add Passkey
Adds a WebAuthn passkey signer to a context rule.
Creates an external signer with WebAuthn verification and adds it to the specified context rule on the smart account contract. The public key must be an uncompressed secp256r1 key (65 bytes starting with 0x04), and the credential ID must be non-empty.
The transaction requires authorization from an existing signer on the specified context rule. The user will be prompted for biometric authentication if the current passkey is the authorizing signer.
Contract call: smart_account.add_signer(context_rule_id, signer) — returns a u32 signer ID. The assigned ID is available via ParsedContextRule.signerIds after fetching the context rule.
Return
TransactionResult indicating success or failure
Parameters
The context rule ID to add the signer to (e.g., 0 for Default)
The uncompressed secp256r1 public key (65 bytes, starting with 0x04)
The WebAuthn credential identifier
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 validation fails or transaction fails
Example:
val result = signerManager.addPasskey(
contextRuleId = 0u,
publicKey = secp256r1PublicKey,
credentialId = credentialIdData
)
if (result.success) {
println("Passkey signer added successfully")
} else {
println("Failed to add signer: ${result.error ?: ""}")
}