memory

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserNotFound       = fmt.Errorf("memory auth: user not found")
	ErrRoleNotFound       = fmt.Errorf("memory roles: role not found")
	ErrAssignmentNotFound = fmt.Errorf("memory roles: assignment not found")
)

Functions

This section is empty.

Types

type ActivityStore

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

ActivityStore logs activity entries in memory and exposes query helpers.

func NewActivityStore

func NewActivityStore() *ActivityStore

NewActivityStore provisions the store.

func (*ActivityStore) ActivityStats

func (*ActivityStore) ListActivity

func (s *ActivityStore) ListActivity(_ context.Context, filter types.ActivityFilter) (types.ActivityPage, error)

func (*ActivityStore) Log

type AuthRepository

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

AuthRepository is an in-memory implementation of both the auth repository and the user inventory repository contracts. It is only intended for examples.

func NewAuthRepository

func NewAuthRepository() *AuthRepository

NewAuthRepository provisions an in-memory auth repository.

func (*AuthRepository) AllowedTransitions

func (r *AuthRepository) AllowedTransitions(context.Context, uuid.UUID) ([]types.LifecycleTransition, error)

func (*AuthRepository) Create

func (r *AuthRepository) Create(_ context.Context, input *types.AuthUser) (*types.AuthUser, error)

func (*AuthRepository) GetByID

func (r *AuthRepository) GetByID(_ context.Context, id uuid.UUID) (*types.AuthUser, error)

func (*AuthRepository) GetByIdentifier

func (r *AuthRepository) GetByIdentifier(_ context.Context, identifier string) (*types.AuthUser, error)

func (*AuthRepository) ListUsers

func (*AuthRepository) ResetPassword

func (r *AuthRepository) ResetPassword(context.Context, uuid.UUID, string) error

func (*AuthRepository) Update

func (r *AuthRepository) Update(_ context.Context, input *types.AuthUser) (*types.AuthUser, error)

func (*AuthRepository) UpdateStatus

func (r *AuthRepository) UpdateStatus(ctx context.Context, actor types.ActorRef, id uuid.UUID, next types.LifecycleState, opts ...types.TransitionOption) (*types.AuthUser, error)

type PreferenceRepository

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

PreferenceRepository persists preference records in memory.

func NewPreferenceRepository

func NewPreferenceRepository() *PreferenceRepository

NewPreferenceRepository provisions the repo.

func (*PreferenceRepository) DeletePreference

func (r *PreferenceRepository) DeletePreference(_ context.Context, userID uuid.UUID, scope types.ScopeFilter, level types.PreferenceLevel, key string) error

func (*PreferenceRepository) ListPreferences

func (*PreferenceRepository) UpsertPreference

type ProfileRepository

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

ProfileRepository stores profile rows in memory.

func NewProfileRepository

func NewProfileRepository() *ProfileRepository

NewProfileRepository provisions the repo.

func (*ProfileRepository) GetProfile

func (r *ProfileRepository) GetProfile(_ context.Context, userID uuid.UUID, scope types.ScopeFilter) (*types.UserProfile, error)

func (*ProfileRepository) UpsertProfile

func (r *ProfileRepository) UpsertProfile(_ context.Context, profile types.UserProfile) (*types.UserProfile, error)

type RoleRegistry

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

RoleRegistry is an in-memory registry used by examples.

func NewRoleRegistry

func NewRoleRegistry() *RoleRegistry

NewRoleRegistry provisions the registry.

func (*RoleRegistry) AssignRole

func (r *RoleRegistry) AssignRole(_ context.Context, userID, roleID uuid.UUID, scope types.ScopeFilter, actor uuid.UUID) error

func (*RoleRegistry) CreateRole

func (*RoleRegistry) DeleteRole

func (r *RoleRegistry) DeleteRole(_ context.Context, id uuid.UUID, _ types.ScopeFilter, _ uuid.UUID) error

func (*RoleRegistry) GetRole

func (*RoleRegistry) ListAssignments

func (r *RoleRegistry) ListAssignments(_ context.Context, filter types.RoleAssignmentFilter) ([]types.RoleAssignment, error)

func (*RoleRegistry) ListRoles

func (r *RoleRegistry) ListRoles(_ context.Context, filter types.RoleFilter) (types.RolePage, error)

func (*RoleRegistry) UnassignRole

func (r *RoleRegistry) UnassignRole(_ context.Context, userID, roleID uuid.UUID, scope types.ScopeFilter, _ uuid.UUID) error

func (*RoleRegistry) UpdateRole

func (r *RoleRegistry) UpdateRole(_ context.Context, id uuid.UUID, input types.RoleMutation) (*types.RoleDefinition, error)

type SecureLinkManager added in v0.13.0

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

SecureLinkManager is an in-memory secure link stub for examples.

func NewSecureLinkManager added in v0.13.0

func NewSecureLinkManager() *SecureLinkManager

NewSecureLinkManager provisions a secure link stub.

func (*SecureLinkManager) Generate added in v0.13.0

func (s *SecureLinkManager) Generate(route string, payloads ...types.SecureLinkPayload) (string, error)

Generate returns a unique token and stores the supplied payloads.

func (*SecureLinkManager) GetAndValidate added in v0.13.0

func (s *SecureLinkManager) GetAndValidate(fn func(string) string) (types.SecureLinkPayload, error)

GetAndValidate extracts a token with the supplied getter and validates it.

func (*SecureLinkManager) GetExpiration added in v0.13.0

func (s *SecureLinkManager) GetExpiration() time.Duration

GetExpiration returns the configured expiration duration.

func (*SecureLinkManager) Validate added in v0.13.0

func (s *SecureLinkManager) Validate(token string) (map[string]any, error)

Validate returns the payload associated with the supplied token.

type UserTokenRepository added in v0.13.0

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

UserTokenRepository stores token metadata in memory for examples.

func NewUserTokenRepository added in v0.13.0

func NewUserTokenRepository() *UserTokenRepository

NewUserTokenRepository provisions a token repository stub.

func (*UserTokenRepository) CreateToken added in v0.13.0

func (r *UserTokenRepository) CreateToken(_ context.Context, token types.UserToken) (*types.UserToken, error)

CreateToken persists an onboarding token record.

func (*UserTokenRepository) GetTokenByJTI added in v0.13.0

func (r *UserTokenRepository) GetTokenByJTI(_ context.Context, tokenType types.UserTokenType, jti string) (*types.UserToken, error)

GetTokenByJTI returns a stored token record by type and JTI.

func (*UserTokenRepository) UpdateTokenStatus added in v0.13.0

func (r *UserTokenRepository) UpdateTokenStatus(_ context.Context, tokenType types.UserTokenType, jti string, status types.UserTokenStatus, usedAt time.Time) error

UpdateTokenStatus updates the stored token state.

Jump to

Keyboard shortcuts

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