std::crypto::encryptSymmetric encryption and decryption.
Encrypt and decrypt data using AES-256-GCM.
import std::crypto::encrypt;
fn main() {
let key = crypto.random_bytes(32);
let ciphertext = encrypt.seal(key, "hello world");
let plaintext = encrypt.open(key, ciphertext);
println(plaintext);
}
sealEncrypt plaintext using AES-256-GCM with the given key.
Returns the ciphertext (nonce + encrypted data) as bytes.
openDecrypt ciphertext using AES-256-GCM with the given key.
Returns the decrypted plaintext string.