Documentation
¶
Overview ¶
Package memory provides an in-memory implementation of store.Store for testing.
Index ¶
- type Store
- func (s *Store) AddUserEmail(_ context.Context, e *user.UserEmail) error
- func (s *Store) BatchResolve(ctx context.Context, keys []string, opts settings.ResolveOpts) (map[string][]*settings.Setting, error)
- func (s *Store) Close() error
- func (s *Store) ConsumePasswordReset(_ context.Context, token string) error
- func (s *Store) ConsumeVerification(_ context.Context, token string) error
- func (s *Store) CreateAPIKey(_ context.Context, k *apikey.APIKey) error
- func (s *Store) CreateApp(_ context.Context, a *app.App) error
- func (s *Store) CreateDelegation(_ context.Context, d *principal.Delegation) error
- func (s *Store) CreateDevice(_ context.Context, d *device.Device) error
- func (s *Store) CreateEnvironment(_ context.Context, e *environment.Environment) error
- func (s *Store) CreateFormConfig(_ context.Context, fc *formconfig.FormConfig) error
- func (s *Store) CreateInvitation(_ context.Context, inv *organization.Invitation) error
- func (s *Store) CreateMember(_ context.Context, m *organization.Member) error
- func (s *Store) CreateNotification(_ context.Context, n *notification.Notification) error
- func (s *Store) CreateOrganization(_ context.Context, o *organization.Organization) error
- func (s *Store) CreatePasswordReset(_ context.Context, pr *account.PasswordReset) error
- func (s *Store) CreateServiceAccount(_ context.Context, svc *serviceaccount.ServiceAccount) error
- func (s *Store) CreateSession(_ context.Context, sess *session.Session) error
- func (s *Store) CreateTeam(_ context.Context, t *organization.Team) error
- func (s *Store) CreateUser(_ context.Context, u *user.User) error
- func (s *Store) CreateUserWithPrimaryEmail(_ context.Context, u *user.User, primary *user.UserEmail) error
- func (s *Store) CreateVerification(_ context.Context, v *account.Verification) error
- func (s *Store) CreateWebhook(_ context.Context, w *webhook.Webhook) error
- func (s *Store) DeleteAPIKey(_ context.Context, keyID id.APIKeyID) error
- func (s *Store) DeleteApp(_ context.Context, appID id.AppID) error
- func (s *Store) DeleteAppClientConfig(_ context.Context, appID id.AppID) error
- func (s *Store) DeleteAppSessionConfig(_ context.Context, appID id.AppID) error
- func (s *Store) DeleteBranding(_ context.Context, orgID id.OrgID) error
- func (s *Store) DeleteDevice(_ context.Context, deviceID id.DeviceID) error
- func (s *Store) DeleteEnvironment(_ context.Context, envID id.EnvironmentID) error
- func (s *Store) DeleteExpiredPasswordResets(_ context.Context, before time.Time, batch int) (int64, error)
- func (s *Store) DeleteExpiredRevokedRefreshTokens(_ context.Context, before time.Time, batch int) (int64, error)
- func (s *Store) DeleteExpiredSessions(_ context.Context, before time.Time, batch int) (int64, error)
- func (s *Store) DeleteExpiredVerifications(_ context.Context, before time.Time, batch int) (int64, error)
- func (s *Store) DeleteFormConfig(_ context.Context, appID id.AppID, formType string) error
- func (s *Store) DeleteInvitation(_ context.Context, invID id.InvitationID) error
- func (s *Store) DeleteMember(_ context.Context, memberID id.MemberID) error
- func (s *Store) DeleteOrganization(_ context.Context, orgID id.OrgID) error
- func (s *Store) DeleteOrganizationCascade(ctx context.Context, orgID id.OrgID) error
- func (s *Store) DeleteServiceAccount(_ context.Context, svcID id.ServiceAccountID) error
- func (s *Store) DeleteSession(_ context.Context, sessionID id.SessionID) error
- func (s *Store) DeleteSessionsByGrant(_ context.Context, grantID id.AgentGrantID) error
- func (s *Store) DeleteSetting(_ context.Context, key string, scope settings.Scope, scopeID string) error
- func (s *Store) DeleteSettingsByNamespace(_ context.Context, namespace string) error
- func (s *Store) DeleteTeam(_ context.Context, teamID id.TeamID) error
- func (s *Store) DeleteUser(_ context.Context, userID id.UserID) error
- func (s *Store) DeleteUserEmail(_ context.Context, userID id.UserID, email string) error
- func (s *Store) DeleteUserSessions(_ context.Context, userID id.UserID) error
- func (s *Store) DeleteWebhook(_ context.Context, webhookID id.WebhookID) error
- func (s *Store) FindActiveDelegation(_ context.Context, appID id.AppID, actor, subject principal.Ref, ...) (*principal.Delegation, error)
- func (s *Store) FindByPrefix(_ context.Context, prefix string) (*apikey.APIKey, error)
- func (s *Store) GetAPIKey(_ context.Context, keyID id.APIKeyID) (*apikey.APIKey, error)
- func (s *Store) GetAPIKeyByPrefix(_ context.Context, appID id.AppID, prefix string) (*apikey.APIKey, error)
- func (s *Store) GetAPIKeyByPublicKey(_ context.Context, appID id.AppID, publicKey string) (*apikey.APIKey, error)
- func (s *Store) GetActiveEmailVerification(_ context.Context, userID id.UserID) (*account.Verification, error)
- func (s *Store) GetApp(_ context.Context, appID id.AppID) (*app.App, error)
- func (s *Store) GetAppByPublishableKey(_ context.Context, key string) (*app.App, error)
- func (s *Store) GetAppBySlug(_ context.Context, slug string) (*app.App, error)
- func (s *Store) GetAppClientConfig(_ context.Context, appID id.AppID) (*appclientconfig.Config, error)
- func (s *Store) GetAppSessionConfig(_ context.Context, appID id.AppID) (*appsessionconfig.Config, error)
- func (s *Store) GetBranding(_ context.Context, orgID id.OrgID) (*formconfig.BrandingConfig, error)
- func (s *Store) GetDefaultEnvironment(_ context.Context, appID id.AppID) (*environment.Environment, error)
- func (s *Store) GetDelegation(_ context.Context, delID id.DelegationID) (*principal.Delegation, error)
- func (s *Store) GetDevice(_ context.Context, deviceID id.DeviceID) (*device.Device, error)
- func (s *Store) GetDeviceByFingerprint(_ context.Context, userID id.UserID, fingerprint string) (*device.Device, error)
- func (s *Store) GetEnvironment(_ context.Context, envID id.EnvironmentID) (*environment.Environment, error)
- func (s *Store) GetEnvironmentBySlug(_ context.Context, appID id.AppID, slug string) (*environment.Environment, error)
- func (s *Store) GetFormConfig(_ context.Context, appID id.AppID, formType string) (*formconfig.FormConfig, error)
- func (s *Store) GetInvitation(_ context.Context, invID id.InvitationID) (*organization.Invitation, error)
- func (s *Store) GetInvitationByToken(_ context.Context, token string) (*organization.Invitation, error)
- func (s *Store) GetMember(_ context.Context, memberID id.MemberID) (*organization.Member, error)
- func (s *Store) GetMemberByUserAndOrg(_ context.Context, userID id.UserID, orgID id.OrgID) (*organization.Member, error)
- func (s *Store) GetNotification(_ context.Context, notifID id.NotificationID) (*notification.Notification, error)
- func (s *Store) GetOrganization(_ context.Context, orgID id.OrgID) (*organization.Organization, error)
- func (s *Store) GetOrganizationBySlug(_ context.Context, appID id.AppID, slug string) (*organization.Organization, error)
- func (s *Store) GetPasswordReset(_ context.Context, token string) (*account.PasswordReset, error)
- func (s *Store) GetPlatformApp(_ context.Context) (*app.App, error)
- func (s *Store) GetPrincipal(ctx context.Context, ref principal.Ref) (*principal.Principal, error)
- func (s *Store) GetRevokedRefreshTokenFamily(_ context.Context, tokenHash string) (id.SessionFamilyID, error)
- func (s *Store) GetServiceAccount(_ context.Context, svcID id.ServiceAccountID) (*serviceaccount.ServiceAccount, error)
- func (s *Store) GetSession(_ context.Context, sessionID id.SessionID) (*session.Session, error)
- func (s *Store) GetSessionByRefreshToken(_ context.Context, refreshToken string) (*session.Session, error)
- func (s *Store) GetSessionByToken(_ context.Context, token string) (*session.Session, error)
- func (s *Store) GetSetting(_ context.Context, key string, scope settings.Scope, scopeID string) (*settings.Setting, error)
- func (s *Store) GetTeam(_ context.Context, teamID id.TeamID) (*organization.Team, error)
- func (s *Store) GetUser(_ context.Context, userID id.UserID) (*user.User, error)
- func (s *Store) GetUserByAnyEmail(_ context.Context, appID id.AppID, envID id.EnvironmentID, email string) (*user.User, error)
- func (s *Store) GetUserByEmail(_ context.Context, appID id.AppID, envID id.EnvironmentID, email string) (*user.User, error)
- func (s *Store) GetUserByPhone(_ context.Context, appID id.AppID, envID id.EnvironmentID, phone string) (*user.User, error)
- func (s *Store) GetUserByUsername(_ context.Context, appID id.AppID, envID id.EnvironmentID, username string) (*user.User, error)
- func (s *Store) GetUserEmailRecord(_ context.Context, appID id.AppID, envID id.EnvironmentID, email string) (*user.UserEmail, error)
- func (s *Store) GetUserEmails(_ context.Context, userID id.UserID) ([]*user.UserEmail, error)
- func (s *Store) GetVerification(_ context.Context, token string) (*account.Verification, error)
- func (s *Store) GetWebhook(_ context.Context, webhookID id.WebhookID) (*webhook.Webhook, error)
- func (s *Store) HashLegacyTokens(_ context.Context, batch int) (int64, error)
- func (s *Store) InjectOneShotFault(method string, err error)
- func (s *Store) IsRefreshTokenRevoked(_ context.Context, tokenHash string) (bool, error)
- func (s *Store) KVCounter(_ context.Context, key string) (int64, error)
- func (s *Store) KVDelete(_ context.Context, key string) error
- func (s *Store) KVDeleteExpired(_ context.Context, now time.Time) (int64, error)
- func (s *Store) KVGet(_ context.Context, key string) ([]byte, error)
- func (s *Store) KVIncrement(_ context.Context, key string, ttl time.Duration) (int64, error)
- func (s *Store) KVSet(_ context.Context, key string, value []byte, ttl time.Duration) error
- func (s *Store) KVSetNX(_ context.Context, key string, value []byte, ttl time.Duration) (bool, error)
- func (s *Store) ListAPIKeysByApp(_ context.Context, appID id.AppID) ([]*apikey.APIKey, error)
- func (s *Store) ListAPIKeysByUser(_ context.Context, appID id.AppID, userID id.UserID) ([]*apikey.APIKey, error)
- func (s *Store) ListApps(_ context.Context) ([]*app.App, error)
- func (s *Store) ListDelegations(_ context.Context, q *principal.DelegationQuery) ([]*principal.Delegation, error)
- func (s *Store) ListDevices(_ context.Context, limit int) ([]*device.Device, error)
- func (s *Store) ListEnvironments(_ context.Context, appID id.AppID) ([]*environment.Environment, error)
- func (s *Store) ListFormConfigs(_ context.Context, appID id.AppID) ([]*formconfig.FormConfig, error)
- func (s *Store) ListInvitations(_ context.Context, orgID id.OrgID) ([]*organization.Invitation, error)
- func (s *Store) ListInvitationsPage(_ context.Context, orgID id.OrgID, opts page.Opts) (page.Page[*organization.Invitation], error)
- func (s *Store) ListMembers(_ context.Context, orgID id.OrgID) ([]*organization.Member, error)
- func (s *Store) ListMembersPage(_ context.Context, orgID id.OrgID, opts page.Opts) (page.Page[*organization.Member], error)
- func (s *Store) ListOrganizations(_ context.Context, appID id.AppID) ([]*organization.Organization, error)
- func (s *Store) ListOrganizationsPage(_ context.Context, appID id.AppID, opts page.Opts) (page.Page[*organization.Organization], error)
- func (s *Store) ListPrincipals(_ context.Context, q *principal.Query) ([]*principal.Principal, error)
- func (s *Store) ListServiceAccounts(_ context.Context, q *serviceaccount.Query) (*serviceaccount.List, error)
- func (s *Store) ListSessions(_ context.Context, limit int) ([]*session.Session, error)
- func (s *Store) ListSettings(_ context.Context, opts settings.ListOpts) ([]*settings.Setting, error)
- func (s *Store) ListTeams(_ context.Context, orgID id.OrgID) ([]*organization.Team, error)
- func (s *Store) ListTeamsPage(_ context.Context, orgID id.OrgID, opts page.Opts) (page.Page[*organization.Team], error)
- func (s *Store) ListUserDevices(_ context.Context, userID id.UserID) ([]*device.Device, error)
- func (s *Store) ListUserNotifications(_ context.Context, userID id.UserID) ([]*notification.Notification, error)
- func (s *Store) ListUserOrganizations(_ context.Context, userID id.UserID) ([]*organization.Organization, error)
- func (s *Store) ListUserOrganizationsPage(_ context.Context, userID id.UserID, opts page.Opts) (page.Page[*organization.Organization], error)
- func (s *Store) ListUserSessions(_ context.Context, userID id.UserID) ([]*session.Session, error)
- func (s *Store) ListUserSessionsPage(_ context.Context, userID id.UserID, opts page.Opts) (page.Page[*session.Session], error)
- func (s *Store) ListUsers(_ context.Context, q *user.Query) (*user.List, error)
- func (s *Store) ListWebhooks(_ context.Context, appID id.AppID) ([]*webhook.Webhook, error)
- func (s *Store) MarkRefreshTokenReplayed(_ context.Context, tokenHash string) (bool, error)
- func (s *Store) MarkRefreshTokenRevoked(_ context.Context, tokenHash string, familyID id.SessionFamilyID, ...) error
- func (s *Store) MarkSent(_ context.Context, notifID id.NotificationID) error
- func (s *Store) MarkUserEmailVerified(_ context.Context, userID id.UserID, email string) error
- func (s *Store) Migrate(_ context.Context, _ ...*migrate.Group) error
- func (s *Store) Ping(context.Context) error
- func (s *Store) ResolveSettings(_ context.Context, key string, opts settings.ResolveOpts) ([]*settings.Setting, error)
- func (s *Store) RevokeDelegation(_ context.Context, delID id.DelegationID, at time.Time) error
- func (s *Store) RevokeRefreshTokenFamily(_ context.Context, familyID id.SessionFamilyID, reason string) error
- func (s *Store) RotateSession(_ context.Context, sess *session.Session, expectedTokenHash string) (bool, error)
- func (s *Store) SaveBranding(_ context.Context, b *formconfig.BrandingConfig) error
- func (s *Store) SeedLegacyInvitation(_ context.Context, inv *organization.Invitation) error
- func (s *Store) SeedLegacyPasswordReset(_ context.Context, pr *account.PasswordReset) error
- func (s *Store) SeedLegacySession(_ context.Context, sess *session.Session) error
- func (s *Store) SeedLegacyVerification(_ context.Context, v *account.Verification) error
- func (s *Store) SetAppClientConfig(_ context.Context, cfg *appclientconfig.Config) error
- func (s *Store) SetAppSessionConfig(_ context.Context, cfg *appsessionconfig.Config) error
- func (s *Store) SetDefaultEnvironment(_ context.Context, appID id.AppID, envID id.EnvironmentID) error
- func (s *Store) SetPrimaryEmail(_ context.Context, userID id.UserID, email string) error
- func (s *Store) SetSetting(_ context.Context, st *settings.Setting) error
- func (s *Store) TouchAPIKey(_ context.Context, keyID id.APIKeyID, at time.Time) error
- func (s *Store) TouchSession(_ context.Context, sessionID id.SessionID, lastActivityAt, expiresAt time.Time) error
- func (s *Store) UpdateAPIKey(_ context.Context, k *apikey.APIKey) error
- func (s *Store) UpdateApp(_ context.Context, a *app.App) error
- func (s *Store) UpdateDevice(_ context.Context, d *device.Device) error
- func (s *Store) UpdateEnvironment(_ context.Context, e *environment.Environment) error
- func (s *Store) UpdateFormConfig(_ context.Context, fc *formconfig.FormConfig) error
- func (s *Store) UpdateInvitation(_ context.Context, inv *organization.Invitation) error
- func (s *Store) UpdateMember(_ context.Context, m *organization.Member) error
- func (s *Store) UpdateOrganization(_ context.Context, o *organization.Organization) error
- func (s *Store) UpdateServiceAccount(_ context.Context, svc *serviceaccount.ServiceAccount) error
- func (s *Store) UpdateSession(_ context.Context, sess *session.Session) error
- func (s *Store) UpdateTeam(_ context.Context, t *organization.Team) error
- func (s *Store) UpdateUser(_ context.Context, u *user.User) error
- func (s *Store) UpdateVerification(_ context.Context, v *account.Verification) error
- func (s *Store) UpdateWebhook(_ context.Context, w *webhook.Webhook) error
- func (s *Store) WithTx(_ context.Context, fn func(tx organization.Store) error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is an in-memory implementation of the composite store interface.
func (*Store) AddUserEmail ¶
AddUserEmail attaches an additional email to a user. The address must be free within (app_id, env_id), else account.ErrEmailTaken.
func (*Store) BatchResolve ¶
func (*Store) ConsumePasswordReset ¶
func (*Store) ConsumeVerification ¶
ConsumeVerification marks a verification consumed, returning ErrNotFound if it was missing or already consumed. The already-consumed case must be distinguishable so callers can reject a replay: checking Consumed on a prior read and setting it here are two steps, and only the store can make them one.
func (*Store) CreateAPIKey ¶
func (*Store) CreateDelegation ¶
func (*Store) CreateDevice ¶
func (*Store) CreateEnvironment ¶
func (s *Store) CreateEnvironment(_ context.Context, e *environment.Environment) error
func (*Store) CreateFormConfig ¶
func (s *Store) CreateFormConfig(_ context.Context, fc *formconfig.FormConfig) error
func (*Store) CreateInvitation ¶
func (s *Store) CreateInvitation(_ context.Context, inv *organization.Invitation) error
func (*Store) CreateMember ¶
func (*Store) CreateNotification ¶
func (s *Store) CreateNotification(_ context.Context, n *notification.Notification) error
func (*Store) CreateOrganization ¶
func (s *Store) CreateOrganization(_ context.Context, o *organization.Organization) error
func (*Store) CreatePasswordReset ¶
func (*Store) CreateServiceAccount ¶
func (s *Store) CreateServiceAccount(_ context.Context, svc *serviceaccount.ServiceAccount) error
func (*Store) CreateSession ¶
func (*Store) CreateTeam ¶
func (*Store) CreateUserWithPrimaryEmail ¶
func (s *Store) CreateUserWithPrimaryEmail(_ context.Context, u *user.User, primary *user.UserEmail) error
CreateUserWithPrimaryEmail creates a user together with its primary email row. The email address must be free within (app_id, env_id).
func (*Store) CreateVerification ¶
func (*Store) CreateWebhook ¶
func (*Store) DeleteAPIKey ¶
func (*Store) DeleteApp ¶
DeleteApp removes the app and every child record scoped to it, mirroring the ON DELETE CASCADE behaviour of the PostgreSQL backend so the in-memory store stays consistent (no orphaned users/sessions/etc.). Plugin-owned tables (passkey, oauth connections, oauth2 clients, ...) live in their own stores and are not tracked here.
func (*Store) DeleteAppClientConfig ¶
func (*Store) DeleteAppSessionConfig ¶
func (*Store) DeleteBranding ¶
func (*Store) DeleteDevice ¶
func (*Store) DeleteEnvironment ¶
func (*Store) DeleteExpiredPasswordResets ¶
func (s *Store) DeleteExpiredPasswordResets(_ context.Context, before time.Time, batch int) (int64, error)
DeleteExpiredPasswordResets implements store.Retention.
func (*Store) DeleteExpiredRevokedRefreshTokens ¶
func (s *Store) DeleteExpiredRevokedRefreshTokens(_ context.Context, before time.Time, batch int) (int64, error)
DeleteExpiredRevokedRefreshTokens implements store.Retention.
func (*Store) DeleteExpiredSessions ¶
func (s *Store) DeleteExpiredSessions(_ context.Context, before time.Time, batch int) (int64, error)
DeleteExpiredSessions implements store.Retention.
func (*Store) DeleteExpiredVerifications ¶
func (s *Store) DeleteExpiredVerifications(_ context.Context, before time.Time, batch int) (int64, error)
DeleteExpiredVerifications implements store.Retention.
func (*Store) DeleteFormConfig ¶
func (*Store) DeleteInvitation ¶
func (*Store) DeleteMember ¶
func (*Store) DeleteOrganization ¶
func (*Store) DeleteOrganizationCascade ¶
DeleteOrganizationCascade deletes the organization and all of its dependent rows (members, teams, invitations) atomically via the snapshot/restore WithTx wrapper. On any inner-store error (e.g. a fault injection) the entire cascade rolls back.
Returns nil if the org doesn't exist (idempotent — matches the SQL-backend behaviour where DELETE on a missing PK is a no-op).
func (*Store) DeleteServiceAccount ¶
func (*Store) DeleteSession ¶
func (*Store) DeleteSessionsByGrant ¶
func (*Store) DeleteSetting ¶
func (*Store) DeleteSettingsByNamespace ¶
func (*Store) DeleteUserEmail ¶
DeleteUserEmail soft-deletes a non-primary email. Deleting the primary is refused with store.ErrConflict.
func (*Store) DeleteUserSessions ¶
func (*Store) DeleteWebhook ¶
func (*Store) FindActiveDelegation ¶
func (*Store) FindByPrefix ¶
func (*Store) GetAPIKeyByPrefix ¶
func (*Store) GetAPIKeyByPublicKey ¶
func (*Store) GetActiveEmailVerification ¶
func (*Store) GetAppByPublishableKey ¶
func (*Store) GetAppBySlug ¶
func (*Store) GetAppClientConfig ¶
func (*Store) GetAppSessionConfig ¶
func (*Store) GetBranding ¶
func (s *Store) GetBranding(_ context.Context, orgID id.OrgID) (*formconfig.BrandingConfig, error)
func (*Store) GetDefaultEnvironment ¶
func (s *Store) GetDefaultEnvironment(_ context.Context, appID id.AppID) (*environment.Environment, error)
func (*Store) GetDelegation ¶
func (s *Store) GetDelegation(_ context.Context, delID id.DelegationID) (*principal.Delegation, error)
func (*Store) GetDeviceByFingerprint ¶
func (*Store) GetEnvironment ¶
func (s *Store) GetEnvironment(_ context.Context, envID id.EnvironmentID) (*environment.Environment, error)
func (*Store) GetEnvironmentBySlug ¶
func (s *Store) GetEnvironmentBySlug(_ context.Context, appID id.AppID, slug string) (*environment.Environment, error)
func (*Store) GetFormConfig ¶
func (s *Store) GetFormConfig(_ context.Context, appID id.AppID, formType string) (*formconfig.FormConfig, error)
func (*Store) GetInvitation ¶
func (s *Store) GetInvitation(_ context.Context, invID id.InvitationID) (*organization.Invitation, error)
func (*Store) GetInvitationByToken ¶
func (s *Store) GetInvitationByToken(_ context.Context, token string) (*organization.Invitation, error)
func (*Store) GetMemberByUserAndOrg ¶
func (*Store) GetNotification ¶
func (s *Store) GetNotification(_ context.Context, notifID id.NotificationID) (*notification.Notification, error)
func (*Store) GetOrganization ¶
func (s *Store) GetOrganization(_ context.Context, orgID id.OrgID) (*organization.Organization, error)
func (*Store) GetOrganizationBySlug ¶
func (s *Store) GetOrganizationBySlug(_ context.Context, appID id.AppID, slug string) (*organization.Organization, error)
func (*Store) GetPasswordReset ¶
func (*Store) GetPrincipal ¶
func (*Store) GetRevokedRefreshTokenFamily ¶
func (s *Store) GetRevokedRefreshTokenFamily(_ context.Context, tokenHash string) (id.SessionFamilyID, error)
GetRevokedRefreshTokenFamily returns the family of a previously-revoked token, or store.ErrNotFound if the hash is unknown.
func (*Store) GetServiceAccount ¶
func (s *Store) GetServiceAccount(_ context.Context, svcID id.ServiceAccountID) (*serviceaccount.ServiceAccount, error)
func (*Store) GetSession ¶
func (*Store) GetSessionByRefreshToken ¶
func (*Store) GetSessionByToken ¶
func (*Store) GetSetting ¶
func (*Store) GetUserByAnyEmail ¶
func (s *Store) GetUserByAnyEmail(_ context.Context, appID id.AppID, envID id.EnvironmentID, email string) (*user.User, error)
GetUserByAnyEmail resolves the user owning any (primary or secondary) email matching (appID, envID, email).
func (*Store) GetUserByEmail ¶
func (*Store) GetUserByPhone ¶
func (*Store) GetUserByUsername ¶
func (*Store) GetUserEmailRecord ¶
func (s *Store) GetUserEmailRecord(_ context.Context, appID id.AppID, envID id.EnvironmentID, email string) (*user.UserEmail, error)
GetUserEmailRecord returns the email row matching (appID, envID, email).
func (*Store) GetUserEmails ¶
GetUserEmails returns all live emails for a user, primary first then oldest.
func (*Store) GetVerification ¶
func (*Store) GetWebhook ¶
func (*Store) HashLegacyTokens ¶
HashLegacyTokens implements store.LegacyTokenHasher.
func (*Store) InjectOneShotFault ¶
InjectOneShotFault is a TEST-ONLY helper. The next call to <method> returns err. Production code must not depend on this.
func (*Store) IsRefreshTokenRevoked ¶
IsRefreshTokenRevoked reports whether tokenHash is in the revoked set.
func (*Store) KVDeleteExpired ¶
KVDeleteExpired implements store.KV.
func (*Store) KVIncrement ¶
KVIncrement implements store.KV.
func (*Store) KVSetNX ¶
func (s *Store) KVSetNX(_ context.Context, key string, value []byte, ttl time.Duration) (bool, error)
KVSetNX implements store.KV.
func (*Store) ListAPIKeysByApp ¶
func (*Store) ListAPIKeysByUser ¶
func (*Store) ListDelegations ¶
func (s *Store) ListDelegations(_ context.Context, q *principal.DelegationQuery) ([]*principal.Delegation, error)
func (*Store) ListDevices ¶
func (*Store) ListEnvironments ¶
func (s *Store) ListEnvironments(_ context.Context, appID id.AppID) ([]*environment.Environment, error)
func (*Store) ListFormConfigs ¶
func (s *Store) ListFormConfigs(_ context.Context, appID id.AppID) ([]*formconfig.FormConfig, error)
func (*Store) ListInvitations ¶
func (s *Store) ListInvitations(_ context.Context, orgID id.OrgID) ([]*organization.Invitation, error)
func (*Store) ListInvitationsPage ¶
func (*Store) ListMembers ¶
func (*Store) ListMembersPage ¶
func (*Store) ListOrganizations ¶
func (s *Store) ListOrganizations(_ context.Context, appID id.AppID) ([]*organization.Organization, error)
func (*Store) ListOrganizationsPage ¶
func (*Store) ListPrincipals ¶
func (*Store) ListServiceAccounts ¶
func (s *Store) ListServiceAccounts(_ context.Context, q *serviceaccount.Query) (*serviceaccount.List, error)
func (*Store) ListSessions ¶
func (*Store) ListSettings ¶
func (*Store) ListTeamsPage ¶
func (*Store) ListUserDevices ¶
func (*Store) ListUserNotifications ¶
func (s *Store) ListUserNotifications(_ context.Context, userID id.UserID) ([]*notification.Notification, error)
func (*Store) ListUserOrganizations ¶
func (s *Store) ListUserOrganizations(_ context.Context, userID id.UserID) ([]*organization.Organization, error)
func (*Store) ListUserOrganizationsPage ¶
func (*Store) ListUserSessions ¶
func (*Store) ListUserSessionsPage ¶
func (*Store) ListWebhooks ¶
func (*Store) MarkRefreshTokenReplayed ¶
MarkRefreshTokenReplayed flips an already-revoked token's reason to "replay_detected", returning whether this call made the change. Guarded by the store mutex so concurrent presentations resolve to a single firstReplay=true — the engine's storm guard.
func (*Store) MarkRefreshTokenRevoked ¶
func (s *Store) MarkRefreshTokenRevoked(_ context.Context, tokenHash string, familyID id.SessionFamilyID, reason string) error
MarkRefreshTokenRevoked records tokenHash as revoked. Idempotent: a duplicate insert keeps the original record (the original family + first-seen timestamp).
func (*Store) MarkUserEmailVerified ¶
MarkUserEmailVerified marks a user's email verified, mirroring onto the user record when the email is primary.
func (*Store) ResolveSettings ¶
func (*Store) RevokeDelegation ¶
func (*Store) RevokeRefreshTokenFamily ¶
func (s *Store) RevokeRefreshTokenFamily(_ context.Context, familyID id.SessionFamilyID, reason string) error
RevokeRefreshTokenFamily revokes every active session sharing familyID. Each surviving refresh-token hash is also recorded as revoked with reason so that later replays of any sibling token are detected too.
func (*Store) RotateSession ¶
func (*Store) SaveBranding ¶
func (s *Store) SaveBranding(_ context.Context, b *formconfig.BrandingConfig) error
func (*Store) SeedLegacyInvitation ¶
func (s *Store) SeedLegacyInvitation(_ context.Context, inv *organization.Invitation) error
SeedLegacyInvitation writes inv the way releases before token hashing did: plaintext and no hash. Test seam for the conformance suite.
func (*Store) SeedLegacyPasswordReset ¶
SeedLegacyPasswordReset writes pr the way releases before token hashing did: plaintext and no hash. Test seam for the conformance suite.
func (*Store) SeedLegacySession ¶
SeedLegacySession writes sess exactly as a release before token hashing did: plaintext tokens and no hashes. It exists so the conformance suite can prove the upgrade path and is refused outside `go test`.
func (*Store) SeedLegacyVerification ¶
SeedLegacyVerification writes v the way releases before token hashing did: plaintext and no hash. Test seam for the conformance suite.
func (*Store) SetAppClientConfig ¶
func (*Store) SetAppSessionConfig ¶
func (*Store) SetDefaultEnvironment ¶
func (*Store) SetPrimaryEmail ¶
SetPrimaryEmail makes a verified, user-owned email the primary, clearing the previous primary and mirroring onto the user record.
func (*Store) SetSetting ¶
func (*Store) TouchAPIKey ¶
func (*Store) TouchSession ¶
func (*Store) UpdateAPIKey ¶
func (*Store) UpdateDevice ¶
func (*Store) UpdateEnvironment ¶
func (s *Store) UpdateEnvironment(_ context.Context, e *environment.Environment) error
func (*Store) UpdateFormConfig ¶
func (s *Store) UpdateFormConfig(_ context.Context, fc *formconfig.FormConfig) error
func (*Store) UpdateInvitation ¶
func (s *Store) UpdateInvitation(_ context.Context, inv *organization.Invitation) error
func (*Store) UpdateMember ¶
func (*Store) UpdateOrganization ¶
func (s *Store) UpdateOrganization(_ context.Context, o *organization.Organization) error
func (*Store) UpdateServiceAccount ¶
func (s *Store) UpdateServiceAccount(_ context.Context, svc *serviceaccount.ServiceAccount) error
func (*Store) UpdateSession ¶
func (*Store) UpdateTeam ¶
func (*Store) UpdateVerification ¶
func (*Store) UpdateWebhook ¶
func (*Store) WithTx ¶
WithTx runs fn against the memory store with snapshot/restore semantics for the four organization-related tables (orgs, members, invitations, teams). On error, those tables are restored to their pre-fn state.
snapshotOrgState covers only organization tables; do not use this WithTx for cross-table mutations until the snapshot is broadened.
Concurrency: NOT safe for concurrent calls — the lock is released while fn runs, so two concurrent WithTx calls each take their own snapshot and rollback is last-writer-wins on the four org tables. Real backends (postgres/sqlite/mongo) will get serializability from the DB once those WithTx implementations are wired; the memory store is only intended for single-threaded test paths.