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

curvepoint

v1.0.5

Published

CurvePoint: A secure and flexible group messaging solution for blockchain applications.

Readme

API

Links: API, Classes

Classes

Class: CurvePoint

export class CurvePoint {
    constructor(wallet: Wallet) 
    async encrypt(message: number[], protocolID: WalletProtocol, keyID: string, recipients: string[], administrators?: string[]): Promise<{
        encryptedMessage: number[];
        header: number[];
    }> 
    async decrypt(ciphertext: number[], protocolID: WalletProtocol, keyID: string): Promise<number[]> 
    buildHeader(senderPublicKey: string, recipients: string[], encryptedKeys: {
        ciphertext: number[];
    }[], administrators: string[], currentVersion: number): number[] 
    parseHeader(ciphertext: number[]): {
        header: number[];
        message: number[];
        administrators: string[];
    } 
    async addParticipant(iheader: number[], protocolID: WalletProtocol, keyID: string, newParticipant: string): Promise<number[]> 
    async removeParticipant(iheader: number[], targetParticipant: string): Promise<number[]> 
}

Constructor

Initializes a new CurvePoint instance.

constructor(wallet: Wallet) 

Argument Details

  • wallet
    • The wallet instance providing cryptographic operations.

Method addParticipant

Adds a new participant to an existing message group.

async addParticipant(iheader: number[], protocolID: WalletProtocol, keyID: string, newParticipant: string): Promise<number[]> 

Returns

The updated message header as an array of bytes.

Argument Details

  • iheader
    • The original message header as an array of bytes.
  • protocolID
    • The protocol ID defining cryptographic context.
  • keyID
    • A unique identifier for the key used.
  • newParticipant
    • The public key of the new participant in hex format.

Method buildHeader

Builds a message header containing recipient and administrator information.

buildHeader(senderPublicKey: string, recipients: string[], encryptedKeys: {
    ciphertext: number[];
}[], administrators: string[], currentVersion: number): number[] 

Returns

The constructed header as an array of bytes.

Argument Details

  • senderPublicKey
    • The sender's public key in hex format.
  • recipients
    • An array of recipient public keys in hex format.
  • encryptedKeys
    • An array of objects containing encrypted symmetric keys.
  • administrators
    • An array of administrator public keys in hex format.
  • currentVersion
    • The current header version number.

Method decrypt

Decrypts a message intended for the recipient.

async decrypt(ciphertext: number[], protocolID: WalletProtocol, keyID: string): Promise<number[]> 

Returns

The decrypted message as an array of bytes.

Argument Details

  • ciphertext
    • The ciphertext containing the message header and encrypted message.
  • protocolID
    • The protocol ID defining cryptographic context.
  • keyID
    • A unique identifier for the key used.

Method encrypt

Encrypts a message for a group of recipients.

async encrypt(message: number[], protocolID: WalletProtocol, keyID: string, recipients: string[], administrators?: string[]): Promise<{
    encryptedMessage: number[];
    header: number[];
}> 

Returns

An object containing the encrypted message and the message header.

Argument Details

  • message
    • The plaintext message to encrypt as an array of bytes.
  • protocolID
    • The protocol ID defining cryptographic context.
  • keyID
    • A unique identifier for the key used.
  • recipients
    • An array of recipient public keys in hex format.
  • administrators
    • (Optional) An array of administrator public keys.

Method parseHeader

Parses a message header and extracts key information.

parseHeader(ciphertext: number[]): {
    header: number[];
    message: number[];
    administrators: string[];
} 

Returns

An object containing the parsed header, message, and administrator list.

Argument Details

  • ciphertext
    • The ciphertext containing the header and message.

Method removeParticipant

Removes a participant from the message group. Only administrators are authorized to perform this action.

async removeParticipant(iheader: number[], targetParticipant: string): Promise<number[]> 

Returns

The updated message header as an array of bytes.

Argument Details

  • iheader
    • The original message header as an array of bytes.
  • targetParticipant
    • The public key of the participant to remove in hex format.

Usage Examples

Encrypt and Decrypt a Message

import { CurvePoint } from 'curvepoint';
import { Wallet } from '@bsv/sdk';

// Step 1: Initialize a wallet instance
const wallet = new Wallet(/* ... wallet configuration ... */);

// Step 2: Create a CurvePoint instance
const curvePoint = new CurvePoint(wallet);

// Step 3: Encrypt a message
const message = [1, 2, 3, 4, 5];
const recipients = ['recipientPublicKey1', 'recipientPublicKey2'];
const administrators = ['adminPublicKey1', 'adminPublicKey2'];
const protocolID = ['App', 'exampleProtocol'];
const keyID = 'exampleKey';

const { encryptedMessage, header } = await curvePoint.encrypt(
    message,
    protocolID,
    keyID,
    recipients,
    administrators
);

// Step 4: Decrypt the message as a recipient
const decryptedMessage = await curvePoint.decrypt(
    [...header, ...encryptedMessage],
    protocolID,
    keyID
);

console.log('Decrypted Message:', decryptedMessage);

Add a Participant to an Existing Header

const updatedHeader = await curvePoint.addParticipant(
    header,
    protocolID,
    keyID,
    'newParticipantPublicKey'
);

console.log('Updated Header:', updatedHeader);

Remove a Participant (Administrator Only)

try {
    const updatedHeader = await curvePoint.removeParticipant(
        header,
        'participantToRemovePublicKey'
    );

    console.log('Header after participant removal:', updatedHeader);
} catch (error) {
    console.error('Failed to remove participant:', error.message);
}

Links: API, Classes