Skip to content

AesGcm.getKey

Derives an AES-GCM key from a password using PBKDF2.

Imports

Named
import { AesGcm } from 'ox'

Examples

import { AesGcm } from 'ox'
 
const key = await AesGcm.getKey({ password: 'qwerty' })
CryptoKey {}

Definition

function getKey(
  options: getKey.Options,
): Promise<CryptoKey>

Source: src/core/AesGcm.ts

Parameters

options

  • Type: getKey.Options

Options for key derivation.

options.iterations

  • Type: number
  • Optional

The number of iterations to use.

options.password

  • Type: string

Password to derive key from.

options.salt

  • Type: Uint8Array
  • Optional

Salt to use for key derivation.

Return Type

The derived key.

Promise<CryptoKey>