WasmStealthCrypto
Defined in: ootle/src/stealth/wasm-crypto.ts:54
The real StealthCryptoProvider, backed by @tari-project/ootle-wasm@0.32.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.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new WasmStealthCrypto(
network?):WasmStealthCrypto
Defined in: ootle/src/stealth/wasm-crypto.ts:61
Parameters
Section titled “Parameters”network?
Section titled “network?”Network = Network.LocalNet
Returns
Section titled “Returns”WasmStealthCrypto
Methods
Section titled “Methods”aggregateInputMasks()
Section titled “aggregateInputMasks()”aggregateInputMasks(
masks):Promise<Mask>
Defined in: ootle/src/stealth/wasm-crypto.ts:180
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.
Parameters
Section titled “Parameters”Mask[]
Returns
Section titled “Returns”Promise<Mask>
Implementation of
Section titled “Implementation of”StealthCryptoProvider.aggregateInputMasks
buildInputsStatement()
Section titled “buildInputsStatement()”buildInputsStatement(
inputs,revealedAmount):Promise<StealthInputsStatement>
Defined in: ootle/src/stealth/wasm-crypto.ts:113
Build the inputs (spend) side of a transfer as canonical WASM wire JSON.
Parameters
Section titled “Parameters”inputs
Section titled “inputs”The stealth inputs being spent (empty for a revealed-only spend).
revealedAmount
Section titled “revealedAmount”bigint
The un-confidential (revealed) µTari input amount.
Returns
Section titled “Returns”Promise<StealthInputsStatement>
A StealthInputsStatement carrying the WASM-produced statementJson.
Implementation of
Section titled “Implementation of”StealthCryptoProvider.buildInputsStatement
deriveAeadKey()
Section titled “deriveAeadKey()”deriveAeadKey(
privateKey,publicKey):Promise<Uint8Array<ArrayBufferLike>>
Defined in: ootle/src/stealth/wasm-crypto.ts:155
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).
Parameters
Section titled “Parameters”privateKey
Section titled “privateKey”Uint8Array
publicKey
Section titled “publicKey”Uint8Array
Returns
Section titled “Returns”Promise<Uint8Array<ArrayBufferLike>>
Implementation of
Section titled “Implementation of”StealthCryptoProvider.deriveAeadKey
generateBalanceProofSignature()
Section titled “generateBalanceProofSignature()”generateBalanceProofSignature(
inputMask,outputMask,inputsStatementJson,outputsStatementJson):Promise<BalanceProofSignature>
Defined in: ootle/src/stealth/wasm-crypto.ts:123
Sign the balance proof over the two statements’ canonical wire JSONs.
A transfer with no stealth inputs passes inputMask = Mask.zero().
Parameters
Section titled “Parameters”inputMask
Section titled “inputMask”outputMask
Section titled “outputMask”inputsStatementJson
Section titled “inputsStatementJson”string
outputsStatementJson
Section titled “outputsStatementJson”string
Returns
Section titled “Returns”Promise<BalanceProofSignature>
The (public_nonce, signature) balance-proof signature.
Implementation of
Section titled “Implementation of”StealthCryptoProvider.generateBalanceProofSignature
generateOutputsStatement()
Section titled “generateOutputsStatement()”generateOutputsStatement(
specs,revealedOutputAmount):Promise<{outputMask:Mask;statement:StealthOutputsStatement; }>
Defined in: ootle/src/stealth/wasm-crypto.ts:65
Build the outputs (sender) side of a transfer: one witness per spec, aggregated into a canonical WASM outputs-statement plus the summed output mask.
Parameters
Section titled “Parameters”Output[]
The outputs to create (incl. change).
revealedOutputAmount
Section titled “revealedOutputAmount”bigint
The un-confidential (revealed) µTari output amount.
Returns
Section titled “Returns”Promise<{ outputMask: Mask; statement: StealthOutputsStatement; }>
The WASM-produced StealthOutputsStatement and the aggregated
outputMask for the balance proof.
Implementation of
Section titled “Implementation of”StealthCryptoProvider.generateOutputsStatement
stealthDhSecret()
Section titled “stealthDhSecret()”stealthDhSecret(
networkByte,ownerSecret,publicNonce):Promise<Uint8Array<ArrayBufferLike>>
Defined in: ootle/src/stealth/wasm-crypto.ts:189
Derive the one-time stealth spend scalar (c + k) via DH for an owned stealth UTXO.
Parameters
Section titled “Parameters”networkByte
Section titled “networkByte”number
The network byte (see Network).
ownerSecret
Section titled “ownerSecret”Uint8Array
The owner’s secret key.
publicNonce
Section titled “publicNonce”Uint8Array
The output’s sender public nonce.
Returns
Section titled “Returns”Promise<Uint8Array<ArrayBufferLike>>
The 32-byte spend scalar.
Implementation of
Section titled “Implementation of”StealthCryptoProvider.stealthDhSecret
unblindOutput()
Section titled “unblindOutput()”unblindOutput(
commitment,encryptedData,aeadKey,skipMemo):Promise<DecryptedData>
Defined in: ootle/src/stealth/wasm-crypto.ts:163
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”.
Parameters
Section titled “Parameters”commitment
Section titled “commitment”Uint8Array
The output’s 32-byte Pedersen commitment (from its substate id).
encryptedData
Section titled “encryptedData”Uint8Array
The raw ciphertext bytes.
aeadKey
Section titled “aeadKey”Uint8Array
The 32-byte AEAD key from deriveAeadKey.
skipMemo
Section titled “skipMemo”boolean
When true, the memo is not decrypted.
Returns
Section titled “Returns”Promise<DecryptedData>
Implementation of
Section titled “Implementation of”StealthCryptoProvider.unblindOutput
validateBalanceProofSignature()
Section titled “validateBalanceProofSignature()”validateBalanceProofSignature(
proof,inputsStatementJson,outputsStatementJson):Promise<boolean>
Defined in: ootle/src/stealth/wasm-crypto.ts:142
Optional client-side pre-flight check of a balance-proof signature. The engine is authoritative at submission — implement as a cheap debug aid only.
Parameters
Section titled “Parameters”inputsStatementJson
Section titled “inputsStatementJson”string
outputsStatementJson
Section titled “outputsStatementJson”string
Returns
Section titled “Returns”Promise<boolean>
Implementation of
Section titled “Implementation of”StealthCryptoProvider.validateBalanceProofSignature
validateTransfer()
Section titled “validateTransfer()”validateTransfer(
statement):Promise<void>
Defined in: ootle/src/stealth/wasm-crypto.ts:201
Structurally validate a complete transfer envelope (balance proof filled). Throws
on invalid. This is a client pre-flight (view_key = null); the engine is
authoritative for viewable-resource validation at submission.
Parameters
Section titled “Parameters”statement
Section titled “statement”Returns
Section titled “Returns”Promise<void>