add New Passkey Signer
Registers a new WebAuthn passkey and adds it as a signer to a context rule.
Performs the full end-to-end flow of creating a new passkey via the platform's WebAuthn API, persisting the credential locally, and adding it as a signer on the smart account contract. This is the high-level method for adding passkey signers; use addPasskey if you already have the public key and credential ID.
Flow:
Validates that a wallet is connected and a WebAuthnProvider is configured
Generates cryptographically secure random challenge and user ID (32 bytes each)
Triggers the platform WebAuthn registration ceremony (biometric prompt)
Base64URL-encodes the credential ID for storage
Saves the credential locally via OZCredentialManager.createPendingCredential
Emits a SmartAccountEvent.CredentialCreated event
Adds the passkey signer on-chain via addPasskey
The on-chain addition requires authorization from an existing signer on the specified context rule. The user will be prompted for biometric authentication twice: once for the new passkey registration and once for the existing signer to authorize the on-chain transaction.
Return
AddPasskeySignerResult containing the credential ID, public key, and transaction result
Parameters
The context rule ID to add the signer to (e.g., 0 for Default)
User-friendly name for the new passkey (displayed by the authenticator)
Optional list of signers for multi-signer authorization. When empty (default), uses single-signer auth with the connected passkey. When non-empty, coordinates signatures from all listed signers.
Optional submission method override. When null (default), uses the configured submission method (relayer if available, RPC otherwise).
Throws
if no WebAuthnProvider is configured
if no wallet is connected
if the WebAuthn registration ceremony fails or the user cancels
if credential storage or on-chain signer addition fails
Example:
val result = signerManager.addNewPasskeySigner(
contextRuleId = 0u,
userName = "Recovery Passkey"
)
println("Credential ID: ${result.credentialId}")
println("On-chain result: ${result.transactionResult.success}")