Versions in this module Expand all Collapse all v1 v1.1.0 May 8, 2024 v1.0.0 May 5, 2023 Changes in this version + const HintChars + var ErrKeySize = errors.New("key size invalid") + type Header struct + Name string + Value string + type Headers []Header + func (headers *Headers) Scan(value any) error + func (headers Headers) Value() (driver.Value, error) + func (headers Headers) With(name, value string) Headers + func (headers Headers) Without(name string) Headers + type Key [keyIDSize + keyDataSize]byte + func NewKey() (Key, error) + func ParseToken(value string) (key Key, err error) + func (rt Key) Hash() []byte + func (rt Key) ID() KeyID + func (rt Key) Payload() []byte + func (rt Key) String() string + type KeyID [keyIDSize]byte + func (kid *KeyID) Scan(value any) error + func (kid KeyID) String() string + func (kid KeyID) Value() (driver.Value, error) + type Storage interface + CreateToken func(ctx context.Context, params TokenParams) error + DeleteToken func(ctx context.Context, ref TokenRef) error + FindToken func(ctx context.Context, id KeyID) (*Token, error) + GetToken func(ctx context.Context, ref TokenRef) (*Token, error) + ListTokens func(ctx context.Context, user string) ([]*Token, error) + UpdateTokenConfig func(ctx context.Context, ref TokenRef, config TokenConfig) error + UpdateTokenKey func(ctx context.Context, ref TokenRef, key Key) error + UpdateTokensStats func(ctx context.Context, stats []TokenStat) error + type Token struct + CreatedAt time.Time + Hash []byte + Headers Headers + ID int64 + KeyID KeyID + Label string + LastAccessAt time.Time + Path string + Requests int64 + UpdatedAt time.Time + User string + func (t *Token) Hint() string + func (t *Token) Valid(path string, payload []byte) bool + type TokenConfig struct + Headers Headers + Label string + Path string + type TokenParams struct + Config TokenConfig + Key Key + User string + type TokenRef struct + ID int64 + User string + type TokenStat struct + Hits int64 + Last time.Time + Token int64