Documentation
¶
Overview ¶
Package authtest provides in-memory mock implementations of auth store interfaces for testing without a database.
Index ¶
- type MemoryInviteStore
- func (s *MemoryInviteStore) CleanExpiredInvites(_ context.Context) error
- func (s *MemoryInviteStore) CreateInvite(_ context.Context, email, tokenHash string, expiresAt time.Time, ...) (*auth.Invite, error)
- func (s *MemoryInviteStore) MarkInviteUsedByHash(_ context.Context, tokenHash string) error
- func (s *MemoryInviteStore) ValidateInviteByHash(_ context.Context, tokenHash string) (*auth.Invite, error)
- type MemoryPasskeyStore
- func (s *MemoryPasskeyStore) DeletePasskey(_ context.Context, credentialID []byte) error
- func (s *MemoryPasskeyStore) GetUserPasskeys(_ context.Context, userID string) ([]webauthn.Credential, error)
- func (s *MemoryPasskeyStore) SavePasskey(_ context.Context, userID string, credential *webauthn.Credential, ...) error
- func (s *MemoryPasskeyStore) UpdateSignCount(_ context.Context, credentialID []byte, signCount uint32) error
- type MemorySessionStore
- func (s *MemorySessionStore) CleanExpiredSessions(_ context.Context) error
- func (s *MemorySessionStore) CreateSession(_ context.Context, userID, tokenHash string, expiresAt time.Time) (*auth.Session, error)
- func (s *MemorySessionStore) DeleteSessionByHash(_ context.Context, tokenHash string) error
- func (s *MemorySessionStore) DeleteUserSessions(_ context.Context, userID string) error
- func (s *MemorySessionStore) ValidateSessionByHash(_ context.Context, tokenHash string) (*auth.Session, error)
- type MemoryUserStore
- func (s *MemoryUserStore) CreateUser(_ context.Context, username, email, displayName string, isAdmin bool) (*auth.User, error)
- func (s *MemoryUserStore) DeleteUser(_ context.Context, id string) error
- func (s *MemoryUserStore) GetUserByEmail(_ context.Context, email string) (*auth.User, error)
- func (s *MemoryUserStore) GetUserByID(_ context.Context, id string) (*auth.User, error)
- func (s *MemoryUserStore) GetUserByUsername(_ context.Context, username string) (*auth.User, error)
- func (s *MemoryUserStore) ListUsers(_ context.Context) ([]*auth.User, error)
- func (s *MemoryUserStore) SetAdmin(_ context.Context, id string, isAdmin bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MemoryInviteStore ¶
type MemoryInviteStore struct {
// contains filtered or unexported fields
}
MemoryInviteStore is an in-memory implementation of auth.InviteStore.
func NewMemoryInviteStore ¶
func NewMemoryInviteStore() *MemoryInviteStore
func (*MemoryInviteStore) CleanExpiredInvites ¶
func (s *MemoryInviteStore) CleanExpiredInvites(_ context.Context) error
func (*MemoryInviteStore) CreateInvite ¶
func (*MemoryInviteStore) MarkInviteUsedByHash ¶
func (s *MemoryInviteStore) MarkInviteUsedByHash(_ context.Context, tokenHash string) error
func (*MemoryInviteStore) ValidateInviteByHash ¶
type MemoryPasskeyStore ¶
type MemoryPasskeyStore struct {
// contains filtered or unexported fields
}
MemoryPasskeyStore is an in-memory implementation of auth.PasskeyStore.
func NewMemoryPasskeyStore ¶
func NewMemoryPasskeyStore() *MemoryPasskeyStore
func (*MemoryPasskeyStore) DeletePasskey ¶
func (s *MemoryPasskeyStore) DeletePasskey(_ context.Context, credentialID []byte) error
func (*MemoryPasskeyStore) GetUserPasskeys ¶
func (s *MemoryPasskeyStore) GetUserPasskeys(_ context.Context, userID string) ([]webauthn.Credential, error)
func (*MemoryPasskeyStore) SavePasskey ¶
func (s *MemoryPasskeyStore) SavePasskey(_ context.Context, userID string, credential *webauthn.Credential, deviceName string) error
func (*MemoryPasskeyStore) UpdateSignCount ¶
type MemorySessionStore ¶
type MemorySessionStore struct {
// contains filtered or unexported fields
}
MemorySessionStore is an in-memory implementation of auth.SessionStore.
func NewMemorySessionStore ¶
func NewMemorySessionStore() *MemorySessionStore
func (*MemorySessionStore) CleanExpiredSessions ¶
func (s *MemorySessionStore) CleanExpiredSessions(_ context.Context) error
func (*MemorySessionStore) CreateSession ¶
func (*MemorySessionStore) DeleteSessionByHash ¶
func (s *MemorySessionStore) DeleteSessionByHash(_ context.Context, tokenHash string) error
func (*MemorySessionStore) DeleteUserSessions ¶
func (s *MemorySessionStore) DeleteUserSessions(_ context.Context, userID string) error
func (*MemorySessionStore) ValidateSessionByHash ¶
type MemoryUserStore ¶
type MemoryUserStore struct {
// contains filtered or unexported fields
}
MemoryUserStore is an in-memory implementation of auth.UserStore.
func NewMemoryUserStore ¶
func NewMemoryUserStore() *MemoryUserStore
func (*MemoryUserStore) CreateUser ¶
func (*MemoryUserStore) DeleteUser ¶
func (s *MemoryUserStore) DeleteUser(_ context.Context, id string) error
func (*MemoryUserStore) GetUserByEmail ¶
func (*MemoryUserStore) GetUserByID ¶
func (*MemoryUserStore) GetUserByUsername ¶
Click to show internal directories.
Click to hide internal directories.