Documentation
¶
Overview ¶
Package defaultstore implements the SQL-backed default store for the totp plugin.
Index ¶
- type DefaultTOTPStore
- func (s *DefaultTOTPStore) DeleteSessionVerification(ctx context.Context, sessionID string) error
- func (s *DefaultTOTPStore) DeleteUserSessionVerifications(ctx context.Context, userID string) error
- func (s *DefaultTOTPStore) GetCredential(ctx context.Context, userID string) (totptypes.Credential, error)
- func (s *DefaultTOTPStore) IsSessionVerified(ctx context.Context, sessionID, userID string, since time.Time) (bool, error)
- func (s *DefaultTOTPStore) MarkSessionVerified(ctx context.Context, sessionID, userID string, at time.Time) error
- func (s *DefaultTOTPStore) SetCredential(ctx context.Context, userID string, secret *string, enabled bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultTOTPStore ¶
type DefaultTOTPStore struct {
// contains filtered or unexported fields
}
DefaultTOTPStore implements totptypes.Store using a SQL database.
Supports PostgreSQL, MySQL, and SQLite through dialect-specific sqlc-generated queries. Safe for concurrent use.
func NewDefaultTOTPStore ¶
NewDefaultTOTPStore creates a DefaultTOTPStore for the given dialect. The dialect switch happens exactly once here; all store methods call through the querier interface and are dialect-agnostic.
func (*DefaultTOTPStore) DeleteSessionVerification ¶
func (s *DefaultTOTPStore) DeleteSessionVerification(ctx context.Context, sessionID string) error
DeleteSessionVerification clears one session's verification.
func (*DefaultTOTPStore) DeleteUserSessionVerifications ¶
func (s *DefaultTOTPStore) DeleteUserSessionVerifications(ctx context.Context, userID string) error
DeleteUserSessionVerifications clears every session verification for a user.
func (*DefaultTOTPStore) GetCredential ¶
func (s *DefaultTOTPStore) GetCredential(ctx context.Context, userID string) (totptypes.Credential, error)
GetCredential returns the user's TOTP credential.
func (*DefaultTOTPStore) IsSessionVerified ¶
func (s *DefaultTOTPStore) IsSessionVerified(ctx context.Context, sessionID, userID string, since time.Time) (bool, error)
IsSessionVerified reports whether the session was verified after since.
func (*DefaultTOTPStore) MarkSessionVerified ¶
func (s *DefaultTOTPStore) MarkSessionVerified(ctx context.Context, sessionID, userID string, at time.Time) error
MarkSessionVerified records a verified session.
func (*DefaultTOTPStore) SetCredential ¶
func (s *DefaultTOTPStore) SetCredential(ctx context.Context, userID string, secret *string, enabled bool) error
SetCredential writes the credential; a nil secret clears it.