Contract 5cd51554b5a60cf7957909089f603a3f59a655129ce50e4a8290c4b2a44255fc

← 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

  • CDS6HFIO7GQ3JXBDOGM37742JDYOM4A6BHEGZBWFDLNQVEXFKD5KHJZW

Interface

Recovers the signer of a raw secp256k1 signature and compares it with the registered key.

key_data must be a 65-byte uncompressed SEC1 point (0x04 || X || Y) and sig_data must be r[32] || s[32] || recovery_id[1], with a raw recovery ID of 0 or 1. The Soroban host requires a normalized low-S signature. The supplied 32-byte hash is passed directly to the Soroban host without another hashing step.

The hazmat API is necessary here because the generic verifier boundary represents the already-SHA-256-hashed Latch auth digest as Bytes. The SDK has no supported conversion from those raw bytes back to Hash<32>; hashing again to obtain that type would verify a different message.

Errors

  • [Secp256k1VerifierError::InvalidHashLength] - hash is not 32 bytes.
  • [Secp256k1VerifierError::InvalidKeyEncoding] - key_data does not start with the uncompressed SEC1 prefix 0x04.
  • [Secp256k1VerifierError::InvalidRecoveryId] - the signature recovery ID is not 0 or 1; Ethereum-style 27/28 va
fn verify(
    env: soroban_sdk::Env,
    hash: soroban_sdk::Bytes,
    key_data: soroban_sdk::BytesN<65>,
    sig_data: soroban_sdk::BytesN<65>,
) -> bool

Returns the canonical 65-byte uncompressed SEC1 public key unchanged.

Errors

  • [Secp256k1VerifierError::InvalidKeyEncoding] - key_data does not start with the uncompressed SEC1 prefix 0x04.
fn canonicalize_key(
    env: soroban_sdk::Env,
    key_data: soroban_sdk::BytesN<65>,
) -> soroban_sdk::Bytes

Canonicalizes every secp256k1 key while preserving input order.

Errors

  • [Secp256k1VerifierError::InvalidKeyEncoding] - any key does not start with the uncompressed SEC1 prefix 0x04.
fn batch_canonicalize_key(
    env: soroban_sdk::Env,
    key_data: soroban_sdk::Vec>,
) -> soroban_sdk::Vec

Imports

WebAssembly Text (WAT) ▶