Problem with secure storge plugin


#1

Hi;

I am using “ionic-native/secure-storage” plugin for storing the data to local database.
As per the code on the plugin it adds as hard coded text ‘SS’ before a key for all the operations like get, set, remove , keys etc.

But I am getting an error while trying to get the data for particular key.
It gives me following message :-

Error: Uncaught (in promise): Error: Key [_SS_KeyName] not found. Error: Key [_SS_KeyName] not found. at g (file:///android_asset/www/build/polyfills.js:3:7133) at fail (file:///android_asset/www/plugins/cordova-plugin-secure-storage/www/securestorage.js:71:36) at Object.callbackFromNative (file:///android_asset/www/cordova.js:295:52) at processMessage (file:///android_asset/www/cordova.js:1119:17) at processMessages (file:///android_asset/www/cordova.js:1142:9) at
Correlation Id 502C-D642-8CC2-BD4D-98E9-505A-0727-5FAC
Context
Error: Uncaught (in promise): Error: Key [_SS_KeyName] not found.
Error: Key [_SS_KeyName] not found.
at g (file:///android_asset/www/build/polyfills.js:3:7133)
at fail (file:///android_asset/www/plugins/cordova-plugin-secure-storage/www/securestorage.js:71:36)
at Object.callbackFromNative (file:///android_asset/www/cordova.js:295:52)
at processMessage (file:///android_asset/www/cordova.js:1119:17)
at processMessages (file:///android_asset/www/cordova.js:1142:9)
at t.invoke (file:///android_asset/www/build/polyfills.js:3:14529)
at Object.onInvoke (file:///android_asset/www/build/main.js:4424:37)
at t.invoke (file:///android_asset/www/build/polyfills.js:3:14469)
at n.run (file:///android_asset/www/build/polyfills.js:3:9741)
at file:///android_asset/www/build/polyfills.js:3:6774
at t.invokeTask (file:///android_asset/www/build/polyfills.js:3:15213)
at Object.onInvokeTask (file:///android_asset/www/build/main.js:4415:37)
at t.invokeTask (file:///android_asset/www/build/polyfills.js:3:15134)
at n.runTask (file:///android_asset/www/build/polyfills.js:3:10390)
at a (file:///android_asset/www/build/polyfills.js:3:5313)
at g (file:///android_asset/www/build/polyfills.js:3:7133)
at l (file:///android_asset/www/build/polyfills.js:3:6251)
at file:///android_asset/www/build/polyfills.js:3:5607
at rejected (file:///android_asset/www/build/main.js:53309:89)
at t.invoke (file:///android_asset/www/build/polyfills.js:3:14529)
at Object.onInvoke (file:///android_asset/www/build/main.js:4424:37)
at t.invoke (file:///android_asset/www/build/polyfills.js:3:14469)
at n.run (file:///android_asset/www/build/polyfills.js:3:9741)
at file:///android_asset/www/build/polyfills.js:3:6774
at t.invokeTask (file:///android_asset/www/build/polyfills.js:3:15213)
at Object.onInvokeTask (file:///android_asset/www/build/main.js:4415:37)
at t.invokeTask (file:///android_asset/www/build/polyfills.js:3:15134)
at n.runTask (file:///android_asset/www/build/polyfills.js:3:10390)
at a (file:///android_asset/www/build/polyfills.js:3:5313)
at

Note:- KeyName in the above error is the actual key used in the application which is replaced here with word KeyName.

Anyone has any idea about the cause of this error.

Thanks;


#2

From how I understand it the “SS” is added internally and you don’t have to concern with it at all - just use storage.get('KeyName'). See also this blog post: https://www.raymondcamden.com/2016/08/16/working-with-ionic-native-using-secure-storage