Documentation ¶
Index ¶
- Constants
- func AbortRequest(c *gin.Context, code int, reason string, err error, log *zap.SugaredLogger)
- func CreateJWTToken(userID uuid.UUID) (string, error)
- func GenerateChallenge(wallet string) (string, error)
- func GetJWTSecret() ([]byte, error)
- func GetTokenFromContext(c *gin.Context) (jwt.Token, error)
- func GetTokenFromRequest(c *gin.Context) string
- func GetUserIDFromContext(c *gin.Context) (uuid.UUID, error)
- func GetUserIDFromToken(token jwt.Token) (uuid.UUID, error)
- func ToUserDTO(userEntry *entry.User, guestUserTypeID uuid.UUID, includeWallet bool) *dto.User
- func ToUserDTOs(userEntries []*entry.User, guestUserTypeID uuid.UUID, includeWallet bool) []*dto.User
- func ValidateJWTWithSecret(signedString string, secret []byte) (*jwt.Token, error)
- func VerifyPolkadotSignature(wallet, challenge, signature string) (bool, error)
- type HTTPError
- type HTTPErrorPayload
Constants ¶
View Source
const (
TokenContextKey = "token"
)
Variables ¶
This section is empty.
Functions ¶
func AbortRequest ¶
func CreateJWTToken ¶
CreateJWTToken saves a jwt token with the given userID as subject and signed with the given secret
func GenerateChallenge ¶
func GetJWTSecret ¶
func GetTokenFromRequest ¶
func ToUserDTOs ¶
func ValidateJWTWithSecret ¶
func VerifyPolkadotSignature ¶
Types ¶
type HTTPError ¶
type HTTPError struct {
Error HTTPErrorPayload `json:"error"`
}
type HTTPErrorPayload ¶
Click to show internal directories.
Click to hide internal directories.