InMemoryMfaPlatform class final

In-memory MfaPlatform for tests and demos. Not secure: values are plain bytes in Dart memory.

Honours the vault contract: it rejects levels outside the configured capabilities, simulates the biometric prompt for protected entries, keeps defensive copies and fails with typed VaultExceptions on demand.

Inheritance

Constructors

InMemoryMfaPlatform({VaultCapabilities? capabilities})
Creates an empty vault with capabilities (default: everything supported).

Properties

clipboard ↔ (String, Duration)?
Last text copied with copySensitive and its expiry.
getter/setter pair
currentCapabilities ↔ VaultCapabilities
The capabilities reported; tests may replace them.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
onBiometricPrompt ↔ bool Function(BiometricPrompt? prompt)
Decides the outcome of a simulated biometric prompt. Return false to simulate the user cancelling. Default: approve.
getter/setter pair
prompts → List<BiometricPrompt?>
Prompts shown so far, oldest first.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
screenCaptureProtected ↔ bool
Current screen-capture protection flag.
getter/setter pair

Methods

capabilities() → Future<VaultCapabilities>
What this device's vault can provide.
override
copySensitive(String text, {Duration expiry = const Duration(seconds: 30)}) → Future<void>
Copies text to the clipboard marked sensitive (not synced, hidden from previews where the OS allows) and clears it after expiry (FR-FAC-05).
override
delete(String key) → Future<void>
Removes key; absent keys are ignored.
override
failNext(VaultOperation operation, VaultException error, {String? key}) → void
Makes the next call of operation throw error (once). With key, only the next call for that key fails (write, read, delete).
keys() → Future<List<String>>
All keys in this plugin's namespace.
override
levelOf(String key) → ProtectionLevel?
The protection level key was stored with, or null.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read(String key, {BiometricPrompt? prompt}) → Future<Uint8List?>
The bytes under key, or null if absent. prompt is shown when the entry is biometric-protected. The caller owns the returned buffer: it is modifiable and should be overwritten once used.
override
setScreenCaptureProtection(bool enabled) → Future<void>
Blocks screenshots and screen recording of the app where supported (Android FLAG_SECURE); a no-op elsewhere, see VaultCapabilities.screenCaptureProtection.
override
toString() → String
A string representation of this object.
inherited
wipe() → Future<void>
Removes every entry and key in this plugin's namespace.
override
write(String key, Uint8List value, ProtectionLevel level) → Future<void>
Stores value under key at protection level, replacing any existing entry.
override

Operators

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

Constants

allCapabilities → const VaultCapabilities
A device that supports every protection level.