Skip to content

Secp256k1.sign

Signs the payload with the provided private key.

Imports

Named
import { Secp256k1 } from 'ox'

Examples

import { Secp256k1 } from 'ox'
 
const signature = Secp256k1.sign({ 
  payload: '0xdeadbeef', 
  privateKey: '0x...'
})

Definition

function sign(
  options: sign.Options,
): Signature.Signature

Source: src/Secp256k1.ts

Parameters

options

  • Type: sign.Options

The signing options.

options.hash

  • Type: boolean
  • Optional

If set to true, the payload will be hashed (sha256) before being signed.

options.payload

  • Type: 0x${string} | Uint8Array

Payload to sign.

options.privateKey

  • Type: 0x${string} | Uint8Array

ECDSA private key.

Return Type

The ECDSA Signature.Signature.

Signature.Signature

Error Type

Secp256k1.sign.ErrorType