OxL Reference

data CryptoError

An authenticated decryption failed: wrong key, modified data or different associated data; or a key had the wrong size.

Example:

oxl✓ checked in CI
use std.crypto { aead, CryptoError }
use std.ser { bytesOf }

fn main() io, rand {
  let key = bytesOf(&"0123456789abcdef0123456789abcdef")
  let sealed = aead.seal(key, bytesOf(&"secret"))!
  let wrong = bytesOf(&"ffffffffffffffffffffffffffffffff")
  match aead.unseal(wrong, sealed) {
    bytes _ => print("opened")
    CryptoError _ => print("refused")
  }
}
Output
refused
@error pub(api) data CryptoError

Thread safety. an immutable value.

Since. 1.0.0-beta

Fields

pub(api) msg: str

What failed.

Defined in: std/crypto/crypto.oxl:62

See also