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

fb-mpc

v0.1.1

Published

TypeScript bindings for Fireblocks MPC signing library

Readme

fb-mpc

TypeScript bindings for the Fireblocks MPC signing library. Provides access to MPC CMP key generation, ECDSA/EdDSA signing, and key refresh from Node.js (via N-API native addon) and browsers (via WASM).

Installation

npm install fb-mpc

Prerequisites

Building the native addon requires:

  • C++ compiler (GCC, Clang, or MSVC)
  • CMake 3.14+
  • OpenSSL 1.1.1+
  • Node.js 18+

On Ubuntu/Debian:

apt install build-essential libssl-dev cmake

On macOS:

brew install openssl cmake

Building

# Build the native addon + TypeScript
npm run build

# Or build components separately:
npm run build:native   # N-API addon (.node)
npm run build:wasm     # WASM module (requires Emscripten)
npm run build:ts       # TypeScript compilation

Quick Start

import { getBackend } from "fb-mpc";

// Auto-detects Node.js (N-API) or browser (WASM)
const backend = await getBackend();

// Create a setup service for key generation
const setupService = backend.createSetupService(platform, persistency);

Implementing Callbacks

The library requires you to implement two callback interfaces:

PlatformService — provides platform capabilities (random number generation, signing authorization, etc.):

import type { PlatformService } from "fb-mpc";

const platform: PlatformService = {
  genRandom(length: number): Uint8Array {
    return crypto.getRandomValues(new Uint8Array(length));
  },
  getTenantId(): string {
    return "my-tenant";
  },
  getPlayerId(): bigint {
    return 1n;
  },
  // ... see types.ts for all methods
};

Key Persistency — provides storage for key material:

import type { SetupKeyPersistency } from "fb-mpc";

const persistency: SetupKeyPersistency = {
  storeKey(keyId, algorithm, privateKey, ttl) { /* save to DB */ },
  loadKey(keyId) { /* load from DB */ },
  // ... see types.ts for all methods
};

CMP Key Generation Protocol

The setup protocol runs in 5 rounds between N players:

import { SignAlgorithm } from "fb-mpc";

const keyId = "unique-key-id";
const playerIds = [1n, 2n];
const algorithm = SignAlgorithm.ECDSA_SECP256K1;

// Round 1: Generate commitments
const commitment = setupService.generateSetupCommitments(
  keyId, "tenant", algorithm, playerIds, 2, 0n, { masterKeyId: "", chaincode: new Uint8Array(0) },
);

// Round 2: Exchange commitments, get decommitments
const decommitment = setupService.storeSetupCommitments(keyId, allCommitments);

// Round 3: Exchange decommitments, generate ZK proofs
const proofs = setupService.generateSetupProofs(keyId, allDecommitments);

// Round 4: Verify proofs
const paillierProofs = setupService.verifySetupProofs(keyId, allProofs);

// Round 5: Create shared secret
const { publicKey, algorithm: algo } = setupService.createSecret(keyId, allPaillierProofs);

// Clean up
setupService.destroy();

Services

| Service | Description | |---------|-------------| | SetupService | CMP key generation (distributed key creation) | | EcdsaOnlineSigningService | ECDSA online signing (secp256k1, secp256r1, Stark) | | EcdsaOfflineSigningService | ECDSA offline pre-signing | | EddsaOnlineSigningService | EdDSA signing (Ed25519) | | OfflineRefreshService | Key share refresh without changing the public key |

Supported Algorithms

| Algorithm | Enum Value | |-----------|------------| | ECDSA secp256k1 | SignAlgorithm.ECDSA_SECP256K1 | | EdDSA Ed25519 | SignAlgorithm.EDDSA_ED25519 | | ECDSA secp256r1 | SignAlgorithm.ECDSA_SECP256R1 | | ECDSA Stark | SignAlgorithm.ECDSA_STARK |

Architecture

fb-mpc
├── src/ts/          # TypeScript API layer
│   ├── types.ts     # All interfaces, enums, type constants
│   ├── backend.ts   # MpcBackend interface
│   ├── index.ts     # Entry point + runtime detection
│   ├── napi-backend.ts   # Node.js N-API backend
│   └── wasm-backend.ts   # Browser WASM backend
├── src/c-wrapper/   # C API over C++ services
├── src/napi/        # N-API native addon
├── src/wasm/        # WASM/Emscripten bindings
└── demo-ts/         # Demo application

The package uses a dual-backend architecture:

  • Node.js: Loads a native N-API addon (.node) for direct C++ interop
  • Browser: Loads a WASM module compiled via Emscripten

Runtime detection is automatic — getBackend() selects the appropriate backend.

Demo

Run the demo to see the key generation protocol in action:

npx tsc -p demo-ts/tsconfig.json
node dist/demo/demo-ts/demo.js

The demo runs with a mock backend if the native addon is not built.

License

GPL-3.0 — see LICENSE for details.

This package wraps the Fireblocks MPC library, which is licensed under GPL-3.0.