diezy-libsignal-node
v1.0.0
Published
Clean, secure and high-performance Open Whisper Systems' libsignal protocol for Node.js
Maintainers
Readme
diezy-libsignal-node
Clean, secure, and high-performance implementation of Open Whisper Systems' libsignal protocol for Node.js.
Designed specifically for WhatsApp multi-device protocols and Baileys-based clients, incorporating the best performance optimizations and stability enhancements from reference architectures (noxleyss, rexxhayanasi, and alipclutch), while maintaining 100% compliance with npm security policies.
✨ Features & Architecture
- Clean & 100% Safe: Zero postinstall/preinstall hooks, zero filesystem modifications, zero background network polling.
- Resilient Session Management: Robust session record pruning (
removeOldSessions) that gracefully handles legacy or corrupted session objects without throwing runtime exceptions. - Ordered Cryptographic Queue: Task execution pipeline to eliminate race conditions and serialize I/O operations across multi-device keys.
- Full WhatsApp Compatibility: Complete support for
curve25519-js,ProtocolAddress,SessionBuilder,SessionCipher, andkeyhelper. - TypeScript Support: Native TypeScript declaration file (
index.d.ts) included out of the box.
📦 Installation
npm install diezy-libsignal-nodeOr as an alias for @whiskeysockets/baileys / custom Baileys forks:
{
"dependencies": {
"libsignal": "npm:diezy-libsignal-node@^1.0.0"
}
}🚀 Quick Usage
const libsignal = require('diezy-libsignal-node');
// 1. Generate identity key pair & registration ID
const identityKey = libsignal.keyhelper.generateIdentityKeyPair();
const registrationId = libsignal.keyhelper.generateRegistrationId();
// 2. Generate prekey & signed prekey
const preKey = libsignal.keyhelper.generatePreKey(1);
const signedPreKey = libsignal.keyhelper.generateSignedPreKey(identityKey, 1);
// 3. Verify signature
const isValid = libsignal.curve.verifySignature(
identityKey.pubKey,
signedPreKey.keyPair.pubKey,
signedPreKey.signature
);
console.log('Signature valid:', isValid);🧪 Testing
npm test📄 License
GPL-3.0 License. Based on Open Whisper Systems' libsignal protocol.
