Documentation
¶
Index ¶
- Constants
- func ReadFile(filename string) ([]byte, error)
- type ApiKey
- type DBUser
- func (c *DBUser) ActivateUser(userId string) error
- func (c *DBUser) CheckUserIdentifierExists(userIdentifier string) (bool, error)
- func (c *DBUser) Close() error
- func (c *DBUser) CreateUser(userId, secureHash, userIdentifier, apiKeyFirstLetters string, ...) error
- func (c *DBUser) CreateUserWithKey(userId, apiKeyFirstLetters string, weakHash [sha256.Size]byte, ...) error
- func (c *DBUser) DeactivateUser(userId string, revokeKey bool) error
- func (c *DBUser) DeleteUser(userId string) error
- func (c *DBUser) GetUsers(userIds ...string) (map[string]*User, error)
- func (c *DBUser) IsBlockedKey(token string) bool
- func (c *DBUser) Restore(snapshot []byte) error
- func (c *DBUser) RotateKey(userId, apiKeyFirstLetters, secureHash, oldIdentifier, newIdentifier string) error
- func (c *DBUser) Snapshot() ([]byte, error)
- func (c *DBUser) UpdateLastUsedTimestamp(users map[string]time.Time)
- func (c *DBUser) ValidateAndExtract(key, userIdentifier string) (*models.Principal, error)
- func (c *DBUser) ValidateImportedKey(token string) (*models.Principal, error)
- type DBUserSnapshot
- type DBUsers
- type RemoteApiKey
- type StaticApiKey
- type User
- type UserStatusRequest
- type UserStatusResponse
Constants ¶
View Source
const ( SnapshotVersion = 0 FileName = "users.json" UserNameMaxLength = 128 UserNameRegexCore = `[A-Za-z][-_0-9A-Za-z@.]{0,128}` )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ApiKey ¶ added in v1.30.0
type ApiKey struct {
Dynamic *DBUser
// contains filtered or unexported fields
}
type DBUser ¶ added in v1.30.0
type DBUser struct {
// contains filtered or unexported fields
}
func (*DBUser) ActivateUser ¶ added in v1.30.0
func (*DBUser) CheckUserIdentifierExists ¶ added in v1.30.0
func (*DBUser) CreateUser ¶ added in v1.30.0
func (*DBUser) CreateUserWithKey ¶ added in v1.30.10
func (*DBUser) DeactivateUser ¶ added in v1.30.0
func (*DBUser) DeleteUser ¶ added in v1.30.0
func (*DBUser) IsBlockedKey ¶ added in v1.30.10
func (*DBUser) UpdateLastUsedTimestamp ¶ added in v1.30.1
func (*DBUser) ValidateAndExtract ¶ added in v1.30.0
type DBUserSnapshot ¶ added in v1.30.0
type DBUserSnapshot struct {
Data dbUserdata
Version int
}
type DBUsers ¶ added in v1.30.0
type DBUsers interface {
CreateUser(userId, secureHash, userIdentifier, apiKeyFirstLetters string, createdAt time.Time) error
CreateUserWithKey(userId, apiKeyFirstLetters string, weakHash [sha256.Size]byte, createdAt time.Time) error
DeleteUser(userId string) error
ActivateUser(userId string) error
DeactivateUser(userId string, revokeKey bool) error
GetUsers(userIds ...string) (map[string]*User, error)
RotateKey(userId, apiKeyFirstLetters, secureHash, oldIdentifier, newIdentifier string) error
CheckUserIdentifierExists(userIdentifier string) (bool, error)
}
type RemoteApiKey ¶ added in v1.30.1
type RemoteApiKey struct {
// contains filtered or unexported fields
}
func NewRemoteApiKey ¶ added in v1.30.1
func NewRemoteApiKey(apikey *ApiKey) *RemoteApiKey
func (*RemoteApiKey) GetUserStatus ¶ added in v1.30.1
func (r *RemoteApiKey) GetUserStatus(ctx context.Context, users UserStatusRequest) (*UserStatusResponse, error)
type StaticApiKey ¶ added in v1.30.0
type StaticApiKey struct {
// contains filtered or unexported fields
}
func (*StaticApiKey) ValidateAndExtract ¶ added in v1.30.0
type UserStatusRequest ¶ added in v1.30.1
type UserStatusResponse ¶ added in v1.30.1
Click to show internal directories.
Click to hide internal directories.