Versions in this module Expand all Collapse all v0 v0.1.0 Aug 20, 2026 Changes in this version + const DefaultChallengeTTL + const DriverName + var ErrChallengeNotFound = errors.New("sulis/postgres: challenge not found") + var ErrTOTPCounterRegressed = errors.New("sulis/postgres: TOTP counter would regress") + var Schema string + func Migrate(ctx context.Context, db *sql.DB) error + func SearchPathDSN(dsn, schema string) (string, error) + type ChallengeStore struct + TTL time.Duration + func (s *ChallengeStore) ConsumeChallenge(ctx context.Context, key string) ([]byte, error) + func (s *ChallengeStore) DeleteExpiredChallenges(ctx context.Context) error + func (s *ChallengeStore) SaveChallenge(ctx context.Context, key string, sessionData []byte) error + type DB struct + func New(db *sql.DB) *DB + func Open(ctx context.Context, dsn string) (*DB, error) + func (d *DB) ChallengeStore() *ChallengeStore + func (d *DB) Close() error + func (d *DB) PasskeyStore() *PasskeyStore + func (d *DB) RecoveryStore() *RecoveryStore + func (d *DB) SQL() *sql.DB + func (d *DB) SessionStore() *SessionStore + func (d *DB) TOTPStore() *TOTPStore + func (d *DB) TokenStore() *TokenStore + func (d *DB) UserStore() *UserStore + type PasskeyStore struct + func (s *PasskeyStore) DeleteCredential(ctx context.Context, userID, id string, allowLast bool) error + func (s *PasskeyStore) DeleteCredentialsByUserID(ctx context.Context, userID string) error + func (s *PasskeyStore) GetCredentialByID(ctx context.Context, credentialID []byte) (*passkey.Credential, error) + func (s *PasskeyStore) GetCredentialsByUserID(ctx context.Context, userID string) ([]passkey.Credential, error) + func (s *PasskeyStore) RenameCredential(ctx context.Context, id, name string) error + func (s *PasskeyStore) SaveCredential(ctx context.Context, cred *passkey.Credential) error + func (s *PasskeyStore) UpdateCredentialAfterLogin(ctx context.Context, credentialID []byte, signCount uint32, backupState bool, ...) error + type RecoveryStore struct + func (s *RecoveryStore) ConsumeCode(ctx context.Context, userID, hash string) error + func (s *RecoveryStore) CountCodes(ctx context.Context, userID string) (int, error) + func (s *RecoveryStore) DeleteCodes(ctx context.Context, userID string) error + func (s *RecoveryStore) ReplaceCodes(ctx context.Context, userID string, hashes []string) error + type SessionStore struct + func (s *SessionStore) CleanExpired(ctx context.Context) error + func (s *SessionStore) CreateSession(ctx context.Context, session *sulis.Session) error + func (s *SessionStore) DeleteSession(ctx context.Context, userID, id string) error + func (s *SessionStore) DeleteUserSessions(ctx context.Context, userID string) error + func (s *SessionStore) DeleteUserSessionsExcept(ctx context.Context, userID, keepSessionID string) error + func (s *SessionStore) GetSessionByTokenHash(ctx context.Context, tokenHash string) (*sulis.Session, error) + func (s *SessionStore) ListUserSessions(ctx context.Context, userID string) ([]sulis.Session, error) + func (s *SessionStore) TouchSession(ctx context.Context, id string, lastSeen time.Time, idleExpires *time.Time) error + func (s *SessionStore) UpdateAuthenticatedAt(ctx context.Context, id string, at time.Time) error + type TOTPStore struct + func (s *TOTPStore) ConfirmEnrollment(ctx context.Context, userID, pendingID string, counter uint64) (*totp.Credential, error) + func (s *TOTPStore) DeleteTOTP(ctx context.Context, userID string) error + func (s *TOTPStore) EnrollPending(ctx context.Context, cred *totp.Credential) error + func (s *TOTPStore) GetActiveTOTP(ctx context.Context, userID string) (*totp.Credential, error) + func (s *TOTPStore) GetPendingTOTP(ctx context.Context, userID string) (*totp.Credential, error) + func (s *TOTPStore) ReplacePending(ctx context.Context, cred *totp.Credential) error + func (s *TOTPStore) SaveTOTP(ctx context.Context, cred *totp.Credential) error + type TokenStore struct + func (s *TokenStore) ConsumeToken(ctx context.Context, hash string, purpose sulis.TokenPurpose) (*sulis.Token, error) + func (s *TokenStore) CreateToken(ctx context.Context, token *sulis.Token) error + func (s *TokenStore) DeleteExpiredTokens(ctx context.Context) error + func (s *TokenStore) DeleteUserTokens(ctx context.Context, userID string, purpose sulis.TokenPurpose) error + type UserStore struct + func (s *UserStore) CreateUser(ctx context.Context, user *sulis.User) error + func (s *UserStore) DeleteUser(ctx context.Context, id string) error + func (s *UserStore) GetUserByEmail(ctx context.Context, email string) (*sulis.User, error) + func (s *UserStore) GetUserByID(ctx context.Context, id string) (*sulis.User, error) + func (s *UserStore) UpdateUser(ctx context.Context, user *sulis.User) error