Skip to content

Mnemonic.toHdKey

Converts a mnemonic to a HD Key.

Imports

Named
import { Mnemonic } from 'ox'

Examples

import { Mnemonic } from 'ox'
 
const mnemonic = Mnemonic.random(Mnemonic.english)
const hdKey = Mnemonic.toHdKey(mnemonic)

Path Derivation

You can derive a HD Key at a specific path using derive:

import { Mnemonic } from 'ox'
 
const mnemonic = Mnemonic.random(Mnemonic.english)
const hdKey = Mnemonic.toHdKey(mnemonic).derive(Mnemonic.path({ index: 1 }))

Definition

function toHdKey(
  mnemonic: string,
  options?: toHdKey.Options,
): HdKey.HdKey

Source: src/core/Mnemonic.ts

Parameters

mnemonic

  • Type: string

The mnemonic to convert.

options

  • Type: toHdKey.Options
  • Optional

Conversion options.

options.passphrase

  • Type: string
  • Optional

An optional passphrase for additional protection to the seed.

Return Type

The HD Key.

HdKey.HdKey