method aead.unseal
Verifies and decrypts; a wrong key or modified data is a CryptoError.
Example:
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 | CryptoErrorSince. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
key | bytes |
sealed | bytes |
aad | bytes = b"" |
Returns
bytes
Errors
CryptoError@error
Effects
none declared (pure unless the body says otherwise)
Defined in: std/crypto/crypto.oxl:472