iOS Headless PIN Authenticator
HYPR SDK for iOS: iOS Authenticators
HYPR SDK for iOS provides the ability to submit a PIN programmatically using the Headless PIN Authenticator.
Visibility
The view must still be presented, but users will not be required to enter a PIN.
Integration Guide
- Import the Headless PIN Authenticator.
#import <HYPRPINHeadless/HYPRPINHeadless.h>
- 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];
}
- Call registration within your
ViewController
.
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Β Β Β Β Β Β
}];
- 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];
Β Β Β Β }
}];
Updated about 1 year ago