Ionic-native: Secure Storage in Ionic Native missing secureDevice function

Created on 31 May 2017  路  9Comments  路  Source: ionic-team/ionic-native

I'm submitting a ... (check one with "x")
[] bug report
[x ] feature request

Current behavior:
The current SecureStorage wrapper does not support secureDevice(successHandler,errorHandler) function which is present in the cordova plugin for android platform.

Also check this stackoverflow question

Expected behavior:
Should be able to do:

var ss = this.secureStorage.create('myStorage')
                .then((storage: SecureStorageObject) => {
                    storage.set('var', 'toto')
                        .then(
                        () => ss.secureDevice(()=>{},()=>{}),
                        (e) => console.log('error');
                        );
                }).catch((err) => {
                    console.error('The device is not secured');
                })

Steps to reproduce:

Use the latest ionic blank app and try to access secureDevice function.

Apologies if I should have raised this with main ionic repo or at the cordova plugin repo. Please let me know.

Most helpful comment

Hi guys,

Unless I'm mistaken, this feature will not work. The promise that returns the SecureStorageObject (SecureStorage.create('secure_storage')) already fails with a Device is not secure error. Therefore, we never get the SecureStorageObject on which we can call the secureDevice method.

All 9 comments

@surajrao I added the missing function. Wait for the next release

thank you @danielsogl

Hi guys,

Unless I'm mistaken, this feature will not work. The promise that returns the SecureStorageObject (SecureStorage.create('secure_storage')) already fails with a Device is not secure error. Therefore, we never get the SecureStorageObject on which we can call the secureDevice method.

@surajrao How would this work? The ss variable is a Promise<void>. So there isn't a function called secureDevice on ss?

@irundaia Oh you are right.. https://github.com/Crypho/cordova-plugin-secure-storage/blob/master/www/securestorage.js#L266 The function does need SecureStorageObject which you will not have in catch.

Hey everybody,

Does this bug will be close ?
More over, it's seem that solution works : https://stackoverflow.com/questions/46520464/ionic-secure-storage-ask-the-user-to-set-a-lock-screen/46583135#46583135

Have a good day ;)

The solution implies that you鈥檇 have to patch the javascript code from ionic-native. To me, that does not sound like a solution but a hack.

Right, after doing some tests, it seems not work on iOS ...
I don't exactly how Ionic "wrapper" from Cordova works, somebody knows ?

Hey,

After some projects update to last version (in package.json), I've a new problem. Apple detection is weak. 95% of the time, app said that phone is unsecure. I do not have that bug on Android
Am I the only one ?

I will give more information if I success to debug iOS app from Linux (with Remote IOS Debug)

Have a good coding day

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ihadeed picture ihadeed  路  4Comments

kyleap picture kyleap  路  4Comments

goleary picture goleary  路  3Comments

danbucholtz picture danbucholtz  路  3Comments

icchio picture icchio  路  3Comments