nemo_crypto_keystore 0.1.0 copy "nemo_crypto_keystore: ^0.1.0" to clipboard
nemo_crypto_keystore: ^0.1.0 copied to clipboard

OS keystore/Keychain MasterKeyCache implementation for nemo_crypto.

example/example.dart

import 'package:nemo_crypto/nemo_crypto.dart';
import 'package:nemo_crypto_keystore/nemo_crypto_keystore.dart';

void main() async {
  await SodiumProvider.init();

  // 1. Configure the OS-level Master Key Cache
  // This setup forces biometric authentication (FaceID/TouchID) where supported.
  final cache = KeystoreMasterKeyCache.biometric(
    android: const AndroidBiometricOptions(
      title: 'Unlock Secure Store',
      subtitle: 'Verify your identity to access keys',
      cancel: 'Cancel',
    ),
  );

  // 2. Pass the cache adapter to the Keyring
  final store = InMemoryWrapStore(); // Usually HiveWrapStore in production
  final keyring = Keyring(store, cache: cache);

  // 3. Attempt silent unlock on launch
  await keyring.init(trySilentUnlock: true);

  if (keyring.isUnlocked) {
    // Keyring unlocked silently via OS Keystore/Keychain
  } else {
    // Cache empty or biometric prompt denied. Fallback to passphrase
  }
}
1
likes
160
points
82
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

OS keystore/Keychain MasterKeyCache implementation for nemo_crypto.

Repository (GitHub)
View/report issues
Contributing

Topics

#keystore #keychain #biometrics #security #encryption

License

MIT (license)

Dependencies

flutter, flutter_secure_storage, nemo_crypto

More

Packages that depend on nemo_crypto_keystore