register

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

Registers a new WebAuthn credential (passkey creation) using Apple's AuthenticationServices framework.

Triggers the platform authenticator (Touch ID / Face ID) to create a new secp256r1 passkey. The resulting credential is bound to the configured Relying Party ID and can be used to deploy and operate a smart account.

The challenge bytes are passed directly to the platform authenticator without modification.

Return

WebAuthnRegistrationResult with credential ID, public key, attestation object, transport hints, device type, and backup status

Parameters

challenge

The challenge bytes to bind to the credential (typically 32 bytes)

userId

User identifier bytes for the credential (used for discoverable credentials)

userName

Human-readable name displayed in the passkey creation dialog

Throws

if the user dismissed the authentication dialog

if passkeys are not available on this device

if credential creation fails for any other reason