Skip to content

Secp256k1.randomPrivateKey

Generates a random ECDSA private key on the secp256k1 curve.

Imports

Named
import { Secp256k1 } from 'ox'

Examples

import { Secp256k1 } from 'ox'
 
const privateKey = Secp256k1.randomPrivateKey()

Definition

function randomPrivateKey<as>(
  options?: randomPrivateKey.Options<as>,
): randomPrivateKey.ReturnType<as>

Source: src/Secp256k1.ts

Parameters

options

  • Type: randomPrivateKey.Options<as>
  • Optional

The options to generate the private key.

options.as

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

Format of the returned private key.

Return Type

The generated private key.

randomPrivateKey.ReturnType<as>