Skip to content
Get startedGetting started →

Secp256k1SigningSession

A live signing session holding a secp256k1 private key. createSecp256k1SigningSession returns it.

import type { Secp256k1SigningSession } from "@category-labs/mera";

Uint8Array, 65 bytes, the uncompressed secp256k1 public key with the 0x04 prefix.

Signs a 32-byte digest without prehashing it and resolves to a Secp256k1Signature: compact (64 bytes, r || s, low-S: s lies in the lower half of the curve order) plus recovery (0 or 1).

Zeroes the session-owned private-key copy and permanently ends the session; later signing throws SESSION_ENDED.

Calls end, so a using declaration ends the session when its scope exits:

import { createSecp256k1SigningSession } from "@category-labs/mera";
const privateKey = crypto.getRandomValues(new Uint8Array(32));
const digest32 = new Uint8Array(32);
{
using session = createSecp256k1SigningSession({ privateKey });
await session.signDigest(digest32);
} // ended here