Contract 7ac4db5f36c8395da5471408c2f6b1d2fedc6e48e8c09c09584ceac8669cf029

← Back to Index 📥 Download WASM

Meta

cliver 28.0.0#300aaf69ab100536678bdb641428b06f06b318ea
rssdk_spec_shaking 2
rssdkver 26.1.1#8ac18efb681a1c0b4b85a38c5a380300344e3f39
rsver 1.94.1

Instances

  • CBQG4V76EKWTGJ5OLRYQ4UNWQJAF7J3BYH6C4GFICCH5SQFRALLFPIQY

Interface

Verify a WebAuthn authentication assertion against a Soroban auth payload hash.

Arguments

  • hash - The 32-byte Soroban auth payload hash. The client base64url-encodes this and embeds it as the challenge field in clientDataJSON.
  • key_data - Bytes containing a 65-byte uncompressed secp256r1 public key (0x04 prefix + 32-byte X + 32-byte Y) followed by an optional variable-length credential ID suffix. The credential ID is client-side metadata and is stripped by canonicalize_key.
  • sig_data - XDR-encoded WebAuthnSigData struct containing:
  • signature: 64-byte compact P-256 signature (r || s)
  • authenticator_data: raw authenticator data bytes (≥37 bytes)
  • client_data: raw clientDataJSON bytes

Returns

true if the assertion is valid. Panics on any verification failure.

fn verify(
    env: soroban_sdk::Env,
    hash: soroban_sdk::Bytes,
    key_data: soroban_sdk::Bytes,
    sig_data: soroban_sdk::Bytes,
) -> bool

Returns the canonical 65-byte public key, stripping any credential ID suffix.

Two registrations of the same P-256 key with different credential IDs must produce identical canonical output — this enables the smart account to detect and reject duplicate signers regardless of which device was used to register.

Panics with Error(Contract, #3119) if key_data is shorter than 65 bytes.

fn canonicalize_key(
    env: soroban_sdk::Env,
    key_data: soroban_sdk::Bytes,
) -> soroban_sdk::Bytes

Canonicalizes a batch of WebAuthn keys, preserving input order.

fn batch_canonicalize_key(
    env: soroban_sdk::Env,
    key_data: soroban_sdk::Vec,
) -> soroban_sdk::Vec

Imports

WebAssembly Text (WAT) ▶