Skip to content

decryptWithViewing()

SIP Protocol API Reference v0.7.0


SIP Protocol API Reference / decryptWithViewing

decryptWithViewing(encrypted, viewingKey): TransactionData

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:3283

Decrypt transaction data with viewing key

Performs authenticated decryption using XChaCha20-Poly1305. The authentication tag is verified before returning data.

EncryptedTransaction

Encrypted transaction data

ViewingKey

Viewing key for decryption

TransactionData

Decrypted transaction data

If decryption fails (wrong key, tampered data, etc.)

try {
const data = decryptWithViewing(encrypted, viewingKey)
console.log(`Amount: ${data.amount}`)
} catch (e) {
console.error('Decryption failed - wrong key or tampered data')
}