function aesGcmEncryptBytes
aesGcmEncryptBytes(
data: Uint8Array,
keyBytes: Uint8Array,
webKey?: WebKeySource,
): Promise<AesGcmEncrypted>

AES-GCM encrypt with raw key bytes, using whichever implementation is faster for this payload.

webKey lets a caller that already holds (or caches) the matching Web Crypto key hand it over instead of importing a fresh one; it is only called when the payload is large enough to take the Web Crypto path.

Parameters

keyBytes: Uint8Array
optional
webKey: WebKeySource

Return Type

Usage

import { aesGcmEncryptBytes } from "docs/crypto.ts";