Closed martinsotirov closed 4 years ago
This value comes from calling atob(null)
, at least on the browser. I'm thinking it's probably something similar on Android. If I get time I'll create a PR, though I'm not currently setup to test on Android.
For me it is also returning some strange values on iOS like eé
We use the following workaround for now where we check for atob(null)
:
return SecureStoragePlugin.get({ key }).then(val => {
if (val.value && val.value !== atob(null)) {
this.setOurValue(val.value);
}
}).catch(error => {
console.log('Error occured');
});
Will provide a PR at least for the web part when I have time.
I lost some time because of this issue. I think it would be a good idea to specify that in the documentation of SecureStoragePlugin.get
in the meantime, until it gets fixed.
Should be fixed in v0.4.0. To use this version you have to update your app to use Capacitor v2. I added getPlatform() method, so you can check if really native plugin is used and not just web "fallback".
When I try to get an non-existing or removed key on iOS the promise correctly gets rejected but on Android and in the browser it resolves with a weird looking value:
I can implement a check in the resolve callback as a workaround but this might be something worth looking into.