Skip to content

WebCryptoP256.createKeyPair

Generates an ECDSA P256 key pair that includes:

Imports

Named
import { WebCryptoP256 } from 'ox'

Examples

import { WebCryptoP256 } from 'ox'
 
const { publicKey, privateKey } = await WebCryptoP256.createKeyPair()
{
privateKey: CryptoKey {},
publicKey: {
x: 59295962801117472859457908919941473389380284132224861839820747729565200149877n,
y: 24099691209996290925259367678540227198235484593389470330605641003500238088869n,
prefix: 4,
},
}

Definition

function createKeyPair(
  options?: createKeyPair.Options,
): Promise<createKeyPair.ReturnType>

Source: src/WebCryptoP256.ts

Parameters

options

  • Type: createKeyPair.Options
  • Optional

Options for creating the key pair.

options.extractable

  • Type: boolean
  • Optional

A boolean value indicating whether it will be possible to export the private key using globalThis.crypto.subtle.exportKey().

Return Type

The key pair.

Promise<createKeyPair.ReturnType>