memstore

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package memstore is a reference in-memory implementation of every interface in the store package. It is safe for concurrent use. It exists so authit is usable and testable with zero external dependencies; host applications that need durability implement the same interfaces against their own database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeviceAuthorizationStore

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

DeviceAuthorizationStore is an in-memory store.DeviceAuthorizationStore.

func NewDeviceAuthorizationStore

func NewDeviceAuthorizationStore() *DeviceAuthorizationStore

func (*DeviceAuthorizationStore) CreateDeviceAuthorization

func (s *DeviceAuthorizationStore) CreateDeviceAuthorization(_ context.Context, d *store.DeviceAuthorization) error

func (*DeviceAuthorizationStore) DeleteDeviceAuthorization

func (s *DeviceAuthorizationStore) DeleteDeviceAuthorization(_ context.Context, id string) error

func (*DeviceAuthorizationStore) GetDeviceAuthorizationByDeviceCodeHash

func (s *DeviceAuthorizationStore) GetDeviceAuthorizationByDeviceCodeHash(_ context.Context, hash string) (*store.DeviceAuthorization, error)

func (*DeviceAuthorizationStore) GetDeviceAuthorizationByUserCode

func (s *DeviceAuthorizationStore) GetDeviceAuthorizationByUserCode(_ context.Context, userCode string) (*store.DeviceAuthorization, error)

func (*DeviceAuthorizationStore) UpdateDeviceAuthorization

func (s *DeviceAuthorizationStore) UpdateDeviceAuthorization(_ context.Context, d *store.DeviceAuthorization) error

type EmailVerificationStore

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

EmailVerificationStore is an in-memory store.EmailVerificationStore.

func NewEmailVerificationStore

func NewEmailVerificationStore() *EmailVerificationStore

func (*EmailVerificationStore) CreateEmailVerificationToken

func (s *EmailVerificationStore) CreateEmailVerificationToken(_ context.Context, t *store.EmailVerificationToken) error

func (*EmailVerificationStore) DeleteUserEmailVerificationTokens

func (s *EmailVerificationStore) DeleteUserEmailVerificationTokens(_ context.Context, userID string) error

func (*EmailVerificationStore) GetEmailVerificationTokenByHash

func (s *EmailVerificationStore) GetEmailVerificationTokenByHash(_ context.Context, hash string) (*store.EmailVerificationToken, error)

func (*EmailVerificationStore) MarkEmailVerificationTokenUsed

func (s *EmailVerificationStore) MarkEmailVerificationTokenUsed(_ context.Context, id string) error

type InvitationStore

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

InvitationStore is an in-memory store.InvitationStore.

func NewInvitationStore

func NewInvitationStore() *InvitationStore

func (*InvitationStore) CreateInvitation

func (s *InvitationStore) CreateInvitation(_ context.Context, i *store.Invitation) error

func (*InvitationStore) GetInvitation

func (s *InvitationStore) GetInvitation(_ context.Context, id string) (*store.Invitation, error)

func (*InvitationStore) GetInvitationByTokenHash

func (s *InvitationStore) GetInvitationByTokenHash(_ context.Context, hash string) (*store.Invitation, error)

func (*InvitationStore) ListInvitationsByTeam

func (s *InvitationStore) ListInvitationsByTeam(_ context.Context, teamID string) ([]*store.Invitation, error)

func (*InvitationStore) UpdateInvitation

func (s *InvitationStore) UpdateInvitation(_ context.Context, i *store.Invitation) error

type LockoutStore

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

LockoutStore is an in-memory store.LockoutStore, shared by the user and superuser planes (they key lockouts by their own IDs/emails, which never collide across planes in practice since a host application uses separate instances per plane).

func NewLockoutStore

func NewLockoutStore() *LockoutStore

func (*LockoutStore) ClearFailedLoginAttempts

func (s *LockoutStore) ClearFailedLoginAttempts(_ context.Context, email string) error

func (*LockoutStore) CountRecentFailedLoginAttempts

func (s *LockoutStore) CountRecentFailedLoginAttempts(_ context.Context, email string, since time.Time) (int, error)

func (*LockoutStore) IsAccountLocked

func (s *LockoutStore) IsAccountLocked(_ context.Context, userID string) (bool, error)

func (*LockoutStore) LockAccount

func (s *LockoutStore) LockAccount(_ context.Context, userID string) error

func (*LockoutStore) RecordFailedLoginAttempt

func (s *LockoutStore) RecordFailedLoginAttempt(_ context.Context, a *store.FailedLoginAttempt) error

func (*LockoutStore) UnlockAccount

func (s *LockoutStore) UnlockAccount(_ context.Context, userID string) error

type MemberStore

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

MemberStore is an in-memory store.MemberStore.

func NewMemberStore

func NewMemberStore() *MemberStore

func (*MemberStore) CreateMember

