OverviewFilesCommitsIssuesDocsReleasesPeers

hyper-overlay commits / 5320177

overlay: per-DID protocol key + unregisterFile (del propagation)
- opts.key threads a per-instance channel id to OverlayProtocol, so N overlays coexist on ONE shared mux (a multi-DID daemon keys each overlay by roomKey). - unregisterFile(overlayPath): stop serving a path + logDel to the change feed, so deletes propagate to peers via attachReplication. Verified: overlay + corestore.replicate share a SecretStream mux (coexistence works in current overlay.js; the old shared-mux bug is gone). Replicator + fetch regression green. Tracks hyper-social #8. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
532017729403ad9f39d307dc70d6e1b26263dc2a
by plankatron <fleeky@gmail.com> · 2026-07-19T17:56:49.000Z

Changed files (2) +16 -1

lib/overlay.js +15 -0
……@@ -71,6 +71,11 @@ export class HyperOverlay extends ReadyResource {
7171 this._serveAuthorizer = opts.serveAuthorizer || null
7272 this._localProfileKey = opts.localProfileKey || null
7373
74 // Per-instance protocol channel id (opts.key) — lets N overlays coexist on ONE shared mux
75 // (e.g. a multi-DID daemon: one overlay per DID, each keyed by its roomKey, on one connection).
76 // Without it they collide on (PROTOCOL, null) and only the first channel opens.
77 this._key = opts.key || null
78
7479 // At-rest key for the local index cores (file-index/index-meta/sync-feed).
7580 this._indexEncryptionKey = opts.indexEncryptionKey || null
7681
……@@ -125,6 +130,7 @@ export class HyperOverlay extends ReadyResource {
125130 await sync.ready()
126131 const transfer = new TransferManager(index, { journalDir: this._journalDir })
127132 const protocol = new OverlayProtocol(sync, transfer, {
133 key: this._key,
128134 filePaths: this._filePaths,
129135 contentHashPaths: this._contentHashPaths,
130136 syncBaseDirs: this._syncBaseDirs,
……@@ -213,6 +219,15 @@ export class HyperOverlay extends ReadyResource {
213219 // ONCE, persists the content-addressed chunk map (durable in FileIndex), and
214220 // returns the content hash. Replaces a hash-only pass plus a lazy fetch-time
215221 // re-chunk with a single read, so the first fetcher never waits on chunk indexing.
222 // Stop serving a path AND record the deletion in the change feed, so the delete propagates to peers
223 // (attachReplication's remote peers see the del op and remove their copy). The authoring counterpart
224 // to a shim deleting a record. Idempotent.
225 async unregisterFile (overlayPath) {
226 await this._ensure()
227 this._filePaths.delete(overlayPath)
228 await this._sync.logDel(overlayPath)
229 }
230
216231 async prepareForServe (diskPath, opts = {}) {
217232 await this._ensure()
218233 // The overlay path below is a throwaway key — byHashOnly persists ONLY the
package.json +1 -1
……@@ -1,6 +1,6 @@
11{
22 "name": "hyper-overlay",
3 "version": "0.3.4",
3 "version": "0.3.5",
44 "description": "Content-addressed P2P file distribution over Protomux \u2014 FastCDC chunking, multi-source fetch, resumable transfers, zero blob duplication. Files live on disk; the overlay is a thin index and transfer protocol.",
55 "type": "module",
66 "main": "index.js",