15

After a lot of rumors, Apple has announced the new iPhone 5s will have a biometric fingerprint sensor (Touch ID).

Has apple already released the API/SDK for this sensor? If so, can an example be provided?

Mick MacCallum
  • 129,200
  • 40
  • 280
  • 281
Niv
  • 2,294
  • 5
  • 29
  • 41
  • 1
    iOS 8 will have a Touch ID api. According to [this](http://www.apple.com/pr/library/2014/06/02Apple-Releases-iOS-8-SDK-With-Over-4-000-New-APIs.html) press release: `"iOS 8 also includes Touch ID™ APIs enabling developers to securely authenticate users within apps, protect logins and user data, and unlock keychain items. With iOS 8, developers can provide authentication with a successful fingerprint match while keeping your fingerprint data safe and protected in the secure enclave."` For developers there's a WWDC video [here](https://developer.apple.com/videos/wwdc/2014/?id=711) – LOP_Luke Jun 10 '14 at 15:33
  • Here is a little example code / tutorial about TouchID and the API: http://www.ama-dev.com/ios8-touchid-tutorial/ – Alexander Oct 01 '14 at 12:47

1 Answers1

26

Update iOS >= 8

As of iOS 8, the old part of this answer is no longer true. Apple has introduced the Local Authentication Framework, which allows you to utilize Touch ID in your applications

Quote + Sample code (Local Authentication Framework Reference)

The Local Authentication framework provides facilities for requesting authentication from users with specified security policies. For example, to request that the user authenticate using Touch ID you would use code such as this:

LAContext *myContext = [[LAContext alloc] init];
NSError *authError = nil;
NSString *myLocalizedReasonString = <#String explaining why app needs authentication#>;

if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) {
    [myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
                  localizedReason:myLocalizedReasonString
                            reply:^(BOOL succes, NSError *error) {
            if (success) {
                // User authenticated successfully, take appropriate action
            } else {
                // User did not authenticate successfully, look at error and take appropriate action
            }
        }];
} else {
    // Could not evaluate policy; look at authError and present an appropriate message to user
}

Old answer iOS < 7

From the September 10, 2013 keynote approximately 61 minutes into the presentation:

All fingerprint info is encrypted and stored inside the secure enclave in our new A7 chip. Here, it is locked away from everything else, accessible only by the Touch ID sensor. It’s never available to other software, it’s never stored on Apple’s servers or backed up to iCloud.

As of yet, this is all the information that is available. That being said, this is speculation, but I think it's likely that there won't be an API for this. If anything, usage of the sensor, will only be done through interaction with the keychain allowing the OS to interact with the sensor, while keeping your app separate in its cozy little sandbox.

EDIT:

It looks like it's true that we can't access the sensor. Here's a quote from an ALLThingsD article (linked below).

Apple Senior Vice President Phil Schiller confirmed to AllThingsD that developers won’t get access to use a fingerprint as a means of authentication. He declined to comment on whether that might come in the future.

http://allthingsd.com/20130910/iphone-developers-wont-get-fingerprint-reader-authentication-option-for-now-anyway/

Mick MacCallum
  • 129,200
  • 40
  • 280
  • 281
  • Accessing the sensor is one thing, but how about just verifying fingerprint for added security to an app? – Jonathan Dec 20 '13 at 17:03
  • I've read somewhere that one would be able to store and encrypt login credentials by fingerprint. I see it like: 1. login to app with username and password. 2. User is asked to use fingerprint to store those credentials. 3. Every next login can be done using fingerprint. – yershuachu Sep 10 '14 at 12:51
  • @yershuachu: it'll be great if you can share your source. – Dio Phung Feb 22 '15 at 10:47