AesGcm.decrypt
Decrypts encrypted data using AES-GCM.
Imports
Named
import { AesGcm } from 'ox'
Examples
import { AesGcm, Hex } from 'ox'
const key = await AesGcm.getKey({ password: 'qwerty' })
const secret = Hex.fromString('i am a secret message')
const encrypted = await AesGcm.encrypt(secret, key)
const decrypted = await AesGcm.decrypt(encrypted, key)
Hex.fromString('i am a secret message')
Definition
function decrypt<value, as>(
value: value | Bytes.Bytes | Hex.Hex,
key: CryptoKey,
options?: decrypt.Options<as>,
): Promise<decrypt.ReturnType<as>>
Source: src/core/AesGcm.ts
Parameters
value
- Type:
value | Bytes.Bytes | Hex.Hex
The data to encrypt.
key
- Type:
CryptoKey
The CryptoKey
to use for encryption.
options
- Type:
decrypt.Options<as>
- Optional
Decryption options.
options.as
- Type:
as | "Bytes" | "Hex"
- Optional
The output format.
Return Type
The decrypted data.
Promise<decrypt.ReturnType<as>>