func (s *MemberStore) CreateMember(_ context.Context, m *store.Member) error

func (*MemberStore) DeleteMember

func (s *MemberStore) DeleteMember(_ context.Context, id string) error

func (*MemberStore) GetMember

func (s *MemberStore) GetMember(_ context.Context, id string) (*store.Member, error)

func (*MemberStore) GetMemberByUserAndTeam

func (s *MemberStore) GetMemberByUserAndTeam(_ context.Context, userID, teamID string) (*store.Member, error)

func (*MemberStore) ListMembersByTeam

func (s *MemberStore) ListMembersByTeam(_ context.Context, teamID string) ([]*store.Member, error)

func (*MemberStore) ListMembershipsByUser

func (s *MemberStore) ListMembershipsByUser(_ context.Context, userID string) ([]*store.Member, error)

func (*MemberStore) UpdateMember

func (s *MemberStore) UpdateMember(_ context.Context, m *store.Member) error

type PasswordResetStore

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

PasswordResetStore is an in-memory store.PasswordResetStore.

func NewPasswordResetStore

func NewPasswordResetStore() *PasswordResetStore

func (*PasswordResetStore) CreatePasswordResetToken

func (s *PasswordResetStore) CreatePasswordResetToken(_ context.Context, t *store.PasswordResetToken) error

func (*PasswordResetStore) DeleteUserPasswordResetTokens

func (s *PasswordResetStore) DeleteUserPasswordResetTokens(_ context.Context, userID string) error

func (*PasswordResetStore) GetPasswordResetTokenByHash

func (s *PasswordResetStore) GetPasswordResetTokenByHash(_ context.Context, hash string) (*store.PasswordResetToken, error)

func (*PasswordResetStore) MarkPasswordResetTokenUsed

func (s *PasswordResetStore) MarkPasswordResetTokenUsed(_ context.Context, id string) error

type PendingTwoFactorStore

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

PendingTwoFactorStore is an in-memory store.PendingTwoFactorStore.

func NewPendingTwoFactorStore

func NewPendingTwoFactorStore() *PendingTwoFactorStore

func (*PendingTwoFactorStore) CreatePendingTwoFactorSession

func (s *PendingTwoFactorStore) CreatePendingTwoFactorSession(_ context.Context, sess *store.PendingTwoFactorSession) error

func (*PendingTwoFactorStore) DeletePendingTwoFactorSession

func (s *PendingTwoFactorStore) DeletePendingTwoFactorSession(_ context.Context, id string) error

func (*PendingTwoFactorStore) GetPendingTwoFactorSessionByHash

func (s *PendingTwoFactorStore) GetPendingTwoFactorSessionByHash(_ context.Context, hash string) (*store.PendingTwoFactorSession, error)

type PersonalAccessTokenStore

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

PersonalAccessTokenStore is an in-memory store.PersonalAccessTokenStore.

func NewPersonalAccessTokenStore

func NewPersonalAccessTokenStore() *PersonalAccessTokenStore

func (*PersonalAccessTokenStore) CreatePersonalAccessToken

func (s *PersonalAccessTokenStore) CreatePersonalAccessToken(_ context.Context, t *store.PersonalAccessToken) error

func (*PersonalAccessTokenStore) GetPersonalAccessToken

func (s *PersonalAccessTokenStore) GetPersonalAccessToken(_ context.Context, id string) (*store.PersonalAccessToken, error)

func (*PersonalAccessTokenStore) GetPersonalAccessTokenByHash

func (s *PersonalAccessTokenStore) GetPersonalAccessTokenByHash(_ context.Context, hash string) (*store.PersonalAccessToken, error)

func (*PersonalAccessTokenStore) ListPersonalAccessTokensByUser

func (s *PersonalAccessTokenStore) ListPersonalAccessTokensByUser(_ context.Context, userID string) ([]*store.PersonalAccessToken, error)

func (*PersonalAccessTokenStore) UpdatePersonalAccessToken

func (s *PersonalAccessTokenStore) UpdatePersonalAccessToken(_ context.Context, t *store.PersonalAccessToken) error

type RefreshTokenStore

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

RefreshTokenStore is an in-memory store.RefreshTokenStore.

func NewRefreshTokenStore

func NewRefreshTokenStore() *RefreshTokenStore

func (*RefreshTokenStore) CreateRefreshToken

func (s *RefreshTokenStore) CreateRefreshToken(_ context.Context, t *store.RefreshToken) error

func (*RefreshTokenStore) GetRefreshTokenByHash

func (s *RefreshTokenStore) GetRefreshTokenByHash(_ context.Context, hash string) (*store.RefreshToken, error)

func (*RefreshTokenStore) ListActiveRefreshTokens

func (s *RefreshTokenStore) ListActiveRefreshTokens(_ context.Context, userID string) ([]*store.RefreshToken, error)

func (*RefreshTokenStore) RevokeAllUserRefreshTokens

