authtest

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: GPL-2.0, GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package authtest provides an in-memory implementation of auth.AuthStore for use in consumer tests. It is not intended for production use.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemStore

type MemStore struct {
	// contains filtered or unexported fields
}

MemStore is an in-memory implementation of auth interfaces for testing.

func NewMemStore

func NewMemStore() *MemStore

NewMemStore returns a new empty MemStore.

func (*MemStore) AddAPIKey

func (m *MemStore) AddAPIKey(k *auth.Key)

AddAPIKey adds an API key to the store.

func (*MemStore) AddSession

func (m *MemStore) AddSession(s *auth.Session)

AddSession adds a session to the store.

func (*MemStore) AddUser

func (m *MemStore) AddUser(u *auth.User)

AddUser adds a user to the store and assigns an auto-incremented ID.

func (*MemStore) CreateSession

func (m *MemStore) CreateSession(_ context.Context, s *auth.Session) error

func (*MemStore) DeleteSession

func (m *MemStore) DeleteSession(_ context.Context, tokenHash string) error

func (*MemStore) DeleteUserSessions

func (m *MemStore) DeleteUserSessions(_ context.Context, userID int64, exceptHash string) error

func (*MemStore) GetAPIKeyByHash

func (m *MemStore) GetAPIKeyByHash(_ context.Context, hash string) (*auth.Key, error)

func (*MemStore) GetSessionByHash

func (m *MemStore) GetSessionByHash(_ context.Context, tokenHash string) (*auth.Session, error)

func (*MemStore) GetUserByID

func (m *MemStore) GetUserByID(_ context.Context, id int64) (*auth.User, error)

func (*MemStore) UpdateSessionActivity

func (m *MemStore) UpdateSessionActivity(_ context.Context, tokenHash string, now time.Time) error

Jump to

Keyboard shortcuts

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