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
-
- Object
- PlatformInterface
- MfaPlatform
- InMemoryMfaPlatform
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
falseto 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
textto the clipboard marked sensitive (not synced, hidden from previews where the OS allows) and clears it afterexpiry(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
operationthrowerror(once). Withkey, 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
keywas stored with, ornull. -
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, ornullif absent.promptis 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
valueunderkeyat protectionlevel, 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.