Skip to content

AesGcm.fromMnemonic

Derives an AES-256-GCM key from a BIP-39 mnemonic.

This is equivalent to passing Mnemonic.toSeed(mnemonic, { passphrase }) to AesGcm.fromSeed.

Imports

Named
import { AesGcm } from 'ox'

Examples

import { AesGcm } from 'ox'
 
const key = await AesGcm.fromMnemonic(
  'test test test test test test test test test test test junk'
)

Definition

function fromMnemonic(
  mnemonic: string,
  options?: fromMnemonic.Options,
): Promise<CryptoKey>

Source: src/core/AesGcm.ts

Parameters

mnemonic

  • Type: string

BIP-39 mnemonic phrase.

options

  • Type: fromMnemonic.Options
  • Optional

Options.

options.passphrase

  • Type: string
  • Optional

Optional BIP-39 passphrase.

Return Type

A nonextractable AES-256-GCM key for encryption and decryption.

Promise<CryptoKey>