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

libresend-p2p

v1.0.0

Published

Decentralized, encrypted, censorship-resistant messaging SDK

Downloads

26

Readme

LibreSend 🔐

Messagerie décentralisée, chiffrée et anti-censure

npm version License: AGPL-3.0

LibreSend est un SDK de communication P2P complet, sans serveur central, sans email, sans numéro de téléphone. Votre identité = vos clés cryptographiques.

✨ Caractéristiques

  • Décentralisé : P2P via libp2p + WebRTC, DHT pour découverte
  • Chiffré : Double Ratchet (Signal Protocol) + libsodium
  • Anonyme : Métadonnées minimisées, compatible Tor
  • Résilient : Messages hors-ligne via Waku
  • Synchronisé : CRDT (Yjs) pour salons et historique
  • Libre : 100% open-source AGPL-3.0

📦 Installation

npm install libresend

🚀 Démarrage rapide

import { LibreSend } from 'libresend';

// Initialiser le client
const client = new LibreSend();
await client.initialize();

// Créer une identité (génère les clés cryptographiques)
const identity = await client.createIdentity('Alice');
console.log('Mon ID:', identity.peerId);

// Se connecter au réseau P2P
await client.connect();

// Envoyer un message chiffré E2E
await client.send('peer-id-destinataire', 'Hello, monde décentralisé!');

// Recevoir des messages
client.onMessage((message) => {
  console.log(`${message.from}: ${message.content}`);
});

📖 API

Classe LibreSend

Initialisation

const client = new LibreSend(options?: LibreSendOptions);

interface LibreSendOptions {
  bootstrapNodes?: string[];  // Nœuds bootstrap personnalisés
  enableRelay?: boolean;      // Activer le relay pour NAT traversal (défaut: true)
}

Méthodes principales

| Méthode | Description | |---------|-------------| | initialize() | Initialise le client et la crypto | | createIdentity(name) | Crée une nouvelle identité avec clés | | loadIdentity(exported) | Charge une identité exportée | | connect() | Se connecte au réseau P2P | | disconnect() | Se déconnecte proprement | | send(peerId, content) | Envoie un message chiffré | | onMessage(callback) | Écoute les messages entrants |

Salons (Rooms) avec CRDT

// Créer ou rejoindre un salon
const room = await client.joinRoom('mon-salon');

// Envoyer un message au salon
await room.send('Hello tout le monde!');

// Écouter les messages du salon
room.onMessage((msg) => {
  console.log(`[${msg.sender}]: ${msg.content}`);
});

// Synchronisation automatique via CRDT (Yjs)
// Les messages sont ordonnés et convergent automatiquement

Gestion d'identité

// Exporter l'identité (pour backup)
const exported = await client.exportIdentity('mot-de-passe-fort');

// Importer sur un autre appareil
await client.loadIdentity(exported, 'mot-de-passe-fort');

// Obtenir le fingerprint pour vérification
const fingerprint = client.getFingerprint();
// "A1B2 C3D4 E5F6 ..."

🏗️ Architecture

┌─────────────────────────────────────────────────────────────┐
│                    Votre Application                         │
└─────────────────────────────────────────────────────────────┘
                              │
┌─────────────────────────────▼─────────────────────────────────┐
│                     LibreSend SDK                             │
│  ┌──────────────┐ ┌──────────────┐ ┌──────────────┐          │
│  │   Identity   │ │   Messaging  │ │    Rooms     │          │
│  │   Manager    │ │   (E2E)      │ │   (CRDT)     │          │
│  └──────────────┘ └──────────────┘ └──────────────┘          │
└───────────────────────────────────────────────────────────────┘
                              │
┌─────────────────────────────▼─────────────────────────────────┐
│                      Réseau P2P                               │
│  ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐        │
│  │  WebRTC  │ │   DHT    │ │ GossipSub│ │  Relay   │        │
│  └──────────┘ └──────────┘ └──────────┘ └──────────┘        │
└───────────────────────────────────────────────────────────────┘

🔐 Sécurité

Algorithmes cryptographiques

| Composant | Algorithme | |-----------|------------| | Identity Key | Ed25519 | | Key Exchange | X25519 (Curve25519) | | Chiffrement | ChaCha20-Poly1305 | | Key Derivation | HKDF-SHA256 | | Password Hash | Argon2id |

Garanties de sécurité

  • Forward Secrecy : Double Ratchet, nouvelle clé à chaque message
  • Protection MITM : Signatures Ed25519, vérification fingerprint
  • Protection Replay : Nonces uniques + timestamps + counters
  • Métadonnées minimales : Padding, timing aléatoire optionnel
  • Pas de serveur central : Aucun point de compromission unique

Double Ratchet (Signal Protocol)

Alice                                    Bob
  │                                        │
  │  1. X3DH Key Agreement                │
  │  ──────────────────────────────────►  │
  │                                        │
  │  2. Symmetric Ratchet (chaque msg)    │
  │  ◄─────────────────────────────────►  │
  │                                        │
  │  3. DH Ratchet (périodique)           │
  │  ◄─────────────────────────────────►  │

🔄 Migration depuis Socket.IO

LibreSend inclut un bridge pour migrer progressivement depuis Socket.IO :

import { LibreSendBridge } from 'libresend/bridge';

const bridge = new LibreSendBridge({
  mode: 'gateway',      // 'gateway' | 'hybrid'
  socketIOPort: 3001,
});

// Les clients Socket.IO existants fonctionnent sans modification
// Le bridge traduit automatiquement vers LibreSend

Voir le guide de migration complet.

🌐 NAT Traversal

LibreSend gère automatiquement le NAT traversal :

  1. Connexion directe (même réseau)
  2. STUN (NAT simple)
  3. TURN (NAT symétrique)
  4. Circuit Relay (libp2p, pairs volontaires)

Le chiffrement E2E est préservé dans tous les cas.

📊 Stockage hors-ligne

Les messages pour les pairs hors-ligne sont stockés temporairement via Waku :

  • TTL : 7 jours par défaut
  • Chiffrement E2E préservé
  • Récupération automatique à la reconnexion

🛠️ Configuration avancée

const client = new LibreSend({
  // Nœuds bootstrap personnalisés
  bootstrapNodes: [
    '/dns4/bootstrap.example.com/tcp/4001/p2p/...',
  ],
  
  // Désactiver le relay (connexions directes uniquement)
  enableRelay: false,
});

📋 Prérequis

  • Node.js >= 18.0.0
  • Navigateur moderne avec WebRTC (pour usage web)

🤝 Contribuer

Les contributions sont les bienvenues ! Voir le dépôt GitLab.

📜 Licence

AGPL-3.0 - Libre pour toujours.


LibreSend - Communication libre, chiffrée, décentralisée.