# API: hyper-p2p-merge-registry **Protocol:** `merge-registry/v1` · **Export:** `HyperP2PMergeRegistry` ## Overview `HyperP2PMergeRegistry` — P2P module. See [`README.md`](../README.md) and [`architecture.md`](architecture.md). ## Constructor ```js const mod = new HyperP2PMergeRegistry(opts) ``` | Option | Type | Default | Description | |--------|------|---------|-------------| | `topic` | Buffer \| string \| null | `null` | Hyperswarm topic; omit for local-only | | `keyPair` | KeyPair | random | Discovery identity | ## Methods ### `register(...)` Public API on `HyperP2PMergeRegistry`. See [`index.js`](../index.js) for parameters and return types. ### `lookup(...)` Public API on `HyperP2PMergeRegistry`. See [`index.js`](../index.js) for parameters and return types. ### `lookupEntry(...)` Public API on `HyperP2PMergeRegistry`. See [`index.js`](../index.js) for parameters and return types. ### `merge(...)` Public API on `HyperP2PMergeRegistry`. See [`index.js`](../index.js) for parameters and return types. ### `entries(...)` Public API on `HyperP2PMergeRegistry`. See [`index.js`](../index.js) for parameters and return types. ### `toJSON(...)` Public API on `HyperP2PMergeRegistry`. See [`index.js`](../index.js) for parameters and return types. ### `getStats() → object` Metrics plus `protocol: 'merge-registry/v1'`. ### `async ready()` Joins Hyperswarm when `topic` is set; opens Protomux channel. ### `async close()` Tears down swarm and clears local state; emits `closed` where applicable. ## P2P Gossip / sync over Protomux `merge-registry/v1` when `topic` is configured. ## Testing ```bash npm install && npm test ```