npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@signing-room/sdk

v2.1.0

Published

The official Signing Room SDK. Licensed under AGPLv3; commercial licenses available.

Readme

@signing-room/sdk

The official JavaScript/TypeScript SDK for SigningRoom.

This SDK provides a robust, programmatic interface to create, manage, and participate in secure, ephemeral Bitcoin multi-signature ceremonies. It handles end-to-end encryption, Zero-knowledge RBAC (server-enforced upload limits; policy delivered encrypted), WebSocket relay coordination, automatic session resumption, and PSBT (Partially Signed Bitcoin Transaction) merging automatically.


Installation

Install the package via npm:

npm install @signing-room/sdk

Live Demo & Examples

Looking for a working implementation? Check out our signingroom-sdk-demo.

This repository provides a complete, runnable TypeScript project that demonstrates the full SDK lifecycle—from room creation and granular RBAC enforcement to threshold signing, session resumption, and forensic offline audit verification.


Relay Requirements & Headless Access (Self-Hosting)

When connecting the SDK to a hosted relay Worker (e.g., [https://api.my-relay.com](https://api.my-relay.com)), the relay's environment variables must be configured to accommodate your architecture:

| Environment Variable | Required Setting | Description | | --- | --- | --- | | ALLOWED_ORIGIN | "my-relay.com" | The root domain or exact origin permitted to access the coordinator. Automatically authorizes subdomains (e.g., app.my-relay.com) and enforces HTTPS in production. | | ALLOW_HEADLESS_ACCESS | "true" | Required for Node.js / CLI integrations against remote relays. Because Node.js runtimes do not emit browser Origin headers, self-hosted relays must set this to "true" to allow backend daemons, bots, and CI/CD runners to communicate with the API and WebSockets. | | ENVIRONMENT | "development" or "production" | When set to "development", headless calls and localhost/127.0.0.1 origins on any port are permitted automatically without additional configuration. |

** Note:** The official public deployment at api.signingroom.io enforces ALLOW_HEADLESS_ACCESS="false". Programmatic SDK scripts must target a self-hosted relay instance with ALLOW_HEADLESS_ACCESS="true" enabled or run locally with ENVIRONMENT="development".


Quick Start & Core API

The SDK is built around the SigningRoomClient.

A user can act as either:

  • Coordinator — administrative privileges, room management, capability generation, finalization, auditing
  • Guest — cryptographically restricted access (e.g., Signer, Blind Signer, Auditor)

Below is a complete lifecycle example demonstrating how to orchestrate a secure Bitcoin multi-signature signing ceremony.


1. Initialization & Room Creation (Coordinator)

To start a new signing ceremony, instantiate the client and provide an unsigned PSBT.

If operating an Enterprise or Custom White-label tier, inject your commercial license token here to securely attest infrastructure provenance.

import { SigningRoomClient } from '@signing-room/sdk';

// Target a local development relay or your self-hosted instance
const API_URL = 'http://localhost:8787';
const UNSIGNED_PSBT = 'cHNidP8BA...'; // Your base64 PSBT

// Optional: Provide a commercial license token to authorize enterprise features
const ENTERPRISE_TOKEN = 'srl_sbJbVsu3kGXet3...';

const coordinator = new SigningRoomClient({
  apiUrl: API_URL,
  licenseToken: ENTERPRISE_TOKEN, // Injects commercial license
  host: 'api.my-relay.com'        // Target domain for cryptographic verification
});

// Create the room and automatically join as Coordinator
const session = await coordinator.createRoomAndJoin(
  UNSIGNED_PSBT,
  'bitcoin', // 'bitcoin' | 'testnet' | 'signet'
  'Project Titan Vault (3-of-5)',
);

console.log(`Room ID: ${session.roomId}`);
console.log(`Encryption Key: ${session.encryptionKey}`);
console.log(`Admin Secret: ${session.encryptedAdminToken}`);

// Set your display name
await coordinator.setDisplayName('Treasury Manager');

2. Generating Capability-based RBAC roles (Coordinator)

The Coordinator can generate cryptographically secure, capability-restricted role tokens. The server stores role token hashes and enforces coarse constraints (e.g. signature upload) without access to the encryption key. Fine-grained UI policies travel in an encrypted policy blob.

// Generate a Standard Signer Role
const signerRole = await coordinator.generateAndRegisterRole({
  canUploadSignature: true,
  canExportPsbt: true,
  canExportAudit: false,
  canViewDetails: true,
  canViewSigners: true,
  canShareSession: false,
});

// Generate an Auditor / Observer Role
const auditorRole = await coordinator.generateAndRegisterRole({
  canUploadSignature: false,
  canExportPsbt: false,
  canExportAudit: true,
  canViewDetails: true,
  canViewSigners: true,
  canShareSession: false,
});

// Easily generate ready-to-click share links for frontend UIs
const UI_APP_URL = 'https://signingroom.io';
console.log(`Signer Link: ${coordinator.getRoomLink(UI_APP_URL, true, signerRole)}`);

3. Joining an Existing Room (Guest)

Guests securely connect and authenticate their specific capabilities using the room ID, base encryption key, and their assigned role token.

import { SigningRoomClient } from '@signing-room/sdk';

const guest = new SigningRoomClient({
  apiUrl: API_URL,
});

// Capture the 4-character Session ID when the network connects (Useful for reconnects)
let cachedSessionId = '';
guest.onEvent('SESSION_CONNECTED').subscribe((e) => {
  cachedSessionId = e.payload; 
});

// Join the room using the explicit role token generated above
await guest.joinRoom(session.roomId, session.encryptionKey, signerRole);

await guest.setDisplayName('Alice (Hardware Wallet 1)');

// Listen for live room updates
guest.onStateChange().subscribe((state) => {
  console.log(`Connected Participants: ${state.payload.connectedCount}`);
});

4. Seamless Session Resumption (Network Drops)

If a user loses internet connection (e.g., cell tower handoff), the SDK allows them to seamlessly resume their exact identity without spawning duplicate "ghost" users in the cryptographic audit log.

// Assume 'guest' disconnected due to a dirty network drop
const reconnectedGuest = new SigningRoomClient({ apiUrl: API_URL });

// 1. Inject the cached Session ID from the initial connection BEFORE joining
reconnectedGuest.restoreSessionId(cachedSessionId);

// 2. Rejoin using the exact same credentials
await reconnectedGuest.joinRoom(session.roomId, session.encryptionKey, signerRole);

// The backend will safely strip the old dead socket, bind this new socket to the existing 
// identity, and silently update the audit log with a clean "Session Reconnected" entry.

5. Room Management & Operational Security

The Coordinator can rename the room, map signer fingerprints, label UTXO addresses, manage address whitelists, and lock the room to prevent new participants from joining.

// Rename the room
await coordinator.setRoomName('Q1 Settlement - Approved');

// Associate a fingerprint with a human-readable label
await coordinator.setSignerLabel('fe0fa7b4', "Alice's Wallet");

// Update approved destination/source addresses
const approvedAddresses = [
  'tb1qqn3pzlcmp8mudfhljtdwe7u6fhjhh3x2rr3njvlj35gx0kqmxxtqlqrzyc',
  'tb1qww078psjaee79gh0cfrqpf6gtzvxzk7gcfs869vnxtruhj6xj03qjfdnh8',
];

await coordinator.updateWhitelist(approvedAddresses, false);

// Associate a UTXO address with a human-readable label
await coordinator.setAddressLabel(
  'tb1qqn3pzlcmp8mudfhljtdwe7u6fhjhh3x2rr3njvlj35gx0kqmxxtqlqrzyc',
  'Corporate Treasury',
);

// Prevent any new participants from joining
await coordinator.toggleLock(true);

6. Event-Driven Monitoring & Uploading Signatures

The SDK exposes an RxJS event bus, making it easy to build reactive UIs or trigger automated alarms when certain conditions are met.

import { filter, take } from 'rxjs';

// Monitor all incoming signatures
coordinator.onEvent('SIGNATURE_RECEIVED').subscribe((event) => {
  console.log(
    `Signature received! Total: ${event.payload.signaturesReceived}/${event.payload.totalSigners}`,
  );
});

// Set an "Alarm" for human-in-the-loop notifications
coordinator
  .onEvent('SIGNATURE_RECEIVED')
  .pipe(
    filter((e) => e.payload.signaturesReceived === 2),
    take(1), // Only fire once
  )
  .subscribe(() => {
    console.log('2 Signatures collected. Paging CEO for final review...');
  });

// Upload a signature (Guest)
const ALICE_SIGNED_PSBT = 'cHNidP8BA...';
const fingerprint = guest.extractFingerprintFromSignature(ALICE_SIGNED_PSBT);

// Will automatically be rejected by the server if the guest's role restricts uploads
await guest.uploadSignature(ALICE_SIGNED_PSBT, fingerprint);

7. Automated Finalization & Forensic Auditing

When the PSBT signature threshold is met, the SDK emits a THRESHOLD_MET event. The Coordinator can use this to finalize the transaction and extract cryptographic audit proofs.

coordinator
  .onEvent('THRESHOLD_MET')
  .pipe(take(1)) // Ensure we only finalize once
  .subscribe(async (event) => {
    console.log(`Quorum Reached! (${event.payload.signaturesReceived}/${event.payload.threshold})`);

    // Finalize transaction
    const finalTx = await coordinator.finalizeTransaction();

    console.log(`Ready to Broadcast HEX: ${finalTx.hex}`);
    console.log(`TXID: ${finalTx.txId}`);

    // Export audit log
    const csvLog = coordinator.getAuditLogCsv();

    // Generate integrity report
    const report = await coordinator.getIntegrityReport();
    console.log(`Forensic SHA-256 Anchor: ${report.anchor}`);

    // Verify active integrity in-memory
    const isValid = await coordinator.verifyIntegrity(report.anchor);
    console.log(`Integrity Check: ${isValid.isValid ? 'PASSED' : 'FAILED'}`);

    // Destroy the room permanently
    await coordinator.closeRoom();
    coordinator.disconnect();
  });

8. Independent Offline Auditing & License Verification

A true Zero-Trust architecture means external auditors can independently verify the cryptographic math and software provenance after the infrastructure is destroyed. The SDK provides static methods to verify the transaction history and infrastructure licensing using nothing but the exported CSV file.

A. Verify Forensic Event Timeline Integrity

Auditors can re-calculate the SHA-256 anchor offline to prove the exported event logs and finalized transaction hex match perfectly.

import { SigningRoomClient } from '@signing-room/sdk';

// The auditor only needs the raw strings exported during the ceremony.
const exportedCsvString = `# --- SIGNING ROOM FORENSIC AUDIT RECORD ---\n...`;
const broadcastedHex = '02000000000101...';
const publishedAnchor = 'a1b2c3d4e5f6...';

const offlineResult = await SigningRoomClient.verifyOfflineIntegrity(
  exportedCsvString,
  broadcastedHex,
  publishedAnchor
);

console.log(`Computed Anchor: ${offlineResult.anchor}`);
console.log(`Cryptographic Match: ${offlineResult.isValid ? 'PASSED' : 'FAILED'}`);

B. Verify Infrastructure Provenance (Enterprise License)

Auditors can mathematically prove the origin of the software that executed the ceremony by verifying the Ed25519 commercial license signature embedded within the CSV header.

// Extract the embedded license token from the CSV and verify its Ed25519 signature
const licenseReport = await SigningRoomClient.verifyLicenseFromCsv(exportedCsvString);

if (licenseReport.isValid) {
  console.log(`Tier: ${licenseReport.tier}`);
  console.log(`Licensee: ${licenseReport.licensee}`);
  console.log(`Issued To: ${licenseReport.domain}`);
} else {
  console.log(`Verification Failed: ${licenseReport.tamperEvidentError}`);
}

// Alternatively, synchronously inspect a raw token string (useful for UI Dashboards)
const rawToken = SigningRoomClient.extractLicenseTokenFromCsv(exportedCsvString);
if (rawToken) {
  const info = SigningRoomClient.inspectLicenseToken(rawToken);
  console.log(`Optimistic Expiry Check: ${info.isExpired ? 'Expired' : 'Valid'}`);
}

9. Coordinator Role Recovery

If the Coordinator disconnects or closes their browser, they can reclaim administrative privileges using the encrypted admin token returned during room creation.

const recoveryClient = new SigningRoomClient({
  apiUrl: API_URL,
});

await recoveryClient.joinRoom(session.roomId, session.encryptionKey);

// Recover Coordinator privileges
await recoveryClient.claimCoordinator(session.encryptedAdminToken);

🏢 Enterprise & Commercial Licensing

SigningRoom.io is open-source under the AGPLv3 License.

  • Community Use: If you modify the code and host it publicly, you must open-source your changes under AGPL-3.0.
  • Commercial Use: Institutions requiring a Commercial License (AGPL Waiver) to integrate this technology into proprietary, closed-source infrastructure (e.g., internal banking systems, custodial platforms) must contact Stateless Research Ltd.

🔗 Contact Stateless Research for Licensing

Distributed under the GNU Affero General Public License v3.0 (AGPL-3.0).

If you modify this code and run it over a network, you must release your source code. See LICENSE for more information.