kms_flutter 0.1.0 kms_flutter: ^0.1.0 copied to clipboard
Key Management Service for Flutter applications. Supports Keystore (Android), Keychain (iOS / Mac OS X), and browsers.
Overview #
This is an adapter for the package kms that uses:
- Keystore in Android
- Keychain in iOS and Mac OS X
- BrowserKms in browsers
Currently the package uses the package flutter_secure_storage for storing the keys. We may transition to direct use of the underlying APIs in the future.
Getting started #
1.Add dependency #
dependencies:
kms: ^0.4.0
kms_flutter: ^0.1.0
2.Set Android minimum version #
Your android/app/build.gradle should have minimum SDK version 18 or above:
defaultConfig {
// ...
minSdkVersion 18
// ...
}
3.Use #
import 'package:kms/kms';
import 'package:kms_flutter/kms_flutter';
final kms = flutterKms();
Future<void> main() async {
// Create a key pair
final document = kms.collection('examples').createKeyPair(
keyExchangeType: null,
signatureType: SignatureType.ed25519,
);
// Sign a document
final signature = document.sign([1,2,3]);
print('Signature: ${signature.bytes}');
print('Public key: ${signature.publicKey.bytes}');
}