0x0ece / yopa-native

0 stars 2 forks source link

Support Fingerprint #42

Closed 0x0ece closed 6 years ago

0x0ece commented 6 years ago

Idea: for a group, store the passphrase in clear in the SecureStore of the phone, and unlock the group via Fingerprint. If it's successful, load the passphrase from the SecureStore.

This is more an epic than a task, so feel free to spin up multiple tasks or PRs.

  1. models/Group Add a new deviceSecurity property, set to true if we store in the device. This should be read in import BUT NOT serialized.

  2. InitGroupScreen

    • the first option (secure) should only be visible if the device supports fingerprint and it's enabled -- this also includes setting properly the initial state/default value to 1 instead of 0
    • getGroupInstance, if securityLevel is 0, should return a Group model with deviceSecurity=true.
    • handlePress, before dispatching, should store the passphrase in the device secure store: https://docs.expo.io/versions/latest/sdk/securestore.html
  3. SecretList / GroupPassPrompt

    • The logic to unlock should be modified. If the group has deviceSecurity == true then we use the fingerprint and, if successful, we read from the secure storage
    • To be precise, I think we should 1. read from the secure storage. If the key is present, present the fingerprint. If it's successful, use it. 2. if the key is not present, ask the user for the passphrase (like now). 3. if the key was not there, but deviceSecurity is true, then store the key. So the next time fingerprint will work transparently
    • Ideally all this logic is in GroupPassPrompt, and SecretList remains untouched, but I'm not sure
0x0ece commented 6 years ago

Note that in the new version of expo the SecureStore has changed api: https://blog.expo.io/expo-sdk-v22-0-0-is-now-available-7745bfe97fc6

I'll send out a PR to update to v22 asap.

0x0ece commented 6 years ago

Minor changes: