Quick Start
DAO MESSAGE provides official SDKs for Web and Android. The two platforms are fully protocol-compatible — Web users and Android users can message and call each other.
The backend is not replaceable. All clients connect to
relay.daomessage.com, which only forwards ciphertext and has zero knowledge of message content, contacts, or keys. You deploy a UI client, not a backend.
Pick your platform
🌐 Web SDK · TypeScript
@daomessage_sdk/sdk · Browser, PWA, Electron, React Native Web
- Install:
npm install @daomessage_sdk/sdk - Framework-agnostic: works with React / Vue / Svelte / vanilla JS
- 👇 Continue below on this page
📱 Android SDK · Kotlin
space.securechat:sdk · Native Android apps
- Jetpack Compose or traditional Views
- → Go to the Android SDK guide (currently a GitHub README, migrating into this site)
Web SDK in 5 minutes
Build an end-to-end encrypted chat app where the server never sees your messages.
Installation
npm install @daomessage_sdk/sdk1. Create the Client
import { SecureChatClient, newMnemonic } from '@daomessage_sdk/sdk';
// No arguments — the relay server URL is hardcoded inside the SDK.
const client = new SecureChatClient();The relay server at
relay.daomessage.comonly forwards ciphertext. It has zero knowledge of message content, contacts, or encryption keys.
2. Register an Account
// Generate a 12-word BIP-39 mnemonic (this is the user's master key)
const mnemonic = newMnemonic();
// Register: derives Ed25519 + X25519 keys, performs PoW, uploads public keys
const { aliasId } = await client.auth.registerAccount(mnemonic, 'Alice');
console.log('Registered as:', aliasId); // e.g. "u12345678"Important: The mnemonic is the only way to recover the account. Store it securely — the server never sees it.
3. Connect via WebSocket
client.connect();This opens a persistent WebSocket to the relay server. The SDK handles:
- Automatic reconnection with exponential backoff
- Heartbeat keepalive (30s interval)
- JWT token authentication
4. Listen for Messages
client.on('message', (msg) => {
console.log(`[${msg.conversationId}] ${msg.isMe ? 'Me' : msg.fromAliasId}: ${msg.text}`);
});The on() method returns an unsubscribe function — perfect for React:
useEffect(() => {
return client.on('message', handleMessage); // auto-cleanup
}, []);5. Send a Message
const messageId = await client.sendMessage(
conversationId, // Shared between both users
toAliasId, // Recipient's alias ID
'Hello, World!'
);Messages are automatically:
- Encrypted with AES-256-GCM using a shared session key
- Sent via WebSocket
- Persisted locally in IndexedDB
- Queued for retry if offline
6. Add a Contact
// Look up a user by their alias ID
const user = await client.contacts.lookupUser('u87654321');
// Send a friend request
await client.contacts.sendFriendRequest(user.alias_id);
// Accept an incoming request
await client.contacts.acceptFriendRequest(friendshipId);
// Sync all contacts (creates local encryption sessions)
const friends = await client.contacts.syncFriends();Complete Example
import { SecureChatClient, newMnemonic } from '@daomessage_sdk/sdk';
const client = new SecureChatClient();
// Register
const mnemonic = newMnemonic();
const { aliasId } = await client.auth.registerAccount(mnemonic, 'Alice');
// Connect
client.connect();
// Listen
client.on('message', (msg) => {
console.log(`${msg.fromAliasId}: ${msg.text}`);
});
// Send (after adding a contact)
await client.sendMessage('conv_abc', 'u87654321', 'Hello!');Next Steps
- Core Concepts — Understand the architecture
- Authentication — Registration, login, recovery
- Messaging — Text, images, files, voice
- Contacts — Friend system, security verification
- API Reference — Full SDK type declarations