Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrKeyLength return when specified key not equal 512 bit, or 64 bytes ErrKeyLength = errors.New("Length of the specified key not equal 512 bits, or 64 bytes") // ErrCorruptedToken return when specified JWT in user request does't have one or more requered parts of JWT // JWT must contain header, payload and signature separated by dot ErrCorruptedToken = errors.New("Your JWT is corrupted and/or does't match the required") // ErrTokenExpired return when token has expired ErrTokenExpired = errors.New("Your token has expired") )
Functions ¶
func GenerateNewToken ¶
GenerateNewToken generate and return new JWT
func ValidateToken ¶
ValidateToken check validity of the JWT
Types ¶
type Payload ¶
type Payload struct { UUID string IsAdmin bool `json:"is_admin"` Roles []Role AuthRooms []AuthRoom `json:"auth_rooms"` Exp int64 }
Payload information in JWT about user
func UnmarshalPayload ¶
UnmarshalPayload unmarshal payload from token and return it
func (Payload) CheckAuthStatus ¶
CheckAuthStatus check auth status in room
func (*Payload) SetAuthStatus ¶
SetAuthStatus set up new auth session for a room
Click to show internal directories.
Click to hide internal directories.