Appearance
Wish SDK
Node.js SDK for building peer-to-peer applications on the Wish protocol.
What you get
- Cryptographic identity — Ed25519 keys managed by wish-core
- Peer discovery — find peers on local network, via relay, or directory
- Encrypted connections — end-to-end encrypted, multiplexed across apps
- Protocol matching — your app only sees peers running the same protocol
Install
sh
npm install @wishcore/wish-sdk@0.4.0-beta-25Two levels of API
App — direct control
Low-level access to wish-core. You handle peer events, send frames, manage state yourself.
typescript
import { App } from '@wishcore/wish-sdk';
const app = new App({
name: 'MyApp',
// Connects to wish-core automatically (Unix socket on macOS/Linux, TCP fallback)
protocols: ['myprotocol'],
});
app.on('ready', () => {
console.log('Connected to wish-core');
});
app.on('online', (peer) => {
console.log('Peer online:', peer.toString());
app.send(peer, Buffer.from('hello'));
});
app.on('frame', (peer, data) => {
console.log('Received from', peer.toString(), ':', data);
});RpcApp — structured protocols
Higher-level wrapper for building RPC-based protocols. Uses the Protocol class pattern for typed peer sessions with request/response handlers.
typescript
import { RpcApp, Protocol } from '@wishcore/wish-sdk';
import { Client, Server } from '@wishcore/wish-rpc';
class NotesProtocol extends Protocol {
peerNotes: Map<string, string[]> = new Map();
constructor() {
super();
this.server.registerMethod('list', (req, res) => {
res.send(myNotes);
});
}
online(peer, client) {
client.request('list', [], (err, notes) => {
this.peerNotes.set(peer.toUrl(), notes);
});
}
offline(peer) {
this.peerNotes.delete(peer.toUrl());
}
}
const app = new RpcApp({
name: 'Notes',
// Connects to wish-core automatically (Unix socket on macOS/Linux, TCP fallback)
protocols: {
notes: new NotesProtocol(),
}
});
await app.whenReady;
console.log('Identities:', app.identities);Prerequisites
Wish SDK connects to a running wish-core instance. Download the Wish app — it includes wish-core and the Dashboard for managing identities, contacts, and app permissions.
Next steps
- App reference — events, identity API, peer lifecycle
- Identity API — list, get, sign, verify
- Peers API — signals, sending data, peer pins