Skip to content

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

Latest

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).