Skip to content

Releases: PerryTS/iroh-bindings

v0.3.0 — bind options, deterministic keys, status snapshots

Choose a tag to compare

@proggeramlug proggeramlug released this 06 May 10:54

Closes the three asks from #425 (comment):

What's new

bind(options?)

interface BindOptions {
  secretKey?: string;  // hex- or base32-encoded SecretKey for stable identity
  mdns?: boolean;      // enable LAN peer discovery via mDNS-like swarm discovery
}

bind() with no args still works — fresh random identity, n0 relay/DNS only.

Deterministic identity

function generateSecretKey(): string;
function secretKeyFromSeed(seed: Uint8Array | Buffer): string;

Persist the result, pass it back via bind({ secretKey }) next time, and your nodeId stays stable across restarts. secretKeyFromSeed is fully deterministic — same 32-byte seed always produces the same key.

nodeStatus(endpoint)

interface NodeStatus {
  nodeId: string;
  online: boolean;
  homeRelay: string;
  directAddrs: string[];
}

One-shot snapshot of the endpoint's current reachability. Useful for healthchecks and human-readable status pages. Subscribing to changes needs an event surface that's deferred — same followup that gates connection-event callbacks.

Compatibility

ABI of js_iroh_bind changed (now takes a single f64 arg for the optional options object). Anyone upgrading from v0.2.0 → v0.3.0 must rebuild their perry program; user-facing TS code is fully backwards-compatible (bind() with no args still works).

v0.2.0 — multi-peer enumeration + binary stream payloads

Choose a tag to compare

@proggeramlug proggeramlug released this 05 May 21:36

New — meaningful-implementation phase additions on top of the v0.1.x MVP:

  • endpointConnections(endpoint) — sync list of every active peer connection handle, for broadcast/fan-out
  • connNodeId(conn) — sync remote-peer node id lookup
  • streamWriteBuffer(stream, buffer) — binary-safe variant of streamWrite
  • streamReadToEndBuffer(stream, maxBytes) — binary-safe variant of streamReadToEnd

Together these unlock real-world P2P use cases: chat broadcast, file transfer, encrypted protocol payloads — all without UTF-8 round-tripping or external bookkeeping.

// Server: broadcast to every connected peer
for (const c of iroh.endpointConnections(ep)) {
  console.log("→", iroh.connNodeId(c));
  const stream = await iroh.openBi(c);
  await iroh.streamWriteBuffer(stream, payload);  // raw bytes
  await iroh.streamFinish(stream);
}

3 new unit tests for the conn-index logic.

Connection-event callbacks (endpoint.on('connection', cb)) deferred — polling via acceptOne + endpointConnections covers the broadcast use case today; event-driven listeners need a wrapper-specific GC scanner + main-thread event pump.

v0.1.2

Choose a tag to compare

@proggeramlug proggeramlug released this 05 May 19:26

Full Changelog: v0.1.1...v0.1.2

v0.1.1

Choose a tag to compare

@proggeramlug proggeramlug released this 05 May 19:23