Encrypted file store, optionally secured by biometric lock for Android, iOS, MacOS and partial support for Linux, Windows and Web.
Meant as a way to store small data in a hardware encrypted fashion. E.g. to store passwords, secret keys, etc. but not massive amounts of data.
Check out AuthPass Password Manager for a app which makes heavy use of this plugin.
Requirements:
minSdkVersion 23
)android/build.gradle
: ext.kotlin_version = '1.4.31'
Theme.AppCompat
thme.
(Otherwise there will be crashes on Android < 29)
For example: android/app/src/main/AndroidManifest.xml:
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme">
[...]
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
</activity>
android/app/src/main/res/values/styles.xml:
<resources>
<style name="LaunchTheme" parent="Theme.AppCompat.NoActionBar">
...
</style>
<style name="NormalTheme" parent="Theme.AppCompat.NoActionBar">
...
</style>
</resources>
Known Issue: since iOS 15 the simulator seem to no longer support local authentication: https://developer.apple.com/forums/thread/685773
SecurityError, Error while writing data: -34018: A required entitlement isn't present.
You basically only need 4 methods.
final response = await BiometricStorage().canAuthenticate()
if (response != CanAuthenticateResponse.success) {
// panic..
}
final store = BiometricStorage().getStorage('mystorage');
final data = await storageFile.read();
final myNewData = 'Hello World';
await storageFile.write(myNewData);
See also the API documentation: https://pub.dev/documentation/biometric_storage/latest/biometric_storage/BiometricStorageFile-class.html#instance-methods