jeroentrappers / flutter_keychain

A flutter plugin for secure storage on Android via KeyStore and iOS via Keychain
Other
57 stars 44 forks source link

flutter_keychain

A Flutter plugin for supporting secure storage of strings via Keychain and Keystore

If you have other types you want to store, you need to serialize to and from UTF-8 strings.

Note KeyStore was introduced in Android 4.3 (API level 18). The plugin does not work on earlier versions.

Getting Started


import 'package:flutter_keychain/flutter_keychain.dart';
...

// Get value
var value = await FlutterKeychain.get(key: "key");

// Put value
await FlutterKeychain.put(key: "key", value: "value");

// Remove item
await FlutterKeychain.remove(key: "key");

// Clear the secure store
await FlutterKeychain.clear();

Configure Android version

In [project]/android/app/build.gradle set minSdkVersion to >= 18.

android {
    ...
    defaultConfig {
        ...
        minSdkVersion 18
        ...
    }
}

Contributing

For help on editing plugin code, view the documentation.