func (s *RefreshTokenStore) RevokeAllUserRefreshTokens(_ context.Context, userID string) error

func (*RefreshTokenStore) RevokeRefreshToken

func (s *RefreshTokenStore) RevokeRefreshToken(_ context.Context, id string) error

type SuperuserRefreshTokenStore

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

SuperuserRefreshTokenStore is an in-memory store.SuperuserRefreshTokenStore.

func NewSuperuserRefreshTokenStore

func NewSuperuserRefreshTokenStore() *SuperuserRefreshTokenStore

func (*SuperuserRefreshTokenStore) CreateSuperuserRefreshToken

func (s *SuperuserRefreshTokenStore) CreateSuperuserRefreshToken(_ context.Context, t *store.SuperuserRefreshToken) error

func (*SuperuserRefreshTokenStore) GetSuperuserRefreshTokenByHash

func (s *SuperuserRefreshTokenStore) GetSuperuserRefreshTokenByHash(_ context.Context, hash string) (*store.SuperuserRefreshToken, error)

func (*SuperuserRefreshTokenStore) RevokeAllSuperuserRefreshTokens

func (s *SuperuserRefreshTokenStore) RevokeAllSuperuserRefreshTokens(_ context.Context, superuserID string) error

func (*SuperuserRefreshTokenStore) RevokeSuperuserRefreshToken

func (s *SuperuserRefreshTokenStore) RevokeSuperuserRefreshToken(_ context.Context, id string) error

type SuperuserStore

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

SuperuserStore is an in-memory store.SuperuserStore.

func NewSuperuserStore

func NewSuperuserStore() *SuperuserStore

func (*SuperuserStore) CountSuperusers

func (s *SuperuserStore) CountSuperusers(_ context.Context) (int, error)

func (*SuperuserStore) CreateSuperuser

func (s *SuperuserStore) CreateSuperuser(_ context.Context, su *store.Superuser) error

func (*SuperuserStore) GetSuperuserByEmail

func (s *SuperuserStore) GetSuperuserByEmail(_ context.Context, email string) (*store.Superuser, error)

func (*SuperuserStore) GetSuperuserByID

func (s *SuperuserStore) GetSuperuserByID(_ context.Context, id string) (*store.Superuser, error)

func (*SuperuserStore) ListSuperusers

func (s *SuperuserStore) ListSuperusers(_ context.Context) ([]*store.Superuser, error)

func (*SuperuserStore) UpdateSuperuser

func (s *SuperuserStore) UpdateSuperuser(_ context.Context, su *store.Superuser) error

type TOTPStore

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

TOTPStore is an in-memory store.TOTPStore.

func NewTOTPStore

func NewTOTPStore() *TOTPStore

func (*TOTPStore) CreateTOTPSettings

func (s *TOTPStore) CreateTOTPSettings(_ context.Context, t *store.TOTPSettings) error

func (*TOTPStore) DeleteTOTPSettings

func (s *TOTPStore) DeleteTOTPSettings(_ context.Context, userID string) error

func (*TOTPStore) GetTOTPSettingsByUserID

func (s *TOTPStore) GetTOTPSettingsByUserID(_ context.Context, userID string) (*store.TOTPSettings, error)

func (*TOTPStore) UpdateTOTPSettings

func (s *TOTPStore) UpdateTOTPSettings(_ context.Context, t *store.TOTPSettings) error

type TeamStore

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

TeamStore is an in-memory store.TeamStore.

func NewTeamStore

func NewTeamStore() *TeamStore

func (*TeamStore) CreateTeam

func (s *TeamStore) CreateTeam(_ context.Context, t *store.Team) error

func (*TeamStore) DeleteTeam

func (s *TeamStore) DeleteTeam(_ context.Context, id string) error

func (*TeamStore) GetTeam

func (s *TeamStore) GetTeam(_ context.Context, id string) (*store.Team, error)

func (*TeamStore) GetTeamBySlug

func (s *TeamStore) GetTeamBySlug(_ context.Context, slug string) (*store.Team, error)

func (*TeamStore) UpdateTeam

func (s *TeamStore) UpdateTeam(_ context.Context, t *store.Team) error

type UserStore

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

UserStore is an in-memory store.UserStore.

func NewUserStore

func NewUserStore() *UserStore

NewUserStore constructs an empty UserStore.

func (*UserStore) CreateUser

func (s *UserStore) CreateUser(_ context.Context, u *store.User) error

func (*UserStore) GetUserByEmail

func (s *UserStore) GetUserByEmail(_ context.Context, email string) (*store.User, error)

func (*UserStore) GetUserByID

func (s *UserStore) GetUserByID(_ context.Context, id string) (*store.User, error)

func (*UserStore) UpdateUser

func (s *UserStore) UpdateUser(_ context.Context, u *store.User) error

Jump to

Keyboard shortcuts

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