Documentation
¶
Index ¶
- type FSAPIKeyStore
- func (s *FSAPIKeyStore) CreateAPIKey(userID, name string, scopes []string, expiresAt *time.Time) (fullKey string, apiKey *oa.APIKey, err error)
- func (s *FSAPIKeyStore) GetAPIKeyByID(keyID string) (*oa.APIKey, error)
- func (s *FSAPIKeyStore) ListUserAPIKeys(userID string) ([]*oa.APIKey, error)
- func (s *FSAPIKeyStore) RevokeAPIKey(keyID string) error
- func (s *FSAPIKeyStore) UpdateAPIKeyLastUsed(keyID string) error
- func (s *FSAPIKeyStore) ValidateAPIKey(fullKey string) (*oa.APIKey, error)
- type FSChannelStore
- type FSIdentityStore
- func (s *FSIdentityStore) GetIdentity(identityType, identityValue string, createIfMissing bool) (*oa.Identity, bool, error)
- func (s *FSIdentityStore) GetUserIdentities(userId string) ([]*oa.Identity, error)
- func (s *FSIdentityStore) MarkIdentityVerified(identityType, identityValue string) error
- func (s *FSIdentityStore) SaveIdentity(identity *oa.Identity) error
- func (s *FSIdentityStore) SetUserForIdentity(identityType, identityValue string, newUserId string) error
- type FSRefreshTokenStore
- func (s *FSRefreshTokenStore) CleanupExpiredTokens() error
- func (s *FSRefreshTokenStore) CreateRefreshToken(userID, clientID string, deviceInfo map[string]any, scopes []string) (*oa.RefreshToken, error)
- func (s *FSRefreshTokenStore) GetRefreshToken(token string) (*oa.RefreshToken, error)
- func (s *FSRefreshTokenStore) GetUserTokens(userID string) ([]*oa.RefreshToken, error)
- func (s *FSRefreshTokenStore) RevokeRefreshToken(token string) error
- func (s *FSRefreshTokenStore) RevokeTokenFamily(family string) error
- func (s *FSRefreshTokenStore) RevokeUserTokens(userID string) error
- func (s *FSRefreshTokenStore) RotateRefreshToken(oldToken string) (*oa.RefreshToken, error)
- type FSTokenStore
- func (s *FSTokenStore) CreateToken(userID, email string, tokenType oa.TokenType, expiryDuration time.Duration) (*oa.AuthToken, error)
- func (s *FSTokenStore) DeleteToken(token string) error
- func (s *FSTokenStore) DeleteUserTokens(userID string, tokenType oa.TokenType) error
- func (s *FSTokenStore) GetToken(token string) (*oa.AuthToken, error)
- type FSUser
- type FSUserStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FSAPIKeyStore ¶
type FSAPIKeyStore struct {
StoragePath string
// contains filtered or unexported fields
}
FSAPIKeyStore stores API keys as JSON files
func NewFSAPIKeyStore ¶
func NewFSAPIKeyStore(storagePath string) *FSAPIKeyStore
NewFSAPIKeyStore creates a new file-based API key store
func (*FSAPIKeyStore) CreateAPIKey ¶
func (s *FSAPIKeyStore) CreateAPIKey(userID, name string, scopes []string, expiresAt *time.Time) (fullKey string, apiKey *oa.APIKey, err error)
CreateAPIKey creates a new API key and returns the full key (only shown once) The key format is: keyID + "_" + secret
func (*FSAPIKeyStore) GetAPIKeyByID ¶
func (s *FSAPIKeyStore) GetAPIKeyByID(keyID string) (*oa.APIKey, error)
GetAPIKeyByID retrieves an API key by its public ID
func (*FSAPIKeyStore) ListUserAPIKeys ¶
func (s *FSAPIKeyStore) ListUserAPIKeys(userID string) ([]*oa.APIKey, error)
ListUserAPIKeys returns all API keys for a user (without secrets)
func (*FSAPIKeyStore) RevokeAPIKey ¶
func (s *FSAPIKeyStore) RevokeAPIKey(keyID string) error
RevokeAPIKey marks an API key as revoked
func (*FSAPIKeyStore) UpdateAPIKeyLastUsed ¶
func (s *FSAPIKeyStore) UpdateAPIKeyLastUsed(keyID string) error
UpdateAPIKeyLastUsed updates the last used timestamp
func (*FSAPIKeyStore) ValidateAPIKey ¶
func (s *FSAPIKeyStore) ValidateAPIKey(fullKey string) (*oa.APIKey, error)
ValidateAPIKey validates a full API key and returns the key metadata if valid The fullKey format is: keyID + "_" + secret
type FSChannelStore ¶
type FSChannelStore struct {
StoragePath string
}
FSChannelStore stores channels as JSON files
func NewFSChannelStore ¶
func NewFSChannelStore(storagePath string) *FSChannelStore
func (*FSChannelStore) GetChannel ¶
func (*FSChannelStore) GetChannelsByIdentity ¶
func (s *FSChannelStore) GetChannelsByIdentity(identityKey string) ([]*oa.Channel, error)
func (*FSChannelStore) SaveChannel ¶
func (s *FSChannelStore) SaveChannel(channel *oa.Channel) error
type FSIdentityStore ¶
type FSIdentityStore struct {
StoragePath string
}
FSIdentityStore stores identities as JSON files
func NewFSIdentityStore ¶
func NewFSIdentityStore(storagePath string) *FSIdentityStore
func (*FSIdentityStore) GetIdentity ¶
func (*FSIdentityStore) GetUserIdentities ¶
func (s *FSIdentityStore) GetUserIdentities(userId string) ([]*oa.Identity, error)
func (*FSIdentityStore) MarkIdentityVerified ¶
func (s *FSIdentityStore) MarkIdentityVerified(identityType, identityValue string) error
func (*FSIdentityStore) SaveIdentity ¶
func (s *FSIdentityStore) SaveIdentity(identity *oa.Identity) error
func (*FSIdentityStore) SetUserForIdentity ¶
func (s *FSIdentityStore) SetUserForIdentity(identityType, identityValue string, newUserId string) error
type FSRefreshTokenStore ¶
type FSRefreshTokenStore struct {
StoragePath string
// contains filtered or unexported fields
}
FSRefreshTokenStore stores refresh tokens as JSON files
func NewFSRefreshTokenStore ¶
func NewFSRefreshTokenStore(storagePath string) *FSRefreshTokenStore
NewFSRefreshTokenStore creates a new file-based refresh token store
func (*FSRefreshTokenStore) CleanupExpiredTokens ¶
func (s *FSRefreshTokenStore) CleanupExpiredTokens() error
CleanupExpiredTokens removes expired tokens (for maintenance)
func (*FSRefreshTokenStore) CreateRefreshToken ¶
func (s *FSRefreshTokenStore) CreateRefreshToken(userID, clientID string, deviceInfo map[string]any, scopes []string) (*oa.RefreshToken, error)
CreateRefreshToken creates a new refresh token for a user
func (*FSRefreshTokenStore) GetRefreshToken ¶
func (s *FSRefreshTokenStore) GetRefreshToken(token string) (*oa.RefreshToken, error)
GetRefreshToken retrieves a refresh token by its value
func (*FSRefreshTokenStore) GetUserTokens ¶
func (s *FSRefreshTokenStore) GetUserTokens(userID string) ([]*oa.RefreshToken, error)
GetUserTokens lists all active (non-revoked, non-expired) refresh tokens for a user
func (*FSRefreshTokenStore) RevokeRefreshToken ¶
func (s *FSRefreshTokenStore) RevokeRefreshToken(token string) error
RevokeRefreshToken marks a token as revoked
func (*FSRefreshTokenStore) RevokeTokenFamily ¶
func (s *FSRefreshTokenStore) RevokeTokenFamily(family string) error
RevokeTokenFamily revokes all tokens in a family (theft detection)
func (*FSRefreshTokenStore) RevokeUserTokens ¶
func (s *FSRefreshTokenStore) RevokeUserTokens(userID string) error
RevokeUserTokens revokes all refresh tokens for a user
func (*FSRefreshTokenStore) RotateRefreshToken ¶
func (s *FSRefreshTokenStore) RotateRefreshToken(oldToken string) (*oa.RefreshToken, error)
RotateRefreshToken invalidates old token and creates new one in same family Returns ErrTokenReused if the old token was already revoked (theft detection)
type FSTokenStore ¶
type FSTokenStore struct {
StoragePath string
}
FSTokenStore stores verification and reset tokens as JSON files
func NewFSTokenStore ¶
func NewFSTokenStore(storagePath string) *FSTokenStore
func (*FSTokenStore) CreateToken ¶
func (*FSTokenStore) DeleteToken ¶
func (s *FSTokenStore) DeleteToken(token string) error
func (*FSTokenStore) DeleteUserTokens ¶
func (s *FSTokenStore) DeleteUserTokens(userID string, tokenType oa.TokenType) error
type FSUser ¶
type FSUser struct {
UserId string `json:"user_id"`
IsActive bool `json:"is_active"`
UserProfile map[string]any `json:"profile"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
FSUser implements the oneauth.User interface
type FSUserStore ¶
type FSUserStore struct {
StoragePath string
}
FSUserStore stores users as JSON files
func NewFSUserStore ¶
func NewFSUserStore(storagePath string) *FSUserStore
func (*FSUserStore) CreateUser ¶
func (*FSUserStore) GetUserById ¶
func (s *FSUserStore) GetUserById(userId string) (oa.User, error)