rootlessnet-sdk
v2.0.1
Published
RootlessNet SDK - Complete SDK for building on RootlessNet protocol. A rootless, ownerless substrate for human expression.
Maintainers
Readme
RootlessNet SDK
A complete TypeScript/JavaScript SDK for building decentralized applications with self-sovereign identity, end-to-end encryption, and censorship-resistant communication.
What is RootlessNet?
RootlessNet is a decentralized protocol that enables:
- 🔑 Self-Sovereign Identity — You own your cryptographic keys
- 🔒 End-to-End Encryption — Private communications by default
- 📦 Content Addressing — Decentralized, location-independent content
- 🌐 No Central Authority — Truly censorship-resistant
- 👥 Community Zones — Create and moderate your own spaces
Installation
npm install rootlessnet-sdkOr with other package managers:
yarn add rootlessnet-sdk
bun add rootlessnet-sdk
pnpm add rootlessnet-sdkQuick Start
Create an Identity
import { RootlessNet } from 'rootlessnet-sdk';
const client = new RootlessNet();
const identity = await client.createIdentity();
console.log('Your DID:', identity.did);
console.log('Public Key:', identity.keySet.signing.publicKey);Create & Sign Content
// Post public content
const post = await client.post('Hello, RootlessNet!');
console.log('Content ID:', post.id);
console.log('Signed:', post.signature);
// Verify content
const isValid = await client.verifyContent(post);Encrypted Messaging
const alice = new RootlessNet();
const bob = new RootlessNet();
await alice.createIdentity();
await bob.createIdentity();
// Alice sends encrypted message to Bob
const encrypted = await alice.sendMessage(
bob.getDID(),
'Secret message'
);
// Bob receives and decrypts
const decrypted = await bob.receiveMessage(encrypted);Export & Backup Identity
// Create encrypted backup
const backup = await client.exportIdentity('mypassword');
// Restore from backup
const restored = new RootlessNet();
await restored.loadIdentity(backup, 'mypassword');Core Features
Identity Management
- Create self-sovereign identities
- Persistent or ephemeral pseudonyms
- Encrypted backups
- Key rotation support
Content Protocol
- Sign and verify content
- Multi-recipient encryption
- Content-addressed storage
- Threaded conversations
E2E Messaging
- X3DH key exchange (Signal protocol)
- Double Ratchet algorithm (perfect forward secrecy)
- Sealed anonymous messages
- Session management
Community Zones
- Create and manage zones
- Local moderation rules
- Member management
- Access control
API Overview
const client = new RootlessNet();
// Identity
await client.createIdentity();
client.getDID();
await client.exportIdentity(password);
await client.loadIdentity(backup, password);
// Content
await client.post(text);
await client.createContent(options);
await client.verifyContent(content);
// Messaging
client.getPrekeyBundle();
await client.sendMessage(recipientDid, message);
await client.receiveMessage(encrypted);
// Zones
await client.createZone(config);
await client.joinZone(zoneId);
// Events
client.on('identity:created', handler);
client.on('content:received', handler);
client.on('message:received', handler);Examples
Building a Chat App
class ChatApp {
constructor() {
this.client = new RootlessNet();
}
async initialize() {
await this.client.createIdentity();
console.log('Ready!', this.client.getDID());
}
async sendMessage(recipientDid, message) {
return await this.client.sendMessage(recipientDid, message);
}
listenForMessages() {
this.client.on('message:received', (msg) => {
console.log(`From ${msg.sender}: ${msg.content}`);
});
}
}Creating a Social Network Zone
const zone = await client.createZone({
name: 'My Community',
description: 'A decentralized space',
rules: {
requiresIdentity: true,
moderators: [moderatorDid]
}
});
// Post to zone
const post = await client.post('Hello zone!', {
zoneId: zone.id
});Security
- Private keys never leave your device — Keys are only used locally
- End-to-end encryption — Only recipients can read content
- Content verification — Cryptographic signatures prevent tampering
- Forward secrecy — Compromised keys don't expose past messages
Performance
- Lightweight — ~50KB minified
- Fast — Hardware-accelerated cryptography
- Async — Non-blocking I/O operations
- Scalable — Works from browsers to servers
Requirements
- Node.js >= 18.0.0
- Bun >= 1.0.0
- TypeScript 5.6.0+ (for development)
Documentation
Contributing
Contributions are welcome! See CONTRIBUTING.md
License
MIT - See LICENSE
Support
RootlessNet: Speech without roots. Power without owners.
