iOS Native Fingerprint Authenticator

HYPR SDK for iOS

πŸ“˜

NOTE

Any fingerprint registered on the device can register/authenticate into your App.

1242

Enrollment Screen

1242

Authentication Screen

1242

Invalid Fingerprint Screen

Description

Standard Fingerprint AAID (Authenticator ID)0045#1005
Full Basic Attestation Fingerprint AAID
(Requires Advanced Device Protection)
0045#1006
Number of Retries for Enrollment3
Number of Retries for Authentication3
Number of Retries before Fingerprint reader is locked5
Fingerprint reader lock timeForever until you unlock your phone via PIN

Setup

  1. Create a group to contain the frameworks.
467
  1. Embed and link the HYPR Frameworks.
1388
  1. Follow the steps below to enable the Fingerprint Authenticator. Since this is typically done during App startup, place it in AppDelegate.swift.
import HyprCore
import HYPRFingerprint

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    HYPRUAFClient.registerAuthenticatorModule(HYPRFingerprintAsm.self)
    HYPRUserAgent.setSSLPinningEnabled(false)
    if HYPRUserAgent.sharedInstance().activeProfile() == nil {
    let config = HYPRUserAgentProfileConfiguration(
        rpAppId: "Relying Party App ID i.e: HYPRDefaultApplication",
      rpServerUrl: "Relying Party URL i.e.: https://9999-pov.hypr.com",
      deviceType: "WEB",
      rpSSLPinCredentials: nil,
      additionalData: nil)
  
    let profile = HYPRUserAgentProfile(displayName: "Place a profile name name here: i.e. MyProfile",
        configuration: config,
      persona: nil,
      userAccounts: nil)
      HYPRUserAgent.sharedInstance().registerProfile(profile!)
    }
    return true
  }
}

Register, Authenticate, Deregister

πŸ“˜

Create a Policy with Fingerprint

To dictate what authenticators to use during registration, authentication, and deregistration, you'll need to create a policy that includes the Fingerprint Authenticator.

See Policy Matching for greater detail.

import HyprCore
  
class ViewController: UIViewController {
    func register() {
    HYPRUserAgent.setParentViewController(self)
    HYPRUserAgent.sharedInstance().registerUser(withName: nil, action: "<policy name goes here>") { error in
        if let error = error {
        // Handle the error
      }
      else {
        // Registration is successful
      }
    }
  }
}

By passing nil for the first argument, it will authenticate the current user.

import HyprCore
  
class ViewController: UIViewController {
    func authenticate() {
    HYPRUserAgent.setParentViewController(self)
    HYPRUserAgent.sharedInstance().authenticateUser(nil, action: "<policy name goes here>") { error in
        if let error = error {
        // Handle the error
      }
      else {
        // Authentication is successful
      }
    }
  }
}

By passing nil for the first argument, it will deregister the current user.

import HyprCore
  
class ViewController: UIViewController {
    func deregister() {
    HYPRUserAgent.setParentViewController(self)
    HYPRUserAgent.sharedInstance().deregisterUser(nil) { error in
        if let error = error {
        // Handle the error
      }
      else {
        // Deregistration is successful
      }
    }
  }
}

UI Customization

To customize elements displayed by the HYPR SDK for iOS, use HYPRFingerprintAuthenticatorViewConfiguration.sharedInstance to set properties describing the specific changes you want to make.

The HYPRFingerprintAuthenticatorViewConfiguration.sharedInstance provides the following properties to style UI elements:

PropertyDescription
authenticationPromptTextText displayed to the user in the fingerprint authentication alert.
biometryLockoutVerifyAlertTitleText displayed to the user if authentication was unsuccessful.
biometryLockoutEnrollAlertTitleText displayed to the user if enrollment was unsuccessful.
biometryLockoutAlertCloseButtonTitleAlert cancellation button text.
biometryLockoutAlertMessageText displayed to the user if authentication or enrollment has been unsuccessful and the number of allowed attempts has been exceeded.

Example

import HyprCore
import HYPRFingerprint

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        let fingerprintConfig = HYPRFingerprintAuthenticatorViewConfiguration.sharedInstance()
      fingerprintConfig.authenticationPromptText = "This is where your touch instructions go"
      fingerprintConfig.biometryLockoutVerifyAlertTitle = "Verification failed"
      fingerprintConfig.biometryLockoutEnrollAlertTitle = "Enrollment failed"
      fingerprintConfig.biometryLockoutAlertCloseButtonTitle = "Close"
      fingerprintConfig.biometryLockoutAlertMessage = "Try again later"
    return true
  }
}

Here is the full list of properties:

@interface HYPRFingerprintAuthenticatorViewConfiguration : NSObject <NSCopying, NSCoding>

+ (instancetype _Nonnull )sharedInstance;

/**
 * Fingerprint authenticator prompt text
 */
@property (nonatomic, copy, nullable) NSString *authenticationPromptText;
/**
 * Biometry lockout enroll alert title
 */
@property (nonatomic, copy, nullable) NSString *biometryLockoutEnrollAlertTitle;
/**
 * Biometry lockout verify alert title
 */
@property (nonatomic, copy, nullable) NSString *biometryLockoutVerifyAlertTitle;
/**
 * Biometry lockout alert message
 */
@property (nonatomic, copy, nullable) NSString *biometryLockoutAlertMessage;
/**
 * Biometry lockout alert close button title
 */
@property (nonatomic, copy, nullable) NSString *biometryLockoutAlertCloseButtonTitle;

@end