Documentation
¶
Index ¶
Constants ¶
const Prefix = "rill"
Prefix is prepended to every auth token.
Variables ¶
var ErrMalformed = errors.New("malformed auth token")
ErrMalformed is used when attempting to parse an invalid token string.
Functions ¶
This section is empty.
Types ¶
type Token ¶
Token is a parsed authentication token with a type, UUID ID, and 24-byte secret. Tokens can be (de)serialized as strings. Example string representation of a user token: rill_usr_2Dws32dc2FxTThgCQjHerGM1rx9pJLCPQh5QbWjUiwpkZNkCCRrlrK.
func FromID ¶ added in v0.78.0
FromID returns a Token with the given type and id, and a zero secret.
func FromString ¶
FromString re-creates a token from it's string representation (acquired by calling String()). The things I do for pretty tokens.
func MatchByPrefix ¶ added in v0.78.0
MatchByPrefix attempts to match a decoded token by its prefix.
func (*Token) Prefix ¶ added in v0.78.0
Prefix returns a safe, partial display string for the token, e.g., "rill_usr_abcdefghij". This works even if t.Secret is empty (all zeroes), as long as t.ID is set.
func (*Token) SecretHash ¶
SecretHash returns a SHA256 hash of the token secret.