authtest

package
v0.2.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package authtest provides in-memory mock implementations of auth store interfaces for testing without a database.

Index

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 (s *MemoryInviteStore) CreateInvite(_ context.Context, email, tokenHash string, expiresAt time.Time, isBootstrap bool) (*auth.Invite, error)

func (*MemoryInviteStore) MarkInviteUsedByHash

func (s *MemoryInviteStore) MarkInviteUsedByHash(_ context.Context, tokenHash string) error

func (*MemoryInviteStore) ValidateInviteByHash

func (s *MemoryInviteStore) ValidateInviteByHash(_ context.Context, tokenHash string) (*auth.Invite, error)

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

func (s *MemoryPasskeyStore) UpdateSignCount(_ context.Context, credentialID []byte, signCount uint32) error

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 (s *MemorySessionStore) CreateSession(_ context.Context, userID, tokenHash string, expiresAt time.Time) (*auth.Session, error)

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

func (s *MemorySessionStore) ValidateSessionByHash(_ context.Context, tokenHash string) (*auth.Session, error)

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 (s *MemoryUserStore) CreateUser(_ context.Context, username, email, displayName string, isAdmin bool) (*auth.User, error)

func (*MemoryUserStore) DeleteUser

func (s *MemoryUserStore) DeleteUser(_ context.Context, id string) error

func (*MemoryUserStore) GetUserByEmail

func (s *MemoryUserStore) GetUserByEmail(_ context.Context, email string) (*auth.User, error)

func (*MemoryUserStore) GetUserByID

func (s *MemoryUserStore) GetUserByID(_ context.Context, id string) (*auth.User, error)

func (*MemoryUserStore) GetUserByUsername

func (s *MemoryUserStore) GetUserByUsername(_ context.Context, username string) (*auth.User, error)

func (*MemoryUserStore) ListUsers

func (s *MemoryUserStore) ListUsers(_ context.Context) ([]*auth.User, error)

func (*MemoryUserStore) SetAdmin

func (s *MemoryUserStore) SetAdmin(_ context.Context, id string, isAdmin bool) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL