import { cryptoEncrypt } from "https://deno.land/x/simple_utility@v2.3.1/src/pure/crypto.ts";
Encrypt binary. Algorithm is AES-GCM with 128 bits key, 128 bits tag and 96 bits IV. IV is prepended to cipher.
Examples
Example 1
Example 1
const bin = await Deno.readFile("./file");
const key1 = await cryptoGenerateEncryptKey();
const key2 = await cryptoGenerateEncryptKey();
const encrypt = await cryptoEncrypt(bin, key1.pub, key2.key);
const decrypt = await cryptoDecrypt(encrypt, key2.pub, key1.key);