Register, Authenticate, and Deregister

HYPR SDK for iOS

This page explains how to register, authenticate, and deregister a user with the HYPR API. It also shows how to deregister a specific authenticator, for example to re-add with a new PIN.

πŸ“˜

Before You Start

This document assumes that you've set up the HYPR SDK in your iOS project by following the steps on the Quick Start page.

To define which authenticators are available for use during registration, authentication, and deregistration you first need to create a policy. See HYPR SDK for IOS Policy Matching for details.

Registering a User

  1. Set the viewController on which the HYPR SDK for IOS UI will be presented.
  2. Register the user by calling the registerUser() method. If you pass nil for the name parameter, the SDK will generate a unique name for you. The action parameter should be the exact policy name you set in the Control Center.
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
      }
    }
  }
}

Authenticating a User

  1. Set the viewController on which the HYPR SDK UI will be presented.
  2. Authenticate by calling the authenticateUser() method. If you pass nil for the name parameter, the HYPR SDK will authenticate the current user. The action parameter should be the exact policy name you set in the Control Center.
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
      }
    }
  }
}

Deregistering a User

  1. Deregister the user by calling the deregisterUser() method. If you pass nil for the user parameter, the HYPR SDK will deregister the current user.
import HyprCore
  
class ViewController: UIViewController {
	func deregister() {
    HYPRUserAgent.sharedInstance().deregisterUser(nil) { error in
    	if let error = error {
      	// Handle the error
      }
      else {
      	// Deregistration is successful
      }
    }
  }
}

Getting Registered Authenticators

  1. To get a list of registered authenticators, pass the userAccount to the registeredAuthenticators() method. If you provide nil for the userAccount, the HYPR SDK will use the current active account.

The return value is a dictionary containing the authenticator attestation IDs (AAIDs) as keys and a list of every KeyId for that AAID.

HYPRUserAgent.sharedInstance().registeredAuthenticators(forUser: <userAccount>, facetId: HYPRUAFClient.facetId())

Deregistering an Authenticator

  1. Deregister a specific authenticator by calling the deregisterAuthenticator() method. You'll need to specify the AAID you want to deregister, along with the userAccount. If you provide nil for the userAccount, the HYPR SDK will use the current active account.
HYPRUserAgent.sharedInstance().deregisterAuthenticator(withAAID: "AAID goes here", forUser: <userAccount>, facetId: HYPRUAFClient.facetId()) { error in
            if let error = error {
                // Error
            }
            else {
                // Success! Authenticator has been removed
            }
        }