sjhoeksma / cordova-plugin-keychain-touch-id

Touch ID plugin with saving password in keychain for IOS and android
87 stars 160 forks source link

[Enhancement]: Allow using pin for iOS #4

Open darkyen opened 7 years ago

darkyen commented 7 years ago

From the screenshots the android version supports fetching key from PIN, maybe support this on iOS ?

sjhoeksma commented 7 years ago

Can you be a more specific what you mean ? (Pin --> Key ?)

darkyen commented 7 years ago

I mean why can't there be a 4 digit PIN to fallback instead of mandatory fingerprint scan

darkyen commented 7 years ago

Also I'm wondering would you be interested if I make a PR to this with an API like

<Promise(Boolean)> window.secureStorage.isSupported

Returns a promise that resolves to true or false depending on if the plugin isSupported. Optionally this can be moved to a synchronous call with explaining what features are supported.

<Promise(String)> window.secureStorage.getItem(key, [message='Please confirm your identity'])

Returns a promise that resolves with the value if key was found, an empty string if key was not stored in keychain otherwise Reject with. The useragent must display a consent window either for entering a PIN or with password.

<Promise(Void)> window.secureStorage.setItem(key, value)

Returns a promise that resolves if the key was stored, and must otherwise Reject with

In this case in the light of ES7 Async/Await this would be as simple as

const keyPair = await createPubPrivKey();
await secureStorage.setItem('some-secure-key', keyPair.private);
// Later on
const privateKey = await secureStorage.getItem('some-secure-key', 'Please scan your fingerprint to confirm you want to make a secure transaction');

if ( privateKey ) {
   fetch({ 
      url: '/api/some-protected-operation',
      headers: {
          'Authorization': `Bearer ${token}`,
          'X-ACTION-VERIFIER': await sign(challenge, privateKey)
      }
   });
}

This works similar to localStorage/sessionStorage and stores strings only, and I believe works better with other API's.

berndlackinger commented 7 years ago

+1 fallback from fingerprint to pin entry

andreamaioli commented 7 years ago

+1 fallback from fingerprint to pin entry

tom94zoe commented 7 years ago

+1 fallback from fingerprint to pin entry

crapthings commented 7 years ago

so enter password on ios just does nothing, is this pin = password on screen ?