DVSecondFactors class
Enrolls and checks second factors for accounts.
Presenting a factor proves who is present; it does not by itself change a
session. After a code verifies, the caller completes the session's second
factor with DVSessions.completeMfa, which rotates its token.
Constructors
- DVSecondFactors({DVSecondFactorStore? store, required DVFieldCipher cipher, required String issuer, DVTotp totp = const DVTotp(), int recoveryCodeCount = 10, DateTime clock()?})
Properties
- cipher → DVFieldCipher
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- issuer → String
-
The name an authenticator app lists the account under.
final
- recoveryCodeCount → int
-
How many recovery codes a set holds.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- store → DVSecondFactorStore
-
final
- totp → DVTotp
-
final
Methods
-
beginTotp(
String userId, {required String account}) → Future< DVTotpEnrollment> -
Starts TOTP enrollment for
userId. Nothing is required of later sign-ins until confirmTotp proves the app holds the secret. -
confirmTotp(
String userId, String code) → Future< bool> - Confirms a pending enrollment with a code from the app. The code's step is spent, so it cannot then sign in.
-
hasTotp(
String userId) → Future< bool> -
Whether
userIdhas a confirmed authenticator. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
redeemRecoveryCode(
String userId, String code) → Future< bool> -
Spends one of
userId's recovery codes. Each works once. -
regenerateRecoveryCodes(
String userId) → Future< DVRecoveryCodes> - Generates a fresh set of recovery codes, invalidating every earlier one. The returned codes are the only readable copy.
-
remainingRecoveryCodes(
String userId) → Future< int> -
How many unspent recovery codes
userIdhas. -
removeRecoveryCodes(
String userId) → Future< void> -
Deletes every recovery code
userIdhas, spent or not. -
removeTotp(
String userId) → Future< void> -
Removes
userId's authenticator. -
toString(
) → String -
A string representation of this object.
inherited
-
verifyTotp(
String userId, String code) → Future< bool> -
Checks a code from
userId's authenticator. A code verifies once.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited