OxL Справочник OxL
РусскийEnglish

method aead.unseal

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

Example:

oxl✓ проверяется в 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}")
}
Вывод
true
pub(api) static fn unseal(key: bytes, sealed: bytes, aad: bytes = b"") -> bytes | CryptoError

С версии. 1.0.0-beta

Параметры

ИмяТип
keybytes
sealedbytes
aadbytes = b""

Возвращает

bytes

Ошибки

Эффекты

не объявлены (чистая, пока тело не говорит иное)

Определено в: std/crypto/crypto.oxl:472

См. также