Skip to content

@armada/sdk / index / decryptedCommitmentMatches

Function: decryptedCommitmentMatches()

decryptedCommitmentMatches(note, onChainCommitmentHash): boolean

Defined in: src/sync/note-crypto.ts:187

Verify a decrypted transact note's own commitment hash equals the on-chain leaf commitment (engine 9.6.0 fix). A crafted ciphertext can decrypt successfully for our viewing key yet carry a (notePublicKey, tokenHash, value) preimage that does NOT match the committed leaf; accepting it would record a wrong-value TXO (inflated balance, and a spend that fails at prove time). note.hash is Poseidon(notePublicKey, tokenHash, value); onChainCommitmentHash is the leaf from the Transact event (0x-prefixed or bare). Callers drop the note when this returns false.

Parameters

note

TransactNote

onChainCommitmentHash

string

Returns

boolean