Skip to content

decryptOwnedUtxo

decryptOwnedUtxo(crypto, viewSecret, substate, substateId): Promise<DecryptedData | null>

Defined in: ootle/src/stealth/wallet-helpers.ts:70

The recipient owner-read: try to decrypt a fetched UTXO substate with a view secret.

Parses the substate (commitment from the id, public_nonce + encrypted_data from the body), derives the AEAD key, and unblinds. Returns the DecryptedData for an owned UTXO, or null when the substate is not a live stealth UTXO or the decrypt throws (the “not ours” signal). This lets a recipient scan many substates in a loop without a try/catch at each call site.

StealthCryptoProvider

The crypto seam (real WASM or a fake).

Uint8Array

The recipient’s 32-byte view secret.

IndexerGetSubstateResponse

The fetched substate response.

string

The substate id the response was fetched by (source of the commitment).

Promise<DecryptedData | null>

The decrypted output if owned, else null.