mogol / flutter_secure_storage Goto Github PK
View Code? Open in Web Editor NEWA Flutter plugin to store data in secure storage
Home Page: https://pub.dartlang.org/packages/flutter_secure_storage
License: BSD 3-Clause "New" or "Revised" License
A Flutter plugin to store data in secure storage
Home Page: https://pub.dartlang.org/packages/flutter_secure_storage
License: BSD 3-Clause "New" or "Revised" License
Looks like the LICENSE file was autogenerated and never updated. It has references to "Your Company". Could you update the LICENSE file (or confirm that you own a company called "Your Company" π).
Intermittently, I'll get the following error trying to start my app on an Android emulator (nexus 6 api 27, android 8.1 (google apis)
Built build/app/outputs/apk/debug/app-debug.apk.
E/FlutterSecureStoragePl( 6890): Registration failed
E/FlutterSecureStoragePl( 6890): java.security.UnrecoverableKeyException: Failed to obtain information about private key
E/FlutterSecureStoragePl( 6890): at android.security.keystore.AndroidKeyStoreProvider.loadAndroidKeyStorePublicKeyFromKeystore(AndroidKeyStoreProvider.java:223)
E/FlutterSecureStoragePl( 6890): at android.security.keystore.AndroidKeyStoreProvider.loadAndroidKeyStoreKeyPairFromKeystore(AndroidKeyStoreProvider.java:259)
E/FlutterSecureStoragePl( 6890): at android.security.keystore.AndroidKeyStoreProvider.loadAndroidKeyStorePrivateKeyFromKeystore(AndroidKeyStoreProvider.java:269)
E/FlutterSecureStoragePl( 6890): at android.security.keystore.AndroidKeyStoreSpi.engineGetKey(AndroidKeyStoreSpi.java:94)
E/FlutterSecureStoragePl( 6890): at java.security.KeyStoreSpi.engineGetEntry(KeyStoreSpi.java:482)
E/FlutterSecureStoragePl( 6890): at java.security.KeyStore.getEntry(KeyStore.java:1560)
E/FlutterSecureStoragePl( 6890): at com.it_nomads.fluttersecurestorage.ciphers.RSACipher18Implementation.createRSAKeysIfNeeded(RSACipher18Implementation.java:93)
E/FlutterSecureStoragePl( 6890): at com.it_nomads.fluttersecurestorage.ciphers.RSACipher18Implementation.<init>(RSACipher18Implementation.java:30)
E/FlutterSecureStoragePl( 6890): at com.it_nomads.fluttersecurestorage.ciphers.StorageCipher18Implementation.<init>(StorageCipher18Implementation.java:30)
E/FlutterSecureStoragePl( 6890): at com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin.<init>(FlutterSecureStoragePlugin.java:46)
E/FlutterSecureStoragePl( 6890): at com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin.registerWith(FlutterSecureStoragePlugin.java:33)
E/FlutterSecureStoragePl( 6890): at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:28)
E/FlutterSecureStoragePl( 6890): at [...myapplication...].MainActivity.onCreate(MainActivity.java:11)
E/FlutterSecureStoragePl( 6890): at android.app.Activity.performCreate(Activity.java:7009)
E/FlutterSecureStoragePl( 6890): at android.app.Activity.performCreate(Activity.java:7000)
E/FlutterSecureStoragePl( 6890): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
E/FlutterSecureStoragePl( 6890): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
E/FlutterSecureStoragePl( 6890): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
E/FlutterSecureStoragePl( 6890): at android.app.ActivityThread.-wrap11(Unknown Source:0)
E/FlutterSecureStoragePl( 6890): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
E/FlutterSecureStoragePl( 6890): at android.os.Handler.dispatchMessage(Handler.java:106)
E/FlutterSecureStoragePl( 6890): at android.os.Looper.loop(Looper.java:164)
E/FlutterSecureStoragePl( 6890): at android.app.ActivityThread.main(ActivityThread.java:6494)
E/FlutterSecureStoragePl( 6890): at java.lang.reflect.Method.invoke(Native Method)
E/FlutterSecureStoragePl( 6890): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
E/FlutterSecureStoragePl( 6890): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
E/FlutterSecureStoragePl( 6890): Caused by: android.security.KeyStoreException: Invalid key blob
E/FlutterSecureStoragePl( 6890): at android.security.KeyStore.getKeyStoreException(KeyStore.java:697)
E/FlutterSecureStoragePl( 6890): at android.security.keystore.AndroidKeyStoreProvider.loadAndroidKeyStorePublicKeyFromKeystore(AndroidKeyStoreProvider.java:224)
E/FlutterSecureStoragePl( 6890): ... 25 more
Syncing files to device Android SDK built for x86...
Flutter doctor output:
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[β] Flutter (Channel beta, v0.7.3, on Mac OS X 10.13.5 17F77, locale en-US)
[β] Android toolchain - develop for Android devices (Android SDK 28.0.2)
[β] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
[β] Android Studio (version 3.1)
[β] IntelliJ IDEA Community Edition (version 2018.2.3)
[β] VS Code (version 1.27.1)
[β] Connected devices (2 available)
β’ No issues found!
To get the application to run again, I have to wipe the emulator's data with AVD.
This seems more likely to happen if I've left my emulator running overnight or let my laptop go to sleep. But, I'm not 100% sure of the correlation.
Hi,
I am getting the above plugin exception running as an installed app (in release mode) on a Google Pixel XL running Android 9 SDK 28. I haven't got another real device to test on at the moment but it works on the emulator.
Unfortunately, that is all the information I have. Let me know if you can think of any other things I can try or ways to get more information.
Update: I get the same result if I build and release the application from the flutter dev or beta channel. It does however work if I run in release mode on the actual device during development. Once it is install (via the play store) it does not work.
Console Output:
W/KeyStore( 8212): KeyStore exception W/KeyStore( 8212): android.os.ServiceSpecificException: (code 7) W/KeyStore( 8212): at android.os.Parcel.createException(Parcel.java:1956) W/KeyStore( 8212): at android.os.Parcel.readException(Parcel.java:1910) W/KeyStore( 8212): at android.os.Parcel.readException(Parcel.java:1860) W/KeyStore( 8212): at android.security.IKeystoreService$Stub$Proxy.get(IKeystoreService.java:786) W/KeyStore( 8212): at android.security.KeyStore.get(KeyStore.java:195) W/KeyStore( 8212): at android.security.keystore.AndroidKeyStoreSpi.engineGetCertificateChain(AndroidKeyStoreSpi.java:118) W/KeyStore( 8212): at java.security.KeyStoreSpi.engineGetEntry(KeyStoreSpi.java:484) W/KeyStore( 8212): at java.security.KeyStore.getEntry(KeyStore.java:1560) W/KeyStore( 8212): at com.it_nomads.fluttersecurestorage.ciphers.RSACipher18Implementation.getEntry(RSACipher18Implementation.java:69) W/KeyStore( 8212): at com.it_nomads.fluttersecurestorage.ciphers.RSACipher18Implementation.wrap(RSACipher18Implementation.java:34) W/KeyStore( 8212): at com.it_nomads.fluttersecurestorage.ciphers.StorageCipher18Implementation.<init>(StorageCipher18Implementation.java:56) W/KeyStore( 8212): at com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin.<init>(FlutterSecureStoragePlugin.java:46) W/KeyStore( 8212): at com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin.registerWith(FlutterSecureStoragePlugin.java:33) W/KeyStore( 8212): at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:22) W/KeyStore( 8212): at com.mdtimeline.app.mdtimelineapp.MainActivity.onCreate(MainActivity.kt:11) W/KeyStore( 8212): at android.app.Activity.performCreate(Activity.java:7136) W/KeyStore( 8212): at android.app.Activity.performCreate(Activity.java:7127) W/KeyStore( 8212): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271) W/KeyStore( 8212): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893) W/KeyStore( 8212): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048) W/KeyStore( 8212): at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) W/KeyStore( 8212): at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) W/KeyStore( 8212): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) W/KeyStore( 8212): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) W/KeyStore( 8212): at android.os.Handler.dispatchMessage(Handler.java:106) W/KeyStore( 8212): at android.os.Looper.loop(Looper.java:193) W/KeyStore( 8212): at android.app.ActivityThread.main(ActivityThread.java:6669) W/KeyStore( 8212): at java.lang.reflect.Method.invoke(Native Method) W/KeyStore( 8212): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) W/KeyStore( 8212): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
pubspec.yaml:
dependencies: flutter: sdk: flutter flutter_localizations: sdk: flutter cupertino_icons: ^0.1.2 flutter_date_picker: "^0.1.8" intl: 0.15.7 barcode_scan: "^0.0.4" http: ^0.12.0 url_launcher: 4.0.1 async_loader: ^0.1.2 flutter_secure_storage: ^3.1.2 local_auth: ^0.3.0 device_info: ^0.3.0 shared_preferences: ^0.4.3 uni_links: ^0.1.4 json_serializable: ^2.0.0 progress_hud: ^1.1.0 event_bus: ^1.0.1 flutter_cupertino_date_picker: ^0.2.0
Flutter doctor:
`
Doctor summary (to see all details, run flutter doctor -v):
[β] Flutter (Channel beta, v0.11.13, on Mac OS X 10.14.1 18B75, locale en-PR)
[β] Android toolchain - develop for Android devices (Android SDK 28.0.3)
[β] iOS toolchain - develop for iOS devices (Xcode 10.1)
[β] Android Studio (version 3.2)
[β] IntelliJ IDEA Ultimate Edition (version 2018.3)
[β] Connected device (1 available)
β’ No issues found!
`
It would be really nice to have the possibility of sharing KeyChain/KeyStore between two or multiple apps. Is there any plan about this?
Articles:
We have users on Android 4.4 and it seems to work fine but two users on Android 5 (5.0 and 5.1) are seeing this error.
Any ideas? Is there a way to check for it, it causes the app to crash.
java.lang.NoClassDefFoundError:
at be.appmire.flutterkeychain.RsaKeyStoreKeyWrapper.createKeys (FlutterKeychainPlugin.kt:156)
at be.appmire.flutterkeychain.RsaKeyStoreKeyWrapper.createRSAKeysIfNeeded (FlutterKeychainPlugin.kt:123)
at be.appmire.flutterkeychain.RsaKeyStoreKeyWrapper.<init> (FlutterKeychainPlugin.kt:48)
at be.appmire.flutterkeychain.FlutterKeychainPlugin$Companion.registerWith (FlutterKeychainPlugin.kt:280)
at be.appmire.flutterkeychain.FlutterKeychainPlugin.registerWith (FlutterKeychainPlugin.kt)
at io.flutter.plugins.GeneratedPluginRegistrant.registerWith (GeneratedPluginRegistrant.java:21)
at com.invoiceninja.flutter.MainActivity.onCreate (MainActivity.java:12)
at android.app.Activity.performCreate (Activity.java:6221)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2611)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2723)
at android.app.ActivityThread.access$900 (ActivityThread.java:172)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1422)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:145)
at android.app.ActivityThread.main (ActivityThread.java:5832)
at java.lang.reflect.Method.invoke (Native Method)
at java.lang.reflect.Method.invoke (Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1194)
Caused by: java.lang.ClassNotFoundException:
at dalvik.system.BaseDexClassLoader.findClass (BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass (ClassLoader.java:511)
at java.lang.ClassLoader.loadClass (ClassLoader.java:469)
Data is available across installs. is there a way that data is not retained when app is uninstalled.
The older issue is closed -- but I am still seeing this anytime I run/reload my Android app .. even on a branch new emulator device I created..
Any ideas?
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 39.9s
Built build/app/outputs/apk/debug/app-debug.apk.
Installing build/app/outputs/apk/app.apk... 4.3s
W/KeyStore( 605): KeyStore exception
W/KeyStore( 605): android.os.ServiceSpecificException: (code 7)
W/KeyStore( 605): at android.os.Parcel.createException(Parcel.java:1956)
W/KeyStore( 605): at android.os.Parcel.readException(Parcel.java:1910)
W/KeyStore( 605): at android.os.Parcel.readException(Parcel.java:1860)
W/KeyStore( 605): at android.security.IKeystoreService$Stub$Proxy.get(IKeystoreService.java:786)
W/KeyStore( 605): at android.security.KeyStore.get(KeyStore.java:195)
W/KeyStore( 605): at android.security.keystore.AndroidKeyStoreSpi.engineGetCertificateChain(AndroidKeyStoreSpi.java:118)
W/KeyStore( 605): at java.security.KeyStoreSpi.engineGetEntry(KeyStoreSpi.java:484)
W/KeyStore( 605): at java.security.KeyStore.getEntry(KeyStore.java:1560)
W/KeyStore( 605): at com.it_nomads.fluttersecurestorage.ciphers.RSACipher18Implementation.createRSAKeysIfNeeded(RSACipher18Implementation.java:113)
W/KeyStore( 605): at com.it_nomads.fluttersecurestorage.ciphers.RSACipher18Implementation.(RSACipher18Implementation.java:33)
W/KeyStore( 605): at com.it_nomads.fluttersecurestorage.ciphers.StorageCipher18Implementation.(StorageCipher18Implementation.java:31)
W/KeyStore( 605): at com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin.(FlutterSecureStoragePlugin.java:46)
W/KeyStore( 605): at com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin.registerWith(FlutterSecureStoragePlugin.java:33)
W/KeyStore( 605): at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:26)
W/KeyStore( 605): at com.missionmode.mobile.MainActivity.onCreate(MainActivity.java:11)
W/KeyStore( 605): at android.app.Activity.performCreate(Activity.java:7136)
W/KeyStore( 605): at android.app.Activity.performCreate(Activity.java:7127)
W/KeyStore( 605): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
W/KeyStore( 605): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
W/KeyStore( 605): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
W/KeyStore( 605): at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
W/KeyStore( 605): at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
W/KeyStore( 605): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
W/KeyStore( 605): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
W/KeyStore( 605): at android.os.Handler.dispatchMessage(Handler.java:106)
W/KeyStore( 605): at android.os.Looper.loop(Looper.java:193)
W/KeyStore( 605): at android.app.ActivityThread.main(ActivityThread.java:6669)
W/KeyStore( 605): at java.lang.reflect.Method.invoke(Native Method)
W/KeyStore( 605): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
W/KeyStore( 605): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
MissingPluginException (MissingPluginException(No implementation found for method read on channel plugins.it_nomads.com/flutter_secure_storage))
Not sure what happened, but I've been getting the title error every time I try to run my app. I removed the plugin files from my .pub_cache
but the problem persists. I don't think I'm doing anything out of the ordinary. I've tried on multiple emulators and a physical device, but I just cannot get this to build.
final storage = new FlutterSecureStorage();
String accessToken = await storage.read(key: 'access_token'); // <-- error
This wasn't a problem until today. I think the only thing that might've borked my app would be doing a git checkout
but I'm not sure.
I am getting this error when building my flutter code for Android. Here's the verbose output:
[ +77 ms] [c:\Sources\flutter] git rev-parse --abbrev-ref --symbolic @{u}
[ +97 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[ ] origin/beta
[ ] [c:\Sources\flutter] git rev-parse --abbrev-ref HEAD
[ +45 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ ] beta
[ ] [c:\Sources\flutter] git ls-remote --get-url origin
[ +45 ms] Exit code 0 from: git ls-remote --get-url origin
[ ] https://github.com/flutter/flutter.git
[ ] [c:\Sources\flutter] git log -n 1 --pretty=format:%H
[ +31 ms] Exit code 0 from: git log -n 1 --pretty=format:%H
[ ] c7ea3ca377e909469c68f2ab878a5bc53d3cf66b
[ ] [c:\Sources\flutter] git log -n 1 --pretty=format:%ar
[ +39 ms] Exit code 0 from: git log -n 1 --pretty=format:%ar
[ ] 6 weeks ago
[ ] [c:\Sources\flutter] git describe --match v*.. --first-parent --long --tags
[ +43 ms] Exit code 0 from: git describe --match v*.. --first-parent --long --tags
[ ] v0.5.1-0-gc7ea3ca37
[ +288 ms] C:\Users\alpes\AppData\Local\Android\Sdk\platform-tools\adb devices -l
[ +30 ms] Exit code 0 from: C:\Users\alpes\AppData\Local\Android\Sdk\platform-tools\adb devices -l
[ ] List of devices attached
emulator-5554 device product:sdk_google_phone_x86 model:Android_SDK_built_for_x86 device:generic_x86 transport_id:2
[ +161 ms] Found plugin flutter_secure_storage at c:\Sources\flutter.pub-cache\hosted\pub.dartlang.org\flutter_secure_storage-3.1.0
[ +12 ms] Found plugin flutter_webview_plugin at c:\Sources\flutter.pub-cache\hosted\pub.dartlang.org\flutter_webview_plugin-0.1.6
[ +47 ms] Found plugin shared_preferences at c:\Sources\flutter.pub-cache\hosted\pub.dartlang.org\shared_preferences-0.2.5
[ +81 ms] C:\Users\alpes\AppData\Local\Android\Sdk\platform-tools\adb -s emulator-5554 shell getprop
[ +74 ms] ro.hardware = ranchu
[ +25 ms] Using hardware rendering with device Android SDK built for x86. If you get graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
[+1035 ms] Launching lib/main.dart on Android SDK built for x86 in debug mode...
[ +11 ms] Initializing gradle...
[ +1 ms] Using gradle from C:\Users\alpes\Downloads\flutter_template\android\gradlew.bat.
[ +117 ms] C:\Users\alpes\Downloads\flutter_template\android\gradlew.bat -v
[+1100 ms]
------------------------------------------------------------
Gradle 3.3
------------------------------------------------------------
Build time: 2017-01-03 15:31:04 UTC
Revision: 075893a3d0798c0c1f322899b41ceca82e4e134b
Groovy: 2.4.7
Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_152-release (JetBrains s.r.o 25.152-b02)
OS: Windows 10 10.0 amd64
[ +3 ms] Resolving dependencies...
[ ] [android] C:\Users\alpes\Downloads\flutter_template\android\gradlew.bat app:properties
[+2712 ms] NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to C:\Users\alpes\AppData\Local\Android\sdk\ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to C:\Users\alpes\AppData\Local\Android\sdk\ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
Incremental java compilation is an incubating feature.
BUILD FAILED
Total time: 2.504 secs
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Sources\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_secure_storage-3.1.0\android\build.gradle' line: 6
* What went wrong:
A problem occurred evaluating project ':flutter_secure_storage'.
> Could not find method google() for arguments [] on repository container.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
[ +9 ms] * Error running Gradle:
Exit code 1 from: C:\Users\alpes\Downloads\flutter_template\android\gradlew.bat app:properties:
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to C:\Users\alpes\AppData\Local\Android\sdk\ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to C:\Users\alpes\AppData\Local\Android\sdk\ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
Incremental java compilation is an incubating feature.
BUILD FAILED
Total time: 2.504 secs
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Sources\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_secure_storage-3.1.0\android\build.gradle' line: 6
* What went wrong:
A problem occurred evaluating project ':flutter_secure_storage'.
> Could not find method google() for arguments [] on repository container.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
[ +36 ms] "flutter run" took 5,625ms.
Please review your Gradle project setup in the android/ folder.
#0 throwToolExit (package:flutter_tools/src/base/common.dart:28)
#1 _readGradleProject (package:flutter_tools/src/android/gradle.dart:117)
#2 _gradleProject (package:flutter_tools/src/android/gradle.dart:90)
#3 getGradleAppOut (package:flutter_tools/src/android/gradle.dart:84)
#4 AndroidApk.fromCurrentDirectory (package:flutter_tools/src/application_package.dart:88)
#5 getApplicationPackageForPlatform (package:flutter_tools/src/application_package.dart:272)
#6 FlutterDevice.runHot (package:flutter_tools/src/resident_runner.dart:269)
#7 HotRunner.run (package:flutter_tools/src/run_hot.dart:216)
#8 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:395)
#9 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:344)
#10 FlutterCommand.run. (package:flutter_tools/src/runner/flutter_command.dart:279)
#11 AppContext.run. (package:flutter_tools/src/base/context.dart:142)
#12 _rootRun (dart:async/zone.dart:1126)
#13 _CustomZone.run (dart:async/zone.dart:1023)
#14 runZoned (dart:async/zone.dart:1501)
#15 AppContext.run (package:flutter_tools/src/base/context.dart:141)
#16 FlutterCommand.run (package:flutter_tools/src/runner/flutter_command.dart:270)
#17 CommandRunner.runCommand (package:args/command_runner.dart:194)
#18 FlutterCommandRunner.runCommand. (package:flutter_tools/src/runner/flutter_command_runner.dart:309)
#19 AppContext.run. (package:flutter_tools/src/base/context.dart:142)
#20 _rootRun (dart:async/zone.dart:1126)
#21 _CustomZone.run (dart:async/zone.dart:1023)
#22 runZoned (dart:async/zone.dart:1501)
#23 AppContext.run (package:flutter_tools/src/base/context.dart:141)
#24 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:265)
#25 CommandRunner.run. (package:args/command_runner.dart:109)
#26 new Future.sync (dart:async/future.dart:222)
#27 CommandRunner.run (package:args/command_runner.dart:109)
#28 FlutterCommandRunner.run (package:flutter_tools/src/runner/flutter_command_runner.dart:174)
#29 run. (package:flutter_tools/runner.dart:59)
#30 AppContext.run. (package:flutter_tools/src/base/context.dart:142)
#31 _rootRun (dart:async/zone.dart:1126)
#32 _CustomZone.run (dart:async/zone.dart:1023)
#33 runZoned (dart:async/zone.dart:1501)
#34 AppContext.run (package:flutter_tools/src/base/context.dart:141)
#35 runInContext (package:flutter_tools/src/context_runner.dart:43)
#36 run (package:flutter_tools/runner.dart:50)
#37 main (package:flutter_tools/executable.dart:49)
#38 main (file:///C:/Sources/flutter/packages/flutter_tools/bin/flutter_tools.dart:8)
#39 _startIsolate. (dart:isolate-patch/dart:isolate/isolate_patch.dart:277)
#40 _RawReceivePortImpl._handleMessage (dart:isolate-patch/dart:isolate/isolate_patch.dart:165)
Can someone please help?
MissingPluginException: MissingPluginException(No implementation found for method read on channel plugins.it_nomads.com/flutter_secure_storage)
File "platform_channel.dart", line 278, in MethodChannel.invokeMethod
File "<asynchronous suspension>"
File "flutter_secure_storage.dart", line 16, in FlutterSecureStorage.read
File "<asynchronous suspension>"
File "app.dart", line 222, in AppModel.init
File "<asynchronous suspension>"
File "splash.dart", line 19, in _SplashState.initState
File "framework.dart", line 3764, in StatefulElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 4667, in SingleChildRenderObjectElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 4667, in SingleChildRenderObjectElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 4667, in SingleChildRenderObjectElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 4667, in SingleChildRenderObjectElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 4667, in SingleChildRenderObjectElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3782, in StatefulElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3782, in StatefulElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 4667, in SingleChildRenderObjectElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 4667, in SingleChildRenderObjectElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3782, in StatefulElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 4667, in SingleChildRenderObjectElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3782, in StatefulElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3782, in StatefulElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 4772, in MultiChildRenderObjectElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "overlay.dart", line 493, in _TheatreElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3782, in StatefulElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 4667, in SingleChildRenderObjectElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3782, in StatefulElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 4667, in SingleChildRenderObjectElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 4667, in SingleChildRenderObjectElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3782, in StatefulElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 4667, in SingleChildRenderObjectElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3782, in StatefulElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3782, in StatefulElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3782, in StatefulElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3782, in StatefulElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3782, in StatefulElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "framework.dart", line 3666, in ComponentElement.performRebuild
File "framework.dart", line 3508, in Element.rebuild
File "framework.dart", line 3635, in ComponentElement._firstBuild
File "framework.dart", line 3782, in StatefulElement._firstBuild
File "framework.dart", line 3630, in ComponentElement.mount
File "framework.dart", line 2920, in Element.inflateWidget
File "framework.dart", line 2723, in Element.updateChild
File "binding.dart", line 857, in RenderObjectToWidgetElement._rebuild
File "binding.dart", line 828, in RenderObjectToWidgetElement.mount
File "binding.dart", line 774, in RenderObjectToWidgetAdapter.attachToRenderTree.<fn>
File "framework.dart", line 2235, in BuildOwner.buildScope
File "binding.dart", line 773, in RenderObjectToWidgetAdapter.attachToRenderTree
File "binding.dart", line 662, in _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&RendererBinding&WidgetsBinding.attachRootWidget
File "binding.dart", line 704, in runApp
File "main.dart", line 80, in main.<fn>
File "libasync_patch.dart", line 77, in _asyncThenWrapperHelper.<fn>
File "zone.dart", line 1134, in _rootRunUnary
File "zone.dart", line 1031, in _CustomZone.runUnary
File "future_impl.dart", line 129, in _FutureListener.handleValue
File "future_impl.dart", line 638, in Future._propagateToListeners.handleValueCallback
File "future_impl.dart", line 667, in Future._propagateToListeners
File "future_impl.dart", line 472, in Future._complete
File "future_impl.dart", line 51, in _SyncCompleter.complete
File "zone.dart", line 1134, in _rootRunUnary
File "zone.dart", line 1031, in _CustomZone.runUnary
File "future_impl.dart", line 129, in _FutureListener.handleValue
File "future_impl.dart", line 638, in Future._propagateToListeners.handleValueCallback
File "future_impl.dart", line 667, in Future._propagateToListeners
File "future_impl.dart", line 472, in Future._complete
File "future_impl.dart", line 51, in _SyncCompleter.complete
File "libasync_patch.dart", line 28, in _AsyncAwaitCompleter.complete
File "libasync_patch.dart", line 292, in _completeOnAsyncReturn
File "android_job_scheduler.dart", line 0, in AndroidJobScheduler._schedule
File "libasync_patch.dart", line 77, in _asyncThenWrapperHelper.<fn>
File "zone.dart", line 1134, in _rootRunUnary
File "zone.dart", line 1031, in _CustomZone.runUnary
File "future_impl.dart", line 129, in _FutureListener.handleValue
File "future_impl.dart", line 638, in Future._propagateToListeners.handleValueCallback
File "future_impl.dart", line 667, in Future._propagateToListeners
File "future_impl.dart", line 472, in Future._complete
File "future_impl.dart", line 51, in _SyncCompleter.complete
File "libasync_patch.dart", line 28, in _AsyncAwaitCompleter.complete
File "libasync_patch.dart", line 292, in _completeOnAsyncReturn
File "platform_channel.dart", line 0, in MethodChannel.invokeMethod
File "libasync_patch.dart", line 77, in _asyncThenWrapperHelper.<fn>
File "zone.dart", line 1134, in _rootRunUnary
File "zone.dart", line 1031, in _CustomZone.runUnary
File "future_impl.dart", line 129, in _FutureListener.handleValue
File "future_impl.dart", line 638, in Future._propagateToListeners.handleValueCallback
File "future_impl.dart", line 667, in Future._propagateToListeners
File "future_impl.dart", line 482, in Future._completeWithValue
File "future_impl.dart", line 512, in Future._asyncComplete.<fn>
File "zone.dart", line 1126, in _rootRun
File "zone.dart", line 1023, in _CustomZone.run
File "zone.dart", line 925, in _CustomZone.runGuarded
File "zone.dart", line 965, in _CustomZone.bindCallbackGuarded.<fn>
File "schedule_microtask.dart", line 41, in _microtaskLoop
File "schedule_microtask.dart", line 50, in _startMicrotaskLoop
[β] Flutter (Channel master, v0.5.8-pre.58, on Linux, locale en_US.UTF-8)
β’ Flutter version 0.5.8-pre.58 at /home/erik/projects/flutter/flutter
β’ Framework revision 85f09f622e (6 hours ago), 2018-07-16 22:42:06 -0700
β’ Engine revision c5a63d28bf
β’ Dart version 2.0.0-dev.67.0.flutter-84ca27a09e
[β] Android toolchain - develop for Android devices (Android SDK 27.0.3)
β’ Android SDK at /home/erik/Android/Sdk
β’ Android NDK location not configured (optional; useful for native profiling support)
β’ Platform android-27, build-tools 27.0.3
β’ Java binary at: /home/erik/projects/android-studio/jre/bin/java
β’ Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
β’ All Android licenses accepted.
[β] Android Studio (version 3.1)
β’ Android Studio at /home/erik/projects/android-studio
β’ Flutter plugin version 23.1.2
β’ Dart plugin version 173.4700
β’ Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
[β] VS Code (version 1.25.1)
β’ VS Code at /usr/share/code
β’ Flutter extension version 2.16.0
[β] Connected devices (1 available)
β’ F5321 β’ BH901GN05Z β’ android-arm64 β’ Android 8.0.0 (API 26
Hello guys. I highly appreciate this library and I want to use it for my project. We would like to store crypto wallet private keys in secure storage and looks like it works fine. But as I know, if you delete an app your Keychain storage will be gone and after reinstalling the app you will lose your data. iOS applications can backup the Keychain to iCloud and the secure data can be restored from iCloud after user reinstalling the app. Is it possible to achieve with flutter?
I'm not sure if this is expected or not.
However, all the data stored on the Shared Preferences stays there, normally.
Is there anything to take into account with the given scenario?
Thank you!
I just got Android 9.0 pie on my phone (physical not virtual). Everything was working fine and then once I downloaded 9.0 this error occurred. My co-worker has an Android but not a Samsung and it works fine but my Samsung produces this error when trying to read from secure storage. (Writing to secure storage doesn't seem to be an issue). Possibly locked keychain? Not sure if this fix is local or if anyone else experiences this issue.
E/flutter (31692): [ERROR:flutter/shell/common/shell.cc(184)] Dart Error: Unhandled exception: E/flutter (31692): PlatformException(error, Unsupported value: javax.crypto.BadPaddingException: error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT, null) E/flutter (31692): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:551:7) E/flutter (31692): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:292:18) E/flutter (31692): <asynchronous suspension> E/flutter (31692): #2 FlutterSecureStorage.read (package:flutter_secure_storage/flutter_secure_storage.dart:16:24) E/flutter (31692): <asynchronous suspension> E/flutter (31692): #3 main (package:phone_app/main.dart:27:11) E/flutter (31692): #4 _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:289:19) E/flutter (31692): #5 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
Hi,
I am happily using your flutter_secure_storage v2.0.0. Now I read about the breaking encryption change in 3.0.0. I also read about the reason for this in #6 . This should be no problem for me in my case.
So how should I upgrade to current v3 without the android users loosing their encrypted data? Is there an option to keep the old encryption scheme? (I didn't work through your code...)
Thank you very much.
While trying to run my flutter application on an Android 4.4.2 phone, I receive the following error:
E/FlutterSecureStoragePl(27505): Registration failed
E/FlutterSecureStoragePl(27505): java.lang.NullPointerException: chain == null
E/FlutterSecureStoragePl(27505): at java.security.KeyStore$PrivateKeyEntry.(KeyStore.java:1205)
E/FlutterSecureStoragePl(27505): at java.security.KeyStoreSpi.engineGetEntry(KeyStoreSpi.java:374)
E/FlutterSecureStoragePl(27505): at java.security.KeyStore.getEntry(KeyStore.java:644)
E/FlutterSecureStoragePl(27505): at com.it_nomads.fluttersecurestorage.ciphers.StorageCipher18Implementation.createKeysIfNeeded(StorageCipher18Implementation.java:78)
E/FlutterSecureStoragePl(27505): at com.it_nomads.fluttersecurestorage.ciphers.StorageCipher18Implementation.(StorageCipher18Implementation.java:29)
E/FlutterSecureStoragePl(27505): at com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin.(FlutterSecureStoragePlugin.java:44)
E/FlutterSecureStoragePl(27505): at com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin.registerWith(FlutterSecureStoragePlugin.java:32)
E/FlutterSecureStoragePl(27505): at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:21)
How can I fix this? It works perfectly on other Android versions.
Hi,
Thank you for making such a handy library!
I was trying to check FlutterSecureStorage
values in an integration test. However, when I imported flutter_secure_storage
in my test file and ran the test driver, my app threw a weird error and exited immediately on startup. This was the trace output by flutter:
file:///directory/to/flutter/packages/flutter/lib/src/services/binary_messenger.dart:7:8: Error: Not found: 'dart:ui'
import 'dart:ui' as ui;
^
file:///directory/to/flutter/packages/flutter/lib/src/services/font_loader.dart:7:8: Error: Not found: 'dart:ui'
import 'dart:ui';
^
file:///directory/to/flutter/packages/flutter/lib/src/services/platform_messages.dart:7:8: Error: Not found: 'dart:ui'
import 'dart:ui' as ui;
^
file:///directory/to/flutter/packages/flutter/lib/src/services/platform_views.dart:7:8: Error: Not found: 'dart:ui'
import 'dart:ui';
^
file:///directory/to/flutter/packages/flutter/lib/src/services/system_channels.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui';
^
file:///directory/to/flutter/packages/flutter/lib/src/services/system_chrome.dart:6:8: Error: Not found: 'dart:ui'
import 'dart:ui';
^
file:///directory/to/flutter/packages/flutter/lib/src/services/system_chrome.dart:12:1: Error: Not found: 'dart:ui'
export 'dart:ui' show Brightness;
^
file:///directory/to/flutter/packages/flutter/lib/src/services/text_editing.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show hashValues, TextAffinity, TextPosition;
^
file:///directory/to/flutter/packages/flutter/lib/src/services/text_editing.dart:9:1: Error: Not found: 'dart:ui'
export 'dart:ui' show TextAffinity, TextPosition;
^
file:///directory/to/flutter/packages/flutter/lib/src/services/text_input.dart:7:8: Error: Not found: 'dart:ui'
import 'dart:ui' show TextAffinity, hashValues, Offset;
^
Stopping application instance.
Driver tests failed: 254
My integration test runs otherwise. Simply adding the import statement
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
causes this issue. This means that I can't get access to the store when my app is running during my integration test. I import FlutterSecureStorage
in my app's main
method and load the values present before returning my Home widget.
I was wondering if anyone could shed some light on this. The stacktrace really leaves me in no man's land here.
Thanks in advance!
Best,
Ahmed
Weak or badly implemented encryption algorithms can endanger data storage and transmission due to RSA/ECB. Reference: https://github.com/jeroentrappers/flutter_keychain/blob/e9734e9481fe341d54163388e83f14fa122b3131/android/src/main/kotlin/be/appmire/flutterkeychain/FlutterKeychainPlugin.kt#L97
Please change the cipher to use AES/GCM to secure data storage. Reference: http://find-sec-bugs.github.io/bugs.htm#ECB_MODE
Since the minimum SDK of the package is 18, AES/GCM is supported. Reference: https://developer.android.com/reference/javax/crypto/Cipher.html
after installing the package and running flutter run I get an error
Macbook-pro:app joseph$ flutter run
Launching lib/main.dart on iPhone XR in debug mode...
Running pod install... 1.0s
Running Xcode build...
Xcode build done. 0.9s
Failed to build iOS app
Error output from Xcode build:
β³
** BUILD FAILED **
Xcode's output:
β³
=== BUILD TARGET flutter_secure_storage OF PROJECT Pods WITH CONFIGURATION Debug ===
In file included from
/Users/joseph/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.2.0/ios/Classes/FlutterSecureStoragePlug
in.m:1:
/Users/joseph/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.2.0/ios/Classes/FlutterSecureStoragePlug
in.h:1:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
Could not build the application for the simulator.
Error launching application on iPhone XR.
I think it is the package because I ran flutter run before adding the package and everything ran perfectly. This has happened to me twice now after adding the package
Caught error: MissingPluginException(No implementation found for method read on channel plugins.it_nomads.com/flutter_secure_storage)
#1 FlutterSecureStorage.read (package:flutter_secure_storage/flutter_secure_storage.dart:16:24)
[β] Flutter (Channel beta, v1.1.8, on Mac OS X 10.14.2 18C54, locale en-US)
β’ Flutter version 1.1.8 at /Users/neil/flutter
β’ Framework revision 985ccb6d14 (6 weeks ago), 2019-01-08 13:45:55 -0800
β’ Engine revision 7112b72cc2
β’ Dart version 2.1.1 (build 2.1.1-dev.0.1 ec86471ccc)
There's an exception thrown when using this plugin on Pie. It still works, though.
I googled it - this Stack Overflow thread looks helpful.
W/KeyStore: KeyStore exception
android.os.ServiceSpecificException: (code 7)
at android.os.Parcel.createException(Parcel.java:1964)
at android.os.Parcel.readException(Parcel.java:1918)
at android.os.Parcel.readException(Parcel.java:1868)
at android.security.IKeystoreService$Stub$Proxy.get(IKeystoreService.java:786)
at android.security.KeyStore.get(KeyStore.java:195)
at android.security.keystore.AndroidKeyStoreSpi.engineGetCertificateChain(AndroidKeyStoreSpi.java:118)
at java.security.KeyStoreSpi.engineGetEntry(KeyStoreSpi.java:484)
at java.security.KeyStore.getEntry(KeyStore.java:1560)
at com.it_nomads.fluttersecurestorage.ciphers.RSACipher18Implementation.getEntry(RSACipher18Implementation.java:69)
at com.it_nomads.fluttersecurestorage.ciphers.RSACipher18Implementation.unwrap(RSACipher18Implementation.java:42)
at com.it_nomads.fluttersecurestorage.ciphers.StorageCipher18Implementation.<init>(StorageCipher18Implementation.java:44)
at com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin.<init>(FlutterSecureStoragePlugin.java:46)
at com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin.registerWith(FlutterSecureStoragePlugin.java:33)
at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:19)
at tk.superl2.epimetheus.MainActivity.onCreate(MainActivity.kt:11)
at android.app.Activity.performCreate(Activity.java:7144)
at android.app.Activity.performCreate(Activity.java:7135)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2931)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3086)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6718)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:495)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Hey @mogol,
first of all: Thanks for this great plugin!
I kind of have a problem on ios:
await storage.read(key: "9flbRJh+7s09Auhjkudv");
(value of key is changed of course, but should look a bit like that)
returns my value on android, but returns null on ios without any code changes. I'd really appreciate any help!
I did the upgrade to 3.1.0 from 3.0.0. Execution worked just fine, however after cleaning the app data and reinstalling the app this error showed up - which strikes me as odd.
E/FlutterSecureStoragePl(10643): Registration failed
E/FlutterSecureStoragePl(10643): java.security.InvalidKeyException: Failed to unwrap key
E/FlutterSecureStoragePl(10643): at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineUnwrap(AndroidKeyStoreCipherSpiBase.java:682)
E/FlutterSecureStoragePl(10643): at javax.crypto.Cipher.unwrap(Cipher.java:2121)
E/FlutterSecureStoragePl(10643): at com.it_nomads.fluttersecurestorage.ciphers.RSACipher18Implementation.unwrap(RSACipher18Implementation.java:46)
E/FlutterSecureStoragePl(10643): at com.it_nomads.fluttersecurestorage.ciphers.StorageCipher18Implementation.<init>(StorageCipher18Implementation.java:48)
E/FlutterSecureStoragePl(10643): at com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin.<init>(FlutterSecureStoragePlugin.java:46)
E/FlutterSecureStoragePl(10643): at com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin.registerWith(FlutterSecureStoragePlugin.java:33)
E/FlutterSecureStoragePl(10643): at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:33)
E/FlutterSecureStoragePl(10643): at de.ffuf.uffl2.MainActivity.onCreate(MainActivity.kt:11)
E/FlutterSecureStoragePl(10643): at android.app.Activity.performCreate(Activity.java:6998)
E/FlutterSecureStoragePl(10643): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1230)
E/FlutterSecureStoragePl(10643): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2899)
E/FlutterSecureStoragePl(10643): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3046)
E/FlutterSecureStoragePl(10643): at android.app.ActivityThread.-wrap11(Unknown Source:0)
E/FlutterSecureStoragePl(10643): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1688)
E/FlutterSecureStoragePl(10643): at android.os.Handler.dispatchMessage(Handler.java:105)
E/FlutterSecureStoragePl(10643): at android.os.Looper.loop(Looper.java:164)
E/FlutterSecureStoragePl(10643): at android.app.ActivityThread.main(ActivityThread.java:6798)
E/FlutterSecureStoragePl(10643): at java.lang.reflect.Method.invoke(Native Method)
E/FlutterSecureStoragePl(10643): at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
E/FlutterSecureStoragePl(10643): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
E/FlutterSecureStoragePl(10643): Caused by: javax.crypto.IllegalBlockSizeException
E/FlutterSecureStoragePl(10643): at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:519)
E/FlutterSecureStoragePl(10643): at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineUnwrap(AndroidKeyStoreCipherSpiBase.java:680)
E/FlutterSecureStoragePl(10643): ... 19 more
E/FlutterSecureStoragePl(10643): Caused by: android.security.KeyStoreException: Unknown error
E/FlutterSecureStoragePl(10643): at android.security.KeyStore.getKeyStoreException(KeyStore.java:695)
E/FlutterSecureStoragePl(10643): at android.security.keystore.KeyStoreCryptoOperationChunkedStreamer.doFinal(KeyStoreCryptoOperationChunkedStreamer.java:224)
E/FlutterSecureStoragePl(10643): at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:506)
E/FlutterSecureStoragePl(10643): ... 20 more
I/FlutterActivityDelegate(10643): onResume setting current activity to this
Syncing files to device ONEPLUS A3003...
E/flutter (10643): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
E/flutter (10643): MissingPluginException(No implementation found for method read on channel plugins.it_nomads.com/flutter_secure_storage)
E/flutter (10643): #0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:278:7)
E/flutter (10643): <asynchronous suspension>
E/flutter (10643): #1 FlutterSecureStorage.read (package:flutter_secure_storage/flutter_secure_storage.dart:16:24)
E/flutter (10643): <asynchronous suspension>
E/flutter (10643): #2 AuthService.getAccessToken (package:uffl/network/auth_service.dart:107:37)
E/flutter (10643): <asynchronous suspension>
E/flutter (10643): #3 _RegisterPageState.initState (package:uffl/feature/intro/RegisterPage.dart:42:17)
E/flutter (10643): #4 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3751:58)
how to fast store / write a array data to storage?
like store this list to 'user' key.
List list = new List();
list.add('jack');
list.add('22');
list.add('usa');
Caused by java.lang.Exception: No certificate found under alias: com.*.*.FlutterSecureStoragePluginKey at com.*.*.encryption.RSACipher18Implementation.getPublicKey + 91(RSACipher18Implementation.java:91) at com.*.*.encryption.RSACipher18Implementation.wrap + 38(RSACipher18Implementation.java:38) at com.*.*.encryption.StorageCipher18Implementation.<init> + 56(StorageCipher18Implementation.java:56)
Hi, I've pulled this library into our native app ahead of launching our Flutter app and seen crash reports on a variety of Samsung Galaxy devices. Any idea what could be causing this issue?
HI there,
After upgrading from 3.1.1 to 3.1.2 I've encountered a strange error when I am trying to read data.
No implementation changed. I tried to uninstall the app, clear cache, cleared the data, but nothing worked.
Here are the logs:
Built build\app\outputs\apk\debug\app-debug.apk. E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage(31075): Failed to handle method call E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage(31075): java.lang.IllegalArgumentException: Unsupported value: javax.crypto.BadPaddingException: error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage(31075): at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:293) E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage(31075): at io.flutter.plugin.common.StandardMethodCodec.encodeErrorEnvelope(StandardMethodCodec.java:70) E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage(31075): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.error(MethodChannel.java:199) E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage(31075): at com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin.onMethodCall(FlutterSecureStoragePlugin.java:92) E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage(31075): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:191) E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage(31075): at io.flutter.view.FlutterNativeView.handlePlatformMessage(FlutterNativeView.java:163) E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage(31075): at android.os.MessageQueue.nativePollOnce(Native Method) E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage(31075): at android.os.MessageQueue.next(MessageQueue.java:379) E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage(31075): at android.os.Looper.loop(Looper.java:144) E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage(31075): at android.app.ActivityThread.main(ActivityThread.java:7425) E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage(31075): at java.lang.reflect.Method.invoke(Native Method) E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage(31075): at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245) E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage(31075): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
I am using this plugin to handle backward compability with the old version of the application, where I was using the keychain. But my KEYCHAIN_SERVICE
is different. Could you allow to set it on initialization?
My problem is that I want to secure the user id and password. The reason is that each time the user will login I will check the stored token (I store in shared preferences). So if the token is expired I will then send the user ID and password which I want to store securely to get a new token. Thus then I dont want the user to keep keying in their user id and password. Below is what I do in the login page.
The error I keep getting is this one
Error: Unexpected token 'await'.
String value = await _storage.read(key: "test1");
Error: A value of type 'dart.async::Futuredart.core::String' can't be assigned to a variable of type 'dart.core::String'.
Try changing the type of the left hand side, or casting the right hand side to 'dart.core::String'.
String value = await _storage.read(key: "test1");
_authenticateUser() async {
if(_valid()) {
var responseJson = await NetworkUtils.authenticateUser(
emailController.text, passwordController.text
);
print(responseJson);
if(responseJson == null) {
NetworkUtils.showSnackBar(_scaffoldKey, 'Something went wrong!');
}
else {
AuthUtils.insertDetails(_sharedPreferences, responseJson);
}
}
Here is the function I try to run on my login page to read the secure store
_fetchSessionAndNavigate() async {
_sharedPreferences = await _prefs;
String authToken = AuthUtils.getToken(_sharedPreferences);
String secKey = AuthUtils.getKey();
//print("Existing token"+authToken);
if(authToken != null){
print("Existing token"+authToken);
}
else{
print("No token yet");
}
}
Here is my full AuthUtil class.
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
class AuthUtils {
static final _storage = new FlutterSecureStorage();
static final String authTokenKey = 'auth_token';
static String getToken(SharedPreferences prefs) {
return prefs.getString(authTokenKey);
}
static String getKey async() {
String value = await _storage.read(key: "test1");
return value;
}
static insertDetails(SharedPreferences prefs, var response) {
print("Token is :"+response['token']);
print("userID is :"+response['userID']);
prefs.setString(authTokenKey, response['token']);
//var user = response['user'];
prefs.setString(userIdKey, response['userID']);
//prefs.setString(nameKey, user['name']);
_storage.write(key: "test1", value: "test");
//await _storage1.write
}
}
Hi, when I write a long string (>600 bytes) , the exceptiong throws.
java.lang.IllegalArgumentException: Unsupported value: javax.crypto.IllegalBlockSizeException: input must be under 256 bytes
any idea? thank you!
This is a question, not a bug report.
What are key and value you refer to in the documentation? is key the alias in the case of Android or is it just an id for a value I need to be stored in the storage.
say I need a small JSON string to be stored securely. Is this the correct method for it.
await storage.write(key: 'my_json_key', value: jsonString);
String jsonString = await storage.read(key: my_json_key',);
Does this mean, real encryption/decryption key management is done behind the scenes for both platforms? In the case of Android where do you store value data?
Hi, I preload an SQL database file from the root bundle and load into my app. Could you provide directions on how I would redirect this path into secure_storage?
Here is example code of how it loads today:
var databasesPath = await getDatabasesPath();
var path = join(databasesPath, "newfile.db");
print(path);
ByteData data = await rootBundle.load(join("assets", "preload.db"));
List bytes =
data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes);
await new File(path).writeAsBytes(bytes);
Thank you!
This will enable using plugin in flutter headless mode when there could be no activity
On https://pub.dartlang.org/packages/flutter_secure_storage the latest version is 3.1.1, however on github the latest version is 3.1.0. Could you push your latest branch please?
How much data can store in flutter_secure_storage ?
can we store 10 mb data?
from the documentation one can call await storage.delete(key: key)
; to delete a single item. Is there a way for deleting all items in one go (emptying/reseting the storage)?
I'm getting the error bellow when i try to run targeting iOS, for Android works fine.
Running "flutter packages get" in smartcrew...
Launching lib/main.dart on iPhone X in debug mode...
Xcode build done
Failed to build iOS app
Error output from Xcode build:
β³
** BUILD FAILED **
Xcode's output:
β³
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
The use of Swift 3 @objc inference in Swift 4 mode is deprecated. Please address deprecated @objc inference warnings, test your code with βUse of deprecated Swift 3 @objc inferenceβ logging enabled, and then disable inference by changing the "Swift 3 @objc Inference" build setting to "Default" for the "Runner" target.
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
/Users/betorcs/dev/smartcrew/ios/Runner/GeneratedPluginRegistrant.m:6:9: fatal error: 'flutter_secure_storage/FlutterSecureStoragePlugin.h' file not found
#import <flutter_secure_storage/FlutterSecureStoragePlugin.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Could not build the application for the simulator.
Error launching application on iPhone X.
Exited (sigterm)
$ flutter doctor
Building flutter tool...
Doctor summary (to see all details, run flutter doctor -v):
[β] Flutter (Channel beta, v0.1.5, on Mac OS X 10.12.6 16G1212, locale en-US)
[β] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[β] iOS toolchain - develop for iOS devices (Xcode 9.2)
[β] Android Studio (version 3.0)
[!] IntelliJ IDEA Ultimate Edition (version 2017.3.4)
β Flutter plugin not installed; this adds Flutter specific functionality.
β Dart plugin not installed; this adds Dart specific functionality.
[β] VS Code (version 1.20.1)
[β] Connected devices (1 available)
! Doctor found issues in 1 category.
how to check if a key exists?
Android API 28 added a new strongbox API for keystore, it would be great to take advantage of this on devices that support it (such as pixel 3)
Looks like it's just a setter for KeyGenParameterSpec.Builder
I have run into what appears to be a bit of a Gotcha unless I am missing something.
I have a function that should securely store an email.
Android Devices Tested (Emulators):
Pixel Pie API 28
Pixel 2 XL Pie API 28
Pixel 3 XL Pie API 28
Nexus 6.0 Marshmallow API 23
These Android Devices throw the error below unless I write the value with .toString() as below.
await storage.write(key: 'email', value: email.toString());
The function works perfectly without .toString() for iOS devices and works fine with .toString().
Why is this? Should this be the expected behaviour as I feel it could catch plenty of people out.
Function in question:
Future<void> persistLoginDetails({String email, String password}) async {
/// // Create storage
final storage = new FlutterSecureStorage();
// Write value
await storage.write(key: 'email', value: email);
return;
}
Android Error:
E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 4489): Failed to handle method call
E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 4489): java.lang.IllegalArgumentException: Unsupported value: java.lang.NullPointerException: Attempt to invoke virtual method 'byte[] java.lang.String.getBytes(java.nio.charset.Charset)' on a null object reference
E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 4489): at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:294)
E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 4489): at io.flutter.plugin.common.StandardMethodCodec.encodeErrorEnvelope(StandardMethodCodec.java:70)
E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 4489): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.error(MethodChannel.java:230)
E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 4489): at com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin.onMethodCall(FlutterSecureStoragePlugin.java:92)
E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 4489): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:222)
E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 4489): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:96)
E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 4489): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:643)
E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 4489): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 4489): at android.os.MessageQueue.next(MessageQueue.java:326)
E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 4489): at android.os.Looper.loop(Looper.java:160)
E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 4489): at android.app.ActivityThread.main(ActivityThread.java:6669)
E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 4489): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 4489): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 4489): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
I/flutter ( 4489): PlatformException(error, Unsupported value: java.lang.NullPointerException: Attempt to invoke virtual method 'byte[] java.lang.String.getBytes(java.nio.charset.Charset)' on a null object reference, null)
$flutter run
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
Running 'gradlew assembleDebug'...
Note: /Users/mbikyaw/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-0.0.1/android/src/main/java/com/it_nomads/fluttersecurestorage/ciphers/StorageCipher18Implementation.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
[β] Flutter (on Mac OS X 10.12.6 16G1114, locale en-SG, channel alpha)
β’ Flutter version 0.0.21 at /Users/-/flutter/flutter
β’ Framework revision 2e449f06f0 (2 days ago), 2018-01-29 14:26:51 -0800
β’ Engine revision 6921873c71
β’ Tools Dart version 2.0.0-dev.16.0
β’ Engine Dart version 2.0.0-edge.da1f52592ef73fe3afa485385cb995b9aec0181a
[β] Android toolchain - develop for Android devices (Android SDK 26.0.3)
β’ Android SDK at /Users/-/Library/Android/sdk
β’ Android NDK at /Users/-/Library/Android/sdk/ndk-bundle
β’ Platform android-27, build-tools 26.0.3
β’ Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
β’ Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)
[β] iOS toolchain - develop for iOS devices (Xcode 9.2)
β’ Xcode at /Applications/Xcode.app/Contents/Developer
β’ Xcode 9.2, Build version 9C40b
β’ ios-deploy 1.9.2
β’ CocoaPods version 1.2.1
[β] Android Studio (version 3.0)
β’ Android Studio at /Applications/Android Studio.app/Contents
β’ Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)
[β] IntelliJ IDEA Ultimate Edition (version 2017.3.4)
β’ Flutter plugin version 21.2.3
β’ Dart plugin version 173.4548.30
[β] Connected devices
β’ Android SDK built for x86 β’ emulator-5554 β’ android-x86 β’ Android 7.1.1 (API 25) (emulator)
I could not locate the test file in the repo. I understand that flutter is a dependency.
Is it possible to create tests without creating and running the Material UI app. If yes, is there any sample code that you can share, please?
Thank you.
Hello! I made a package with flutter and imported it into swift project.
In my swift project, I can read data stored by flutter_secure_storage in flutter part. However, in flutter package, I can't read data from swift keychain. I tried other keychain package such as flutter_keychain. I got the same result.
What's more, in flutter project, I can't use flutter_secure_storage to read data stored by flutter_keychain.
Is there any way I can do to read data stored in swift project? Thanks a lot.
Note: /Users/ben/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.1.0/android/src/main/java/com/it_nomads/fluttersecurestorage/FlutterSecureStoragePlugin.java uses unchecked or unsafe operations.
App Crashes on Samsung Galaxy S3 Neo (Android 4.4).
Exception in Logcat:
Process: com.it_nomads.fluttersecurestorageexample, PID: 3794
java.lang.VerifyError: com/it_nomads/fluttersecurestorage/ciphers/RSACipher18Implementation
at com.it_nomads.fluttersecurestorage.ciphers.StorageCipher18Implementation.<init>(StorageCipher18Implementation.java:31)
at com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin.<init>(FlutterSecureStoragePlugin.java:46)
at com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin.registerWith(FlutterSecureStoragePlugin.java:33)
at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:14)
at com.it_nomads.fluttersecurestorageexample.MainActivity.onCreate(MainActivity.java:12)
at android.app.Activity.performCreate(Activity.java:5451)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2292)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2386)
at android.app.ActivityThread.access$900(ActivityThread.java:169)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1277)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5476)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
I think the problem is the StrongBoxUnavailableException in the createKeys method (RSACipher18Implementation). I tried to comment it out and it works, but I have no idea how to replace it properly.
flutter_secure_storage: 3.1.2
Latest flutter build on ios gives :
flutter build ios
Building com.rockvole.kbmlViewer for device (ios-release)...
Automatically signing iOS for device deployment using specified development team
in Xcode project: SQ4ZRAJ4V2
Running pod install... 3.1s
Starting Xcode build...
Xcode build done. 5.8s
Failed to build iOS app
Error output from Xcode build:
β³
** BUILD FAILED **
Xcode's output:
β³
/Users/david/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.1.2
/ios/Classes/FlutterSecureStoragePlugin.m:87:49: warning: values of type
'OSStatus' should not be used as format arguments; add an explicit cast to
'int' instead [-Wformat]
NSLog(@"SecItemUpdate status = %d", status);
~~ ^~~~~~
%d (int)
/Users/david/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.1.2
/ios/Classes/FlutterSecureStoragePlugin.m:95:46: warning: values of type
'OSStatus' should not be used as format arguments; add an explicit cast to
'int' instead [-Wformat]
NSLog(@"SecItemAdd status = %d", status);
~~ ^~~~~~
%d (int)
3 warnings generated.
<module-includes>:1:1: warning: umbrella header for module 'Flutter' does
not include header 'FlutterNavigationController.h' [-Wincomplete-umbrella]
#import "Headers/Flutter.h"
^
1 warning generated.
1 warning generated.
Encountered error while building for device.
Using Version 2.0.0
[β] Flutter (Channel dev, v0.2.4, on Mac OS X 10.13.3 17D102, locale en-US)
[β] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[β] iOS toolchain - develop for iOS devices (Xcode 9.2)
[β] Android Studio (version 3.0)
[β] IntelliJ IDEA Ultimate Edition (version 2017.3)
[β] Connected devices (3 available)
Using Android Emulators of various versions (26+), and a physical Pixel (27)
Every now and then, but consistently once it happens once, flutter_secure_storage throws an exception when reading/writing a key.
Flutter throws the error:
E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 8518): Failed to handle method call E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 8518): java.lang.IllegalArgumentException: Unsupported value: javax.crypto.IllegalBlockSizeException E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 8518): at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:293) E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 8518): at io.flutter.plugin.common.StandardMethodCodec.encodeErrorEnvelope(StandardMethodCodec.java:70) E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 8518): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.error(MethodChannel.java:199) E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 8518): at com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin.onMethodCall(FlutterSecureStoragePlugin.java:77) E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 8518): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:191) E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 8518): at io.flutter.view.FlutterNativeView.handlePlatformMessage(FlutterNativeView.java:136) E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 8518): at android.os.MessageQueue.nativePollOnce(Native Method) E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 8518): at android.os.MessageQueue.next(MessageQueue.java:325) E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 8518): at android.os.Looper.loop(Looper.java:142) E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 8518): at android.app.ActivityThread.main(ActivityThread.java:6494) E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 8518): at java.lang.reflect.Method.invoke(Native Method) E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 8518): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) E/MethodChannel#plugins.it_nomads.com/flutter_secure_storage( 8518): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
However, this is caused by a system exception:
E/System ( 8518): java.lang.IllegalStateException: Binder has been finalized! E/System ( 8518): at android.os.BinderProxy.transactNative(Native Method) E/System ( 8518): at android.os.BinderProxy.transact(Binder.java:764) E/System ( 8518): at android.security.IKeystoreService$Stub$Proxy.abort(IKeystoreService.java:1373) E/System ( 8518): at android.security.KeyStore.abort(KeyStore.java:531) E/System ( 8518): at android.security.keystore.AndroidKeyStoreCipherSpiBase.finalize(AndroidKeyStoreCipherSpiBase.java:744) E/System ( 8518): at android.security.keystore.AndroidKeyStoreRSACipherSpi$PKCS1Padding.finalize(Unknown Source:0) E/System ( 8518): at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:250) E/System ( 8518): at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:237) E/System ( 8518): at java.lang.Daemons$Daemon.run(Daemons.java:103) E/System ( 8518): at java.lang.Thread.run(Thread.java:764)
The only ways I've resolved the issue is to do a hard restore of the device/emulator, as well as a full clean and rebuild of the project. It does not seem to happen on formal builds, just after a lot of debugging sessions, but nothing specific.
My app built in release mode does not get past the launch screen. When built in debug mode, everything works fine.
In my main
method, I have the following code that will check if a previous login session exists so the user does not need to log in again each time.
Future<null> main(List<String> args) async {
// ...
final storage = FlutterSecureStorage();
final hasExisting = await storage.read(key: "isExisting");
// ...
runApp(MyApp(hasExisting: hasExisting));
}
And I can confirm that this plugin is the one causing the problem because when I change the code to the following
Future<null> main(List<String> args) async {
// ...
// final storage = FlutterSecureStorage();
// final hasExisting = await storage.read(key: "isExisting");
final hasExisting = false;
// ...
runApp(MyApp(hasExisting: hasExisting));
}
Everything works, but of course the desired function is not the same.
I can confirm it was working as of March 5, but it no longer does.
Hi! For whatever reason, there is nothing related to flutter_secure_storage in my ios folder of the overall app, not even in the Podfile. I'm wondering if this has to do with me already installing a pod into the project (I made a pod for a c library that I depend on) before/simultaneous with installing flutter_secure_storage?
Flutter doctor comes up clean as well.
Xcode build done. 2.8s
Failed to build iOS app
Error output from Xcode build:
β³
** BUILD FAILED **
Xcode's output:
β³
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
/Users/mike/src/mobile/ios/Runner/GeneratedPluginRegistrant.m:6:9: fatal error: 'flutter_secure_storage/FlutterSecureStoragePlugin.h' file not found
#import <flutter_secure_storage/FlutterSecureStoragePlugin.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Could not build the application for the simulator.
Error launching application on iPhone XΚ.
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[β] Flutter (Channel stable, v1.5.4-hotfix.2, on Mac OS X 10.14.5 18F132, locale
en-US)
[β] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[β] iOS toolchain - develop for iOS devices (Xcode 10.2.1)
[β] Android Studio (version 3.4)
[β] IntelliJ IDEA Community Edition (version 2019.1.2)
[β] Connected device (1 available)
β’ No issues found!
~/src/mobile/ios(master β) ls Pods
Headers Manifest.lock Target Support Files
Local Podspecs Pods.xcodeproj
~/src/mobile/ios(master β) ls Pods/Target\ Support\ Files
Pods-Runner mbedTLS
~/src/mobile/ios(master β) ls -la
total 24
drwxr-xr-x 11 mike staff 352 Jun 3 15:16 .
drwxr-xr-x 18 mike staff 576 Jun 3 15:16 ..
drwxr-xr-x 8 mike staff 256 Jun 3 15:17 Flutter
drwxr-xr-x 2 mike staff 64 Jun 3 11:01 Frameworks
-rw-r--r--@ 1 mike staff 292 Jun 3 11:15 Podfile
-rw-r--r-- 1 mike staff 284 Jun 3 11:15 Podfile.lock
drwxr-xr-x 7 mike staff 224 Jun 3 15:02 Pods
drwxr-xr-x 10 mike staff 320 Jun 2 16:26 Runner
drwxr-xr-x@ 5 mike staff 160 Jun 3 11:15 Runner.xcodeproj
drwxr-xr-x@ 5 mike staff 160 Jun 3 11:01 Runner.xcworkspace
-rw-r--r-- 1 mike staff 15 Jun 3 15:17 ServiceDefinitions.json
Podfile:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'Runner' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
pod 'mbedTLS', :path => '../Pods/mbedTLS'
# Pods for Runner
end
So I'm wondering what I can do to get this configured to get the pod in correctly.
Thanks!
Mike
EDIT:
Here is my pubspec.yaml
name: mobile
description: A mobile frontend for my project.
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
flutter_secure_storage: ^3.2.1+1
provider: ^2.0.1+1
dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
I'm not sure if this was intentional or note, but on Android, the data is not saved when the user uninstalls the app but on IOS it is. I need to be able to save data between installs on both Android and IOS, is this possible with this package?
I store tokens in the keychain which I need to access from a background process (background_fetch, and content-available
push notifications) - to do this items have to be stored with kSecAttrAccessible
= kSecAttrAccessibleAlways
.
I think, the current implementation is a bit inconsistent, because on Android the default is that items can always be accessed, while on iOS the secure_storage can only be accessed while the user has unlocked the device.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.