| … | … | @@ -23,12 +23,14 @@ export class CommunityRoom { |
| 23 | 23 | constructor (room) { this._room = room } |
| 24 | 24 | |
| 25 | 25 | // OWNER — create a fresh community room. This peer is the genesis writer AND the sole indexer (N=1, the |
| 26 | | // safe default per the autobase quorum rule — never auto-grow to N=2). Optionally set the name. |
| 27 | | static async create (corestore, { namespace = 'community', name = null } = {}) { |
| 26 | // safe default per the autobase quorum rule — never auto-grow to N=2). Optionally set the name and the |
| 27 | // community's atproto DID (see communityDid below). |
| 28 | static async create (corestore, { namespace = 'community', name = null, did = null } = {}) { |
| 28 | 29 | const room = new Room(corestore, { schema: communitySchema, bootstrapKey: null, namespace }) |
| 29 | 30 | await room.ready() |
| 30 | 31 | const cr = new CommunityRoom(room) |
| 31 | 32 | if (name) await cr.setMeta('name', name) |
| 33 | if (did) await cr.setMeta('did', did) |
| 32 | 34 | return cr |
| 33 | 35 | } |
| 34 | 36 | |
| … | … | @@ -87,6 +89,19 @@ export class CommunityRoom { |
| 87 | 89 | |
| 88 | 90 | async isBanned (did) { await this._room.base.update(); return !!(await this._room.view.get(BANNED + did)) } |
| 89 | 91 | |
| 92 | // The community's atproto DID (meta:did) — the CO-OWNED identity that owns/signs this community's |
| 93 | // app.bsky.feed.generator + app.bsky.labeler.service records and its com.atproto.label labels (the |
| 94 | // lens export, spec/lens-export.md §3). It is a SEPARATE substrate from this room: the DID is a |
| 95 | // co-owned hyper-proto-peer (StateBase admins + Lease + Signer/LabelRoom = the multiswarm-PDS pattern); |
| 96 | // this room is the keyless MEMBER roster. The room's MODS are the DID's admin/signer set — one attested |
| 97 | // group surfaced two ways (mods here; StateBase device-writers there). Returns null until set at create |
| 98 | // or via setDid. Keyless-safe (a plain meta read). |
| 99 | async communityDid () { return (await this.meta()).did || null } |
| 100 | |
| 101 | // Owner/mod: bind (or rebind) the community's atproto DID. Written like any meta op, so it linearizes + |
| 102 | // replicates to keyless readers. Set once at create normally; this is for late-binding / migration. |
| 103 | async setDid (did) { this._assertWritable('setDid'); this._assertDid(did); await this.setMeta('did', did) } |
| 104 | |
| 90 | 105 | async meta () { |
| 91 | 106 | await this._room.base.update() |
| 92 | 107 | const m = {} |