OverviewFilesCommitsIssuesDocsReleasesPeers

hyper-orgs commits / 5f80836

hyper-orgs: surface pairing descriptor + resumeOrgPairing (survive restart)
createOrgInvite now also returns the persistable descriptor; resumeOrgPairing (name, descriptor, swarm) re-registers the org-invite pairing member after a restart (mounts the org room, calls resumeRoomPairing). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
5f80836f849c4ec1452ddb78cf6750fc4ef6eeeb
by plankatron <fleeky@gmail.com> · 2026-05-28T01:51:06.000Z

Changed files (1) +18 -2

lib/hyper-orgs.js +18 -2
……@@ -24,7 +24,7 @@
2424 * today joiners are read-only followers of the org's autobase.
2525 */
2626
27import { Room, composeSchemas, createRoomPairing, joinRoomPairing, decodeRoomPairingInvite } from 'hyper-rooms'
27import { Room, composeSchemas, createRoomPairing, joinRoomPairing, resumeRoomPairing, decodeRoomPairingInvite } from 'hyper-rooms'
2828import { orgsSchema, validateName } from './schema.js'
2929
3030export class HyperOrgs {
……@@ -266,7 +266,23 @@ export class HyperOrgs {
266266 meta: { kind: 'org', name }
267267 })
268268 this._pairings.set(pairing.invite, pairing)
269 return { invitation: pairing.invite, close: pairing.close }
269 // descriptor lets the daemon persist + re-register this invite on restart.
270 return { invitation: pairing.invite, descriptor: pairing.descriptor, close: pairing.close }
271 }
272
273 /**
274 * Re-register a persisted org-invite pairing member after a restart so an
275 * already-shared invite keeps working. The org Room must be mounted first.
276 * @param {string} name
277 * @param {object} descriptor from a prior createOrgInvite()
278 * @param {object} swarm shared Hyperswarm (injected)
279 */
280 async resumeOrgPairing (name, descriptor, swarm) {
281 if (!swarm) throw new Error('resumeOrgPairing requires { swarm }')
282 const room = this._requireRoom(name)
283 const pairing = resumeRoomPairing(room, descriptor, swarm)
284 this._pairings.set(descriptor.invitation || (name + ':' + descriptor.discoveryKey), pairing)
285 return pairing
270286 }
271287
272288 /**