Skip to content

WebCryptoP256.sign

Signs a payload with the provided CryptoKey private key and returns a P256 signature.

Imports

Named
import { WebCryptoP256 } from 'ox'

Examples

import { WebCryptoP256 } from 'ox'
 
const { privateKey } = await WebCryptoP256.createKeyPair()
 
const signature = await WebCryptoP256.sign({ 
  payload: '0xdeadbeef', 
  privateKey, 
})
{
r: 151231...4423n,
s: 516123...5512n,
}

Definition

function sign(
  options: sign.Options,
): Promise<Signature.Signature<false>>

Source: src/WebCryptoP256.ts

Parameters

options

  • Type: sign.Options

Options for signing the payload.

options.payload

  • Type: 0x${string} | Uint8Array

Payload to sign.

options.privateKey

  • Type: CryptoKey

ECDSA private key.

Return Type

The P256 ECDSA Signature.Signature.

Promise<Signature.Signature<false>>