Documentation ¶
Index ¶
Constants ¶
View Source
const ( // UserPrefix is a common prefix for every user_id caveat UserPrefix = "user_id = " // TimePrefix is a common prefix for every expiry caveat TimePrefix = "time < " // Gen is a common caveat for every token Gen = "gen = 1" )
Variables ¶
This section is empty.
Functions ¶
func GenerateLoginToken ¶
func GenerateLoginToken(op TokenOptions) (string, error)
GenerateLoginToken generates a short term login token to be used as token authentication ("m.login.token")
func GetUserFromToken ¶
GetUserFromToken returns the user associated with the token Returns the error if something goes wrong. Warning: Does not validate the token. Use ValidateToken for that.
func ValidateToken ¶
func ValidateToken(op TokenOptions, token string) error
ValidateToken validates that the Token is understood and was signed by this server. Returns nil if token is valid, otherwise returns a error.
Types ¶
Click to show internal directories.
Click to hide internal directories.