SelfLender / react-native-biometrics

React Native module for iOS and Android biometrics
MIT License
665 stars 228 forks source link

What happen if Private key already exist ? + Multi account ? #23

Open MayoudP opened 5 years ago

MayoudP commented 5 years ago

Hello, I'm wondering, if a user already created a keypair :

  Biometrics.createKeys('Confirm fingerprint in order to activate it')
          .then((publicKey) => {
            console.log(publicKey)
          })

The next time he do that, if the key already exist, how does your lib works ? Does it create a new_publicKey and keep the private one on the keychain ? Or does it modify both ? Sorry for the small issues, not usefull, but I just would like to know...

Moreover, how does it works in case of multi account on the same device ? Let's say, I'm connect with my account A, I'm activating touchID on my application, it's creating a first keypair. Then I loggout, and one of my friend's connecting to his account B, and activate touchID. How does the Biometrics will know which private key to use when creating a new signature with encrypted data...?

NappyPirate commented 5 years ago

So currently, this library only maintains one key pair. If createKeys is called again it will overwrite the original keys with a new pair. It is possible to add functionality that would allow you to maintain multiple pairs, would that functionality be useful to you?

MayoudP commented 5 years ago

@NappyPirate Yes, a lot. Since I would like to implement touchID for my app, and implementing a keypair process for the security... But I have to be able to save several private keys (I guess) in case if two differents users connect on the same phone and activate the touchID.

Donhv commented 2 years ago

So currently, this library only maintains one key pair. If createKeys is called again it will overwrite the original keys with a new pair. It is possible to add functionality that would allow you to maintain multiple pairs, would that functionality be useful to you?

How about this feature?