Skip to main content
Module

x/simple_utility/mod.full.ts>cryptoDecrypt

Simplify processing for Deno.
Latest
function cryptoDecrypt
import { cryptoDecrypt } from "https://deno.land/x/simple_utility@v2.2.0/mod.full.ts";

Decrypt binary. Algorithm is AES-GCM with 128 bits key, 128 bits tag and 96 bits IV. IV is read from head of cipher.

Examples

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);

Parameters

data: Uint8Array
pub: Uint8Array
key: Uint8Array

Returns

Promise<Uint8Array>