Skip to content
Get startedGetting started →

createSecp256k1SigningSession

Creates a signing session from a secp256k1 private key.

import { createSecp256k1SigningSession } from "@category-labs/mera";
import {
createSecp256k1SigningSession,
getEvmAddress,
} from "@category-labs/mera";
const privateKey = crypto.getRandomValues(new Uint8Array(32));
const digest32 = new Uint8Array(32);
const session = createSecp256k1SigningSession({ privateKey });
const address = getEvmAddress(session.publicKey);
const { compact, recovery } = await session.signDigest(digest32);
session.end();

options is a CreateSigningSessionOptions.

  • Type: Uint8Array
  • Required

secp256k1 private key. Must be exactly 32 bytes and a valid scalar, an integer inside the curve’s private-key range.

A live Secp256k1SigningSession.

  • INPUT_INVALID: privateKey is not 32 bytes or not a valid secp256k1 scalar.