Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidLength is returned when a token's data is an invalid length. ErrInvalidLength = errors.New("invalid length") // ErrSaltEmpty is returned when a token's data is an invalid length. ErrSaltEmpty = errors.New("salt empty") )
Functions ¶
This section is empty.
Types ¶
type Kind ¶
type Kind int64
Kind represents the kind of model to encode a token for.
const ( // KindInstance is a token that represents a federated social instance. KindInstance Kind = 1 + iota // KindAccount is a token that represents a federated social account. KindAccount // KindBlock is a token that represents a blocked federated social instance. KindBlock )
This order can not change else all external urls with tokens will become invalid.
type Tokenizer ¶
type Tokenizer struct {
// contains filtered or unexported fields
}
Tokenizer generates public tokens for database IDs to obfuscate the database IDs.
func (*Tokenizer) DecodeToken ¶
DecodeToken returns the kind and id number of a provided token.
func (*Tokenizer) EncodeToken ¶
EncodeToken turns a model kind and id into a token.
Click to show internal directories.
Click to hide internal directories.