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

@toled/signal-expo

v0.5.14

Published

Signal Protocol encryption for Expo - wraps official libsignal library

Readme

@toled/signal-expo

Signal Protocol encryption for Expo/React Native - wraps the official libsignal library.

Features

  • End-to-end encryption using the Signal Protocol
  • Key generation (identity keys, pre-keys, signed pre-keys)
  • Session establishment via X3DH key agreement
  • Message encryption/decryption with Double Ratchet
  • Built on official Signal libraries (Swift + Kotlin bindings)

Requirements

  • Expo SDK 50+ or React Native 0.73+
  • iOS 13.0+
  • Android API 24+ (Android 7.0)
  • Development build required (not compatible with Expo Go)

Installation

npm install @toled/signal-expo expo-secure-store

Add the plugin to your app.json or app.config.js:

{
  "expo": {
    "plugins": ["@toled/signal-expo"]
  }
}

Then generate native projects and run:

# Generate native iOS/Android projects
npx expo prebuild --clean

# Run on iOS
npx expo run:ios

# Run on Android
npx expo run:android

Using EAS Build

eas build --profile development --platform all

Usage

import {
  generateIdentityKeyPair,
  generateRegistrationId,
  generatePreKeys,
  generateSignedPreKey,
  initialize,
  createSession,
  encrypt,
  decrypt,
} from '@toled/signal-expo';

// 1. Generate identity (do this once per device)
const identityKeyPair = generateIdentityKeyPair();
const registrationId = generateRegistrationId();
const preKeys = generatePreKeys(1, 100);
const signedPreKey = generateSignedPreKey(identityKeyPair, 1);

// 2. Initialize the protocol (required before encrypt/decrypt)
await initialize(identityKeyPair, registrationId, preKeys, signedPreKey);

// 3. Upload to your server (public keys only):
// - identityKeyPair.publicKey
// - registrationId
// - preKeys.map(k => ({ id: k.id, publicKey: k.publicKey }))
// - { id: signedPreKey.id, publicKey: signedPreKey.publicKey, signature: signedPreKey.signature }

// 4. Create session with recipient (using their pre-key bundle from server)
const recipientAddress = { name: 'user123', deviceId: 1 };
await createSession(recipientAddress, recipientPreKeyBundle);

// 5. Encrypt message
const plaintext = new TextEncoder().encode('Hello!');
const ciphertext = await encrypt(recipientAddress, plaintext);

// 6. Decrypt received message
const decrypted = await decrypt(senderAddress, receivedCiphertext);
const message = new TextDecoder().decode(decrypted.plaintext);

API

Key Generation

| Function | Description | |----------|-------------| | generateIdentityKeyPair() | Creates a new identity key pair | | generateRegistrationId() | Creates a 14-bit registration ID | | generatePreKeys(start, count) | Generates pre-keys for X3DH | | generateSignedPreKey(identityKeyPair, id) | Generates a signed pre-key |

Initialization

| Function | Description | |----------|-------------| | initialize(identityKeyPair, registrationId, preKeys, signedPreKey) | Initialize the protocol stores (required before encrypt/decrypt) |

Session Management

| Function | Description | |----------|-------------| | createSession(address, bundle) | Establishes session from pre-key bundle | | hasSession(address) | Checks if session exists | | deleteSession(address) | Removes a session |

Encryption/Decryption

| Function | Description | |----------|-------------| | encrypt(address, plaintext) | Encrypts a message | | decrypt(address, ciphertext) | Decrypts a message |

Types

interface IdentityKeyPair {
  publicKey: Uint8Array;  // 33 bytes
  privateKey: Uint8Array; // 32 bytes
}

interface ProtocolAddress {
  name: string;    // User identifier
  deviceId: number; // Device ID
}

interface PreKeyBundle {
  registrationId: number;
  deviceId: number;
  preKeyId: number | null;
  preKeyPublic: Uint8Array | null;
  signedPreKeyId: number;
  signedPreKeyPublic: Uint8Array;
  signedPreKeySignature: Uint8Array;
  identityKey: Uint8Array;
}

License

AGPL-3.0 (same as libsignal)

Credits

This library wraps the official Signal Protocol implementation from libsignal.