@ghostlytools/sdk 1.7.3 → 1.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/dist/core.js +2 -2
- package/dist/{fakes-NFHnJNv8.js → fakes-DSeGiDvk.js} +2 -2
- package/dist/fakes-DSeGiDvk.js.map +1 -0
- package/dist/fakes.js +1 -1
- package/dist/index.js +2 -2
- package/dist/{keet-identity-key-740ESaV_.js → keet-identity-key-Db5KY0V1.js} +2 -2
- package/dist/{keet-identity-key-740ESaV_.js.map → keet-identity-key-Db5KY0V1.js.map} +1 -1
- package/dist/{src-Dw-9Vq6U.js → src-CfpOdLVf.js} +1435 -236
- package/dist/src-CfpOdLVf.js.map +1 -0
- package/dist/testing.js +3 -3
- package/dist/types/browser/src/shared/features.d.ts +5 -0
- package/dist/types/browser/src/shared/mints.d.ts +6 -0
- package/dist/types/core/src/chatFiles.d.ts +18 -1
- package/dist/types/core/src/dhtDelivery.d.ts +51 -0
- package/dist/types/core/src/domainProofs.d.ts +3 -2
- package/dist/types/core/src/engineErrors.d.ts +5 -1
- package/dist/types/core/src/ghostlink.d.ts +24 -5
- package/dist/types/core/src/groupCommunity.d.ts +42 -4
- package/dist/types/core/src/groupSession.d.ts +6 -2
- package/dist/types/core/src/identityProofs.d.ts +1 -0
- package/dist/types/core/src/identityTimeline.d.ts +1 -1
- package/dist/types/core/src/image.d.ts +2 -1
- package/dist/types/core/src/index.d.ts +1 -0
- package/dist/types/core/src/link.d.ts +13 -0
- package/dist/types/core/src/linkPreview.d.ts +8 -4
- package/dist/types/core/src/pairedApps.d.ts +10 -5
- package/dist/types/core/src/ratchet.d.ts +201 -0
- package/dist/types/core/src/relay.d.ts +28 -2
- package/dist/types/core/src/storeForward.d.ts +32 -11
- package/dist/{verify-chCUPRKH.js → verify-C-u4HILn.js} +2 -2
- package/dist/{verify-chCUPRKH.js.map → verify-C-u4HILn.js.map} +1 -1
- package/package.json +1 -1
- package/dist/fakes-NFHnJNv8.js.map +0 -1
- package/dist/src-Dw-9Vq6U.js.map +0 -1
|
@@ -998,6 +998,64 @@ var firstWriter = (who) => !who.write || who.background ? null : who.group ? "gr
|
|
|
998
998
|
/** A key's turn neither asked nor read in the last minute: it is dropped, and asking again starts a new one (`TURNS_PRUNE_MS`). */
|
|
999
999
|
var staleTurn = (turn, now) => now - Math.max(turn.askedAt, turn.servedAt) >= 6e4;
|
|
1000
1000
|
/**
|
|
1001
|
+
* Keys and when each was last set, those of the last minute: how many and the latest, without walking them all (the
|
|
1002
|
+
* chats that need a relay, `chatNeeds`). Each is set at the time it is set, so the sets come oldest first; a clock
|
|
1003
|
+
* gone back makes the later ones as of now.
|
|
1004
|
+
*/
|
|
1005
|
+
var RecentKeys = class {
|
|
1006
|
+
at = /* @__PURE__ */ new Map();
|
|
1007
|
+
/** Every set, oldest first, from `head`; one a later set or a delete replaced is skipped. */
|
|
1008
|
+
order = [];
|
|
1009
|
+
head = 0;
|
|
1010
|
+
set(key, now) {
|
|
1011
|
+
this.prune(now);
|
|
1012
|
+
this.at.set(key, now);
|
|
1013
|
+
this.order.push([key, now]);
|
|
1014
|
+
}
|
|
1015
|
+
delete(key) {
|
|
1016
|
+
this.at.delete(key);
|
|
1017
|
+
}
|
|
1018
|
+
size(now) {
|
|
1019
|
+
this.prune(now);
|
|
1020
|
+
return this.at.size;
|
|
1021
|
+
}
|
|
1022
|
+
/** When the key set last was, -Infinity with none in the last minute. */
|
|
1023
|
+
latest(now) {
|
|
1024
|
+
this.prune(now);
|
|
1025
|
+
while (this.order.length > this.head) {
|
|
1026
|
+
const [key, at] = this.order[this.order.length - 1];
|
|
1027
|
+
if (this.at.get(key) === at) return at;
|
|
1028
|
+
this.order.pop();
|
|
1029
|
+
}
|
|
1030
|
+
return -Infinity;
|
|
1031
|
+
}
|
|
1032
|
+
/** The keys set in the last minute, oldest first. */
|
|
1033
|
+
*entries(now) {
|
|
1034
|
+
this.prune(now);
|
|
1035
|
+
for (let i = this.head; i < this.order.length; i++) if (this.at.get(this.order[i][0]) === this.order[i][1]) yield this.order[i];
|
|
1036
|
+
}
|
|
1037
|
+
/** Drops the keys set a minute ago or more. */
|
|
1038
|
+
prune(now) {
|
|
1039
|
+
if (this.order.length > this.head && now < this.order[this.order.length - 1][1]) {
|
|
1040
|
+
for (const [key, at] of this.at) this.at.set(key, Math.min(at, now));
|
|
1041
|
+
this.order = [...this.at].sort((a, b) => a[1] - b[1]);
|
|
1042
|
+
this.head = 0;
|
|
1043
|
+
}
|
|
1044
|
+
while (this.head < this.order.length) {
|
|
1045
|
+
const [key, at] = this.order[this.head];
|
|
1046
|
+
if (this.at.get(key) === at) {
|
|
1047
|
+
if (now - at < 6e4) break;
|
|
1048
|
+
this.at.delete(key);
|
|
1049
|
+
}
|
|
1050
|
+
this.head++;
|
|
1051
|
+
}
|
|
1052
|
+
if (this.head > 64 && this.head * 2 > this.order.length) {
|
|
1053
|
+
this.order = this.order.slice(this.head);
|
|
1054
|
+
this.head = 0;
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
};
|
|
1058
|
+
/**
|
|
1001
1059
|
* Public Pkarr relays. They are generic Pkarr infrastructure (an HTTP bridge to
|
|
1002
1060
|
* the Mainline DHT), not a Ghostly backend: they only ever see signed,
|
|
1003
1061
|
* encrypted packets. Every client uses this list: the browser clients read and
|
|
@@ -1033,6 +1091,14 @@ var REQUESTS_PER_MINUTE = 30;
|
|
|
1033
1091
|
*/
|
|
1034
1092
|
var BACKGROUND_REQUESTS_PER_MINUTE = 20;
|
|
1035
1093
|
/**
|
|
1094
|
+
* Of the background share, what background writes may spend in a minute on a relay (10 of the 20): the rest is kept
|
|
1095
|
+
* for background reads. Those writes are mostly the upkeep of chats whose contacts are away (the link's heartbeat, the
|
|
1096
|
+
* DHT floor's keep-alive, the capability record), about one a minute for every two chats. A profile with 200 such chats
|
|
1097
|
+
* spent the share on them, and on one relay 147 of its 200 contacts were not read once in 25 minutes: a contact back
|
|
1098
|
+
* then went unnoticed (bug hunt, 2026-11-01). Upkeep held back goes when a request of this share frees.
|
|
1099
|
+
*/
|
|
1100
|
+
var BACKGROUND_WRITES_SHARE = 1 / 2;
|
|
1101
|
+
/**
|
|
1036
1102
|
* A link's write the budget refused (its presence, its offer, its answer) goes first when the minute
|
|
1037
1103
|
* frees a request: reads on that relay wait this long after the refusal. A link that polls fast for a
|
|
1038
1104
|
* peer while its offer waits would otherwise take every request the minute frees, and the offer (the
|
|
@@ -1306,6 +1372,15 @@ function normalizeRelayUrl(input) {
|
|
|
1306
1372
|
return null;
|
|
1307
1373
|
}
|
|
1308
1374
|
}
|
|
1375
|
+
/**
|
|
1376
|
+
* Why a line of a Pkarr relay list is not a relay `normalizeRelayUrl` keeps, with the line as typed; null when it is
|
|
1377
|
+
* one. A host alone or another scheme (`relay.example.org`, `wss://…`) was meant as an https:// relay.
|
|
1378
|
+
*/
|
|
1379
|
+
function relayUrlProblem(input) {
|
|
1380
|
+
const line = input.trim();
|
|
1381
|
+
if (normalizeRelayUrl(line)) return null;
|
|
1382
|
+
return /^(?:[a-z][a-z\d+.-]*:\/\/)?[^\s/:]+\.[^\s]+$/i.test(line) ? `Use an https:// relay address: ${line}` : `Not a relay address: ${line}`;
|
|
1383
|
+
}
|
|
1309
1384
|
/** A relay the breaker leaves alone for failing (`RelayBreaker`): nothing was asked of it now. */
|
|
1310
1385
|
var RelayLeftAloneError = class extends Error {};
|
|
1311
1386
|
/**
|
|
@@ -1348,6 +1423,8 @@ var RelayTransport = class {
|
|
|
1348
1423
|
lastReadFrom = /* @__PURE__ */ new Map();
|
|
1349
1424
|
spent = /* @__PURE__ */ new Map();
|
|
1350
1425
|
spentBackground = /* @__PURE__ */ new Map();
|
|
1426
|
+
/** Background writes on each relay in the last minute (`BACKGROUND_WRITES_SHARE`). */
|
|
1427
|
+
spentBackgroundWrites = /* @__PURE__ */ new Map();
|
|
1351
1428
|
/** Groups' urgent reads on each relay in the last `GROUP_BURST_MS`. */
|
|
1352
1429
|
spentGroupUrgent = /* @__PURE__ */ new Map();
|
|
1353
1430
|
/** Watch reads on each relay in the last `GROUP_RATION_WINDOW_MS` (`WATCH_SHARE`). */
|
|
@@ -1381,9 +1458,11 @@ var RelayTransport = class {
|
|
|
1381
1458
|
/**
|
|
1382
1459
|
* Per key a 1:1 chat asks for: when it last read urgently (for the next minute, groups leave it `CHAT_RESERVE` on
|
|
1383
1460
|
* every relay) and when the budget last refused it on each relay (the same, on that relay). A read of the key at a
|
|
1384
|
-
* slow pace (the chat is live, or back in the background) drops it: `CHAT_RESERVE`.
|
|
1461
|
+
* slow pace (the chat is live, or back in the background) drops it: `CHAT_RESERVE`. Per relay, the later of the two
|
|
1462
|
+
* for each key (`chatNeed`); `chatUrgentAt` keeps the urgent ones for a relay not asked yet.
|
|
1385
1463
|
*/
|
|
1386
1464
|
chatNeeds = /* @__PURE__ */ new Map();
|
|
1465
|
+
chatUrgentAt = new RecentKeys();
|
|
1387
1466
|
/** When a link (a chat's or a group's) last asked urgently: background requests yield for `SIGNALING_WINDOW_MS`. */
|
|
1388
1467
|
urgentAt = -Infinity;
|
|
1389
1468
|
/** Timestamp of the last packet sent to each relay, per key: the compare-and-swap value for the next one. */
|
|
@@ -1424,16 +1503,16 @@ var RelayTransport = class {
|
|
|
1424
1503
|
this.perMinuteGiven = options.requestsPerMinute !== void 0;
|
|
1425
1504
|
this.backgroundPerMinute = this.perMinute === 30 ? 20 : Math.ceil(this.perMinute * 2 / 3);
|
|
1426
1505
|
this.backgroundWhileSignaling = this.perMinute === 30 ? 5 : Math.ceil(this.perMinute / 6);
|
|
1427
|
-
const log = options.log ?? ((line) => console.info(`
|
|
1506
|
+
const log = options.log ?? ((line) => console.info(`ghostly: ${line}`));
|
|
1428
1507
|
this.breaker = new RelayBreaker({
|
|
1429
1508
|
...options.breaker,
|
|
1430
1509
|
onTrip: (relay, reason, forMs) => {
|
|
1431
|
-
log(
|
|
1510
|
+
log(`relay ${new URL(relay).host} ${reason === "no answer" ? "did not answer" : reason === "slow" ? "answered too slowly" : `failed (${reason})`}; asked again in ${Math.round(forMs / 1e3)} s`);
|
|
1432
1511
|
options.breaker?.onTrip?.(relay, reason, forMs);
|
|
1433
1512
|
this.changed("tripped");
|
|
1434
1513
|
},
|
|
1435
1514
|
onRecover: (relay) => {
|
|
1436
|
-
log(
|
|
1515
|
+
log(`relay ${new URL(relay).host} answers again`);
|
|
1437
1516
|
options.breaker?.onRecover?.(relay);
|
|
1438
1517
|
this.changed("recovered");
|
|
1439
1518
|
}
|
|
@@ -1790,7 +1869,7 @@ var RelayTransport = class {
|
|
|
1790
1869
|
*/
|
|
1791
1870
|
async resolve(pubKeyZ32, options = {}, keptOnFailure = true) {
|
|
1792
1871
|
if (this.relays.length === 0) throw new Error("No Pkarr relays configured");
|
|
1793
|
-
if (options.background && !options.urgent && !options.group) this.
|
|
1872
|
+
if (options.background && !options.urgent && !options.group) this.chatNeedLapsed(pubKeyZ32);
|
|
1794
1873
|
const readAt = this.readAt.get(pubKeyZ32);
|
|
1795
1874
|
if (readAt !== void 0 && Date.now() - readAt < this.freshReadMs) return this.newest.get(pubKeyZ32) ?? null;
|
|
1796
1875
|
const order = this.readOrder(pubKeyZ32);
|
|
@@ -2117,13 +2196,13 @@ var RelayTransport = class {
|
|
|
2117
2196
|
let response;
|
|
2118
2197
|
try {
|
|
2119
2198
|
response = await request;
|
|
2120
|
-
} catch
|
|
2199
|
+
} catch {
|
|
2121
2200
|
this.networkCooldown.set(`PUT ${relay}`, Date.now() + NETWORK_ERROR_COOLDOWN_MS);
|
|
2122
2201
|
this.answered(relay, {
|
|
2123
2202
|
kind: "error",
|
|
2124
2203
|
reason: "no answer"
|
|
2125
2204
|
});
|
|
2126
|
-
throw
|
|
2205
|
+
throw new Error(`${relay} did not answer`);
|
|
2127
2206
|
}
|
|
2128
2207
|
if (response.status === 429) this.answered(relay, {
|
|
2129
2208
|
kind: "throttled",
|
|
@@ -2146,13 +2225,13 @@ var RelayTransport = class {
|
|
|
2146
2225
|
const writer = firstWriter(who);
|
|
2147
2226
|
if (who.urgent && !who.background) {
|
|
2148
2227
|
this.urgentAt = now;
|
|
2149
|
-
if (isChat(who)) this.chatNeed(key
|
|
2228
|
+
if (isChat(who)) this.chatNeed(key, now);
|
|
2150
2229
|
}
|
|
2151
2230
|
if (isGroupRead(who) || isChatWatch(who)) this.readAsked(key, who, now);
|
|
2152
2231
|
if (isTurnRead(who)) this.turnAsked(key, who, now);
|
|
2153
2232
|
if (this.heldFor(relay, who, now, key) > 0) {
|
|
2154
2233
|
if (isGroupRead(who) && (this.spent.get(relay)?.length ?? 0) >= this.limitOf(relay)) this.groupsFullAt.set(relay, now);
|
|
2155
|
-
if (isChat(who)) this.chatNeed(key
|
|
2234
|
+
if (isChat(who)) this.chatNeed(key, now, relay);
|
|
2156
2235
|
if (writer) this.writeWaiting.set(`${writer} ${relay}`, now);
|
|
2157
2236
|
return false;
|
|
2158
2237
|
}
|
|
@@ -2177,6 +2256,7 @@ var RelayTransport = class {
|
|
|
2177
2256
|
if (departedOver) this.departedOverAdd(key, now);
|
|
2178
2257
|
this.spent.get(relay).push(now);
|
|
2179
2258
|
if (who.background) this.spentBackground.get(relay).push(now);
|
|
2259
|
+
if (who.background && who.write) this.spentBackgroundWrites.get(relay).push(now);
|
|
2180
2260
|
if (isGroupUrgentRead(who)) this.spentGroupUrgent.get(relay).push(now);
|
|
2181
2261
|
if (isWatch(who)) this.spentWatch.get(relay).push(now);
|
|
2182
2262
|
if (isChatWatch(who) && !departedOver) this.spentChatWatch.get(relay).push(now);
|
|
@@ -2210,6 +2290,8 @@ var RelayTransport = class {
|
|
|
2210
2290
|
const recentBackground = (this.spentBackground.get(relay) ?? []).filter((at) => now - at < 6e4);
|
|
2211
2291
|
this.spent.set(relay, recent);
|
|
2212
2292
|
this.spentBackground.set(relay, recentBackground);
|
|
2293
|
+
const recentBackgroundWrites = (this.spentBackgroundWrites.get(relay) ?? []).filter((at) => now - at < 6e4);
|
|
2294
|
+
this.spentBackgroundWrites.set(relay, recentBackgroundWrites);
|
|
2213
2295
|
const over = (list, limit) => list.length >= limit ? list[list.length - limit] + 6e4 - now : 0;
|
|
2214
2296
|
const limit = this.limitOf(relay);
|
|
2215
2297
|
const departed = isDepartedRead(who) && key !== void 0 && recent.length >= limit && this.departedReads(key, now) < 6;
|
|
@@ -2224,7 +2306,9 @@ var RelayTransport = class {
|
|
|
2224
2306
|
this.spentGroupOver.set(relay, groupOver);
|
|
2225
2307
|
if (isGroupSignal(who) && !who.write && recent.length >= limit && groupOver.length > 0) wait = Math.max(wait, groupOver[groupOver.length - 1] + GROUP_OVER_PACE_MS - now);
|
|
2226
2308
|
if (who.background && !starved) {
|
|
2227
|
-
|
|
2309
|
+
const backgroundShare = Math.min(this.backgroundPerMinute, Math.ceil(limit * 2 / 3));
|
|
2310
|
+
wait = Math.max(wait, over(recentBackground, backgroundShare));
|
|
2311
|
+
if (who.write) wait = Math.max(wait, over(recentBackgroundWrites, Math.max(1, Math.floor(backgroundShare * BACKGROUND_WRITES_SHARE))));
|
|
2228
2312
|
const signaling = this.urgentAt + SIGNALING_WINDOW_MS - now;
|
|
2229
2313
|
if (signaling > 0 && !who.door) wait = Math.max(wait, Math.min(signaling, over(recentBackground, Math.min(this.backgroundWhileSignaling, Math.ceil(limit / 6)))));
|
|
2230
2314
|
}
|
|
@@ -2357,25 +2441,36 @@ var RelayTransport = class {
|
|
|
2357
2441
|
for (const [other, reads] of this.departedOver) if (now - reads[reads.length - 1] >= 6e4) this.departedOver.delete(other);
|
|
2358
2442
|
this.departedOver.set(key, [...this.departedOver.get(key) ?? [], now]);
|
|
2359
2443
|
}
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
if (
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
}
|
|
2366
|
-
|
|
2444
|
+
/** A chat's request of `key` asked urgently (it needs every relay), or the budget refused it on `relay` (it needs that one). */
|
|
2445
|
+
chatNeed(key, now, relay) {
|
|
2446
|
+
if (relay !== void 0) {
|
|
2447
|
+
this.chatNeedsOn(relay, now).set(key, now);
|
|
2448
|
+
return;
|
|
2449
|
+
}
|
|
2450
|
+
this.chatUrgentAt.set(key, now);
|
|
2451
|
+
for (const needs of this.chatNeeds.values()) needs.set(key, now);
|
|
2367
2452
|
}
|
|
2368
|
-
/**
|
|
2369
|
-
|
|
2370
|
-
let
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
continue;
|
|
2375
|
-
}
|
|
2376
|
-
until = Math.max(until, need.urgentAt, need.refused.get(relay) ?? -Infinity);
|
|
2453
|
+
/** The chats that need this relay: those a request of was refused there, and the urgent ones. */
|
|
2454
|
+
chatNeedsOn(relay, now) {
|
|
2455
|
+
let needs = this.chatNeeds.get(relay);
|
|
2456
|
+
if (!needs) {
|
|
2457
|
+
this.chatNeeds.set(relay, needs = new RecentKeys());
|
|
2458
|
+
for (const [key, at] of this.chatUrgentAt.entries(now)) needs.set(key, at);
|
|
2377
2459
|
}
|
|
2378
|
-
return
|
|
2460
|
+
return needs;
|
|
2461
|
+
}
|
|
2462
|
+
/** The chat reading `key` has nothing due: it needs no relay any more. */
|
|
2463
|
+
chatNeedLapsed(key) {
|
|
2464
|
+
this.chatUrgentAt.delete(key);
|
|
2465
|
+
for (const needs of this.chatNeeds.values()) needs.delete(key);
|
|
2466
|
+
}
|
|
2467
|
+
/**
|
|
2468
|
+
* How long groups still leave a chat its reserve on this relay (`CHAT_RESERVE`); a chat's need a minute old goes.
|
|
2469
|
+
* Kept up to date as needs come and go (`RecentKeys`): walking them all for each request cost a daemon with 500
|
|
2470
|
+
* contacts away 2.7 s of CPU per 10 idle minutes (bug hunt, 2026-11-01).
|
|
2471
|
+
*/
|
|
2472
|
+
chatReservedFor(relay, now) {
|
|
2473
|
+
return this.chatNeedsOn(relay, now).latest(now) + 6e4 - now;
|
|
2379
2474
|
}
|
|
2380
2475
|
/**
|
|
2381
2476
|
* How long a chat's packet another relay already took waits for this one: while chats need the relays, a copy takes
|
|
@@ -2396,8 +2491,7 @@ var RelayTransport = class {
|
|
|
2396
2491
|
}
|
|
2397
2492
|
/** What the chats that need the relays keep on this relay (`CHAT_RESERVE_PER_CHAT`), never less than `reserveOf`. */
|
|
2398
2493
|
chatReserveOf(relay, now) {
|
|
2399
|
-
|
|
2400
|
-
for (const need of this.chatNeeds.values()) if (now - Math.max(need.urgentAt, need.refused.get(relay) ?? -Infinity) < 6e4) needing++;
|
|
2494
|
+
const needing = this.chatNeedsOn(relay, now).size(now);
|
|
2401
2495
|
return Math.max(this.reserveOf(relay), Math.min(needing * 3, Math.floor(this.limitOf(relay) * CHAT_RESERVE_MOST_SHARE)));
|
|
2402
2496
|
}
|
|
2403
2497
|
/** What groups leave a chat on this relay: `CHAT_RESERVE`, or a third of a smaller budget. */
|
|
@@ -2745,13 +2839,13 @@ function turnName(name) {
|
|
|
2745
2839
|
}
|
|
2746
2840
|
return hasVisible(out) ? out.trimEnd() : "";
|
|
2747
2841
|
}
|
|
2748
|
-
function u32$
|
|
2842
|
+
function u32$4(value) {
|
|
2749
2843
|
return Uint8Array.of(value >>> 24 & 255, value >>> 16 & 255, value >>> 8 & 255, value & 255);
|
|
2750
2844
|
}
|
|
2751
2845
|
/** What a release signs: `"ghostly-turn-release" || turnAddress(32) || turn(4) || toKey(32) || H(32)`. */
|
|
2752
2846
|
function turnReleaseMessage(address, turn, toKey, h) {
|
|
2753
2847
|
if (address.length !== 32 || toKey.length !== 32 || h.length !== 32) throw new Error("A release names 32-byte values");
|
|
2754
|
-
return concatBytes(RELEASE_DOMAIN, address, u32$
|
|
2848
|
+
return concatBytes(RELEASE_DOMAIN, address, u32$4(turn), toKey, h);
|
|
2755
2849
|
}
|
|
2756
2850
|
/** What the author signs: `"ghostly-turn" || turnAddress(32) || body[0..310]`. */
|
|
2757
2851
|
function turnSignedMessage(address, unsigned) {
|
|
@@ -2769,8 +2863,8 @@ function encodeTurnFields(fields) {
|
|
|
2769
2863
|
if (tombstone ? fields.active !== 255 : !held(fields.active)) throw new Error(tombstone ? "A tombstone names no active device" : "The active device has no slot");
|
|
2770
2864
|
const body = /* @__PURE__ */ new Uint8Array(310);
|
|
2771
2865
|
body[OFFSET.version] = 1;
|
|
2772
|
-
body.set(u32$
|
|
2773
|
-
body.set(u32$
|
|
2866
|
+
body.set(u32$4(fields.turn), OFFSET.turn);
|
|
2867
|
+
body.set(u32$4(fields.rev).subarray(1), OFFSET.rev);
|
|
2774
2868
|
body[OFFSET.author] = fields.author;
|
|
2775
2869
|
body[OFFSET.active] = fields.active;
|
|
2776
2870
|
body[OFFSET.count] = fields.slots.filter(Boolean).length;
|
|
@@ -3035,7 +3129,7 @@ var TURN_RAISE_READ_TIMEOUT_MS = 5e3;
|
|
|
3035
3129
|
var TURN_VISIBLE_MS = 1e4;
|
|
3036
3130
|
/** `T`: how long a device that raised the turn waits, from the end of its put, before the read that may make it active. `T >= P + 2V`. */
|
|
3037
3131
|
var TURN_SETTLE_MS = 3e4;
|
|
3038
|
-
function compareBytes$
|
|
3132
|
+
function compareBytes$4(a, b) {
|
|
3039
3133
|
for (let i = 0; i < Math.min(a.length, b.length); i++) if (a[i] !== b[i]) return a[i] - b[i];
|
|
3040
3134
|
return a.length - b.length;
|
|
3041
3135
|
}
|
|
@@ -3046,7 +3140,7 @@ function compareBytes$3(a, b) {
|
|
|
3046
3140
|
* reader still agrees.
|
|
3047
3141
|
*/
|
|
3048
3142
|
function keptAtEqualSequence(a, b) {
|
|
3049
|
-
return compareBytes$
|
|
3143
|
+
return compareBytes$4(a.record.instance, b.record.instance) || compareBytes$4(a.record.body, b.record.body) || compareBytes$4(a.payload, b.payload);
|
|
3050
3144
|
}
|
|
3051
3145
|
var kept = (f) => ({
|
|
3052
3146
|
record: f.read.record,
|
|
@@ -4138,14 +4232,38 @@ function webpSize(b) {
|
|
|
4138
4232
|
if (ascii(b, 12, "VP8X")) return sized(u24le(b, 24) + 1, u24le(b, 27) + 1);
|
|
4139
4233
|
}
|
|
4140
4234
|
/**
|
|
4235
|
+
* A GIF's size as it is decoded: its logical screen, or as far as its first frame reaches past it (a browser decodes
|
|
4236
|
+
* the first frame whole, at its own size, however small the screen says it is). Undefined when its first frame is not
|
|
4237
|
+
* in these bytes: what it would be drawn at is not known.
|
|
4238
|
+
*/
|
|
4239
|
+
function gifSize(b) {
|
|
4240
|
+
if (b.length < 13) return void 0;
|
|
4241
|
+
const screenWidth = u16le(b, 6), screenHeight = u16le(b, 8);
|
|
4242
|
+
let at = 13 + (b[10] & 128 ? 3 * (2 << (b[10] & 7)) : 0);
|
|
4243
|
+
while (at < b.length) {
|
|
4244
|
+
const block = b[at];
|
|
4245
|
+
if (block === 44) {
|
|
4246
|
+
if (at + 9 > b.length) return void 0;
|
|
4247
|
+
const left = u16le(b, at + 1), top = u16le(b, at + 3), width = u16le(b, at + 5), height = u16le(b, at + 7);
|
|
4248
|
+
return sized(Math.max(screenWidth, left + width), Math.max(screenHeight, top + height));
|
|
4249
|
+
}
|
|
4250
|
+
if (block === 59) return sized(screenWidth, screenHeight);
|
|
4251
|
+
if (block !== 33 || at + 2 > b.length) return void 0;
|
|
4252
|
+
at += 2;
|
|
4253
|
+
while (at < b.length && b[at] !== 0) at += 1 + b[at];
|
|
4254
|
+
at++;
|
|
4255
|
+
}
|
|
4256
|
+
}
|
|
4257
|
+
/**
|
|
4141
4258
|
* A picture's size as it is shown, read from its first bytes (PNG, JPEG, GIF, WebP), or undefined when they do not
|
|
4142
|
-
* say. Only the header is read: a JPEG whose frame header
|
|
4259
|
+
* say. Only the header is read: a JPEG whose frame header, or a GIF whose first frame, sits past
|
|
4260
|
+
* `IMAGE_LIMITS.headBytes` goes without.
|
|
4143
4261
|
*/
|
|
4144
4262
|
function imageSize(head) {
|
|
4145
4263
|
const b = head;
|
|
4146
4264
|
try {
|
|
4147
4265
|
if (b.length >= 24 && b[0] === 137 && ascii(b, 1, "PNG\r\n\n") && ascii(b, 12, "IHDR")) return sized(u32be(b, 16), u32be(b, 20));
|
|
4148
|
-
if (b.length >= 10 && (ascii(b, 0, "GIF87a") || ascii(b, 0, "GIF89a"))) return
|
|
4266
|
+
if (b.length >= 10 && (ascii(b, 0, "GIF87a") || ascii(b, 0, "GIF89a"))) return gifSize(b);
|
|
4149
4267
|
if (b.length >= 4 && b[0] === 255 && b[1] === 216 && b[2] === 255) return jpegSize(b);
|
|
4150
4268
|
if (b.length >= 16 && ascii(b, 0, "RIFF") && ascii(b, 8, "WEBP")) return webpSize(b);
|
|
4151
4269
|
} catch {}
|
|
@@ -4618,7 +4736,7 @@ function isAppUrl(value) {
|
|
|
4618
4736
|
return false;
|
|
4619
4737
|
}
|
|
4620
4738
|
if (url.protocol !== "https:" || url.username || url.password || !url.hostname) return false;
|
|
4621
|
-
const host = url.hostname.toLowerCase();
|
|
4739
|
+
const host = url.hostname.toLowerCase().replace(/\.+$/, "");
|
|
4622
4740
|
if (host === "jsdelivr.net" || host.endsWith(".jsdelivr.net")) return host === "cdn.jsdelivr.net" && /^\/gh\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+@[0-9a-f]{40}\/./.test(url.pathname);
|
|
4623
4741
|
return true;
|
|
4624
4742
|
}
|
|
@@ -4810,7 +4928,7 @@ function checkAppManifest(value, options = {}) {
|
|
|
4810
4928
|
function appDigest(manifestBytes) {
|
|
4811
4929
|
return toBase64Url(sha256(manifestBytes));
|
|
4812
4930
|
}
|
|
4813
|
-
var u32$
|
|
4931
|
+
var u32$3 = (b, at) => (b[at] << 24 >>> 0) + (b[at + 1] << 16) + (b[at + 2] << 8) + b[at + 3];
|
|
4814
4932
|
/**
|
|
4815
4933
|
* Lets the thread go for one turn: what waits (input, drawing, timers, port messages, IndexedDB answers) runs, then the
|
|
4816
4934
|
* caller goes on. A message to itself, queued behind the page's other tasks. Never `scheduler.yield()`: in Chromium its
|
|
@@ -4886,7 +5004,7 @@ function readAppBundleHead(bytes) {
|
|
|
4886
5004
|
ok: false,
|
|
4887
5005
|
reason: "truncated"
|
|
4888
5006
|
};
|
|
4889
|
-
const manifestLength = u32$
|
|
5007
|
+
const manifestLength = u32$3(bytes, at);
|
|
4890
5008
|
at += 4;
|
|
4891
5009
|
if (manifestLength > APP_BUNDLE_LIMITS.manifestBytes) return {
|
|
4892
5010
|
ok: false,
|
|
@@ -4898,7 +5016,7 @@ function readAppBundleHead(bytes) {
|
|
|
4898
5016
|
};
|
|
4899
5017
|
const manifestBytes = bytes.subarray(at, at + manifestLength);
|
|
4900
5018
|
at += manifestLength;
|
|
4901
|
-
const statementLength = u32$
|
|
5019
|
+
const statementLength = u32$3(bytes, at);
|
|
4902
5020
|
at += 4;
|
|
4903
5021
|
if (bytes.length < at + statementLength) return {
|
|
4904
5022
|
ok: false,
|
|
@@ -5090,9 +5208,9 @@ var ContactRequestError = class extends Error {
|
|
|
5090
5208
|
this.name = "ContactRequestError";
|
|
5091
5209
|
}
|
|
5092
5210
|
};
|
|
5093
|
-
var label = (text) => utf8Encode(text);
|
|
5211
|
+
var label$1 = (text) => utf8Encode(text);
|
|
5094
5212
|
function derive(linkKeyZ32, info) {
|
|
5095
|
-
return hkdf(sha256, publicKeyFromZ32(linkKeyZ32), label("ghostly-contact/1"), label(info), 32);
|
|
5213
|
+
return hkdf(sha256, publicKeyFromZ32(linkKeyZ32), label$1("ghostly-contact/1"), label$1(info), 32);
|
|
5096
5214
|
}
|
|
5097
5215
|
/** The UTC day number of a time: a stamp is made for one. */
|
|
5098
5216
|
function contactDay(ms) {
|
|
@@ -5100,7 +5218,7 @@ function contactDay(ms) {
|
|
|
5100
5218
|
}
|
|
5101
5219
|
/** The `seen` entry of an asker key on a link: the first 9 bytes of a hash, so the record names nobody. */
|
|
5102
5220
|
function seenEntry(linkKeyZ32, askerZ32) {
|
|
5103
|
-
return toBase64Url(sha256(concatBytes(label("ghostly-contact/1 seen"), publicKeyFromZ32(linkKeyZ32), publicKeyFromZ32(askerZ32))).slice(0, 9));
|
|
5221
|
+
return toBase64Url(sha256(concatBytes(label$1("ghostly-contact/1 seen"), publicKeyFromZ32(linkKeyZ32), publicKeyFromZ32(askerZ32))).slice(0, 9));
|
|
5104
5222
|
}
|
|
5105
5223
|
function linkRecords(record) {
|
|
5106
5224
|
if (!Number.isInteger(record.bits) || record.bits < 16 || record.bits > 24) throw new Error("A link asks for 16 to 24 bits");
|
|
@@ -5138,7 +5256,7 @@ function readLinkRecord(records) {
|
|
|
5138
5256
|
function stampPrefix(linkKeyZ32, askerZ32, day) {
|
|
5139
5257
|
const tail = /* @__PURE__ */ new Uint8Array(4);
|
|
5140
5258
|
new DataView(tail.buffer).setUint32(0, day);
|
|
5141
|
-
return concatBytes(label("ghostly-contact/1 stamp"), publicKeyFromZ32(linkKeyZ32), publicKeyFromZ32(askerZ32), tail);
|
|
5259
|
+
return concatBytes(label$1("ghostly-contact/1 stamp"), publicKeyFromZ32(linkKeyZ32), publicKeyFromZ32(askerZ32), tail);
|
|
5142
5260
|
}
|
|
5143
5261
|
function leadingZeroBits(hash) {
|
|
5144
5262
|
let bits = 0;
|
|
@@ -5200,7 +5318,7 @@ function knockSlotOf(linkKeyZ32, askerZ32) {
|
|
|
5200
5318
|
}
|
|
5201
5319
|
function knockSlotRecords(linkKeyZ32, knocks) {
|
|
5202
5320
|
const nonce = randomBytes(NONCE_LENGTH$3);
|
|
5203
|
-
const body = label(JSON.stringify(knocks.slice(-6).map((k) => [
|
|
5321
|
+
const body = label$1(JSON.stringify(knocks.slice(-6).map((k) => [
|
|
5204
5322
|
k.key,
|
|
5205
5323
|
k.day,
|
|
5206
5324
|
k.stamp
|
|
@@ -5235,9 +5353,9 @@ function mergeContactKnocks(existing, mine, now) {
|
|
|
5235
5353
|
return [...existing.filter((k) => k.key !== mine.key && k.day >= today - 1 && k.day <= today + 1).slice(-5), mine];
|
|
5236
5354
|
}
|
|
5237
5355
|
function requestKey(linkKeyZ32, askerZ32, shared) {
|
|
5238
|
-
return hkdf(sha256, shared, label("ghostly-contact/1 request"), concatBytes(publicKeyFromZ32(linkKeyZ32), publicKeyFromZ32(askerZ32)), 32);
|
|
5356
|
+
return hkdf(sha256, shared, label$1("ghostly-contact/1 request"), concatBytes(publicKeyFromZ32(linkKeyZ32), publicKeyFromZ32(askerZ32)), 32);
|
|
5239
5357
|
}
|
|
5240
|
-
var REQUEST_AAD = label("ghostly-contact/1 request");
|
|
5358
|
+
var REQUEST_AAD = label$1("ghostly-contact/1 request");
|
|
5241
5359
|
/** The value of a request's record for a plaintext of `length` bytes. */
|
|
5242
5360
|
var sealedValueLength = (length) => Math.ceil((NONCE_LENGTH$3 + length + TAG_LENGTH) * 4 / 3);
|
|
5243
5361
|
var plaintextBytes;
|
|
@@ -5275,7 +5393,7 @@ function requestRecords(askerSeedB64, linkKeyZ32, request) {
|
|
|
5275
5393
|
if (!inviteHolds(request.invite)) throw new ContactRequestError("invite");
|
|
5276
5394
|
if (!Number.isSafeInteger(request.issued) || !Number.isSafeInteger(request.expires) || request.expires <= request.issued || request.expires - request.issued > 6048e5) throw new ContactRequestError("dates");
|
|
5277
5395
|
const asker = identityFromSeedB64(askerSeedB64);
|
|
5278
|
-
const json = label(JSON.stringify([
|
|
5396
|
+
const json = label$1(JSON.stringify([
|
|
5279
5397
|
1,
|
|
5280
5398
|
request.invite,
|
|
5281
5399
|
request.name,
|
|
@@ -8342,6 +8460,13 @@ var UNUSED_INVITE_WAIT_MAX_MS = 18e4;
|
|
|
8342
8460
|
* hunt 1014-0136, 2026-10-14).
|
|
8343
8461
|
*/
|
|
8344
8462
|
var UNUSED_INVITE_READS_PER_MINUTE = 10;
|
|
8463
|
+
/**
|
|
8464
|
+
* An invite this side made that nobody used, once no longer awaited, puts its key and its mailbox out this often, not
|
|
8465
|
+
* every `PRESENCE_HEARTBEAT`: 20 of them added about 17 relay writes a minute for as long as the app ran (bug hunt,
|
|
8466
|
+
* 2026-10-30). Not longer: a joiner goes live sooner while it finds both still good, the packet within `PRESENCE_WINDOW`
|
|
8467
|
+
* and the envelope unexpired. At 30 minutes the slowest of 6 joins took 235 s, against 86 s of 9 at the heartbeat's pace.
|
|
8468
|
+
*/
|
|
8469
|
+
var UNUSED_INVITE_UPKEEP_MS = 48e4;
|
|
8345
8470
|
/** The keys and mailboxes of unused invites read slowly over each transport (an app's relays). */
|
|
8346
8471
|
var unusedInviteReaders = /* @__PURE__ */ new WeakMap();
|
|
8347
8472
|
/** Counts `reader` (an invite's key or mailbox) among the unused ones read over `transport` while `unused`, or no longer: how many there are. */
|
|
@@ -8438,6 +8563,8 @@ var LinkSession = class {
|
|
|
8438
8563
|
awaitingSince;
|
|
8439
8564
|
/** This side's invite, nobody used yet (`LinkSessionOptions.invite`). */
|
|
8440
8565
|
invite;
|
|
8566
|
+
/** This side's own invite, nobody used yet (`LinkSessionOptions.ownInvite`). */
|
|
8567
|
+
ownInvite;
|
|
8441
8568
|
intervals;
|
|
8442
8569
|
fastPollUntil = 0;
|
|
8443
8570
|
/** An offer to a saved contact is out: from then on its fast window looks less often (`OFFER_FAST_MS`); 0 for none. */
|
|
@@ -8506,6 +8633,7 @@ var LinkSession = class {
|
|
|
8506
8633
|
this.resumeReads = !!options.resumed;
|
|
8507
8634
|
this.awaitingSince = Math.min(options.awaitingSince ?? this.startedAt, this.startedAt);
|
|
8508
8635
|
this.invite = options.invite ?? (() => false);
|
|
8636
|
+
this.ownInvite = options.ownInvite ?? (() => false);
|
|
8509
8637
|
}
|
|
8510
8638
|
get peerPresence() {
|
|
8511
8639
|
return this.presence;
|
|
@@ -8796,10 +8924,15 @@ var LinkSession = class {
|
|
|
8796
8924
|
if (this.heartbeatTimer) clearTimeout(this.heartbeatTimer);
|
|
8797
8925
|
this.heartbeatTimer = setTimeout(() => {
|
|
8798
8926
|
if (!this.running) return;
|
|
8799
|
-
if (this.getServices() !== void 0) this.publish(true).catch(() => {});
|
|
8927
|
+
if (this.getServices() !== void 0 && !this.upkeepWaits()) this.publish(true).catch(() => {});
|
|
8800
8928
|
this.scheduleHeartbeat();
|
|
8801
8929
|
}, PRESENCE_HEARTBEAT);
|
|
8802
8930
|
}
|
|
8931
|
+
/** An unused invite of this side's, no longer awaited, whose packet went out less than `UNUSED_INVITE_UPKEEP_MS` ago. */
|
|
8932
|
+
upkeepWaits() {
|
|
8933
|
+
const now = Date.now();
|
|
8934
|
+
return this.ownInvite() && !this.presence.online && !this.connected && now - this.awaitingSince >= 6e5 && now - this.lastPublishedAt < 36e4;
|
|
8935
|
+
}
|
|
8803
8936
|
/**
|
|
8804
8937
|
* Coalesces publishes: at most one in flight and one queued behind it. `upkeep`: nothing new to say (the heartbeat, a
|
|
8805
8938
|
* retry of what waits): with nothing else asked for since, the packet goes as upkeep (`publishOnce`).
|
|
@@ -9653,6 +9786,476 @@ var DataLink = class {
|
|
|
9653
9786
|
}
|
|
9654
9787
|
};
|
|
9655
9788
|
//#endregion
|
|
9789
|
+
//#region ../core/src/ratchet.ts
|
|
9790
|
+
/**
|
|
9791
|
+
* The ratchet of a 1:1 chat's stored paths (WISP 4xx-ratchet, reserved number 407): what goes on the DHT floor
|
|
9792
|
+
* (WISP 403) and what is held (WISP 404) is sealed with a key used once, from a double ratchet in the manner of
|
|
9793
|
+
* Signal's (an X25519 step each time the turn passes, a one-way chain per message), so a participation key stolen
|
|
9794
|
+
* later opens none of it once the turn has passed. The live session needs none: its transports agree fresh keys on
|
|
9795
|
+
* every connection.
|
|
9796
|
+
*
|
|
9797
|
+
* Pure: every call takes a state and returns the next one. The caller holds one lock per chat from reading the state
|
|
9798
|
+
* to saving the next (an open's until what it opened is stored), and saves a seal's state before the sealed bytes
|
|
9799
|
+
* leave the device. Nothing here reads a clock or the network but through its options.
|
|
9800
|
+
*/
|
|
9801
|
+
var RATCHET_CAPABILITY = "ratchet/1";
|
|
9802
|
+
var LANE = {
|
|
9803
|
+
floor: 1,
|
|
9804
|
+
hold: 2
|
|
9805
|
+
};
|
|
9806
|
+
var VERSION$1 = 1;
|
|
9807
|
+
var SID_BYTES = 8;
|
|
9808
|
+
/** version, lane, session id, the sender's ratchet key, the hold lane's previous chain length, the message number. */
|
|
9809
|
+
var RATCHET_HEADER_BYTES = 50;
|
|
9810
|
+
/** What sealing adds to a plaintext: the header and the 16-byte tag (the nonce is derived, never sent). */
|
|
9811
|
+
var RATCHET_OVERHEAD = 66;
|
|
9812
|
+
/**
|
|
9813
|
+
* How far a message may be ahead of the last one opened on its chain. A mailbox shows only its newest envelope, so the
|
|
9814
|
+
* floor's between were replaced unread: their keys are stepped over and never kept. A held item's are kept. A sender
|
|
9815
|
+
* whose chain reaches the bound without the turn passing starts a new session rather than seal past it.
|
|
9816
|
+
*/
|
|
9817
|
+
var MAX_SKIP = {
|
|
9818
|
+
floor: 4096,
|
|
9819
|
+
hold: 512
|
|
9820
|
+
};
|
|
9821
|
+
/** Keys kept for held items not opened yet, at most, oldest dropped first. */
|
|
9822
|
+
var MAX_SKIPPED_KEYS = 512;
|
|
9823
|
+
/** A kept key, and a session only received on, is dropped this long after it was last of use: a held item lives 7 days. */
|
|
9824
|
+
var RATCHET_KEEP_MS = 6912e5;
|
|
9825
|
+
/**
|
|
9826
|
+
* A session that lost (`lost`) becomes current when its floor envelopes keep rising in sequence while the current one
|
|
9827
|
+
* has opened no floor envelope for this long: two that started at once settle within one keep-alive (about four
|
|
9828
|
+
* minutes), and a contact that lost its state meanwhile seals in its own session from then on.
|
|
9829
|
+
*/
|
|
9830
|
+
var FOLLOW_MS = 6e5;
|
|
9831
|
+
var emptyRatchetState = () => ({
|
|
9832
|
+
v: 1,
|
|
9833
|
+
others: [],
|
|
9834
|
+
skipped: [],
|
|
9835
|
+
retired: [],
|
|
9836
|
+
heard: {}
|
|
9837
|
+
});
|
|
9838
|
+
/** Sessions only opened with, at most. */
|
|
9839
|
+
var MAX_OTHERS = 2;
|
|
9840
|
+
var b64 = toBase64Url;
|
|
9841
|
+
var unb64 = fromBase64Url;
|
|
9842
|
+
var label = (text) => utf8Encode(`ghostly-ratchet/1 ${text}`);
|
|
9843
|
+
var mac = (key, text) => hmac(sha256, key, label(text));
|
|
9844
|
+
function u32$2(n) {
|
|
9845
|
+
if (!Number.isSafeInteger(n) || n < 0 || n > 4294967295) throw new Error("Ratchet counter out of range");
|
|
9846
|
+
return new Uint8Array([
|
|
9847
|
+
n >>> 24,
|
|
9848
|
+
n >>> 16 & 255,
|
|
9849
|
+
n >>> 8 & 255,
|
|
9850
|
+
n & 255
|
|
9851
|
+
]);
|
|
9852
|
+
}
|
|
9853
|
+
var readU32 = (b, at) => (b[at] << 24 >>> 0) + (b[at + 1] << 16) + (b[at + 2] << 8) + b[at + 3];
|
|
9854
|
+
function compareBytes$3(a, b) {
|
|
9855
|
+
for (let i = 0; i < Math.min(a.length, b.length); i++) if (a[i] !== b[i]) return a[i] - b[i];
|
|
9856
|
+
return a.length - b.length;
|
|
9857
|
+
}
|
|
9858
|
+
/** X25519, or null for a key that gives no secret (a low-order point): such an item does not open. */
|
|
9859
|
+
function agree(secret, pub) {
|
|
9860
|
+
try {
|
|
9861
|
+
return x25519.getSharedSecret(secret, pub);
|
|
9862
|
+
} catch {
|
|
9863
|
+
return null;
|
|
9864
|
+
}
|
|
9865
|
+
}
|
|
9866
|
+
function context(keys) {
|
|
9867
|
+
const secret = ed25519.utils.toMontgomerySecret(keys.seed);
|
|
9868
|
+
return {
|
|
9869
|
+
keys,
|
|
9870
|
+
secret,
|
|
9871
|
+
pub: x25519.getPublicKey(secret),
|
|
9872
|
+
peer: ed25519.utils.toMontgomery(publicKeyFromZ32(keys.peer)),
|
|
9873
|
+
first: compareBytes$3(publicKeyFromZ32(keys.self), publicKeyFromZ32(keys.peer)) < 0
|
|
9874
|
+
};
|
|
9875
|
+
}
|
|
9876
|
+
function root(c, sid) {
|
|
9877
|
+
const { keys } = c;
|
|
9878
|
+
const info = utf8Encode(JSON.stringify([
|
|
9879
|
+
"ghostly-ratchet/1",
|
|
9880
|
+
[...keys.rendezvous].sort(),
|
|
9881
|
+
[keys.self, keys.peer].sort()
|
|
9882
|
+
]));
|
|
9883
|
+
const salt = hkdf(sha256, keys.secret, info, label("salt"), 32);
|
|
9884
|
+
return hkdf(sha256, x25519.getSharedSecret(c.secret, c.peer), salt, concatBytes(label("root"), sid), 32);
|
|
9885
|
+
}
|
|
9886
|
+
/** The root key a session starts from: the two participation keys' agreement, salted by the invite and the chat, per session id. */
|
|
9887
|
+
var ratchetRoot = (keys, sid) => root(context(keys), sid);
|
|
9888
|
+
/** A ratchet step: the next root key and the chain key it gives, from an X25519 output. */
|
|
9889
|
+
function stepRoot(rk, dh) {
|
|
9890
|
+
const okm = hkdf(sha256, dh, rk, label("step"), 64);
|
|
9891
|
+
return [okm.slice(0, 32), okm.slice(32)];
|
|
9892
|
+
}
|
|
9893
|
+
var lanes = (ck) => ({
|
|
9894
|
+
floor: {
|
|
9895
|
+
k: b64(mac(ck, "lane floor")),
|
|
9896
|
+
n: 0
|
|
9897
|
+
},
|
|
9898
|
+
hold: {
|
|
9899
|
+
k: b64(mac(ck, "lane hold")),
|
|
9900
|
+
n: 0
|
|
9901
|
+
}
|
|
9902
|
+
});
|
|
9903
|
+
/** One message key off a chain, and the chain moved past it. */
|
|
9904
|
+
function advance(chain) {
|
|
9905
|
+
const ck = unb64(chain.k);
|
|
9906
|
+
return [hmac(sha256, ck, new Uint8Array([1])), {
|
|
9907
|
+
k: b64(hmac(sha256, ck, new Uint8Array([2]))),
|
|
9908
|
+
n: chain.n + 1
|
|
9909
|
+
}];
|
|
9910
|
+
}
|
|
9911
|
+
function newSession(c, sid, random, now) {
|
|
9912
|
+
const rk0 = root(c, sid);
|
|
9913
|
+
const initial = lanes(mac(rk0, "initial"));
|
|
9914
|
+
const base = {
|
|
9915
|
+
sid: b64(sid),
|
|
9916
|
+
pnHold: 0,
|
|
9917
|
+
heard: false,
|
|
9918
|
+
fs: false,
|
|
9919
|
+
at: now,
|
|
9920
|
+
made: now
|
|
9921
|
+
};
|
|
9922
|
+
if (!c.first) return {
|
|
9923
|
+
...base,
|
|
9924
|
+
rk: b64(rk0),
|
|
9925
|
+
dhs: null,
|
|
9926
|
+
dhsPub: b64(c.pub),
|
|
9927
|
+
dhr: null,
|
|
9928
|
+
send: initial,
|
|
9929
|
+
recv: null
|
|
9930
|
+
};
|
|
9931
|
+
const dhs = random(32);
|
|
9932
|
+
const [rk, ck] = stepRoot(rk0, x25519.getSharedSecret(dhs, c.peer));
|
|
9933
|
+
return {
|
|
9934
|
+
...base,
|
|
9935
|
+
rk: b64(rk),
|
|
9936
|
+
dhs: b64(dhs),
|
|
9937
|
+
dhsPub: b64(x25519.getPublicKey(dhs)),
|
|
9938
|
+
dhr: b64(c.peer),
|
|
9939
|
+
send: lanes(ck),
|
|
9940
|
+
recv: initial
|
|
9941
|
+
};
|
|
9942
|
+
}
|
|
9943
|
+
function messageKeys(mk) {
|
|
9944
|
+
const okm = hkdf(sha256, mk, /* @__PURE__ */ new Uint8Array(32), label("message"), 56);
|
|
9945
|
+
return {
|
|
9946
|
+
key: okm.slice(0, 32),
|
|
9947
|
+
nonce: okm.slice(32)
|
|
9948
|
+
};
|
|
9949
|
+
}
|
|
9950
|
+
function aad(lane, sender, recipient, header) {
|
|
9951
|
+
return concatBytes(utf8Encode("ghostly-ratchet/1"), new Uint8Array([LANE[lane]]), publicKeyFromZ32(sender), publicKeyFromZ32(recipient), header);
|
|
9952
|
+
}
|
|
9953
|
+
function header$1(lane, session, n) {
|
|
9954
|
+
return concatBytes(new Uint8Array([VERSION$1, LANE[lane]]), unb64(session.sid), unb64(session.dhsPub), u32$2(session.pnHold), u32$2(n));
|
|
9955
|
+
}
|
|
9956
|
+
function parseHeader(sealed) {
|
|
9957
|
+
if (sealed.length < 66 || sealed[0] !== VERSION$1 || sealed[1] !== 1 && sealed[1] !== 2) return null;
|
|
9958
|
+
const at = 42;
|
|
9959
|
+
return {
|
|
9960
|
+
lane: sealed[1] === 1 ? "floor" : "hold",
|
|
9961
|
+
sid: b64(sealed.slice(2, 10)),
|
|
9962
|
+
dh: b64(sealed.slice(10, at)),
|
|
9963
|
+
pnHold: readU32(sealed, at),
|
|
9964
|
+
n: readU32(sealed, 46)
|
|
9965
|
+
};
|
|
9966
|
+
}
|
|
9967
|
+
function prune(state, now) {
|
|
9968
|
+
state.skipped = state.skipped.filter((k) => k.at + RATCHET_KEEP_MS > now).slice(-512);
|
|
9969
|
+
for (const old of state.others.filter((o) => o.at + RATCHET_KEEP_MS <= now)) retire(state, old);
|
|
9970
|
+
state.others = state.others.filter((o) => o.at + RATCHET_KEEP_MS > now);
|
|
9971
|
+
}
|
|
9972
|
+
function retire(state, session) {
|
|
9973
|
+
if (!session) return;
|
|
9974
|
+
if (!state.retired.includes(session.sid)) state.retired = [...state.retired, session.sid].slice(-16);
|
|
9975
|
+
state.skipped = state.skipped.filter((k) => k.s !== session.sid);
|
|
9976
|
+
}
|
|
9977
|
+
/** `session` is only opened with from now on; past `MAX_OTHERS`, the one used least lately is retired. */
|
|
9978
|
+
function demote(state, session) {
|
|
9979
|
+
state.others = [...state.others.filter((o) => o.sid !== session.sid), session].sort((a, b) => a.at - b.at);
|
|
9980
|
+
while (state.others.length > MAX_OTHERS) retire(state, state.others.shift());
|
|
9981
|
+
}
|
|
9982
|
+
/**
|
|
9983
|
+
* Seals one item for the contact on a lane, with the current session (started here when there is none, or when its
|
|
9984
|
+
* chain on this lane reached `MAX_SKIP` without the turn passing: past it the contact could not step over to it). The
|
|
9985
|
+
* state returned MUST be saved before the sealed bytes leave the device: a key is used once, and a crash between the
|
|
9986
|
+
* two that kept the old state would use it again on other bytes.
|
|
9987
|
+
*/
|
|
9988
|
+
function ratchetSeal(prev, keys, lane, plaintext, options = {}) {
|
|
9989
|
+
const now = options.now ?? Date.now(), random = options.random ?? randomBytes;
|
|
9990
|
+
const state = structuredClone(prev);
|
|
9991
|
+
prune(state, now);
|
|
9992
|
+
if (state.current && state.current.send[lane].n >= MAX_SKIP[lane]) {
|
|
9993
|
+
demote(state, state.current);
|
|
9994
|
+
delete state.current;
|
|
9995
|
+
}
|
|
9996
|
+
const session = state.current ??= newSession(context(keys), random(SID_BYTES), random, now);
|
|
9997
|
+
const [mk, next] = advance(session.send[lane]);
|
|
9998
|
+
const head = header$1(lane, session, session.send[lane].n);
|
|
9999
|
+
session.send[lane] = next;
|
|
10000
|
+
session.at = now;
|
|
10001
|
+
const { key, nonce } = messageKeys(mk);
|
|
10002
|
+
return {
|
|
10003
|
+
state,
|
|
10004
|
+
sealed: concatBytes(head, xchacha20poly1305(key, nonce, aad(lane, keys.self, keys.peer, head)).encrypt(plaintext))
|
|
10005
|
+
};
|
|
10006
|
+
}
|
|
10007
|
+
/**
|
|
10008
|
+
* Opens `sealed` under `session`, changing it and `state` in place (both are a copy the caller throws away on null).
|
|
10009
|
+
* Every bound is checked before any X25519 or chain step.
|
|
10010
|
+
*/
|
|
10011
|
+
function openWith(state, session, c, h, sealed, random, now) {
|
|
10012
|
+
const decrypt = (mk) => {
|
|
10013
|
+
const { key, nonce } = messageKeys(mk);
|
|
10014
|
+
try {
|
|
10015
|
+
return xchacha20poly1305(key, nonce, aad(h.lane, c.keys.peer, c.keys.self, sealed.subarray(0, 50))).decrypt(sealed.subarray(50));
|
|
10016
|
+
} catch {
|
|
10017
|
+
return null;
|
|
10018
|
+
}
|
|
10019
|
+
};
|
|
10020
|
+
if (h.lane === "hold") {
|
|
10021
|
+
const i = state.skipped.findIndex((k) => k.s === session.sid && k.d === h.dh && k.n === h.n);
|
|
10022
|
+
if (i >= 0) {
|
|
10023
|
+
const plain = decrypt(unb64(state.skipped[i].k));
|
|
10024
|
+
if (plain) state.skipped.splice(i, 1);
|
|
10025
|
+
return plain;
|
|
10026
|
+
}
|
|
10027
|
+
}
|
|
10028
|
+
const keep = (lane, dh, from, until) => {
|
|
10029
|
+
let chain = from;
|
|
10030
|
+
while (chain.n < until) {
|
|
10031
|
+
const [mk, next] = advance(chain);
|
|
10032
|
+
if (lane === "hold") state.skipped.push({
|
|
10033
|
+
s: session.sid,
|
|
10034
|
+
d: dh,
|
|
10035
|
+
n: chain.n,
|
|
10036
|
+
k: b64(mk),
|
|
10037
|
+
at: now
|
|
10038
|
+
});
|
|
10039
|
+
chain = next;
|
|
10040
|
+
}
|
|
10041
|
+
return chain;
|
|
10042
|
+
};
|
|
10043
|
+
const bound = MAX_SKIP[h.lane];
|
|
10044
|
+
if (h.dh !== session.dhr) {
|
|
10045
|
+
const old = session.recv && session.dhr ? session.recv.hold : null;
|
|
10046
|
+
if (h.n > bound || old && h.pnHold > old.n && h.pnHold - old.n > MAX_SKIP.hold) return null;
|
|
10047
|
+
const received = agree(session.dhs ? unb64(session.dhs) : c.secret, unb64(h.dh));
|
|
10048
|
+
if (!received) return null;
|
|
10049
|
+
if (old && session.dhr) keep("hold", session.dhr, old, h.pnHold);
|
|
10050
|
+
let [rk, ck] = stepRoot(unb64(session.rk), received);
|
|
10051
|
+
const steppedWithOwn = session.dhs !== null;
|
|
10052
|
+
session.recv = lanes(ck);
|
|
10053
|
+
session.dhr = h.dh;
|
|
10054
|
+
session.pnHold = session.send.hold.n;
|
|
10055
|
+
const dhs = random(32);
|
|
10056
|
+
[rk, ck] = stepRoot(rk, x25519.getSharedSecret(dhs, unb64(h.dh)));
|
|
10057
|
+
session.rk = b64(rk);
|
|
10058
|
+
session.dhs = b64(dhs);
|
|
10059
|
+
session.dhsPub = b64(x25519.getPublicKey(dhs));
|
|
10060
|
+
session.send = lanes(ck);
|
|
10061
|
+
if (steppedWithOwn && h.dh !== b64(c.peer)) session.fs = true;
|
|
10062
|
+
}
|
|
10063
|
+
if (!session.recv) return null;
|
|
10064
|
+
const chain = session.recv[h.lane];
|
|
10065
|
+
if (h.n < chain.n || h.n - chain.n > bound) return null;
|
|
10066
|
+
const [mk, next] = advance(keep(h.lane, h.dh, chain, h.n));
|
|
10067
|
+
const plain = decrypt(mk);
|
|
10068
|
+
if (!plain) return null;
|
|
10069
|
+
session.recv[h.lane] = next;
|
|
10070
|
+
session.heard = true;
|
|
10071
|
+
session.at = now;
|
|
10072
|
+
return plain;
|
|
10073
|
+
}
|
|
10074
|
+
/**
|
|
10075
|
+
* Opens an item the contact sealed. Null: not a ratcheted item of this chat on this lane, or one already opened, or
|
|
10076
|
+
* past the bounds. Otherwise the plaintext, and `finish`, which gives the state to save once the item is stored and
|
|
10077
|
+
* passed its path's own checks (a newer DHT sequence, a held item not taken before): those, not the ratchet, are what
|
|
10078
|
+
* refuse a replay. `order`: a floor envelope's sequence, read from the body once opened. `fresh`: it came under a
|
|
10079
|
+
* session this side did not know.
|
|
10080
|
+
*/
|
|
10081
|
+
function ratchetOpen(prev, keys, lane, sealed, options = {}) {
|
|
10082
|
+
const now = options.now ?? Date.now(), random = options.random ?? randomBytes;
|
|
10083
|
+
const h = parseHeader(sealed);
|
|
10084
|
+
if (!h || h.lane !== lane) return null;
|
|
10085
|
+
const state = structuredClone(prev);
|
|
10086
|
+
prune(state, now);
|
|
10087
|
+
const c = context(keys);
|
|
10088
|
+
const seen = (session, order) => {
|
|
10089
|
+
if (lane !== "floor" || order === void 0 || !Number.isSafeInteger(order)) return false;
|
|
10090
|
+
const rising = session.floorSeq !== void 0 && order > session.floorSeq;
|
|
10091
|
+
session.floorSeq = Math.max(session.floorSeq ?? 0, order);
|
|
10092
|
+
session.floorAt = now;
|
|
10093
|
+
return rising;
|
|
10094
|
+
};
|
|
10095
|
+
const done = () => {
|
|
10096
|
+
state.heard[lane] = true;
|
|
10097
|
+
prune(state, now);
|
|
10098
|
+
return state;
|
|
10099
|
+
};
|
|
10100
|
+
const known = state.current?.sid === h.sid ? state.current : state.others.find((o) => o.sid === h.sid);
|
|
10101
|
+
if (known) {
|
|
10102
|
+
const plaintext = openWith(state, known, c, h, sealed, random, now);
|
|
10103
|
+
if (!plaintext) return null;
|
|
10104
|
+
return {
|
|
10105
|
+
plaintext,
|
|
10106
|
+
fresh: false,
|
|
10107
|
+
finish: (order) => {
|
|
10108
|
+
const rising = seen(known, order), current = state.current;
|
|
10109
|
+
if (rising && known.lost && current && known !== current && current.floorSeq === void 0 && now - (current.floorAt ?? current.made) > 6e5) {
|
|
10110
|
+
state.others = state.others.filter((o) => o.sid !== known.sid);
|
|
10111
|
+
delete known.lost;
|
|
10112
|
+
demote(state, current);
|
|
10113
|
+
state.current = known;
|
|
10114
|
+
}
|
|
10115
|
+
return done();
|
|
10116
|
+
}
|
|
10117
|
+
};
|
|
10118
|
+
}
|
|
10119
|
+
if (state.retired.includes(h.sid)) return null;
|
|
10120
|
+
if (h.n > MAX_SKIP[lane] || h.pnHold > MAX_SKIP.hold) return null;
|
|
10121
|
+
const fresh = newSession(c, unb64(h.sid), random, now);
|
|
10122
|
+
const plaintext = openWith(state, fresh, c, h, sealed, random, now);
|
|
10123
|
+
if (!plaintext) return null;
|
|
10124
|
+
return {
|
|
10125
|
+
plaintext,
|
|
10126
|
+
fresh: true,
|
|
10127
|
+
finish: (order) => {
|
|
10128
|
+
seen(fresh, order);
|
|
10129
|
+
const current = state.current;
|
|
10130
|
+
if (!current) state.current = fresh;
|
|
10131
|
+
else if (current.floorSeq === void 0) {
|
|
10132
|
+
if (compareBytes$3(unb64(h.sid), unb64(current.sid)) > 0) {
|
|
10133
|
+
current.lost = true;
|
|
10134
|
+
demote(state, current);
|
|
10135
|
+
state.current = fresh;
|
|
10136
|
+
} else {
|
|
10137
|
+
fresh.lost = true;
|
|
10138
|
+
demote(state, fresh);
|
|
10139
|
+
}
|
|
10140
|
+
} else if (lane === "floor" && fresh.floorSeq !== void 0 && fresh.floorSeq > current.floorSeq) {
|
|
10141
|
+
demote(state, current);
|
|
10142
|
+
state.current = fresh;
|
|
10143
|
+
} else if (lane === "floor") {
|
|
10144
|
+
fresh.lost = true;
|
|
10145
|
+
demote(state, fresh);
|
|
10146
|
+
} else state.skipped = state.skipped.filter((k) => k.s !== fresh.sid);
|
|
10147
|
+
return done();
|
|
10148
|
+
}
|
|
10149
|
+
};
|
|
10150
|
+
}
|
|
10151
|
+
/** Whether `sealed` is shaped as a ratcheted item of this lane (it may still not open). */
|
|
10152
|
+
var isRatcheted = (sealed, lane) => parseHeader(sealed)?.lane === lane;
|
|
10153
|
+
/** The session a ratcheted item of this lane names (its `sid`, base64url), as its header says; undefined for anything else. */
|
|
10154
|
+
var ratchetSessionOf = (sealed, lane) => {
|
|
10155
|
+
const h = parseHeader(sealed);
|
|
10156
|
+
return h?.lane === lane ? h.sid : void 0;
|
|
10157
|
+
};
|
|
10158
|
+
/**
|
|
10159
|
+
* Whether `sealed` names a session this side has no state of and did not retire: neither the current one nor one of the
|
|
10160
|
+
* others. What the contact sealed in the session it shares with a device this profile was on before (a Move, a restore:
|
|
10161
|
+
* WISP 4xx § Several devices) is such an item, once the turn passed there; so is anything under a made-up `sid`. It says
|
|
10162
|
+
* nothing of whether the item is genuine: only that this side could not tell, having never had the session.
|
|
10163
|
+
*/
|
|
10164
|
+
function ratchetUnknownSession(state, sealed, lane) {
|
|
10165
|
+
const h = parseHeader(sealed);
|
|
10166
|
+
if (!h || h.lane !== lane) return false;
|
|
10167
|
+
const s = state ?? emptyRatchetState();
|
|
10168
|
+
return s.current?.sid !== h.sid && !s.others.some((o) => o.sid === h.sid) && !s.retired.includes(h.sid);
|
|
10169
|
+
}
|
|
10170
|
+
/** Whether forward secrecy is on for this chat: the turn passed both ways in the session this side seals with. */
|
|
10171
|
+
var ratchetOn = (state) => !!state?.current?.fs;
|
|
10172
|
+
/** Whether a lane refuses plain items from the contact: a ratcheted one opened there (WISP 4xx § Downgrade). */
|
|
10173
|
+
var ratchetHeard = (state, lane) => !!state?.heard[lane];
|
|
10174
|
+
/**
|
|
10175
|
+
* One chat's ratchet, shared by its two lanes (the DHT floor and held items): the one lock per chat of WISP 4xx §
|
|
10176
|
+
* Saving state, and the order of saving. Every change goes through `lock`, so a seal and an open never start from the
|
|
10177
|
+
* same state.
|
|
10178
|
+
*/
|
|
10179
|
+
var RatchetBox = class {
|
|
10180
|
+
keys;
|
|
10181
|
+
state;
|
|
10182
|
+
save;
|
|
10183
|
+
chain = Promise.resolve();
|
|
10184
|
+
constructor(keys, state, save) {
|
|
10185
|
+
this.keys = keys;
|
|
10186
|
+
this.state = state;
|
|
10187
|
+
this.save = save;
|
|
10188
|
+
}
|
|
10189
|
+
/** Runs `fn` alone among this chat's ratchet changes; `seal` and `open` are called inside it only. */
|
|
10190
|
+
lock(fn) {
|
|
10191
|
+
const run = this.chain.then(() => fn(this.transaction()));
|
|
10192
|
+
this.chain = run.then(() => {}, () => {});
|
|
10193
|
+
return run;
|
|
10194
|
+
}
|
|
10195
|
+
transaction() {
|
|
10196
|
+
return {
|
|
10197
|
+
seal: async (lane, plaintext) => {
|
|
10198
|
+
const { state, sealed } = ratchetSeal(this.state, this.keys(), lane, plaintext);
|
|
10199
|
+
await this.save(state);
|
|
10200
|
+
this.state = state;
|
|
10201
|
+
return sealed;
|
|
10202
|
+
},
|
|
10203
|
+
open: (lane, sealed) => {
|
|
10204
|
+
const opened = ratchetOpen(this.state, this.keys(), lane, sealed);
|
|
10205
|
+
if (!opened) return null;
|
|
10206
|
+
return {
|
|
10207
|
+
plaintext: opened.plaintext,
|
|
10208
|
+
fresh: opened.fresh,
|
|
10209
|
+
commit: async (order) => {
|
|
10210
|
+
const state = opened.finish(order);
|
|
10211
|
+
await this.save(state);
|
|
10212
|
+
this.state = state;
|
|
10213
|
+
}
|
|
10214
|
+
};
|
|
10215
|
+
}
|
|
10216
|
+
};
|
|
10217
|
+
}
|
|
10218
|
+
/**
|
|
10219
|
+
* Opens without keeping anything, and without the lock: a look from another profile, or the first half of a receive
|
|
10220
|
+
* whose content is then stored with no lock held (`commitOpen` keeps it).
|
|
10221
|
+
*/
|
|
10222
|
+
peek(lane, sealed) {
|
|
10223
|
+
return ratchetOpen(this.state, this.keys(), lane, sealed)?.plaintext ?? null;
|
|
10224
|
+
}
|
|
10225
|
+
/**
|
|
10226
|
+
* The second half of a receive, once what `peek` gave is stored: opened again under the lock on the state as it is now
|
|
10227
|
+
* (a seal or another open may have moved it meanwhile), and that state saved. False: it no longer opens (taken by a
|
|
10228
|
+
* receive of the same item meanwhile), and nothing moved. So the lock is never held while content is stored, which
|
|
10229
|
+
* may call back into the other lane.
|
|
10230
|
+
*/
|
|
10231
|
+
commitOpen(lane, sealed, order) {
|
|
10232
|
+
return this.lock(async (tx) => {
|
|
10233
|
+
const opened = tx.open(lane, sealed);
|
|
10234
|
+
if (!opened) return false;
|
|
10235
|
+
await opened.commit(order);
|
|
10236
|
+
return true;
|
|
10237
|
+
});
|
|
10238
|
+
}
|
|
10239
|
+
heard(lane) {
|
|
10240
|
+
return ratchetHeard(this.state, lane);
|
|
10241
|
+
}
|
|
10242
|
+
/** A ratcheted item from the contact opened on either lane: this side seals with the ratchet whatever the contact's record says. */
|
|
10243
|
+
get heardAny() {
|
|
10244
|
+
return this.heard("floor") || this.heard("hold");
|
|
10245
|
+
}
|
|
10246
|
+
get on() {
|
|
10247
|
+
return ratchetOn(this.state);
|
|
10248
|
+
}
|
|
10249
|
+
/** The session this side seals with now, if any (its `sid`). */
|
|
10250
|
+
get session() {
|
|
10251
|
+
return this.state.current?.sid;
|
|
10252
|
+
}
|
|
10253
|
+
/** `ratchetUnknownSession` on the state as it is: an item under a session this side never had. */
|
|
10254
|
+
unknownSession(lane, sealed) {
|
|
10255
|
+
return ratchetUnknownSession(this.state, sealed, lane);
|
|
10256
|
+
}
|
|
10257
|
+
};
|
|
10258
|
+
//#endregion
|
|
9656
10259
|
//#region ../core/src/groupCrypto.ts
|
|
9657
10260
|
/**
|
|
9658
10261
|
* The cryptography of the `group-mesh/1` profile (WISP 900 / 902 group mesh).
|
|
@@ -10993,11 +11596,25 @@ var LINK_CLOSERS = {
|
|
|
10993
11596
|
"}": "{"
|
|
10994
11597
|
};
|
|
10995
11598
|
/**
|
|
10996
|
-
*
|
|
10997
|
-
*
|
|
10998
|
-
*
|
|
11599
|
+
* Punctuation a sentence in Chinese, Japanese or Arabic puts right after a link, with no space: the ideographic comma
|
|
11600
|
+
* and full stop, the full-width ! , : ; ? and brackets, the corner quotes, the Arabic comma, semicolon and question
|
|
11601
|
+
* mark, the Urdu full stop. No address holds one as typed, so a link stops at the first.
|
|
11602
|
+
*/
|
|
11603
|
+
var LINK_STOP = /[、。〈-】!(),:;?،؛؟۔]/;
|
|
11604
|
+
/** What a link leaves out at its end: a sentence's punctuation ("…", "»", "”" too), never a path's "/". */
|
|
11605
|
+
var LINK_TRAILING = /[.,;:!?'"*_>…»’”]/;
|
|
11606
|
+
/** A link up to the first `LINK_STOP`: "https://x.example/a。" opens /a, not /a%E3%80%82. */
|
|
11607
|
+
function linkStop(url) {
|
|
11608
|
+
const at = url.search(LINK_STOP);
|
|
11609
|
+
return at < 0 ? url : url.slice(0, at);
|
|
11610
|
+
}
|
|
11611
|
+
/**
|
|
11612
|
+
* A link ends where the sentence around it takes over: trailing punctuation ("see https://x.example/a.", in any of
|
|
11613
|
+
* the app's languages) and a closing bracket or quote the link did not open ("(https://x.example/a)") are left as
|
|
11614
|
+
* text. The same rule as the message bubble's links.
|
|
10999
11615
|
*/
|
|
11000
|
-
function linkEnd(
|
|
11616
|
+
function linkEnd(whole) {
|
|
11617
|
+
const url = linkStop(whole);
|
|
11001
11618
|
const count = {
|
|
11002
11619
|
"(": 0,
|
|
11003
11620
|
")": 0,
|
|
@@ -11011,7 +11628,7 @@ function linkEnd(url) {
|
|
|
11011
11628
|
while (end > 0) {
|
|
11012
11629
|
const last = url[end - 1];
|
|
11013
11630
|
const opener = LINK_CLOSERS[last];
|
|
11014
|
-
if (
|
|
11631
|
+
if (!LINK_TRAILING.test(last) && !(opener && count[last] > count[opener])) break;
|
|
11015
11632
|
if (opener) count[last]--;
|
|
11016
11633
|
end--;
|
|
11017
11634
|
}
|
|
@@ -11021,7 +11638,7 @@ function linkEnd(url) {
|
|
|
11021
11638
|
var LINK_MAX_CHARS = 4096;
|
|
11022
11639
|
/** The http(s) links of a text, in order, each ending as the bubble ends it. */
|
|
11023
11640
|
function linksIn(text) {
|
|
11024
|
-
return [...text.matchAll(/https?:\/\/\S+/
|
|
11641
|
+
return [...text.matchAll(/https?:\/\/\S+/gi)].filter((match) => match[0].length <= LINK_MAX_CHARS).map((match) => linkEnd(match[0])).filter((url) => url.length > 8);
|
|
11025
11642
|
}
|
|
11026
11643
|
/**
|
|
11027
11644
|
* The link as a preview names it: parsed, http(s) only, without tracking parameters (`utm_*`, `fbclid`, …). The
|
|
@@ -11522,6 +12139,17 @@ var BLANK = /[\u034F\u115F\u1160\u2800\u3164\uFFA0]/gu;
|
|
|
11522
12139
|
*/
|
|
11523
12140
|
var SPACE_RUN = /(?:\s\p{M}*)+/gu;
|
|
11524
12141
|
/**
|
|
12142
|
+
* A run of characters meant to draw nothing (variation selectors, the Khmer inherent vowels, the Mongolian free
|
|
12143
|
+
* variation selectors). WebKit draws some of them as wide blanks after a letter, so "Invoice.pdf" + 150 of one +
|
|
12144
|
+
* ".exe" reads as a PDF there. A letter keeps one variation selector (its variant form); the rest go.
|
|
12145
|
+
*/
|
|
12146
|
+
var IGNORABLE_RUN = /\p{Default_Ignorable_Code_Point}+/gu;
|
|
12147
|
+
var VARIATION_SELECTOR = /^\p{Variation_Selector}/u;
|
|
12148
|
+
function dropIgnorable(run, offset, text) {
|
|
12149
|
+
const kept = VARIATION_SELECTOR.exec(run)?.[0];
|
|
12150
|
+
return kept && offset > 0 && !/\s/u.test(text[offset - 1]) ? kept : "";
|
|
12151
|
+
}
|
|
12152
|
+
/**
|
|
11525
12153
|
* Names Windows keeps for devices, whatever the case, with any extension, and with spaces before the dot:
|
|
11526
12154
|
* "CON", "nul.txt", "COM1 .log" open a device there, not a file.
|
|
11527
12155
|
*/
|
|
@@ -11538,7 +12166,7 @@ function shorten(name) {
|
|
|
11538
12166
|
}
|
|
11539
12167
|
/** A file name is display text and a download suggestion, never a path. */
|
|
11540
12168
|
function sanitizeFileName(name) {
|
|
11541
|
-
const clean = shorten(name.replace(INVISIBLE, "").replace(BLANK, "").replace(/[/\\:]/g, "").replace(SPACE_RUN, " ").replace(/^[\s.]+/, "").trim());
|
|
12169
|
+
const clean = shorten(name.replace(INVISIBLE, "").replace(BLANK, "").replace(/[/\\:]/g, "").replace(IGNORABLE_RUN, dropIgnorable).replace(SPACE_RUN, " ").replace(/^[\s.]+/, "").trim());
|
|
11542
12170
|
if (WINDOWS_DEVICE.test(clean)) return shorten("_" + clean);
|
|
11543
12171
|
return clean || "file";
|
|
11544
12172
|
}
|
|
@@ -11884,6 +12512,11 @@ var DhtDelivery = class DhtDelivery {
|
|
|
11884
12512
|
live = false;
|
|
11885
12513
|
active = false;
|
|
11886
12514
|
startedAt = Date.now();
|
|
12515
|
+
/**
|
|
12516
|
+
* When an envelope of the contact's newer than any before was last read here, in this run. A contact that is there
|
|
12517
|
+
* puts a keep-alive every four minutes: none in `PRESENCE_WINDOW`, it is away (`publish`).
|
|
12518
|
+
*/
|
|
12519
|
+
peerNewAt = -Infinity;
|
|
11887
12520
|
/** The next read was asked for (a refresh, a fresh packet of the contact): it is not a background one. */
|
|
11888
12521
|
urgent = false;
|
|
11889
12522
|
/** Reads left that are signaling: the contact is leaving DHT only, and the live link waits on them (`expect`). */
|
|
@@ -11957,9 +12590,29 @@ var DhtDelivery = class DhtDelivery {
|
|
|
11957
12590
|
maxTextBytes: 256,
|
|
11958
12591
|
...this.lastPublished && { lastPublished: this.lastPublished },
|
|
11959
12592
|
...this.foreignKeySeenAt && { foreignKeySeenAt: this.foreignKeySeenAt },
|
|
11960
|
-
...this.state.inviteTaken && { inviteTaken: true }
|
|
12593
|
+
...this.state.inviteTaken && { inviteTaken: true },
|
|
12594
|
+
...this.forwardSecrecy && { forwardSecrecy: this.forwardSecrecy }
|
|
11961
12595
|
};
|
|
11962
12596
|
}
|
|
12597
|
+
get forwardSecrecy() {
|
|
12598
|
+
const ratchet = this.options.ratchet;
|
|
12599
|
+
if (!ratchet || !this.options.credentials.peerKey) return void 0;
|
|
12600
|
+
const supports = ratchet.peerSupports();
|
|
12601
|
+
return ratchet.box.on && supports ? "on" : !supports ? ratchet.box.heardAny ? "stopped" : "unsupported" : "starting";
|
|
12602
|
+
}
|
|
12603
|
+
/**
|
|
12604
|
+
* Whether an envelope to `recipient` is sealed with the ratchet: the contact is pinned and its record lists
|
|
12605
|
+
* `ratchet/1`, or a ratcheted envelope of its was opened here, after which nothing goes plain (WISP 4xx § Downgrade).
|
|
12606
|
+
* And the contact pinned this side too (an envelope of its sealed to this side read, or a live session had): a joiner
|
|
12607
|
+
* pins its inviter from the invite, and its first contact sealed with the ratchet would reach an inviter that has no key
|
|
12608
|
+
* to open it with, and so never pins it.
|
|
12609
|
+
*/
|
|
12610
|
+
ratcheted(recipient) {
|
|
12611
|
+
const ratchet = this.options.ratchet, peer = this.options.credentials.peerKey;
|
|
12612
|
+
if (!ratchet || !peer || recipient !== peer) return false;
|
|
12613
|
+
if (ratchet.box.heardAny) return true;
|
|
12614
|
+
return ratchet.peerSupports() && (!!this.state.peerPinned || !!this.state.wasLive);
|
|
12615
|
+
}
|
|
11963
12616
|
/**
|
|
11964
12617
|
* This side joined, and its inviter never answered (`DhtDeliveryState.unanswered`): no envelope of its newer than the
|
|
11965
12618
|
* one that pinned it, none sealed to this side, no text confirmed, never live (as `sealedToAnother` asks too).
|
|
@@ -11998,6 +12651,14 @@ var DhtDelivery = class DhtDelivery {
|
|
|
11998
12651
|
return this.pinnedBoxes;
|
|
11999
12652
|
}
|
|
12000
12653
|
lastPublished;
|
|
12654
|
+
/** The envelope a trace line was last said for, per step: a packet read again says nothing new (a Desktop logs every line). */
|
|
12655
|
+
traced = /* @__PURE__ */ new Map();
|
|
12656
|
+
traceOnce(step, record, detail) {
|
|
12657
|
+
const seen = record.slice(-24);
|
|
12658
|
+
if (this.traced.get(step) === seen) return;
|
|
12659
|
+
this.traced.set(step, seen);
|
|
12660
|
+
traceLink(this.from, step, detail);
|
|
12661
|
+
}
|
|
12001
12662
|
/** The sealed record's nonce is its first 24 bytes: 32 characters of base64. */
|
|
12002
12663
|
static facts(body, records, key) {
|
|
12003
12664
|
return {
|
|
@@ -12053,6 +12714,13 @@ var DhtDelivery = class DhtDelivery {
|
|
|
12053
12714
|
]));
|
|
12054
12715
|
}
|
|
12055
12716
|
records(body, recipient = this.options.credentials.peerKey) {
|
|
12717
|
+
return this.envelope(body, recipient).records;
|
|
12718
|
+
}
|
|
12719
|
+
/**
|
|
12720
|
+
* The envelope's records. Ratcheted (`ratcheted`), its `_dr` record is the right length but not sealed yet: `seal`
|
|
12721
|
+
* gives its bytes, under the chat's lock, once the publication is sure to go. Measuring a packet takes no key.
|
|
12722
|
+
*/
|
|
12723
|
+
envelope(body, recipient = this.options.credentials.peerKey) {
|
|
12056
12724
|
const signature = toBase64Url(sign(this.signed(body, recipient), this.participation.seed));
|
|
12057
12725
|
const plaintext = JSON.stringify([body, signature]);
|
|
12058
12726
|
const hint = recipient ? [{
|
|
@@ -12060,20 +12728,46 @@ var DhtDelivery = class DhtDelivery {
|
|
|
12060
12728
|
value: encrypt(this.participation.pubKeyZ32, this.key),
|
|
12061
12729
|
ttl: ENVELOPE_TTL
|
|
12062
12730
|
}] : [];
|
|
12731
|
+
const ratchet = this.ratcheted(recipient);
|
|
12732
|
+
const sealedBytes = (bytes) => ratchet ? 4 * Math.ceil((66 + bytes) / 3) : sealedLength(bytes);
|
|
12733
|
+
const label = ratchet ? "_dr" : "_dm";
|
|
12063
12734
|
const fits = (bytes) => bytes <= MAX_ENVELOPE_PLAINTEXT && measureRecords(this.identity.pubKeyZ32, [{
|
|
12064
|
-
label
|
|
12065
|
-
value: "A".repeat(
|
|
12735
|
+
label,
|
|
12736
|
+
value: "A".repeat(sealedBytes(bytes)),
|
|
12066
12737
|
ttl: ENVELOPE_TTL
|
|
12067
12738
|
}, ...hint]) <= ENVELOPE_PACKET_BYTES;
|
|
12068
12739
|
const bytes = utf8Encode(plaintext).length;
|
|
12069
12740
|
if (!fits(bytes)) throw new Error("Text and authentication exceed the DHT packet budget. Shorten the message.");
|
|
12070
12741
|
let padded = bytes;
|
|
12071
12742
|
for (let step = 512; step >= 1; step >>= 1) if (fits(padded + step)) padded += step;
|
|
12072
|
-
|
|
12073
|
-
|
|
12074
|
-
|
|
12743
|
+
const full = plaintext + " ".repeat(padded - bytes);
|
|
12744
|
+
if (ratchet) return {
|
|
12745
|
+
records: [{
|
|
12746
|
+
label,
|
|
12747
|
+
value: "A".repeat(sealedBytes(padded)),
|
|
12748
|
+
ttl: ENVELOPE_TTL
|
|
12749
|
+
}, ...hint],
|
|
12750
|
+
plaintext: full
|
|
12751
|
+
};
|
|
12752
|
+
return { records: [{
|
|
12753
|
+
label,
|
|
12754
|
+
value: encrypt(full, recipient ? this.sealedKey(recipient) : this.key),
|
|
12075
12755
|
ttl: ENVELOPE_TTL
|
|
12076
|
-
}, ...hint];
|
|
12756
|
+
}, ...hint] };
|
|
12757
|
+
}
|
|
12758
|
+
/**
|
|
12759
|
+
* The records to publish: a ratcheted one sealed now, its state saved first (seal, save, send), from the plaintext
|
|
12760
|
+
* the envelope was measured with.
|
|
12761
|
+
*/
|
|
12762
|
+
async sealed(envelope) {
|
|
12763
|
+
const { records, plaintext } = envelope;
|
|
12764
|
+
if (records[0]?.label !== "_dr") return records;
|
|
12765
|
+
if (plaintext === void 0) throw new Error("A ratcheted envelope without its plaintext");
|
|
12766
|
+
const sealed = await this.options.ratchet.box.lock((tx) => tx.seal("floor", utf8Encode(plaintext)));
|
|
12767
|
+
return [{
|
|
12768
|
+
...records[0],
|
|
12769
|
+
value: toBase64(sealed)
|
|
12770
|
+
}, ...records.slice(1)];
|
|
12077
12771
|
}
|
|
12078
12772
|
async start() {
|
|
12079
12773
|
if (this.running) return;
|
|
@@ -12192,6 +12886,7 @@ var DhtDelivery = class DhtDelivery {
|
|
|
12192
12886
|
}
|
|
12193
12887
|
validate(text, timestamp, id, reply, edit) {
|
|
12194
12888
|
if (this.options.peerAcceptsText?.() === false) return DHT_TEXT_REFUSED;
|
|
12889
|
+
if (this.forwardSecrecy === "stopped") return DHT_RATCHET_STOPPED;
|
|
12195
12890
|
if (!ID$3.test(id) || !Number.isSafeInteger(timestamp) || timestamp <= 0 || reply !== void 0 && !REPLY_TO.test(reply)) return "Invalid message.";
|
|
12196
12891
|
if (edit !== void 0 && (reply !== void 0 || !ID$3.test(edit[0]) || !validEditNumber(edit[1]))) return "Invalid message.";
|
|
12197
12892
|
if (utf8Encode(text).length > 256) return DHT_TEXT_TOO_LONG;
|
|
@@ -12466,10 +13161,10 @@ var DhtDelivery = class DhtDelivery {
|
|
|
12466
13161
|
for (let count = pending.length; count > 0; count--) {
|
|
12467
13162
|
const body = this.body(sequence, issued, expires, message, receipt, reply, pending.slice(0, count), edit, forwarded, file);
|
|
12468
13163
|
try {
|
|
12469
|
-
const
|
|
13164
|
+
const envelope = this.envelope(body);
|
|
12470
13165
|
if (utf8Encode(JSON.stringify([body, "x".repeat(86)])).length <= MAX_ENVELOPE_PLAINTEXT) return {
|
|
12471
13166
|
body,
|
|
12472
|
-
|
|
13167
|
+
...envelope,
|
|
12473
13168
|
reactions: count
|
|
12474
13169
|
};
|
|
12475
13170
|
} catch {}
|
|
@@ -12477,7 +13172,7 @@ var DhtDelivery = class DhtDelivery {
|
|
|
12477
13172
|
const body = this.body(sequence, issued, expires, message, receipt, reply, [], edit, forwarded, file);
|
|
12478
13173
|
return {
|
|
12479
13174
|
body,
|
|
12480
|
-
|
|
13175
|
+
...this.envelope(body),
|
|
12481
13176
|
reactions: 0
|
|
12482
13177
|
};
|
|
12483
13178
|
}
|
|
@@ -12492,10 +13187,21 @@ var DhtDelivery = class DhtDelivery {
|
|
|
12492
13187
|
if (keepAlive && (this.controlDue > now || this.state.inviteTaken)) return;
|
|
12493
13188
|
const expires = pending?.expires ?? now - 12e4 + CONTROL_TTL;
|
|
12494
13189
|
const issued = Math.min(now, Math.max(now - DHT_ISSUED_BACK_MS, expires - (pending ? DHT_MESSAGE_TTL : CONTROL_TTL), (pending?.message[1] ?? 0) - 3e4));
|
|
12495
|
-
const
|
|
13190
|
+
const identity = !reseal && this.state.peerPinned && this.state.peerPinned !== "can" && this.pinned()?.identity || this.identity;
|
|
13191
|
+
const away = !!this.options.credentials.peerKey && now - this.peerNewAt >= 6e5;
|
|
13192
|
+
const options = keepAlive && (this.live || away) ? { background: true } : void 0;
|
|
13193
|
+
const held = this.options.transport.publishHeld?.(identity.pubKeyZ32, options);
|
|
13194
|
+
if (held) {
|
|
13195
|
+
await this.heldBack(held, now, {
|
|
13196
|
+
lastPublish: this.lastPublish,
|
|
13197
|
+
controlDue: this.controlDue
|
|
13198
|
+
}, void 0, void 0);
|
|
13199
|
+
throw held;
|
|
13200
|
+
}
|
|
13201
|
+
const fittedEnvelope = this.fitted(this.sequence + 1, issued, expires, pending?.message ?? null, receipt?.id ?? null, pending?.reply, pending?.edit, pending?.forwarded, pending?.file);
|
|
13202
|
+
const { body, reactions } = fittedEnvelope;
|
|
12496
13203
|
const reactionsWereDue = this.reactionsDue;
|
|
12497
13204
|
this.reactionsDue = !reactions && !!this.options.reactions?.().length;
|
|
12498
|
-
const identity = !reseal && this.state.peerPinned && this.state.peerPinned !== "can" && this.pinned()?.identity || this.identity;
|
|
12499
13205
|
const sequence = body[1];
|
|
12500
13206
|
await this.persist({
|
|
12501
13207
|
...this.state,
|
|
@@ -12512,20 +13218,23 @@ var DhtDelivery = class DhtDelivery {
|
|
|
12512
13218
|
} : this.state.receipt
|
|
12513
13219
|
});
|
|
12514
13220
|
this.sequence = sequence;
|
|
13221
|
+
const records = await this.sealed(fittedEnvelope);
|
|
12515
13222
|
const before = {
|
|
12516
13223
|
lastPublish: this.lastPublish,
|
|
12517
13224
|
controlDue: this.controlDue
|
|
12518
13225
|
};
|
|
13226
|
+
const ownInvite = !this.options.credentials.expectedPeerKey && !this.active && this.unusedInviteAge(now) !== void 0;
|
|
12519
13227
|
this.lastPublish = now;
|
|
12520
|
-
this.controlDue = now + 24e4;
|
|
13228
|
+
this.controlDue = now + (ownInvite ? UNUSED_INVITE_UPKEEP_MS : 24e4);
|
|
12521
13229
|
traceLink(this.from, "dht-publish", {
|
|
12522
13230
|
mode: this.mode,
|
|
12523
13231
|
seq: body[1],
|
|
12524
|
-
...identity !== this.identity && { pinned: true }
|
|
13232
|
+
...identity !== this.identity && { pinned: true },
|
|
13233
|
+
...records[0]?.label === "_dr" && { ratchet: true }
|
|
12525
13234
|
});
|
|
12526
13235
|
if (pending) this.lastPublished = DhtDelivery.facts(body, records, identity.pubKeyZ32);
|
|
12527
13236
|
try {
|
|
12528
|
-
await this.options.transport.publish(identity, records,
|
|
13237
|
+
await this.options.transport.publish(identity, records, options);
|
|
12529
13238
|
} catch (error) {
|
|
12530
13239
|
this.reactionsDue ||= reactionsWereDue;
|
|
12531
13240
|
if (isDiscoveryBudgetError(error)) await this.heldBack(error, now, before, pending, receipt);
|
|
@@ -12551,7 +13260,7 @@ var DhtDelivery = class DhtDelivery {
|
|
|
12551
13260
|
this.lastPublish = before.lastPublish;
|
|
12552
13261
|
this.controlDue = Math.min(before.controlDue, at);
|
|
12553
13262
|
traceLink(this.from, "dht-publish-waits", { retryInMs: at - now });
|
|
12554
|
-
await this.persist({
|
|
13263
|
+
if (pending || receipt) await this.persist({
|
|
12555
13264
|
...this.state,
|
|
12556
13265
|
pending: pending ?? this.state.pending,
|
|
12557
13266
|
receipt: receipt ?? this.state.receipt
|
|
@@ -12562,22 +13271,44 @@ var DhtDelivery = class DhtDelivery {
|
|
|
12562
13271
|
* one sealed record, a well-formed body within its times, signed by the key it names. Null: not an envelope of the
|
|
12563
13272
|
* contact's (the pin rules are the caller's).
|
|
12564
13273
|
*/
|
|
12565
|
-
open(packet, box) {
|
|
13274
|
+
open(packet, box, ratchet) {
|
|
12566
13275
|
const address = box === "pinned" ? this.pinned()?.peerAddress : this.peerAddress;
|
|
12567
13276
|
if (!address || packet.pubKeyZ32 !== address || measureRecords(packet.pubKeyZ32, packet.records) > 1e3) return null;
|
|
12568
|
-
const records = packet.records.filter((r) => r.label === "_dm");
|
|
12569
|
-
if (records.length !== 1) return null;
|
|
13277
|
+
const records = packet.records.filter((r) => r.label === "_dm"), ratcheted = packet.records.filter((r) => r.label === "_dr");
|
|
13278
|
+
if (records.length + ratcheted.length !== 1) return null;
|
|
12570
13279
|
const hints = packet.records.filter((r) => r.label === "_dmk");
|
|
12571
13280
|
if (hints.length > 1) return null;
|
|
12572
13281
|
const sender = hints.length ? tryDecrypt(hints[0].value, this.key) : null;
|
|
12573
13282
|
if (hints.length && !sender) return null;
|
|
13283
|
+
const peer = this.options.credentials.peerKey;
|
|
12574
13284
|
let plaintext;
|
|
12575
|
-
|
|
12576
|
-
|
|
12577
|
-
|
|
12578
|
-
|
|
13285
|
+
if (ratcheted.length) {
|
|
13286
|
+
const closed = box === "invite" && sender ? { sealedToAnother: sender } : null;
|
|
13287
|
+
if (!ratchet || !peer || sender !== peer) return closed;
|
|
13288
|
+
let opened;
|
|
13289
|
+
try {
|
|
13290
|
+
opened = ratchet(fromBase64(ratcheted[0].value));
|
|
13291
|
+
} catch {
|
|
13292
|
+
opened = null;
|
|
13293
|
+
}
|
|
13294
|
+
if (!opened) return closed;
|
|
13295
|
+
try {
|
|
13296
|
+
plaintext = utf8Decode(opened);
|
|
13297
|
+
} catch {
|
|
13298
|
+
return null;
|
|
13299
|
+
}
|
|
13300
|
+
} else {
|
|
13301
|
+
if (peer && this.options.ratchet?.box.heard("floor") && (!sender || sender === peer)) {
|
|
13302
|
+
this.traceOnce("dht-plain-refused", records[0].value, { box });
|
|
13303
|
+
return null;
|
|
13304
|
+
}
|
|
13305
|
+
try {
|
|
13306
|
+
plaintext = tryDecrypt(records[0].value, sender ? this.sealedKey(sender) : this.key);
|
|
13307
|
+
} catch {
|
|
13308
|
+
plaintext = null;
|
|
13309
|
+
}
|
|
13310
|
+
if (!plaintext && sender) return { sealedToAnother: sender };
|
|
12579
13311
|
}
|
|
12580
|
-
if (!plaintext && sender) return { sealedToAnother: sender };
|
|
12581
13312
|
if (!plaintext || utf8Encode(plaintext).length > MAX_ENVELOPE_PLAINTEXT) return null;
|
|
12582
13313
|
let envelope;
|
|
12583
13314
|
try {
|
|
@@ -12657,7 +13388,41 @@ var DhtDelivery = class DhtDelivery {
|
|
|
12657
13388
|
* can write to) or `pinned`. `none`: nothing from the contact in it; `old`: the contact's, already read; `new`: taken.
|
|
12658
13389
|
*/
|
|
12659
13390
|
async receive(packet, box) {
|
|
12660
|
-
const
|
|
13391
|
+
const ratcheted = packet.records.find((r) => r.label === "_dr");
|
|
13392
|
+
if (!ratcheted) return this.take(packet, box, this.open(packet, box));
|
|
13393
|
+
const digest = toBase64Url(sha256(utf8Encode(ratcheted.value)).slice(0, 16));
|
|
13394
|
+
if (digest === this.state.lastDr) return "old";
|
|
13395
|
+
const ratchet = this.options.ratchet;
|
|
13396
|
+
if (!ratchet) return "none";
|
|
13397
|
+
let sealed;
|
|
13398
|
+
const opened = this.open(packet, box, (bytes) => {
|
|
13399
|
+
const plain = ratchet.box.peek("floor", bytes);
|
|
13400
|
+
if (plain) sealed = bytes;
|
|
13401
|
+
return plain;
|
|
13402
|
+
});
|
|
13403
|
+
if (!sealed) this.traceOnce("dht-ratchet-closed", ratcheted.value, {
|
|
13404
|
+
box,
|
|
13405
|
+
pinned: !!this.options.credentials.peerKey
|
|
13406
|
+
});
|
|
13407
|
+
if (!sealed && box === "pinned" && packet.pubKeyZ32 === this.pinned()?.peerAddress && this.state.peerPinned !== "seen") {
|
|
13408
|
+
await this.persist({
|
|
13409
|
+
...this.state,
|
|
13410
|
+
peerPinned: "seen"
|
|
13411
|
+
});
|
|
13412
|
+
traceLink(this.from, "dht-peer-pinned", {
|
|
13413
|
+
peerPinned: "seen",
|
|
13414
|
+
ratchet: true
|
|
13415
|
+
});
|
|
13416
|
+
}
|
|
13417
|
+
return this.take(packet, box, opened, sealed && {
|
|
13418
|
+
commit: async (order) => {
|
|
13419
|
+
if (!await ratchet.box.commitOpen("floor", sealed, order)) throw new Error("A ratcheted envelope no longer opens");
|
|
13420
|
+
},
|
|
13421
|
+
digest
|
|
13422
|
+
});
|
|
13423
|
+
}
|
|
13424
|
+
/** `ratchet`: the envelope was ratcheted; its state is saved once what it carried is stored, with its digest. */
|
|
13425
|
+
async take(packet, box, opened, ratchet) {
|
|
12661
13426
|
if (!opened) return "none";
|
|
12662
13427
|
if ("sealedToAnother" in opened) {
|
|
12663
13428
|
if (opened.sealedToAnother) await this.sealedToAnother(opened.sealedToAnother);
|
|
@@ -12684,6 +13449,7 @@ var DhtDelivery = class DhtDelivery {
|
|
|
12684
13449
|
if (message !== null && (!Array.isArray(message) || message.length !== 3 || typeof message[0] !== "string" || !ID$3.test(message[0]) || !Number.isSafeInteger(message[1]) || message[1] <= 0 || message[1] > issued + 3e4 || typeof message[2] !== "string" || utf8Encode(message[2]).length > 256 || expires - issued > 3e5)) return "none";
|
|
12685
13450
|
if (receipt !== null && (typeof receipt !== "string" || !ID$3.test(receipt))) return "none";
|
|
12686
13451
|
const unanswered = !this.options.credentials.peerKey && !!this.options.credentials.expectedPeerKey && !sender && !this.live;
|
|
13452
|
+
this.peerNewAt = Date.now();
|
|
12687
13453
|
await this.options.pin(author);
|
|
12688
13454
|
this.options.credentials.peerKey = author;
|
|
12689
13455
|
this.options.credentials.requireSignedSignals = true;
|
|
@@ -12727,6 +13493,7 @@ var DhtDelivery = class DhtDelivery {
|
|
|
12727
13493
|
if (peerPinned !== this.state.peerPinned) traceLink(this.from, "dht-peer-pinned", { peerPinned });
|
|
12728
13494
|
if (this.state.inviteTaken) traceLink(this.from, "invite-untaken", {});
|
|
12729
13495
|
const { inviteTaken: _taken, ...kept } = this.state;
|
|
13496
|
+
if (ratchet) await ratchet.commit(sequence);
|
|
12730
13497
|
await this.persist({
|
|
12731
13498
|
...kept,
|
|
12732
13499
|
peerSequence: sequence,
|
|
@@ -12735,6 +13502,7 @@ var DhtDelivery = class DhtDelivery {
|
|
|
12735
13502
|
confirmed,
|
|
12736
13503
|
...peerPinned && { peerPinned },
|
|
12737
13504
|
...unanswered && { unanswered: sequence },
|
|
13505
|
+
...ratchet && { lastDr: ratchet.digest },
|
|
12738
13506
|
pending: confirmed && this.state.pending?.message[0] === confirmed ? void 0 : this.state.pending,
|
|
12739
13507
|
...newest > (this.state.reactionsTaken ?? 0) && { reactionsTaken: newest }
|
|
12740
13508
|
});
|
|
@@ -12789,7 +13557,12 @@ var DhtDelivery = class DhtDelivery {
|
|
|
12789
13557
|
for (const box of boxes) {
|
|
12790
13558
|
const packet = await this.options.transport.resolve(box === "pinned" ? pinned.peerAddress : this.peerAddress, options);
|
|
12791
13559
|
reads++;
|
|
12792
|
-
const
|
|
13560
|
+
const dr = packet?.records.find((r) => r.label === "_dr");
|
|
13561
|
+
if (dr && toBase64Url(sha256(utf8Encode(dr.value)).slice(0, 16)) === this.state.lastDr) return {
|
|
13562
|
+
reads,
|
|
13563
|
+
text: null
|
|
13564
|
+
};
|
|
13565
|
+
const opened = packet && this.open(packet, box, (sealed) => this.options.ratchet?.box.peek("floor", sealed) ?? null);
|
|
12793
13566
|
if (!opened || "sealedToAnother" in opened || opened.author !== expected) continue;
|
|
12794
13567
|
const { sequence, message } = opened;
|
|
12795
13568
|
const fresh = Array.isArray(message) && typeof message[0] === "string" && ID$3.test(message[0]) && sequence > this.state.peerSequence && this.state.receipt?.id !== message[0];
|
|
@@ -12904,6 +13677,7 @@ var DhtDelivery = class DhtDelivery {
|
|
|
12904
13677
|
}
|
|
12905
13678
|
};
|
|
12906
13679
|
var DHT_TEXT_REFUSED = "Your contact's app does not accept text over the DHT. It is sent when you are live.";
|
|
13680
|
+
var DHT_RATCHET_STOPPED = "Your contact's app no longer reads protected messages over the DHT. It is sent when you are live.";
|
|
12907
13681
|
var DHT_FILE_REFUSED = "Your contact's app shows a file only once it comes. It is sent when you are live.";
|
|
12908
13682
|
var DHT_FILE_TOO_LARGE = "This file's name is too long to say over the DHT. It is sent when you are live.";
|
|
12909
13683
|
/**
|
|
@@ -12914,17 +13688,29 @@ function peekDhtMailbox(options) {
|
|
|
12914
13688
|
const refuse = async () => {
|
|
12915
13689
|
throw new Error("A peek saves nothing");
|
|
12916
13690
|
};
|
|
13691
|
+
const credentials = { ...options.credentials }, peer = credentials.peerKey;
|
|
13692
|
+
const box = options.ratchet && peer ? new RatchetBox(() => ({
|
|
13693
|
+
seed: fromBase64Url(credentials.seedB64),
|
|
13694
|
+
self: identityFromSeedB64(credentials.seedB64).pubKeyZ32,
|
|
13695
|
+
peer,
|
|
13696
|
+
rendezvous: [identityFromSeedB64(options.params.seedB64).pubKeyZ32, options.params.peerPubKeyZ32],
|
|
13697
|
+
secret: fromBase64Url(options.params.encKeyB64)
|
|
13698
|
+
}), options.ratchet, refuse) : void 0;
|
|
12917
13699
|
return new DhtDelivery({
|
|
12918
13700
|
params: options.params,
|
|
12919
13701
|
mode: "stream",
|
|
12920
13702
|
state: options.state,
|
|
12921
|
-
credentials
|
|
13703
|
+
credentials,
|
|
12922
13704
|
transport: options.transport,
|
|
12923
13705
|
save: refuse,
|
|
12924
13706
|
pin: refuse,
|
|
12925
13707
|
message: refuse,
|
|
12926
13708
|
receipt: refuse,
|
|
12927
|
-
changed: () => {}
|
|
13709
|
+
changed: () => {},
|
|
13710
|
+
...box && { ratchet: {
|
|
13711
|
+
box,
|
|
13712
|
+
peerSupports: () => true
|
|
13713
|
+
} }
|
|
12928
13714
|
}).peek(options.background ? { background: true } : void 0);
|
|
12929
13715
|
}
|
|
12930
13716
|
//#endregion
|
|
@@ -13757,6 +14543,14 @@ var TransportSwitch = class {
|
|
|
13757
14543
|
var RING_LIFETIME = 600;
|
|
13758
14544
|
var enc = base64urlnopad.encode;
|
|
13759
14545
|
var dec = base64urlnopad.decode;
|
|
14546
|
+
/** No bytes for text that is not base64url: the checks then refuse it with their own message. */
|
|
14547
|
+
var decOrEmpty = (s) => {
|
|
14548
|
+
try {
|
|
14549
|
+
return dec(s);
|
|
14550
|
+
} catch {
|
|
14551
|
+
return /* @__PURE__ */ new Uint8Array(0);
|
|
14552
|
+
}
|
|
14553
|
+
};
|
|
13760
14554
|
var hash = (s) => enc(sha256(utf8Encode(s)));
|
|
13761
14555
|
var header = enc(utf8Encode(JSON.stringify({
|
|
13762
14556
|
alg: "EdDSA",
|
|
@@ -13781,8 +14575,14 @@ function verifyRingAuthorization(authorization, statement, issuer, issuedAt, exp
|
|
|
13781
14575
|
if (typeof authorization !== "string" || authorization.length > 2400) throw new Error("Invalid Ring authorization");
|
|
13782
14576
|
const [h, p, s, ...extra] = authorization.split(".");
|
|
13783
14577
|
if (extra.length || h !== header || !p || !s) throw new Error("Unsupported Ring authorization");
|
|
13784
|
-
|
|
13785
|
-
|
|
14578
|
+
let claims;
|
|
14579
|
+
try {
|
|
14580
|
+
claims = JSON.parse(utf8Decode(dec(p)));
|
|
14581
|
+
} catch {
|
|
14582
|
+
throw new Error("Unsupported Ring authorization");
|
|
14583
|
+
}
|
|
14584
|
+
const sig = decOrEmpty(s);
|
|
14585
|
+
if (typeof claims?.cnf !== "string" || !validRingKey(claims.cnf) || expiresAt !== issuedAt + 600 || p !== enc(utf8Encode(JSON.stringify(ringClaims(statement, issuer, claims.cnf, issuedAt, expiresAt)))) || !validRingKey(issuer) || sig.length !== 64 || enc(sig) !== s || !ed25519.verify(sig, utf8Encode(h + "." + p), fromZ32(issuer), { zip215: false })) throw new Error("Ring did not authorize this exact conversation");
|
|
13786
14586
|
return claims;
|
|
13787
14587
|
}
|
|
13788
14588
|
function validRingKey(key) {
|
|
@@ -13817,7 +14617,7 @@ function ringEvidence(authorization, statement, delegatedSeed) {
|
|
|
13817
14617
|
function verifyRingEvidence(e, statement, issuer, issuedAt, expiresAt) {
|
|
13818
14618
|
if (!e || e.scheme !== "pubky-ring/1" || typeof e.signature !== "string" || e.signature.length !== 86) throw new Error("Invalid Ring proof");
|
|
13819
14619
|
const claims = verifyRingAuthorization(e.authorization, statement, issuer, issuedAt, expiresAt);
|
|
13820
|
-
const sig =
|
|
14620
|
+
const sig = decOrEmpty(e.signature);
|
|
13821
14621
|
if (enc(sig) !== e.signature || e.id !== evidenceId(e.authorization, e.signature) || !ed25519.verify(sig, possession(e.authorization, statement), fromZ32(claims.cnf), { zip215: false })) throw new Error("Invalid delegated proof of possession");
|
|
13822
14622
|
}
|
|
13823
14623
|
//#endregion
|
|
@@ -13952,7 +14752,7 @@ async function verifyPeerProof(event, c, readStorage) {
|
|
|
13952
14752
|
if (sig.length !== 64 || !verify(sig, data, fromZ32(c.externalKey))) throw new Error("Invalid Pubky signature");
|
|
13953
14753
|
} else if (c.adapter === "keet-import") {
|
|
13954
14754
|
if (sig.length !== 107 || sig[0] !== 1 || sig[41] !== 0 || sig[42] !== 1) throw new Error("Unsupported Keet attestation");
|
|
13955
|
-
const { default: IdentityKey } = await import("./keet-identity-key-
|
|
14755
|
+
const { default: IdentityKey } = await import("./keet-identity-key-Db5KY0V1.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1));
|
|
13956
14756
|
if (!IdentityKey.verify(b4a.from(sig), b4a.from(data), { expectedIdentity: b4a.from(unhex(c.externalKey)) })) throw new Error("Invalid Keet attestation");
|
|
13957
14757
|
} else throw new Error("Unsupported proof adapter");
|
|
13958
14758
|
}
|
|
@@ -14176,10 +14976,12 @@ function applyIdentityEvent(timeline, event, at) {
|
|
|
14176
14976
|
const i = lastOf(out, event.side, event.type === "result" ? [event.proof, event.requested] : [event.proof]);
|
|
14177
14977
|
const last = i >= 0 ? out[i] : void 0;
|
|
14178
14978
|
const add = (entry) => {
|
|
14179
|
-
const
|
|
14979
|
+
const prefix = `${entry.side}:${entry.proof}:`;
|
|
14980
|
+
let n = 0;
|
|
14981
|
+
for (const e of out) if (e.id.startsWith(prefix)) n = Math.max(n, Number(e.id.slice(prefix.length)) + 1 || 0);
|
|
14180
14982
|
out.push({
|
|
14181
14983
|
...entry,
|
|
14182
|
-
id: `${
|
|
14984
|
+
id: `${prefix}${n}`,
|
|
14183
14985
|
at
|
|
14184
14986
|
});
|
|
14185
14987
|
};
|
|
@@ -14384,13 +15186,19 @@ function verifyIdentityPresentation(key, sig, proofId, scope, nonce, issuedAt) {
|
|
|
14384
15186
|
}
|
|
14385
15187
|
var clean$1 = (value, max) => {
|
|
14386
15188
|
if (typeof value !== "string") return void 0;
|
|
14387
|
-
const text = value
|
|
14388
|
-
return text ? text.slice(0, max) : void 0;
|
|
15189
|
+
const text = stripHidden(value).trim();
|
|
15190
|
+
return text && hasVisible(text) ? text.slice(0, max) : void 0;
|
|
14389
15191
|
};
|
|
15192
|
+
/**
|
|
15193
|
+
* Room for a line that names a domain (up to 253 characters) once or twice: a How line or a reason cut inside the name
|
|
15194
|
+
* names a record that does not exist, and the app no longer knows the reason to say it in the person's language.
|
|
15195
|
+
*/
|
|
15196
|
+
var SOURCE_MAX = 640;
|
|
15197
|
+
var ERROR_MAX = 512;
|
|
14390
15198
|
/** Bounds a provider's result so a buggy provider cannot store or show arbitrary data. */
|
|
14391
15199
|
function boundVerifiedIdentity(v) {
|
|
14392
15200
|
if (!v || typeof v.subject !== "string" || !IDENTITY_SUBJECT.test(v.subject)) throw new Error("Provider returned an invalid subject");
|
|
14393
|
-
const source = clean$1(v.source,
|
|
15201
|
+
const source = clean$1(v.source, SOURCE_MAX);
|
|
14394
15202
|
if (!source) throw new Error("Provider did not say how it verified");
|
|
14395
15203
|
const out = {
|
|
14396
15204
|
subject: v.subject,
|
|
@@ -14444,7 +15252,10 @@ function receivedWithRoom(received, id, replaced, now) {
|
|
|
14444
15252
|
const out = kept.filter((r) => !drop.has(r));
|
|
14445
15253
|
return out.length < 16 ? out : void 0;
|
|
14446
15254
|
}
|
|
14447
|
-
var
|
|
15255
|
+
var REVOKED = "Its owner revoked this proof";
|
|
15256
|
+
/** Revoked is final: a later lookup that fails or finds nothing (the relays forgot it) does not undo it. */
|
|
15257
|
+
var revokedHere = (received, id) => received.some((r) => r.id === id && r.status === "revoked");
|
|
15258
|
+
var shortError = (e) => clean$1(e instanceof Error ? e.message : String(e), ERROR_MAX) ?? "Invalid proof";
|
|
14448
15259
|
/**
|
|
14449
15260
|
* A check this side could not finish because of what its own network did: a host it refused to contact, a server
|
|
14450
15261
|
* that did not answer or answered an error. The message is for this side only. The contact is told the proof could
|
|
@@ -14605,54 +15416,60 @@ var IdentityExchange = class {
|
|
|
14605
15416
|
const r = this.options.storage.read().received.find((x) => x.id === id);
|
|
14606
15417
|
if (!r) throw new Error("Unknown identity");
|
|
14607
15418
|
if (r.status === "revoked") return r;
|
|
14608
|
-
|
|
14609
|
-
|
|
14610
|
-
|
|
14611
|
-
|
|
14612
|
-
|
|
14613
|
-
|
|
14614
|
-
|
|
14615
|
-
|
|
14616
|
-
|
|
14617
|
-
|
|
14618
|
-
|
|
14619
|
-
|
|
14620
|
-
|
|
14621
|
-
type: "stopped",
|
|
14622
|
-
side: "theirs",
|
|
14623
|
-
proof: id,
|
|
14624
|
-
provider: r.binding.provider,
|
|
14625
|
-
subject: r.verified.subject,
|
|
14626
|
-
reason: "revoked"
|
|
14627
|
-
}));
|
|
14628
|
-
return next;
|
|
14629
|
-
}
|
|
15419
|
+
if (await this.options.revoked?.(identityStatement(r.binding)).catch(() => false)) return await this.settleRecheck(id, (x) => x.status === "revoked" ? x : {
|
|
15420
|
+
...x,
|
|
15421
|
+
status: "revoked",
|
|
15422
|
+
checkedAt: this.now(),
|
|
15423
|
+
error: void 0
|
|
15424
|
+
}, {
|
|
15425
|
+
type: "stopped",
|
|
15426
|
+
side: "theirs",
|
|
15427
|
+
proof: id,
|
|
15428
|
+
provider: r.binding.provider,
|
|
15429
|
+
subject: r.verified.subject,
|
|
15430
|
+
reason: "revoked"
|
|
15431
|
+
}) ?? r;
|
|
14630
15432
|
if (revocationOnly) return r;
|
|
15433
|
+
let outcome;
|
|
14631
15434
|
try {
|
|
14632
15435
|
const verified = boundVerifiedIdentity(await this.options.verify(identityStatement(r.binding), r.evidence));
|
|
14633
15436
|
if (verified.subject !== r.verified.subject) throw new Error("The identity changed");
|
|
14634
|
-
|
|
14635
|
-
...
|
|
15437
|
+
outcome = (x) => ({
|
|
15438
|
+
...x,
|
|
14636
15439
|
verified: {
|
|
14637
15440
|
...verified,
|
|
14638
|
-
display: verified.display ??
|
|
15441
|
+
display: verified.display ?? x.verified.display
|
|
14639
15442
|
},
|
|
14640
15443
|
checkedAt: this.now(),
|
|
14641
|
-
status:
|
|
15444
|
+
status: "verified",
|
|
14642
15445
|
error: void 0
|
|
14643
|
-
};
|
|
15446
|
+
});
|
|
14644
15447
|
} catch (e) {
|
|
14645
|
-
|
|
14646
|
-
|
|
15448
|
+
const error = shortError(e);
|
|
15449
|
+
outcome = (x) => ({
|
|
15450
|
+
...x,
|
|
14647
15451
|
checkedAt: this.now(),
|
|
14648
|
-
status:
|
|
14649
|
-
error
|
|
14650
|
-
};
|
|
15452
|
+
status: "unconfirmed",
|
|
15453
|
+
error
|
|
15454
|
+
});
|
|
14651
15455
|
}
|
|
14652
|
-
await this.
|
|
14653
|
-
...
|
|
14654
|
-
|
|
14655
|
-
}));
|
|
15456
|
+
return await this.settleRecheck(id, (x) => x.status === "revoked" ? x : x.status === "withdrawn" ? {
|
|
15457
|
+
...outcome(x),
|
|
15458
|
+
status: "withdrawn"
|
|
15459
|
+
} : outcome(x)) ?? r;
|
|
15460
|
+
}
|
|
15461
|
+
async settleRecheck(id, outcome, event) {
|
|
15462
|
+
let next;
|
|
15463
|
+
await this.options.storage.update((l) => {
|
|
15464
|
+
const x = l.received.find((y) => y.id === id);
|
|
15465
|
+
if (!x) return l;
|
|
15466
|
+
next = outcome(x);
|
|
15467
|
+
const out = {
|
|
15468
|
+
...l,
|
|
15469
|
+
received: l.received.map((y) => y.id === id ? next : y)
|
|
15470
|
+
};
|
|
15471
|
+
return event && x.status !== "revoked" ? this.log(out, event) : out;
|
|
15472
|
+
});
|
|
14656
15473
|
return next;
|
|
14657
15474
|
}
|
|
14658
15475
|
async receive(frame) {
|
|
@@ -14669,7 +15486,7 @@ var IdentityExchange = class {
|
|
|
14669
15486
|
case "idp-result": {
|
|
14670
15487
|
const s = id ? this.shared(id) : void 0;
|
|
14671
15488
|
if (!s || s.status !== "pending") return;
|
|
14672
|
-
const error = frame.ok === true ? void 0 : clean$1(frame.error,
|
|
15489
|
+
const error = frame.ok === true ? void 0 : clean$1(frame.error, ERROR_MAX) ?? "Your contact could not verify it";
|
|
14673
15490
|
await this.setShared({
|
|
14674
15491
|
...s,
|
|
14675
15492
|
status: frame.ok === true ? "accepted" : "rejected",
|
|
@@ -14687,7 +15504,7 @@ var IdentityExchange = class {
|
|
|
14687
15504
|
case "idp-withdraw": {
|
|
14688
15505
|
if (!id) return;
|
|
14689
15506
|
const r = this.options.storage.read().received.find((x) => x.id === id);
|
|
14690
|
-
if (r && r.status !== "withdrawn") await this.options.storage.update((l) => this.log({
|
|
15507
|
+
if (r && r.status !== "withdrawn" && r.status !== "revoked") await this.options.storage.update((l) => this.log({
|
|
14691
15508
|
...l,
|
|
14692
15509
|
received: l.received.map((x) => x.id === id ? {
|
|
14693
15510
|
...x,
|
|
@@ -14815,13 +15632,14 @@ var IdentityExchange = class {
|
|
|
14815
15632
|
let reason;
|
|
14816
15633
|
try {
|
|
14817
15634
|
const mayReplace = (r) => r.binding.provider === binding.provider && (r.binding.subject === binding.subject || r.verified.subject === binding.subject);
|
|
15635
|
+
if (revokedHere(this.options.storage.read().received, id)) throw new Error(REVOKED);
|
|
14818
15636
|
if (!receivedWithRoom(this.options.storage.read().received, id, mayReplace, now)) throw new Error(TOO_MANY_RECEIVED);
|
|
14819
15637
|
if (JSON.stringify(evidence ?? null).length > 16384) throw new Error("Evidence too large");
|
|
14820
15638
|
if (!verifyIdentityPresentation(binding.key, sig, id, scope, nonce, issuedAt)) throw new Error("The proof key did not sign this conversation's challenge");
|
|
14821
15639
|
if (binding.issuedAt > now + 300) throw new Error("The proof is dated in the future");
|
|
14822
15640
|
const result = boundVerifiedIdentity(await this.options.verify(statement, evidence));
|
|
14823
15641
|
if (Math.min(binding.expiresAt, result.expiresAt ?? Infinity) <= now) throw new Error("The proof has expired");
|
|
14824
|
-
if (await this.options.revoked?.(statement).catch(() => false)) throw new Error(
|
|
15642
|
+
if (await this.options.revoked?.(statement).catch(() => false)) throw new Error(REVOKED);
|
|
14825
15643
|
verified = result;
|
|
14826
15644
|
} catch (e) {
|
|
14827
15645
|
error = peerError(e);
|
|
@@ -14832,6 +15650,10 @@ var IdentityExchange = class {
|
|
|
14832
15650
|
if (!challenge) throw new Error("Unknown or reused identity challenge");
|
|
14833
15651
|
const challenges = l.challenges.filter((c) => c.nonce !== nonce);
|
|
14834
15652
|
const subject = verified?.subject;
|
|
15653
|
+
if (verified && revokedHere(l.received, id)) {
|
|
15654
|
+
verified = void 0;
|
|
15655
|
+
error = reason = REVOKED;
|
|
15656
|
+
}
|
|
14835
15657
|
const received = verified && receivedWithRoom(l.received, id, (r) => r.binding.provider === binding.provider && r.verified.subject === subject, now);
|
|
14836
15658
|
if (verified && !received) {
|
|
14837
15659
|
verified = void 0;
|
|
@@ -15286,17 +16108,23 @@ var CapsExchange = class {
|
|
|
15286
16108
|
return;
|
|
15287
16109
|
}
|
|
15288
16110
|
if (due) {
|
|
16111
|
+
const options = changed || unpublished ? void 0 : { background: true };
|
|
16112
|
+
const held = this.options.transport.publishHeld?.(this.keys.identity.pubKeyZ32, options);
|
|
16113
|
+
if (held) {
|
|
16114
|
+
this.schedule(budgetRetryMs(held, 1e3, 6e4));
|
|
16115
|
+
throw held;
|
|
16116
|
+
}
|
|
15289
16117
|
const rev = changed ? this.state.rev + 1 : this.state.rev;
|
|
15290
16118
|
const { records, dropped } = this.keys.seal(content, rev, peerKey, now);
|
|
15291
16119
|
this.dropped = dropped;
|
|
15292
|
-
await this.persist({
|
|
16120
|
+
if (!(rev === this.state.rev && digest === this.state.digest && peerKey === this.state.sealedFor && this.state.publishedAt === void 0)) await this.persist({
|
|
15293
16121
|
rev,
|
|
15294
16122
|
digest,
|
|
15295
16123
|
sealedFor: peerKey,
|
|
15296
16124
|
publishedAt: void 0
|
|
15297
16125
|
});
|
|
15298
16126
|
try {
|
|
15299
|
-
await this.options.transport.publish(this.keys.identity, records,
|
|
16127
|
+
await this.options.transport.publish(this.keys.identity, records, options);
|
|
15300
16128
|
} catch (error) {
|
|
15301
16129
|
this.schedule(isDiscoveryBudgetError(error) ? budgetRetryMs(error, 1e3, 6e4) : 6e4);
|
|
15302
16130
|
throw error;
|
|
@@ -15591,14 +16419,15 @@ function parseDomainTxt(value) {
|
|
|
15591
16419
|
var addRecord = (list, r) => {
|
|
15592
16420
|
if (!list.some((x) => x.key === r.key && x.proof === r.proof)) list.push(r);
|
|
15593
16421
|
};
|
|
15594
|
-
/** All records among the TXT strings of `_ghostly.<domain>`; other strings are skipped.
|
|
16422
|
+
/** All records among the first 32 TXT strings of `_ghostly.<domain>`; other strings are skipped. A TXT set has
|
|
16423
|
+
* no order, so every record is kept: the one a proof needs may come in any position. */
|
|
15595
16424
|
function recordsFromTxt(values) {
|
|
15596
16425
|
const out = [];
|
|
15597
16426
|
for (const value of values.slice(0, 32)) {
|
|
15598
16427
|
const r = parseDomainTxt(value);
|
|
15599
16428
|
if (r) addRecord(out, r);
|
|
15600
16429
|
}
|
|
15601
|
-
return out
|
|
16430
|
+
return out;
|
|
15602
16431
|
}
|
|
15603
16432
|
/** The body of `/.well-known/ghostly.json`. */
|
|
15604
16433
|
function domainWellKnownFile(records) {
|
|
@@ -15615,7 +16444,7 @@ function parseJson(text) {
|
|
|
15615
16444
|
if (typeof text !== "string" || utf8Encode(text).length > 16384) throw new Error("File too large");
|
|
15616
16445
|
return JSON.parse(text);
|
|
15617
16446
|
}
|
|
15618
|
-
/** Records from `ghostly.json`. Throws on a malformed file; [] when it names none. */
|
|
16447
|
+
/** Records from the first 32 entries of `ghostly.json`. Throws on a malformed file; [] when it names none. */
|
|
15619
16448
|
function recordsFromWellKnown(text) {
|
|
15620
16449
|
const body = parseJson(text);
|
|
15621
16450
|
if (!body || typeof body !== "object" || Array.isArray(body) || body.ghostly !== 1 || !Array.isArray(body.proofs)) throw new Error("Not a Ghostly domain file");
|
|
@@ -15628,7 +16457,7 @@ function recordsFromWellKnown(text) {
|
|
|
15628
16457
|
};
|
|
15629
16458
|
if (validDomainRecord(r)) addRecord(out, r);
|
|
15630
16459
|
}
|
|
15631
|
-
return out
|
|
16460
|
+
return out;
|
|
15632
16461
|
}
|
|
15633
16462
|
/** NIP-05: only the root name `_` speaks for the domain itself. Undefined when absent. */
|
|
15634
16463
|
function nip05RootKey(text) {
|
|
@@ -15811,9 +16640,13 @@ var SIG$3 = /^[A-Za-z0-9_-]{86}$/;
|
|
|
15811
16640
|
var MAGIC$1 = utf8Encode("GHLD");
|
|
15812
16641
|
var VERSION = 1;
|
|
15813
16642
|
var NONCE$2 = 24;
|
|
16643
|
+
/** A bundle sealed by the chat's ratchet (WISP 4xx § Held items). */
|
|
16644
|
+
var RATCHETED = 2;
|
|
15814
16645
|
/** Why a bundle, manifest or pointer was refused. Never a reason to trust it a little. */
|
|
15815
16646
|
var HoldRefusedError = class extends Error {
|
|
15816
16647
|
reason;
|
|
16648
|
+
/** The bytes the chat's ratchet opened, when it opened them before the item was refused: the caller commits them. */
|
|
16649
|
+
ratcheted;
|
|
15817
16650
|
constructor(reason, message) {
|
|
15818
16651
|
super(message);
|
|
15819
16652
|
this.reason = reason;
|
|
@@ -15853,6 +16686,19 @@ var HoldKeys = class {
|
|
|
15853
16686
|
}
|
|
15854
16687
|
/** Seals one item for the contact: signed with my participation key, encrypted to our shared key. */
|
|
15855
16688
|
seal(item, body) {
|
|
16689
|
+
const nonce = randomBytes(NONCE$2);
|
|
16690
|
+
const box = xsalsa20poly1305(this.sealKey, nonce).encrypt(this.inner(item, body));
|
|
16691
|
+
return concatBytes(MAGIC$1, new Uint8Array([VERSION]), nonce, box);
|
|
16692
|
+
}
|
|
16693
|
+
/**
|
|
16694
|
+
* The same item as a version-2 bundle (WISP 4xx § Held items): the same plaintext, sealed by the chat's ratchet
|
|
16695
|
+
* (`seal`, which saves the ratchet's state before it returns), so the bundle can be uploaded once this returns.
|
|
16696
|
+
*/
|
|
16697
|
+
async sealRatcheted(item, body, seal) {
|
|
16698
|
+
return concatBytes(MAGIC$1, new Uint8Array([RATCHETED]), await seal(this.inner(item, body)));
|
|
16699
|
+
}
|
|
16700
|
+
/** What a bundle seals: the header's length, the signed header, the body. */
|
|
16701
|
+
inner(item, body) {
|
|
15856
16702
|
const fields = [
|
|
15857
16703
|
VERSION,
|
|
15858
16704
|
this.from,
|
|
@@ -15872,26 +16718,51 @@ var HoldKeys = class {
|
|
|
15872
16718
|
const header = utf8Encode(JSON.stringify([fields, signature]));
|
|
15873
16719
|
const length = /* @__PURE__ */ new Uint8Array(4);
|
|
15874
16720
|
new DataView(length.buffer).setUint32(0, header.length);
|
|
15875
|
-
|
|
15876
|
-
const box = xsalsa20poly1305(this.sealKey, nonce).encrypt(concatBytes(length, header, body));
|
|
15877
|
-
return concatBytes(MAGIC$1, new Uint8Array([VERSION]), nonce, box);
|
|
16721
|
+
return concatBytes(length, header, body);
|
|
15878
16722
|
}
|
|
15879
16723
|
/**
|
|
15880
16724
|
* Opens a bundle the contact sealed for me. Everything is checked before anything is returned: the
|
|
15881
16725
|
* authenticated encryption, the header's shape, that it names this link, this contact and me, the
|
|
15882
16726
|
* signature, the body digest and the limits of its kind. `loopback`: see `isHoldUrl`.
|
|
15883
16727
|
*/
|
|
16728
|
+
/**
|
|
16729
|
+
* `ratchet`: opens a version-2 bundle's sealed bytes (WISP 4xx), without keeping anything; absent, one is from a newer
|
|
16730
|
+
* Ghostly. `refusePlain`: a ratcheted item from this contact opened here, so a version-1 item other than the manifest is
|
|
16731
|
+
* refused (WISP 4xx § Downgrade). `ratcheted` in the result: the bytes the ratchet opened, for the caller to commit once
|
|
16732
|
+
* the item is stored.
|
|
16733
|
+
*/
|
|
15884
16734
|
open(bytes, expect = {}) {
|
|
15885
16735
|
const now = expect.now ?? Date.now();
|
|
15886
16736
|
if (bytes.length > (expect.maxBytes ?? HOLD_LIMITS.maxBundleBytes)) throw new HoldRefusedError("size", "The held item is larger than allowed");
|
|
15887
|
-
if (bytes.length < MAGIC$1.length + 1 +
|
|
15888
|
-
|
|
15889
|
-
|
|
16737
|
+
if (bytes.length < MAGIC$1.length + 1 + 16 + 4 || !MAGIC$1.every((b, i) => bytes[i] === b)) throw new HoldRefusedError("format", "Not a held item");
|
|
16738
|
+
const version = bytes[MAGIC$1.length];
|
|
16739
|
+
if (version !== VERSION && (version !== RATCHETED || !expect.ratchet)) throw new HoldRefusedError("format", "Held item from a newer Ghostly");
|
|
16740
|
+
let plain, ratcheted;
|
|
16741
|
+
if (version === RATCHETED) {
|
|
16742
|
+
ratcheted = bytes.subarray(MAGIC$1.length + 1);
|
|
16743
|
+
try {
|
|
16744
|
+
plain = expect.ratchet(ratcheted);
|
|
16745
|
+
} catch {
|
|
16746
|
+
plain = null;
|
|
16747
|
+
}
|
|
16748
|
+
if (!plain) throw new HoldRefusedError("tampered", "The held item was changed, is not for this chat, or was opened already");
|
|
16749
|
+
} else {
|
|
16750
|
+
if (bytes.length < MAGIC$1.length + 1 + NONCE$2 + 16 + 4) throw new HoldRefusedError("format", "Not a held item");
|
|
16751
|
+
try {
|
|
16752
|
+
plain = xsalsa20poly1305(this.sealKey, bytes.subarray(MAGIC$1.length + 1, MAGIC$1.length + 1 + NONCE$2)).decrypt(bytes.subarray(MAGIC$1.length + 1 + NONCE$2));
|
|
16753
|
+
} catch {
|
|
16754
|
+
throw new HoldRefusedError("tampered", "The held item was changed or is not for this chat");
|
|
16755
|
+
}
|
|
16756
|
+
}
|
|
15890
16757
|
try {
|
|
15891
|
-
|
|
15892
|
-
} catch {
|
|
15893
|
-
|
|
16758
|
+
return this.read(plain, ratcheted, expect, now);
|
|
16759
|
+
} catch (error) {
|
|
16760
|
+
if (error instanceof HoldRefusedError && ratcheted) error.ratcheted = ratcheted;
|
|
16761
|
+
throw error;
|
|
15894
16762
|
}
|
|
16763
|
+
}
|
|
16764
|
+
/** The checks of `open` once the bundle is decrypted. */
|
|
16765
|
+
read(plain, ratcheted, expect, now) {
|
|
15895
16766
|
if (plain.length < 4) throw new HoldRefusedError("format", "Not a held item");
|
|
15896
16767
|
const headerLength = new DataView(plain.buffer, plain.byteOffset, 4).getUint32(0);
|
|
15897
16768
|
if (headerLength > 131072 || 4 + headerLength > plain.length) throw new HoldRefusedError("format", "Not a held item");
|
|
@@ -15933,10 +16804,12 @@ var HoldKeys = class {
|
|
|
15933
16804
|
digest,
|
|
15934
16805
|
expires
|
|
15935
16806
|
};
|
|
16807
|
+
if (!ratcheted && expect.refusePlain && kind !== "manifest") throw new HoldRefusedError("plain", "The held item was sealed without forward secrecy, which this chat no longer takes");
|
|
15936
16808
|
checkKind(header, body, expect.loopback);
|
|
15937
16809
|
return {
|
|
15938
16810
|
header,
|
|
15939
|
-
body
|
|
16811
|
+
body,
|
|
16812
|
+
...ratcheted && { ratcheted }
|
|
15940
16813
|
};
|
|
15941
16814
|
}
|
|
15942
16815
|
/** My pointer, as records to publish under `identity`. Throws when it cannot fit a packet. */
|
|
@@ -16693,7 +17566,7 @@ var APP_RATE_LIMIT = 50;
|
|
|
16693
17566
|
var APP_RATE_WINDOW_MS = 1e3;
|
|
16694
17567
|
/** Data frames a sender sends per app per window: under the receiver's limit, so an `open` or `close` always fits. */
|
|
16695
17568
|
var APP_SEND_LIMIT = 48;
|
|
16696
|
-
/** Distinct apps the peer may have open on one session; an `open` for one more is dropped. */
|
|
17569
|
+
/** Distinct apps the peer may have open on one session, held ones counted; an `open` for one more is dropped. */
|
|
16697
17570
|
var APP_PEER_OPEN_MAX = 16;
|
|
16698
17571
|
/** The longest version an `open` carries. */
|
|
16699
17572
|
var APP_VERSION_MAX = 64;
|
|
@@ -16852,7 +17725,10 @@ var AppSessions = class {
|
|
|
16852
17725
|
open;
|
|
16853
17726
|
now;
|
|
16854
17727
|
peer = /* @__PURE__ */ new Map();
|
|
16855
|
-
/**
|
|
17728
|
+
/**
|
|
17729
|
+
* What the peer had open on a session that ended, until it says so again: each with its version and the time its
|
|
17730
|
+
* grace ends, counted from the suspension that took it from the peer.
|
|
17731
|
+
*/
|
|
16856
17732
|
held = /* @__PURE__ */ new Map();
|
|
16857
17733
|
received = new RateWindows(50, 64);
|
|
16858
17734
|
sent = new RateWindows(48, 64);
|
|
@@ -16886,7 +17762,7 @@ var AppSessions = class {
|
|
|
16886
17762
|
app,
|
|
16887
17763
|
o: "close"
|
|
16888
17764
|
} : null;
|
|
16889
|
-
if (!this.peer.has(app) && this.peer.size >= 16) return null;
|
|
17765
|
+
if (!this.peer.has(app) && !this.held.has(app) && this.peer.size + this.held.size >= 16) return null;
|
|
16890
17766
|
this.held.delete(app);
|
|
16891
17767
|
this.peer.set(app, parsed.v);
|
|
16892
17768
|
return {
|
|
@@ -16921,10 +17797,14 @@ var AppSessions = class {
|
|
|
16921
17797
|
/**
|
|
16922
17798
|
* The session ended or was replaced, and another may follow at once: what the peer had open is held, not closed (no
|
|
16923
17799
|
* event now). Nothing is sent to a held app; an `open` on the next session takes it back, a `close` closes it, and
|
|
16924
|
-
* `heldExpired` closes the rest once `
|
|
17800
|
+
* `heldExpired` closes the rest once `graceMs` has passed since the suspension that held each.
|
|
16925
17801
|
*/
|
|
16926
|
-
sessionSuspended() {
|
|
16927
|
-
|
|
17802
|
+
sessionSuspended(graceMs = APP_RESUME_GRACE_MS) {
|
|
17803
|
+
const until = this.now() + graceMs;
|
|
17804
|
+
for (const [app, version] of this.peer) this.held.set(app, {
|
|
17805
|
+
version,
|
|
17806
|
+
until
|
|
17807
|
+
});
|
|
16928
17808
|
this.peer.clear();
|
|
16929
17809
|
this.received.clear();
|
|
16930
17810
|
this.sent.clear();
|
|
@@ -16933,14 +17813,23 @@ var AppSessions = class {
|
|
|
16933
17813
|
get holding() {
|
|
16934
17814
|
return this.held.size > 0;
|
|
16935
17815
|
}
|
|
16936
|
-
/**
|
|
17816
|
+
/** When the next held app's grace ends; undefined when none is held. */
|
|
17817
|
+
get heldUntil() {
|
|
17818
|
+
let first;
|
|
17819
|
+
for (const { until } of this.held.values()) if (first === void 0 || until < first) first = until;
|
|
17820
|
+
return first;
|
|
17821
|
+
}
|
|
17822
|
+
/** Each app held whose grace is over is closed, with `offline`; the ones held later keep theirs. */
|
|
16937
17823
|
heldExpired() {
|
|
16938
|
-
const
|
|
16939
|
-
|
|
16940
|
-
|
|
16941
|
-
|
|
16942
|
-
|
|
16943
|
-
|
|
17824
|
+
const now = this.now(), closed = [];
|
|
17825
|
+
for (const [app, { until }] of this.held) if (until <= now) {
|
|
17826
|
+
this.held.delete(app);
|
|
17827
|
+
closed.push({
|
|
17828
|
+
app,
|
|
17829
|
+
o: "close",
|
|
17830
|
+
offline: true
|
|
17831
|
+
});
|
|
17832
|
+
}
|
|
16944
17833
|
return closed;
|
|
16945
17834
|
}
|
|
16946
17835
|
};
|
|
@@ -18146,6 +19035,12 @@ var FILE_LIMITS = {
|
|
|
18146
19035
|
autoAcceptBytesPerPeer: 524288e3,
|
|
18147
19036
|
/** Offers from one contact waiting for an answer here. */
|
|
18148
19037
|
maxWaitingOffers: 16,
|
|
19038
|
+
/**
|
|
19039
|
+
* Files from one contact not finished here, whatever their state (asked about, taken and waiting their turn, paused,
|
|
19040
|
+
* arriving). Only bytes were counted before: offers of 0 bytes were each taken, and 2,500 of them were 2,500
|
|
19041
|
+
* messages and records waiting for good.
|
|
19042
|
+
*/
|
|
19043
|
+
maxUnfinishedIncoming: 256,
|
|
18149
19044
|
/** Files one contact sends at once; accepted ones beyond wait their turn. */
|
|
18150
19045
|
maxActiveIncoming: 3,
|
|
18151
19046
|
/** An offer nobody answered ends after this long. */
|
|
@@ -18197,6 +19092,15 @@ var FINAL = /* @__PURE__ */ new Set([
|
|
|
18197
19092
|
]);
|
|
18198
19093
|
var transferEnded = (record) => FINAL.has(record.state);
|
|
18199
19094
|
/**
|
|
19095
|
+
* Whether a file sent from here arrived whole (the receiver confirmed every byte, and may be checking it): too late
|
|
19096
|
+
* for its person to cancel. The receiver's check comes before a `pf-abort` behind it, so it would keep the file while
|
|
19097
|
+
* the sender said it was cancelled. Not once the receiver asks about it again (`asking`), nor paused here.
|
|
19098
|
+
*/
|
|
19099
|
+
function sentWhole(record) {
|
|
19100
|
+
if (record.direction !== "out" || transferEnded(record)) return false;
|
|
19101
|
+
return record.state === "verifying" || record.file.size > 0 && record.confirmed === record.file.size && record.state !== "asking" && record.state !== "paused";
|
|
19102
|
+
}
|
|
19103
|
+
/**
|
|
18200
19104
|
* Whether an unfinished transfer is stuck, so its person is offered to push it: "Send again" (sending) or "Ask again"
|
|
18201
19105
|
* (receiving). `movedAt` is when its bytes last moved, `restored` that it has not moved since the app started. What
|
|
18202
19106
|
* waits for a person (an answer, a pause) is not stuck, and a failed one has its own "Retry".
|
|
@@ -18583,6 +19487,16 @@ var ChatFiles = class {
|
|
|
18583
19487
|
if (entry.record.direction === "out") this.announce(entry);
|
|
18584
19488
|
else if (entry.record.state === "queued") this.startIncoming(entry);
|
|
18585
19489
|
else if (entry.record.state === "active") this.armNudge(entry);
|
|
19490
|
+
else if (entry.record.state === "paused" && entry.record.pausedBy === "peer") this.send({
|
|
19491
|
+
t: "pf-accept",
|
|
19492
|
+
id: entry.record.id,
|
|
19493
|
+
offset: entry.in.written
|
|
19494
|
+
});
|
|
19495
|
+
else if (entry.record.state === "asking") this.send({
|
|
19496
|
+
t: "pf-wait",
|
|
19497
|
+
id: entry.record.id,
|
|
19498
|
+
why: "consent"
|
|
19499
|
+
});
|
|
18586
19500
|
}
|
|
18587
19501
|
}
|
|
18588
19502
|
/** The session went: nothing moves until the next one. What was received is made durable. */
|
|
@@ -18604,7 +19518,11 @@ var ChatFiles = class {
|
|
|
18604
19518
|
if (entry.in && !transferEnded(entry.record)) this.checkpoint(entry);
|
|
18605
19519
|
}
|
|
18606
19520
|
}
|
|
18607
|
-
/**
|
|
19521
|
+
/**
|
|
19522
|
+
* Offers ended by their time to live. The host calls it now and then; `attach` does too. A file taken here and waiting
|
|
19523
|
+
* its turn ends too once nothing of it arrived in that time: its sender never sent it. Offered again, it is taken
|
|
19524
|
+
* again (`retakeAgreed`).
|
|
19525
|
+
*/
|
|
18608
19526
|
sweep() {
|
|
18609
19527
|
const now = this.now();
|
|
18610
19528
|
for (const entry of this.entries.values()) {
|
|
@@ -18614,12 +19532,15 @@ var ChatFiles = class {
|
|
|
18614
19532
|
"offered",
|
|
18615
19533
|
"asking"
|
|
18616
19534
|
].includes(record.state) || record.since + FILE_LIMITS.offerTtlMs > now) continue;
|
|
18617
|
-
if (record.direction === "in" && record.state === "queued") continue;
|
|
19535
|
+
if (record.direction === "in" && record.state === "queued" && (entry.in?.starting || this.moved(entry) > 0)) continue;
|
|
18618
19536
|
this.end(entry, "failed", record.direction === "in" ? "The offer expired" : record.state === "queued" ? "Not delivered in time" : "Not accepted in time");
|
|
18619
|
-
|
|
19537
|
+
this.send(record.direction === "in" ? {
|
|
18620
19538
|
t: "pf-refuse",
|
|
18621
19539
|
id: record.id,
|
|
18622
19540
|
why: "expired"
|
|
19541
|
+
} : {
|
|
19542
|
+
t: "pf-abort",
|
|
19543
|
+
id: record.id
|
|
18623
19544
|
});
|
|
18624
19545
|
}
|
|
18625
19546
|
}
|
|
@@ -18835,6 +19756,9 @@ var ChatFiles = class {
|
|
|
18835
19756
|
waitingOffers() {
|
|
18836
19757
|
return [...this.entries.values()].filter((e) => e.record.direction === "in" && e.record.state === "asking").length;
|
|
18837
19758
|
}
|
|
19759
|
+
unfinishedIncoming() {
|
|
19760
|
+
return [...this.entries.values()].filter((e) => e.record.direction === "in" && !transferEnded(e.record)).length;
|
|
19761
|
+
}
|
|
18838
19762
|
activeIncoming(except) {
|
|
18839
19763
|
return [...this.entries.values()].filter((e) => e !== except && e.record.direction === "in" && (e.record.state === "active" || e.record.state === "verifying" || e.in?.starting)).length;
|
|
18840
19764
|
}
|
|
@@ -19023,7 +19947,7 @@ var ChatFiles = class {
|
|
|
19023
19947
|
this.startIncoming(existing);
|
|
19024
19948
|
return;
|
|
19025
19949
|
}
|
|
19026
|
-
if (this.waitingOffers() >= FILE_LIMITS.maxWaitingOffers) {
|
|
19950
|
+
if (this.waitingOffers() >= FILE_LIMITS.maxWaitingOffers || this.unfinishedIncoming() >= FILE_LIMITS.maxUnfinishedIncoming) {
|
|
19027
19951
|
this.send({
|
|
19028
19952
|
t: "pf-refuse",
|
|
19029
19953
|
id,
|
|
@@ -19082,6 +20006,14 @@ var ChatFiles = class {
|
|
|
19082
20006
|
*/
|
|
19083
20007
|
async retakeAgreed(entry) {
|
|
19084
20008
|
const { record } = entry;
|
|
20009
|
+
if (this.unfinishedIncoming() >= FILE_LIMITS.maxUnfinishedIncoming) {
|
|
20010
|
+
this.send({
|
|
20011
|
+
t: "pf-refuse",
|
|
20012
|
+
id: record.id,
|
|
20013
|
+
why: "too-many"
|
|
20014
|
+
});
|
|
20015
|
+
return false;
|
|
20016
|
+
}
|
|
19085
20017
|
if (!record.consented) {
|
|
19086
20018
|
let decision;
|
|
19087
20019
|
try {
|
|
@@ -19346,7 +20278,8 @@ var ChatFiles = class {
|
|
|
19346
20278
|
return;
|
|
19347
20279
|
}
|
|
19348
20280
|
if (!outgoing || transferEnded(outgoing.record)) {
|
|
19349
|
-
|
|
20281
|
+
const asked = frame.t === "pf-accept" || frame.t === "pf-wait";
|
|
20282
|
+
if (outgoing?.record.state === "cancelled" ? frame.t !== "pf-refuse" : asked && outgoing?.record.state !== "done") this.send({
|
|
19350
20283
|
t: "pf-abort",
|
|
19351
20284
|
id
|
|
19352
20285
|
});
|
|
@@ -19452,6 +20385,7 @@ var ChatFiles = class {
|
|
|
19452
20385
|
if (entry.record.state !== "asking") return;
|
|
19453
20386
|
entry.record.state = "queued";
|
|
19454
20387
|
entry.record.consented = entry.record.agreed = true;
|
|
20388
|
+
entry.record.since = this.now();
|
|
19455
20389
|
this.changed(entry);
|
|
19456
20390
|
this.startIncoming(entry);
|
|
19457
20391
|
}
|
|
@@ -19495,6 +20429,7 @@ var ChatFiles = class {
|
|
|
19495
20429
|
if (record.state !== "paused" || record.pausedBy !== "me") return;
|
|
19496
20430
|
record.pausedBy = void 0;
|
|
19497
20431
|
record.state = "queued";
|
|
20432
|
+
if (direction === "in") record.since = this.now();
|
|
19498
20433
|
this.changed(entry);
|
|
19499
20434
|
if (direction === "out") {
|
|
19500
20435
|
if (this.attached) this.announce(entry);
|
|
@@ -20751,7 +21686,8 @@ var PairingTracker = class {
|
|
|
20751
21686
|
* none of these (a mint's own words, a provider's) stays as it is.
|
|
20752
21687
|
*
|
|
20753
21688
|
* `{name}` in a template is a value: a host or domain (no spaces), a network ("Mainnet" or "Testnet"), a chain's name,
|
|
20754
|
-
* an ecash unit ("usd"),
|
|
21689
|
+
* an ecash unit ("usd"), an amount (digits, with the separators of whatever locale wrote it), or a server's own `{reason}`
|
|
21690
|
+
* (one line, last in its text).
|
|
20755
21691
|
*/
|
|
20756
21692
|
var ENGINE_ERRORS = {
|
|
20757
21693
|
mintUnreachable: "Could not reach {host}. Check the address: it should be a Cashu mint.",
|
|
@@ -20768,13 +21704,16 @@ var ENGINE_ERRORS = {
|
|
|
20768
21704
|
mintNotHttps: "Mints must use https",
|
|
20769
21705
|
notEnoughSats: "Not enough sats in your wallet",
|
|
20770
21706
|
notEnoughForFee: "Not enough sats in your wallet: {amount} sats leave room for the fee",
|
|
21707
|
+
mintsNoAnyAmount: "None of your mints can pay an invoice with no amount",
|
|
20771
21708
|
noSharedMint: "You share no mint with this contact",
|
|
20772
21709
|
ecashAlreadySpent: "This ecash was already spent somewhere else",
|
|
20773
21710
|
ecashBeingReceived: "This ecash is already being received",
|
|
21711
|
+
ecashFeeTakesAll: "The mint keeps all {amount} sats of this ecash as its fee to take it in: nothing was redeemed, and its sender can still take it back",
|
|
20774
21712
|
ecashOtherUnit: "This ecash is in {unit}: only sat ecash can be redeemed here",
|
|
20775
21713
|
reviewedEcashSpent: "The ecash for this payment was already spent somewhere else. Nothing was sent, and your balance now shows what the mint still holds.",
|
|
20776
21714
|
reviewedSatsGone: "The sats this payment was reviewed with went to another payment. Nothing was sent: review it again.",
|
|
20777
21715
|
lightningFeeTooHigh: "The Lightning fee ({fee} sats) is too high",
|
|
21716
|
+
lightningRefused: "The mint refused this Lightning payment, and no sats left your wallet: it is safe to try again. The mint said: {reason}",
|
|
20778
21717
|
invoiceExpired: "That invoice has expired",
|
|
20779
21718
|
lnurlExactly: "{domain} asks for exactly {amount} sats",
|
|
20780
21719
|
lnurlRange: "{domain} takes between {min} and {max} sats",
|
|
@@ -21084,6 +22023,13 @@ var WAKE_LOST_MS = 1e4;
|
|
|
21084
22023
|
* then did the resume dial: a chat opened on return went live 21 s after the tap (Android emulator, 2026-10-29).
|
|
21085
22024
|
*/
|
|
21086
22025
|
var WAKE_ANSWER_GRACE_MS = 3e3;
|
|
22026
|
+
function peerSaidWindow() {
|
|
22027
|
+
return {
|
|
22028
|
+
window: new RateWindow(6, 6e4),
|
|
22029
|
+
read: null,
|
|
22030
|
+
timer: null
|
|
22031
|
+
};
|
|
22032
|
+
}
|
|
21087
22033
|
/**
|
|
21088
22034
|
* What files/3 may hold on a session's channel (WISP 501, Backpressure): a quarter of its send budget (native and iroh
|
|
21089
22035
|
* channels throw past 120 KiB), or the high water mark of a WebRTC channel, which has none.
|
|
@@ -21291,6 +22237,11 @@ var GhostLink = class {
|
|
|
21291
22237
|
peerNickOverride = null;
|
|
21292
22238
|
/** Group protocol versions the peer announced on this session; null until it does. */
|
|
21293
22239
|
peerGroupVersions = null;
|
|
22240
|
+
/**
|
|
22241
|
+
* Groups were on on this session. Off again, they stay off until the next session: each "on" runs a group edge's
|
|
22242
|
+
* whole opening, and the peer says its versions once a session.
|
|
22243
|
+
*/
|
|
22244
|
+
peerGroupsWereOn = false;
|
|
21294
22245
|
/** What each side announced after the handshake (`paired-capabilities`): calls, services. */
|
|
21295
22246
|
sessionCapabilities = new SessionCapabilities(() => this.offeredCapabilities());
|
|
21296
22247
|
pairedCalls = new PairedCalls();
|
|
@@ -21315,20 +22266,16 @@ var GhostLink = class {
|
|
|
21315
22266
|
editsReceived = new RateWindow(30, EDIT_RATE_WINDOW_MS);
|
|
21316
22267
|
wakeReceived = new RateWindow(6, 6e4);
|
|
21317
22268
|
/**
|
|
21318
|
-
* The contact's name and picture,
|
|
21319
|
-
*
|
|
22269
|
+
* The contact's name and picture, its word on held items, its ways of paying and its transport descriptors, each saved
|
|
22270
|
+
* on this side when it changes: said once a session and when changed, so a handful a minute each. Past that only the
|
|
22271
|
+
* newest waits, read once the window has room again.
|
|
21320
22272
|
*/
|
|
21321
22273
|
peerSaid = {
|
|
21322
|
-
"paired-nick":
|
|
21323
|
-
|
|
21324
|
-
|
|
21325
|
-
|
|
21326
|
-
|
|
21327
|
-
"paired-avatar": {
|
|
21328
|
-
window: new RateWindow(6, 6e4),
|
|
21329
|
-
read: null,
|
|
21330
|
-
timer: null
|
|
21331
|
-
}
|
|
22274
|
+
"paired-nick": peerSaidWindow(),
|
|
22275
|
+
"paired-avatar": peerSaidWindow(),
|
|
22276
|
+
"paired-hold": peerSaidWindow(),
|
|
22277
|
+
"paired-payments": peerSaidWindow(),
|
|
22278
|
+
"paired-adapters": peerSaidWindow()
|
|
21332
22279
|
};
|
|
21333
22280
|
/** Identity-proof frames the contact may send per window; the rest are dropped before they are read. */
|
|
21334
22281
|
identityReceived = new RateWindow(40, IDENTITY_FRAME_WINDOW_MS);
|
|
@@ -21544,6 +22491,7 @@ var GhostLink = class {
|
|
|
21544
22491
|
peerCapsRev: options.dht.peerCapsRev,
|
|
21545
22492
|
peerAcceptsText: options.dht.peerAcceptsText,
|
|
21546
22493
|
peerAcceptsFile: options.dht.peerAcceptsFile,
|
|
22494
|
+
...options.dht.ratchet && { ratchet: options.dht.ratchet },
|
|
21547
22495
|
...options.reactionsSupport && {
|
|
21548
22496
|
reactions: options.dht.reactions,
|
|
21549
22497
|
reaction: async (reaction) => {
|
|
@@ -21633,6 +22581,7 @@ var GhostLink = class {
|
|
|
21633
22581
|
pollIntervals: options.pollIntervals,
|
|
21634
22582
|
awaitingSince: options.madeAt,
|
|
21635
22583
|
...backsOff && { invite: () => !options.pairing.credentials.peerKey || !!this.dht?.unanswered },
|
|
22584
|
+
...invite && { ownInvite: () => !options.pairing.credentials.peerKey && !options.pairing.credentials.expectedPeerKey },
|
|
21636
22585
|
getServices: options.getServices,
|
|
21637
22586
|
firstPublish: options.firstPublish ?? (this.tracker && options.pairingProgress?.role === "joiner" && options.rtcAvailable !== false || this.resuming ? "after-first-poll" : "at-start"),
|
|
21638
22587
|
resumed: !!this.resuming,
|
|
@@ -23478,6 +24427,10 @@ var GhostLink = class {
|
|
|
23478
24427
|
get liveAttempt() {
|
|
23479
24428
|
return this.isDataLinkOpen ? void 0 : this.lastAttempt;
|
|
23480
24429
|
}
|
|
24430
|
+
/** Automatic dials since the link was last live or its wait started over (`wake`), the one under way included. */
|
|
24431
|
+
get dialAttempts() {
|
|
24432
|
+
return this.autoConnectFailures;
|
|
24433
|
+
}
|
|
23481
24434
|
/**
|
|
23482
24435
|
* Which side dials this chat to go live: the lower rendezvous key, or the joiner of a first pairing (WISP 100). The
|
|
23483
24436
|
* other side answers, so what it can tell of a failed attempt is only what reached it.
|
|
@@ -24436,16 +25389,27 @@ var GhostLink = class {
|
|
|
24436
25389
|
/**
|
|
24437
25390
|
* The session ended or a new one took its place (a transport switch, a resume, a re-dial): what the contact had open
|
|
24438
25391
|
* is held for `APP_RESUME_GRACE_MS` (WISP 1200 § In a chat). The next session's `open` takes each back, and the app
|
|
24439
|
-
* hears only that open, not a close first; one not said again by then is closed with `offline`.
|
|
25392
|
+
* hears only that open, not a close first; one not said again by then is closed with `offline`. Each suspension
|
|
25393
|
+
* gives what it held its own grace: a later one's apps do not close at an earlier one's time.
|
|
24440
25394
|
*/
|
|
24441
25395
|
appsSuspended() {
|
|
24442
25396
|
this.appRanges.reset();
|
|
24443
|
-
this.apps.sessionSuspended();
|
|
24444
|
-
|
|
25397
|
+
this.apps.sessionSuspended(this.options.appResumeGraceMs ?? 1e4);
|
|
25398
|
+
this.armAppsGrace();
|
|
25399
|
+
}
|
|
25400
|
+
/** A timer for the next held app's grace, as long as any is held. */
|
|
25401
|
+
armAppsGrace() {
|
|
25402
|
+
if (this.appsGrace) {
|
|
25403
|
+
clearTimeout(this.appsGrace);
|
|
25404
|
+
this.appsGrace = null;
|
|
25405
|
+
}
|
|
25406
|
+
const until = this.apps.heldUntil;
|
|
25407
|
+
if (until === void 0) return;
|
|
24445
25408
|
this.appsGrace = setTimeout(() => {
|
|
24446
25409
|
this.appsGrace = null;
|
|
24447
25410
|
for (const event of this.apps.heldExpired()) this.options.events?.onAppFrame?.(event);
|
|
24448
|
-
|
|
25411
|
+
this.armAppsGrace();
|
|
25412
|
+
}, Math.max(0, until - Date.now()));
|
|
24449
25413
|
}
|
|
24450
25414
|
/** Whether files/3 was agreed on the session open now; kept to say when that changes. */
|
|
24451
25415
|
filesOpen = false;
|
|
@@ -25084,6 +26048,7 @@ var GhostLink = class {
|
|
|
25084
26048
|
if (oldChannel) this.retire(oldChannel, () => {
|
|
25085
26049
|
if (oldRtc && this.activeBinding && this.dataLink.connection === oldRtc) this.dataLink.close();
|
|
25086
26050
|
}, !oldBinding);
|
|
26051
|
+
if (migration.plan && binding && oldBinding && WEBRTC_ATTEMPT.has(this.dataLink.state)) this.dataLink.close();
|
|
25087
26052
|
this.session.setDataLinkOpen(true);
|
|
25088
26053
|
if (migration.plan) switched = {
|
|
25089
26054
|
from,
|
|
@@ -25118,6 +26083,7 @@ var GhostLink = class {
|
|
|
25118
26083
|
this.peerNetworks = null;
|
|
25119
26084
|
this.peerHoldOverride = null;
|
|
25120
26085
|
this.sessionCapabilities.reset();
|
|
26086
|
+
this.peerGroupsWereOn = false;
|
|
25121
26087
|
this.leaveHangUp();
|
|
25122
26088
|
this.typingSender.reset();
|
|
25123
26089
|
this.typingReceiver.clear();
|
|
@@ -25296,7 +26262,7 @@ var GhostLink = class {
|
|
|
25296
26262
|
return;
|
|
25297
26263
|
}
|
|
25298
26264
|
if (frame?.t === "paired-avatar" || frame?.t === "paired-nick") {
|
|
25299
|
-
this.
|
|
26265
|
+
this.peerSaysOfItself(channel, frame.t, frame);
|
|
25300
26266
|
return;
|
|
25301
26267
|
}
|
|
25302
26268
|
if (frame?.t === "paired-capabilities") {
|
|
@@ -25388,15 +26354,21 @@ var GhostLink = class {
|
|
|
25388
26354
|
}
|
|
25389
26355
|
if (frame?.t === "paired-payments") {
|
|
25390
26356
|
if (!Array.isArray(frame.m) || frame.m.length > 16 || !frame.m.every((m) => typeof m === "string")) return;
|
|
25391
|
-
|
|
25392
|
-
|
|
25393
|
-
this.
|
|
26357
|
+
const methods = new Set(frame.m.filter((m) => PAYMENT_METHODS.includes(m)));
|
|
26358
|
+
const networks = frame.n === void 0 ? null : parsePaymentNetworks(frame.n);
|
|
26359
|
+
this.peerSays(channel, "paired-payments", () => {
|
|
26360
|
+
this.peerPaymentMethods = methods;
|
|
26361
|
+
this.peerNetworks = frame.n === void 0 ? null : networks ?? this.peerNetworks;
|
|
26362
|
+
this.emitPairingState();
|
|
26363
|
+
});
|
|
25394
26364
|
return;
|
|
25395
26365
|
}
|
|
25396
26366
|
if (frame?.t === "paired-groups") {
|
|
25397
26367
|
if (!Array.isArray(frame.v) || frame.v.length > 8 || !frame.v.every((v) => Number.isSafeInteger(v) && v > 0)) return;
|
|
25398
26368
|
const before = this.groupsSupport;
|
|
26369
|
+
if (!before && this.peerGroupsWereOn && frame.v.includes(1)) return;
|
|
25399
26370
|
this.peerGroupVersions = frame.v;
|
|
26371
|
+
if (this.groupsSupport) this.peerGroupsWereOn = true;
|
|
25400
26372
|
if (this.groupsSupport !== before) this.options.events?.onGroupsSupport?.(this.groupsSupport);
|
|
25401
26373
|
return;
|
|
25402
26374
|
}
|
|
@@ -25413,12 +26385,15 @@ var GhostLink = class {
|
|
|
25413
26385
|
}
|
|
25414
26386
|
if (frame?.t === "paired-hold") {
|
|
25415
26387
|
if (typeof frame.on !== "boolean" || frame.top !== void 0 && !(Number.isSafeInteger(frame.top) && frame.top >= 0)) return;
|
|
25416
|
-
|
|
25417
|
-
|
|
25418
|
-
|
|
25419
|
-
|
|
25420
|
-
|
|
25421
|
-
|
|
26388
|
+
const on = frame.on, top = frame.top;
|
|
26389
|
+
this.peerSays(channel, "paired-hold", () => {
|
|
26390
|
+
this.peerHoldOverride = on;
|
|
26391
|
+
Promise.resolve(this.options.events?.onHold?.({
|
|
26392
|
+
peerAllows: on,
|
|
26393
|
+
peerTop: top
|
|
26394
|
+
})).catch(() => {});
|
|
26395
|
+
this.emitPairingState();
|
|
26396
|
+
});
|
|
25422
26397
|
return;
|
|
25423
26398
|
}
|
|
25424
26399
|
if (frame?.t === "paired-reconnect") {
|
|
@@ -25433,12 +26408,14 @@ var GhostLink = class {
|
|
|
25433
26408
|
if (frame?.t === "paired-adapters") {
|
|
25434
26409
|
if (!frame.descriptors || typeof frame.descriptors !== "object" || JSON.stringify(frame.descriptors).length > 4096) return;
|
|
25435
26410
|
const descriptors = checkedDescriptors(frame.descriptors);
|
|
25436
|
-
|
|
25437
|
-
|
|
25438
|
-
|
|
25439
|
-
|
|
25440
|
-
|
|
25441
|
-
|
|
26411
|
+
await this.peerSays(channel, "paired-adapters", async () => {
|
|
26412
|
+
const transports = [...this.paired?.peerTransports ?? []];
|
|
26413
|
+
const fallback = this.paired?.peerAllowsFallback ?? false;
|
|
26414
|
+
await this.options.events?.onTransportDiscovery?.(descriptors, transports, fallback);
|
|
26415
|
+
this.peerDescriptors = descriptors;
|
|
26416
|
+
this.peerTransports = transports;
|
|
26417
|
+
this.peerFallback = fallback;
|
|
26418
|
+
});
|
|
25442
26419
|
return;
|
|
25443
26420
|
}
|
|
25444
26421
|
if (!frame || typeof frame.id !== "string" || !/^[A-Za-z0-9_-]{22}$/.test(frame.id)) return;
|
|
@@ -25797,11 +26774,8 @@ var GhostLink = class {
|
|
|
25797
26774
|
traceLink(this.myPubKeyZ32, "wake-answer-dropped", {});
|
|
25798
26775
|
this.dataLink.abandon();
|
|
25799
26776
|
}
|
|
25800
|
-
/**
|
|
25801
|
-
|
|
25802
|
-
* window the newest waits for room on this session, so the last word still counts.
|
|
25803
|
-
*/
|
|
25804
|
-
peerSays(channel, kind, frame) {
|
|
26777
|
+
/** A name or picture the contact said, once it is one (reading it costs little; saving it is what counts). */
|
|
26778
|
+
peerSaysOfItself(channel, kind, frame) {
|
|
25805
26779
|
let read;
|
|
25806
26780
|
if (kind === "paired-avatar") {
|
|
25807
26781
|
const avatar = sanitizeAvatar(frame.a);
|
|
@@ -25817,11 +26791,15 @@ var GhostLink = class {
|
|
|
25817
26791
|
}
|
|
25818
26792
|
};
|
|
25819
26793
|
}
|
|
26794
|
+
this.peerSays(channel, kind, read);
|
|
26795
|
+
}
|
|
26796
|
+
/**
|
|
26797
|
+
* Something the contact said that this side saves, read within its window: past it the newest waits for room on this
|
|
26798
|
+
* session (handed on unawaited then), so the last word still counts. What `read` returns when read at once is returned.
|
|
26799
|
+
*/
|
|
26800
|
+
peerSays(channel, kind, read) {
|
|
25820
26801
|
const held = this.peerSaid[kind];
|
|
25821
|
-
if (!held.timer && held.window.take())
|
|
25822
|
-
read();
|
|
25823
|
-
return;
|
|
25824
|
-
}
|
|
26802
|
+
if (!held.timer && held.window.take()) return read();
|
|
25825
26803
|
held.read = read;
|
|
25826
26804
|
if (held.timer) return;
|
|
25827
26805
|
const due = () => {
|
|
@@ -25836,7 +26814,7 @@ var GhostLink = class {
|
|
|
25836
26814
|
}
|
|
25837
26815
|
const next = held.read;
|
|
25838
26816
|
held.read = null;
|
|
25839
|
-
next();
|
|
26817
|
+
Promise.resolve(next()).catch(() => {});
|
|
25840
26818
|
};
|
|
25841
26819
|
held.timer = setTimeout(due, held.window.wait());
|
|
25842
26820
|
}
|
|
@@ -25897,6 +26875,7 @@ var GhostLink = class {
|
|
|
25897
26875
|
this.typingReceiver.clear();
|
|
25898
26876
|
this.appsSuspended();
|
|
25899
26877
|
this.emitFilesSession();
|
|
26878
|
+
this.peerGroupsWereOn = false;
|
|
25900
26879
|
if (this.peerGroupVersions) {
|
|
25901
26880
|
this.peerGroupVersions = null;
|
|
25902
26881
|
this.options.events?.onGroupsSupport?.(false);
|
|
@@ -27344,7 +28323,7 @@ function decodeDidDhtPacket(did, dnsPacket) {
|
|
|
27344
28323
|
const alg = props.get("a") ?? KEY_TYPES[type].alg;
|
|
27345
28324
|
if (!ALG.test(alg)) throw malformed(`the key ${alias} has an unusable algorithm`);
|
|
27346
28325
|
const k = props.get("k") ?? "";
|
|
27347
|
-
const bytes = /^[A-Za-z0-9_-]+$/.test(k) ? fromBase64Url(k) : /* @__PURE__ */ new Uint8Array();
|
|
28326
|
+
const bytes = /^[A-Za-z0-9_-]+$/.test(k) && k.length % 4 !== 1 ? fromBase64Url(k) : /* @__PURE__ */ new Uint8Array();
|
|
27348
28327
|
if (bytes.length === 0 || toBase64Url(bytes) !== k) throw malformed(`the key ${alias} is not unpadded base64url`);
|
|
27349
28328
|
const controller = props.get("c") ?? did;
|
|
27350
28329
|
if (!DID.test(controller)) throw malformed(`the key ${alias} has a controller that is not a DID`);
|
|
@@ -27619,6 +28598,11 @@ function parseWeb(id) {
|
|
|
27619
28598
|
path
|
|
27620
28599
|
};
|
|
27621
28600
|
}
|
|
28601
|
+
/**
|
|
28602
|
+
* A did:web (or one of its URLs) with the port's `%3a` written `%3A`, as `parseDid` writes it: percent-encoding is
|
|
28603
|
+
* case-insensitive (RFC 3986), so a document may write either. The fragment is left as it is.
|
|
28604
|
+
*/
|
|
28605
|
+
var webPortForm = (value) => value.startsWith("did:web:") ? value.replace(/^[^#]*/, (part) => part.replace(/%3a/g, "%3A")) : value;
|
|
27622
28606
|
var web = (did) => {
|
|
27623
28607
|
const parsed = parseDid(did);
|
|
27624
28608
|
if (parsed.method !== "web") throw new DidError("Not a did:web");
|
|
@@ -27655,7 +28639,7 @@ function didWebFileNames(text, did, statement) {
|
|
|
27655
28639
|
} catch {
|
|
27656
28640
|
return false;
|
|
27657
28641
|
}
|
|
27658
|
-
return isObject$6(body) && body.ghostly === 1 && body.did === did && body.statement === statement;
|
|
28642
|
+
return isObject$6(body) && body.ghostly === 1 && typeof body.did === "string" && webPortForm(body.did) === did && body.statement === statement;
|
|
27659
28643
|
}
|
|
27660
28644
|
/** The service entry a did.json can carry instead of the file. */
|
|
27661
28645
|
function didGhostlyServiceEntry(did, key, proofId) {
|
|
@@ -27807,7 +28791,7 @@ function staticDidDocument(did) {
|
|
|
27807
28791
|
/** An id as absolute `<did>#<fragment>`, from `#frag` or the absolute form; undefined for another DID's. */
|
|
27808
28792
|
function methodId(did, id) {
|
|
27809
28793
|
if (typeof id !== "string" || id.length > 640) return void 0;
|
|
27810
|
-
const absolute = id.startsWith("#") ? `${did}${id}` : id;
|
|
28794
|
+
const absolute = id.startsWith("#") ? `${did}${id}` : webPortForm(id);
|
|
27811
28795
|
return absolute.startsWith(`${did}#`) && absolute.length > did.length + 1 && /^[\x21-\x7e]+$/.test(absolute) ? absolute : void 0;
|
|
27812
28796
|
}
|
|
27813
28797
|
/** Key material of one verification method: `publicKeyJwk`, `publicKeyMultibase` or (Ed25519 2018) `publicKeyBase58`. */
|
|
@@ -27846,7 +28830,7 @@ var list = (value, name) => {
|
|
|
27846
28830
|
*/
|
|
27847
28831
|
function parseDidDocument(did, raw) {
|
|
27848
28832
|
if (!isObject$6(raw)) throw new DidError("The DID document is not a JSON object");
|
|
27849
|
-
if (raw.id !== did) throw new DidError(typeof raw.id === "string" ? `The DID document is for another DID (${raw.id.slice(0, 80)})` : "The DID document has no id");
|
|
28833
|
+
if (typeof raw.id !== "string" || webPortForm(raw.id) !== did) throw new DidError(typeof raw.id === "string" ? `The DID document is for another DID (${raw.id.slice(0, 80)})` : "The DID document has no id");
|
|
27850
28834
|
const keys = /* @__PURE__ */ new Map();
|
|
27851
28835
|
const unusable = /* @__PURE__ */ new Set();
|
|
27852
28836
|
let skipped = 0;
|
|
@@ -28000,14 +28984,19 @@ function checkDidJws(input, messages, doc) {
|
|
|
28000
28984
|
inputs = [];
|
|
28001
28985
|
}
|
|
28002
28986
|
if (!inputs.length) throw new DidError("The JWS carries another text: sign exactly the statement shown");
|
|
28987
|
+
let refused;
|
|
28003
28988
|
for (const key of candidates) {
|
|
28004
28989
|
if (!inputs.some((m) => verifyWith(key, jws.signature, m))) continue;
|
|
28005
|
-
if (!key.relationships.length)
|
|
28990
|
+
if (!key.relationships.length) {
|
|
28991
|
+
refused ??= key;
|
|
28992
|
+
continue;
|
|
28993
|
+
}
|
|
28006
28994
|
return {
|
|
28007
28995
|
key,
|
|
28008
28996
|
alg: jws.alg
|
|
28009
28997
|
};
|
|
28010
28998
|
}
|
|
28999
|
+
if (refused) throw refusedKey(refused);
|
|
28011
29000
|
throw new DidError("The JWS signature does not match: sign exactly the statement shown, with a key of this DID");
|
|
28012
29001
|
}
|
|
28013
29002
|
/**
|
|
@@ -28025,10 +29014,14 @@ function checkDidSignature(signature, messages, doc, vm) {
|
|
|
28025
29014
|
}
|
|
28026
29015
|
const der = signature.length !== 64 && signature[0] === 48;
|
|
28027
29016
|
if (signature.length !== 64 && !der) throw new DidError("A signature is 64 bytes (or DER, for ECDSA)");
|
|
29017
|
+
let refused;
|
|
28028
29018
|
for (const key of candidates) {
|
|
28029
29019
|
if (der && key.curve === "Ed25519") continue;
|
|
28030
29020
|
if (!messages.some((m) => verifyWith(key, signature, m, der ? "der" : "compact"))) continue;
|
|
28031
|
-
if (!key.relationships.length)
|
|
29021
|
+
if (!key.relationships.length) {
|
|
29022
|
+
refused ??= key;
|
|
29023
|
+
continue;
|
|
29024
|
+
}
|
|
28032
29025
|
const canonical = der ? (key.curve === "secp256k1" ? secp256k1 : p256).Signature.fromBytes(signature, "der").toBytes("compact") : signature;
|
|
28033
29026
|
return {
|
|
28034
29027
|
key,
|
|
@@ -28036,6 +29029,7 @@ function checkDidSignature(signature, messages, doc, vm) {
|
|
|
28036
29029
|
signature: canonical
|
|
28037
29030
|
};
|
|
28038
29031
|
}
|
|
29032
|
+
if (refused) throw refusedKey(refused);
|
|
28039
29033
|
throw new DidError("The signature does not match: sign exactly the statement shown, with a key of this DID");
|
|
28040
29034
|
}
|
|
28041
29035
|
function parseDidSignaturePaste(pasted) {
|
|
@@ -30321,6 +31315,8 @@ function readFirstPlace(o, epoch) {
|
|
|
30321
31315
|
var ownKey = (f) => `${f.e}:${f.n}`;
|
|
30322
31316
|
/** What a frame weighs in a log, roughly: its boxes plus the fixed fields around them. */
|
|
30323
31317
|
var frameKey$1 = (f) => `${f.s}:${f.e}:${f.n}`;
|
|
31318
|
+
/** One edit of a message, by its number: an edit handed already, apart from the message's own `frameKey`. */
|
|
31319
|
+
var editKey = (f) => `${f.s}:${f.e}:${f.n}:v${f.v}`;
|
|
30324
31320
|
/** What a kept frame counts for against `GROUP_LIMITS.relayBytes`. */
|
|
30325
31321
|
var frameBytes = (f) => f.c.length + (f.m?.c.length ?? 0) + (f.r?.c.length ?? 0) + (f.sc?.c.length ?? 0) + (f.fl?.c.length ?? 0) + (f.nk?.c.length ?? 0) + 400;
|
|
30326
31322
|
/** Only the fields an edit frame has, as `clean` does for a message. */
|
|
@@ -30505,9 +31501,9 @@ var GroupSession = class {
|
|
|
30505
31501
|
}
|
|
30506
31502
|
this.answers = new CatchUpAnswers({
|
|
30507
31503
|
send: (to, frame) => {
|
|
30508
|
-
if (frame.t === "group-msg" && !rosterHas(this.roster, frame.s)) {
|
|
31504
|
+
if ((frame.t === "group-msg" || frame.t === "group-edit") && !rosterHas(this.roster, frame.s)) {
|
|
30509
31505
|
const handed = this.leaversHanded.get(to) ?? /* @__PURE__ */ new Set();
|
|
30510
|
-
this.leaversHanded.set(to, handed.add(frameKey$1(frame)));
|
|
31506
|
+
this.leaversHanded.set(to, handed.add(frame.t === "group-edit" ? editKey(frame) : frameKey$1(frame)));
|
|
30511
31507
|
}
|
|
30512
31508
|
return hooks.send(to, frame);
|
|
30513
31509
|
},
|
|
@@ -30984,7 +31980,18 @@ var GroupSession = class {
|
|
|
30984
31980
|
if (this.state.relay?.length) this.state.relay = prune(this.state.relay, false);
|
|
30985
31981
|
if (this.onRows?.length) this.onRows = prune(this.onRows, true);
|
|
30986
31982
|
this.pruned.splice(0, this.pruned.length - GROUP_LIMITS.relay);
|
|
30987
|
-
if (this.state.relayEdits?.length) this.state.relayEdits = this.state.relayEdits.filter((f) => rosterHas(this.roster, f.s));
|
|
31983
|
+
if (this.state.relayEdits?.length) this.state.relayEdits = this.state.relayEdits.filter((f) => rosterHas(this.roster, f.s) || this.isRemovalEdit(f));
|
|
31984
|
+
}
|
|
31985
|
+
/** Whether a kept edit is a removal (WISP 400 § Delete for everyone): its box, under its epoch's key, says `rm`. */
|
|
31986
|
+
isRemovalEdit(frame) {
|
|
31987
|
+
const secret = this.secret(frame.e);
|
|
31988
|
+
const plain = secret && decryptText(epochKeys(secret, this.id, frame.e).message, editAad(frame), frame.nn, frame.c);
|
|
31989
|
+
if (!plain) return false;
|
|
31990
|
+
try {
|
|
31991
|
+
return JSON.parse(plain)?.rm === true;
|
|
31992
|
+
} catch {
|
|
31993
|
+
return false;
|
|
31994
|
+
}
|
|
30988
31995
|
}
|
|
30989
31996
|
/** The frames `pruneRelay` dropped that are handed on again now (a removal's `left` mark came after it), back in their logs. */
|
|
30990
31997
|
unprune() {
|
|
@@ -31671,11 +32678,14 @@ var GroupSession = class {
|
|
|
31671
32678
|
/**
|
|
31672
32679
|
* An edit of a member's own message, from its author's edge or handed on by another member: believed only while its
|
|
31673
32680
|
* author is still in the roster (someone removed edits nothing), and the member handing it on too; for an epoch the
|
|
31674
|
-
* author and I were both members of, with the author's signature over the whole frame and a box that opens.
|
|
31675
|
-
* an
|
|
32681
|
+
* author and I were both members of, with the author's signature over the whole frame and a box that opens. A removal
|
|
32682
|
+
* of an author out of the roster still stands, handed on by a member: it only takes away what the author wrote while
|
|
32683
|
+
* in, and a member away when it was said would keep the message for good. One for an epoch or a secret not here yet
|
|
32684
|
+
* waits, as a message does. Taken, it is kept to hand on in turn.
|
|
31676
32685
|
*/
|
|
31677
32686
|
async receiveEdit(from, raw) {
|
|
31678
|
-
if (!isEditFrame(raw) || raw.s === this.myKey || !rosterHas(this.roster,
|
|
32687
|
+
if (!isEditFrame(raw) || raw.s === this.myKey || !rosterHas(this.roster, from)) return;
|
|
32688
|
+
const member = rosterHas(this.roster, raw.s);
|
|
31679
32689
|
if (!verify(fromBase64Url(raw.sig), editSigned(raw), publicKeyFromZ32(raw.s))) return;
|
|
31680
32690
|
if (raw.e > this.epoch) {
|
|
31681
32691
|
this.parkEdit(from, raw);
|
|
@@ -31699,6 +32709,7 @@ var GroupSession = class {
|
|
|
31699
32709
|
if (!body || typeof body !== "object" || !validEditText(body.text)) return;
|
|
31700
32710
|
if (body.rm !== void 0 && body.rm !== true) return;
|
|
31701
32711
|
const rm = body.rm === true;
|
|
32712
|
+
if (!member && !rm) return;
|
|
31702
32713
|
if (!rm && !cardEditNumber(raw.v)) return;
|
|
31703
32714
|
const k = rm ? [] : validMentions(body.m, body.text, rosterAdmin(commit.m) === raw.s && this.admin === raw.s);
|
|
31704
32715
|
const sc = rm || body.sc === void 0 ? void 0 : readStatusCard(body.sc);
|
|
@@ -31859,7 +32870,7 @@ var GroupSession = class {
|
|
|
31859
32870
|
if (e <= this.epoch) {
|
|
31860
32871
|
const known = this.state.chain[e];
|
|
31861
32872
|
const result = verifyCommit(raw, this.state.chain[e - 1] ?? null, this.id);
|
|
31862
|
-
if ("error" in result || result.commit.by !== known.by) return;
|
|
32873
|
+
if ("error" in result || result.commit.by !== known.by || result.commit.by !== this.admin) return;
|
|
31863
32874
|
if (commitHash(result.commit) !== commitHash(known)) await this.fork(`Member ${from.slice(0, 8)} holds a different membership history for epoch ${e}`);
|
|
31864
32875
|
else if (this.takeLeftMark(known, frame.left)) {
|
|
31865
32876
|
this.unprune();
|
|
@@ -32017,10 +33028,13 @@ var GroupSession = class {
|
|
|
32017
33028
|
while (metas.length && metas[0].ts < f.ts) answer.push(metas.shift().frame);
|
|
32018
33029
|
answer.push(f);
|
|
32019
33030
|
}
|
|
33031
|
+
const readable = (f) => !!this.state.chain[f.e] && rosterHas(this.state.chain[f.e].m, from);
|
|
32020
33032
|
for (const author of asked) {
|
|
32021
|
-
const edits = (this.state.relayEdits ?? []).filter((f) => f.s === author &&
|
|
33033
|
+
const edits = (this.state.relayEdits ?? []).filter((f) => f.s === author && readable(f));
|
|
32022
33034
|
answer.push(...edits.slice(-GROUP_LIMITS.handOnEdits));
|
|
32023
33035
|
}
|
|
33036
|
+
const gone = (this.state.relayEdits ?? []).filter((f) => !rosterHas(this.roster, f.s) && readable(f) && !handed?.has(editKey(f)));
|
|
33037
|
+
answer.push(...gone.slice(-GROUP_LIMITS.handOnEdits));
|
|
32024
33038
|
answer.push(...metas.map((m) => m.frame));
|
|
32025
33039
|
this.handOut(from, answer);
|
|
32026
33040
|
}
|
|
@@ -32419,8 +33433,9 @@ function entryParams(link, mySeed, myZ32, peerZ32) {
|
|
|
32419
33433
|
* only a newcomer is sent it; `leave`, `remove` and `rotate` get a fresh secret sealed to everyone;
|
|
32420
33434
|
* - concurrent commits are a race with a deterministic winner, not a fork: the branch that keeps the
|
|
32421
33435
|
* admin's changes (remove, role, rotate, link) since the common parent, then the longest, then the
|
|
32422
|
-
* lowest hash of the first commit after the common parent. The admin signing changes on
|
|
32423
|
-
* branches (after the same commit or not) is still a fork and halts the group;
|
|
33436
|
+
* lowest hash of the first commit after the common parent. The admin of the tip signing changes on
|
|
33437
|
+
* two branches (after the same commit or not) is still a fork and halts the group; a former admin
|
|
33438
|
+
* doing so on a branch from before its hand-over is refused, as a stale branch;
|
|
32424
33439
|
* - messages name the commit of their epoch, so messages under a commit that lost stay readable;
|
|
32425
33440
|
* every member keeps recent frames from everyone and re-sends them to whoever was away.
|
|
32426
33441
|
*
|
|
@@ -32475,6 +33490,15 @@ var COMMUNITY_LIMITS = {
|
|
|
32475
33490
|
syncAnswers: 16,
|
|
32476
33491
|
syncWindowMs: 6e4,
|
|
32477
33492
|
/**
|
|
33493
|
+
* Messages of one member taken per `messageWindowMs`, and the bytes of their sealed bodies, past what one catch-up
|
|
33494
|
+
* answer holds (a whole store, and the lasting frames): anyone with the link is a member, and each message taken is a
|
|
33495
|
+
* row in every member's app and a frame each hub passes on. The rest are not taken now and come again in a catch-up
|
|
33496
|
+
* (`MessagePace`).
|
|
33497
|
+
*/
|
|
33498
|
+
messagesPerAuthor: 30,
|
|
33499
|
+
messageBytesPerAuthor: 131072,
|
|
33500
|
+
messageWindowMs: 1e4,
|
|
33501
|
+
/**
|
|
32478
33502
|
* Frames of one catch-up answer in a slice (`CommunitySessionHooks.handled`), two slices at most not handled yet by
|
|
32479
33503
|
* the member's app: a member back after the store filled was handed 258 at once, and an app holds 64 waiting at most
|
|
32480
33504
|
* before 2026-10-07 (more ends the session). As a private group's (`GROUP_LIMITS.catchUpSlice`).
|
|
@@ -32680,7 +33704,7 @@ function communityRoster(previous, c, trusted = false) {
|
|
|
32680
33704
|
/**
|
|
32681
33705
|
* One commit against its parent (null for a genesis) and the parent's roster: shape, id, link,
|
|
32682
33706
|
* authority, roster arithmetic, roster hash and signature. The confirmation tag is checked once
|
|
32683
|
-
* the secret is known. `before`: the commits before it on its branch, newest first; given, a `leave` is held to the
|
|
33707
|
+
* the secret is known (a derived kind's on arrival, by a member holding the parent's: `receiveCommit`). `before`: the commits before it on its branch, newest first; given, a `leave` is held to the
|
|
32684
33708
|
* admission it ends (`leaveStands`). A member gives it for every commit it takes in after its own admission; the chain
|
|
32685
33709
|
* of a welcome is not held to it (`verifyCommunityChain`).
|
|
32686
33710
|
*/
|
|
@@ -32782,6 +33806,56 @@ var messageSigned = (f) => utf8Encode(JSON.stringify([
|
|
|
32782
33806
|
]));
|
|
32783
33807
|
var communityMessageId = (sender, epoch, h, seq) => `${sender}:${epoch}:${h}:${seq}`;
|
|
32784
33808
|
var seenKey = (e, h) => `${e}:${h}`;
|
|
33809
|
+
/**
|
|
33810
|
+
* One member's messages taken: a whole catch-up answer at once (`MESSAGE_BURST`), then
|
|
33811
|
+
* `COMMUNITY_LIMITS.messagesPerAuthor` and `messageBytesPerAuthor` per `messageWindowMs`. One not taken is not marked
|
|
33812
|
+
* seen, so a catch-up hands it again; until it is taken, those after it under the same commit (`seenKey`) are not taken
|
|
33813
|
+
* either: a later one taken would say I have everything up to it (`syncFrame`'s `have`) and the one before would never
|
|
33814
|
+
* be handed again. A place that moves no more for `COMMUNITY_LIMITS.pendingMs` (no catch-up holds it any longer) is let go.
|
|
33815
|
+
*/
|
|
33816
|
+
var MESSAGE_BURST = {
|
|
33817
|
+
frames: COMMUNITY_LIMITS.store + COMMUNITY_LIMITS.lasting,
|
|
33818
|
+
bytes: COMMUNITY_LIMITS.storeBytes + COMMUNITY_LIMITS.lasting * COMMUNITY_LIMITS.textBytes * 2
|
|
33819
|
+
};
|
|
33820
|
+
var MessagePace = class {
|
|
33821
|
+
frames = MESSAGE_BURST.frames;
|
|
33822
|
+
bytes = MESSAGE_BURST.bytes;
|
|
33823
|
+
at;
|
|
33824
|
+
held = /* @__PURE__ */ new Map();
|
|
33825
|
+
take(key, n, bytes, now) {
|
|
33826
|
+
let held = this.held.get(key);
|
|
33827
|
+
if (held && now - held.at >= COMMUNITY_LIMITS.pendingMs) {
|
|
33828
|
+
this.held.delete(key);
|
|
33829
|
+
held = void 0;
|
|
33830
|
+
}
|
|
33831
|
+
if (held && n > held.low) {
|
|
33832
|
+
held.top = Math.max(held.top, n);
|
|
33833
|
+
return false;
|
|
33834
|
+
}
|
|
33835
|
+
const elapsed = Math.max(0, now - (this.at ?? now)) / COMMUNITY_LIMITS.messageWindowMs;
|
|
33836
|
+
this.at = now;
|
|
33837
|
+
this.frames = Math.min(MESSAGE_BURST.frames, this.frames + elapsed * COMMUNITY_LIMITS.messagesPerAuthor);
|
|
33838
|
+
this.bytes = Math.min(MESSAGE_BURST.bytes, this.bytes + elapsed * COMMUNITY_LIMITS.messageBytesPerAuthor);
|
|
33839
|
+
if (this.frames < 1 || this.bytes < bytes) {
|
|
33840
|
+
if (held) held.low = n;
|
|
33841
|
+
else this.held.set(key, {
|
|
33842
|
+
low: n,
|
|
33843
|
+
top: n,
|
|
33844
|
+
at: now
|
|
33845
|
+
});
|
|
33846
|
+
return false;
|
|
33847
|
+
}
|
|
33848
|
+
this.frames -= 1;
|
|
33849
|
+
this.bytes -= bytes;
|
|
33850
|
+
if (held && n === held.low) {
|
|
33851
|
+
if (held.top > n) {
|
|
33852
|
+
held.low = n + 1;
|
|
33853
|
+
held.at = now;
|
|
33854
|
+
} else this.held.delete(key);
|
|
33855
|
+
}
|
|
33856
|
+
return true;
|
|
33857
|
+
}
|
|
33858
|
+
};
|
|
32785
33859
|
/** One of a member's frames, among its own. */
|
|
32786
33860
|
var frameKey = (f) => `${f.e}:${f.h}:${f.n}`;
|
|
32787
33861
|
/** A frame among everyone's: each member counts its own `n`, so `frameKey` alone tells only one member's frames apart. */
|
|
@@ -32865,6 +33939,8 @@ var CommunitySession = class {
|
|
|
32865
33939
|
asked = /* @__PURE__ */ new Map();
|
|
32866
33940
|
/** Syncs answered per member, a few a minute (`COMMUNITY_LIMITS.syncAnswers`). In memory only. */
|
|
32867
33941
|
syncsAnswered = /* @__PURE__ */ new Map();
|
|
33942
|
+
/** Messages taken per author, a few a second (`MessagePace`). In memory only. */
|
|
33943
|
+
messagePace = /* @__PURE__ */ new Map();
|
|
32868
33944
|
/** The entry seed sealed to each member, for the seed it seals (`entryFrame`): every sync answer carries it. In memory only. */
|
|
32869
33945
|
sealedEntries = /* @__PURE__ */ new Map();
|
|
32870
33946
|
/** Catch-up answers still going out, a slice at a time (`receiveSync`). */
|
|
@@ -33063,6 +34139,18 @@ var CommunitySession = class {
|
|
|
33063
34139
|
get entryKey() {
|
|
33064
34140
|
return this.state.entry.key;
|
|
33065
34141
|
}
|
|
34142
|
+
/**
|
|
34143
|
+
* The entry key of the link my admission that lost was let in by (the one its branch named), where I ask again: a
|
|
34144
|
+
* link replaced since keeps me out as it does anyone. `entryKey` once that admission is no longer held.
|
|
34145
|
+
*/
|
|
34146
|
+
get lostEntryKey() {
|
|
34147
|
+
const side = this.state.side;
|
|
34148
|
+
for (let i = side.length - 1; i >= 0; i--) if (side[i].k === "add" && side[i].s === this.myKey) {
|
|
34149
|
+
for (const c of this.ancestry(side[i].p)) if (c.x !== void 0) return c.x;
|
|
34150
|
+
return "";
|
|
34151
|
+
}
|
|
34152
|
+
return this.entryKey;
|
|
34153
|
+
}
|
|
33066
34154
|
role(key) {
|
|
33067
34155
|
return this.roster.find(([k]) => k === key)?.[1];
|
|
33068
34156
|
}
|
|
@@ -33070,10 +34158,62 @@ var CommunitySession = class {
|
|
|
33070
34158
|
get picture() {
|
|
33071
34159
|
return groupMetaPicture(this.state.meta);
|
|
33072
34160
|
}
|
|
33073
|
-
/**
|
|
34161
|
+
/**
|
|
34162
|
+
* Members of any epoch in the window: whom a frame may come from. A side commit's roster counts only while its branch
|
|
34163
|
+
* could still win (`mayWin`): one let in only on a branch that lost is not in the roster anyone sees, and the main
|
|
34164
|
+
* branch past where they part, a later link among it, is not its business (`lostAt`).
|
|
34165
|
+
*/
|
|
33074
34166
|
isRecentMember(key) {
|
|
33075
|
-
|
|
33076
|
-
|
|
34167
|
+
let side = false;
|
|
34168
|
+
for (const [h, roster] of this.rosters) if (rosterHas(roster, key)) {
|
|
34169
|
+
if (this.mainIndex.has(h)) return true;
|
|
34170
|
+
side = true;
|
|
34171
|
+
}
|
|
34172
|
+
return side && [...this.mayWin()].some((h) => rosterHas(this.rosters.get(h) ?? [], key));
|
|
34173
|
+
}
|
|
34174
|
+
/**
|
|
34175
|
+
* The side commits whose branch could still win: it does not drop an admin change the main branch holds (one that
|
|
34176
|
+
* does never wins, see `better`), and it parts within the window. Kept until the tip or the side moves.
|
|
34177
|
+
*/
|
|
34178
|
+
mayWin() {
|
|
34179
|
+
const side = this.state.side, at = `${this.topHash}:${side.length}:${side.length ? communityCommitHash(side[side.length - 1]) : ""}`;
|
|
34180
|
+
if (this.winning?.at === at) return this.winning.set;
|
|
34181
|
+
const counts = this.adminCounts(), main = this.branch(this.topHash), set = /* @__PURE__ */ new Set();
|
|
34182
|
+
for (const c of side) {
|
|
34183
|
+
const h = communityCommitHash(c), branch = this.rosters.has(h) ? this.branch(h) : null;
|
|
34184
|
+
if (!branch || !branch.path.length) continue;
|
|
34185
|
+
const { parent, admin } = this.parting(branch, main, counts);
|
|
34186
|
+
if (!(admin[1] && !admin[0]) && parent >= this.epoch - COMMUNITY_LIMITS.window) set.add(h);
|
|
34187
|
+
}
|
|
34188
|
+
this.winning = {
|
|
34189
|
+
at,
|
|
34190
|
+
set
|
|
34191
|
+
};
|
|
34192
|
+
return set;
|
|
34193
|
+
}
|
|
34194
|
+
winning;
|
|
34195
|
+
/**
|
|
34196
|
+
* For a key that is no recent member, let in on a branch that lost: the main-branch index it parts from, and that of
|
|
34197
|
+
* the commit that makes it lose (the latest over its branches). Undefined for anyone else.
|
|
34198
|
+
*/
|
|
34199
|
+
lostAt(key) {
|
|
34200
|
+
const side = this.state.side, parents = new Set(side.map((c) => c.p)), counts = this.adminCounts();
|
|
34201
|
+
let lost;
|
|
34202
|
+
for (const c of side) {
|
|
34203
|
+
const h = communityCommitHash(c);
|
|
34204
|
+
if (parents.has(h)) continue;
|
|
34205
|
+
const branch = this.branch(h);
|
|
34206
|
+
if (!branch || !branch.path.some((x) => rosterHas(this.rosters.get(x) ?? [], key))) continue;
|
|
34207
|
+
for (let j = branch.fork + 1; j < this.state.chain.length; j++) {
|
|
34208
|
+
if (this.better(branch, this.branch(communityCommitHash(this.state.chain[j])), counts)) continue;
|
|
34209
|
+
lost = {
|
|
34210
|
+
fork: Math.min(lost?.fork ?? j, branch.fork),
|
|
34211
|
+
end: Math.max(lost?.end ?? j, j)
|
|
34212
|
+
};
|
|
34213
|
+
break;
|
|
34214
|
+
}
|
|
34215
|
+
}
|
|
34216
|
+
return lost;
|
|
33077
34217
|
}
|
|
33078
34218
|
/**
|
|
33079
34219
|
* Whether `key` could read message `messageId` (`<s>:<e>:<h>:<n>`) and still can: a member of the roster it was sealed
|
|
@@ -33378,11 +34518,17 @@ var CommunitySession = class {
|
|
|
33378
34518
|
if (!parsed || this.known.has(communityCommitHash(parsed))) return false;
|
|
33379
34519
|
const result = verifyCommunityCommit(raw, parent, parentRoster, this.id, this.ancestry(p));
|
|
33380
34520
|
if ("error" in result) return false;
|
|
34521
|
+
const previous = this.state.secrets[p];
|
|
34522
|
+
if (previous && !FRESH.has(result.commit.k)) {
|
|
34523
|
+
const untagged = communityUntaggedHash(result.commit);
|
|
34524
|
+
if (!confirmationMatches(epochKeys(derivedSecret(fromBase64Url(previous), untagged), this.id, result.commit.e).confirm, untagged, result.commit.c)) return false;
|
|
34525
|
+
}
|
|
33381
34526
|
if (GROWS.has(result.commit.k) && !keepsRoom(result.commit.e, result.roster)) return false;
|
|
33382
34527
|
const commit = result.commit, h = communityCommitHash(commit);
|
|
33383
34528
|
const admin = rosterAdmin(parentRoster);
|
|
33384
34529
|
if (commit.by === admin) {
|
|
33385
34530
|
for (const [other, c] of this.known) if (other !== h && c.p === commit.p && c.by === admin) {
|
|
34531
|
+
if (admin !== this.admin) return false;
|
|
33386
34532
|
this.known.set(h, commit);
|
|
33387
34533
|
this.rosters.set(h, result.roster);
|
|
33388
34534
|
await this.fork(`The admin signed two different changes after epoch ${parent.e}`);
|
|
@@ -33395,6 +34541,11 @@ var CommunitySession = class {
|
|
|
33395
34541
|
if (branch && branch.path.length) {
|
|
33396
34542
|
const { admin } = this.parting(branch, this.branch(this.topHash), this.adminCounts());
|
|
33397
34543
|
if (ADMIN_ONLY.has(commit.k) && admin[1]) {
|
|
34544
|
+
if (commit.by !== this.admin) {
|
|
34545
|
+
this.known.delete(h);
|
|
34546
|
+
this.rosters.delete(h);
|
|
34547
|
+
return false;
|
|
34548
|
+
}
|
|
33398
34549
|
await this.fork(`The admin signed changes on two branches after epoch ${this.state.chain[branch.fork].e}`);
|
|
33399
34550
|
return true;
|
|
33400
34551
|
}
|
|
@@ -33486,6 +34637,7 @@ var CommunitySession = class {
|
|
|
33486
34637
|
this.state.chain.push(c);
|
|
33487
34638
|
this.takeDerived(h);
|
|
33488
34639
|
}
|
|
34640
|
+
this.holdDroppedLeaves(dropped);
|
|
33489
34641
|
if (!rosterHas(this.roster, this.myKey) && this.state.status === "active") {
|
|
33490
34642
|
const out = [...path].reverse().map((h) => this.known.get(h)).find((c) => (c.k === "remove" || c.k === "leave") && c.s === this.myKey);
|
|
33491
34643
|
if (out) this.out(out.k === "remove" ? "removed" : "left", out.k === "remove" ? "You were removed from this group" : "You left this group");
|
|
@@ -33495,6 +34647,33 @@ var CommunitySession = class {
|
|
|
33495
34647
|
}
|
|
33496
34648
|
}
|
|
33497
34649
|
}
|
|
34650
|
+
/**
|
|
34651
|
+
* A leave the branch I left behind had committed, whose member the main branch still lists (an admin-only commit
|
|
34652
|
+
* signed on a stale view won the fork): its request is held again, so the next hub commits it on top. The hub that
|
|
34653
|
+
* committed it kept no copy and the leaver's app forgot the group, so nobody would say it again (agents#2285).
|
|
34654
|
+
*/
|
|
34655
|
+
holdDroppedLeaves(dropped) {
|
|
34656
|
+
let held = this.state.pendingLeaves;
|
|
34657
|
+
for (const c of dropped) {
|
|
34658
|
+
if (c.k !== "leave" || !c.s || !c.ls || c.s === this.myKey || !rosterHas(this.roster, c.s)) continue;
|
|
34659
|
+
const request = {
|
|
34660
|
+
s: c.s,
|
|
34661
|
+
ls: c.ls,
|
|
34662
|
+
...c.ls3 ? { ls3: c.ls3 } : {}
|
|
34663
|
+
};
|
|
34664
|
+
if (!leaveStands({
|
|
34665
|
+
g: this.id,
|
|
34666
|
+
...request
|
|
34667
|
+
}, this.ancestry(this.topHash))) continue;
|
|
34668
|
+
const other = held.find((r) => r.s === c.s && leaveStands({
|
|
34669
|
+
g: this.id,
|
|
34670
|
+
...r
|
|
34671
|
+
}, this.ancestry(this.topHash)));
|
|
34672
|
+
if (other && (other.ls3 || !request.ls3)) continue;
|
|
34673
|
+
held = [...held.filter((r) => r.s !== c.s), request].slice(-COMMUNITY_LIMITS.pendingLeaves);
|
|
34674
|
+
}
|
|
34675
|
+
this.state.pendingLeaves = held;
|
|
34676
|
+
}
|
|
33498
34677
|
/** The entry key is the one the main branch names; its seed comes with a `group-entry` from whoever holds it. */
|
|
33499
34678
|
followEntry() {
|
|
33500
34679
|
const key = this.currentEntryKey();
|
|
@@ -33749,6 +34928,10 @@ var CommunitySession = class {
|
|
|
33749
34928
|
return this.serialize(async () => {
|
|
33750
34929
|
this.requireAdmin();
|
|
33751
34930
|
if (!rosterHas(this.roster, memberKey) || memberKey === this.myKey) throw new Error("Not a member");
|
|
34931
|
+
if (this.state.pendingLeaves.some((r) => r.s === memberKey && leaveStands({
|
|
34932
|
+
g: this.id,
|
|
34933
|
+
...r
|
|
34934
|
+
}, this.ancestry(this.topHash)))) throw new Error("This member has left the group. Make someone else the admin.");
|
|
33752
34935
|
await this.commit("role", { s: memberKey }, now);
|
|
33753
34936
|
});
|
|
33754
34937
|
}
|
|
@@ -34380,6 +35563,9 @@ var CommunitySession = class {
|
|
|
34380
35563
|
}
|
|
34381
35564
|
const roster = this.rosterOf(found.hash);
|
|
34382
35565
|
if (!rosterHas(roster, raw.s)) return false;
|
|
35566
|
+
let pace = this.messagePace.get(raw.s);
|
|
35567
|
+
if (!pace) this.messagePace.set(raw.s, pace = new MessagePace());
|
|
35568
|
+
if (!pace.take(seenKey(raw.e, raw.h), raw.n, raw.c.length, this.hooks.clock?.() ?? Date.now())) return false;
|
|
34383
35569
|
if (!rosterHas(roster, this.myKey)) {
|
|
34384
35570
|
this.markSeen(raw);
|
|
34385
35571
|
this.keep(raw);
|
|
@@ -34577,10 +35763,23 @@ var CommunitySession = class {
|
|
|
34577
35763
|
for (const { from, frame } of ready) await this.receiveMessage(from, frame);
|
|
34578
35764
|
}
|
|
34579
35765
|
async receiveSync(from, frame) {
|
|
34580
|
-
if (!
|
|
35766
|
+
if (!isZ32Key(from) || !Number.isSafeInteger(frame.e) || typeof frame.h !== "string") return;
|
|
35767
|
+
const recent = this.isRecentMember(from), lost = recent ? void 0 : this.lostAt(from);
|
|
35768
|
+
if (!recent && !lost) return;
|
|
34581
35769
|
let answered = this.syncsAnswered.get(from);
|
|
34582
35770
|
if (!answered) this.syncsAnswered.set(from, answered = new RateWindow(COMMUNITY_LIMITS.syncAnswers, COMMUNITY_LIMITS.syncWindowMs, () => this.hooks.clock?.() ?? Date.now()));
|
|
34583
35771
|
if (!answered.take()) return;
|
|
35772
|
+
if (lost) {
|
|
35773
|
+
const at = this.mainIndex.get(frame.h);
|
|
35774
|
+
const commits = this.state.chain.slice(at !== void 0 ? at + 1 : lost.fork + 1, lost.end + 1);
|
|
35775
|
+
if (commits.length) this.answers.handOut(from, commits.map((commit) => ({
|
|
35776
|
+
t: "group-commit",
|
|
35777
|
+
v: 2,
|
|
35778
|
+
g: this.id,
|
|
35779
|
+
commit
|
|
35780
|
+
})));
|
|
35781
|
+
return;
|
|
35782
|
+
}
|
|
34584
35783
|
const answer = [];
|
|
34585
35784
|
const ask = () => {
|
|
34586
35785
|
const sync = this.question(from);
|
|
@@ -34631,8 +35830,8 @@ var CommunitySession = class {
|
|
|
34631
35830
|
const unheard = new Set(this.state.unheard ?? []);
|
|
34632
35831
|
const marked = /* @__PURE__ */ new Set();
|
|
34633
35832
|
const metas = this.metaFor(from, frame.mt);
|
|
34634
|
-
const inStore = new Set(this.state.store.map(
|
|
34635
|
-
const lasting = Object.values(this.state.lasting ?? {}).filter((f) => !inStore.has(
|
|
35833
|
+
const inStore = new Set(this.state.store.map(storeKey));
|
|
35834
|
+
const lasting = Object.values(this.state.lasting ?? {}).filter((f) => !inStore.has(storeKey(f))).sort((a, b) => a.ts - b.ts);
|
|
34636
35835
|
for (const stored of [...lasting, ...this.state.store]) {
|
|
34637
35836
|
if (stored.s === from) continue;
|
|
34638
35837
|
const high = have[stored.s]?.[seenKey(stored.e, stored.h)];
|
|
@@ -36169,6 +37368,6 @@ function x401ApprovalDigest(subject) {
|
|
|
36169
37368
|
return toBase64Url(sha256(utf8Encode(canonical)));
|
|
36170
37369
|
}
|
|
36171
37370
|
//#endregion
|
|
36172
|
-
export { COMMUNITY_LIMITS as $, fromBase64 as $C, normalizeRelayUrl as $S, readHandoffAck as $_, LIVENESS_PING_MS as $a, INVITE_VERSION as $b, isServeId as $c, emptyDhtDeliveryState as $d, LINK_PREVIEW_LIMITS as $f, HANDOFF_BUSY_REASONS as $g, encodeChunk as $h, sparkAddressKind as $i, DOMAIN_FILE_MAX_BYTES as $l, DATA_SETTLE_MS as $m, bip322MessageHash as $n, meshHubs as $o, cardLinkHost as $p, checkDidJws as $r, GROUP_PIN_FRAME as $s, carryMentions as $t, identityRevocationValue as $u, planKnocks as $v, TURN_SLOTS as $x, pacer as $y, readX401ProofResponseHeader as A, identityFromSeed as AC, DEPARTED_READS as AS, handoffContext as A_, ENDPOINT as Aa, parseImageMeta as Ab, wakeRequest as Ac, ringAuthorization as Ad, isPlayableVideoType as Af, waitForIceGathering as Ag, UNUSED_INVITE_WAIT_MAX_MS as Ah, openDidDhtPayload as Ai, SERVICES_CAPABILITY as Al, rememberAlone as Am, parseGroupMetaFrame as An, fetchesByItself as Ao, REPLY_ID as Ap, shortAtprotoDid as Ar, FileUplink as As, mergeKnocks as At, dialDescriptors as Au, ENROLL_PROOF as Av, signDeviceTransports as Ax, readLinkRecord as Ay, APP_STORE_KINDS as B, MAX_AVATAR_LENGTH as BC, RELAY_REQUESTS_PER_MINUTE as BS, handoffManifestFrames as B_, CROSSED_FRESH_MS as Ba, readContactLink as Bb, APP_RANGE_DATA_KIND as Bc, irohDescriptor as Bd, MAX_EDITS_PER_MESSAGE as Bf, MAX_SERVICES as Bg, relativizeLocation as Bh, USDT_PUBLIC_RPC as Bi, PairedSession as Bl, confirmationTag as Bm, SshSigError as Bn, GROUP_VERSION_SIGNALS as Bo, CRON_LINE as Bp, parseAtprotoVerificationKey as Br, TYPING_REFRESH_MS as Bs, mentionedMembers as Bt, IDENTITY_MAX_FRAME as Bu, readEnrollGrant as Bv, keptAtEqualSequence as Bx, APP_ICON_PATH as By, buildX401TokenObject as C, signRelayPayload as CC, BACKGROUND_REQUESTS_PER_MINUTE as CS, filePartName as C_, parseLightningDestination as Ca, signAppRevocation as Cb, newWakeToken as Cc, storageProof as Cd, voiceFileName as Cf, heardCallSignal as Cg, PRESENCE_HEARTBEAT as Ch, didDhtDocument as Ci, CALLS_CAPABILITY as Cl, MEMBER_KEY as Cm, groupMetaTag as Cn, parseEngineError as Co, reactionFrame as Cp, atprotoDidMethod as Cr, PAIRED_CALL_FRAME as Cs, MAX_KNOCKS as Ct, CAPS_PUBLISH_SPACING_MS as Cu, verifySetUpdate as Cv, deviceLinkPairing as Cx, knockSlotRecords as Cy, readX401ProofRequest as D, readDnsName as DC, CHAT_RESERVE_PER_CHAT as DS, handoffAttemptSucceeded as D_, BOLT11_PATTERN as Da, IMAGE_LIMITS as Db, relayRequest as Dc, verifyNostrProof as Dd, PLAYABLE_VIDEO as Df, pickCallCandidates as Dg, STALLED_LOOK_MS as Dh, encodeDidDhtDeactivated as Di, KNOWN_SESSION_CAPABILITIES as Dl, commitUntaggedHash as Dm, nextGroupMetaRevision as Dn, GROUP_VERSION_FILES as Do, validReactionNumber as Dp, isAtprotoDid as Dr, FILE_DATA_KIND as Ds, groupEntryUrl as Dt, CapsRefusedError as Du, ENROLL_DONE as Dv, deviceLinkSecret as Dx, mergeContactKnocks as Dy, isX401Protocol as E, encodeTxtPacket as EC, CHAT_RESERVE_MOST_SHARE as ES, handoffAttemptFailed as E_, resolveLightningDestination as Ea, verifyAppStatementBytes as Eb, readWakePayload as Ec, validExternalKey as Ed, voicePeaksOf as Ef, parseCallSignal as Eg, SIGNAL_OUT_READS as Eh, didDhtRecords as Ei, FILES_CAPABILITY as El, commitHash as Em, keepPastGroupMeta as En, GROUP_HAVE_FRAME as Eo, readReaction as Ep, checkAtprotoProofRecord as Er, ChatFiles as Es, entryParams as Et, CapsKeys as Eu, ENROLL_CANCEL_REASONS as Ev, deviceLinkSealKey as Ex, makeStampPaced as Ey, appRevocationFor as F, decrypt as FC, GROUP_RATION_WINDOW_MS as FS, handoffEphemeral as F_, parseCashuRequestPayload as Fa, readCanonicalJson as Fb, encryptPushPayload as Fc, verifyRingEvidence as Fd, EDIT_BUFFER_MS as Ff, emptyLinkRecords as Fg, GhostlyHttpError as Fh, ONCHAIN_PROVIDER as Fi, UPGRADE_CAPABILITY as Fl, verifyChain as Fm, wrapGroupMeta as Fn, readGroupWant as Fo, replySnippet as Fp, decodeDagCbor as Fr, transferStalled as Fs, GROUP_WAKE_MEMBER_INTERVAL_MS as Ft, IDENTITY_CHECK_UNAVAILABLE as Fu, enrollGrantFrame as Fv, TURN_PUT_WINDOW_MS as Fx, APP_BUNDLE_LIMITS as Fy, readAppStore as G, hasVisible as GC, SIGNALING_WINDOW_MS as GS, handoffRetryAfter as G_, DHT_PIN_GRACE_MS as Ga, deviceInviteJoinerKeyZ32 as Gb, appRangeCancelFrame as Gc, ACTIVE_DHT_POLL_MS as Gd, editFrame as Gf, isViewerTag as Gg, webLocalFetch as Gh, formatPaymentAmount as Gi, HOLD_LIMITS as Gl, newEpochSecret as Gm, sshKeyDigestHex as Gn, SIGNAL_PROVEN_MS as Go, ROUTINE_STATES as Gp, DID_DOCUMENT_MAX_BYTES as Gr, TypingSender as Gs, GroupSession as Gt, IDENTITY_REVOCATION_LABEL as Gu, MAX_MISSED as Gv, TURN_LABEL as Gx, appViewOf as Gy, checkAppListing as H, jpegSize$1 as HC, RelayTransport as HS, handoffPakeFrame as H_, CROSSED_WAIT_MS as Ha, DEVICE_INVITE_LIFETIME_S as Hb, APP_RANGE_FRAMES as Hc, rankTransports as Hd, REMOVED_TEXT as Hf, decodeServices as Hg, sanitizeRequestHeaders as Hh, arkAddressPrefix as Hi, SESSION_RECEIVE_PENDING as Hl, edgeParams as Hm, parseSshSignature as Hn, SIGNAL_CARRIERS as Ho, PR_CHECKS as Hp, unsignedCommitBytes as Hr, TYPING_STATUS_MAX as Hs, GROUP_LIMITS as Ht, IDENTITY_MAX_VALIDITY as Hu, verifyEnrollProof as Hv, TOMBSTONE_SEQUENCE as Hx, APP_SCREENSHOTS_DIR as Hy, appStoreDecision as I, encrypt as IC, GROUP_SIGNALING_ALLOWANCE_SHARE as IS, handoffFileMissingFrame as I_, parseFedimintRequestPayload as Ia, CONTACT_LINK_BYTES as Ib, generateVapidKeys as Ic, RELAY_URL as Id, EDIT_FRAME as If, isEmptyLinkPacket as Ig, HttpClient as Ih, PaymentPreflightError as Ii, WAKE_SESSION_CAPABILITY as Il, verifyCommit as Im, SSHSIG_MAX_ARMOR as In, readGroupWantNo as Io, wireReply as Ip, encodeDagCbor as Ir, TYPING_FRAME as Is, GROUP_WAKE_RECEIVE_LIMIT as It, IDENTITY_CLOCK_SKEW as Iu, enrollHelloFrame as Iv, TURN_RAISE_READ_TIMEOUT_MS as Ix, APP_BUNDLE_MAGIC as Iy, GROUP_TYPING_FRAME as J, stripHidden as JC, TURN_SOURCE_TIMEOUT_MS as JS, handoffVerifiedMessage as J_, GhostLink as Ja, readDeviceInvite as Jb, appRangeEndFrame as Jc, DHT_MESSAGE_TTL as Jd, parseEditedFrame as Jf, servicesToWire as Jg, LIMITS as Jh, validatePaymentTarget as Ji, isHoldUrl as Jl, sealPair as Jm, isLegacySignature as Jn, readGroupSignal as Jo, TASK_STATUSES as Jp, DID_JWS_ALGS as Jr, sanitizeTypingStatus as Js, frameBytes as Jt, IdentityCheckUnavailable as Ju, REOPEN_BELOW as Jv, TURN_NAME_BYTES as Jx, checkAppManifest as Jy, readAppStoreSteps as K, sanitizeDisplayText as KC, SLOW_DEMOTE_MS as KS, handoffStreamKey as K_, EARLY_DIAL_JOIN_MS as Ka, deviceInviteJoinerParams as Kb, appRangeChunk as Kc, DHT_FILE_REFUSED as Kd, editedFrame as Kf, serviceIdFromName as Kg, CHUNK_FLAG_END as Kh, isWalletNetwork as Ki, HoldKeys as Kl, openPair as Km, sshSignCommand as Kn, SIGNAL_REPLY_MS as Ko, RUN_RESULTS as Kp, DID_FILE_MAX_BYTES as Kr, parseTypingActivity as Ks, asWritten as Kt, IDENTITY_STATEMENT_PREFIX as Ku, MAX_WAITING as Kv, TURN_LAST_SEQUENCE as Kx, assembleAppBundle as Ky, appUpdateDecision as L, generateEncryptionKey as LC, HEDGE_MISSING_MS as LS, handoffFileRequestFrame as L_, ANSWERS_REFUSED_PAUSES as La, CONTACT_LINK_VERSION as Lb, pushRequest as Lc, TRANSPORTS as Ld, EDIT_RATE_WINDOW_MS as Lf, parseLinkRecords as Lg, HttpHost as Lh, SEPOLIA_TEST_USDT as Li, parseSessionCapabilities as Ll, verifyCommitSignature as Lm, SSHSIG_NAMESPACE as Ln, CARRIED_DEFER_MS as Lo, ACTIVE_TASK_STATUSES as Lp, findInMst as Lr, TYPING_KINDS as Ls, GroupWakeLimiter as Lt, IDENTITY_FRAME_LIMIT as Lu, enrollMessage as Lv, TURN_SETTLE_MS as Lx, APP_CLIENTS as Ly, readX401ProofResultHeader as M, publicKeyFromZ32 as MC, GROUP_BURST_MS as MS, handoffDataFrame as M_, fedimintRequestPayload as Ma, readImageMeta as Mb, WebPushError as Mc, ringEvidence as Md, parseVideoMeta as Mf, MAX_MSGS_PAYLOAD_B64 as Mg, countUnusedInvite as Mh, signDidDhtPacket as Mi, STATUS_CARD_CAPABILITY as Ml, rosterHas as Mm, parseGroupMetaTag as Mn, isGroupMessageId as Mo, groupReplyAuthor as Mp, AtprotoProofError as Mr, encodeFileData as Ms, GROUP_WAKE_FRAME as Mt, encodePacketTransports as Mu, enrollCancelReason as Mv, verifyDeviceTransports as Mx, requestRecords as My, x401AnswerableRequests as N, sign as NC, GROUP_BURST_ONE_LINK as NS, handoffDigest as N_, findEndpoint as Na, canonicalJson as Nb, checkPushEndpoint as Nc, validRingKey as Nd, EDITED_FRAME as Nf, RECORD_TTL as Ng, presenceSeenAt as Nh, ETHEREUM_USDT as Ni, SessionCapabilities as Nl, signCommit as Nm, signGroupMeta as Nn, readGroupFileMeta as No, pairedReplyAuthor as Np, atprotoCidFor as Nr, refusalText as Ns, GROUP_WAKE_GROUP_LIMIT as Nt, parsePacketTransports as Nu, enrollDigits as Nv, seedSigner as Nx, seenEntry as Ny, readX401ProofRequestHeader as O, IDENTITY_MEMO_SIZE as OC, CHAT_WATCH_SHARE as OS, handoffBusyFrame as O_, decodeBolt11 as Oa, imageSize as Ob, wakeFrame as Oc, verifyPeerProof as Od, VIDEO_LIMITS as Of, sdpHasCandidates as Og, TRANSPORTS_GONE_MS as Oh, encodeDidDhtPacket as Oi, PIN_CAPABILITY as Ol, expectedRoster as Om, openGroupMeta as On, GROUP_WANT_FRAME as Oo, wireReaction as Op, normalizeAtprotoHandle as Or, FILE_FRAMES as Os, knockIdentity as Ot, DHT_TEXT_CAPABILITY as Ou, ENROLL_GRANT as Ov, devicePingFrame as Ox, openRequest as Oy, addedAppPermissions as P, verify as PC, GROUP_OVER_PACE_MS as PS, handoffDoneFrame as P_, isFederationId as Pa, canonicalJsonBytes as Pb, decryptPushPayload as Pc, verifyRingAuthorization as Pd, EDIT_BUFFER_MAX as Pf, buildLinkRecords as Pg, unusedInviteWait as Ph, EVM_TEST_CHAINS as Pi, TYPING_CAPABILITY as Pl, sortRoster as Pm, verifyGroupMetaSignature as Pn, readGroupHave as Po, readReply as Pp, decodeAtprotoCommit as Pr, transferEnded as Ps, GROUP_WAKE_GROUP_WINDOW_MS as Pt, IDENTITY_CHALLENGE_WINDOW as Pu, enrollDoneFrame as Pv, webCryptoSigner as Px, stampHolds as Py, sealGroupTyping as Q, concatBytes as QC, currentRelays as QS, openHandoffPiece as Q_, LIVENESS_MISSED_PINGS as Qa, INVITE_MAX_LENGTH as Qb, encodeAppRangeData as Qc, LIVE_POLL_MS as Qd, LINK_MAX_CHARS as Qf, HANDOFF_BUSY as Qg, decodeControl as Qh, isSparkAddress as Qi, DNS_TYPE as Ql, CONNECT_TIMEOUT_MS as Qm, MessageRefusal as Qn, mayBeHub as Qo, cardLine as Qp, DidError as Qr, COMMUNITY_PIN_FRAME as Qs, GROUP_EDIT_TEXT_BYTES as Qt, identityPresentationBytes as Qu, newInbox as Qv, TURN_SIGNED_BYTES as Qx, isAppUrl as Qy, checkAppBeforeRun as R, sealedLength as RC, HEDGE_MS as RS, handoffHaveFrames as R_, ANSWERS_REFUSED_PAUSE_MS as Ra, createContactLink as Rb, vapidAuthorization as Rc, automaticTransport as Rd, EDIT_RECEIVE_LIMIT as Rf, HTTP_SERVICE_PROTO as Rg, formatLocalTarget as Rh, SEPOLIA_TEST_USDT_FAUCET as Ri, sessionCapabilitiesFrame as Rl, GROUP_PROFILE as Rm, SSH_KEY_TYPES as Rn, CarriedTransport as Ro, BUTTON_ID as Rp, parseAtprotoCar as Rr, TYPING_RATE_LIMIT as Rs, groupWakeFrame as Rt, IDENTITY_FRAME_WINDOW_MS as Ru, enrollProofFrame as Rv, TURN_VISIBLE_MS as Rx, APP_CLIENT_NAME as Ry, buildX401ResultArtifact as S, readOwnRelayPayload as SC, turnVerifierMark as SS, filePartDigest as S_, parseInvoiceCallback as Sa, signAppObject as Sb, deviceWakeRequest as Sc, proofStatement as Sd, voiceDownloadName as Sf, extractParamsFromSdp as Sg, OFFER_STEP_MAX as Sh, decodeDidDhtPacket as Si, BUTTONS_CAPABILITY as Sl, MAX_GROUP_MEMBERS as Sm, groupMetaPicture as Sn, engineText as So, reactionEmoji as Sp, ATPROTO_PROOF_SCOPE as Sr, MAX_PAIRED_CALL_SIGNAL as Ss, KNOCK_TTL_MS as St, CAPS_LIMITS as Su, signTombstone as Sv, deviceKeyZ32 as Sx, knockSlotOf as Sy, encodeX401Header as T, decodeTxtPacket as TC, CHAT_RESERVE as TS, handoffAttemptAllowed as T_, requestLnurlInvoice as Ta, verifyAppSignature as Tb, readWake as Tc, storageProofPath as Td, voiceLevelsOf as Tf, keepsToRelays as Tg, RELAY_POLL_INTERVALS as Th, didDhtKey as Ti, FILES_BINARY_CAPABILITY as Tl, SAID_AGAIN as Tm, groupName as Tn, GROUP_FILE_LIMITS as To, readDhtReactions as Tp, atprotoProofRkey as Tr, parsePairedCallFrame as Ts, encodeGroupEntryLink as Tt, CapsExchange as Tu, ENROLL_CANCEL as Tv, deviceLinkRendezvousSeed as Tx, makeStamp as Ty, checkAppStoreIndex as U, sanitizeAvatar as UC, RelaysFailedError as US, handoffReleaseFrame as U_, DEMOTE_AFTER_FAILURES as Ua, DEVICE_INVITE_OWN_DEVICE as Ub, APP_RANGE_LIMITS as Uc, relayedTransports as Ud, RateWindow as Uf, encodeServices as Ug, sanitizeResponseHeaders as Uh, assertTokenUnits as Ui, HOLD_CAPABILITY as Ul, encryptText as Um, sameSshKey as Un, SIGNAL_FRESH_MS as Uo, PR_STATES as Up, verifyAtprotoRecordProof as Ur, TYPING_TIMEOUT_MS as Us, GROUP_REACTED_FRAME as Ut, IDENTITY_PROOF_CAPABILITY as Uu, FLOOD_PER_DAY as Uv, TOMBSTONE_TURN as Ux, APP_VIEWS as Uy, APP_STORE_LIMITS as V, MAX_AVATAR_SIDE as VC, REQUESTS_PER_MINUTE as VS, handoffOfferFrame as V_, CROSSED_PROBE_MS as Va, DEVICE_INVITE_BYTES as Vb, APP_RANGE_ERRORS as Vc, irohRelayUrl as Vd, MAX_REMOVAL_NUMBER as Vf, SERVICES_VERSION as Vg, resolveTargetUrl as Vh, WALLET_NETWORKS as Vi, SESSION_FRAME_MAX as Vl, decryptText as Vm, parseSshPublicKey as Vn, SIGNALS_PER_MINUTE as Vo, ITEM_STATES as Vp, readAtprotoCid as Vr, TYPING_SEND_LIMIT as Vs, parseGroupWakeFrame as Vt, IDENTITY_MAX_RECEIVED as Vu, readEnrollHello as Vv, turnPutSummary as Vx, APP_PERMISSIONS as Vy, readAppListing as W, MAX_NICK_LENGTH as WC, SIGNALING_ALLOWANCE_SHARE as WS, handoffRequestFrame as W_, DEMOTE_MS as Wa, createDeviceInvite as Wb, AppRanges as Wc, transportOrder as Wd, dhtEditId as Wf, isValidServiceId as Wg, viewerResponseHeaders as Wh, assertWholeSats as Wi, HOLD_DATED_BACK_MS as Wl, epochKeys as Wm, sshFingerprint as Wn, SIGNAL_HOLD_MS as Wo, REMOVABLE_KINDS as Wp, verifyAtprotoSignature as Wr, TypingReceiver as Ws, GROUP_READ_NOTE as Wt, IDENTITY_PROVIDER_ID as Wu, MAX_DONE as Wv, TURN_BODY_BYTES as Wx, appDigest as Wy, groupTypingEpoch as X, unwrapPasted as XC, WAY_BACK_SHARE as XS, isHandoffPartName as X_, INVITER_DIAL_GRACE_MS as Xa, INVITE_HRP as Xb, appRangeGetFrame as Xc, DHT_TEXT_REFUSED as Xd, validEditNumber as Xf, HANDOFF_ACK as Xg, PROTOCOL_VERSION as Xh, SPARK_NETWORKS as Xi, readManifest as Xl, sha256Hex as Xm, verifyBitcoinMessage as Xn, MESH_HUBS as Xo, buttonLabelClash as Xp, DID_MAX_LENGTH as Xr, typingFrame as Xs, COMMUNITY_EDIT_FRAME as Xt, boundVerifiedIdentity as Xu, endedRequests as Xv, TURN_REV_LIMIT as Xx, isAppLicense as Xy, GroupTypingBoard as Y, trimEndOf as YC, WATCH_SHARE as YS, handoffVersions as Y_, HANDLED_WAIT_MS as Ya, DEVICE_INVITE_VERSION as Yb, appRangeErrorFrame as Yc, DHT_TEXT_BYTES as Yd, validEditMessage as Yf, viewerTag as Yg, MAX_CHUNK_PAYLOAD_BYTES as Yh, walletNetworkOf as Yi, newMailbox as Yl, sealSecret as Ym, legacyMessageHash as Yn, GROUP_VERSION_HUBS as Yo, appCardId as Yp, DID_JWS_MAX_LENGTH as Yr, typingActivity as Ys, groupMessageId as Yt, IdentityExchange as Yu, clearMissed as Yv, TURN_NO_ACTIVE as Yx, findAppForbiddenKey as Yy, openGroupTyping as Z, bytesEqual as ZC, WRITE_FIRST_MS as ZS, newHandoffId as Z_, INVITE_TAKEN as Za, INVITE_LINK_ORIGIN as Zb, decodeAppRangeData as Zc, DhtDelivery as Zd, validRemovalNumber as Zf, HANDOFF_ATTEMPTS as Zg, decodeChunk as Zh, SPARK_PROVIDER as Zi, DNS_LABEL as Zl, ANSWER_REFUSED_REDIALS as Zm, BIP322_REVISION as Zn, NO_HUB_POLICY as Zo, cardEditNumber as Zp, DID_METHODS as Zr, typingKindOf as Zs, GROUP_EDIT_FRAME as Zt, emptyIdentityLedger as Zu, inboxRecord as Zv, TURN_SEALED_BYTES as Zx, isAppPath as Zy, X401_PROTOCOLS as _, createRelayPayload as _C, turnPayloadSequence as _S, HANDOFF_TIMINGS as __, LIGHTNING_DESTINATION_PATTERN as _a, readAppRevocation as _b, WAKE_FRAME as _c, importedProof as _d, fileMessageText as _f, callRtcConfig as _g, IDLE_THRESHOLD as _h, DID_DHT_MAX_PAYLOAD as _i, isChatAppId as _l, GROUP_ID as _m, encodeGroupMetaBody as _n, parsePaymentNetworks as _o, nextReactionNumber as _p, u64 as _r, readBeacon as _s, shortHash as _t, txtValue as _u, encodeSetSlots as _v, ENROLL_CAPABILITY as _x, STAMP_BITS_MAX as _y, X401_DCQL_LIMITS as a, BREAKER_MAX_MS as aC, nextTurnPosition as aS, HANDOFF_FILE_REQUEST as a_, PUBKY_PROOF_ROOT as aa, APP_PREFIXES as ab, nextPinNumber as ac, revokesIdentity as ad, FileTransfers as af, RTC_SIGNAL_FUTURE_MS as ag, STALLED_EVIDENCE_MS as ah, didWebFile as ai, APP_RATE_LIMIT as al, sameButtonText as am, MENTION_EVERYONE as an, RACE_ANSWERED_MS as ao, sanitizePreviewImage as ap, ByteReader as ar, beaconKeys as as, communityHasFrame as at, decodeDnsResponse as au, readHandoffHave as av, toBase64Url as aw, encodeInviteCode as ax, KNOCK_SLOTS as ay, buildX401ProofRequest as b, openRelayPayload as bC, turnSignedMessage as bS, HANDOFF_WINDOW as b_, findLightningDestination as ba, readAppSignature as bb, WAKE_TTL_SECONDS as bc, proofCapability as bd, parseVoiceMeta as bf, contactRtcConfig as bg, OFFER_FAST_MS as bh, DID_DHT_VERSION as bi, APPS_CAPABILITY as bl, LEGACY_GROUP_MEMBERS as bm, groupMetaChange as bn, EngineError as bo, queueReaction as bp, ATPROTO_FULL_SCOPE as br, shouldBeHub as bs, verifyCommunityCommit as bt, CAPS_ISSUED_BACK_MS as bu, setUpdateFrame as bv, deviceEchoNonce as bx, knockHolds as by, readX401DcqlQuery as c, DiscoveryBudgetError as cC, readTurnPacket as cS, HANDOFF_LATER_BYTES as c_, newPubkyProofFolder as ca, appRef as cb, pinFrame as cc, IDENTITY_TIMELINE_MAX as cd, safeBlobType as cf, extractRtcParams as cg, DIRECT_PEERS as ch, didWebHost as ci, APP_SEND_LIMIT as cl, taskProgress as cm, mentionsMember as cn, REDESCRIBED_GRACE_MS as co, forwardedMany as cp, decodeBitcoinAddress as cr, freshHubs as cs, communityUntaggedHash as ct, domainWellKnownFile as cu, readHandoffPake as cv, utf8Encode as cw, inviteQrSegments as cx, MAX_SEEN as cy, newX401HolderKey as d, isDiscoveryBudgetError as dC, signTurnPacket as dS, HANDOFF_OFFER as d_, pubkyProofFile as da, appSignedBytes as db, pinnedFrame as dc, PROOF_ADAPTERS as dd, PLAYABLE_AUDIO as df, CALL_SIGNAL_FUTURE_MS as dg, symmetricNat as dh, parseDidDocument as di, appCloseFrame as dl, arrivalKey as dm, GROUP_META_PAST as dn, SWITCH_RETIRE_MS as do, GROUP_REACTION_FRAME as dp, encodeTx as dr, lobbyRecords as ds, encodeCommunityLink as dt, nip05RootKey as du, readHandoffVerified as dv, __exportAll as dw, pastedAgain as dx, REQUEST_LABEL as dy, readRelayBody as eC, TURN_TTL as eS, HANDOFF_CANCEL as e_, sparkInvoiceDetails as ea, readAppBundle as eb, PINNED_FRAME as ec, identityStatement as ed, peekDhtMailbox as ef, encodeControl as eg, DataLink as eh, checkDidSignature as ei, parseAppRangeFrame as el, cardTimeUtc as em, communityEditFrame as en, MAX_PAIRED_MESSAGE_FRAME as eo, canonicalUrl as ep, bip322ToSign as er, meshRendezvous as es, COMMUNITY_PROFILE as et, DOMAIN_MAX_RECORDS as eu, readHandoffBusy as ev, fromBase64Url as ew, OwnInviteError as ex, settleRequest as ey, readX401SdJwtVc as f, withRequestOptions as fC, signTurnRelease as fS, HANDOFF_PAKE as f_, pubkyProofPath as fa, checkAppRevokeStatement as fb, readPin as fc, PROOF_CAPABILITY as fd, RECORDING_TYPES as ff, CALL_SIGNAL_MAX_AGE_MS as fg, AWAITING_PEER_MS as fh, parseDidJws as fi, appDataBytes as fl, claimedTime as fm, GROUP_META_PAST_CHARS as fn, UNPROVEN_AUTH_MS as fo, QUICK_REACTIONS as fp, encodeWitness as fr, mergeBeacon as fs, leaveStands as ft, normalizeDomain as fu, sameDigest as fv, __require as fw, readInviteCode as fx, REQUEST_LIFETIME_MS as fy, X401_LIMITS as g, RELAY_PAYLOAD_MAX_BYTES as gC, turnPacket as gS, HANDOFF_REQUEST as g_, pubkyHomeserverOf as ga, isAppSignature as gb, WAKE_CALL_WAIT_MS as gc, emptyProofLedger as gd, downsamplePeaks as gf, buildSdpFromSignal as gg, FIRST_PUBLISH_MAX_MS as gh, strictBase64Url as gi, isAppVersion as gl, GROUP_ADMIN_OFF_ERROR as gm, MAX_GROUP_PICTURE_LENGTH as gn, pairedMessageFrame as go, ReactionWindow as gp, u32$1 as gr, rankHubs as gs, rosterHash as gt, recordsName as gu, SET_UPDATE as gv, DEVICE_PING_FRAME as gx, STAMP_BITS_DEFAULT as gy, X401_HEADERS as h, PacketTooLargeError as hC, turnName as hS, HANDOFF_RELEASE as h_, homeserverWebEndpoint as ha, isAppRef as hb, WAKE_CALL_TTL_SECONDS as hc, STORAGE_ROOT as hd, baseMime as hf, answersOffer as hg, EXPECT_PEER_MS as hh, staticDidDocument as hi, chatAppId as hl, shownTime as hm, MAX_GROUP_NAME_LENGTH as hn, pairedMessageFits as ho, REACTION_LIMITS as hp, txHash as hr, pickHubs as hs, leftStatement as ht, recordsFromWellKnown as hu, SET_ACK as hv, DEVICE_ECHO_FRAME as hx, REQUEST_TEXT_BYTES as hy, x401ApprovalDigest as i, BREAKER_BASE_MS as iC, firstDeviceSetSecret as iS, HANDOFF_FILE_MISSING as i_, PUBKY_PROOF_MAX_BYTES as ia, APP_NAME as ib, mayPin as ic, receivedIdentityStatus as id, readDhtFile as if, DATA_CHANNEL_LABEL as ig, REANSWERS as ih, didWebDocumentUrl as ii, APP_PEER_OPEN_MAX as il, removedCardText as im, validEditText as in, PONG_WAIT_MS as io, previewImageSize as ip, BitcoinAddressError as ir, COMMUNITY_TOPOLOGY as is, communityGroupId as it, WELL_KNOWN_PATH as iu, readHandoffFileFrame as iv, toBase64 as iw, encodeGhostlyInvite as ix, ContactRequestError as iy, readX401ProofResult as j, identityFromSeedB64 as jC, FRESH_READ_MS as jS, handoffContextProof as j_, cashuRequestPayload as ja, previewable as jb, PUSH_SERVICE_HOSTS as jc, ringClaims as jd, isVideoMime as jf, LABEL$1 as jg, WATCH_PEER_MS as jh, resolveDidDht as ji, SESSION_CAPABILITIES_FRAME as jl, rosterAdmin as jm, parseGroupMetaStatement as jn, groupFileFallback as jo, REPLY_LIMITS as jp, AtprotoCid as jr, decodeFileData as js, readKnocks as jt, emptyCapsState as ju, enrollCancelFrame as jv, unsignedDeviceTransports as jx, requestPlaintextBytes as jy, readX401ProofResponse as k, createIdentity as kC, DEFAULT_RELAYS as kS, handoffCancelFrame as k_, findBolt11 as ka, isImageMime as kb, wakePayload as kc, RING_LIFETIME as kd, formatVideoDuration as kf, signalHasVideo as kg, UNUSED_INVITE_READS_PER_MINUTE as kh, jwkThumbprint as ki, REACTIONS_CAPABILITY as kl, parseGroupCommit as km, parseGroupMetaBody as kn, GROUP_WANT_NO_FRAME as ko, PAIRED_REPLY_AUTHORS as kp, parseAtprotoDidDocument as kr, FILE_LIMITS as ks, knockRecords as kt, capsDescriptors as ku, ENROLL_HELLO as kv, newDeviceSetSecret as kx, readKnockSlot as ky, x401VpToken as l, budgetRetryMs as lC, sealTurnBody as lS, HANDOFF_LIST_PER_FRAME as l_, normalizePubkyKey as la, appRefPublisher as lb, pinIsNewer as lc, applyIdentityEvent as ld, sanitizeFileName as lf, offerIsFresh as lg, DirectPathWatch as lh, normalizeDid as li, APP_VERSION_MAX as ll, usageLeft as lm, validMentions as ln, RESUME_WAIT_MS as lo, readForwarded as lp, decodeTx as lr, hubRank as ls, decodeCommunityLink as lt, encodeDnsQuery as lu, readHandoffRelease as lv, __commonJSMin as lw, inviteQrText as lx, MAX_SLOT_KNOCKS as ly, x401HolderJwk as m, PKARR_FUTURE_SKEW_MS as mC, turnKeys as mS, HANDOFF_PIECE_OVERHEAD as m_, encodeSvcbPacket as ma, isAppKey as mb, WAKE_CALL_INTERVAL_MS as mc, STORAGE_LIFETIME as md, VOICE_METER as mf, RTC_CONFIG as mg, DHT_POLL_INTERVALS as mh, signingKeys as mi, appOpenFrame as ml, receivedTimestamp as mm, MAX_GROUP_NAME_BYTES as mn, WAKE_LOST_MS as mo, REACTION_FRAME as mp, sha256d as mr, newerHead as ms, leaveStatement3 as mt, recordsFromTxt as mu, sortParts as mv, DEVICE_CAPABILITIES as mx, REQUEST_PACKET_BYTES as my, X401_RESPONSE_MODES as n, traceLink as nC, TurnRecordError as nS, HANDOFF_DATA as n_, BITCOIN_NETWORKS as na, sha256Paced as nb, PIN_FRAME as nc, isIdentityBinding as nd, dhtFileElements as nf, wrapDataChannel as ng, GATHER_STALL_MS as nh, didJwsAlg as ni, APP_DATA_MAX_BYTES as nl, checkStatusCard as nm, meshMessageRef as nn, PAIRING_ATTEMPT_MS as no, linksIn as np, decodeBase64 as nr, pickMeshHubs as ns, GROUP_READ_NOTE_COMMUNITY as nt, DOMAIN_TXT_MAX_BYTES as nu, readHandoffData as nv, isZ32Key as nw, createLink as nx, turnOff as ny, matchX401Dcql as o, BREAKER_THRESHOLD as oC, openTurnValue as oS, HANDOFF_HAVE as o_, isPubkyKey as oa, APP_STATEMENT_LIMITS as ob, parsePinFrame as oc, signIdentityPresentation as od, PREVIEWABLE_IMAGE as of, RTC_SIGNAL_MAX_AGE_MS as og, DIRECT_EVIDENCE_MS as oh, didWebFileNames as oi, APP_RATE_WINDOW_MS as ol, statusCardBytes as om, MENTION_LIMITS as on, RACE_DIRECT_MS as oo, FORWARD_LIMITS as op, compactSize as or, beaconRecords as os, communityMessageId as ot, dnsProofName as ou, readHandoffHello as ov, toZ32 as ow, inviteLink as ox, KNOCK_SLOT_LABEL as oy, sameX401HolderJwk as p, MAX_DNS_PACKET_BYTES as pC, turnInstance as pS, HANDOFF_PIECE_BYTES as p_, decodeSvcbRecords as pa, isAppHash as pb, DEVICE_WAKE_TTL_SECONDS as pc, PeerProofs as pd, VOICE_LIMITS as pf, PAIRED_CALL_CANDIDATES as pg, DEPARTED_READ_MS as ph, parseDidSignaturePaste as pi, appDataFrame as pl, heardTime as pm, MAX_GROUP_META_BODY as pn, WAKE_ANSWER_GRACE_MS as po, REACTED_FRAME as pp, hash160 as pr, mergeLobby as ps, leaveStatement as pt, parseDomainTxt as pu, sealHandoffPiece as pv, __toCommonJS as pw, DEVICES_CAPABILITY as px, REQUEST_NAME_UNITS as py, signAppStore as q, sanitizeNick as qC, SLOW_MS as qS, handoffVerifiedFrame as q_, FIRST_PAIRING_PACE_MS as qa, encodeDeviceInvite as qb, appRangeDataFrame as qc, DHT_FILE_TOO_LARGE as qd, parseEditFrame as qf, servicesFromWire as qg, CHUNK_KIND as qh, parsePaymentAmount as qi, HoldRefusedError as ql, openSecret as qm, verifySshSignature as qn, groupSignalFrame as qo, STATUS_CARD_LIMITS as qp, DID_GHOSTLY_SERVICE as qr, parseTypingFrame as qs, chainPieces as qt, IDENTITY_SUBJECT as qu, NEW_PER_HOUR as qv, TURN_MAX as qx, buildAppBundle as qy, readX401OpenId4VpRequest as r, BREAKER_ALL_DOWN_PROBE_MS as rC, encodeTurnFields as rS, HANDOFF_DONE as r_, isBitcoinAddress as ra, yieldThread as rb, PIN_LIMITS as rc, newIdentityBinding as rd, dhtFileId as rf, DATA_CHANNEL_ID as rg, OFFER_HOST_GATHER_MS as rh, didSignedMessages as ri, APP_FRAME as rl, readStatusCard as rm, parseCommunityEdit as rn, PAIRING_RETRY_MS as ro, parseLinkPreview as rp, verifyBip322 as rr, wireHubPolicy as rs, communityCommitHash as rt, NIP05_PATH as ru, readHandoffDone as rv, randomBytes as rw, decodeInviteCode as rx, CONTACT_RECORD_TTL as ry, presentX401SdJwtVc as s, RelayBreaker as sC, readTurnBody as sS, HANDOFF_HELLO as s_, isPubkyProofFolder as sa, appFingerprint as sb, parsePinnedFrame as sc, verifyIdentityPresentation as sd, formatFileSize as sf, buildDataSdp as sg, DIRECT_OWN_ATTEMPTS as sh, didWebFileUrl as si, APP_RESUME_GRACE_MS as sl, statusCardText as sm, mentionsBytes as sn, RACE_RELAYED_MS as so, forwardedAgain as sp, decodeAnyBitcoinAddress as sr, doorHubs as ss, communityRoster as st, domainTxtRecord as su, readHandoffManifest as sv, utf8Decode as sw, inviteOwnership as sx, LINK_RECORD_LABEL as sy, X401_REQUEST_LIMITS as t, setLinkTraceSink as tC, TURN_VERSION as tS, HANDOFF_CANCEL_REASONS as t_, sparkNetworkOf as ta, readAppBundleAsync as tb, PIN_CLOCK_SKEW_MS as tc, identityStatementText as td, DHT_FILE_CAPABILITY as tf, sendBody as tg, GATHER_ATTEMPTS as th, didGhostlyServiceEntry as ti, readAppRangeFrame as tl, cardUrl as tm, communityMessageAuthor as tn, PAIRED_FRAME_TOO_LARGE as to, linkEnd as tp, bip322ToSpend as tr, parseHubPolicy as ts, CommunitySession as tt, DOMAIN_METHODS as tu, readHandoffCancel as tv, fromZ32 as tw, createChatInvite as tx, takeRequest as ty, X401_CREDENTIAL_LIMITS as u, heldBackError as uC, signTurnBody as uS, HANDOFF_MANIFEST as u_, pubkyProofCapability as ua, appRevocationId as ub, pinNumberHolds as uc, lastSharedWithMe as ud, sanitizeMime as uf, parseRtcSignal as ug, directBlocked as uh, parseDid as ui, AppSessions as ul, MESSAGE_CLOCK_SKEW_MS as um, wireMentions as un, RTC_UNSTARTED_MS as uo, COMMUNITY_REACTION_FRAME as up, decodeWitness as ur, lobbyKeys as us, derivedSecret as ut, isPublicAddress as uu, readHandoffTurnFrame as uv, __esmMin as uw, ownInviteRefusal as ux, REQUEST_CLOCK_SKEW_MS as uy, X401_SCHEME as v, measureRecords as vC, turnReleaseMessage as vS, HANDOFF_VERIFIED as v_, LNURL_LIMITS as va, readAppRevocationShape as vb, WAKE_INTERVAL_MS as vc, isProofAdapter as vd, formatVoiceDuration as vf, callSignalHeardAt as vg, LinkSession as vh, DID_DHT_PREFIX as vi, parseAppFrame as vl, GROUP_MEMBER_CAP as vm, groupDisplayName as vn, publishFailure as vo, parseReactedFrame as vp, varBytes as vr, readBeaconHead as vs, signCommunity as vt, validDomainRecord as vu, readSetUpdate as vv, HANDOFF_CAPABILITY as vx, STAMP_BITS_MIN as vy, decodeX401Header as w, decodeDnsAnswers as wC, BACKGROUND_WHILE_SIGNALING as wS, handoffAckFrame as w_, parsePayParams as wa, verifyAppRevocation as wb, parseWakeFrame as wc, storageProofBody as wd, voiceLevel as wf, isGlobalIpv4Host as wg, PRESENCE_WINDOW as wh, didDhtFromPublicKey as wi, EDIT_CAPABILITY as wl, OWN_FRAME_LIMIT as wm, groupMetaToHand as wn, PairingTracker as wo, reactionIsNewer as wp, atprotoProofRecord as wr, PairedCalls as ws, decodeGroupEntryLink as wt, CAPS_REFRESH_MS as wu, DEVICE_KINDS as wv, deviceLinkParams as wx, linkRecords as wy, buildX401ProofResult as x, parseRelayPayload as xC, turnStatedVerifier as xS, NO_ATTEMPTS as x_, invoiceCallbackUrl as xa, setAppSignatureFastPath as xb, WakeLimiter as xc, proofHash as xd, recordingMime as xf, decompressSdp as xg, OFFER_LOOK_MS as xh, DidDhtError as xi, APP_RANGES_CAPABILITY as xl, MAX_GROUP_CHAIN as xm, groupMetaNewer as xn, engineError as xo, reactedFrame as xp, ATPROTO_PROOF_COLLECTION as xr, validHead as xs, GROUP_ENTRY_PROFILE as xt, CAPS_LABEL as xu, setUpdateMessage as xv, deviceFrameCapability as xx, knockSlotIdentity as xy, X401_VERSION as y, newerPacket as yC, turnSequence as yS, HANDOFF_VERSION as y_, fetchLnurlJson as ya, readAppRevocations as yb, WAKE_SUBJECT as yc, nostrProofTemplate as yd, isPlayableAudioType as yf, compressSdp as yg, MAX_DHT_TEXT_BYTES as yh, DID_DHT_TTL as yi, readAppFrame as yl, GROUP_VERSION_LARGE as ym, groupMetaBody as yn, ENGINE_ERRORS as yo, parseReactionFrame as yp, ATPROTO_DECLARED_SCOPE as yr, readLobby as ys, verifyCommunityChain as yt, wellKnownUrl as yu, setAckFrame as yv, deviceEchoFrame as yx, contactDay as yy, planAppUpdate as z, tryDecrypt as zC, PREVIOUS_DEFAULT_RELAYS as zS, handoffHelloFrame as z_, BLOCKED_DIAL_WAIT_MS as za, encodeContactLink as zb, vapidKeysMatch as zc, checkedDescriptors as zd, EDIT_SEND_LIMIT as zf, LEGACY_SERVICES as zg, parseLocalTarget as zh, TEST_USDT_FAUCET_AMOUNT as zi, PAIRED_PROFILE as zl, confirmationMatches as zm, SSH_PUBLIC_KEY_MAX as zn, GROUP_SIGNAL_FRAME as zo, BUTTON_STYLES as zp, parseAtprotoDidKey as zr, TYPING_RATE_WINDOW_MS as zs, groupWakes as zt, IDENTITY_MAX_EVIDENCE as zu, formatEnrollDigits as zv, classifyTurnRead as zx, APP_FORBIDDEN_KEYS as zy };
|
|
37371
|
+
export { COMMUNITY_LIMITS as $, identityFromSeed as $C, FRESH_READ_MS as $S, handoffDataFrame as $_, LIVENESS_PING_MS as $a, readImageMeta as $b, encodeAppRangeData as $c, LIVE_POLL_MS as $d, LINK_MAX_CHARS as $f, MAX_MSGS_PAYLOAD_B64 as $g, countUnusedInvite as $h, sparkAddressKind as $i, DNS_TYPE as $l, sha256Hex as $m, bip322MessageHash as $n, meshHubs as $o, buttonLabelClash as $p, checkDidJws as $r, COMMUNITY_PIN_FRAME as $s, carryMentions as $t, identityPresentationBytes as $u, enrollCancelReason as $v, verifyDeviceTransports as $x, requestRecords as $y, readX401ProofResponseHeader as A, RelayBreaker as AC, sealTurnBody as AS, HANDOFF_LIST_PER_FRAME as A_, ENDPOINT as Aa, appRefPublisher as Ab, wakePayload as Ac, RING_LIFETIME as Ad, formatVideoDuration as Af, offerIsFresh as Ag, directBlocked as Ah, openDidDhtPayload as Ai, REACTIONS_CAPABILITY as Al, commitUntaggedHash as Am, parseGroupMetaFrame as An, fetchesByItself as Ao, validReactionNumber as Ap, shortAtprotoDid as Ar, FileUplink as As, mergeKnocks as At, capsDescriptors as Au, readHandoffRelease as Av, utf8Decode as Aw, inviteQrText as Ax, MAX_SLOT_KNOCKS as Ay, APP_STORE_KINDS as B, createRelayPayload as BC, turnSequence as BS, HANDOFF_VERSION as B_, CROSSED_FRESH_MS as Ba, readAppRevocations as Bb, vapidKeysMatch as Bc, checkedDescriptors as Bd, EDIT_SEND_LIMIT as Bf, compressSdp as Bg, OFFER_FAST_MS as Bh, USDT_PUBLIC_RPC as Bi, PAIRED_PROFILE as Bl, verifyCommitSignature as Bm, SshSigError as Bn, GROUP_VERSION_SIGNALS as Bo, ACTIVE_TASK_STATUSES as Bp, parseAtprotoVerificationKey as Br, TYPING_RATE_WINDOW_MS as Bs, mentionedMembers as Bt, IDENTITY_MAX_EVIDENCE as Bu, setAckFrame as Bv, deviceEchoFrame as Bx, contactDay as By, buildX401TokenObject as C, relayUrlProblem as CC, TurnRecordError as CS, HANDOFF_DATA as C_, parseLightningDestination as Ca, sha256Paced as Cb, deviceWakeRequest as Cc, proofStatement as Cd, voiceDownloadName as Cf, wrapDataChannel as Cg, OFFER_HOST_GATHER_MS as Ch, didDhtDocument as Ci, BUTTONS_CAPABILITY as Cl, LEGACY_GROUP_MEMBERS as Cm, groupMetaTag as Cn, parseEngineError as Co, queueReaction as Cp, atprotoDidMethod as Cr, PAIRED_CALL_FRAME as Cs, MAX_KNOCKS as Ct, CAPS_LIMITS as Cu, readHandoffData as Cv, fromBase64Url as Cw, createLink as Cx, turnOff as Cy, readX401ProofRequest as D, BREAKER_BASE_MS as DC, openTurnValue as DS, HANDOFF_HAVE as D_, BOLT11_PATTERN as Da, APP_STATEMENT_LIMITS as Db, readWakePayload as Dc, validExternalKey as Dd, voicePeaksOf as Df, RTC_SIGNAL_MAX_AGE_MS as Dg, DIRECT_OWN_ATTEMPTS as Dh, encodeDidDhtDeactivated as Di, FILES_CAPABILITY as Dl, OWN_FRAME_LIMIT as Dm, nextGroupMetaRevision as Dn, GROUP_VERSION_FILES as Do, reactionIsNewer as Dp, isAtprotoDid as Dr, FILE_DATA_KIND as Ds, groupEntryUrl as Dt, CapsKeys as Du, readHandoffHello as Dv, toBase64 as Dw, inviteLink as Dx, KNOCK_SLOT_LABEL as Dy, isX401Protocol as E, BREAKER_ALL_DOWN_PROBE_MS as EC, nextTurnPosition as ES, HANDOFF_FILE_REQUEST as E_, resolveLightningDestination as Ea, APP_PREFIXES as Eb, readWake as Ec, storageProofPath as Ed, voiceLevelsOf as Ef, RTC_SIGNAL_FUTURE_MS as Eg, DIRECT_EVIDENCE_MS as Eh, didDhtRecords as Ei, FILES_BINARY_CAPABILITY as El, MEMBER_KEY as Em, keepPastGroupMeta as En, GROUP_HAVE_FRAME as Eo, reactionFrame as Ep, checkAtprotoProofRecord as Er, ChatFiles as Es, entryParams as Et, CapsExchange as Eu, readHandoffHave as Ev, randomBytes as Ew, encodeInviteCode as Ex, KNOCK_SLOTS as Ey, appRevocationFor as F, withRequestOptions as FC, turnKeys as FS, HANDOFF_PIECE_OVERHEAD as F_, parseCashuRequestPayload as Fa, isAppKey as Fb, decryptPushPayload as Fc, verifyRingAuthorization as Fd, EDIT_BUFFER_MAX as Ff, RTC_CONFIG as Fg, EXPECT_PEER_MS as Fh, ONCHAIN_PROVIDER as Fi, TYPING_CAPABILITY as Fl, rosterHas as Fm, wrapGroupMeta as Fn, readGroupWant as Fo, groupReplyAuthor as Fp, decodeDagCbor as Fr, transferEnded as Fs, GROUP_WAKE_MEMBER_INTERVAL_MS as Ft, IDENTITY_CHALLENGE_WINDOW as Fu, sortParts as Fv, __require as Fw, DEVICE_CAPABILITIES as Fx, REQUEST_PACKET_BYTES as Fy, readAppStore as G, readOwnRelayPayload as GC, BACKGROUND_WHILE_SIGNALING as GS, handoffAckFrame as G_, DHT_PIN_GRACE_MS as Ga, verifyAppRevocation as Gb, AppRanges as Gc, transportOrder as Gd, dhtEditId as Gf, isGlobalIpv4Host as Gg, RELAY_POLL_INTERVALS as Gh, formatPaymentAmount as Gi, HOLD_DATED_BACK_MS as Gl, edgeParams as Gm, sshKeyDigestHex as Gn, SIGNAL_PROVEN_MS as Go, PR_CHECKS as Gp, DID_DOCUMENT_MAX_BYTES as Gr, TypingReceiver as Gs, GroupSession as Gt, IDENTITY_PROVIDER_ID as Gu, DEVICE_KINDS as Gv, deviceLinkParams as Gx, linkRecords as Gy, checkAppListing as H, newerPacket as HC, turnStatedVerifier as HS, NO_ATTEMPTS as H_, CROSSED_WAIT_MS as Ha, setAppSignatureFastPath as Hb, APP_RANGE_ERRORS as Hc, irohRelayUrl as Hd, MAX_REMOVAL_NUMBER as Hf, decompressSdp as Hg, OFFER_STEP_MAX as Hh, arkAddressPrefix as Hi, SESSION_FRAME_MAX as Hl, confirmationMatches as Hm, parseSshSignature as Hn, SIGNAL_CARRIERS as Ho, BUTTON_STYLES as Hp, unsignedCommitBytes as Hr, TYPING_SEND_LIMIT as Hs, GROUP_LIMITS as Ht, IDENTITY_MAX_RECEIVED as Hu, setUpdateMessage as Hv, deviceFrameCapability as Hx, knockSlotIdentity as Hy, appStoreDecision as I, MAX_DNS_PACKET_BYTES as IC, turnName as IS, HANDOFF_RELEASE as I_, parseFedimintRequestPayload as Ia, isAppRef as Ib, encryptPushPayload as Ic, verifyRingEvidence as Id, EDIT_BUFFER_MS as If, answersOffer as Ig, FIRST_PUBLISH_MAX_MS as Ih, PaymentPreflightError as Ii, UPGRADE_CAPABILITY as Il, signCommit as Im, SSHSIG_MAX_ARMOR as In, readGroupWantNo as Io, pairedReplyAuthor as Ip, encodeDagCbor as Ir, transferStalled as Is, GROUP_WAKE_RECEIVE_LIMIT as It, IDENTITY_CHECK_UNAVAILABLE as Iu, SET_ACK as Iv, __toCommonJS as Iw, DEVICE_ECHO_FRAME as Ix, REQUEST_TEXT_BYTES as Iy, GROUP_TYPING_FRAME as J, decodeTxtPacket as JC, CHAT_RESERVE_MOST_SHARE as JS, handoffAttemptSucceeded as J_, GhostLink as Ja, IMAGE_LIMITS as Jb, appRangeDataFrame as Jc, DHT_FILE_TOO_LARGE as Jd, parseEditFrame as Jf, pickCallCandidates as Jg, TRANSPORTS_GONE_MS as Jh, validatePaymentTarget as Ji, HoldRefusedError as Jl, newEpochSecret as Jm, isLegacySignature as Jn, readGroupSignal as Jo, ROUTINE_STATES as Jp, DID_JWS_ALGS as Jr, parseTypingFrame as Js, frameBytes as Jt, IDENTITY_SUBJECT as Ju, ENROLL_DONE as Jv, deviceLinkSecret as Jx, mergeContactKnocks as Jy, readAppStoreSteps as K, signRelayPayload as KC, BACKGROUND_WRITES_SHARE as KS, handoffAttemptAllowed as K_, EARLY_DIAL_JOIN_MS as Ka, verifyAppSignature as Kb, appRangeCancelFrame as Kc, ACTIVE_DHT_POLL_MS as Kd, editFrame as Kf, keepsToRelays as Kg, SIGNAL_OUT_READS as Kh, isWalletNetwork as Ki, HOLD_LIMITS as Kl, encryptText as Km, sshSignCommand as Kn, SIGNAL_REPLY_MS as Ko, PR_STATES as Kp, DID_FILE_MAX_BYTES as Kr, TypingSender as Ks, asWritten as Kt, IDENTITY_REVOCATION_LABEL as Ku, ENROLL_CANCEL as Kv, deviceLinkRendezvousSeed as Kx, makeStamp as Ky, appUpdateDecision as L, PKARR_FUTURE_SKEW_MS as LC, turnPacket as LS, HANDOFF_REQUEST as L_, ANSWERS_REFUSED_PAUSES as La, isAppSignature as Lb, generateVapidKeys as Lc, RELAY_URL as Ld, EDIT_FRAME as Lf, buildSdpFromSignal as Lg, IDLE_THRESHOLD as Lh, SEPOLIA_TEST_USDT as Li, WAKE_SESSION_CAPABILITY as Ll, sortRoster as Lm, SSHSIG_NAMESPACE as Ln, CARRIED_DEFER_MS as Lo, readReply as Lp, findInMst as Lr, TYPING_FRAME as Ls, GroupWakeLimiter as Lt, IDENTITY_CLOCK_SKEW as Lu, SET_UPDATE as Lv, DEVICE_PING_FRAME as Lx, STAMP_BITS_DEFAULT as Ly, readX401ProofResultHeader as M, budgetRetryMs as MC, signTurnPacket as MS, HANDOFF_OFFER as M_, fedimintRequestPayload as Ma, appSignedBytes as Mb, PUSH_SERVICE_HOSTS as Mc, ringClaims as Md, isVideoMime as Mf, CALL_SIGNAL_FUTURE_MS as Mg, AWAITING_PEER_MS as Mh, signDidDhtPacket as Mi, SESSION_CAPABILITIES_FRAME as Ml, parseGroupCommit as Mm, parseGroupMetaTag as Mn, isGroupMessageId as Mo, PAIRED_REPLY_AUTHORS as Mp, AtprotoProofError as Mr, encodeFileData as Ms, GROUP_WAKE_FRAME as Mt, emptyCapsState as Mu, readHandoffVerified as Mv, __commonJSMin as Mw, pastedAgain as Mx, REQUEST_LABEL as My, x401AnswerableRequests as N, heldBackError as NC, signTurnRelease as NS, HANDOFF_PAKE as N_, findEndpoint as Na, checkAppRevokeStatement as Nb, WebPushError as Nc, ringEvidence as Nd, parseVideoMeta as Nf, CALL_SIGNAL_MAX_AGE_MS as Ng, DEPARTED_READ_MS as Nh, ETHEREUM_USDT as Ni, STATUS_CARD_CAPABILITY as Nl, rememberAlone as Nm, signGroupMeta as Nn, readGroupFileMeta as No, REPLY_ID as Np, atprotoCidFor as Nr, refusalText as Ns, GROUP_WAKE_GROUP_LIMIT as Nt, encodePacketTransports as Nu, sameDigest as Nv, __esmMin as Nw, readInviteCode as Nx, REQUEST_LIFETIME_MS as Ny, readX401ProofRequestHeader as O, BREAKER_MAX_MS as OC, readTurnBody as OS, HANDOFF_HELLO as O_, decodeBolt11 as Oa, appFingerprint as Ob, relayRequest as Oc, verifyNostrProof as Od, PLAYABLE_VIDEO as Of, buildDataSdp as Og, DIRECT_PEERS as Oh, encodeDidDhtPacket as Oi, KNOWN_SESSION_CAPABILITIES as Ol, SAID_AGAIN as Om, openGroupMeta as On, GROUP_WANT_FRAME as Oo, readDhtReactions as Op, normalizeAtprotoHandle as Or, FILE_FRAMES as Os, knockIdentity as Ot, CapsRefusedError as Ou, readHandoffManifest as Ov, toBase64Url as Ow, inviteOwnership as Ox, LINK_RECORD_LABEL as Oy, addedAppPermissions as P, isDiscoveryBudgetError as PC, turnInstance as PS, HANDOFF_PIECE_BYTES as P_, isFederationId as Pa, isAppHash as Pb, checkPushEndpoint as Pc, validRingKey as Pd, EDITED_FRAME as Pf, PAIRED_CALL_CANDIDATES as Pg, DHT_POLL_INTERVALS as Ph, EVM_TEST_CHAINS as Pi, SessionCapabilities as Pl, rosterAdmin as Pm, verifyGroupMetaSignature as Pn, readGroupHave as Po, REPLY_LIMITS as Pp, decodeAtprotoCommit as Pr, sentWhole as Ps, GROUP_WAKE_GROUP_WINDOW_MS as Pt, parsePacketTransports as Pu, sealHandoffPiece as Pv, __exportAll as Pw, DEVICES_CAPABILITY as Px, REQUEST_NAME_UNITS as Py, sealGroupTyping as Q, createIdentity as QC, DEPARTED_READS as QS, handoffContextProof as Q_, LIVENESS_MISSED_PINGS as Qa, previewable as Qb, decodeAppRangeData as Qc, DhtDelivery as Qd, validRemovalNumber as Qf, LABEL$1 as Qg, WATCH_PEER_MS as Qh, isSparkAddress as Qi, DNS_LABEL as Ql, sealSecret as Qm, MessageRefusal as Qn, mayBeHub as Qo, appCardId as Qp, DidError as Qr, typingKindOf as Qs, GROUP_EDIT_TEXT_BYTES as Qt, emptyIdentityLedger as Qu, enrollCancelFrame as Qv, unsignedDeviceTransports as Qx, requestPlaintextBytes as Qy, checkAppBeforeRun as R, PacketTooLargeError as RC, turnPayloadSequence as RS, HANDOFF_TIMINGS as R_, ANSWERS_REFUSED_PAUSE_MS as Ra, readAppRevocation as Rb, pushRequest as Rc, TRANSPORTS as Rd, EDIT_RATE_WINDOW_MS as Rf, callRtcConfig as Rg, LinkSession as Rh, SEPOLIA_TEST_USDT_FAUCET as Ri, parseSessionCapabilities as Rl, verifyChain as Rm, SSH_KEY_TYPES as Rn, CarriedTransport as Ro, replySnippet as Rp, parseAtprotoCar as Rr, TYPING_KINDS as Rs, groupWakeFrame as Rt, IDENTITY_FRAME_LIMIT as Ru, encodeSetSlots as Rv, ENROLL_CAPABILITY as Rx, STAMP_BITS_MAX as Ry, buildX401ResultArtifact as S, readRelayBody as SC, TURN_VERSION as SS, HANDOFF_CANCEL_REASONS as S_, parseInvoiceCallback as Sa, readAppBundleAsync as Sb, WakeLimiter as Sc, proofHash as Sd, recordingMime as Sf, sendBody as Sg, GATHER_STALL_MS as Sh, decodeDidDhtPacket as Si, APP_RANGES_CAPABILITY as Sl, GROUP_VERSION_LARGE as Sm, groupMetaPicture as Sn, engineText as So, parseReactionFrame as Sp, ATPROTO_PROOF_SCOPE as Sr, MAX_PAIRED_CALL_SIGNAL as Ss, KNOCK_TTL_MS as St, CAPS_LABEL as Su, readHandoffCancel as Sv, fromBase64 as Sw, createChatInvite as Sx, takeRequest as Sy, encodeX401Header as T, traceLink as TC, firstDeviceSetSecret as TS, HANDOFF_FILE_MISSING as T_, requestLnurlInvoice as Ta, APP_NAME as Tb, parseWakeFrame as Tc, storageProofBody as Td, voiceLevel as Tf, DATA_CHANNEL_LABEL as Tg, STALLED_EVIDENCE_MS as Th, didDhtKey as Ti, EDIT_CAPABILITY as Tl, MAX_GROUP_MEMBERS as Tm, groupName as Tn, GROUP_FILE_LIMITS as To, reactionEmoji as Tp, atprotoProofRkey as Tr, parsePairedCallFrame as Ts, encodeGroupEntryLink as Tt, CAPS_REFRESH_MS as Tu, readHandoffFileFrame as Tv, isZ32Key as Tw, encodeGhostlyInvite as Tx, ContactRequestError as Ty, checkAppStoreIndex as U, openRelayPayload as UC, turnVerifierMark as US, filePartDigest as U_, DEMOTE_AFTER_FAILURES as Ua, signAppObject as Ub, APP_RANGE_FRAMES as Uc, rankTransports as Ud, REMOVED_TEXT as Uf, extractParamsFromSdp as Ug, PRESENCE_HEARTBEAT as Uh, assertTokenUnits as Ui, SESSION_RECEIVE_PENDING as Ul, confirmationTag as Um, sameSshKey as Un, SIGNAL_FRESH_MS as Uo, CRON_LINE as Up, verifyAtprotoRecordProof as Ur, TYPING_STATUS_MAX as Us, GROUP_REACTED_FRAME as Ut, IDENTITY_MAX_VALIDITY as Uu, signTombstone as Uv, deviceKeyZ32 as Ux, knockSlotOf as Uy, APP_STORE_LIMITS as V, measureRecords as VC, turnSignedMessage as VS, HANDOFF_WINDOW as V_, CROSSED_PROBE_MS as Va, readAppSignature as Vb, APP_RANGE_DATA_KIND as Vc, irohDescriptor as Vd, MAX_EDITS_PER_MESSAGE as Vf, contactRtcConfig as Vg, OFFER_LOOK_MS as Vh, WALLET_NETWORKS as Vi, PairedSession as Vl, GROUP_PROFILE as Vm, parseSshPublicKey as Vn, SIGNALS_PER_MINUTE as Vo, BUTTON_ID as Vp, readAtprotoCid as Vr, TYPING_REFRESH_MS as Vs, parseGroupWakeFrame as Vt, IDENTITY_MAX_FRAME as Vu, setUpdateFrame as Vv, deviceEchoNonce as Vx, knockHolds as Vy, readAppListing as W, parseRelayPayload as WC, BACKGROUND_REQUESTS_PER_MINUTE as WS, filePartName as W_, DEMOTE_MS as Wa, signAppRevocation as Wb, APP_RANGE_LIMITS as Wc, relayedTransports as Wd, RateWindow as Wf, heardCallSignal as Wg, PRESENCE_WINDOW as Wh, assertWholeSats as Wi, HOLD_CAPABILITY as Wl, decryptText as Wm, sshFingerprint as Wn, SIGNAL_HOLD_MS as Wo, ITEM_STATES as Wp, verifyAtprotoSignature as Wr, TYPING_TIMEOUT_MS as Ws, GROUP_READ_NOTE as Wt, IDENTITY_PROOF_CAPABILITY as Wu, verifySetUpdate as Wv, deviceLinkPairing as Wx, knockSlotRecords as Wy, groupTypingEpoch as X, readDnsName as XC, CHAT_WATCH_SHARE as XS, handoffCancelFrame as X_, INVITER_DIAL_GRACE_MS as Xa, isImageMime as Xb, appRangeErrorFrame as Xc, DHT_TEXT_BYTES as Xd, validEditMessage as Xf, signalHasVideo as Xg, UNUSED_INVITE_UPKEEP_MS as Xh, SPARK_NETWORKS as Xi, newMailbox as Xl, openSecret as Xm, verifyBitcoinMessage as Xn, MESH_HUBS as Xo, STATUS_CARD_LIMITS as Xp, DID_MAX_LENGTH as Xr, typingActivity as Xs, COMMUNITY_EDIT_FRAME as Xt, IdentityExchange as Xu, ENROLL_HELLO as Xv, newDeviceSetSecret as Xx, readKnockSlot as Xy, GroupTypingBoard as Y, encodeTxtPacket as YC, CHAT_RESERVE_PER_CHAT as YS, handoffBusyFrame as Y_, HANDLED_WAIT_MS as Ya, imageSize as Yb, appRangeEndFrame as Yc, DHT_MESSAGE_TTL as Yd, parseEditedFrame as Yf, sdpHasCandidates as Yg, UNUSED_INVITE_READS_PER_MINUTE as Yh, walletNetworkOf as Yi, isHoldUrl as Yl, openPair as Ym, legacyMessageHash as Yn, GROUP_VERSION_HUBS as Yo, RUN_RESULTS as Yp, DID_JWS_MAX_LENGTH as Yr, sanitizeTypingStatus as Ys, groupMessageId as Yt, IdentityCheckUnavailable as Yu, ENROLL_GRANT as Yv, devicePingFrame as Yx, openRequest as Yy, openGroupTyping as Z, IDENTITY_MEMO_SIZE as ZC, DEFAULT_RELAYS as ZS, handoffContext as Z_, INVITE_TAKEN as Za, parseImageMeta as Zb, appRangeGetFrame as Zc, DHT_TEXT_REFUSED as Zd, validEditNumber as Zf, waitForIceGathering as Zg, UNUSED_INVITE_WAIT_MAX_MS as Zh, SPARK_PROVIDER as Zi, readManifest as Zl, sealPair as Zm, BIP322_REVISION as Zn, NO_HUB_POLICY as Zo, TASK_STATUSES as Zp, DID_METHODS as Zr, typingFrame as Zs, GROUP_EDIT_FRAME as Zt, boundVerifiedIdentity as Zu, ENROLL_PROOF as Zv, signDeviceTransports as Zx, readLinkRecord as Zy, X401_PROTOCOLS as _, WATCH_SHARE as _C, TURN_REV_LIMIT as _S, HANDOFF_ACK as __, LIGHTNING_DESTINATION_PATTERN as _a, isAppLicense as _b, WAKE_CALL_WAIT_MS as _c, emptyProofLedger as _d, downsamplePeaks as _f, PROTOCOL_VERSION as _g, ANSWER_REFUSED_REDIALS as _h, DID_DHT_MAX_PAYLOAD as _i, isAppVersion as _l, receivedTimestamp as _m, encodeGroupMetaBody as _n, parsePaymentNetworks as _o, REACTION_FRAME as _p, u64 as _r, readBeacon as _s, shortHash as _t, recordsName as _u, isHandoffPartName as _v, stripHidden as _w, INVITE_HRP as _x, endedRequests as _y, X401_DCQL_LIMITS as a, HEDGE_MISSING_MS as aC, TURN_VISIBLE_MS as aS, HTTP_SERVICE_PROTO as a_, PUBKY_PROOF_ROOT as aa, APP_CLIENT_NAME as ab, mayPin as ac, receivedIdentityStatus as ad, readDhtFile as af, formatLocalTarget as ag, RATCHET_KEEP_MS as ah, didWebFile as ai, APP_PEER_OPEN_MAX as al, checkStatusCard as am, MENTION_EVERYONE as an, RACE_ANSWERED_MS as ao, linksIn as ap, ByteReader as ar, beaconKeys as as, communityHasFrame as at, WELL_KNOWN_PATH as au, handoffHaveFrames as av, encrypt as aw, createContactLink as ax, enrollProofFrame as ay, buildX401ProofRequest as b, currentRelays as bC, TURN_SLOTS as bS, HANDOFF_BUSY_REASONS as b_, findLightningDestination as ba, pacer as bb, WAKE_SUBJECT as bc, nostrProofTemplate as bd, isPlayableAudioType as bf, encodeChunk as bg, DataLink as bh, DID_DHT_VERSION as bi, readAppFrame as bl, GROUP_ID as bm, groupMetaChange as bn, EngineError as bo, nextReactionNumber as bp, ATPROTO_FULL_SCOPE as br, shouldBeHub as bs, verifyCommunityCommit as bt, wellKnownUrl as bu, readHandoffAck as bv, bytesEqual as bw, INVITE_VERSION as bx, planKnocks as by, readX401DcqlQuery as c, RELAY_REQUESTS_PER_MINUTE as cC, turnPutSummary as cS, SERVICES_VERSION as c_, newPubkyProofFolder as ca, APP_PERMISSIONS as cb, parsePinnedFrame as cc, verifyIdentityPresentation as cd, formatFileSize as cf, resolveTargetUrl as cg, emptyRatchetState as ch, didWebHost as ci, APP_RESUME_GRACE_MS as cl, sameButtonText as cm, mentionsMember as cn, REDESCRIBED_GRACE_MS as co, sanitizePreviewImage as cp, decodeBitcoinAddress as cr, freshHubs as cs, communityUntaggedHash as ct, domainTxtRecord as cu, handoffOfferFrame as cv, tryDecrypt as cw, DEVICE_INVITE_BYTES as cx, readEnrollHello as cy, newX401HolderKey as d, RelaysFailedError as dC, TURN_BODY_BYTES as dS, isValidServiceId as d_, pubkyProofFile as da, appDigest as db, pinNumberHolds as dc, lastSharedWithMe as dd, sanitizeMime as df, viewerResponseHeaders as dg, ratchetOn as dh, parseDidDocument as di, AppSessions as dl, taskProgress as dm, GROUP_META_PAST as dn, SWITCH_RETIRE_MS as do, forwardedMany as dp, encodeTx as dr, lobbyRecords as ds, encodeCommunityLink as dt, isPublicAddress as du, handoffRequestFrame as dv, jpegSize$1 as dw, createDeviceInvite as dx, MAX_DONE as dy, GROUP_BURST_MS as eC, seedSigner as eS, RECORD_TTL as e_, sparkInvoiceDetails as ea, seenEntry as eb, GROUP_PIN_FRAME as ec, identityRevocationValue as ed, emptyDhtDeliveryState as ef, presenceSeenAt as eg, FOLLOW_MS as eh, checkDidSignature as ei, isServeId as el, cardEditNumber as em, communityEditFrame as en, MAX_PAIRED_MESSAGE_FRAME as eo, LINK_PREVIEW_LIMITS as ep, bip322ToSign as er, meshRendezvous as es, COMMUNITY_PROFILE as et, DOMAIN_FILE_MAX_BYTES as eu, handoffDigest as ev, identityFromSeedB64 as ew, canonicalJson as ex, enrollDigits as ey, readX401SdJwtVc as f, SIGNALING_ALLOWANCE_SHARE as fC, TURN_LABEL as fS, isViewerTag as f_, pubkyProofPath as fa, appViewOf as fb, pinnedFrame as fc, PROOF_ADAPTERS as fd, PLAYABLE_AUDIO as ff, webLocalFetch as fg, ratchetOpen as fh, parseDidJws as fi, appCloseFrame as fl, usageLeft as fm, GROUP_META_PAST_CHARS as fn, UNPROVEN_AUTH_MS as fo, readForwarded as fp, encodeWitness as fr, mergeBeacon as fs, leaveStands as ft, nip05RootKey as fu, handoffRetryAfter as fv, sanitizeAvatar as fw, deviceInviteJoinerKeyZ32 as fx, MAX_MISSED as fy, X401_LIMITS as g, TURN_SOURCE_TIMEOUT_MS as gC, TURN_NO_ACTIVE as gS, viewerTag as g_, pubkyHomeserverOf as ga, findAppForbiddenKey as gb, WAKE_CALL_TTL_SECONDS as gc, STORAGE_ROOT as gd, baseMime as gf, MAX_CHUNK_PAYLOAD_BYTES as gg, ratchetUnknownSession as gh, strictBase64Url as gi, chatAppId as gl, heardTime as gm, MAX_GROUP_PICTURE_LENGTH as gn, pairedMessageFrame as go, REACTED_FRAME as gp, u32$1 as gr, rankHubs as gs, rosterHash as gt, recordsFromWellKnown as gu, handoffVersions as gv, sanitizeNick as gw, DEVICE_INVITE_VERSION as gx, clearMissed as gy, X401_HEADERS as h, SLOW_MS as hC, TURN_NAME_BYTES as hS, servicesToWire as h_, homeserverWebEndpoint as ha, checkAppManifest as hb, WAKE_CALL_INTERVAL_MS as hc, STORAGE_LIFETIME as hd, VOICE_METER as hf, LIMITS as hg, ratchetSessionOf as hh, staticDidDocument as hi, appOpenFrame as hl, claimedTime as hm, MAX_GROUP_NAME_LENGTH as hn, pairedMessageFits as ho, QUICK_REACTIONS as hp, txHash as hr, pickHubs as hs, leftStatement as ht, recordsFromTxt as hu, handoffVerifiedMessage as hv, sanitizeDisplayText as hw, readDeviceInvite as hx, REOPEN_BELOW as hy, x401ApprovalDigest as i, GROUP_SIGNALING_ALLOWANCE_SHARE as iC, TURN_SETTLE_MS as iS, parseLinkRecords as i_, PUBKY_PROOF_MAX_BYTES as ia, APP_CLIENTS as ib, PIN_LIMITS as ic, newIdentityBinding as id, dhtFileId as if, HttpHost as ig, RATCHET_HEADER_BYTES as ih, didWebDocumentUrl as ii, APP_FRAME as il, cardUrl as im, validEditText as in, PONG_WAIT_MS as io, linkStop as ip, BitcoinAddressError as ir, COMMUNITY_TOPOLOGY as is, communityGroupId as it, NIP05_PATH as iu, handoffFileRequestFrame as iv, decrypt as iw, CONTACT_LINK_VERSION as ix, enrollMessage as iy, readX401ProofResult as j, DiscoveryBudgetError as jC, signTurnBody as jS, HANDOFF_MANIFEST as j_, cashuRequestPayload as ja, appRevocationId as jb, wakeRequest as jc, ringAuthorization as jd, isPlayableVideoType as jf, parseRtcSignal as jg, symmetricNat as jh, resolveDidDht as ji, SERVICES_CAPABILITY as jl, expectedRoster as jm, parseGroupMetaStatement as jn, groupFileFallback as jo, wireReaction as jp, AtprotoCid as jr, decodeFileData as js, readKnocks as jt, dialDescriptors as ju, readHandoffTurnFrame as jv, utf8Encode as jw, ownInviteRefusal as jx, REQUEST_CLOCK_SKEW_MS as jy, readX401ProofResponse as k, BREAKER_THRESHOLD as kC, readTurnPacket as kS, HANDOFF_LATER_BYTES as k_, findBolt11 as ka, appRef as kb, wakeFrame as kc, verifyPeerProof as kd, VIDEO_LIMITS as kf, extractRtcParams as kg, DirectPathWatch as kh, jwkThumbprint as ki, PIN_CAPABILITY as kl, commitHash as km, parseGroupMetaBody as kn, GROUP_WANT_NO_FRAME as ko, readReaction as kp, parseAtprotoDidDocument as kr, FILE_LIMITS as ks, knockRecords as kt, DHT_TEXT_CAPABILITY as ku, readHandoffPake as kv, toZ32 as kw, inviteQrSegments as kx, MAX_SEEN as ky, x401VpToken as l, REQUESTS_PER_MINUTE as lC, TOMBSTONE_SEQUENCE as lS, decodeServices as l_, normalizePubkyKey as la, APP_SCREENSHOTS_DIR as lb, pinFrame as lc, IDENTITY_TIMELINE_MAX as ld, safeBlobType as lf, sanitizeRequestHeaders as lg, isRatcheted as lh, normalizeDid as li, APP_SEND_LIMIT as ll, statusCardBytes as lm, validMentions as ln, RESUME_WAIT_MS as lo, FORWARD_LIMITS as lp, decodeTx as lr, hubRank as ls, decodeCommunityLink as lt, domainWellKnownFile as lu, handoffPakeFrame as lv, MAX_AVATAR_LENGTH as lw, DEVICE_INVITE_LIFETIME_S as lx, verifyEnrollProof as ly, x401HolderJwk as m, SLOW_DEMOTE_MS as mC, TURN_MAX as mS, servicesFromWire as m_, encodeSvcbPacket as ma, buildAppBundle as mb, DEVICE_WAKE_TTL_SECONDS as mc, PeerProofs as md, VOICE_LIMITS as mf, CHUNK_KIND as mg, ratchetSeal as mh, signingKeys as mi, appDataFrame as ml, arrivalKey as mm, MAX_GROUP_NAME_BYTES as mn, WAKE_LOST_MS as mo, GROUP_REACTION_FRAME as mp, sha256d as mr, newerHead as ms, leaveStatement3 as mt, parseDomainTxt as mu, handoffVerifiedFrame as mv, hasVisible as mw, encodeDeviceInvite as mx, NEW_PER_HOUR as my, X401_RESPONSE_MODES as n, GROUP_OVER_PACE_MS as nC, TURN_PUT_WINDOW_MS as nS, emptyLinkRecords as n_, BITCOIN_NETWORKS as na, APP_BUNDLE_LIMITS as nb, PIN_CLOCK_SKEW_MS as nc, identityStatementText as nd, DHT_FILE_CAPABILITY as nf, GhostlyHttpError as ng, MAX_SKIPPED_KEYS as nh, didJwsAlg as ni, readAppRangeFrame as nl, cardLinkHost as nm, meshMessageRef as nn, PAIRING_ATTEMPT_MS as no, canonicalUrl as np, decodeBase64 as nr, pickMeshHubs as ns, GROUP_READ_NOTE_COMMUNITY as nt, DOMAIN_METHODS as nu, handoffEphemeral as nv, sign as nw, readCanonicalJson as nx, enrollGrantFrame as ny, matchX401Dcql as o, HEDGE_MS as oC, classifyTurnRead as oS, LEGACY_SERVICES as o_, isPubkyKey as oa, APP_FORBIDDEN_KEYS as ob, nextPinNumber as oc, revokesIdentity as od, FileTransfers as of, parseLocalTarget as og, RATCHET_OVERHEAD as oh, didWebFileNames as oi, APP_RATE_LIMIT as ol, readStatusCard as om, MENTION_LIMITS as on, RACE_DIRECT_MS as oo, parseLinkPreview as op, compactSize as or, beaconRecords as os, communityMessageId as ot, decodeDnsResponse as ou, handoffHelloFrame as ov, generateEncryptionKey as ow, encodeContactLink as ox, formatEnrollDigits as oy, sameX401HolderJwk as p, SIGNALING_WINDOW_MS as pC, TURN_LAST_SEQUENCE as pS, serviceIdFromName as p_, decodeSvcbRecords as pa, assembleAppBundle as pb, readPin as pc, PROOF_CAPABILITY as pd, RECORDING_TYPES as pf, CHUNK_FLAG_END as pg, ratchetRoot as ph, parseDidSignaturePaste as pi, appDataBytes as pl, MESSAGE_CLOCK_SKEW_MS as pm, MAX_GROUP_META_BODY as pn, WAKE_ANSWER_GRACE_MS as po, COMMUNITY_REACTION_FRAME as pp, hash160 as pr, mergeLobby as ps, leaveStatement as pt, normalizeDomain as pu, handoffStreamKey as pv, MAX_NICK_LENGTH as pw, deviceInviteJoinerParams as px, MAX_WAITING as py, signAppStore as q, decodeDnsAnswers as qC, CHAT_RESERVE as qS, handoffAttemptFailed as q_, FIRST_PAIRING_PACE_MS as qa, verifyAppStatementBytes as qb, appRangeChunk as qc, DHT_FILE_REFUSED as qd, editedFrame as qf, parseCallSignal as qg, STALLED_LOOK_MS as qh, parsePaymentAmount as qi, HoldKeys as ql, epochKeys as qm, verifySshSignature as qn, groupSignalFrame as qo, REMOVABLE_KINDS as qp, DID_GHOSTLY_SERVICE as qr, parseTypingActivity as qs, chainPieces as qt, IDENTITY_STATEMENT_PREFIX as qu, ENROLL_CANCEL_REASONS as qv, deviceLinkSealKey as qx, makeStampPaced as qy, readX401OpenId4VpRequest as r, GROUP_RATION_WINDOW_MS as rC, TURN_RAISE_READ_TIMEOUT_MS as rS, isEmptyLinkPacket as r_, isBitcoinAddress as ra, APP_BUNDLE_MAGIC as rb, PIN_FRAME as rc, isIdentityBinding as rd, dhtFileElements as rf, HttpClient as rg, RATCHET_CAPABILITY as rh, didSignedMessages as ri, APP_DATA_MAX_BYTES as rl, cardTimeUtc as rm, parseCommunityEdit as rn, PAIRING_RETRY_MS as ro, linkEnd as rp, verifyBip322 as rr, wireHubPolicy as rs, communityCommitHash as rt, DOMAIN_TXT_MAX_BYTES as ru, handoffFileMissingFrame as rv, verify as rw, CONTACT_LINK_BYTES as rx, enrollHelloFrame as ry, presentX401SdJwtVc as s, PREVIOUS_DEFAULT_RELAYS as sC, keptAtEqualSequence as sS, MAX_SERVICES as s_, isPubkyProofFolder as sa, APP_ICON_PATH as sb, parsePinFrame as sc, signIdentityPresentation as sd, PREVIEWABLE_IMAGE as sf, relativizeLocation as sg, RatchetBox as sh, didWebFileUrl as si, APP_RATE_WINDOW_MS as sl, removedCardText as sm, mentionsBytes as sn, RACE_RELAYED_MS as so, previewImageSize as sp, decodeAnyBitcoinAddress as sr, doorHubs as ss, communityRoster as st, dnsProofName as su, handoffManifestFrames as sv, sealedLength as sw, readContactLink as sx, readEnrollGrant as sy, X401_REQUEST_LIMITS as t, GROUP_BURST_ONE_LINK as tC, webCryptoSigner as tS, buildLinkRecords as t_, sparkNetworkOf as ta, stampHolds as tb, PINNED_FRAME as tc, identityStatement as td, peekDhtMailbox as tf, unusedInviteWait as tg, MAX_SKIP as th, didGhostlyServiceEntry as ti, parseAppRangeFrame as tl, cardLine as tm, communityMessageAuthor as tn, PAIRED_FRAME_TOO_LARGE as to, LINK_TRAILING as tp, bip322ToSpend as tr, parseHubPolicy as ts, CommunitySession as tt, DOMAIN_MAX_RECORDS as tu, handoffDoneFrame as tv, publicKeyFromZ32 as tw, canonicalJsonBytes as tx, enrollDoneFrame as ty, X401_CREDENTIAL_LIMITS as u, RelayTransport as uC, TOMBSTONE_TURN as uS, encodeServices as u_, pubkyProofCapability as ua, APP_VIEWS as ub, pinIsNewer as uc, applyIdentityEvent as ud, sanitizeFileName as uf, sanitizeResponseHeaders as ug, ratchetHeard as uh, parseDid as ui, APP_VERSION_MAX as ul, statusCardText as um, wireMentions as un, RTC_UNSTARTED_MS as uo, forwardedAgain as up, decodeWitness as ur, lobbyKeys as us, derivedSecret as ut, encodeDnsQuery as uu, handoffReleaseFrame as uv, MAX_AVATAR_SIDE as uw, DEVICE_INVITE_OWN_DEVICE as ux, FLOOD_PER_DAY as uy, X401_SCHEME as v, WAY_BACK_SHARE as vC, TURN_SEALED_BYTES as vS, HANDOFF_ATTEMPTS as v_, LNURL_LIMITS as va, isAppPath as vb, WAKE_FRAME as vc, importedProof as vd, fileMessageText as vf, decodeChunk as vg, CONNECT_TIMEOUT_MS as vh, DID_DHT_PREFIX as vi, isChatAppId as vl, shownTime as vm, groupDisplayName as vn, publishFailure as vo, REACTION_LIMITS as vp, varBytes as vr, readBeaconHead as vs, signCommunity as vt, txtValue as vu, newHandoffId as vv, trimEndOf as vw, INVITE_LINK_ORIGIN as vx, inboxRecord as vy, decodeX401Header as w, setLinkTraceSink as wC, encodeTurnFields as wS, HANDOFF_DONE as w_, parsePayParams as wa, yieldThread as wb, newWakeToken as wc, storageProof as wd, voiceFileName as wf, DATA_CHANNEL_ID as wg, REANSWERS as wh, didDhtFromPublicKey as wi, CALLS_CAPABILITY as wl, MAX_GROUP_CHAIN as wm, groupMetaToHand as wn, PairingTracker as wo, reactedFrame as wp, atprotoProofRecord as wr, PairedCalls as ws, decodeGroupEntryLink as wt, CAPS_PUBLISH_SPACING_MS as wu, readHandoffDone as wv, fromZ32 as ww, decodeInviteCode as wx, CONTACT_RECORD_TTL as wy, buildX401ProofResult as x, normalizeRelayUrl as xC, TURN_TTL as xS, HANDOFF_CANCEL as x_, invoiceCallbackUrl as xa, readAppBundle as xb, WAKE_TTL_SECONDS as xc, proofCapability as xd, parseVoiceMeta as xf, encodeControl as xg, GATHER_ATTEMPTS as xh, DidDhtError as xi, APPS_CAPABILITY as xl, GROUP_MEMBER_CAP as xm, groupMetaNewer as xn, engineError as xo, parseReactedFrame as xp, ATPROTO_PROOF_COLLECTION as xr, validHead as xs, GROUP_ENTRY_PROFILE as xt, CAPS_ISSUED_BACK_MS as xu, readHandoffBusy as xv, concatBytes as xw, OwnInviteError as xx, settleRequest as xy, X401_VERSION as y, WRITE_FIRST_MS as yC, TURN_SIGNED_BYTES as yS, HANDOFF_BUSY as y_, fetchLnurlJson as ya, isAppUrl as yb, WAKE_INTERVAL_MS as yc, isProofAdapter as yd, formatVoiceDuration as yf, decodeControl as yg, DATA_SETTLE_MS as yh, DID_DHT_TTL as yi, parseAppFrame as yl, GROUP_ADMIN_OFF_ERROR as ym, groupMetaBody as yn, ENGINE_ERRORS as yo, ReactionWindow as yp, ATPROTO_DECLARED_SCOPE as yr, readLobby as ys, verifyCommunityChain as yt, validDomainRecord as yu, openHandoffPiece as yv, unwrapPasted as yw, INVITE_MAX_LENGTH as yx, newInbox as yy, planAppUpdate as z, RELAY_PAYLOAD_MAX_BYTES as zC, turnReleaseMessage as zS, HANDOFF_VERIFIED as z_, BLOCKED_DIAL_WAIT_MS as za, readAppRevocationShape as zb, vapidAuthorization as zc, automaticTransport as zd, EDIT_RECEIVE_LIMIT as zf, callSignalHeardAt as zg, MAX_DHT_TEXT_BYTES as zh, TEST_USDT_FAUCET_AMOUNT as zi, sessionCapabilitiesFrame as zl, verifyCommit as zm, SSH_PUBLIC_KEY_MAX as zn, GROUP_SIGNAL_FRAME as zo, wireReply as zp, parseAtprotoDidKey as zr, TYPING_RATE_LIMIT as zs, groupWakes as zt, IDENTITY_FRAME_WINDOW_MS as zu, readSetUpdate as zv, HANDOFF_CAPABILITY as zx, STAMP_BITS_MIN as zy };
|
|
36173
37372
|
|
|
36174
|
-
//# sourceMappingURL=src-
|
|
37373
|
+
//# sourceMappingURL=src-CfpOdLVf.js.map
|