@witbitz/sdk 4.7.0 → 4.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/sdkPlan.js CHANGED
@@ -9,6 +9,7 @@
9
9
  // · CREATE-TIME — the tier, a split key, the tools the assistant may use and which run without approval: a new room
10
10
  // (`wb.createSpace`), and the SDK carries no history into it.
11
11
  // planChange() applies exactly those rules (the same functions configure() and fork() call) and changes nothing.
12
+ import { hasRoles, roleFor, rolesOf } from './roomRoles.js'
12
13
  import { planGovernance, normAdmission, forkConfig, checkAdminCollections } from './emailFork.js'
13
14
 
14
15
  const IN_PLACE_AGENT = ['name', 'instructions', 'model']
@@ -21,7 +22,7 @@ const RANK = { none: 0, in_place: 1, fork: 2, new_room: 3 }
21
22
  * @param room { cfg (the room's sealed config, or null), me (the signed-in email, or ''), lane (bool), checkData?(data) }
22
23
  * → { how: 'none'|'in_place'|'new_room'|'refused', history: 'kept'|'not_carried'|null, call, steps, reason? }
23
24
  */
24
- export function planChange (change = {}, { cfg = null, me = '', lane = false, activeLane = lane, checkData = null, gatedUnread = false, signIn = 'wb.signIn' } = {}) { // signIn: the call that signs in here ('wb.vault.signIn' in a vault) // gatedUnread: a gated room answered only its stub (not signed in)
25
+ export function planChange (change = {}, { cfg = null, me = '', role = roleFor(cfg, { email: me }), lane = false, activeLane = lane, checkData = null, gatedUnread = false, signIn = 'wb.signIn' } = {}) { // signIn: the call that signs in here ('wb.vault.signIn' in a vault) // gatedUnread: a gated room answered only its stub (not signed in)
25
26
  const steps = []
26
27
  let members = false // the change includes a member list (in place: space.changeMembers)
27
28
  let how = 'none', refusal = null
@@ -52,8 +53,8 @@ export function planChange (change = {}, { cfg = null, me = '', lane = false, ac
52
53
  if (gatedUnread && !cfg) refuse('sign_in_required', 'an email-gated room takes a change only from a signed-in member (' + signIn + ')')
53
54
  else if (cfg && cfg.ownerPolicy && !(cfg.ownerPolicy.policy && cfg.ownerPolicy.policy.app === 'chat.witbitz')) refuse('governed_room', 'an owner-governed room changes by fork-and-replay') // the sealed field is ownerPolicy (it read cfg.policy, which no config carries — sync sweep 2026-11-09); a room under Witbitz's own rule changes in place, as the server allows (spaceService op config)
54
55
  else if (cfg) {
55
- const gov = [...lower(cfg.admins), ...lower(cfg.owners)], email = String(me || '').toLowerCase()
56
- if (gov.length && !gov.includes(email)) refuse(email ? 'not_admin' : 'sign_in_required', email ? "only this room's admins can change the assistant" : 'a room with admins takes a change only from a signed-in admin (' + signIn + ')')
56
+ const email = String(me || '').toLowerCase()
57
+ if (hasRoles(cfg) && !role) refuse(email ? 'not_admin' : 'sign_in_required', email ? "only this room's admins can change the assistant" : 'a room with admins takes a change only from a signed-in admin (' + signIn + ')')
57
58
  else if (change.data !== undefined) { try { checkAdminCollections(change.data, cfg) } catch (e) { refuse(e.code || 'admins_required', String(e.message || e).replace(/^witbitz: /, '')) } }
58
59
  }
59
60
  }
@@ -74,14 +75,27 @@ export function planChange (change = {}, { cfg = null, me = '', lane = false, ac
74
75
  // the list (sdkRekey.js, sdk-people.md#members). A Space no longer moves, so a change that names a `history` is refused by name.
75
76
  if (change.history !== undefined) refuse('use_change_members', 'a Space no longer moves to a new room — its members change in place, history and all (space.changeMembers)')
76
77
  need('in_place'); members = true; steps.push('admission: changed in place — the same room and history, a new key that only the members on the list receive (space.changeMembers)')
77
- const admins = lower(cfg.admins), owners = lower(cfg.owners), email = String(me || '').toLowerCase()
78
+ const email = String(me || '').toLowerCase()
78
79
  if (!email) refuse('sign_in_required', 'a member change needs a signed-in member (' + signIn + ')')
79
- else if (!admins.length && !owners.length) refuse('not_admin', 'this Space has no owners or admins — only the Spaces app can change it (its creator)')
80
- else if ((admins.length || owners.length) && !admins.includes(email) && !owners.includes(email)) refuse('not_admin', "only this room's owners and admins change its members")
80
+ else if (!hasRoles(cfg)) refuse('not_admin', 'this Space has no owners or admins — only the Spaces app can change it (its creator)')
81
+ else if (!role) refuse('not_admin', "only this room's owners and admins change its members")
81
82
  else {
82
83
  // the same two checks space.fork() makes, in its order: governance, then an admins-only collection the
83
84
  // new room would keep with no admin or owner (emailFork.checkAdminCollections; sync sweep, 2026-10-10)
84
- try { planGovernance(cfg, gate, email, change.admission.admins !== undefined); const next = forkConfig(cfg, gate, ''); checkAdminCollections(next.dataSchema, next) } catch (e) { refuse(e.code || 'refused', String(e.message || e).replace(/^witbitz: /, '')) } }
85
+ try {
86
+ const old = rolesOf(cfg)
87
+ const ownerTags = change.admission.ownerTags ?? old.ownerTags, adminTags = change.admission.adminTags ?? old.adminTags
88
+ if (![ownerTags, adminTags].every(tags => Array.isArray(tags) && tags.every(t => typeof t === 'string' && t))) throw Object.assign(new Error('Role tags must be lists of room tags'), { code: 'invalid_argument' })
89
+ if (role !== 'owner' && (old.owners.length || old.ownerTags.length) &&
90
+ (ownerTags.length !== old.ownerTags.length || old.ownerTags.some(t => !ownerTags.includes(t)) || old.adminTags.some(t => !adminTags.includes(t) && !ownerTags.includes(t)))) {
91
+ throw Object.assign(new Error('Only an owner can change the owners or lower an admin'), { code: 'not_owner' })
92
+ }
93
+ planGovernance(cfg, gate, email, change.admission.admins !== undefined, role === 'owner')
94
+ const next = forkConfig(cfg, gate, '')
95
+ if (ownerTags.length) next.owners = { ...next.owners, tags: ownerTags }
96
+ if (adminTags.length) next.admins = { ...next.admins, tags: adminTags }
97
+ checkAdminCollections(next.dataSchema, next)
98
+ } catch (e) { refuse(e.code || 'refused', String(e.message || e).replace(/^witbitz: /, '')) } }
85
99
  }
86
100
  }
87
101
  }
@@ -92,5 +106,3 @@ export function planChange (change = {}, { cfg = null, me = '', lane = false, ac
92
106
  const call = how === 'in_place' ? (members ? (configures ? 'space.configure(…) and space.changeMembers(admission)' : 'space.changeMembers(admission)') : 'space.configure(…)') : how === 'new_room' ? 'wb.createSpace(…)' : null
93
107
  return { how, history, call, steps }
94
108
  }
95
-
96
- const lower = (g) => (g && Array.isArray(g.emails) ? g.emails.map((x) => String(x).toLowerCase()) : [])
package/sdkRekey.js CHANGED
@@ -14,7 +14,7 @@ import { checkInbox } from './inviteReceive.js' // collect(): the same reading o
14
14
  import { genRecipientKey, openBox, commit, combineShares } from './e2ee.js'
15
15
  import { tokenApp, tokenClaims } from './accountScope.js'
16
16
  import { GATE_DOMAIN } from './emailFork.js'
17
- import { EMAIL, normalizeDomains, lc, recipientsFor, membersAfter, unseenHidden, stillOnList, dropsForUsers } from './memberChange.js'
17
+ import { EMAIL, normalizeDomains, lc, hasOwnGrant, recipientsFor, membersAfter, unseenHidden, stillOnList, dropsForUsers } from './memberChange.js'
18
18
  import { ROSTER_DOC } from './roomRoster.js'
19
19
  import { hide } from './sdkRedact.js'
20
20
  import { assertNotKept } from './sdkCloudDevice.js'
@@ -271,7 +271,7 @@ async function rekeyNow (space, { members, stay, allowAfter, expectEpoch = null,
271
271
  (domains.has(lc(p.email).split('@')[1]) || p.entries?.some(e => typeof e === 'string' && e.startsWith('u:')))).map(p => lc(p.email))
272
272
  const found = await recipientsFor(space.room, [...stay, ...joined], wb._client || space._client, { scope, allow: allowAfter, people }) // include observed retained legacy handles, never arbitrary roster emails
273
273
  const recipients = [...found.recipients, ...extra.filter((x) => !found.recipients.some((r) => r.mh === x.mh))], { unreachable, pending } = found
274
- if (!recipients.some((x) => x.email === me)) throw sdkError('witbitz: this account has no invite key for this app yet (wb.invite.status: ' + wb.invite.status + ') — restore wb.invite.state from the device that has it', 'no_invite_key')
274
+ if (!await hasOwnGrant(recipients, space.room, me, () => ownTags(space))) throw sdkError('witbitz: this account has no invite key for this app yet (wb.invite.status: ' + wb.invite.status + ') — restore wb.invite.state from the device that has it', 'no_invite_key')
275
275
  const split = space._split ? { userShare: fragParam(space.shareLink, 'us') } : null
276
276
  if (space._split && !split.userShare) throw sdkError('witbitz: this split Space was not opened from its link — its user half is unknown here', 'invalid_argument')
277
277
  const r = await space._client.rekey(space.room, space._mk, { ...(members ? { members } : {}), recipients: recipients.map(({ mh, boxPub }) => ({ mh, boxPub })), pending: [...pending, ...unseenHidden(allowAfter, recipients, pending)], by: me, ...(split ? { split } : {}), ...(Number.isInteger(expectEpoch) ? { expectEpoch } : {}) }).catch(() => null) // ONE SNAPSHOT (docs/state-machines.md V#5, the SDK's twin K#1): the change was planned at this epoch — a key adopted on the way (the healing client's retry) must not apply it to another
@@ -284,6 +284,15 @@ async function rekeyNow (space, { members, stay, allowAfter, expectEpoch = null,
284
284
  return { epoch: r.epoch, unreachable: unreachable.filter((e) => e !== me) }
285
285
  }
286
286
 
287
+ export async function sessionRole(space, cfg, email = space._wb?._session?.email) {
288
+ if (!email) return ''
289
+ const direct = roleFor(cfg, { email })
290
+ if (direct === 'owner') return direct
291
+ const roles = rolesOf(cfg)
292
+ if (!roles.ownerTags.length && !roles.adminTags.length) return direct
293
+ return roleFor(cfg, { email, tags: await ownTags(space) })
294
+ }
295
+
287
296
  /** May this session change this Space (`what`: 'changeMembers' | 'rotateKey')? Throws the refusal; → { cfg, me }. Exported so a
288
297
  * vault checks BEFORE it asks the person (sweep 10-23 #21). */
289
298
  export async function changeable (space, what) {
@@ -302,9 +311,7 @@ export async function changeable (space, what) {
302
311
  const me = lc(wb._session.email)
303
312
  if (!hasRoles(cfg)) throw sdkError('witbitz: this Space has no owners or admins — only the Spaces app can change it (its creator)', 'not_admin')
304
313
  // a role held by this account's @username tag (§ 13.1) counts as one held by its email
305
- const rt = rolesOf(cfg)
306
- const tags = !roleFor(cfg, { email: me }) && (rt.ownerTags.length || rt.adminTags.length) ? await ownTags(space) : []
307
- if (!roleFor(cfg, { email: me, tags })) throw sdkError('witbitz: only an owner or an admin changes this Space', 'not_admin')
314
+ if (!await sessionRole(space, cfg, me)) throw sdkError('witbitz: only an owner or an admin changes this Space', 'not_admin')
308
315
  return { cfg, me }
309
316
  }
310
317
 
@@ -377,8 +384,10 @@ export async function planMembers (space, admission = {}, cfg = null) {
377
384
  // ROLES BY @USERNAME TAG (docs/spaces-usernames.md § 13.1; the owner, 2026-11-29). `admission.ownerTags` / `adminTags` (members()'s) state
378
385
  // them in full; unstated, the room's are kept — but where `owners` / `admins` are stated, a tag whose holder the guest book names by an
379
386
  // email left out of that list is dropped (lowered), and an email stated for someone who holds the role by tag stays their tag.
380
- const held = (cur.ownerTags.length || cur.adminTags.length) ? await roleTagHolders(Object.values((cur.book && cur.book.seen) || {}), [...cur.ownerTags, ...cur.adminTags], { room: space.room, userTag: typeof c.userTag === 'function' ? (n, r) => c.userTag(n, r) : null }) : new Map()
387
+ const roleTags = [...cur.ownerTags, ...cur.adminTags, ...(Array.isArray(admission.ownerTags) ? admission.ownerTags : []), ...(Array.isArray(admission.adminTags) ? admission.adminTags : [])]
388
+ const held = roleTags.length ? await roleTagHolders(Object.values((cur.book && cur.book.seen) || {}), roleTags, { room: space.room, userTag: typeof c.userTag === 'function' ? (n, r) => c.userTag(n, r) : null }) : new Map()
381
389
  const holderEmail = (t) => (held.get(t) && held.get(t).email) || ''
390
+ const roleUsers = Object.fromEntries([...held].filter(([, h]) => h.user).map(([t, h]) => [t, h.user]))
382
391
  const tagWant = {}
383
392
  for (const [role, key] of [['owners', 'ownerTags'], ['admins', 'adminTags']]) {
384
393
  if (admission[key] !== undefined) {
@@ -396,6 +405,7 @@ export async function planMembers (space, admission = {}, cfg = null) {
396
405
  for (const { email, username } of (pref && pref.learned) || []) {
397
406
  const t = await roleTagFor(c, username, space.room)
398
407
  if (!t) continue
408
+ roleUsers[t] = username
399
409
  for (const [role, e] of granted) if (e === email) { want[role] = want[role].filter((x) => x !== email); tagWant[role === 'owners' ? 'ownerTags' : 'adminTags'].push(t) }
400
410
  }
401
411
  }
@@ -435,7 +445,7 @@ export async function planMembers (space, admission = {}, cfg = null) {
435
445
  if (actor && (cur.owners.includes(actor) || cur.admins.includes(actor)) && (m.removed || []).map(lc).includes(actor)) {
436
446
  throw sdkError('witbitz: your own address is not on the new list — add it, or leave the Space instead', 'invalid_argument')
437
447
  }
438
- return { emails, cur, want, m, asUsers, epoch: epochOf(cfg), actor: lc(space._wb?._session?.email), roles: !asUsers.length && !m.removed.length && sameList(cfg.allow, m.allow) }
448
+ return { emails, cur, want, m, asUsers, roleUsers, epoch: epochOf(cfg), actor: lc(space._wb?._session?.email), roles: !asUsers.length && !m.removed.length && sameList(cfg.allow, m.allow) }
439
449
  }
440
450
 
441
451
  /** space.changeMembers(admission) — `admission`: { emails, domains?, admins?, owners?, advertise? }, the list stated in FULL,
package/sdkVault.js CHANGED
@@ -152,7 +152,7 @@ function openTransport(win, origin, helloMs) {
152
152
  signOut: () => call('signOut'),
153
153
  userToken: (t) => call('userToken', t), // per-user billing: the page's current token, handed over before an op that can spend
154
154
  enclaveAvailable: () => call('enclaveAvailable'),
155
- whoami: () => call('whoami'),
155
+ whoami: (...args) => call('whoami', ...args),
156
156
  lockSettings: () => call('lockSettings'), // the vault's lock sheet (a vault started with `lock: true`): the person decides there; the page learns { available, on, protect }
157
157
  notifications: () => call('notifications'), // the vault's notifications card (`push: true`): the person decides; the page learns { available, on }
158
158
  forget: (room) => call('forget', room),
@@ -10,6 +10,7 @@ import { derSigToRaw } from './x509.js'
10
10
 
11
11
  /** The build-enclave images whose verdicts count — infra/build-enclave/pins.json `buildEnclave` (held equal by a test). */
12
12
  export const BUILD_ENCLAVE_PCR0 = Object.freeze([
13
+ "5efd30e7333e33104dcc238d6d876b4019ee7cb0c80ee423786473199225de8bb11eb5edbb60b787b1f87741e8876e34",
13
14
  "c6a8cbd0c05d8e003e75b266f1dde2a6426b7cd61f845e4b128e59063e40968b44f30d934bbe1925582fe33bbdd0b1d7",
14
15
  "f490096d57e4287146e8b8d7bf4c75f423984ca52199efab0ee8684fbee6cfe6ab82c72d54f05a38f24a0d4ad6e2f557",
15
16
  "41ec7e0e54beac5759fba7efa06c48081dbd96c7299c29c92a9c619036ce057cec357ad4ad71a165d7f881df120b043b",
package/spaceClient.js CHANGED
@@ -131,6 +131,10 @@ const originBase = () => (typeof location !== 'undefined' && location.origin) ||
131
131
  // can't tamper with (the verifiable-client property). `{ relay, keyConfig }` = the direct mode: the app encapsulates
132
132
  // in-process (simpler; used by tests / the non-framed path). Unset ⇒ plain JSON POST (behaviour-neutral).
133
133
  let _ohttp = null
134
+ let relayRequired = false
135
+ export function requireOhttp(on) { relayRequired = !!on }
136
+ export function ohttpRequired() { return relayRequired }
137
+ const relayUnavailable = () => ({ status: 0, error: 'privacy_relay_unavailable' })
134
138
  export function configureOhttp(cfg) { _ohttp = (cfg && (typeof cfg.send === 'function' || (cfg.relay && cfg.keyConfig))) ? cfg : null }
135
139
  export async function readSealedArchive(read) {
136
140
  const first = await read(0)
@@ -156,8 +160,8 @@ export function ohttpActive() { return !!_ohttp }
156
160
  // bought that guarantee by AWAITing setup in boot — which held the whole UI hostage for the full setup (seconds, and up
157
161
  // to the 25s timeout on a bad network), the "blank for 30s then the app appears" bug. Instead: boot marks OHTTP pending
158
162
  // SYNCHRONOUSLY (before op one) and stops awaiting, so views resolve instantly; each network op below awaits this gate,
159
- // so it still never fires before OHTTP is up (success ⇒ routed oblivious) or has definitively given up (failure ⇒ direct,
160
- // the unchanged fail-open-to-direct posture). Untouched when OHTTP is off: _ohttpPending stays null → zero added latency.
163
+ // so it waits for setup, then uses the active relay
164
+ // or returns an offline result when the device requires the relay.
161
165
  let _ohttpPending = null // a Promise (with its resolver stapled on) while setup is in flight; null otherwise
162
166
  export function markOhttpPending() { let done; _ohttpPending = new Promise((r) => { done = r }); _ohttpPending._done = done }
163
167
  export function resolveOhttpPending() { const p = _ohttpPending; _ohttpPending = null; if (p && p._done) p._done() }
@@ -170,8 +174,8 @@ async function awaitOhttpReady() { const p = _ohttpPending; if (p) { try { await
170
174
  // leak — fail-closed on IP exactly like call().
171
175
  export async function ohttpSend(body, fetchImpl = (typeof fetch !== 'undefined' ? fetch : null)) {
172
176
  await awaitOhttpReady() // hold until "Hide my IP" setup settles, so this never picks the direct path while OHTTP is still coming up
173
- if (!_ohttp) return null
174
- try { return _ohttp.send ? await _ohttp.send(body) : await ohttpCall(body, fetchImpl) }
177
+ if (!_ohttp) return relayRequired ? relayUnavailable() : null
178
+ try { return (await (_ohttp.send ? _ohttp.send(body) : ohttpCall(body, fetchImpl))) || relayUnavailable() }
175
179
  catch (e) { return { status: 0, error: 'ohttp: ' + String((e && e.message) || e).slice(0, 120) } }
176
180
  }
177
181
 
@@ -198,22 +202,27 @@ export async function verifyAndEnableOhttp(relayBase, expect = {}, gateway = { a
198
202
  let _ohttpMod = null
199
203
  const ohttpMod = async () => (_ohttpMod || (_ohttpMod = await import('./ohttp.js')))
200
204
 
201
- async function ohttpCall(body, fetchImpl) {
205
+ async function ohttpCall(body, fetchImpl, config = _ohttp) {
202
206
  const O = await ohttpMod()
203
207
  const inner = O.encodeRequest({
204
- method: 'POST', scheme: 'https', authority: _ohttp.gatewayAuthority, path: _ohttp.gatewayPath || '/',
208
+ method: 'POST', scheme: 'https', authority: config.gatewayAuthority, path: config.gatewayPath || '/',
205
209
  headers: { 'content-type': 'application/json' }, body: new TextEncoder().encode(JSON.stringify(body)),
206
210
  })
207
- const { encRequest, ks, enc } = await O.encapsulateRequest(_ohttp.keyConfig, inner)
211
+ const { encRequest, ks, enc } = await O.encapsulateRequest(config.keyConfig, inner)
208
212
  // Send the encapsulated request THROUGH the relay as { op:'ohttp', enc:<base64> } — the relay forwards this opaque
209
213
  // envelope to the gateway verbatim (it can't read enc: ciphertext) and returns { res:<base64> }. Relay sees our IP
210
214
  // but not the room; the gateway decrypts the room but sees the relay's IP, not ours.
211
215
  const b64 = (u8) => { let s = ''; for (const b of u8) s += String.fromCharCode(b); return btoa(s) }
212
216
  const ub64 = (s) => { const bin = atob(s); const u = new Uint8Array(bin.length); for (let i = 0; i < bin.length; i++) u[i] = bin.charCodeAt(i); return u }
213
- const res = await fetchImpl(_ohttp.relay, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ op: 'ohttp', enc: b64(encRequest) }) })
214
- if (!res.ok) return { status: res.status }
215
- let env = {}; try { env = await res.json() } catch { return { status: res.status } }
216
- if (!env.res) return { status: env.status || res.status, ...(env.error ? { error: env.error } : {}) }
217
+ const packet = { op: 'ohttp', enc: b64(encRequest) }
218
+ let env
219
+ if (config.forward) env = await config.forward(packet.enc)
220
+ else {
221
+ const res = await fetchImpl(config.relay, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(packet) })
222
+ if (!res.ok) return { status: res.status }
223
+ env = await res.json()
224
+ }
225
+ if (!env?.res) return { status: env?.status >= 400 ? env.status : 0, error: 'privacy_relay_unavailable' }
217
226
  const respBhttp = await O.decapsulateResponse(ks, enc, ub64(env.res))
218
227
  const resp = O.decodeResponse(respBhttp)
219
228
  let data = {}
@@ -221,9 +230,19 @@ async function ohttpCall(body, fetchImpl) {
221
230
  return { status: resp.status, ...data }
222
231
  }
223
232
 
233
+ // The worker seals to the gateway independently of the page carrying its envelope. Refresh this PUBLIC pin
234
+ // alongside gateway key rotations. A stale pin fails closed. The existing attested shim carries the outer request.
235
+ export function workerEnvelopeTransport(forward) {
236
+ const pub = 'BIfFQos1TNEVvDa0Njw4XvMqwHRMFix92888qJBRatoRaUvGpzQVgYEMeH0ij8rudN5IAtbB04GLscfRchfmc5c'
237
+ const config = { gatewayAuthority: 'api.witbitz.chat', gatewayPath: '/v1/space',
238
+ keyConfig: { keyId: 1, publicKey: Uint8Array.from(atob(pub.replace(/-/g, '+').replace(/_/g, '/')), c => c.charCodeAt(0)) } }
239
+ config.forward = forward
240
+ return { send: body => ohttpCall(body, null, config) }
241
+ }
242
+
224
243
  async function call(endpoint, body, fetchImpl) {
225
- await awaitOhttpReady() // hold until "Hide my IP" setup settles, so an op never leaks direct while OHTTP is still coming up
226
- if (_ohttp) { try { return _ohttp.send ? await _ohttp.send(body) : await ohttpCall(body, fetchImpl) } catch (e) { return { status: 0, error: 'ohttp: ' + String((e && e.message) || e).slice(0, 120) } } }
244
+ const routed = await ohttpSend(body, fetchImpl)
245
+ if (routed !== null) return routed
227
246
  const res = await fetchImpl(endpoint, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) })
228
247
  let data = {}
229
248
  try { data = await res.json() } catch { /* non-JSON → status only */ }
@@ -1476,7 +1495,8 @@ export function makeSpaceClient({ endpoint = DEFAULT_ENDPOINT, fetch: fetchImpl,
1476
1495
  // builder's half and its seal stay as they are. The grants carry userShare' (never mk'); the answer carries newShare.
1477
1496
  rekey: async (room, mk, { members = null, recipients = [], pending = [], by = '', split = null, creatorPriv = null, link = null, expectEpoch: wantEpoch = null } = {}) => { // link: { roster, gk } — a LINK Space (linkMembers.js): its roster and new invite key; recipients then carry `id` (keyGrantId) and `extra` (their fresh gk grant)
1478
1497
  const r = await policyPost(room, mk)
1479
- if (!r || r.status !== 200 || !r.configSealed) return { status: (r && r.status) || 502, error: (r && r.error) || 'policy_unavailable' }
1498
+ if (!r || r.status !== 200) return { status: (r && r.status) || 502, error: (r && r.error) || 'policy_unavailable' }
1499
+ if (!r.configSealed) return { status: 502, error: 'policy_unavailable' }
1480
1500
  let cur = null
1481
1501
  try { cur = JSON.parse((await open(JSON.parse(r.configSealed), { mk })) || 'null') } catch { cur = null }
1482
1502
  if (!cur || typeof cur !== 'object') return { status: 409, error: 'config_unreadable' }
package/sw-notif-core.js CHANGED
@@ -353,7 +353,9 @@ self.wbxWirePush = (cfg) => self.addEventListener('push', (e) => {
353
353
  // A LOCKED CHAT (chatLockSw.js; docs/chat-lock-plan.md): the plain line only — no name, no words, no read of its own
354
354
  const locked = room ? await self.wbxChatLocked(room) : false
355
355
  const carried = allowed && !locked ? opened : null
356
- const fetched = carried || !room || locked ? null : await cfg.describe(room)
356
+ // Until the app has mirrored an explicit permission (including after an upgrade), show the notice offline.
357
+ const directAllowed = await self.wbxIdbGet('pushDirectAllowed').catch(() => false) === true
358
+ const fetched = carried || !room || locked || !directAllowed ? null : await cfg.describe(room)
357
359
  const d = allowed && !locked ? (carried || fetched) : null
358
360
  // ALERT or update quietly ("don't notify" is not an option on iOS — "don't buzz" is). Stamped only on an alert, or a
359
361
  // continuous conversation keeps pushing the window forward and never alerts again.
@@ -372,7 +374,7 @@ self.wbxWirePush = (cfg) => self.addEventListener('push', (e) => {
372
374
  else if (room) await self.wbxBadgeAdd(room) // the number on the app's icon counts it until it is read (appBadge.js)
373
375
  // The push carried the preview, so describe() did not run: run it now for its PREFETCH — after the notification is up,
374
376
  // so a slow or refused fetch never delays or blanks what is shown.
375
- if (carried && room && !tailKept) { try { await cfg.describe(room) } catch { /* the tap's prefetch is best-effort */ } }
377
+ if (directAllowed && carried && room && !tailKept) { try { await cfg.describe(room) } catch { /* the tap's prefetch is best-effort */ } }
376
378
  })())
377
379
  })
378
380
 
package/util.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // util.js — pure, dep-free leaf helpers (Verified-Client Phase 1). The DOM lookup ($) and formatters,
2
2
  // imported by space.js and (going forward) every extracted TCB module, so they need no rewiring.
3
3
 
4
- import { env } from './env.js' // leaf: is this frame the vault's (saveTextFile)
4
+ import { env, isIOS, nativePlatform } from './env.js' // leaf: is this frame the vault's (saveTextFile)
5
5
  import { attachSheetChrome, BACK_SVG, X_SVG } from './sheetChrome.js' // the one chrome every sheet gets: handle, ✕, pull-down, scrim tap, Escape
6
6
 
7
7
  export const $ = (id) => document.getElementById(id)
@@ -178,4 +178,14 @@ export const entryKey = entryKeyOf // ledgerView.js — the SDK keys reactions a
178
178
  // focus"). iOS ignores a focus that runs outside the tap (a timer, after a load); Android raises the keyboard for it. A
179
179
  // focus made INSIDE a tap (Reply, Rename, the search icon) is the person asking to type and stays as it is.
180
180
  export const hasMouse = () => { try { return matchMedia('(hover:hover) and (pointer:fine)').matches } catch { return false } }
181
+ // Cards follow the desktop shell even when its window is snapped or its only input is touch.
182
+ // In a browser, a mouse gets the desktop layout. Other devices retain each sheet's responsive CSS.
183
+ export function configureDesktopDialogs () {
184
+ const platform = nativePlatform()
185
+ const desktop = platform ? ['windows', 'macos', 'linux'].includes(platform) : hasMouse() && !isIOS() && !/Android/.test(navigator.userAgent)
186
+ if (!desktop) return
187
+ document.documentElement.classList.add('desktop-dialogs')
188
+ for (const style of document.querySelectorAll('style[data-desktop-dialogs]')) style.media = 'all'
189
+ for (const style of document.querySelectorAll('style[data-phone-dialogs]')) style.media = 'not all'
190
+ }
181
191
  export function focusIfMouse(el) { if (el && hasMouse()) { try { el.focus() } catch { /* a nicety */ } } }
package/vault-core.js CHANGED
@@ -22,7 +22,7 @@ import { routingIndex } from './opRouting.js'
22
22
  import { memberHash } from './rosterHash.js'
23
23
  import { Witbitz, Space, Lane } from './witbitz-sdk.js'
24
24
  import { LaneA2A, assertAgentTarget } from './sdkA2A.js'
25
- import { openGrant, relink, changeMembers, rotateKey, changeable, planMembers } from './sdkRekey.js' // a Space's members changed in place (https://witbitz.chat/docs/sdk-people.md#members)
25
+ import { openGrant, relink, changeMembers, rotateKey, changeable, planMembers, sessionRole } from './sdkRekey.js' // a Space's members changed in place (https://witbitz.chat/docs/sdk-people.md#members)
26
26
  import { setPendingKeyStore } from './connections.js' // the SDK's pending-key store (N#7): this vault's
27
27
  import { adoptPendingKeys } from './connPending.js'
28
28
  import { idb } from './idb.js'
@@ -34,6 +34,7 @@ import { liveLocks } from './chatLock.js'
34
34
  import { openItem, cardUrlOf, mcpUrlOf } from './a2aCore.js'
35
35
  import { judgeMove, checkNewRoomGov } from './emailFork.js'
36
36
  import { ROSTER_DOC, selfRow, ensureSelf, unseenIn, entriesMissing, announcedIn } from './roomRoster.js'
37
+ import { signedInRoomTags } from './roomRoles.js'
37
38
  import { findEmptySpaces, removeEmptySpaces, ownAdmissionEntries } from './emptySpaces.js'
38
39
  import { readAllPages } from './ledgerView.js'
39
40
  import { commit as keyCommit } from './e2ee.js'
@@ -57,6 +58,17 @@ export const VAULT_PROTOCOL = 1
57
58
  // cross-room), subscribe/unsubscribe (push belongs to the vault), and the intake ops (the account's). Sealed exports and supported chat imports are allowed.
58
59
  // (no 'safeCopy': a safe copy is made only where the sign-in and the key are — space.safeMedia.make is refused in a vault, and
59
60
  // nothing in vault mode posts one; sync sweep backlog P7)
61
+ export function roleSummary(emails, tags, roleUsers) {
62
+ const labels = [...emails]
63
+ let unknown = 0
64
+ for (const tag of tags || []) {
65
+ if (Object.hasOwn(roleUsers, tag)) labels.push('@' + roleUsers[tag])
66
+ else unknown++
67
+ }
68
+ if (unknown) labels.push(unknown + (unknown === 1 ? ' unidentified member' : ' unidentified members'))
69
+ return labels.join(', ') || 'none'
70
+ }
71
+
60
72
  export const PAGE_OPS = new Set(['poll', 'pollSealed', 'turn', 'state', 'data', 'title', 'decide', 'pending', 'mirror', 'toolResult', 'getConfig', 'setConfig', 'blob', 'react', 'mark', 'sealed', 'exportSealed', 'stop', 'toolRules', 'importChat', 'importWhatsApp'])
61
73
  const KEYS = { rooms: 'wbvault:rooms', session: 'wbvault:session', siri: 'wbvault:siri', a2a: 'wbvault:a2a', invite: 'wbvault:invite', connections: 'wbvault:connections', backup: 'wbvault:backup', keep: 'wbvault:keep', connPending: 'wbvault:connPending', connGone: 'wbvault:connGone', pendingForget: 'wbvault:pendingForget', pendingGrants: 'wbvault:pendingGrants' }
62
74
  // THE ACCOUNT, through the vault's session (docs/sdk-vault-mode.md § The account). The page asks; the vault runs it on its
@@ -82,7 +94,7 @@ export const ACCOUNT_CALLS = {
82
94
  /** The backup calls that need an account on the Witbitz account service (sync sweep 11-16 #15). */
83
95
  const SERVICE_CALLS = new Set(['manageSecurityKeys', 'signOutOthers', 'newRecoveryCode', 'emailMove', 'requestMoveTime', 'cancelEmailMove'])
84
96
  export const ROOM_ACCOUNT_CALLS = {
85
- roster: { list: {}, admission: {} },
97
+ roster: { list: {}, admission: {}, isOwner: {}, isAdmin: {}, sessionRole: {} },
86
98
  portable: { export: { confirm: true } },
87
99
  privateRoom: { link: { confirm: true }, unlink: { confirm: true } },
88
100
  keptAgent: { link: { confirm: true }, unlink: { confirm: true } },
@@ -1074,8 +1086,8 @@ export async function startVault(o = {}) {
1074
1086
  const summary = plan ? [
1075
1087
  'Members: ' + plan.emails.join(', '),
1076
1088
  'Domains: ' + ((plan.m.allow.domains || []).join(', ') || 'none'),
1077
- 'Owners: ' + (plan.want.owners.join(', ') || 'none'),
1078
- 'Admins: ' + (plan.want.admins.join(', ') || 'none'),
1089
+ 'Owners: ' + roleSummary(plan.want.owners, plan.want.ownerTags, plan.roleUsers),
1090
+ 'Admins: ' + roleSummary(plan.want.admins, plan.want.adminTags, plan.roleUsers),
1079
1091
  ...(plan.m.allow.users?.length ? ['Usernames: ' + plan.m.allow.users.map(u => u.handle).join(', ')] : []),
1080
1092
  ...(plan.m.allow.mh?.length ? ['Private membership entries: ' + plan.m.allow.mh.length] : []),
1081
1093
  ].join('\n') : ''
@@ -1191,7 +1203,7 @@ export async function startVault(o = {}) {
1191
1203
  'backup.newRecoveryCode': { title: 'Make a new recovery code?', text: 'Your current code stops working, and every other device is signed out. We email you a code to confirm, then show the new recovery code once.', ok: 'New code' },
1192
1204
  // a move already under way resumes in ITS saved mode, whatever this call asks (sdkBackupV2.js migrate) — the words say what it will do
1193
1205
  // (side sweep 2026-11-28: a resumed emailed-code move promised that devices could join, then signed them out)
1194
- 'backup.migrate': (sdk.backup._s?.v2?.moving ? (sdk.backup._s.v2.moveMode === 'signed' || sdk.backup._s.v2.svc?.silent === 'moved') : a?.silent === true) ? { title: 'Move this account with its signing key?', text: 'Your Spaces and recovery code stay the same. Other eligible devices can join using their existing account keys.', ok: 'Move account' } : { title: 'Move to the new account service?', text: 'Your Spaces and recovery code stay the same. Other devices are signed out and can restore on the new service. This legacy backup has no account key, so it moves with email-only trust; Advanced Backup remains unavailable.', ok: 'Move account' },
1206
+ 'backup.migrate': (sdk.backup._s?.v2?.moving ? (sdk.backup._s.v2.moveMode === 'signed' || sdk.backup._s.v2.svc?.silent === 'moved') : a?.silent === true) ? { title: 'Move this account with its signing key?', text: 'Your Spaces and recovery code stay the same. Other eligible devices can join using their existing account keys.', ok: 'Move account' } : { title: 'Move to the new account service?', text: 'Your Spaces and recovery code stay the same. Other devices are signed out and can restore on the new service. This legacy backup has no account key, so it moves using email alone. After the move, you can enroll security keys if Advanced Backup is available on this service.', ok: 'Move account' },
1195
1207
  'cloudDevice.enroll': { title: 'Sign the cloud device in?', text: 'We email a code so this secure cloud device can sign in to this app’s account. No Space is handed over yet.', ok: 'Send code' },
1196
1208
  'cloudDevice.register': { title: 'Add the cloud device to your account?', text: 'Register its public device key on the account service. You can sign it out later from Your devices. We email a code to confirm.', ok: 'Add device' },
1197
1209
  'cloudDevice.setBuilds': { title: 'Update the cloud device’s secure builds?', text: 'The cloud device will follow this account’s accepted secure-build list and automatic-acceptance choice.', ok: 'Update' },
@@ -1735,7 +1747,7 @@ export async function startVault(o = {}) {
1735
1747
  const config = await wop('getConfig', room, { plainMark: true })
1736
1748
  if (epoch === privacyEpoch && held(room) && (config?.help || config?.lane || config?.bridge)) return { excluded: true }
1737
1749
  const history = await readAllPages(since => wop('poll', room, undefined, since))
1738
- return epoch === privacyEpoch && held(room) && config && !config.help && !config.lane && !config.bridge && history.status === 200 && !history.incomplete ? { config, entries: history.entries, etag: history.etag, selfEntries: await ownAdmissionEntries(config, signedIn() && sdk.session.email, () => wop('state', room, ROSTER_DOC)), selfHash: signedIn() ? await memberHash(sdk.session.email, room) : null } : null
1750
+ return epoch === privacyEpoch && held(room) && config && !config.help && !config.lane && !config.bridge && history.status === 200 && !history.incomplete ? { config, entries: history.entries, etag: history.etag, selfEntries: await ownAdmissionEntries(config, signedIn() && sdk.session.email, () => wop('state', room, ROSTER_DOC), () => signedInRoomTags(sdk._client, room, sdk.session?.idToken)), selfHash: signedIn() ? await memberHash(sdk.session.email, room) : null } : null
1739
1751
  },
1740
1752
  forget: async room => { if (epoch === privacyEpoch && held(room)) { await base.forget(room); await dropRoom(room) } },
1741
1753
  }
@@ -1933,6 +1945,8 @@ export async function startVault(o = {}) {
1933
1945
  if (ns === 'a2a') return laneA2A(room, m, args)
1934
1946
  const sp = roomSpace(room)
1935
1947
  try {
1948
+ if (ns === 'roster' && m === 'sessionRole') return sessionRole(sp, await sp._gateConfig({ fresh: true, plainMark: true }))
1949
+ if (ns === 'roster' && (m === 'isOwner' || m === 'isAdmin')) return sp[m](args[0])
1936
1950
  if (ns === 'roster') return await (m === 'list' ? sp.roster() : sp.admission())
1937
1951
  if (ns === 'portable') {
1938
1952
  const { saveRoomExport } = await import('./sdkExports.js')
@@ -2148,7 +2162,9 @@ export async function startVault(o = {}) {
2148
2162
  if (op === 'getConfig') r = configForPage(r)
2149
2163
  if ((op === 'poll' || op === 'pollSealed') && r?.streamGrants) { const { streamGrants: _grants, ...visible } = r; r = visible }
2150
2164
  const lanes = op === 'getConfig' ? r && r.lanes : op === 'setConfig' && r && r.status === 200 && args[0] ? args[0].lanes : undefined
2151
- if (op === 'setConfig' && lanes === false) await disconnectRoomLanes(sdk, room)
2165
+ if (lanes === false && (op === 'setConfig' || sdk._heldLaneRooms(room).length ||
2166
+ sdk.backup.rooms.some(r => r.kind === 'lane' && r.shared === room) ||
2167
+ sdk.account.links.some(l => l.a === room || l.b === room))) await disconnectRoomLanes(sdk, room)
2152
2168
  if (typeof lanes === 'boolean') {
2153
2169
  const it = rooms.find((x) => x.room === room)
2154
2170
  if (it && it.link) { const url = new URL(it.link); url.searchParams.delete('lanes'); const hash = new URLSearchParams(url.hash.slice(1)); if (lanes) hash.set('lanes', '1'); else hash.delete('lanes'); url.hash = hash.toString(); const link = url.href; if (link !== it.link) { it.link = link; await saveRooms(); emit({ ev: 'rooms', rooms: publicRooms() }) } }
@@ -2157,13 +2173,26 @@ export async function startVault(o = {}) {
2157
2173
  return r
2158
2174
  },
2159
2175
  async create(cfg, opts) { // opts { enclave, split }: the confidential tier, a split-key room; anything else is refused, never ignored
2160
- if (opts !== undefined && opts !== null && (typeof opts !== 'object' || Object.keys(opts).some((k) => k !== 'enclave' && k !== 'split'))) throw Object.assign(new Error('vault: create takes { enclave, split } and nothing else'), { code: 'invalid_argument' })
2176
+ if (opts !== undefined && opts !== null && (typeof opts !== 'object' || Object.keys(opts).some((k) => k !== 'enclave' && k !== 'split' && k !== 'creator'))) throw Object.assign(new Error('vault: create takes { enclave, split } and nothing else'), { code: 'invalid_argument' })
2177
+ if (opts?.creator !== undefined && (opts.creator?.accountEpoch !== creationAccount() || opts.creator?.email !== who())) throw Object.assign(new Error('The creating account changed'), { code: 'account_changed' })
2161
2178
  return makeRoom(cfg, null, { enclave: !!(opts && opts.enclave === true), split: !!(opts && opts.split === true) })
2162
2179
  },
2163
2180
  }
2181
+ // An opaque revision lets the page bind a create to the current vault account without receiving its backup key.
2182
+ const creatorScopes = new WeakMap(), withoutBackup = {}
2183
+ let creatorRevision = 0
2184
+ function creationAccount() {
2185
+ const record = sdk.backup._s || withoutBackup
2186
+ const scope = JSON.stringify([privacyEpoch, sdk._archiveGeneration, who(), sdk.backup._restoreEpoch || 0])
2187
+ const previous = creatorScopes.get(record)
2188
+ if (previous?.scope === scope) return previous.revision
2189
+ const revision = ++creatorRevision
2190
+ creatorScopes.set(record, { scope, revision })
2191
+ return revision
2192
+ }
2164
2193
  async function makeRoom(cfg, lane, { enclave = false, split = false } = {}) {
2165
- const epoch = privacyEpoch, owner = who()
2166
- const current = () => { if (privacyEpoch !== epoch || who() !== owner) throw Object.assign(new Error('the account changed during creation'), { code: 'account_changed' }) }
2194
+ const revision = creationAccount()
2195
+ const current = () => { if (creationAccount() !== revision) throw Object.assign(new Error('the account changed during creation'), { code: 'account_changed' }) }
2167
2196
  // SPLIT: the room's key is two halves — the link holds one, the builder's app-half function (/api/appshare on THIS
2168
2197
  // origin; spaces/templates/appshare) the other. A vault that serves none cannot make one (`appShare: true` says it does).
2169
2198
  if (split && !o.appShare) throw Object.assign(new Error('vault: this vault serves no app-half function — a split-key Space needs one at /api/appshare (startVault({ appShare: true }))'), { code: 'vault_unsupported' })
@@ -2187,6 +2216,7 @@ export async function startVault(o = {}) {
2187
2216
  // Attest FIRST — loud on a configuration failure (no published claim: never mint a confidential room that pins
2188
2217
  // nothing), soft on a cold enclave (woken below) — then mint, wake, and hand the enclave its own sealed config.
2189
2218
  if (enclave) { await sdk._encAttestSoft(); pushEnclave() }
2219
+ current()
2190
2220
  const r = await wcall({ t: 'create', cfg, base: location.origin, ...(enclave && !split ? { enclave: true } : {}), ...(split ? { split: true, ...(sdk.backup.enabled ? { returnMk: true } : {}) } : {}), ...(sdk.backup.enabled ? { delAsk: true } : {}) })
2191
2221
  current()
2192
2222
  const mark = (l, m) => l + (l.includes('#') ? '&' : '#') + m
@@ -2370,7 +2400,7 @@ export async function startVault(o = {}) {
2370
2400
  if (epoch !== privacyEpoch) throw Object.assign(new Error('The account changed'), { code: 'account_changed' })
2371
2401
  await wipeSignedOut(); emit({ ev: 'signedOut' }); return { signedIn: false } },
2372
2402
  async enclaveAvailable() { return sdk._encClaimDoc().then(() => true, () => false) },
2373
- async whoami() { return signedIn() ? { signedIn: true, email: sdk.session.email, keyId: sessionKeyId() } : { signedIn: false } },
2403
+ async whoami(options) { return { ...(signedIn() ? { signedIn: true, email: sdk.session.email, keyId: sessionKeyId() } : { signedIn: false }), ...(options?.forCreate === true ? { accountEpoch: creationAccount() } : {}) } },
2374
2404
  async forget(room) {
2375
2405
  if (pendingForget.has(room)) { await purgeForgotten(room); return { forgotten: true } }
2376
2406
  if (!held(room)) return { forgotten: false }
package/vault-kit.mjs CHANGED
@@ -20,7 +20,7 @@ import { createHash } from 'node:crypto'
20
20
  import { join, dirname } from 'node:path'
21
21
 
22
22
  export const DEFAULTS = { endpoint: 'https://api.witbitz.chat/v1/space', loginBase: 'https://witbitz-spaces.pages.dev', from: 'https://witbitz.chat/sdk/latest/', enclaveClaim: 'https://witbitz-spaces.pages.dev/enclave-claim.json', accountService: 'https://api.witbitz.chat/v1' } // enclaveClaim: the confidential tier's published measurement (and its policy text, beside it)
23
- export const KIT_RELEASE = '4.7.0' // tools/sdk-release.mjs stamps the version here, so a downloaded copy builds from ITS release
23
+ export const KIT_RELEASE = '4.8.0' // tools/sdk-release.mjs stamps the version here, so a downloaded copy builds from ITS release
24
24
  export function stampSdkAuth(src) {
25
25
  return src.replaceAll('__' + 'SPACE_AUTH_BROKER' + '__', 'https://auth.witbitz.chat').replaceAll('__' + 'SPACE_AUTH_FORCE_BROKER' + '__', '0')
26
26
  }
package/vaultAtRest.js CHANGED
@@ -127,7 +127,8 @@ export function createAtRest ({ storage, key, currentRoom = () => true }) {
127
127
  return onDisk(async () => {
128
128
  const encoded = await Promise.all(snap.map(entryOut))
129
129
  const next = signature(snap)
130
- const commit = () => {
130
+ // Reject the lock callback promise on a failed write so the next save can acquire the lock.
131
+ const commit = async () => {
131
132
  const previous = snapshots.get(k)
132
133
  const disk = read(storage, k)
133
134
  const rows = new Map((Array.isArray(disk) ? disk : []).filter(currentRoom).map(r => [r.room, r]))
@@ -151,7 +152,7 @@ export function createAtRest ({ storage, key, currentRoom = () => true }) {
151
152
  }
152
153
  const locks = globalThis.navigator?.locks
153
154
  if (locks) await locks.request('witbitz:room-registry:' + k, commit)
154
- else commit()
155
+ else await commit()
155
156
  })
156
157
  },
157
158
  /** Every account's backup state (the vault's `wbvault:backup` = { email: state }), opened. */
package/witbitz-admin.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  // Witbitz admin client — one file for your SERVER (https://witbitz.chat/docs/sdk#builder-calls). Never ship it in a page.
2
2
 
3
- // spaces/public/sdk/4.7.0/connCatalog.js
3
+ // spaces/public/sdk/4.8.0/connCatalog.js
4
4
  var GCAL_PROVIDER = "prov_XE5FdiPdAx881HKs";
5
5
  var CATALOG = [
6
6
  // AN AGENT YOU SEND JOBS TO, not a service you sign in to (the owner, 2026-10-15: "Doesn't grokbot have a connector like
@@ -154,7 +154,7 @@ var CATALOG = [
154
154
  { name: "Gmail", kind: "mail", host: "mail.google.com", desc: "Forward the mail you choose into a Space of your own \u2014 the assistant reads it when you ask.", cat: "Email" }
155
155
  ];
156
156
 
157
- // spaces/public/sdk/4.7.0/cbor.js
157
+ // spaces/public/sdk/4.8.0/cbor.js
158
158
  var MAX_LEN = 1 << 22;
159
159
  function decode(bytes) {
160
160
  const b = toBytes(bytes);
@@ -348,7 +348,7 @@ function concat(...parts) {
348
348
  return out;
349
349
  }
350
350
 
351
- // spaces/public/sdk/4.7.0/x509.js
351
+ // spaces/public/sdk/4.8.0/x509.js
352
352
  var TAG = { INT: 2, BITSTRING: 3, OID: 6, SEQ: 48, UTCTIME: 23, GENTIME: 24 };
353
353
  var SIG_OIDS = /* @__PURE__ */ new Map([
354
354
  ["1.2.840.10045.4.3.2", { hash: "SHA-256" }],
@@ -522,7 +522,7 @@ async function verifyChain(chainDer, { now = Date.now() } = {}) {
522
522
  return certs[certs.length - 1];
523
523
  }
524
524
 
525
- // spaces/public/sdk/4.7.0/nitroVerify.js
525
+ // spaces/public/sdk/4.8.0/nitroVerify.js
526
526
  var NITRO_ROOT_G1_B64 = "MIICETCCAZagAwIBAgIRAPkxdWgbkK/hHUbMtOTn+FYwCgYIKoZIzj0EAwMwSTELMAkGA1UEBhMCVVMxDzANBgNVBAoMBkFtYXpvbjEMMAoGA1UECwwDQVdTMRswGQYDVQQDDBJhd3Mubml0cm8tZW5jbGF2ZXMwHhcNMTkxMDI4MTMyODA1WhcNNDkxMDI4MTQyODA1WjBJMQswCQYDVQQGEwJVUzEPMA0GA1UECgwGQW1hem9uMQwwCgYDVQQLDANBV1MxGzAZBgNVBAMMEmF3cy5uaXRyby1lbmNsYXZlczB2MBAGByqGSM49AgEGBSuBBAAiA2IABPwCVOumCMHzaHDimtqQvkY4MpJzbolL//Zy2YlES1BR5TSksfbb48C8WBoyt7F2Bw7eEtaaP+ohG2bnUs990d0JX28TcPQXCEPZ3BABIeTPYwEoCWZEh8l5YoQwTcU/9KNCMEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUkCW1DdkFR+eWw5b6cp3PmanfS5YwDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMDA2kAMGYCMQCjfy+Rocm9Xue4YnwWmNJVA44fA0P5W2OpYow9OYCVRaEevL8uO1XYru5xtMPWrfMCMQCi85sWBbJwKKXdS6BptQFuZbT73o/gBh1qUxl/nNr12UO8Yfwr6wPLb+6NIwLz3/Y=";
527
527
  var COSE_ALG_ES384 = -35;
528
528
  var MAX_DOC = 1 << 20;
@@ -646,8 +646,9 @@ async function verifyAttestation(cose, { root, now = Date.now(), maxAgeMs = 0, e
646
646
  return { ok: true, ...doc, leaf };
647
647
  }
648
648
 
649
- // spaces/public/sdk/4.7.0/sentinelRelease.js
649
+ // spaces/public/sdk/4.8.0/sentinelRelease.js
650
650
  var BUILD_ENCLAVE_PCR0 = Object.freeze([
651
+ "5efd30e7333e33104dcc238d6d876b4019ee7cb0c80ee423786473199225de8bb11eb5edbb60b787b1f87741e8876e34",
651
652
  "c6a8cbd0c05d8e003e75b266f1dde2a6426b7cd61f845e4b128e59063e40968b44f30d934bbe1925582fe33bbdd0b1d7",
652
653
  "f490096d57e4287146e8b8d7bf4c75f423984ca52199efab0ee8684fbee6cfe6ab82c72d54f05a38f24a0d4ad6e2f557",
653
654
  "41ec7e0e54beac5759fba7efa06c48081dbd96c7299c29c92a9c619036ce057cec357ad4ad71a165d7f881df120b043b",
@@ -794,7 +795,7 @@ async function recordPcrBy(r, subject, builders, verify = verifyAttestation) {
794
795
  return { pcr0, builder };
795
796
  }
796
797
 
797
- // spaces/public/sdk/4.7.0/sealShare.js
798
+ // spaces/public/sdk/4.8.0/sealShare.js
798
799
  var enc2 = new TextEncoder();
799
800
  var b64 = (u8) => btoa(String.fromCharCode(...new Uint8Array(u8)));
800
801
  async function sealTo(enclaveKey, nonce, bundle) {
@@ -808,13 +809,13 @@ async function sealTo(enclaveKey, nonce, bundle) {
808
809
  return { epk: b64(epk), iv: b64(iv), ct: b64(ct), nonce: b64(nonce) };
809
810
  }
810
811
 
811
- // spaces/public/sdk/4.7.0/connDisp.js
812
+ // spaces/public/sdk/4.8.0/connDisp.js
812
813
  var enc3 = new TextEncoder();
813
814
  var dec = new TextDecoder();
814
815
  var SALT = enc3.encode("witbitz-sentinel-display-v1");
815
816
  var INFO = enc3.encode("sentinel-display");
816
817
 
817
- // spaces/public/sdk/4.7.0/connections.js
818
+ // spaces/public/sdk/4.8.0/connections.js
818
819
  var STANDING_SENTINEL_PCR0 = ["0e424db41977965bc6edf225229eae70fe162dd8264b1ac0b5670cb3f71bf8b923001341e85a665354b25cd8418ac6d3"];
819
820
  var b642 = (u8) => btoa(String.fromCharCode(...new Uint8Array(u8)));
820
821
  var unb642 = (s) => Uint8Array.from(atob(s), (c) => c.charCodeAt(0));
@@ -928,7 +929,7 @@ async function attestStandingSentinel({ post, auth = {}, pins = STANDING_SENTINE
928
929
  }
929
930
  var MCP_CURATED = CATALOG.filter((c) => c.url).map((c) => ({ label: c.name, url: c.url }));
930
931
 
931
- // spaces/public/sdk/4.7.0/sdkRedact.js
932
+ // spaces/public/sdk/4.8.0/sdkRedact.js
932
933
  var REDACTED = "[REDACTED]";
933
934
  var INSPECT = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
934
935
  function hide(obj, names) {
@@ -953,7 +954,7 @@ function redacted(proto, summary) {
953
954
  });
954
955
  }
955
956
 
956
- // spaces/public/sdk/4.7.0/witbitz-admin.js
957
+ // spaces/public/sdk/4.8.0/witbitz-admin.js
957
958
  var adminError = (code, message) => Object.assign(new Error(message), { code: String(code || "refused") });
958
959
  var DEFAULT_ENDPOINT = "https://api.witbitz.chat/v1/space";
959
960
  var ownerRetired = () => adminError("owner_rule_retired", "witbitz: the owner rule (rooms only your app may use) is retired \u2014 a web page cannot prove which app it is (sdk-changes.md, 4.0.0)");