Skip to content

P256.fromMnemonic

Derives a valid P256 private key from a BIP-39 mnemonic.

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

Imports

Named
import { P256 } from 'ox'

Examples

import { P256 } from 'ox'
 
const privateKey = P256.fromMnemonic(
  'test test test test test test test test test test test junk'
)

Definition

function fromMnemonic<as>(
  mnemonic: string,
  options?: fromMnemonic.Options<as>,
): fromMnemonic.ReturnType<as>

Source: src/core/P256.ts

Parameters

mnemonic

  • Type: string

BIP-39 mnemonic phrase.

options

  • Type: fromMnemonic.Options<as>
  • Optional

Options.

options.as

  • Type: "Bytes" | "Hex" | as
  • Optional

Format of the returned private key.

options.passphrase

  • Type: string
  • Optional

Optional BIP-39 passphrase.

Return Type

A valid P256 private key.

fromMnemonic.ReturnType<as>