AuthExceptionCode enum

Why an AuthException was raised.

New members may be added in a minor release, so a switch over this should carry a default rather than being exhaustive. Several platform conditions still arrive as unknown — Android reports every BiometricPrompt error beyond cancel, timeout and the two lockouts that way — and narrowing them is only a minor-version change while this contract holds.

Inheritance
Available extensions

Values

userCanceled → const AuthExceptionCode

User taps the cancel/negative button or presses back.

canceled → const AuthExceptionCode

Authentication prompt is canceled due to another reason (like when biometric sensor becamse unavailable like when user switches between apps, logsout, etc).

unknown → const AuthExceptionCode
timeout → const AuthExceptionCode
linuxAppArmorDenied → const AuthExceptionCode
lockout → const AuthExceptionCode

Too many failed attempts, and biometry is locked until it recovers on its own. Retrying shortly is the correct response; nothing is lost.

Android only, from BiometricPrompt.ERROR_LOCKOUT. iOS and macOS never report this value — see lockoutPermanent.

lockoutPermanent → const AuthExceptionCode

Locked out until the user enters their device credential (PIN, pattern or password on Android, the passcode on iOS and macOS). Waiting does not clear it. Nothing is lost: the data is readable again once the user has entered their credential.

On Android this follows continued failures after lockout. iOS and macOS have no separate temporary state — LAError.biometryLockout always wants the passcode — so they report this value for every biometric lockout, and only for a store with darwinBiometricOnly: true. Without that flag the item's access control is .userPresence, which falls back to the passcode by itself, so a biometric lockout is not an error the caller ever sees.

keyInvalidated → const AuthExceptionCode

The key backing this storage was destroyed because the device's enrolled biometrics changed since it was created — a fingerprint or face added or removed. The stored value is gone, and the plugin has already removed the unreadable remains, so the next write starts clean.

Android only, and certain when reported: KeyPermanentlyInvalidatedException is a documented, unambiguous signal from the Keystore. It reaches a caller from read(); write() recovers from it silently, since the value it is about to store replaces the one that was lost anyway.

It is certain only for a store that authenticates per use — one left with androidAuthenticationValidityDuration unset. A store with a validity duration holds a key bound to the device credential as well, which an enrollment change does not invalidate, so the condition is not expected there; were the Keystore to raise it anyway, it would arrive as a PlatformException rather than as this code.

iOS and macOS have no equivalent signal and never report this value. The Keychain collapses an item whose access control can no longer be satisfied into the same errSecAuthFailed it uses for an ordinary failed attempt, which arrives as authFailed.

authFailed → const AuthExceptionCode

Authentication failed, and the platform did not say why. The value is most likely still there and readable after a successful authentication, so do not delete the store in response to this.

iOS and macOS only, from the Keychain's errSecAuthFailed once lockoutPermanent has been ruled out. That one status covers every outcome Apple does not distinguish, and the observed causes are a mix of the harmless and the terminal:

Prompting the user to try again is the one response that is right for all of them. Treat the value as lost only after a deliberate, successful re-authentication has failed to produce it.

unavailable → const AuthExceptionCode

The check cannot run on this device now: no biometrics enrolled, no passcode set, the sensor unavailable (a closed lid, a remote session). The value is intact; ask for the user's password instead.

Reported by the gate-only form on macOS (StorageFileInitOptions.darwinGateOnly) and by Windows Hello.

Properties

hashCode → int
The hash code for this object.
no setterinherited
index → int
A numeric identifier for the enumerated value.
no setterinherited
name → String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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

Constants

values → const List<AuthExceptionCode>
A constant List of the values in this enum, in order of their declaration.