register

abstract suspend fun register(challenge: ByteArray, userId: ByteArray, userName: String): WebAuthnRegistrationResult

Registers a new WebAuthn credential (passkey creation).

Triggers the platform's credential creation flow, prompting the user to create a new passkey using biometric authentication or a security key.

Flow:

  1. Platform shows biometric/security key prompt

  2. User authenticates with fingerprint, face, or security key

  3. Platform generates a secp256r1 keypair and credential ID

  4. Returns public key and attestation data

IMPORTANT: The challenge parameter MUST be used as-is in the WebAuthn registration request. It is a cryptographic hash that binds the credential to the smart account deployment.

Return

WebAuthnRegistrationResult with credential ID, public key, and attestation data

Parameters

challenge

The challenge bytes to sign (typically 32 bytes)

userId

User identifier bytes (typically random, used for discoverable credentials)

userName

User-friendly name for the credential

Throws

WebAuthnException

if registration fails or user cancels