Skip to content

WasmStealthCrypto

Defined in: ootle/src/stealth/wasm-crypto.ts:78

The real StealthCryptoProvider, backed by @tari-project/ootle-wasm@0.42.0.

Marshals between the step-02 domain types (Mask, Output, statements) and the raw WASM ABI (snake_case result fields, positional args, raw Uint8Arrays/bigints). Async signatures wrap synchronous WASM calls — see StealthCryptoProvider.

new WasmStealthCrypto(network?): WasmStealthCrypto

Defined in: ootle/src/stealth/wasm-crypto.ts:85

Network = Network.LocalNet

WasmStealthCrypto

aggregateInputMasks(masks): Promise<Mask>

Defined in: ootle/src/stealth/wasm-crypto.ts:246

Aggregate input commitment masks into a single scalar. masks must be non-empty; the revealed-only case (no stealth inputs) must short-circuit to Mask.zero() at the caller instead of calling this method.

Mask[]

Promise<Mask>

StealthCryptoProvider.aggregateInputMasks


buildInputsStatement(inputs, revealedAmount): Promise<StealthInputsStatement>

Defined in: ootle/src/stealth/wasm-crypto.ts:177

Build the inputs (spend) side of a transfer as canonical WASM wire JSON.

StealthInput[]

The stealth inputs being spent (empty for a revealed-only spend).

bigint

The un-confidential (revealed) µTari input amount.

Promise<StealthInputsStatement>

A StealthInputsStatement carrying the WASM-produced statementJson.

StealthCryptoProvider.buildInputsStatement


deriveAeadKey(privateKey, publicKey): Promise<Uint8Array<ArrayBufferLike>>

Defined in: ootle/src/stealth/wasm-crypto.ts:221

Derive the 32-byte AEAD encryption key for an output’s encrypted data via DH+KDF.

  • Receivers: (viewSecret, sender_public_nonce).
  • Senders: (sender_secret_nonce, recipient_view_pub).

Split from unblindOutput to mirror the WASM (encryptedDataDhKdfAead then unblindOutput).

Uint8Array

Uint8Array

Promise<Uint8Array<ArrayBufferLike>>

StealthCryptoProvider.deriveAeadKey


generateBalanceProofSignature(inputMask, outputMask, inputsStatementJson, outputsStatementJson): Promise<BalanceProofSignature>

Defined in: ootle/src/stealth/wasm-crypto.ts:187

Sign the balance proof over the two statements’ canonical wire JSONs.

A transfer with no stealth inputs passes inputMask = Mask.zero(). The signature also binds the envelope’s covenant claims, which this SDK always emits empty.

Mask

Mask

string

string

Promise<BalanceProofSignature>

The (public_nonce, signature) balance-proof signature.

StealthCryptoProvider.generateBalanceProofSignature


generateOutputsStatement(specs, revealedOutput): Promise<{ outputMask: Mask; statement: StealthOutputsStatement; }>

Defined in: ootle/src/stealth/wasm-crypto.ts:89

Build the outputs (sender) side of a transfer: one witness per spec, aggregated into a canonical WASM outputs-statement plus the summed output mask.

Output[]

The outputs to create (incl. change).

RevealedOutput | null

The un-confidential (revealed) output and its receiver, or null for none.

Promise<{ outputMask: Mask; statement: StealthOutputsStatement; }>

The WASM-produced StealthOutputsStatement and the aggregated outputMask for the balance proof.

StealthCryptoProvider.generateOutputsStatement


stealthDhSecret(networkByte, ownerSecret, viewSecret, publicNonce): Promise<Uint8Array<ArrayBufferLike>>

Defined in: ootle/src/stealth/wasm-crypto.ts:255

Derive the one-time stealth spend scalar (c + k, where c = H(network || v·R)) for an owned stealth UTXO.

number

The network byte (see Network).

Uint8Array

The owner’s secret key k.

Uint8Array

The owner’s view secret key v.

Uint8Array

The output’s sender public nonce.

Promise<Uint8Array<ArrayBufferLike>>

The 32-byte spend scalar.

StealthCryptoProvider.stealthDhSecret


unblindOutput(commitment, encryptedData, aeadKey, skipMemo): Promise<DecryptedData>

Defined in: ootle/src/stealth/wasm-crypto.ts:229

Decrypt an owned output using a precomputed AEAD key (from deriveAeadKey).

Throws on AEAD failure / commitment mismatch — i.e. the output is not owned. The receive helper catches this to mean “skip this UTXO”.

Uint8Array

The output’s 32-byte Pedersen commitment (from its substate id).

Uint8Array

The raw ciphertext bytes.

Uint8Array

The 32-byte AEAD key from deriveAeadKey.

boolean

When true, the memo is not decrypted.

Promise<DecryptedData>

StealthCryptoProvider.unblindOutput


validateBalanceProofSignature(proof, inputsStatementJson, outputsStatementJson): Promise<boolean>

Defined in: ootle/src/stealth/wasm-crypto.ts:207

Optional client-side pre-flight check of a balance-proof signature. The engine is authoritative at submission — implement as a cheap debug aid only.

BalanceProofSignature

string

string

Promise<boolean>

StealthCryptoProvider.validateBalanceProofSignature


validateTransfer(statement): Promise<void>

Defined in: ootle/src/stealth/wasm-crypto.ts:269

Structurally validate a complete transfer envelope (balance proof filled). Throws on invalid. When statement.outputsStatement.resourceViewKey is set, also validates the ElGamal viewable-balance proofs on all stealth outputs against that view key.

StealthTransferStatement

Promise<void>

StealthCryptoProvider.validateTransfer