@witbitz/sdk 4.7.1 → 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/README.md +2 -2
- package/acctV2Client.js +3 -3
- package/acctV2UiCore.js +1 -0
- package/acctV2WebAuthn.js +4 -4
- package/idb.js +1 -0
- package/l1-worker-src.js +1 -1
- package/l1-worker.js +22 -1
- package/manifest.json +16 -16
- package/package.json +2 -2
- package/sentinelRelease.js +1 -0
- package/spaceClient.js +32 -13
- package/sw-notif-core.js +4 -2
- package/vault-kit.mjs +1 -1
- package/vaultAtRest.js +3 -2
- package/witbitz-admin.mjs +11 -10
- package/witbitz-sdk.js +1 -1
package/l1-worker.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
// locally rather than round-trip.
|
|
15
15
|
import { routingIndex } from './opRouting.js'
|
|
16
16
|
import { prefetchUsable, positionOf, prefetchAnswer, prefetchHashKey } from './prefetchPoll.js'
|
|
17
|
-
import { makeSpaceClient, setAttestProvider, setPushSelf, setPushAcct, pushAcctSecretOf, viewingTag } from './spaceClient.js'
|
|
17
|
+
import { configureOhttp, requireOhttp, ohttpRequired, workerEnvelopeTransport, makeSpaceClient, setAttestProvider, setPushSelf, setPushAcct, pushAcctSecretOf, viewingTag } from './spaceClient.js'
|
|
18
18
|
import { idb } from './idb.js'
|
|
19
19
|
import { armIdbNaming, setIdbNaming } from './idbSeal.js' // §NAMES (docs/desktop-protection.md phase 2): this realm's store keeps opaque names on a protected device
|
|
20
20
|
import { _hasGzip, _jsonBytes, gunzipB64, gzipB64 } from './compress.js' // Atlas index docs: gzip/absorb/inject worker-side
|
|
@@ -286,6 +286,16 @@ const prefetchFlag = new Set() // rooms the service worker announced a fresh
|
|
|
286
286
|
let prefetchLookUntil = 0 // after a 'wakeup' (the page came to the foreground) every poll looks, for a few seconds: the first poll of a resumed page is already on its way before any tap message, and the push's announcement is lost while iOS holds the page suspended
|
|
287
287
|
try { const pfc = new BroadcastChannel('wb-prefetch'); pfc.onmessage = (e) => { const r = e && e.data && e.data.room; if (typeof r === 'string') prefetchFlag.add(r) } } catch { /* no BroadcastChannel: the first-poll check still runs */ }
|
|
288
288
|
|
|
289
|
+
function setWorkerRelay(on) {
|
|
290
|
+
if (on === ohttpRequired()) return
|
|
291
|
+
requireOhttp(on)
|
|
292
|
+
configureOhttp(on ? workerEnvelopeTransport(enc => auth('#ohttp:' + enc)) : null)
|
|
293
|
+
if (on) {
|
|
294
|
+
for (const held of streams.values()) held.s?.stop()
|
|
295
|
+
streams.clear()
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
289
299
|
self.onmessage = async (e) => {
|
|
290
300
|
const m = e.data || {}
|
|
291
301
|
switch (m.t) {
|
|
@@ -535,8 +545,18 @@ self.onmessage = async (e) => {
|
|
|
535
545
|
} catch (err) { self.postMessage({ id, error: 'inviteLink: ' + String((err && err.message) || err) }) }
|
|
536
546
|
return
|
|
537
547
|
}
|
|
548
|
+
case 'privacyPref': {
|
|
549
|
+
try {
|
|
550
|
+
if (m.on) setWorkerRelay(true)
|
|
551
|
+
await idb.setRawStrict('pushDirectAllowed', !m.on)
|
|
552
|
+
if (!m.on) setWorkerRelay(false)
|
|
553
|
+
self.postMessage({ id: m.id, result: 'sealed-room-relay-v1' })
|
|
554
|
+
} catch { self.postMessage({ id: m.id, error: 'Could not save the push privacy setting' }) }
|
|
555
|
+
return
|
|
556
|
+
}
|
|
538
557
|
case 'open': { // capture the room's mk here; (re)create the client bound to this realm
|
|
539
558
|
try {
|
|
559
|
+
if (m.hideIp) setWorkerRelay(true)
|
|
540
560
|
if (m.room && m.mk) keep(m.room, m.mk)
|
|
541
561
|
// ONE CLIENT PER REALM (sync sweep 2026-11-07 #6): a room open in the SAME realm (endpoint · app · tenant) keeps the client
|
|
542
562
|
// it has — what it learned (option B's prefetched `idextras` hints, gated/verified rooms, older key chains) is the
|
|
@@ -788,6 +808,7 @@ self.onmessage = async (e) => {
|
|
|
788
808
|
return
|
|
789
809
|
}
|
|
790
810
|
case 'streamOpen': {
|
|
811
|
+
if (ohttpRequired()) return
|
|
791
812
|
const { room } = m
|
|
792
813
|
const grants = m.grants || grantsByRoom.get(room)
|
|
793
814
|
let held = streams.get(room)
|
package/manifest.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "4.
|
|
3
|
-
"commit": "
|
|
4
|
-
"released": "2026-
|
|
2
|
+
"version": "4.8.0",
|
|
3
|
+
"commit": "b47312c7930f4196ede9d28eb94ce9e6f56e30b3",
|
|
4
|
+
"released": "2026-12-01",
|
|
5
5
|
"files": {
|
|
6
6
|
"a2aCore.js": "sha384-rnS5krIO4jMP44Rk55sMqVXUqQ+AOrYvMeLJ+lcaCr9uIEia1X6Yl39mmHOKt1/6",
|
|
7
7
|
"a2aShared.js": "sha384-8ZySzE/00iuVY9rHn+OF4ffcmGL/7z2eyFbRNIGejqnnnbf/AdHncYqLPU7RPq8L",
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
"accountStores.js": "sha384-0tmlMZ7cdtBOX+YG6z5ryNPoBkhmeTPqenBVYjum/n3FVaEUKD9Fn0hMl1u6HvXY",
|
|
15
15
|
"acctV2App.js": "sha384-suf3k46vq4ulVwHXPMzu3zgqBJ6nWWWatqxdBKReofx9VbmjoI213+6tDRU1/G+R",
|
|
16
16
|
"acctV2Check.js": "sha384-1tl+lRbBFz1cz6dLmVsCCVs8WLd6SIdo53wHN1PNBeKaSFaGLPcCJ1UsNfQZvYLL",
|
|
17
|
-
"acctV2Client.js": "sha384
|
|
17
|
+
"acctV2Client.js": "sha384-3VM3VGAL9huxo4SEOdgKbxvstGpiAqLzc2XcZrRM5zoyen98neR2zjtXVQoD4apx",
|
|
18
18
|
"acctV2Keys.js": "sha384-xlfDiwkXSQWjiKBcceDCfsoCVcuLRxxC/p8jss/K9M2gMn4x62ZE5UlFkm9eTpIV",
|
|
19
19
|
"acctV2Legacy.js": "sha384-QlBzwihqxBMe+eejAzEVYV4vnbJxj/3PNrtkovy+g1CMrIqQmDxeWkyLlcwPS2lG",
|
|
20
20
|
"acctV2Switch.js": "sha384-kFTFjxcIn9nKkpUUMEOdl7ZoQupXWBt5w7tZrcuZVx4xUsfryE3aPzEg4+KJm29W",
|
|
21
|
-
"acctV2UiCore.js": "sha384-
|
|
22
|
-
"acctV2WebAuthn.js": "sha384-
|
|
21
|
+
"acctV2UiCore.js": "sha384-jEeZZ1V3Et7b4Mc02H/VNHgaF6iEoXXm3OuEBq4djwklOReLiwg7yBzB8suHte5R",
|
|
22
|
+
"acctV2WebAuthn.js": "sha384-0FZNO6vz1gtGYUkgXleXjao2Jg1X4mtWhvTV/m9j4DkMwPgH1/q8yM7+H1Y284H5",
|
|
23
23
|
"acctV2Wire.js": "sha384-umBkf5pazE80LpOByLC7mdcrLiWUHzB4+OpdvUybpJ2KgpOsQ5ftgr0IInNmqKKT",
|
|
24
24
|
"addPreferred.js": "sha384-npT8Hea1UtImEiC7CMvZ3t9CQRVHqbjxEEQeoCWFJaDt2lTrdjL+4ipvek2NX8NQ",
|
|
25
25
|
"address.js": "sha384-GlXfyjK8I9tPdW9WDfcll/dzPtQe7G/EsJDw4yozjKi2dahI2Ogn9ira13iVbeK7",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"eraseFile.js": "sha384-XbqGtyFGuTTbIOTyhiCJ0fYdCWETvnuYOMMGulEyneEMxkn8YupQEnwYUMERh4AB",
|
|
94
94
|
"followImage.js": "sha384-fXM5pscmbxWeYsP+HsvovFO8IhdMS1KTkJA9zxoQlkJelv0RQVcf1K+/7/IZJdRk",
|
|
95
95
|
"healNames.js": "sha384-BrYl5itN8sTYkwgY/vMj9AiT/54AK6V/bzAw14FvzjtbipV16SY353ruKP7ZAB5+",
|
|
96
|
-
"idb.js": "sha384-
|
|
96
|
+
"idb.js": "sha384-oEXgNQxEAOc3+phEn1ILhjJ6YAQ2cRQAVHHigXlMtGR/pyu1vw4eFot9JKj+R4cX",
|
|
97
97
|
"idbSeal.js": "sha384-qDE6vLBy3FLV7lEuaf4bzp6UmtY/tJipOZdKvPhVttAWOvGgDcL+EiG+U6H0CniG",
|
|
98
98
|
"indexGone.js": "sha384-UWHAd79orf/n84uvDPQk6/czC+Yorwwygh8Dkm0By8bqStosXh0k3soewx40xjYw",
|
|
99
99
|
"invite.js": "sha384-ZzEaSWz3fzoLKW6A5vlfp9Sxp75YHGQOZmSTQ0Ru3g6w8d7iZz6q7bTfRjur3MD7",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"inviteSend.js": "sha384-1mW+Y0Prmkg2zteLBnnVIM0qMiMQi7vvBz2YiSYir0kxR7fY2c3TmaSGXi8goifi",
|
|
103
103
|
"jobAgents.js": "sha384-X6MXdAULj2JevxPtbvCA/N1L+PL0Zv2Aeh9xfmzKT9Ust3Pr2Nvmm1JdN2D6wiAo",
|
|
104
104
|
"keptMerge.js": "sha384-+IKgfams0D8AgT3/ne+Z45rqSMc9KqcqGQRD9oxkCkdj6C/vFSDFRx+TSd/UK/Oh",
|
|
105
|
-
"l1-worker.js": "sha384-
|
|
105
|
+
"l1-worker.js": "sha384-ENnIVNjRJZb9XXR65dc4bGIi/wcGPwXSqr2GYs3QImDF2ckV5TNtAOdC/yajSay/",
|
|
106
106
|
"laneAssociation.js": "sha384-IixAlVFfq/Hv6EciVn+zpRoYDQMZIN1SVPiLTJs+ZMXWP8GrAV+Cyg973YnO/4kV",
|
|
107
107
|
"laneConfig.js": "sha384-23nxPBKRdr5W7k4wp0IdiYm9E4pMHSyowDAX5ZRw4N6M1lTfFRC3wxyejlsaDbe6",
|
|
108
108
|
"laneLinkCore.js": "sha384-bdUhU+o0amycFRuRZCAeo+E2zWtHQiYgW9ffY0CqotDCmldBD8RG9CGL3Z6IwXga",
|
|
@@ -189,12 +189,12 @@
|
|
|
189
189
|
"sealShare.js": "sha384-AqXw807TlSiXMfXMAkvtOknirlMHchil9Z7WYlpkoCmm0t1o4LY37FU2goFqhckK",
|
|
190
190
|
"sealedNames.js": "sha384-N7KdhXd0LDdlTk6/tqo+SY8Ty3dheW444C7jNepHgMVHkw+tcRPqTHlyufgAeabv",
|
|
191
191
|
"sealedReceipt.js": "sha384-cxEVvIOaa0f//odHxmenbeMJh8Aal4ADwkiwn3sRVv+hIprDk3YgzHZym1ZXpPCK",
|
|
192
|
-
"sentinelRelease.js": "sha384-
|
|
192
|
+
"sentinelRelease.js": "sha384-qpFwmscU1IodefIezF1a37ARJCWGM46//wOWDjQPwbcHvJkYb911ewuKVfdXpuZx",
|
|
193
193
|
"shamir.js": "sha384-pPKyKj3LXePkZkFgHLRZc1XWfl6b8eq0g450R6uSeC7P2eHVyGlNAPXCBXUbYUj0",
|
|
194
194
|
"sharedViews.js": "sha384-+tw2Oj/1X1XXM+5PW4rVSyZOHXJ9yocOqbPc2NZ6245otJxaI5yKVZYnepHndBwL",
|
|
195
195
|
"sheetChrome.js": "sha384-2nTqz57klkEZhvjhwM03b/ISOaFy9Qh6L2uDlk/QwdD+Ua86ao7ostLaI1eTaRoq",
|
|
196
196
|
"siri.js": "sha384-WYAr+BM+JaTQlWfQ7eHylDgmhyK427uaJ8IvocIrX73B4qgQp1L2zrOGmFvMQEpK",
|
|
197
|
-
"spaceClient.js": "sha384-
|
|
197
|
+
"spaceClient.js": "sha384-EkIK/sAqU+3oqxd2O7JAD7SSw5Lktr6e1Bo3w6vgbxs9+PQ7tARRskB4IHvMfuAA",
|
|
198
198
|
"spaceConfig.js": "sha384-Pb3W47eQ8xQSGkL9yD521UFnn+tp4vV3+F5Y3Qf92d5jLPmEeZqo3Zbj1idGb4Wd",
|
|
199
199
|
"spaceEmailGate.js": "sha384-iynfCnft76GXEDC9p7K+mWkYpH+k1zHSSuuKi1JoSHCrHjcojoLB39WviO359U4K",
|
|
200
200
|
"spaceExport.js": "sha384-j9nsGBzycJ7w9YFYaMkufu4zOIs87GYW4LfHvW9fCZ4Ms57ptn7yw4BY6rI80nQG",
|
|
@@ -208,7 +208,7 @@
|
|
|
208
208
|
"streamHint.js": "sha384-oCgy5+jFo0rLa1ClIQaL7TpkXtKKWKaBUCxzQBQ67U1DGWo8VTPW4z0xmB1IhKaq",
|
|
209
209
|
"sttCloud.js": "sha384-okBhUPRe6BuneeTwctRD+IbAYyQqs30wFBvcfx+qv9xeMqGcTBcoODSraFHOfczi",
|
|
210
210
|
"sttWorklet.js": "sha384-IIMaavXUhyBqTuaeZjlxy9dpzBZbHZa+McrpWhuBrwlWansekQ9XXJ9lS3KEXeo4",
|
|
211
|
-
"sw-notif-core.js": "sha384-
|
|
211
|
+
"sw-notif-core.js": "sha384-6AjtDcguJR/MJhjnU4km7XWNOlnMAe5qWLLxiNGHlEExnY0ExQ9qXnd03PlE5ELR",
|
|
212
212
|
"tapTrail.js": "sha384-Na3QIhXdlCtSzDXAO9z1R2OZ36PuWQh/GzsN8luh4plArJJSDoYBjWrAU3NsqAku",
|
|
213
213
|
"tempList.js": "sha384-fH1HemG//WUOeW4u2Mi/2OJas7FV+dfnzlMNYofEK4KGDKCoTB33+U4nuRv9pq8h",
|
|
214
214
|
"tinfoilVerifier.js": "sha384-VGUL+148m10QYUYNezSWpMyl/rtwAJvQ3APcd4JscCnxudBSFODpSAvsr5aIZ55W",
|
|
@@ -221,9 +221,9 @@
|
|
|
221
221
|
"usageSummary.js": "sha384-Ox1QVGMJ9QwuddinJ0lCCqzzTH2gQlVh8d8Ozd0v6Vp6esApiWkdfbM5vgW0VT6C",
|
|
222
222
|
"util.js": "sha384-FY4tFxhs/cNXbCkQSVyZc/0iyP0V7bMZf5NdiQbx4okDxd09otsZB+VTTiXxjcDA",
|
|
223
223
|
"vault-core.js": "sha384-NsOrXk7Bqq+h4T3ZDwLPo4WyRQt0n98l/XyOFblo2VJXjF54ZqbWoA4n7RZOkCoh",
|
|
224
|
-
"vault-kit.mjs": "sha384-
|
|
224
|
+
"vault-kit.mjs": "sha384-g7GOtq2USJQPJX51NTRxuobkmCdb51Ekj4+aHuQm9VHs1TyGmpkrgO3fxzE/FIcY",
|
|
225
225
|
"vault-screens.js": "sha384-URf4/cjWLnzLt/dryA3odAUeJCe6lKmWxbDAl67nVpWIJerK/6tHf1DrS2SJj+KS",
|
|
226
|
-
"vaultAtRest.js": "sha384-
|
|
226
|
+
"vaultAtRest.js": "sha384-F00LSSeXxDFhTSMPruPFxbo0dAQImlg7CbTSTH+NJqu+Y3p6AmKYdMCr23kZ66VL",
|
|
227
227
|
"vaultCoreLock.js": "sha384-2RdHJjbgp/Qr1JzXX21I71vbiVmWl1Uv7JpBKnU/+InBaa0vC1B19EAMhYZ1LZ0/",
|
|
228
228
|
"vaultCorePush.js": "sha384-O0EKR7YJeoNcm8azSGUv+/vngeTwdV/6Moz8oEjrmgtz8Q/iedgR1879JfC4mXwc",
|
|
229
229
|
"vaultDeviceKey.js": "sha384-dxi/JbQlMPP7KkKYWyCSoD1cygLrzlppZ087rJLSlSLMK3PIBMuK/9GmNY/Hqovc",
|
|
@@ -235,14 +235,14 @@
|
|
|
235
235
|
"voiceAttest.js": "sha384-H+Uxa7jFO7kaLjxhZnSwgZ/GrgQLjCFV3o6hhQE4l0yw1mI1Nx6HKZVKSkhVJ9sW",
|
|
236
236
|
"voiceCert.js": "sha384-lYIUZhCjHZUqJOqIaV0JrMVJXl4u5O32+kofC6kSVAmwOUbpme9mMh0ZhNcrYYEj",
|
|
237
237
|
"witbitz-admin.js": "sha384-/e0V5Q5jYfuJVnomnQaXiI2hszGueuX5W2PbYApdFAowZXHW24m+mpxW+KHfSywE",
|
|
238
|
-
"witbitz-sdk.js": "sha384-
|
|
238
|
+
"witbitz-sdk.js": "sha384-vY7EF7US8n7kTF/KJkUvl1pT8NnUUVfIIEWu4xUhY4ImW53qVKJFfchAww5kBiqM",
|
|
239
239
|
"workerClient.js": "sha384-f/z7EfUCWakRS00R8UfWGnVIZDtWBA3WPXl2B5orVAkeyvaTUXVqC+hDqb4hkAB6",
|
|
240
240
|
"workerLiveness.js": "sha384-BSL4mziJ9HE+b2ILIHccsIxSloOr0NKm6pGrRrPN77cRLcwzaJHEEtrjrQcIgVZH",
|
|
241
241
|
"x509.js": "sha384-YAuy3/aSUomw0Ne+aDTto3HTb9yzdgA+1h44DimiEMjkMYOq/O6MhuRZKsbXmSSp",
|
|
242
242
|
"witbitz-sdk.d.ts": "sha384-bO138VoQVdsIwAdn2I60//aDOic8cBGkpZb4cPOFw7b2zwczd18QE2UQX0twzcJu",
|
|
243
243
|
"witbitz-admin.d.ts": "sha384-ikmN7qyKXg/WdVWmRORgw9LNt/n+M0zJaKcKbLlY0W+nEIH9b4uCCUbket/jWbwX",
|
|
244
244
|
"decrypt.html": "sha384-3xRvQ++CfE5Fdxf+zHU51M4wxGNthg4NZqrgfaO0vaHiKTKNplmgWBotsf1o8vTS",
|
|
245
|
-
"witbitz-admin.mjs": "sha384-
|
|
246
|
-
"l1-worker-src.js": "sha384-
|
|
245
|
+
"witbitz-admin.mjs": "sha384-Qwd8eNgBGUgEr5/rz6JIVA2HBdPPpAqepx8mNInM5808p/+TSUJXhLUVMGVA1yUq",
|
|
246
|
+
"l1-worker-src.js": "sha384-y/RHh6WP+PpXCWRcFC2LlTzdeMZnxjjAdEhpcFGVTjeWqQmjeQCZ+rSVtDSRLJ+2"
|
|
247
247
|
}
|
|
248
248
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@witbitz/sdk",
|
|
3
|
-
"version": "4.
|
|
4
|
-
"description": "The Witbitz SDK: Spaces — end-to-end encrypted rooms with an AI assistant — in your own app. The same bytes as https://witbitz.chat/sdk/4.
|
|
3
|
+
"version": "4.8.0",
|
|
4
|
+
"description": "The Witbitz SDK: Spaces — end-to-end encrypted rooms with an AI assistant — in your own app. The same bytes as https://witbitz.chat/sdk/4.8.0/",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./witbitz-sdk.js",
|
|
7
7
|
"types": "./witbitz-sdk.d.ts",
|
package/sentinelRelease.js
CHANGED
|
@@ -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
|
|
160
|
-
//
|
|
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 ?
|
|
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:
|
|
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(
|
|
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
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
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
|
-
|
|
226
|
-
if (
|
|
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 */ }
|
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
|
-
|
|
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/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.
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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)");
|
package/witbitz-sdk.js
CHANGED
|
@@ -201,7 +201,7 @@ const perTurn = (instructions) => (typeof instructions === 'string' && instructi
|
|
|
201
201
|
/** This SDK's version: 'dev' on the live build, the release number in /sdk/<version>/ (tools/sdk-release.mjs sets it). */
|
|
202
202
|
export { isLaneCopy } from './roomName.js' // is this message a lane's copy of its shared room's line? (the app's own test, sdk-agents.md#lanes)
|
|
203
203
|
export { Protect } // device storage protection, usable before a client exists (sdkProtect.js, #protect)
|
|
204
|
-
export const SDK_VERSION = '4.
|
|
204
|
+
export const SDK_VERSION = '4.8.0'
|
|
205
205
|
// Every error the SDK throws carries a `code` (sdk-reference.md#errors): an argument it cannot use is `invalid_argument`.
|
|
206
206
|
const sdkError = (message, code = 'invalid_argument') => Object.assign(new Error(message), { code })
|
|
207
207
|
/** What this SDK build can do — for feature detection (wb.capabilities()). Names only grow; a removed one is a major version. */
|