A fresh registry with its own state
import { createNip65Registry } from '@kehto/nip/65';
import { SimplePool } from 'nostr-tools/pool';
const registry = createNip65Registry();
const pool = new SimplePool();
pool.subscribeMany(discoveryRelays, [{ kinds: [10002], authors }], {
onevent: (e) => registry.ingest(e),
});
// Later, before publishing on behalf of `author`:
const outbox = registry.resolveOutboxRelays([author]);
Create a closure-scoped Nip65Registry for accumulating kind-10002 relay lists and resolving outbox/inbox relays.
Framework-agnostic: it knows nothing about relay pools, subscriptions, or storage. Feed it kind-10002 events (e.g. from your pool's
oneventcallback) via Nip65Registry.ingest and query the outbox model with Nip65Registry.resolveOutboxRelays.