Generating a string or hash via TouchID in Swift

How can I use TouchID to generate an unique string or hash in Swift?

I search a lot about it but I didn't find any way to do it.

Accepted Answer

You can't.


Touch ID answers the yes/no question "does the finger on the sensor match one of the ones registered in Settings?" That's all you get.

Thank you.

Generate the unique string yourself, and store it as a keychain item protected by TouchID.

Yes thats right and thank you. but the problem is that if the iPhone device has fingerprints of the other people,it can be insecure to use this method. Can I specify on fingerprint to one item of Keychain? I mean if iPhone has many fingerprints,the keychain item just can be accessible from one of this fingerprints.

Well, that is a separate question that goes to how you intend to use the identifier. No, the API does not have more granularity than junkpile described. Either data is accessible via Touch ID validation or not. You cannot request that it only be validated by a specific fingerprint.

Aha,Thanks,You help me a lot.

Generating a string or hash via TouchID in Swift
 
 
Q