Skip to content

P256.randomPrivateKey

Generates a random P256 ECDSA private key.

Imports

Named
import { P256 } from 'ox'

Examples

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

Definition

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

Source: src/core/P256.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>