OxL Reference

method aead.unseal

Verifies and decrypts; a wrong key or modified data is a CryptoError.

Example:

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

fn main() io, rand {
  let sealed = aead.seal(rand.secure(32), bytesOf(&"x"))!
  print("{aead.unseal(rand.secure(32), sealed) is CryptoError}")
}
Output
true
pub(api) static fn unseal(key: bytes, sealed: bytes, aad: bytes = b"") -> bytes | CryptoError

Since. 1.0.0-beta

Parameters

NameType
keybytes
sealedbytes
aadbytes = b""

Returns

bytes

Errors

Effects

none declared (pure unless the body says otherwise)

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

See also