Function decrypt

Source
pub fn decrypt(ciphertext: &[u8], passphrase: &[u8]) -> Result<Vec<u8>, JsError>
Expand description

Decrypts ciphertext and into a newly allocated Uint8Array.

ยงErrors

Returns an error if any of the following are true:

  • ciphertext is shorter than 128 bytes.
  • The magic number is invalid.
  • The version number is the unrecognized scrypt version number.
  • The scrypt parameters are invalid.
  • The checksum of the header mismatch.
  • The MAC (authentication tag) of the header is invalid.
  • The MAC (authentication tag) of the scrypt encrypted data format is invalid.