register

suspend fun register(deviceName: String? = null, block: FidoRegistrationCustomizer.() -> Unit = {}): Result<JsonObject>

Registers a new FIDO2 credential using the initialized creation options.

This method initiates the FIDO2 registration ceremony, prompting the user to create a new credential using available authenticators. Upon successful registration, it formats and submits the response to the Journey workflow.

Sample callbackValue Results:

Legacy String Format (when supportsJsonResponse = false):

{"type":"webauthn.create","challenge":"test-challenge"}::dGVzdC1hdHRlc3RhdGlvbi1vYmplY3Q::dGVzdC1yYXctaWQ::MyDevice

JSON Format (when supportsJsonResponse = true):

{
"authenticatorType": "PLATFORM",
"response": "{\"type\":\"webauthn.create\",\"challenge\":\"test-challenge\"}::dGVzdC1hdHRlc3RhdGlvbi1vYmplY3Q::dGVzdC1yYXctaWQ::MyDevice"
}

The data components are separated by "::" and include:

  1. Client data JSON (Base64)

  2. Attestation object (Base64 converted to integer string)

  3. Raw credential ID

  4. Device name (if provided)

Return

A Result containing the attestation response as a JsonObject on success, or an exception on failure. The response is automatically submitted to the workflow.

Parameters

deviceName

Optional name for the registered device/credential for easier identification