Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Secure Storage in Ionic Native missing secureDevice function #1625

Closed
surajrao opened this issue May 31, 2017 · 9 comments · Fixed by #1626
Closed

Secure Storage in Ionic Native missing secureDevice function #1625

surajrao opened this issue May 31, 2017 · 9 comments · Fixed by #1626

Comments

@surajrao
Copy link
Contributor

surajrao commented May 31, 2017

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.

@danielsogl
Copy link
Owner

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

@surajrao
Copy link
Contributor Author

thank you @danielsogl

ihadeed pushed a commit that referenced this issue Jun 1, 2017
* fix(secure-storage): add missing function

fix #1625

* Update index.ts
@irundaia
Copy link

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.

@irundaia
Copy link

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

@surajrao
Copy link
Contributor Author

@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.

@Servuc
Copy link
Contributor

Servuc commented Jan 26, 2018

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 ;)

@irundaia
Copy link

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

@Servuc
Copy link
Contributor

Servuc commented Jan 29, 2018

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

@Servuc
Copy link
Contributor

Servuc commented Aug 9, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants