Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidToken = errors.New("invalid API token") ErrTokenNotFound = errors.New("API token not found") )
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store persists hashed API tokens in one private JSON file.
func (*Store) Authenticate ¶
Authenticate validates a raw API token.
type Token ¶
type Token struct {
ID string `json:"id"`
Name string `json:"name"`
Hash string `json:"hash,omitempty"`
Scopes []string `json:"scopes"`
CreatedAt time.Time `json:"createdAt"`
ExpiresAt *time.Time `json:"expiresAt,omitempty"`
RevokedAt *time.Time `json:"revokedAt,omitempty"`
}
Token describes one API token without exposing its secret value.
Click to show internal directories.
Click to hide internal directories.