Skip to main content
In order to register a device using the Hanko FIDO UAF Client and the Hanko API, the following three steps must be performed:
  • Step 1: Retrieve a registration request
  • Step 2: Pass the registration request to the Hanko FIDO UAF Client
  • Step 3: Send the public key to the Hanko API
Hanko FIDO UAF Client registration flow

Sequence diagram for the UAF registration flow with the Hanko FIDO UAF Client for Android

Step 1: Retrieve a registration request

The first step consists of initiating the registration of an authenticator device by issuing a POST request to the UAF endpoint ({API_URL}/v1/uaf/requests) of the Hanko API. The POST request body must include the appropriate operation type (i.e. REG for registration), a userId and a username. The userId will be used to map a public key credential generated during registration to a specific user account with the relying party. As mentioned in the prerequisites, you need an HTTP client to make a request to your backend. In your backend you can use one of the server-side Hanko SDKs to initiate the registration with the Hanko API. This request targets a secured endpoint of the API, so you will need an API Key ID and an API Key (see the prerequisites).
The API will respond with a Hanko request in a PENDING status. It contains the registration request issued by the FIDO server which must be passed to the Hanko FIDO UAF Client in order to trigger credential creation and prompting the user for an authentication gesture.
Remember to cache the returned Hanko request because the request id will be required to finalize the registration in Step 3.

Step 2: Pass the registration request to the Hanko FIDO UAF Client

Extract the request value from the Hanko request you retrieved in the previous step.Create a stringified representation of a JSON object with the following structure:
Use Android’s Intent mechanism to pass it to the Hanko FIDO UAF Client (<fido-uaf-request>). This will trigger a prompt for an authentication gesture. To retrieve the activity result, use the startActivityForResult API.
After the user accepted or denied the request by performing an authentication gesture, you can process the result using the onActivityResult API.
Extract the response (1) from the Intent data. The extracted value will be used in the next step to verify the authenticator response.

Step 3: Send the public key to the Hanko API

To finalize the registration by verifying the authenticator response, use an HTTP client in your app to forward the authenticator response along with the requestId of the initialization request (see Step 1) to your backend. Then, use a Hanko server-side SDK to pass the authenticator response to the Hanko API. This request targets a secured endpoint so you will need an API Key ID and an API Key. Reuse a previously instantiated client instance or create one as described in Step 1.
Backend SDK examples for this step will be added once official server SDKs are available again.
After registration is successful you can choose to persist information that a user has registered a device (e.g. using Shared Preferences, UserDefaults) such that - for example - subsequent authentication attempts automatically use the registered credential.