testkit

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptNotification

func DecryptNotification(keys goauth.KeyRing, envelope goauth.EncryptedEnvelope) (goauth.Notification, error)

Types

type EventSink

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

func (*EventSink) DeleteEncrypted

func (s *EventSink) DeleteEncrypted(ctx context.Context, eventID string) error

func (*EventSink) DeleteExpiredEncrypted

func (s *EventSink) DeleteExpiredEncrypted(ctx context.Context, before time.Time) (int64, error)

func (*EventSink) EnqueueEncrypted

func (s *EventSink) EnqueueEncrypted(ctx context.Context, event goauth.EncryptedEvent) error

func (*EventSink) Events

func (s *EventSink) Events() []goauth.EncryptedEvent

type Fixture

type Fixture struct {
	Runtime      *goauth.Runtime
	Store        *Store
	Events       *EventSink
	SigningKeys  goauth.KeyRing
	TokenKeys    goauth.KeyRing
	EnvelopeKeys goauth.KeyRing
}

func NewRuntime

func NewRuntime(options ...RuntimeOption) (*Fixture, error)

type RuntimeOption

type RuntimeOption func(*goauth.Config)

type Store

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

func NewStore

func NewStore() *Store

func (*Store) ChallengeAttempts

func (s *Store) ChallengeAttempts(subjectID goauth.SubjectID, purpose goauth.EmailChallengePurpose) int

func (*Store) ChangePassword

func (*Store) ConsumePasswordReset

func (s *Store) ConsumePasswordReset(
	ctx context.Context,
	request goauth.PasswordResetConsumeRequest,
) (goauth.PasswordResetConsumeResult, error)

func (*Store) ConsumePasswordResetWithPreparation added in v0.7.0

func (s *Store) ConsumePasswordResetWithPreparation(
	ctx context.Context, request goauth.PasswordResetConsumeRequest,
	prepare func(context.Context, goauth.Account) (string, error),
) (goauth.PasswordResetConsumeResult, error)

ConsumePasswordResetWithPreparation serializes the entire authenticated preparation and mutation while allowing resolver reads through the same scope.

func (*Store) CreateLocalAccount

func (s *Store) CreateLocalAccount(
	ctx context.Context,
	record goauth.LocalAccountRecord,
) (goauth.Account, error)

func (*Store) CreateLocalIdentity added in v0.6.0

func (s *Store) CreateLocalIdentity(ctx context.Context, record goauth.LocalIdentityRecord) (goauth.Account, error)

func (*Store) CreatePasswordReset

func (s *Store) CreatePasswordReset(ctx context.Context, record goauth.PasswordResetRecord) error

func (*Store) CreatePasswordResetForSubject added in v0.7.0

func (s *Store) CreatePasswordResetForSubject(ctx context.Context, record goauth.PasswordResetRecord) error

func (*Store) CreateSSOAccount

func (s *Store) CreateSSOAccount(
	ctx context.Context,
	record goauth.SSOAccountRecord,
) (goauth.Account, goauth.IdentityLink, error)

func (*Store) CreateSession

func (s *Store) CreateSession(ctx context.Context, record goauth.SessionRecord) error

func (*Store) FindAccount

func (s *Store) FindAccount(
	ctx context.Context,
	identifier goauth.IdentifierInput,
) (goauth.Account, error)

func (*Store) FindLocalAccount

func (s *Store) FindLocalAccount(
	ctx context.Context,
	identifier goauth.IdentifierInput,
) (goauth.LocalAccountRecord, error)

func (*Store) GetAccount

func (s *Store) GetAccount(ctx context.Context, subjectID goauth.SubjectID) (goauth.Account, error)

func (*Store) GetLocalAccount

func (s *Store) GetLocalAccount(
	ctx context.Context,
	subjectID goauth.SubjectID,
) (goauth.LocalAccountRecord, error)

func (*Store) GetLocalIdentifier added in v0.6.0

func (s *Store) GetLocalIdentifier(
	ctx context.Context, subjectID goauth.SubjectID, scheme goauth.IdentifierScheme,
) (goauth.Identifier, error)

func (*Store) GetPendingEmailChange

func (s *Store) GetPendingEmailChange(
	ctx context.Context,
	subjectID goauth.SubjectID,
	now time.Time,
) (goauth.PendingEmailChange, error)

