WebAuthnSignature

data class WebAuthnSignature(val authenticatorData: ByteArray, val clientData: ByteArray, val signature: ByteArray) : SmartAccountSignature

WebAuthn signature from a passkey authentication ceremony.

WebAuthn signatures contain the complete attestation data required to verify biometric or security key authentication. The signature must be in compact format (64 bytes) with normalized S value to prevent signature malleability.

Field ordering in the SCVal map is CRITICAL and must be alphabetical:

  1. authenticator_data

  2. client_data

  3. signature

Note: The field name is "client_data", NOT "client_data_json".

Example:

val webauthnSig = WebAuthnSignature(
authenticatorData = byteArrayOf(...), // Raw authenticator data from WebAuthn ceremony
clientData = byteArrayOf(...), // Client data JSON from WebAuthn ceremony
signature = byteArrayOf(...) // 64-byte compact ECDSA signature (r || s)
)
val scVal = webauthnSig.toScVal()

Constructors

Link copied to clipboard
constructor(authenticatorData: ByteArray, clientData: ByteArray, signature: ByteArray)

Properties

Link copied to clipboard

Raw authenticator data from the WebAuthn authentication ceremony. Contains RP ID hash, flags, signature counter, and optional extensions.

Link copied to clipboard

Client data JSON from the WebAuthn ceremony. Contains challenge, origin, type, and other client-side information. CRITICAL: This is stored as "client_data", NOT "client_data_json".

Link copied to clipboard

ECDSA signature in compact 64-byte format (r || s). The signature must already be normalized (S value in lower half of curve order) to prevent signature malleability attacks. This is typically handled by the WebAuthn browser API.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Constant-time equals to prevent timing side-channel attacks on signature data.

Link copied to clipboard
open override fun hashCode(): Int

Custom hashCode implementation that properly handles ByteArray fields.

Link copied to clipboard
open override fun toScVal(): SCValXdr

Converts the WebAuthn signature to a Soroban SCVal map.