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}")
}Вывод
true
pub(api) static fn unseal(key: bytes, sealed: bytes, aad: bytes = b"") -> bytes | CryptoErrorС версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
key | bytes |
sealed | bytes |
aad | bytes = b"" |
Возвращает
bytes
Ошибки
CryptoError@error
Эффекты
не объявлены (чистая, пока тело не говорит иное)
Определено в: std/crypto/crypto.oxl:472