5

I want to make an unique string or hash via Touch ID on iPhones in Swift. I search a lot about it but I didn't find a solution to make it.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Behdad
  • 1,459
  • 3
  • 24
  • 36
  • 3
    You can't. All you can do with Touch ID is get a "yes" or "no" answer about whether the user touched the Touch ID sensor with a valid finger or not. – rmaddy Dec 06 '15 at 21:43
  • 1
    TouchID is just an authentication method. You can generate a UUID and store it in the keychain, requiring TouchID to access the item in the keychain. You can also request TouchID authentication before initially generating the UUID and storing it but there is nothing about the TouchID process itself that can generate an identifier. – Paulw11 Dec 06 '15 at 21:43
  • @Paulw11 Thank you so much. How Can I generate an UUID? And How Can I get it inside of my app? – Behdad Dec 06 '15 at 21:58
  • Use the NSUUID class. https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUUID_Class/ – Paulw11 Dec 06 '15 at 21:59
  • @Paulw11 Thank you so much. I got it. – Behdad Dec 06 '15 at 22:04

1 Answers1

3

you can NOT do this.

you can use universally unique identifier (UUID) of an ios Device.

let uuid = NSUUID().UUIDString

or generate your own unique identifier using irreversible algorithms.

Mojtaba Yeganeh
  • 2,788
  • 1
  • 30
  • 49
  • That string will not be tied to a fingerprint which I'm guessing is what the OP wanted to do. – Paul Cezanne Dec 07 '15 at 13:19
  • Thanks, I wanted to create an App in iOS that when user input his fingerprint on Touch ID, then the App returns an unique hash or string as an a password or some secret key. @Mojtabye – Behdad Dec 11 '15 at 16:51
  • you can Not tie fingerprint to unique hash too much ! , because as i said before result is boolean only ! . `let toHash = email + isAuthenticated + UUID`. – Mojtaba Yeganeh Dec 13 '15 at 20:44