Documentation
¶
Index ¶
- type Store
- func (s *Store) ConfirmTOTPSecret(_ context.Context, userID theauth.ULID, at time.Time) error
- func (s *Store) ConsumeMagicLink(_ context.Context, hash []byte) (*theauth.MagicLink, error)
- func (s *Store) ConsumePasswordResetToken(_ context.Context, hash []byte) (*theauth.PasswordResetToken, error)
- func (s *Store) ConsumeRecoveryCode(_ context.Context, userID theauth.ULID, code string, at time.Time) error
- func (s *Store) CreateMagicLink(_ context.Context, ml theauth.MagicLink) error
- func (s *Store) CreatePasswordResetToken(_ context.Context, t theauth.PasswordResetToken) error
- func (s *Store) CreateSession(_ context.Context, sess theauth.Session) (theauth.Session, error)
- func (s *Store) CreateSessionWithAuthLevel(_ context.Context, sess theauth.Session) (theauth.Session, error)
- func (s *Store) CreateUser(_ context.Context, u theauth.User) (theauth.User, error)
- func (s *Store) DeleteTOTPSecret(_ context.Context, userID theauth.ULID) error
- func (s *Store) DeleteWebAuthnCredential(_ context.Context, id theauth.ULID, userID theauth.ULID) error
- func (s *Store) InsertRecoveryCodes(_ context.Context, codes []theauth.RecoveryCode) error
- func (s *Store) InsertWebAuthnCredential(_ context.Context, c theauth.WebAuthnCredential) (theauth.WebAuthnCredential, error)
- func (s *Store) MarkEmailVerified(_ context.Context, userID theauth.ULID) error
- func (s *Store) OAuthAccountByProviderUserID(_ context.Context, provider, providerUserID string) (*theauth.OAuthAccount, error)
- func (s *Store) RevokeSession(_ context.Context, id theauth.ULID) error
- func (s *Store) RevokeUserSessions(_ context.Context, userID theauth.ULID) error
- func (s *Store) SessionByTokenHash(_ context.Context, hash []byte) (*theauth.Session, error)
- func (s *Store) SetUserPassword(_ context.Context, userID theauth.ULID, passwordHash string) error
- func (s *Store) TOTPSecretByUserID(_ context.Context, userID theauth.ULID) (*theauth.TOTPSecret, error)
- func (s *Store) UpdateSessionAuthLevel(_ context.Context, id theauth.ULID, level string) error
- func (s *Store) UpdateWebAuthnSignCount(_ context.Context, credentialID []byte, newCount uint32, usedAt time.Time) error
- func (s *Store) UpsertOAuthAccount(_ context.Context, a theauth.OAuthAccount) (theauth.OAuthAccount, error)
- func (s *Store) UpsertPendingTOTPSecret(_ context.Context, sec theauth.TOTPSecret) error
- func (s *Store) UserByEmail(_ context.Context, email string) (*theauth.User, error)
- func (s *Store) UserByEmailWithPassword(_ context.Context, email string) (*theauth.User, string, error)
- func (s *Store) UserByID(_ context.Context, id theauth.ULID) (*theauth.User, error)
- func (s *Store) WebAuthnCredentialByCredentialID(_ context.Context, credentialID []byte) (*theauth.WebAuthnCredential, error)
- func (s *Store) WebAuthnCredentialsByUserID(_ context.Context, userID theauth.ULID) ([]theauth.WebAuthnCredential, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) ConfirmTOTPSecret ¶ added in v0.5.0
func (*Store) ConsumeMagicLink ¶
func (*Store) ConsumePasswordResetToken ¶ added in v0.2.0
func (*Store) ConsumeRecoveryCode ¶ added in v0.5.0
func (s *Store) ConsumeRecoveryCode(_ context.Context, userID theauth.ULID, code string, at time.Time) error
ConsumeRecoveryCode walks the user's unused codes and constant-time-checks each against the supplied plaintext. The first hit is marked used and returns nil. No match returns ErrNotFound. Matches the Postgres semantics (linear scan over the per-user slice is fine because N is bounded by RecoveryCodeCount, defaulting to 10).
func (*Store) CreateMagicLink ¶
func (*Store) CreatePasswordResetToken ¶ added in v0.2.0
func (*Store) CreateSession ¶
func (*Store) CreateSessionWithAuthLevel ¶ added in v0.5.0
func (s *Store) CreateSessionWithAuthLevel(_ context.Context, sess theauth.Session) (theauth.Session, error)
CreateSessionWithAuthLevel is identical to CreateSession but honors the AuthLevel field explicitly (defaulting to AuthLevelFull when blank for safety). Service code uses this path when minting a pending_2fa session.
func (*Store) CreateUser ¶
func (*Store) DeleteTOTPSecret ¶ added in v0.5.0
func (*Store) DeleteWebAuthnCredential ¶ added in v0.5.0
func (*Store) InsertRecoveryCodes ¶ added in v0.5.0
func (*Store) InsertWebAuthnCredential ¶ added in v0.5.0
func (s *Store) InsertWebAuthnCredential(_ context.Context, c theauth.WebAuthnCredential) (theauth.WebAuthnCredential, error)
func (*Store) MarkEmailVerified ¶
func (*Store) OAuthAccountByProviderUserID ¶ added in v0.3.0
func (*Store) RevokeSession ¶
func (*Store) RevokeUserSessions ¶
func (*Store) SessionByTokenHash ¶
func (*Store) SetUserPassword ¶ added in v0.2.0
func (*Store) TOTPSecretByUserID ¶ added in v0.5.0
func (*Store) UpdateSessionAuthLevel ¶ added in v0.5.0
UpdateSessionAuthLevel rewrites the AuthLevel column on the named session. Used to promote pending_2fa to full after a successful TOTP verify.
func (*Store) UpdateWebAuthnSignCount ¶ added in v0.5.0
func (*Store) UpsertOAuthAccount ¶ added in v0.3.0
func (s *Store) UpsertOAuthAccount(_ context.Context, a theauth.OAuthAccount) (theauth.OAuthAccount, error)
UpsertOAuthAccount mirrors the Postgres ON CONFLICT (provider, provider_user_id) DO UPDATE behavior: if a row with the same (provider, provider_user_id) already exists, its mutable fields are refreshed in place (keeping the original ID + CreatedAt). Otherwise the supplied row is inserted as-is.