func (*Store) GetSubjectLifecycle added in v0.6.0

func (s *Store) GetSubjectLifecycle(ctx context.Context, id goauth.SubjectID) (goauth.SubjectLifecycleView, error)

func (*Store) InAuthTransaction added in v0.5.0

func (s *Store) InAuthTransaction(ctx context.Context, fn func(context.Context) error) error

InAuthTransaction serializes store operations and publishes a private snapshot only on success. The fixture additionally enlists its encrypted event sink.

func (*Store) IntrospectSession

func (s *Store) IntrospectSession(ctx context.Context, sessionID string) (goauth.SessionSecurity, error)

func (*Store) InvalidatePasswordResets added in v0.7.0

func (s *Store) InvalidatePasswordResets(ctx context.Context, subjectID goauth.SubjectID, now time.Time) error

InvalidatePasswordResets mirrors the managed PostgreSQL helper for fixture hosts. Call it with the same transaction context as the alias mutation.

func (*Store) IssueEmailChange

func (*Store) LinkIdentity

func (s *Store) LinkIdentity(ctx context.Context, link goauth.IdentityLink) (goauth.IdentityLink, error)

func (*Store) LockAccount added in v0.5.0

func (s *Store) LockAccount(ctx context.Context, id goauth.SubjectID) (goauth.Account, error)

func (*Store) PeekRefresh added in v0.5.0

func (*Store) RecordSecurityEvent added in v0.5.0

func (s *Store) RecordSecurityEvent(ctx context.Context, event goauth.SecurityEvent) error

func (*Store) RenameLocalIdentity added in v0.6.0

func (s *Store) RenameLocalIdentity(
	ctx context.Context, request goauth.RenameLocalIdentityStoreRequest,
) (goauth.LocalIdentityView, error)
func (s *Store) ResolveIdentityLink(
	ctx context.Context,
	issuer string,
	externalSubject string,
) (goauth.Account, goauth.IdentityLink, error)

func (*Store) RetireLocalIdentity added in v0.6.0

func (s *Store) RetireLocalIdentity(
	ctx context.Context, request goauth.RetireLocalIdentityStoreRequest,
) (goauth.SubjectLifecycleView, error)

func (*Store) RevokeSession

func (s *Store) RevokeSession(
	ctx context.Context,
	subjectID goauth.SubjectID,
	sessionID string,
	now time.Time,
) (bool, error)

func (*Store) RevokeSubjectSessions

func (s *Store) RevokeSubjectSessions(
	ctx context.Context,
	subjectID goauth.SubjectID,
	now time.Time,
) (int64, error)

func (*Store) RotateRefresh

func (*Store) SetSubjectStatus

func (s *Store) SetSubjectStatus(
	ctx context.Context,
	subjectID goauth.SubjectID,
	status goauth.SubjectStatus,
	now time.Time,
) (goauth.Subject, error)

func (*Store) SetTrustedLocalPassword added in v0.6.0

func (s *Store) SetTrustedLocalPassword(
	ctx context.Context, request goauth.TrustedLocalPasswordStoreRequest,
) (goauth.Account, error)

func (*Store) TakeRateLimit

func (s *Store) TakeRateLimit(
	ctx context.Context,
	request goauth.RateLimitRequest,
) (goauth.RateLimitResult, error)

TakeRateLimit admits an attempt outside any managed auth transaction. Auth writes may roll back; attempt accounting must not roll back with them.

func (*Store) UpdateBasicProfile

func (s *Store) UpdateBasicProfile(
	ctx context.Context,
	subjectID goauth.SubjectID,
	profile goauth.BasicProfile,
	now time.Time,
) (goauth.Account, error)

func (*Store) VerifyEmailChallenge

func (s *Store) VerifyEmailChallenge(
	ctx context.Context,
	request goauth.EmailChallengeVerifyRequest,
) (goauth.EmailChallengeVerifyResult, error)

func (*Store) VerifyEmailChange

func (s *Store) VerifyEmailChange(
	ctx context.Context,
	request goauth.EmailChangeVerifyRequest,
) (goauth.EmailChangeVerifyResult, error)

Jump to

Keyboard shortcuts

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