Skip to main content

Headless PIN

Headless PIN is a way to implement your own PIN screen.

SDK for Android

You must have the Headless PIN AAID: 0045#0011 in the Control Center in order to use the headless PIN.

The custom PIN screen created by the customer will be displayed prior to calling the HYPR SDK for Android registration/authentication interfaces. The PIN entered by the user is passed to the HYPR SDK for Android via the HyprPinActivity override. The Customer App must extend the HyprPinActivity class and implement an override of the getPinHeadless method. The Customer App then must add the custom HyprPinActivity to the overrides.xml class.

  1. Create a custom HyprPinActivity extended class and override the getPinHeadless method to return the PIN that was entered by the user.

    @Keep
    public class CustomHyprPinActivity extends HyprPinActivity {
    @Override
    public String getPinHeadless() {
    // Return the PIN that was entered by the user in the custom
    // registration or authentication screen that was
    // created by the customer.
    return pinEnteredByUserInCustomPinScreenCreatedByCustomer;
    }
    }
  2. Add that custom HyprPinActivity class (CustomHyprPinActivity in the above example) to the overrides.xml file in app/<module_name>/src/main/res/values directory.

        <string name="hypr_pin_activity_class_override">com.customerapp.CustomHyprPinActivity</string> 

SDK for iOS

Visibility

The view must still be presented, but users will not be required to enter a PIN.

Integration Guide

  1. Import the Headless PIN Authenticator.

    #import <HYPRPINHeadless/HYPRPINHeadless.h>
  2. Configure the Authenticator with the desired parameters.

    internal func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
       [HYPRUAFClient registerAuthenticatorModule:[HYPRPINHeadlessAsm class]];
       UIViewController *anInvisiblePINViewController = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"idForInvisiblePINViewController"];
       [HYPRPINHeadlessController.sharedInstance setPinLength:@6];
       [HYPRPINHeadlessController.sharedInstance setEnrollmentViewController:anInvisiblePINViewController];
       [HYPRPINHeadlessController.sharedInstance setVerificationViewController:anInvisiblePINViewController];
    }

3. Call registration within your `ViewController`.

```objective-c ViewController.m
NSString *pinToSubmit = <Get PIN from somewhere>;
[HYPRUserAgent setParentViewController:self];

// This will present the invisible PIN screen assuming the action id has the headless PIN
[[HYPRUserAgent sharedInstance] registerUserWithName:nil action:<policy with the headless PIN authenticator> completion:^(NSError * _Nullable error) {
   // Handle error         
}];
  1. Submit the PIN and handle the response.

    [HYPRPINHeadlessController.sharedInstance submitPIN:self.pinTextField.text onPinSubmitted:^(BOOL success, int numberOfRetriesLeft) {
            if(success) {
               // Handle success
            }    
            else {
               // Handle failure (You'll most likely want to cancel the operation as the user won't be able to enter the PIN again in the invisible PIN view controller)
              [HYPRPINHeadlessController.sharedInstance cancel];
            }
    }];