InMemoryAuthTwoFactorBackend class final

Transactional in-memory backend for tests and local applications.

Commands are serialized per user. Every command snapshots all two-factor stores and restores them if a write or injected fault fails.

Implemented types

Constructors

InMemoryAuthTwoFactorBackend({InMemoryAuthTwoFactorStore? factorStore, InMemoryAuthTwoFactorChallengeStore? challengeStore, InMemoryAuthTwoFactorTrustedDeviceStore? trustedDeviceStore, InMemoryAuthTwoFactorStepUpStore? stepUpStore, AuthTwoFactorFaultInjector? faultInjector, DateTime clock()?})
Creates a transactional in-memory two-factor backend.

Properties

challengeStore → InMemoryAuthTwoFactorChallengeStore
Pending-challenge store used by this backend.
final
factorStore → InMemoryAuthTwoFactorStore
Factor store used by this backend.
final
faultInjector → AuthTwoFactorFaultInjector?
Optional fault injector used to exercise rollback paths.
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stepUpStore → InMemoryAuthTwoFactorStepUpStore
Step-up-proof store used by this backend.
final
trustedDeviceStore → InMemoryAuthTwoFactorTrustedDeviceStore
Trusted-device store used by this backend.
final

Methods

beginChallenge(AuthTwoFactorBeginChallengeCommand command) → Future<AuthTwoFactorCommandResult>
Atomically starts or bypasses a pending challenge.
override
beginEnrollment(AuthTwoFactorBeginEnrollmentCommand command) → Future<AuthTwoFactorCommandResult>
Atomically starts or replaces an enrollment.
override
captureDeletionState() → Object
Captures deletion state.
override
completeChallenge(AuthTwoFactorCompleteChallengeCommand command) → Future<AuthTwoFactorCommandResult>
Atomically completes a pending TOTP challenge.
override
completeRecoveryChallenge(AuthTwoFactorCompleteRecoveryChallengeCommand command) → Future<AuthTwoFactorCommandResult>
Atomically completes a pending recovery challenge.
override
disable(AuthTwoFactorDisableCommand command) → Future<AuthTwoFactorCommandResult>
Atomically disables two-factor state.
override
issueTrustedDevice(AuthTwoFactorIssueTrustedDeviceCommand command) → Future<AuthTwoFactorCommandResult>
Atomically issues a trusted-device record.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
regenerateRecoveryCodes(AuthTwoFactorRegenerateRecoveryCodesCommand command) → Future<AuthTwoFactorCommandResult>
Atomically replaces recovery-code digests.
override
restoreDeletionState(Object checkpoint) → void
Restores deletion state.
override
revokeAllStepUp(String userId) → Future<void>
Revokes every step-up proof belonging to userId.
override
revokeStepUp(AuthTwoFactorRevokeStepUpCommand command) → Future<void>
Revokes step-up proofs according to command.
override
revokeTrustedDevices(AuthTwoFactorRevokeTrustedDevicesCommand command) → Future<void>
Revokes trusted devices according to command.
override
toString() → String
A string representation of this object.
inherited
useRecoveryCode(AuthTwoFactorUseRecoveryCodeCommand command) → Future<AuthTwoFactorCommandResult>
Atomically consumes a recovery code.
override
verifyEnrollment(AuthTwoFactorVerifyEnrollmentCommand command) → Future<AuthTwoFactorCommandResult>
Atomically activates an enrollment.
override
verifyStepUp(AuthTwoFactorVerifyStepUpCommand command) → Future<AuthTwoFactorCommandResult>
Atomically issues a session-bound step-up proof.
override
verifyTotp(AuthTwoFactorVerifyTotpCommand command) → Future<AuthTwoFactorCommandResult>
Atomically verifies a TOTP code.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited