decrypt_note_data

Function decrypt_note_data 

Source
pub fn decrypt_note_data(
    private_key_bytes: &[u8],
    encrypted_data: &[u8],
) -> Result<Vec<u8>, JsValue>
Expand description

Decrypt note data using X25519-XSalsa20-Poly1305.

When scanning for notes addressed to us, we try to decrypt each encrypted output. If decryption succeeds, the note was sent to us.

§Arguments

  • private_key_bytes - Our X25519 encryption private key (32 bytes)
  • encrypted_data - Encrypted data from on-chain event (112+ bytes)

§Returns

  • Success: [amount (8 bytes LE)] [blinding (32 bytes)] = 40 bytes
  • Failure: Empty vec (note was not addressed to us)