oyyq99999 / react-native-secure-storage

A secure AsyncStorage implementation
MIT License
74 stars 54 forks source link

Repeated touch ID prompts when accessing storage #9

Closed perry-mitchell closed 5 years ago

perry-mitchell commented 5 years ago

I'm using your library in my project and it's fantastic! I've noticed a quirk however and I can't figure out why it's occurring. Whenever I write to the storage, touch authentication is always requested. We use touch to unlock our app and then we write to storage, so we get 2 touch id requests one after the other.

We're using it in our password manager that has an iOS extension for password autofill, and you can see the configs here and here (2 different uses of the storage).

We've tried seeing accessControl to null is in #6, but it still prompts us. The authenticationPrompt property seems to have no affect on what's displayed.

Have you seen this issue before? It's really bewildering us.

perry-mitchell commented 5 years ago

I guess what we're basically asking is this: Are we doing something wrong (which causes the endless prompts) or should we just stem the amount of writes we make (is it impossible to forgo the authentication prompts)?

If the device is unlocked (we're using accessible: ACCESSIBLE.WHEN_UNLOCKED), shouldn't it just be available, without a prompt?

perry-mitchell commented 5 years ago

Nevermind, we were able to fix the issue. Thanks!

oyyq99999 commented 5 years ago

I have looked at the pull request you mentioned but didn't get it. Seems the problem was caused by your own native code?

perry-mitchell commented 5 years ago

Yes it seems that it was it was this line:

(__bridge NSString *)kSecAttrAccessible: (__bridge id)accessible

Probably the value just wasn't getting passed.

woodpav commented 5 years ago

Is there a fix? The linked issue is from your own project not this one.

perry-mitchell commented 5 years ago

@woodpav See my previous comment. Adding that fixed it for us. The issue was not with this library.

fkrauthan commented 5 years ago

@perry-mitchell Where exactly do I need to add that line you posted? Did you modify this plugins code or is that something you put into your own App codebase?

woodpav commented 5 years ago

I get an authentication prompt whenever I make a SecureStorage.getItem call. Could this be the cause of this issue?

perry-mitchell commented 5 years ago

@fkrauthan One of our contributors submitted it, so I couldn't tell you sorry. Please feel free to inspect where it was added.