@ghostlytools/sdk 1.7.4 → 1.8.1

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.
Files changed (35) hide show
  1. package/dist/core.js +593 -2
  2. package/dist/core.js.map +1 -1
  3. package/dist/{fakes-ClE16ouz.js → fakes-Cyfc_vXC.js} +2 -2
  4. package/dist/fakes-Cyfc_vXC.js.map +1 -0
  5. package/dist/fakes.js +1 -1
  6. package/dist/index.js +2 -2
  7. package/dist/{keet-identity-key-BRKv78jp.js → keet-identity-key-uq3scTiE.js} +2 -2
  8. package/dist/{keet-identity-key-BRKv78jp.js.map → keet-identity-key-uq3scTiE.js.map} +1 -1
  9. package/dist/{src-B5uLojgn.js → src-DytzSJB6.js} +1133 -182
  10. package/dist/src-DytzSJB6.js.map +1 -0
  11. package/dist/testing.js +3 -3
  12. package/dist/types/browser/src/shared/features.d.ts +5 -0
  13. package/dist/types/browser/src/shared/mints.d.ts +6 -0
  14. package/dist/types/core/src/chatFiles.d.ts +34 -1
  15. package/dist/types/core/src/dhtDelivery.d.ts +51 -0
  16. package/dist/types/core/src/domainProofs.d.ts +3 -2
  17. package/dist/types/core/src/engineErrors.d.ts +5 -1
  18. package/dist/types/core/src/ghostlink.d.ts +18 -0
  19. package/dist/types/core/src/groupCommunity.d.ts +44 -4
  20. package/dist/types/core/src/groupSession.d.ts +19 -21
  21. package/dist/types/core/src/groupSignals.d.ts +4 -0
  22. package/dist/types/core/src/image.d.ts +2 -0
  23. package/dist/types/core/src/index.d.ts +2 -0
  24. package/dist/types/core/src/link.d.ts +13 -0
  25. package/dist/types/core/src/pairedTransports.d.ts +14 -3
  26. package/dist/types/core/src/pictureMetadata.d.ts +25 -0
  27. package/dist/types/core/src/ratchet.d.ts +201 -0
  28. package/dist/types/core/src/relay.d.ts +15 -0
  29. package/dist/types/core/src/statusCards.d.ts +5 -0
  30. package/dist/types/core/src/storeForward.d.ts +32 -11
  31. package/dist/{verify-yJe2Uqod.js → verify-BC1Eu1lE.js} +2 -2
  32. package/dist/{verify-yJe2Uqod.js.map → verify-BC1Eu1lE.js.map} +1 -1
  33. package/package.json +1 -1
  34. package/dist/fakes-ClE16ouz.js.map +0 -1
  35. package/dist/src-B5uLojgn.js.map +0 -1
@@ -1091,6 +1091,14 @@ var REQUESTS_PER_MINUTE = 30;
1091
1091
  */
1092
1092
  var BACKGROUND_REQUESTS_PER_MINUTE = 20;
1093
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
+ /**
1094
1102
  * A link's write the budget refused (its presence, its offer, its answer) goes first when the minute
1095
1103
  * frees a request: reads on that relay wait this long after the refusal. A link that polls fast for a
1096
1104
  * peer while its offer waits would otherwise take every request the minute frees, and the offer (the
@@ -1364,6 +1372,15 @@ function normalizeRelayUrl(input) {
1364
1372
  return null;
1365
1373
  }
1366
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
+ }
1367
1384
  /** A relay the breaker leaves alone for failing (`RelayBreaker`): nothing was asked of it now. */
1368
1385
  var RelayLeftAloneError = class extends Error {};
1369
1386
  /**
@@ -1406,6 +1423,8 @@ var RelayTransport = class {
1406
1423
  lastReadFrom = /* @__PURE__ */ new Map();
1407
1424
  spent = /* @__PURE__ */ new Map();
1408
1425
  spentBackground = /* @__PURE__ */ new Map();
1426
+ /** Background writes on each relay in the last minute (`BACKGROUND_WRITES_SHARE`). */
1427
+ spentBackgroundWrites = /* @__PURE__ */ new Map();
1409
1428
  /** Groups' urgent reads on each relay in the last `GROUP_BURST_MS`. */
1410
1429
  spentGroupUrgent = /* @__PURE__ */ new Map();
1411
1430
  /** Watch reads on each relay in the last `GROUP_RATION_WINDOW_MS` (`WATCH_SHARE`). */
@@ -1484,16 +1503,16 @@ var RelayTransport = class {
1484
1503
  this.perMinuteGiven = options.requestsPerMinute !== void 0;
1485
1504
  this.backgroundPerMinute = this.perMinute === 30 ? 20 : Math.ceil(this.perMinute * 2 / 3);
1486
1505
  this.backgroundWhileSignaling = this.perMinute === 30 ? 5 : Math.ceil(this.perMinute / 6);
1487
- const log = options.log ?? ((line) => console.info(`[ghostly:relay] ${line}`));
1506
+ const log = options.log ?? ((line) => console.info(`ghostly: ${line}`));
1488
1507
  this.breaker = new RelayBreaker({
1489
1508
  ...options.breaker,
1490
1509
  onTrip: (relay, reason, forMs) => {
1491
- log(`${new URL(relay).host} tripped (${reason}); left alone for ${Math.round(forMs / 1e3)} s`);
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`);
1492
1511
  options.breaker?.onTrip?.(relay, reason, forMs);
1493
1512
  this.changed("tripped");
1494
1513
  },
1495
1514
  onRecover: (relay) => {
1496
- log(`${new URL(relay).host} answered again`);
1515
+ log(`relay ${new URL(relay).host} answers again`);
1497
1516
  options.breaker?.onRecover?.(relay);
1498
1517
  this.changed("recovered");
1499
1518
  }
@@ -2177,13 +2196,13 @@ var RelayTransport = class {
2177
2196
  let response;
2178
2197
  try {
2179
2198
  response = await request;
2180
- } catch (error) {
2199
+ } catch {
2181
2200
  this.networkCooldown.set(`PUT ${relay}`, Date.now() + NETWORK_ERROR_COOLDOWN_MS);
2182
2201
  this.answered(relay, {
2183
2202
  kind: "error",
2184
2203
  reason: "no answer"
2185
2204
  });
2186
- throw error;
2205
+ throw new Error(`${relay} did not answer`);
2187
2206
  }
2188
2207
  if (response.status === 429) this.answered(relay, {
2189
2208
  kind: "throttled",
@@ -2237,6 +2256,7 @@ var RelayTransport = class {
2237
2256
  if (departedOver) this.departedOverAdd(key, now);
2238
2257
  this.spent.get(relay).push(now);
2239
2258
  if (who.background) this.spentBackground.get(relay).push(now);
2259
+ if (who.background && who.write) this.spentBackgroundWrites.get(relay).push(now);
2240
2260
  if (isGroupUrgentRead(who)) this.spentGroupUrgent.get(relay).push(now);
2241
2261
  if (isWatch(who)) this.spentWatch.get(relay).push(now);
2242
2262
  if (isChatWatch(who) && !departedOver) this.spentChatWatch.get(relay).push(now);
@@ -2270,6 +2290,8 @@ var RelayTransport = class {
2270
2290
  const recentBackground = (this.spentBackground.get(relay) ?? []).filter((at) => now - at < 6e4);
2271
2291
  this.spent.set(relay, recent);
2272
2292
  this.spentBackground.set(relay, recentBackground);
2293
+ const recentBackgroundWrites = (this.spentBackgroundWrites.get(relay) ?? []).filter((at) => now - at < 6e4);
2294
+ this.spentBackgroundWrites.set(relay, recentBackgroundWrites);
2273
2295
  const over = (list, limit) => list.length >= limit ? list[list.length - limit] + 6e4 - now : 0;
2274
2296
  const limit = this.limitOf(relay);
2275
2297
  const departed = isDepartedRead(who) && key !== void 0 && recent.length >= limit && this.departedReads(key, now) < 6;
@@ -2284,7 +2306,9 @@ var RelayTransport = class {
2284
2306
  this.spentGroupOver.set(relay, groupOver);
2285
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);
2286
2308
  if (who.background && !starved) {
2287
- wait = Math.max(wait, over(recentBackground, Math.min(this.backgroundPerMinute, Math.ceil(limit * 2 / 3))));
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))));
2288
2312
  const signaling = this.urgentAt + SIGNALING_WINDOW_MS - now;
2289
2313
  if (signaling > 0 && !who.door) wait = Math.max(wait, Math.min(signaling, over(recentBackground, Math.min(this.backgroundWhileSignaling, Math.ceil(limit / 6)))));
2290
2314
  }
@@ -2815,13 +2839,13 @@ function turnName(name) {
2815
2839
  }
2816
2840
  return hasVisible(out) ? out.trimEnd() : "";
2817
2841
  }
2818
- function u32$3(value) {
2842
+ function u32$4(value) {
2819
2843
  return Uint8Array.of(value >>> 24 & 255, value >>> 16 & 255, value >>> 8 & 255, value & 255);
2820
2844
  }
2821
2845
  /** What a release signs: `"ghostly-turn-release" || turnAddress(32) || turn(4) || toKey(32) || H(32)`. */
2822
2846
  function turnReleaseMessage(address, turn, toKey, h) {
2823
2847
  if (address.length !== 32 || toKey.length !== 32 || h.length !== 32) throw new Error("A release names 32-byte values");
2824
- return concatBytes(RELEASE_DOMAIN, address, u32$3(turn), toKey, h);
2848
+ return concatBytes(RELEASE_DOMAIN, address, u32$4(turn), toKey, h);
2825
2849
  }
2826
2850
  /** What the author signs: `"ghostly-turn" || turnAddress(32) || body[0..310]`. */
2827
2851
  function turnSignedMessage(address, unsigned) {
@@ -2839,8 +2863,8 @@ function encodeTurnFields(fields) {
2839
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");
2840
2864
  const body = /* @__PURE__ */ new Uint8Array(310);
2841
2865
  body[OFFSET.version] = 1;
2842
- body.set(u32$3(fields.turn), OFFSET.turn);
2843
- body.set(u32$3(fields.rev).subarray(1), OFFSET.rev);
2866
+ body.set(u32$4(fields.turn), OFFSET.turn);
2867
+ body.set(u32$4(fields.rev).subarray(1), OFFSET.rev);
2844
2868
  body[OFFSET.author] = fields.author;
2845
2869
  body[OFFSET.active] = fields.active;
2846
2870
  body[OFFSET.count] = fields.slots.filter(Boolean).length;
@@ -3105,7 +3129,7 @@ var TURN_RAISE_READ_TIMEOUT_MS = 5e3;
3105
3129
  var TURN_VISIBLE_MS = 1e4;
3106
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`. */
3107
3131
  var TURN_SETTLE_MS = 3e4;
3108
- function compareBytes$3(a, b) {
3132
+ function compareBytes$4(a, b) {
3109
3133
  for (let i = 0; i < Math.min(a.length, b.length); i++) if (a[i] !== b[i]) return a[i] - b[i];
3110
3134
  return a.length - b.length;
3111
3135
  }
@@ -3116,7 +3140,7 @@ function compareBytes$3(a, b) {
3116
3140
  * reader still agrees.
3117
3141
  */
3118
3142
  function keptAtEqualSequence(a, b) {
3119
- return compareBytes$3(a.record.instance, b.record.instance) || compareBytes$3(a.record.body, b.record.body) || compareBytes$3(a.payload, b.payload);
3143
+ return compareBytes$4(a.record.instance, b.record.instance) || compareBytes$4(a.record.body, b.record.body) || compareBytes$4(a.payload, b.payload);
3120
3144
  }
3121
3145
  var kept = (f) => ({
3122
3146
  record: f.read.record,
@@ -4904,7 +4928,7 @@ function checkAppManifest(value, options = {}) {
4904
4928
  function appDigest(manifestBytes) {
4905
4929
  return toBase64Url(sha256(manifestBytes));
4906
4930
  }
4907
- var u32$2 = (b, at) => (b[at] << 24 >>> 0) + (b[at + 1] << 16) + (b[at + 2] << 8) + b[at + 3];
4931
+ var u32$3 = (b, at) => (b[at] << 24 >>> 0) + (b[at + 1] << 16) + (b[at + 2] << 8) + b[at + 3];
4908
4932
  /**
4909
4933
  * Lets the thread go for one turn: what waits (input, drawing, timers, port messages, IndexedDB answers) runs, then the
4910
4934
  * caller goes on. A message to itself, queued behind the page's other tasks. Never `scheduler.yield()`: in Chromium its
@@ -4980,7 +5004,7 @@ function readAppBundleHead(bytes) {
4980
5004
  ok: false,
4981
5005
  reason: "truncated"
4982
5006
  };
4983
- const manifestLength = u32$2(bytes, at);
5007
+ const manifestLength = u32$3(bytes, at);
4984
5008
  at += 4;
4985
5009
  if (manifestLength > APP_BUNDLE_LIMITS.manifestBytes) return {
4986
5010
  ok: false,
@@ -4992,7 +5016,7 @@ function readAppBundleHead(bytes) {
4992
5016
  };
4993
5017
  const manifestBytes = bytes.subarray(at, at + manifestLength);
4994
5018
  at += manifestLength;
4995
- const statementLength = u32$2(bytes, at);
5019
+ const statementLength = u32$3(bytes, at);
4996
5020
  at += 4;
4997
5021
  if (bytes.length < at + statementLength) return {
4998
5022
  ok: false,
@@ -5184,9 +5208,9 @@ var ContactRequestError = class extends Error {
5184
5208
  this.name = "ContactRequestError";
5185
5209
  }
5186
5210
  };
5187
- var label = (text) => utf8Encode(text);
5211
+ var label$1 = (text) => utf8Encode(text);
5188
5212
  function derive(linkKeyZ32, info) {
5189
- 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);
5190
5214
  }
5191
5215
  /** The UTC day number of a time: a stamp is made for one. */
5192
5216
  function contactDay(ms) {
@@ -5194,7 +5218,7 @@ function contactDay(ms) {
5194
5218
  }
5195
5219
  /** The `seen` entry of an asker key on a link: the first 9 bytes of a hash, so the record names nobody. */
5196
5220
  function seenEntry(linkKeyZ32, askerZ32) {
5197
- 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));
5198
5222
  }
5199
5223
  function linkRecords(record) {
5200
5224
  if (!Number.isInteger(record.bits) || record.bits < 16 || record.bits > 24) throw new Error("A link asks for 16 to 24 bits");
@@ -5232,7 +5256,7 @@ function readLinkRecord(records) {
5232
5256
  function stampPrefix(linkKeyZ32, askerZ32, day) {
5233
5257
  const tail = /* @__PURE__ */ new Uint8Array(4);
5234
5258
  new DataView(tail.buffer).setUint32(0, day);
5235
- 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);
5236
5260
  }
5237
5261
  function leadingZeroBits(hash) {
5238
5262
  let bits = 0;
@@ -5294,7 +5318,7 @@ function knockSlotOf(linkKeyZ32, askerZ32) {
5294
5318
  }
5295
5319
  function knockSlotRecords(linkKeyZ32, knocks) {
5296
5320
  const nonce = randomBytes(NONCE_LENGTH$3);
5297
- const body = label(JSON.stringify(knocks.slice(-6).map((k) => [
5321
+ const body = label$1(JSON.stringify(knocks.slice(-6).map((k) => [
5298
5322
  k.key,
5299
5323
  k.day,
5300
5324
  k.stamp
@@ -5329,9 +5353,9 @@ function mergeContactKnocks(existing, mine, now) {
5329
5353
  return [...existing.filter((k) => k.key !== mine.key && k.day >= today - 1 && k.day <= today + 1).slice(-5), mine];
5330
5354
  }
5331
5355
  function requestKey(linkKeyZ32, askerZ32, shared) {
5332
- 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);
5333
5357
  }
5334
- var REQUEST_AAD = label("ghostly-contact/1 request");
5358
+ var REQUEST_AAD = label$1("ghostly-contact/1 request");
5335
5359
  /** The value of a request's record for a plaintext of `length` bytes. */
5336
5360
  var sealedValueLength = (length) => Math.ceil((NONCE_LENGTH$3 + length + TAG_LENGTH) * 4 / 3);
5337
5361
  var plaintextBytes;
@@ -5369,7 +5393,7 @@ function requestRecords(askerSeedB64, linkKeyZ32, request) {
5369
5393
  if (!inviteHolds(request.invite)) throw new ContactRequestError("invite");
5370
5394
  if (!Number.isSafeInteger(request.issued) || !Number.isSafeInteger(request.expires) || request.expires <= request.issued || request.expires - request.issued > 6048e5) throw new ContactRequestError("dates");
5371
5395
  const asker = identityFromSeedB64(askerSeedB64);
5372
- const json = label(JSON.stringify([
5396
+ const json = label$1(JSON.stringify([
5373
5397
  1,
5374
5398
  request.invite,
5375
5399
  request.name,
@@ -8436,6 +8460,13 @@ var UNUSED_INVITE_WAIT_MAX_MS = 18e4;
8436
8460
  * hunt 1014-0136, 2026-10-14).
8437
8461
  */
8438
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;
8439
8470
  /** The keys and mailboxes of unused invites read slowly over each transport (an app's relays). */
8440
8471
  var unusedInviteReaders = /* @__PURE__ */ new WeakMap();
8441
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. */
@@ -8532,6 +8563,8 @@ var LinkSession = class {
8532
8563
  awaitingSince;
8533
8564
  /** This side's invite, nobody used yet (`LinkSessionOptions.invite`). */
8534
8565
  invite;
8566
+ /** This side's own invite, nobody used yet (`LinkSessionOptions.ownInvite`). */
8567
+ ownInvite;
8535
8568
  intervals;
8536
8569
  fastPollUntil = 0;
8537
8570
  /** An offer to a saved contact is out: from then on its fast window looks less often (`OFFER_FAST_MS`); 0 for none. */
@@ -8600,6 +8633,7 @@ var LinkSession = class {
8600
8633
  this.resumeReads = !!options.resumed;
8601
8634
  this.awaitingSince = Math.min(options.awaitingSince ?? this.startedAt, this.startedAt);
8602
8635
  this.invite = options.invite ?? (() => false);
8636
+ this.ownInvite = options.ownInvite ?? (() => false);
8603
8637
  }
8604
8638
  get peerPresence() {
8605
8639
  return this.presence;
@@ -8890,10 +8924,15 @@ var LinkSession = class {
8890
8924
  if (this.heartbeatTimer) clearTimeout(this.heartbeatTimer);
8891
8925
  this.heartbeatTimer = setTimeout(() => {
8892
8926
  if (!this.running) return;
8893
- if (this.getServices() !== void 0) this.publish(true).catch(() => {});
8927
+ if (this.getServices() !== void 0 && !this.upkeepWaits()) this.publish(true).catch(() => {});
8894
8928
  this.scheduleHeartbeat();
8895
8929
  }, PRESENCE_HEARTBEAT);
8896
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
+ }
8897
8936
  /**
8898
8937
  * Coalesces publishes: at most one in flight and one queued behind it. `upkeep`: nothing new to say (the heartbeat, a
8899
8938
  * retry of what waits): with nothing else asked for since, the packet goes as upkeep (`publishOnce`).
@@ -9747,6 +9786,476 @@ var DataLink = class {
9747
9786
  }
9748
9787
  };
9749
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
9750
10259
  //#region ../core/src/groupCrypto.ts
9751
10260
  /**
9752
10261
  * The cryptography of the `group-mesh/1` profile (WISP 900 / 902 group mesh).
@@ -10251,6 +10760,18 @@ function cardUrl(value) {
10251
10760
  if (url.protocol !== "https:" || !url.hostname || url.username || url.password) return void 0;
10252
10761
  return url.href.length <= STATUS_CARD_LIMITS.url ? url.href : void 0;
10253
10762
  }
10763
+ /**
10764
+ * The link an app card names, sent or read (WISP 405 § An app): a card's link without its query or fragment. A
10765
+ * private file's read token rides in a query, and a card goes to a contact; a bundle is pinned by its digest, not its link.
10766
+ */
10767
+ function appCardUrl(value) {
10768
+ const href = cardUrl(value);
10769
+ if (!href) return void 0;
10770
+ const url = new URL(href);
10771
+ url.search = "";
10772
+ url.hash = "";
10773
+ return url.href;
10774
+ }
10254
10775
  /** The host a card shows beside a link, so the reader sees where it goes before following it. */
10255
10776
  function cardLinkHost(url) {
10256
10777
  try {
@@ -10368,7 +10889,7 @@ function readStatusCard(raw, now = Date.now()) {
10368
10889
  if (!isAppRef(raw.ref) || id !== appCardId(raw.ref) || !isAppHash(raw.digest) || !appSequence(raw.sequence)) return void 0;
10369
10890
  const title = cardLine(raw.title, STATUS_CARD_LIMITS.appTitle);
10370
10891
  if (!title) return void 0;
10371
- const version = cardLine(raw.version, STATUS_CARD_LIMITS.appVersion), url = cardUrl(raw.url);
10892
+ const version = cardLine(raw.version, STATUS_CARD_LIMITS.appVersion), url = appCardUrl(raw.url);
10372
10893
  return {
10373
10894
  kind: "app",
10374
10895
  id,
@@ -10706,8 +11227,8 @@ function removedCardText(of, title) {
10706
11227
  function statusCardText(card) {
10707
11228
  if (card.kind === "removed") return removedCardText(card.of);
10708
11229
  if (card.kind === "app") {
10709
- const named = `${card.title}${card.version ? ` ${card.version}` : ""}`;
10710
- return [card.opened ? `🧩 Opened ${named} in this chat (Ghostly app)` : `🧩 ${named} (Ghostly app)`, ...card.url ? [card.url] : []].join("\n");
11230
+ const named = `${card.title}${card.version ? ` ${card.version}` : ""}`, url = appCardUrl(card.url);
11231
+ return [card.opened ? `🧩 Opened ${named} in this chat (Ghostly app)` : `🧩 ${named} (Ghostly app)`, ...url ? [url] : []].join("\n");
10711
11232
  }
10712
11233
  if (card.kind === "usage") {
10713
11234
  const left = `${usageLeft(card)}% left${card.window ? ` (${card.window})` : ""}`;
@@ -12003,6 +12524,11 @@ var DhtDelivery = class DhtDelivery {
12003
12524
  live = false;
12004
12525
  active = false;
12005
12526
  startedAt = Date.now();
12527
+ /**
12528
+ * When an envelope of the contact's newer than any before was last read here, in this run. A contact that is there
12529
+ * puts a keep-alive every four minutes: none in `PRESENCE_WINDOW`, it is away (`publish`).
12530
+ */
12531
+ peerNewAt = -Infinity;
12006
12532
  /** The next read was asked for (a refresh, a fresh packet of the contact): it is not a background one. */
12007
12533
  urgent = false;
12008
12534
  /** Reads left that are signaling: the contact is leaving DHT only, and the live link waits on them (`expect`). */
@@ -12076,9 +12602,29 @@ var DhtDelivery = class DhtDelivery {
12076
12602
  maxTextBytes: 256,
12077
12603
  ...this.lastPublished && { lastPublished: this.lastPublished },
12078
12604
  ...this.foreignKeySeenAt && { foreignKeySeenAt: this.foreignKeySeenAt },
12079
- ...this.state.inviteTaken && { inviteTaken: true }
12605
+ ...this.state.inviteTaken && { inviteTaken: true },
12606
+ ...this.forwardSecrecy && { forwardSecrecy: this.forwardSecrecy }
12080
12607
  };
12081
12608
  }
12609
+ get forwardSecrecy() {
12610
+ const ratchet = this.options.ratchet;
12611
+ if (!ratchet || !this.options.credentials.peerKey) return void 0;
12612
+ const supports = ratchet.peerSupports();
12613
+ return ratchet.box.on && supports ? "on" : !supports ? ratchet.box.heardAny ? "stopped" : "unsupported" : "starting";
12614
+ }
12615
+ /**
12616
+ * Whether an envelope to `recipient` is sealed with the ratchet: the contact is pinned and its record lists
12617
+ * `ratchet/1`, or a ratcheted envelope of its was opened here, after which nothing goes plain (WISP 4xx § Downgrade).
12618
+ * And the contact pinned this side too (an envelope of its sealed to this side read, or a live session had): a joiner
12619
+ * pins its inviter from the invite, and its first contact sealed with the ratchet would reach an inviter that has no key
12620
+ * to open it with, and so never pins it.
12621
+ */
12622
+ ratcheted(recipient) {
12623
+ const ratchet = this.options.ratchet, peer = this.options.credentials.peerKey;
12624
+ if (!ratchet || !peer || recipient !== peer) return false;
12625
+ if (ratchet.box.heardAny) return true;
12626
+ return ratchet.peerSupports() && (!!this.state.peerPinned || !!this.state.wasLive);
12627
+ }
12082
12628
  /**
12083
12629
  * This side joined, and its inviter never answered (`DhtDeliveryState.unanswered`): no envelope of its newer than the
12084
12630
  * one that pinned it, none sealed to this side, no text confirmed, never live (as `sealedToAnother` asks too).
@@ -12117,6 +12663,14 @@ var DhtDelivery = class DhtDelivery {
12117
12663
  return this.pinnedBoxes;
12118
12664
  }
12119
12665
  lastPublished;
12666
+ /** The envelope a trace line was last said for, per step: a packet read again says nothing new (a Desktop logs every line). */
12667
+ traced = /* @__PURE__ */ new Map();
12668
+ traceOnce(step, record, detail) {
12669
+ const seen = record.slice(-24);
12670
+ if (this.traced.get(step) === seen) return;
12671
+ this.traced.set(step, seen);
12672
+ traceLink(this.from, step, detail);
12673
+ }
12120
12674
  /** The sealed record's nonce is its first 24 bytes: 32 characters of base64. */
12121
12675
  static facts(body, records, key) {
12122
12676
  return {
@@ -12172,6 +12726,13 @@ var DhtDelivery = class DhtDelivery {
12172
12726
  ]));
12173
12727
  }
12174
12728
  records(body, recipient = this.options.credentials.peerKey) {
12729
+ return this.envelope(body, recipient).records;
12730
+ }
12731
+ /**
12732
+ * The envelope's records. Ratcheted (`ratcheted`), its `_dr` record is the right length but not sealed yet: `seal`
12733
+ * gives its bytes, under the chat's lock, once the publication is sure to go. Measuring a packet takes no key.
12734
+ */
12735
+ envelope(body, recipient = this.options.credentials.peerKey) {
12175
12736
  const signature = toBase64Url(sign(this.signed(body, recipient), this.participation.seed));
12176
12737
  const plaintext = JSON.stringify([body, signature]);
12177
12738
  const hint = recipient ? [{
@@ -12179,20 +12740,46 @@ var DhtDelivery = class DhtDelivery {
12179
12740
  value: encrypt(this.participation.pubKeyZ32, this.key),
12180
12741
  ttl: ENVELOPE_TTL
12181
12742
  }] : [];
12743
+ const ratchet = this.ratcheted(recipient);
12744
+ const sealedBytes = (bytes) => ratchet ? 4 * Math.ceil((66 + bytes) / 3) : sealedLength(bytes);
12745
+ const label = ratchet ? "_dr" : "_dm";
12182
12746
  const fits = (bytes) => bytes <= MAX_ENVELOPE_PLAINTEXT && measureRecords(this.identity.pubKeyZ32, [{
12183
- label: "_dm",
12184
- value: "A".repeat(sealedLength(bytes)),
12747
+ label,
12748
+ value: "A".repeat(sealedBytes(bytes)),
12185
12749
  ttl: ENVELOPE_TTL
12186
12750
  }, ...hint]) <= ENVELOPE_PACKET_BYTES;
12187
12751
  const bytes = utf8Encode(plaintext).length;
12188
12752
  if (!fits(bytes)) throw new Error("Text and authentication exceed the DHT packet budget. Shorten the message.");
12189
12753
  let padded = bytes;
12190
12754
  for (let step = 512; step >= 1; step >>= 1) if (fits(padded + step)) padded += step;
12191
- return [{
12192
- label: "_dm",
12193
- value: encrypt(plaintext + " ".repeat(padded - bytes), recipient ? this.sealedKey(recipient) : this.key),
12755
+ const full = plaintext + " ".repeat(padded - bytes);
12756
+ if (ratchet) return {
12757
+ records: [{
12758
+ label,
12759
+ value: "A".repeat(sealedBytes(padded)),
12760
+ ttl: ENVELOPE_TTL
12761
+ }, ...hint],
12762
+ plaintext: full
12763
+ };
12764
+ return { records: [{
12765
+ label,
12766
+ value: encrypt(full, recipient ? this.sealedKey(recipient) : this.key),
12194
12767
  ttl: ENVELOPE_TTL
12195
- }, ...hint];
12768
+ }, ...hint] };
12769
+ }
12770
+ /**
12771
+ * The records to publish: a ratcheted one sealed now, its state saved first (seal, save, send), from the plaintext
12772
+ * the envelope was measured with.
12773
+ */
12774
+ async sealed(envelope) {
12775
+ const { records, plaintext } = envelope;
12776
+ if (records[0]?.label !== "_dr") return records;
12777
+ if (plaintext === void 0) throw new Error("A ratcheted envelope without its plaintext");
12778
+ const sealed = await this.options.ratchet.box.lock((tx) => tx.seal("floor", utf8Encode(plaintext)));
12779
+ return [{
12780
+ ...records[0],
12781
+ value: toBase64(sealed)
12782
+ }, ...records.slice(1)];
12196
12783
  }
12197
12784
  async start() {
12198
12785
  if (this.running) return;
@@ -12311,6 +12898,7 @@ var DhtDelivery = class DhtDelivery {
12311
12898
  }
12312
12899
  validate(text, timestamp, id, reply, edit) {
12313
12900
  if (this.options.peerAcceptsText?.() === false) return DHT_TEXT_REFUSED;
12901
+ if (this.forwardSecrecy === "stopped") return DHT_RATCHET_STOPPED;
12314
12902
  if (!ID$3.test(id) || !Number.isSafeInteger(timestamp) || timestamp <= 0 || reply !== void 0 && !REPLY_TO.test(reply)) return "Invalid message.";
12315
12903
  if (edit !== void 0 && (reply !== void 0 || !ID$3.test(edit[0]) || !validEditNumber(edit[1]))) return "Invalid message.";
12316
12904
  if (utf8Encode(text).length > 256) return DHT_TEXT_TOO_LONG;
@@ -12585,10 +13173,10 @@ var DhtDelivery = class DhtDelivery {
12585
13173
  for (let count = pending.length; count > 0; count--) {
12586
13174
  const body = this.body(sequence, issued, expires, message, receipt, reply, pending.slice(0, count), edit, forwarded, file);
12587
13175
  try {
12588
- const records = this.records(body);
13176
+ const envelope = this.envelope(body);
12589
13177
  if (utf8Encode(JSON.stringify([body, "x".repeat(86)])).length <= MAX_ENVELOPE_PLAINTEXT) return {
12590
13178
  body,
12591
- records,
13179
+ ...envelope,
12592
13180
  reactions: count
12593
13181
  };
12594
13182
  } catch {}
@@ -12596,7 +13184,7 @@ var DhtDelivery = class DhtDelivery {
12596
13184
  const body = this.body(sequence, issued, expires, message, receipt, reply, [], edit, forwarded, file);
12597
13185
  return {
12598
13186
  body,
12599
- records: this.records(body),
13187
+ ...this.envelope(body),
12600
13188
  reactions: 0
12601
13189
  };
12602
13190
  }
@@ -12611,10 +13199,21 @@ var DhtDelivery = class DhtDelivery {
12611
13199
  if (keepAlive && (this.controlDue > now || this.state.inviteTaken)) return;
12612
13200
  const expires = pending?.expires ?? now - 12e4 + CONTROL_TTL;
12613
13201
  const issued = Math.min(now, Math.max(now - DHT_ISSUED_BACK_MS, expires - (pending ? DHT_MESSAGE_TTL : CONTROL_TTL), (pending?.message[1] ?? 0) - 3e4));
12614
- const { body, records, reactions } = this.fitted(this.sequence + 1, issued, expires, pending?.message ?? null, receipt?.id ?? null, pending?.reply, pending?.edit, pending?.forwarded, pending?.file);
13202
+ const identity = !reseal && this.state.peerPinned && this.state.peerPinned !== "can" && this.pinned()?.identity || this.identity;
13203
+ const away = !!this.options.credentials.peerKey && now - this.peerNewAt >= 6e5;
13204
+ const options = keepAlive && (this.live || away) ? { background: true } : void 0;
13205
+ const held = this.options.transport.publishHeld?.(identity.pubKeyZ32, options);
13206
+ if (held) {
13207
+ await this.heldBack(held, now, {
13208
+ lastPublish: this.lastPublish,
13209
+ controlDue: this.controlDue
13210
+ }, void 0, void 0);
13211
+ throw held;
13212
+ }
13213
+ const fittedEnvelope = this.fitted(this.sequence + 1, issued, expires, pending?.message ?? null, receipt?.id ?? null, pending?.reply, pending?.edit, pending?.forwarded, pending?.file);
13214
+ const { body, reactions } = fittedEnvelope;
12615
13215
  const reactionsWereDue = this.reactionsDue;
12616
13216
  this.reactionsDue = !reactions && !!this.options.reactions?.().length;
12617
- const identity = !reseal && this.state.peerPinned && this.state.peerPinned !== "can" && this.pinned()?.identity || this.identity;
12618
13217
  const sequence = body[1];
12619
13218
  await this.persist({
12620
13219
  ...this.state,
@@ -12631,20 +13230,23 @@ var DhtDelivery = class DhtDelivery {
12631
13230
  } : this.state.receipt
12632
13231
  });
12633
13232
  this.sequence = sequence;
13233
+ const records = await this.sealed(fittedEnvelope);
12634
13234
  const before = {
12635
13235
  lastPublish: this.lastPublish,
12636
13236
  controlDue: this.controlDue
12637
13237
  };
13238
+ const ownInvite = !this.options.credentials.expectedPeerKey && !this.active && this.unusedInviteAge(now) !== void 0;
12638
13239
  this.lastPublish = now;
12639
- this.controlDue = now + 24e4;
13240
+ this.controlDue = now + (ownInvite ? UNUSED_INVITE_UPKEEP_MS : 24e4);
12640
13241
  traceLink(this.from, "dht-publish", {
12641
13242
  mode: this.mode,
12642
13243
  seq: body[1],
12643
- ...identity !== this.identity && { pinned: true }
13244
+ ...identity !== this.identity && { pinned: true },
13245
+ ...records[0]?.label === "_dr" && { ratchet: true }
12644
13246
  });
12645
13247
  if (pending) this.lastPublished = DhtDelivery.facts(body, records, identity.pubKeyZ32);
12646
13248
  try {
12647
- await this.options.transport.publish(identity, records, keepAlive && this.live ? { background: true } : void 0);
13249
+ await this.options.transport.publish(identity, records, options);
12648
13250
  } catch (error) {
12649
13251
  this.reactionsDue ||= reactionsWereDue;
12650
13252
  if (isDiscoveryBudgetError(error)) await this.heldBack(error, now, before, pending, receipt);
@@ -12670,7 +13272,7 @@ var DhtDelivery = class DhtDelivery {
12670
13272
  this.lastPublish = before.lastPublish;
12671
13273
  this.controlDue = Math.min(before.controlDue, at);
12672
13274
  traceLink(this.from, "dht-publish-waits", { retryInMs: at - now });
12673
- await this.persist({
13275
+ if (pending || receipt) await this.persist({
12674
13276
  ...this.state,
12675
13277
  pending: pending ?? this.state.pending,
12676
13278
  receipt: receipt ?? this.state.receipt
@@ -12681,22 +13283,44 @@ var DhtDelivery = class DhtDelivery {
12681
13283
  * one sealed record, a well-formed body within its times, signed by the key it names. Null: not an envelope of the
12682
13284
  * contact's (the pin rules are the caller's).
12683
13285
  */
12684
- open(packet, box) {
13286
+ open(packet, box, ratchet) {
12685
13287
  const address = box === "pinned" ? this.pinned()?.peerAddress : this.peerAddress;
12686
13288
  if (!address || packet.pubKeyZ32 !== address || measureRecords(packet.pubKeyZ32, packet.records) > 1e3) return null;
12687
- const records = packet.records.filter((r) => r.label === "_dm");
12688
- if (records.length !== 1) return null;
13289
+ const records = packet.records.filter((r) => r.label === "_dm"), ratcheted = packet.records.filter((r) => r.label === "_dr");
13290
+ if (records.length + ratcheted.length !== 1) return null;
12689
13291
  const hints = packet.records.filter((r) => r.label === "_dmk");
12690
13292
  if (hints.length > 1) return null;
12691
13293
  const sender = hints.length ? tryDecrypt(hints[0].value, this.key) : null;
12692
13294
  if (hints.length && !sender) return null;
13295
+ const peer = this.options.credentials.peerKey;
12693
13296
  let plaintext;
12694
- try {
12695
- plaintext = tryDecrypt(records[0].value, sender ? this.sealedKey(sender) : this.key);
12696
- } catch {
12697
- plaintext = null;
13297
+ if (ratcheted.length) {
13298
+ const closed = box === "invite" && sender ? { sealedToAnother: sender } : null;
13299
+ if (!ratchet || !peer || sender !== peer) return closed;
13300
+ let opened;
13301
+ try {
13302
+ opened = ratchet(fromBase64(ratcheted[0].value));
13303
+ } catch {
13304
+ opened = null;
13305
+ }
13306
+ if (!opened) return closed;
13307
+ try {
13308
+ plaintext = utf8Decode(opened);
13309
+ } catch {
13310
+ return null;
13311
+ }
13312
+ } else {
13313
+ if (peer && this.options.ratchet?.box.heard("floor") && (!sender || sender === peer)) {
13314
+ this.traceOnce("dht-plain-refused", records[0].value, { box });
13315
+ return null;
13316
+ }
13317
+ try {
13318
+ plaintext = tryDecrypt(records[0].value, sender ? this.sealedKey(sender) : this.key);
13319
+ } catch {
13320
+ plaintext = null;
13321
+ }
13322
+ if (!plaintext && sender) return { sealedToAnother: sender };
12698
13323
  }
12699
- if (!plaintext && sender) return { sealedToAnother: sender };
12700
13324
  if (!plaintext || utf8Encode(plaintext).length > MAX_ENVELOPE_PLAINTEXT) return null;
12701
13325
  let envelope;
12702
13326
  try {
@@ -12776,7 +13400,41 @@ var DhtDelivery = class DhtDelivery {
12776
13400
  * can write to) or `pinned`. `none`: nothing from the contact in it; `old`: the contact's, already read; `new`: taken.
12777
13401
  */
12778
13402
  async receive(packet, box) {
12779
- const opened = this.open(packet, box);
13403
+ const ratcheted = packet.records.find((r) => r.label === "_dr");
13404
+ if (!ratcheted) return this.take(packet, box, this.open(packet, box));
13405
+ const digest = toBase64Url(sha256(utf8Encode(ratcheted.value)).slice(0, 16));
13406
+ if (digest === this.state.lastDr) return "old";
13407
+ const ratchet = this.options.ratchet;
13408
+ if (!ratchet) return "none";
13409
+ let sealed;
13410
+ const opened = this.open(packet, box, (bytes) => {
13411
+ const plain = ratchet.box.peek("floor", bytes);
13412
+ if (plain) sealed = bytes;
13413
+ return plain;
13414
+ });
13415
+ if (!sealed) this.traceOnce("dht-ratchet-closed", ratcheted.value, {
13416
+ box,
13417
+ pinned: !!this.options.credentials.peerKey
13418
+ });
13419
+ if (!sealed && box === "pinned" && packet.pubKeyZ32 === this.pinned()?.peerAddress && this.state.peerPinned !== "seen") {
13420
+ await this.persist({
13421
+ ...this.state,
13422
+ peerPinned: "seen"
13423
+ });
13424
+ traceLink(this.from, "dht-peer-pinned", {
13425
+ peerPinned: "seen",
13426
+ ratchet: true
13427
+ });
13428
+ }
13429
+ return this.take(packet, box, opened, sealed && {
13430
+ commit: async (order) => {
13431
+ if (!await ratchet.box.commitOpen("floor", sealed, order)) throw new Error("A ratcheted envelope no longer opens");
13432
+ },
13433
+ digest
13434
+ });
13435
+ }
13436
+ /** `ratchet`: the envelope was ratcheted; its state is saved once what it carried is stored, with its digest. */
13437
+ async take(packet, box, opened, ratchet) {
12780
13438
  if (!opened) return "none";
12781
13439
  if ("sealedToAnother" in opened) {
12782
13440
  if (opened.sealedToAnother) await this.sealedToAnother(opened.sealedToAnother);
@@ -12803,6 +13461,7 @@ var DhtDelivery = class DhtDelivery {
12803
13461
  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";
12804
13462
  if (receipt !== null && (typeof receipt !== "string" || !ID$3.test(receipt))) return "none";
12805
13463
  const unanswered = !this.options.credentials.peerKey && !!this.options.credentials.expectedPeerKey && !sender && !this.live;
13464
+ this.peerNewAt = Date.now();
12806
13465
  await this.options.pin(author);
12807
13466
  this.options.credentials.peerKey = author;
12808
13467
  this.options.credentials.requireSignedSignals = true;
@@ -12846,6 +13505,7 @@ var DhtDelivery = class DhtDelivery {
12846
13505
  if (peerPinned !== this.state.peerPinned) traceLink(this.from, "dht-peer-pinned", { peerPinned });
12847
13506
  if (this.state.inviteTaken) traceLink(this.from, "invite-untaken", {});
12848
13507
  const { inviteTaken: _taken, ...kept } = this.state;
13508
+ if (ratchet) await ratchet.commit(sequence);
12849
13509
  await this.persist({
12850
13510
  ...kept,
12851
13511
  peerSequence: sequence,
@@ -12854,6 +13514,7 @@ var DhtDelivery = class DhtDelivery {
12854
13514
  confirmed,
12855
13515
  ...peerPinned && { peerPinned },
12856
13516
  ...unanswered && { unanswered: sequence },
13517
+ ...ratchet && { lastDr: ratchet.digest },
12857
13518
  pending: confirmed && this.state.pending?.message[0] === confirmed ? void 0 : this.state.pending,
12858
13519
  ...newest > (this.state.reactionsTaken ?? 0) && { reactionsTaken: newest }
12859
13520
  });
@@ -12908,7 +13569,12 @@ var DhtDelivery = class DhtDelivery {
12908
13569
  for (const box of boxes) {
12909
13570
  const packet = await this.options.transport.resolve(box === "pinned" ? pinned.peerAddress : this.peerAddress, options);
12910
13571
  reads++;
12911
- const opened = packet && this.open(packet, box);
13572
+ const dr = packet?.records.find((r) => r.label === "_dr");
13573
+ if (dr && toBase64Url(sha256(utf8Encode(dr.value)).slice(0, 16)) === this.state.lastDr) return {
13574
+ reads,
13575
+ text: null
13576
+ };
13577
+ const opened = packet && this.open(packet, box, (sealed) => this.options.ratchet?.box.peek("floor", sealed) ?? null);
12912
13578
  if (!opened || "sealedToAnother" in opened || opened.author !== expected) continue;
12913
13579
  const { sequence, message } = opened;
12914
13580
  const fresh = Array.isArray(message) && typeof message[0] === "string" && ID$3.test(message[0]) && sequence > this.state.peerSequence && this.state.receipt?.id !== message[0];
@@ -13023,6 +13689,7 @@ var DhtDelivery = class DhtDelivery {
13023
13689
  }
13024
13690
  };
13025
13691
  var DHT_TEXT_REFUSED = "Your contact's app does not accept text over the DHT. It is sent when you are live.";
13692
+ var DHT_RATCHET_STOPPED = "Your contact's app no longer reads protected messages over the DHT. It is sent when you are live.";
13026
13693
  var DHT_FILE_REFUSED = "Your contact's app shows a file only once it comes. It is sent when you are live.";
13027
13694
  var DHT_FILE_TOO_LARGE = "This file's name is too long to say over the DHT. It is sent when you are live.";
13028
13695
  /**
@@ -13033,17 +13700,29 @@ function peekDhtMailbox(options) {
13033
13700
  const refuse = async () => {
13034
13701
  throw new Error("A peek saves nothing");
13035
13702
  };
13703
+ const credentials = { ...options.credentials }, peer = credentials.peerKey;
13704
+ const box = options.ratchet && peer ? new RatchetBox(() => ({
13705
+ seed: fromBase64Url(credentials.seedB64),
13706
+ self: identityFromSeedB64(credentials.seedB64).pubKeyZ32,
13707
+ peer,
13708
+ rendezvous: [identityFromSeedB64(options.params.seedB64).pubKeyZ32, options.params.peerPubKeyZ32],
13709
+ secret: fromBase64Url(options.params.encKeyB64)
13710
+ }), options.ratchet, refuse) : void 0;
13036
13711
  return new DhtDelivery({
13037
13712
  params: options.params,
13038
13713
  mode: "stream",
13039
13714
  state: options.state,
13040
- credentials: { ...options.credentials },
13715
+ credentials,
13041
13716
  transport: options.transport,
13042
13717
  save: refuse,
13043
13718
  pin: refuse,
13044
13719
  message: refuse,
13045
13720
  receipt: refuse,
13046
- changed: () => {}
13721
+ changed: () => {},
13722
+ ...box && { ratchet: {
13723
+ box,
13724
+ peerSupports: () => true
13725
+ } }
13047
13726
  }).peek(options.background ? { background: true } : void 0);
13048
13727
  }
13049
13728
  //#endregion
@@ -13338,7 +14017,7 @@ function irohRelayUrl(value, spelling = "dotted") {
13338
14017
  const host = url.hostname, name = host.replace(/\.$/, "");
13339
14018
  if (!name.includes(".") && name !== "localhost") return value;
13340
14019
  if (name.startsWith("[") || /^\d+(\.\d+){3}$/.test(name)) return value;
13341
- const wanted = spelling === "plain" || name === "localhost" ? name : `${name}.`;
14020
+ const wanted = spelling === "dotted" && /(^|\.)iroh\.link$/.test(name) ? `${name}.` : name;
13342
14021
  if (wanted === host) return value;
13343
14022
  url.hostname = wanted;
13344
14023
  return url.href;
@@ -13358,6 +14037,14 @@ function irohDescriptor(descriptor, spelling = "dotted") {
13358
14037
  * as a test relay is (the same rule as the relay settings).
13359
14038
  */
13360
14039
  var RELAY_URL = /^((https|wss):\/\/[^\s]{1,120}|(http|ws):\/\/(127\.0\.0\.1|localhost|\[::1\])(:\d{1,5})?(\/[^\s]{0,100})?)$/;
14040
+ /**
14041
+ * A relay URL with more than its server's address in it: a login, a query or a fragment, which no relay setting takes
14042
+ * (irohWeb.ts `irohRelayProblem`, hyperdhtRelay.ts `hyperdhtRelayProblem`). An older app named its HyperDHT relay as
14043
+ * set, with them; such a descriptor is not dialed or kept, and the rest of what the contact told still is.
14044
+ */
14045
+ var RELAY_WITH_SECRETS = /^[a-z]+:\/\/[^/?#]*@|[?#]/i;
14046
+ /** A relay URL a descriptor may name: `RELAY_URL`, with nothing but the server's address in it. */
14047
+ var relayUrl = (value) => typeof value === "string" && RELAY_URL.test(value) && !RELAY_WITH_SECRETS.test(value);
13361
14048
  var HEX_KEY = /^[0-9a-f]{64}$/;
13362
14049
  /** An Iroh direct address as the adapters parse it: an IPv4 or bracketed IPv6 address and its port. */
13363
14050
  var SOCKET_ADDRESS = /^(\d{1,3}(\.\d{1,3}){3}|\[[0-9A-Fa-f:.]{2,45}(%[A-Za-z0-9._-]{1,16})?\]):\d{1,5}$/;
@@ -13365,7 +14052,7 @@ var MAX_ADDRESSES = 8;
13365
14052
  /**
13366
14053
  * A contact's native descriptors as it tells them on a session (`paired-policy`, `paired-adapters`) or as this app
13367
14054
  * kept them: only what the adapters dial, each field in the shape its adapter makes. The keys are 64 hex characters,
13368
- * a relay passes `RELAY_URL` (the rule its capability record is read by), an Iroh descriptor lists at most eight
14055
+ * a relay passes `relayUrl` (the rule its capability record is read by), an Iroh descriptor lists at most eight
13369
14056
  * socket addresses. A descriptor that is anything else is left out, as one the contact never told; a field this app
13370
14057
  * does not know is not kept.
13371
14058
  */
@@ -13373,17 +14060,16 @@ function checkedDescriptors(value) {
13373
14060
  const out = {};
13374
14061
  if (!value || typeof value !== "object" || Array.isArray(value)) return out;
13375
14062
  const raw = value;
13376
- const relay = (v) => typeof v === "string" && RELAY_URL.test(v);
13377
14063
  const relayed = (v) => v === void 0 || typeof v === "boolean";
13378
14064
  const iroh = raw["iroh/1"];
13379
- if (iroh && typeof iroh === "object" && typeof iroh.id === "string" && HEX_KEY.test(iroh.id) && (iroh.relay === void 0 || iroh.relay === null || relay(iroh.relay)) && relayed(iroh.relayed) && Array.isArray(iroh.addresses) && iroh.addresses.length <= MAX_ADDRESSES && iroh.addresses.every((a) => typeof a === "string" && SOCKET_ADDRESS.test(a))) out["iroh/1"] = {
14065
+ if (iroh && typeof iroh === "object" && typeof iroh.id === "string" && HEX_KEY.test(iroh.id) && (iroh.relay === void 0 || iroh.relay === null || relayUrl(iroh.relay)) && relayed(iroh.relayed) && Array.isArray(iroh.addresses) && iroh.addresses.length <= MAX_ADDRESSES && iroh.addresses.every((a) => typeof a === "string" && SOCKET_ADDRESS.test(a))) out["iroh/1"] = {
13380
14066
  id: iroh.id,
13381
14067
  relay: iroh.relay ?? null,
13382
14068
  addresses: [...iroh.addresses],
13383
14069
  ...iroh.relayed !== void 0 ? { relayed: iroh.relayed } : {}
13384
14070
  };
13385
14071
  const hyper = raw["hyperdht/1"];
13386
- if (hyper && typeof hyper === "object" && typeof hyper.publicKey === "string" && HEX_KEY.test(hyper.publicKey) && (hyper.relay === void 0 || relay(hyper.relay)) && relayed(hyper.relayed)) out["hyperdht/1"] = {
14072
+ if (hyper && typeof hyper === "object" && typeof hyper.publicKey === "string" && HEX_KEY.test(hyper.publicKey) && (hyper.relay === void 0 || relayUrl(hyper.relay)) && relayed(hyper.relayed)) out["hyperdht/1"] = {
13387
14073
  publicKey: hyper.publicKey,
13388
14074
  ...hyper.relay !== void 0 ? { relay: hyper.relay } : {},
13389
14075
  ...hyper.relayed !== void 0 ? { relayed: hyper.relayed } : {}
@@ -14085,7 +14771,7 @@ async function verifyPeerProof(event, c, readStorage) {
14085
14771
  if (sig.length !== 64 || !verify(sig, data, fromZ32(c.externalKey))) throw new Error("Invalid Pubky signature");
14086
14772
  } else if (c.adapter === "keet-import") {
14087
14773
  if (sig.length !== 107 || sig[0] !== 1 || sig[41] !== 0 || sig[42] !== 1) throw new Error("Unsupported Keet attestation");
14088
- const { default: IdentityKey } = await import("./keet-identity-key-BRKv78jp.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1));
14774
+ const { default: IdentityKey } = await import("./keet-identity-key-uq3scTiE.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1));
14089
14775
  if (!IdentityKey.verify(b4a.from(sig), b4a.from(data), { expectedIdentity: b4a.from(unhex(c.externalKey)) })) throw new Error("Invalid Keet attestation");
14090
14776
  } else throw new Error("Unsupported proof adapter");
14091
14777
  }
@@ -15121,12 +15807,12 @@ function capsDescriptors(descriptors) {
15121
15807
  const iroh = descriptors?.["iroh/1"];
15122
15808
  if (iroh && typeof iroh.id === "string" && HEX64$1.test(iroh.id)) out["iroh/1"] = {
15123
15809
  id: hexToKey(iroh.id),
15124
- ...typeof iroh.relay === "string" && RELAY_URL.test(iroh.relay) ? { relay: iroh.relay } : {}
15810
+ ...relayUrl(iroh.relay) ? { relay: iroh.relay } : {}
15125
15811
  };
15126
15812
  const hyper = descriptors?.["hyperdht/1"];
15127
15813
  if (hyper && typeof hyper.publicKey === "string" && HEX64$1.test(hyper.publicKey)) out["hyperdht/1"] = {
15128
15814
  publicKey: hexToKey(hyper.publicKey),
15129
- ...typeof hyper.relay === "string" && RELAY_URL.test(hyper.relay) ? { relay: hyper.relay } : {}
15815
+ ...relayUrl(hyper.relay) ? { relay: hyper.relay } : {}
15130
15816
  };
15131
15817
  return out;
15132
15818
  }
@@ -15160,16 +15846,17 @@ function parseDescriptors(value) {
15160
15846
  const raw = value;
15161
15847
  const out = {};
15162
15848
  const iroh = raw["iroh/1"], hyper = raw["hyperdht/1"];
15849
+ const withSecrets = (relay) => typeof relay === "string" && RELAY_WITH_SECRETS.test(relay);
15163
15850
  if (iroh !== void 0) {
15164
15851
  if (!iroh || typeof iroh.id !== "string" || !KEY.test(iroh.id) || iroh.relay !== void 0 && (typeof iroh.relay !== "string" || !RELAY_URL.test(iroh.relay))) return null;
15165
- out["iroh/1"] = {
15852
+ if (!withSecrets(iroh.relay)) out["iroh/1"] = {
15166
15853
  id: iroh.id,
15167
15854
  ...iroh.relay !== void 0 ? { relay: iroh.relay } : {}
15168
15855
  };
15169
15856
  }
15170
15857
  if (hyper !== void 0) {
15171
15858
  if (!hyper || typeof hyper.publicKey !== "string" || !KEY.test(hyper.publicKey) || hyper.relay !== void 0 && (typeof hyper.relay !== "string" || !RELAY_URL.test(hyper.relay))) return null;
15172
- out["hyperdht/1"] = {
15859
+ if (!withSecrets(hyper.relay)) out["hyperdht/1"] = {
15173
15860
  publicKey: hyper.publicKey,
15174
15861
  ...hyper.relay !== void 0 ? { relay: hyper.relay } : {}
15175
15862
  };
@@ -15441,17 +16128,23 @@ var CapsExchange = class {
15441
16128
  return;
15442
16129
  }
15443
16130
  if (due) {
16131
+ const options = changed || unpublished ? void 0 : { background: true };
16132
+ const held = this.options.transport.publishHeld?.(this.keys.identity.pubKeyZ32, options);
16133
+ if (held) {
16134
+ this.schedule(budgetRetryMs(held, 1e3, 6e4));
16135
+ throw held;
16136
+ }
15444
16137
  const rev = changed ? this.state.rev + 1 : this.state.rev;
15445
16138
  const { records, dropped } = this.keys.seal(content, rev, peerKey, now);
15446
16139
  this.dropped = dropped;
15447
- await this.persist({
16140
+ if (!(rev === this.state.rev && digest === this.state.digest && peerKey === this.state.sealedFor && this.state.publishedAt === void 0)) await this.persist({
15448
16141
  rev,
15449
16142
  digest,
15450
16143
  sealedFor: peerKey,
15451
16144
  publishedAt: void 0
15452
16145
  });
15453
16146
  try {
15454
- await this.options.transport.publish(this.keys.identity, records, changed || unpublished ? void 0 : { background: true });
16147
+ await this.options.transport.publish(this.keys.identity, records, options);
15455
16148
  } catch (error) {
15456
16149
  this.schedule(isDiscoveryBudgetError(error) ? budgetRetryMs(error, 1e3, 6e4) : 6e4);
15457
16150
  throw error;
@@ -15746,14 +16439,15 @@ function parseDomainTxt(value) {
15746
16439
  var addRecord = (list, r) => {
15747
16440
  if (!list.some((x) => x.key === r.key && x.proof === r.proof)) list.push(r);
15748
16441
  };
15749
- /** All records among the TXT strings of `_ghostly.<domain>`; other strings are skipped. */
16442
+ /** All records among the first 32 TXT strings of `_ghostly.<domain>`; other strings are skipped. A TXT set has
16443
+ * no order, so every record is kept: the one a proof needs may come in any position. */
15750
16444
  function recordsFromTxt(values) {
15751
16445
  const out = [];
15752
16446
  for (const value of values.slice(0, 32)) {
15753
16447
  const r = parseDomainTxt(value);
15754
16448
  if (r) addRecord(out, r);
15755
16449
  }
15756
- return out.slice(0, 8);
16450
+ return out;
15757
16451
  }
15758
16452
  /** The body of `/.well-known/ghostly.json`. */
15759
16453
  function domainWellKnownFile(records) {
@@ -15770,7 +16464,7 @@ function parseJson(text) {
15770
16464
  if (typeof text !== "string" || utf8Encode(text).length > 16384) throw new Error("File too large");
15771
16465
  return JSON.parse(text);
15772
16466
  }
15773
- /** Records from `ghostly.json`. Throws on a malformed file; [] when it names none. */
16467
+ /** Records from the first 32 entries of `ghostly.json`. Throws on a malformed file; [] when it names none. */
15774
16468
  function recordsFromWellKnown(text) {
15775
16469
  const body = parseJson(text);
15776
16470
  if (!body || typeof body !== "object" || Array.isArray(body) || body.ghostly !== 1 || !Array.isArray(body.proofs)) throw new Error("Not a Ghostly domain file");
@@ -15783,7 +16477,7 @@ function recordsFromWellKnown(text) {
15783
16477
  };
15784
16478
  if (validDomainRecord(r)) addRecord(out, r);
15785
16479
  }
15786
- return out.slice(0, 8);
16480
+ return out;
15787
16481
  }
15788
16482
  /** NIP-05: only the root name `_` speaks for the domain itself. Undefined when absent. */
15789
16483
  function nip05RootKey(text) {
@@ -15966,9 +16660,13 @@ var SIG$3 = /^[A-Za-z0-9_-]{86}$/;
15966
16660
  var MAGIC$1 = utf8Encode("GHLD");
15967
16661
  var VERSION = 1;
15968
16662
  var NONCE$2 = 24;
16663
+ /** A bundle sealed by the chat's ratchet (WISP 4xx § Held items). */
16664
+ var RATCHETED = 2;
15969
16665
  /** Why a bundle, manifest or pointer was refused. Never a reason to trust it a little. */
15970
16666
  var HoldRefusedError = class extends Error {
15971
16667
  reason;
16668
+ /** The bytes the chat's ratchet opened, when it opened them before the item was refused: the caller commits them. */
16669
+ ratcheted;
15972
16670
  constructor(reason, message) {
15973
16671
  super(message);
15974
16672
  this.reason = reason;
@@ -16008,6 +16706,19 @@ var HoldKeys = class {
16008
16706
  }
16009
16707
  /** Seals one item for the contact: signed with my participation key, encrypted to our shared key. */
16010
16708
  seal(item, body) {
16709
+ const nonce = randomBytes(NONCE$2);
16710
+ const box = xsalsa20poly1305(this.sealKey, nonce).encrypt(this.inner(item, body));
16711
+ return concatBytes(MAGIC$1, new Uint8Array([VERSION]), nonce, box);
16712
+ }
16713
+ /**
16714
+ * The same item as a version-2 bundle (WISP 4xx § Held items): the same plaintext, sealed by the chat's ratchet
16715
+ * (`seal`, which saves the ratchet's state before it returns), so the bundle can be uploaded once this returns.
16716
+ */
16717
+ async sealRatcheted(item, body, seal) {
16718
+ return concatBytes(MAGIC$1, new Uint8Array([RATCHETED]), await seal(this.inner(item, body)));
16719
+ }
16720
+ /** What a bundle seals: the header's length, the signed header, the body. */
16721
+ inner(item, body) {
16011
16722
  const fields = [
16012
16723
  VERSION,
16013
16724
  this.from,
@@ -16027,26 +16738,51 @@ var HoldKeys = class {
16027
16738
  const header = utf8Encode(JSON.stringify([fields, signature]));
16028
16739
  const length = /* @__PURE__ */ new Uint8Array(4);
16029
16740
  new DataView(length.buffer).setUint32(0, header.length);
16030
- const nonce = randomBytes(NONCE$2);
16031
- const box = xsalsa20poly1305(this.sealKey, nonce).encrypt(concatBytes(length, header, body));
16032
- return concatBytes(MAGIC$1, new Uint8Array([VERSION]), nonce, box);
16741
+ return concatBytes(length, header, body);
16033
16742
  }
16034
16743
  /**
16035
16744
  * Opens a bundle the contact sealed for me. Everything is checked before anything is returned: the
16036
16745
  * authenticated encryption, the header's shape, that it names this link, this contact and me, the
16037
16746
  * signature, the body digest and the limits of its kind. `loopback`: see `isHoldUrl`.
16038
16747
  */
16748
+ /**
16749
+ * `ratchet`: opens a version-2 bundle's sealed bytes (WISP 4xx), without keeping anything; absent, one is from a newer
16750
+ * Ghostly. `refusePlain`: a ratcheted item from this contact opened here, so a version-1 item other than the manifest is
16751
+ * refused (WISP 4xx § Downgrade). `ratcheted` in the result: the bytes the ratchet opened, for the caller to commit once
16752
+ * the item is stored.
16753
+ */
16039
16754
  open(bytes, expect = {}) {
16040
16755
  const now = expect.now ?? Date.now();
16041
16756
  if (bytes.length > (expect.maxBytes ?? HOLD_LIMITS.maxBundleBytes)) throw new HoldRefusedError("size", "The held item is larger than allowed");
16042
- if (bytes.length < MAGIC$1.length + 1 + NONCE$2 + 16 + 4 || !MAGIC$1.every((b, i) => bytes[i] === b)) throw new HoldRefusedError("format", "Not a held item");
16043
- if (bytes[MAGIC$1.length] !== VERSION) throw new HoldRefusedError("format", "Held item from a newer Ghostly");
16044
- let plain;
16757
+ 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");
16758
+ const version = bytes[MAGIC$1.length];
16759
+ if (version !== VERSION && (version !== RATCHETED || !expect.ratchet)) throw new HoldRefusedError("format", "Held item from a newer Ghostly");
16760
+ let plain, ratcheted;
16761
+ if (version === RATCHETED) {
16762
+ ratcheted = bytes.subarray(MAGIC$1.length + 1);
16763
+ try {
16764
+ plain = expect.ratchet(ratcheted);
16765
+ } catch {
16766
+ plain = null;
16767
+ }
16768
+ if (!plain) throw new HoldRefusedError("tampered", "The held item was changed, is not for this chat, or was opened already");
16769
+ } else {
16770
+ if (bytes.length < MAGIC$1.length + 1 + NONCE$2 + 16 + 4) throw new HoldRefusedError("format", "Not a held item");
16771
+ try {
16772
+ 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));
16773
+ } catch {
16774
+ throw new HoldRefusedError("tampered", "The held item was changed or is not for this chat");
16775
+ }
16776
+ }
16045
16777
  try {
16046
- 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));
16047
- } catch {
16048
- throw new HoldRefusedError("tampered", "The held item was changed or is not for this chat");
16778
+ return this.read(plain, ratcheted, expect, now);
16779
+ } catch (error) {
16780
+ if (error instanceof HoldRefusedError && ratcheted) error.ratcheted = ratcheted;
16781
+ throw error;
16049
16782
  }
16783
+ }
16784
+ /** The checks of `open` once the bundle is decrypted. */
16785
+ read(plain, ratcheted, expect, now) {
16050
16786
  if (plain.length < 4) throw new HoldRefusedError("format", "Not a held item");
16051
16787
  const headerLength = new DataView(plain.buffer, plain.byteOffset, 4).getUint32(0);
16052
16788
  if (headerLength > 131072 || 4 + headerLength > plain.length) throw new HoldRefusedError("format", "Not a held item");
@@ -16088,10 +16824,12 @@ var HoldKeys = class {
16088
16824
  digest,
16089
16825
  expires
16090
16826
  };
16827
+ if (!ratcheted && expect.refusePlain && kind !== "manifest") throw new HoldRefusedError("plain", "The held item was sealed without forward secrecy, which this chat no longer takes");
16091
16828
  checkKind(header, body, expect.loopback);
16092
16829
  return {
16093
16830
  header,
16094
- body
16831
+ body,
16832
+ ...ratcheted && { ratcheted }
16095
16833
  };
16096
16834
  }
16097
16835
  /** My pointer, as records to publish under `identity`. Throws when it cannot fit a packet. */
@@ -18339,8 +19077,20 @@ var FILE_LIMITS = {
18339
19077
  stallMs: 6e4,
18340
19078
  /** A receiver makes what it stored durable, and records the point to resume from, this often. */
18341
19079
  checkpointBytes: 8388608,
18342
- /** A receiver confirms at least this often while writing. */
19080
+ /**
19081
+ * A receiver confirms at least this often while writing, and the file's last bytes at once. Its writes are buffered
19082
+ * and done at once, so confirming whenever they were all done too was confirming nearly every chunk: 6,400 confirms for
19083
+ * 100 MiB, each a native call and a progress update on both sides. A host that batches them (`batchConfirms`) does not.
19084
+ */
18343
19085
  ackEveryBytes: 131072,
19086
+ /**
19087
+ * Batched (`ChatFilesHost.batchConfirms`), bytes stored and not confirmed are confirmed this long after the first of
19088
+ * them was stored, at most. What a sender has in flight may be no more than `ackEveryBytes` (a window at its floor, one
19089
+ * chunk while the path is measured), and bytes waiting here for a confirm are bytes it cannot send: on a slow or
19090
+ * wavering path a confirm comes about every this long, as fast as the window needs. A round trip it measures is up to
19091
+ * this much longer, well inside the queue it allows (`queueMs`).
19092
+ */
19093
+ ackWaitMs: 10,
18344
19094
  /** A sender reads its file this much at a time. */
18345
19095
  readBytes: 1048576,
18346
19096
  /** The session refused a data frame (its send budget was full): the sender looks again after this long. */
@@ -18374,6 +19124,15 @@ var FINAL = /* @__PURE__ */ new Set([
18374
19124
  ]);
18375
19125
  var transferEnded = (record) => FINAL.has(record.state);
18376
19126
  /**
19127
+ * Whether a file sent from here arrived whole (the receiver confirmed every byte, and may be checking it): too late
19128
+ * for its person to cancel. The receiver's check comes before a `pf-abort` behind it, so it would keep the file while
19129
+ * the sender said it was cancelled. Not once the receiver asks about it again (`asking`), nor paused here.
19130
+ */
19131
+ function sentWhole(record) {
19132
+ if (record.direction !== "out" || transferEnded(record)) return false;
19133
+ return record.state === "verifying" || record.file.size > 0 && record.confirmed === record.file.size && record.state !== "asking" && record.state !== "paused";
19134
+ }
19135
+ /**
18377
19136
  * Whether an unfinished transfer is stuck, so its person is offered to push it: "Send again" (sending) or "Ask again"
18378
19137
  * (receiving). `movedAt` is when its bytes last moved, `restored` that it has not moved since the app started. What
18379
19138
  * waits for a person (an answer, a pause) is not stuck, and a failed one has its own "Retry".
@@ -18668,6 +19427,13 @@ var ChatFiles = class {
18668
19427
  peerRoomValue = null;
18669
19428
  /** What the chat's files may have in flight, sized by the path. */
18670
19429
  pace = new FilePace();
19430
+ /**
19431
+ * What the chat's files had in flight just before the last confirm. A receiver confirms many chunks at once
19432
+ * (`ackEveryBytes`), and the chunks sent for them go with that much in flight, the window: counted one by one, the
19433
+ * first went with the window less a confirm, and read as a path carrying that little, it shrank the window and ended
19434
+ * every trial of a larger one (a fifth of the rate on a wavering path). Confirmed chunk by chunk, it is what each sends with.
19435
+ */
19436
+ refill = 0;
18671
19437
  constructor(host) {
18672
19438
  this.host = host;
18673
19439
  }
@@ -18752,6 +19518,7 @@ var ChatFiles = class {
18752
19518
  this.attached = true;
18753
19519
  this.peerRoomValue = null;
18754
19520
  this.pace.reset();
19521
+ this.refill = 0;
18755
19522
  this.host.uplink?.join(this);
18756
19523
  this.sayRoom();
18757
19524
  this.sweep();
@@ -18765,6 +19532,11 @@ var ChatFiles = class {
18765
19532
  id: entry.record.id,
18766
19533
  offset: entry.in.written
18767
19534
  });
19535
+ else if (entry.record.state === "asking") this.send({
19536
+ t: "pf-wait",
19537
+ id: entry.record.id,
19538
+ why: "consent"
19539
+ });
18768
19540
  }
18769
19541
  }
18770
19542
  /** The session went: nothing moves until the next one. What was received is made durable. */
@@ -18782,7 +19554,11 @@ var ChatFiles = class {
18782
19554
  clearTimeout(entry.out.wake);
18783
19555
  entry.out.next = entry.record.confirmed;
18784
19556
  }
18785
- if (entry.in) clearTimeout(entry.in.timer);
19557
+ if (entry.in) {
19558
+ clearTimeout(entry.in.timer);
19559
+ clearTimeout(entry.in.ackTimer);
19560
+ entry.in.ackTimer = void 0;
19561
+ }
18786
19562
  if (entry.in && !transferEnded(entry.record)) this.checkpoint(entry);
18787
19563
  }
18788
19564
  }
@@ -18802,10 +19578,13 @@ var ChatFiles = class {
18802
19578
  ].includes(record.state) || record.since + FILE_LIMITS.offerTtlMs > now) continue;
18803
19579
  if (record.direction === "in" && record.state === "queued" && (entry.in?.starting || this.moved(entry) > 0)) continue;
18804
19580
  this.end(entry, "failed", record.direction === "in" ? "The offer expired" : record.state === "queued" ? "Not delivered in time" : "Not accepted in time");
18805
- if (record.direction === "in") this.send({
19581
+ this.send(record.direction === "in" ? {
18806
19582
  t: "pf-refuse",
18807
19583
  id: record.id,
18808
19584
  why: "expired"
19585
+ } : {
19586
+ t: "pf-abort",
19587
+ id: record.id
18809
19588
  });
18810
19589
  }
18811
19590
  }
@@ -18973,7 +19752,7 @@ var ChatFiles = class {
18973
19752
  out.sends.push({
18974
19753
  end: out.next,
18975
19754
  at: this.now(),
18976
- flight: this.inFlight(),
19755
+ flight: Math.max(this.inFlight(), Math.min(this.refill, this.pace.limit(this.floor()))),
18977
19756
  generation
18978
19757
  });
18979
19758
  }
@@ -19322,6 +20101,7 @@ var ChatFiles = class {
19322
20101
  /** An agreed file that ended here, offered again: taken again from the start. */
19323
20102
  async retake(entry) {
19324
20103
  await entry.in?.target?.then((t) => t.discard()).catch(() => {});
20104
+ clearTimeout(entry.in?.ackTimer);
19325
20105
  entry.in = {
19326
20106
  written: 0,
19327
20107
  stored: 0,
@@ -19374,15 +20154,8 @@ var ChatFiles = class {
19374
20154
  if (transferEnded(record) || incoming.dropped) return;
19375
20155
  await (await target).append(bytes);
19376
20156
  incoming.stored = offset + bytes.length;
19377
- if (incoming.stored === incoming.written || incoming.stored - incoming.acked >= FILE_LIMITS.ackEveryBytes) {
19378
- incoming.acked = incoming.stored;
19379
- this.send({
19380
- t: "pf-got",
19381
- id: record.id,
19382
- offset: incoming.stored
19383
- });
19384
- this.changed(entry, true);
19385
- }
20157
+ if (incoming.stored - incoming.acked >= FILE_LIMITS.ackEveryBytes || incoming.stored === record.file.size || !this.host.batchConfirms && incoming.stored === incoming.written) this.confirm(entry);
20158
+ else if (this.host.batchConfirms) incoming.ackTimer ??= setTimeout(() => this.confirm(entry), FILE_LIMITS.ackWaitMs);
19386
20159
  if (incoming.stored - incoming.checkpointed >= FILE_LIMITS.checkpointBytes) await this.checkpointNow(entry);
19387
20160
  }).catch((error) => {
19388
20161
  if (transferEnded(record)) return;
@@ -19396,6 +20169,20 @@ var ChatFiles = class {
19396
20169
  this.startNext();
19397
20170
  });
19398
20171
  }
20172
+ /** `pf-got` for what is stored and not confirmed yet. */
20173
+ confirm(entry) {
20174
+ const { record } = entry, incoming = entry.in;
20175
+ clearTimeout(incoming.ackTimer);
20176
+ incoming.ackTimer = void 0;
20177
+ if (transferEnded(record) || incoming.stored <= incoming.acked) return;
20178
+ incoming.acked = incoming.stored;
20179
+ this.send({
20180
+ t: "pf-got",
20181
+ id: record.id,
20182
+ offset: incoming.stored
20183
+ });
20184
+ this.changed(entry, true);
20185
+ }
19399
20186
  /** What was stored is durable, and a restart resumes from there. */
19400
20187
  async checkpoint(entry) {
19401
20188
  if (!entry.in?.target) return;
@@ -19543,7 +20330,8 @@ var ChatFiles = class {
19543
20330
  return;
19544
20331
  }
19545
20332
  if (!outgoing || transferEnded(outgoing.record)) {
19546
- if (outgoing?.record.state === "cancelled" && frame.t !== "pf-refuse") this.send({
20333
+ const asked = frame.t === "pf-accept" || frame.t === "pf-wait";
20334
+ if (outgoing?.record.state === "cancelled" ? frame.t !== "pf-refuse" : asked && outgoing?.record.state !== "done") this.send({
19547
20335
  t: "pf-abort",
19548
20336
  id
19549
20337
  });
@@ -19560,6 +20348,7 @@ var ChatFiles = class {
19560
20348
  out.generation++;
19561
20349
  record.confirmed = frame.offset;
19562
20350
  out.next = frame.offset;
20351
+ this.refill = 0;
19563
20352
  record.state = "active";
19564
20353
  record.pausedBy = record.waitingFor = void 0;
19565
20354
  this.changed(outgoing);
@@ -19587,6 +20376,7 @@ var ChatFiles = class {
19587
20376
  return;
19588
20377
  case "pf-got": {
19589
20378
  if (!isInt$1(frame.offset) || frame.offset <= record.confirmed || frame.offset > out.next) return;
20379
+ this.refill = this.inFlight();
19590
20380
  this.pace.delivered += frame.offset - record.confirmed;
19591
20381
  record.confirmed = frame.offset;
19592
20382
  let sample;
@@ -19631,6 +20421,8 @@ var ChatFiles = class {
19631
20421
  if (entry.in) {
19632
20422
  const incoming = entry.in;
19633
20423
  clearTimeout(incoming.timer);
20424
+ clearTimeout(incoming.ackTimer);
20425
+ incoming.ackTimer = void 0;
19634
20426
  incoming.writing.finally(() => {
19635
20427
  if (transferEnded(record)) incoming.target = void 0;
19636
20428
  });
@@ -20385,6 +21177,8 @@ var CarriedTransport = class {
20385
21177
  seen = -1n;
20386
21178
  /** A read under way: resolved when a carried packet comes meanwhile. */
20387
21179
  waiting = null;
21180
+ /** The records of a publish refused before they were signed, while nobody could carry them: signed when one can (`latest`). */
21181
+ unsigned = null;
20388
21182
  /** The packet the relays have not got yet. */
20389
21183
  pending = null;
20390
21184
  /** How many carried packets of the member's came: a deferral that ends with none more says no member reaches it. */
@@ -20417,6 +21211,7 @@ var CarriedTransport = class {
20417
21211
  async publish(identity, records, options) {
20418
21212
  if (this.stopped || identity.pubKeyZ32 !== this.myKey) return this.inner.publish(identity, records, options);
20419
21213
  this.drop();
21214
+ this.unsigned = null;
20420
21215
  if (this.hooks.open()) {
20421
21216
  const relayOptions = options?.signal ? options : {
20422
21217
  ...options,
@@ -20430,6 +21225,16 @@ var CarriedTransport = class {
20430
21225
  if (this.hooks.direct && this.inner.publishPayload) published.then(() => this.handDirect(payload), () => {});
20431
21226
  return published;
20432
21227
  }
21228
+ if (this.hooks.canCarry && !this.hooks.canCarry()) {
21229
+ const held = this.inner.publishHeld?.(identity.pubKeyZ32, options);
21230
+ if (held) {
21231
+ this.unsigned = {
21232
+ identity,
21233
+ records
21234
+ };
21235
+ throw held;
21236
+ }
21237
+ }
20433
21238
  const payload = this.newest = this.stamp(identity, records);
20434
21239
  this.mine = payload;
20435
21240
  let carried = {
@@ -20596,13 +21401,20 @@ var CarriedTransport = class {
20596
21401
  }
20597
21402
  /** My newest packet for this edge while it is down, for a member that can pass it on now; null once it is up. */
20598
21403
  latest() {
20599
- return this.stopped || this.hooks.open() ? null : this.mine;
21404
+ if (this.stopped || this.hooks.open()) return null;
21405
+ if (this.unsigned) {
21406
+ const { identity, records } = this.unsigned;
21407
+ this.unsigned = null;
21408
+ this.mine = this.newest = this.stamp(identity, records);
21409
+ }
21410
+ return this.mine;
20600
21411
  }
20601
21412
  /** The edge is going: nothing more is deferred or carried, and a last packet goes straight to the relays. */
20602
21413
  stop() {
20603
21414
  this.stopped = true;
20604
21415
  this.drop();
20605
21416
  this.mine = null;
21417
+ this.unsigned = null;
20606
21418
  const waiting = this.waiting;
20607
21419
  this.waiting = null;
20608
21420
  waiting?.();
@@ -20950,7 +21762,8 @@ var PairingTracker = class {
20950
21762
  * none of these (a mint's own words, a provider's) stays as it is.
20951
21763
  *
20952
21764
  * `{name}` in a template is a value: a host or domain (no spaces), a network ("Mainnet" or "Testnet"), a chain's name,
20953
- * an ecash unit ("usd"), or an amount (digits, with the separators of whatever locale wrote it).
21765
+ * an ecash unit ("usd"), an amount (digits, with the separators of whatever locale wrote it), or a server's own `{reason}`
21766
+ * (one line, last in its text).
20954
21767
  */
20955
21768
  var ENGINE_ERRORS = {
20956
21769
  mintUnreachable: "Could not reach {host}. Check the address: it should be a Cashu mint.",
@@ -20967,13 +21780,16 @@ var ENGINE_ERRORS = {
20967
21780
  mintNotHttps: "Mints must use https",
20968
21781
  notEnoughSats: "Not enough sats in your wallet",
20969
21782
  notEnoughForFee: "Not enough sats in your wallet: {amount} sats leave room for the fee",
21783
+ mintsNoAnyAmount: "None of your mints can pay an invoice with no amount",
20970
21784
  noSharedMint: "You share no mint with this contact",
20971
21785
  ecashAlreadySpent: "This ecash was already spent somewhere else",
20972
21786
  ecashBeingReceived: "This ecash is already being received",
21787
+ 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",
20973
21788
  ecashOtherUnit: "This ecash is in {unit}: only sat ecash can be redeemed here",
20974
21789
  reviewedEcashSpent: "The ecash for this payment was already spent somewhere else. Nothing was sent, and your balance now shows what the mint still holds.",
20975
21790
  reviewedSatsGone: "The sats this payment was reviewed with went to another payment. Nothing was sent: review it again.",
20976
21791
  lightningFeeTooHigh: "The Lightning fee ({fee} sats) is too high",
21792
+ lightningRefused: "The mint refused this Lightning payment, and no sats left your wallet: it is safe to try again. The mint said: {reason}",
20977
21793
  invoiceExpired: "That invoice has expired",
20978
21794
  lnurlExactly: "{domain} asks for exactly {amount} sats",
20979
21795
  lnurlRange: "{domain} takes between {min} and {max} sats",
@@ -21751,6 +22567,7 @@ var GhostLink = class {
21751
22567
  peerCapsRev: options.dht.peerCapsRev,
21752
22568
  peerAcceptsText: options.dht.peerAcceptsText,
21753
22569
  peerAcceptsFile: options.dht.peerAcceptsFile,
22570
+ ...options.dht.ratchet && { ratchet: options.dht.ratchet },
21754
22571
  ...options.reactionsSupport && {
21755
22572
  reactions: options.dht.reactions,
21756
22573
  reaction: async (reaction) => {
@@ -21840,6 +22657,7 @@ var GhostLink = class {
21840
22657
  pollIntervals: options.pollIntervals,
21841
22658
  awaitingSince: options.madeAt,
21842
22659
  ...backsOff && { invite: () => !options.pairing.credentials.peerKey || !!this.dht?.unanswered },
22660
+ ...invite && { ownInvite: () => !options.pairing.credentials.peerKey && !options.pairing.credentials.expectedPeerKey },
21843
22661
  getServices: options.getServices,
21844
22662
  firstPublish: options.firstPublish ?? (this.tracker && options.pairingProgress?.role === "joiner" && options.rtcAvailable !== false || this.resuming ? "after-first-poll" : "at-start"),
21845
22663
  resumed: !!this.resuming,
@@ -22852,6 +23670,9 @@ var GhostLink = class {
22852
23670
  this.advertiseTransports();
22853
23671
  this.options.events?.onTransportsChanged?.();
22854
23672
  };
23673
+ endpoint.onRelayBack = () => {
23674
+ if (this.endpoints.get(endpoint.transport) === endpoint) this.knockAgain(endpoint.transport);
23675
+ };
22855
23676
  this.advertiseTransports();
22856
23677
  if (this.resuming === endpoint.transport) this.knock(endpoint.transport);
22857
23678
  else this.joinRace(endpoint.transport);
@@ -23029,6 +23850,11 @@ var GhostLink = class {
23029
23850
  if (!this.transportOffer().includes(transport)) return;
23030
23851
  const epoch = this.connectionEpoch;
23031
23852
  this.dialing = true;
23853
+ const knocking = this.knocking = {
23854
+ transport,
23855
+ epoch,
23856
+ again: false
23857
+ };
23032
23858
  traceLink(this.myPubKeyZ32, "knock", { transport });
23033
23859
  try {
23034
23860
  const { channel, binding } = await endpoint.connect(descriptor);
@@ -23043,6 +23869,7 @@ var GhostLink = class {
23043
23869
  error: error instanceof Error ? error.message : String(error)
23044
23870
  });
23045
23871
  } finally {
23872
+ if (this.knocking === knocking) this.knocking = null;
23046
23873
  if (epoch === this.connectionEpoch) {
23047
23874
  this.dialing = false;
23048
23875
  this.settleCrossed();
@@ -23050,6 +23877,36 @@ var GhostLink = class {
23050
23877
  }
23051
23878
  if (!this.channel) this.maybeAutoConnect(this.presence);
23052
23879
  }
23880
+ /** The knock under way (`knock`): its transport, its attempt, and whether it was knocked again (`knockAgain`). */
23881
+ knocking = null;
23882
+ /**
23883
+ * The endpoint of a knock still under way is back on its relay (`NativeEndpoint.onRelayBack`): it is knocked again, once,
23884
+ * beside the first, and the first live wins. An Android phone back from Doze knocked at once through an Iroh whose relay
23885
+ * was gone; Iroh found it again only seconds later (its reconnect backoff, up to 16 s), and what the knock sent meanwhile
23886
+ * went nowhere: QUIC sends it again seconds on, and the dial is given 20 s. Live again 4.4 s and 9.8 s after the
23887
+ * return (away 5 and 15 minutes), and once not over Iroh at all (the emulator with a CLI bot, 2026-11-01).
23888
+ */
23889
+ async knockAgain(transport) {
23890
+ const knocking = this.knocking;
23891
+ if (!knocking || knocking.transport !== transport || knocking.again || knocking.epoch !== this.connectionEpoch) return;
23892
+ const endpoint = this.endpoints.get(transport), descriptor = this.peerDescriptors[transport];
23893
+ if (!endpoint || !descriptor || this.channel || this.stopped || this.streamBlocked || this.keyStopped) return;
23894
+ knocking.again = true;
23895
+ traceLink(this.myPubKeyZ32, "knock-again", { transport });
23896
+ try {
23897
+ const { channel, binding } = await endpoint.connect(descriptor);
23898
+ if (this.stopped || knocking.epoch !== this.connectionEpoch || this.channel) {
23899
+ channel.close();
23900
+ return;
23901
+ }
23902
+ this.attach(channel, binding);
23903
+ } catch (error) {
23904
+ traceLink(this.myPubKeyZ32, "knock-again-failed", {
23905
+ transport,
23906
+ error: error instanceof Error ? error.message : String(error)
23907
+ });
23908
+ }
23909
+ }
23053
23910
  canReleaseEndpoint(transport) {
23054
23911
  return this.activeBinding?.transport !== transport && this.candidate?.binding?.transport !== transport && !this.dialing && !this.switcher.pending && !this.transitionTarget;
23055
23912
  }
@@ -23685,6 +24542,10 @@ var GhostLink = class {
23685
24542
  get liveAttempt() {
23686
24543
  return this.isDataLinkOpen ? void 0 : this.lastAttempt;
23687
24544
  }
24545
+ /** Automatic dials since the link was last live or its wait started over (`wake`), the one under way included. */
24546
+ get dialAttempts() {
24547
+ return this.autoConnectFailures;
24548
+ }
23688
24549
  /**
23689
24550
  * Which side dials this chat to go live: the lower rendezvous key, or the joiner of a first pairing (WISP 100). The
23690
24551
  * other side answers, so what it can tell of a failed attempt is only what reached it.
@@ -25302,6 +26163,7 @@ var GhostLink = class {
25302
26163
  if (oldChannel) this.retire(oldChannel, () => {
25303
26164
  if (oldRtc && this.activeBinding && this.dataLink.connection === oldRtc) this.dataLink.close();
25304
26165
  }, !oldBinding);
26166
+ if (migration.plan && binding && oldBinding && WEBRTC_ATTEMPT.has(this.dataLink.state)) this.dataLink.close();
25305
26167
  this.session.setDataLinkOpen(true);
25306
26168
  if (migration.plan) switched = {
25307
26169
  from,
@@ -30704,16 +31566,10 @@ var GroupSession = class {
30704
31566
  /** Set while a save of what received messages changed is due (`persistSoon`). */
30705
31567
  saveTimer;
30706
31568
  /**
30707
- * The frames of members who left that each member was handed (`frameKey`), so an app that does not take them (from
30708
- * before revision 2026-10-13, and never marks them seen) is not handed them again at every sync. In memory only.
31569
+ * The removals of authors out of the roster that each member was handed (`editKey`), so an app that does not take
31570
+ * them is not handed them again at every sync. In memory only.
30709
31571
  */
30710
31572
  leaversHanded = /* @__PURE__ */ new Map();
30711
- /**
30712
- * The frames a commit took out of the logs (`pruneRelay`), newest last, and whether the app holds them with its
30713
- * messages: a removal's `left` mark can come after its commit, and what the leaver wrote is then kept again
30714
- * (`unprune`). In memory only: started again, the app's rows bring theirs back.
30715
- */
30716
- pruned = [];
30717
31573
  /** Syncs answered per member, a few a minute (`GROUP_LIMITS.syncAnswers`). In memory only. */
30718
31574
  syncsAnswered = /* @__PURE__ */ new Map();
30719
31575
  /**
@@ -30727,6 +31583,8 @@ var GroupSession = class {
30727
31583
  * message written just now. Each frame of the answer keeps it open: it goes a slice at a time. In memory only.
30728
31584
  */
30729
31585
  answering = /* @__PURE__ */ new Map();
31586
+ /** Per member ahead of me: the epoch its last sync said, up to which its answer to mine brings the chain. In memory only. */
31587
+ syncedEpoch = /* @__PURE__ */ new Map();
30730
31588
  /** Catch-up answers still going out, a slice at a time (`handOut`). */
30731
31589
  answers;
30732
31590
  /**
@@ -30749,20 +31607,20 @@ var GroupSession = class {
30749
31607
  if (onRows) {
30750
31608
  const held = new Set(onRows.map(frameKey$1));
30751
31609
  if (state.relay?.length) state.relay = state.relay.filter((f) => !held.has(frameKey$1(f)));
30752
- this.onRows = state.status === "active" ? onRows.filter((f) => this.handsOn(f.s, f.e)) : [];
31610
+ this.onRows = state.status === "active" ? onRows.filter((f) => this.handsOn(f.s)) : [];
30753
31611
  this.trimRelay();
30754
31612
  }
30755
31613
  this.answers = new CatchUpAnswers({
30756
31614
  send: (to, frame) => {
30757
- if ((frame.t === "group-msg" || frame.t === "group-edit") && !rosterHas(this.roster, frame.s)) {
31615
+ if (frame.t === "group-edit" && !rosterHas(this.roster, frame.s)) {
30758
31616
  const handed = this.leaversHanded.get(to) ?? /* @__PURE__ */ new Set();
30759
- this.leaversHanded.set(to, handed.add(frame.t === "group-edit" ? editKey(frame) : frameKey$1(frame)));
31617
+ this.leaversHanded.set(to, handed.add(editKey(frame)));
30760
31618
  }
30761
31619
  return hooks.send(to, frame);
30762
31620
  },
30763
31621
  ...hooks.handled && { handled: (to) => hooks.handled(to) },
30764
31622
  active: () => this.state.status === "active",
30765
- key: (frame) => frame.t === "group-msg" ? frameKey$1(frame) : void 0
31623
+ key: (frame) => frame.t === "group-msg" ? frameKey$1(frame) : frame.t === "group-commit" ? `commit:${frame.commit.e}` : void 0
30766
31624
  });
30767
31625
  this.provisional = new Set((state.provisional ?? []).slice(-GROUP_LIMITS.provisional));
30768
31626
  this.chainMovedAt = this.clock();
@@ -31051,8 +31909,9 @@ var GroupSession = class {
31051
31909
  return this.hooks.save(structuredClone(this.state));
31052
31910
  }
31053
31911
  /**
31054
- * A save within `GROUP_LIMITS.saveWithinMs`, for what a received message changes (what was seen, what is kept to hand
31055
- * on): the state holds the whole hand-on log, and a member back in a busy group wrote all of it once per message.
31912
+ * A save within `GROUP_LIMITS.saveWithinMs`, for what a received message, commit or secret changes (what was seen,
31913
+ * what is kept to hand on, the chain): the state holds the whole hand-on log and chain, and a member back in a busy
31914
+ * group wrote all of it once per message, and once per commit.
31056
31915
  * The message itself is stored before (`hooks.message`). An app killed before the save takes those frames again when
31057
31916
  * it syncs: its store has the messages already, and the state then catches up.
31058
31917
  */
@@ -31160,7 +32019,7 @@ var GroupSession = class {
31160
32019
  }
31161
32020
  transferAdmin(memberKey, now = Date.now()) {
31162
32021
  return this.serialize(async () => {
31163
- this.requireAdmin();
32022
+ this.requireAdmin("Only the admin can hand the admin role over");
31164
32023
  if (!rosterHas(this.roster, memberKey) || memberKey === this.myKey) throw new Error("Not a member");
31165
32024
  await this.commit("role", memberKey, now);
31166
32025
  });
@@ -31221,18 +32080,10 @@ var GroupSession = class {
31221
32080
  this.hooks.changed();
31222
32081
  return { secret };
31223
32082
  }
31224
- /**
31225
- * Someone removed is not handed on any more, whatever they sent while in the roster; one who left still is, for the
31226
- * epochs before its leave (WISP 902 § Catch-up).
31227
- */
32083
+ /** Someone removed or gone is not handed on any more, whatever they sent while in the roster (WISP 902 § Catch-up). */
31228
32084
  pruneRelay() {
31229
- const prune = (log, row) => log.filter((f) => this.handsOn(f.s, f.e) || (this.pruned.push({
31230
- frame: f,
31231
- row
31232
- }), false));
31233
- if (this.state.relay?.length) this.state.relay = prune(this.state.relay, false);
31234
- if (this.onRows?.length) this.onRows = prune(this.onRows, true);
31235
- this.pruned.splice(0, this.pruned.length - GROUP_LIMITS.relay);
32085
+ if (this.state.relay?.length) this.state.relay = this.state.relay.filter((f) => this.handsOn(f.s));
32086
+ if (this.onRows?.length) this.onRows = this.onRows.filter((f) => this.handsOn(f.s));
31236
32087
  if (this.state.relayEdits?.length) this.state.relayEdits = this.state.relayEdits.filter((f) => rosterHas(this.roster, f.s) || this.isRemovalEdit(f));
31237
32088
  }
31238
32089
  /** Whether a kept edit is a removal (WISP 400 § Delete for everyone): its box, under its epoch's key, says `rm`. */
@@ -31246,18 +32097,6 @@ var GroupSession = class {
31246
32097
  return false;
31247
32098
  }
31248
32099
  }
31249
- /** The frames `pruneRelay` dropped that are handed on again now (a removal's `left` mark came after it), back in their logs. */
31250
- unprune() {
31251
- const back = this.pruned.filter((p) => this.handsOn(p.frame.s, p.frame.e));
31252
- if (!back.length) return;
31253
- this.pruned = this.pruned.filter((p) => !back.includes(p));
31254
- for (const { frame, row } of back) {
31255
- const log = row && this.onRows ? this.onRows : this.state.relay ??= [];
31256
- const at = log.findIndex((f) => f.ts > frame.ts);
31257
- log.splice(at < 0 ? log.length : at, 0, frame);
31258
- }
31259
- this.trimRelay();
31260
- }
31261
32100
  /** Another member's edit, kept to hand on: the latest per message; the oldest go once the log is full. False: one as new was kept. */
31262
32101
  keepEdit(frame) {
31263
32102
  const same = (f) => f.s === frame.s && f.e === frame.e && f.n === frame.n;
@@ -31322,7 +32161,6 @@ var GroupSession = class {
31322
32161
  this.state.sent = [];
31323
32162
  this.state.relay = [];
31324
32163
  if (this.onRows) this.onRows = [];
31325
- this.pruned = [];
31326
32164
  this.state.relayEdits = [];
31327
32165
  this.state.alone = [];
31328
32166
  this.waiting = [];
@@ -31825,8 +32663,8 @@ var GroupSession = class {
31825
32663
  }
31826
32664
  /**
31827
32665
  * A message, from its author's edge or handed on by another member. Handed on, it is taken only while both are in
31828
- * the roster (someone removed is neither heard from nor handed on, #300), or from a member in it when its author left
31829
- * after it (`handsOn`), and its boxes only with the author's `xs`.
32666
+ * the roster (someone removed or gone is neither heard from nor handed on, #300, `handsOn`), and its boxes only with
32667
+ * the author's `xs`.
31830
32668
  */
31831
32669
  async receiveMessage(from, raw, waited = false) {
31832
32670
  if (!isMessageFrame$1(raw)) return;
@@ -31837,7 +32675,7 @@ var GroupSession = class {
31837
32675
  const relayed = raw.s !== from;
31838
32676
  const now = this.now(), answer = (this.answering.get(from) ?? 0) > now;
31839
32677
  if (answer) this.answering.set(from, now + ANSWER_WINDOW_MS);
31840
- if (relayed && (!rosterHas(this.roster, from) || !this.handsOn(raw.s, raw.e))) return;
32678
+ if (relayed && (!rosterHas(this.roster, from) || !this.handsOn(raw.s))) return;
31841
32679
  if (this.isDuplicate(raw)) return;
31842
32680
  const signedWhole = relayed && this.wholeSigned(raw);
31843
32681
  if (!signedWhole && !verify(fromBase64Url(raw.sig), messageSigned$1(raw), publicKeyFromZ32(raw.s))) return;
@@ -31888,7 +32726,7 @@ var GroupSession = class {
31888
32726
  this.markSeen(raw);
31889
32727
  this.keep(clean(raw));
31890
32728
  this.persistSoon();
31891
- if (this.handsOn(raw.s, raw.e)) this.took(clean(raw));
32729
+ if (this.handsOn(raw.s)) this.took(clean(raw));
31892
32730
  return;
31893
32731
  }
31894
32732
  const id = first && !this.provisional.has(own) ? groupMessageId(raw.s, first.e, first.n) : own;
@@ -31926,7 +32764,7 @@ var GroupSession = class {
31926
32764
  if (firstFrame && rosterHas(this.state.chain[firstFrame.e]?.m ?? [], this.myKey)) this.markSeen(firstFrame);
31927
32765
  this.keep(clean(raw));
31928
32766
  this.persistSoon();
31929
- if (this.handsOn(raw.s, raw.e)) this.took(clean(raw));
32767
+ if (this.handsOn(raw.s)) this.took(clean(raw));
31930
32768
  }
31931
32769
  /**
31932
32770
  * An edit of a member's own message, from its author's edge or handed on by another member: believed only while its
@@ -32106,6 +32944,14 @@ var GroupSession = class {
32106
32944
  this.asked.set(from, now);
32107
32945
  this.hooks.send(from, this.syncFrame([], from));
32108
32946
  }
32947
+ /**
32948
+ * Whether my sync to `from` (the one my edge opened with) still waits for its answer, which has the chain from the
32949
+ * epoch it said: asking again on reading its newer sync, or a commit of that answer, had each commit I missed sent
32950
+ * twice, each with a secret sealed again (200 missed went as 400 frames, 1,456 when answers go a slice at a time).
32951
+ */
32952
+ awaitsAnswer(from) {
32953
+ return (this.answering.get(from) ?? 0) > this.now();
32954
+ }
32109
32955
  async replayWaiting() {
32110
32956
  await this.metaFollowsChain();
32111
32957
  const ready = this.waiting.filter((w) => w.frame.e <= this.epoch && !!this.state.secrets[w.frame.e]);
@@ -32120,15 +32966,13 @@ var GroupSession = class {
32120
32966
  const raw = frame.commit;
32121
32967
  if (!raw || typeof raw !== "object" || !Number.isSafeInteger(raw.e)) return;
32122
32968
  const e = raw.e;
32969
+ if (this.awaitsAnswer(from)) this.answering.set(from, this.now() + ANSWER_WINDOW_MS);
32123
32970
  if (e <= this.epoch) {
32124
32971
  const known = this.state.chain[e];
32125
32972
  const result = verifyCommit(raw, this.state.chain[e - 1] ?? null, this.id);
32126
32973
  if ("error" in result || result.commit.by !== known.by || result.commit.by !== this.admin) return;
32127
32974
  if (commitHash(result.commit) !== commitHash(known)) await this.fork(`Member ${from.slice(0, 8)} holds a different membership history for epoch ${e}`);
32128
- else if (this.takeLeftMark(known, frame.left)) {
32129
- this.unprune();
32130
- await this.persist();
32131
- }
32975
+ else if (this.takeLeftMark(known, frame.left)) await this.persist();
32132
32976
  return;
32133
32977
  }
32134
32978
  if (e > this.epoch + 1) {
@@ -32150,7 +32994,7 @@ var GroupSession = class {
32150
32994
  commit: result.commit,
32151
32995
  ...mark ? { left: mark } : {}
32152
32996
  });
32153
- if (this.state.status === "active" && !this.state.secrets[this.epoch]) this.ask(from);
32997
+ if (this.state.status === "active" && !this.state.secrets[this.epoch] && !(this.awaitsAnswer(from) && this.epoch < (this.syncedEpoch.get(from) ?? 0))) this.ask(from);
32154
32998
  const next = this.pendingCommits.get(this.epoch + 1);
32155
32999
  if (next) {
32156
33000
  this.pendingCommits.delete(this.epoch + 1);
@@ -32158,21 +33002,12 @@ var GroupSession = class {
32158
33002
  }
32159
33003
  }
32160
33004
  /**
32161
- * Whether a frame of `author` under `epoch` is taken from another member, kept and handed on: while its author is in
32162
- * the roster, or when it left (its removal marked `left`, and it is not back in) and the frame is from before that,
32163
- * and from after any removal of it before that was not a leave: let back in, it is not handed on for those epochs.
33005
+ * Whether a frame of `author` is taken from another member, kept and handed on: only while its author is in the
33006
+ * roster. One who left, as one removed, keeps its seed and the secrets of its epochs, and a copy of its state signs
33007
+ * frames for them after the leave, dated as it likes: whether the admin marked its removal `left` changes nothing.
32164
33008
  */
32165
- handsOn(author, epoch) {
32166
- if (rosterHas(this.roster, author)) return true;
32167
- const chain = this.state.chain;
32168
- let left = false;
32169
- for (let e = chain.length - 1; e > 0; e--) {
32170
- if (chain[e].k !== "remove" || chain[e].s !== author) continue;
32171
- if (left && epoch >= e) return true;
32172
- if (!this.state.leftMarks?.[e] || epoch >= e) return false;
32173
- left = true;
32174
- }
32175
- return left;
33009
+ handsOn(author) {
33010
+ return rosterHas(this.roster, author);
32176
33011
  }
32177
33012
  /** Keeps the admin's mark on a commit that took out a member who left (`GroupCommitFrame.left`) when it holds; true when new. */
32178
33013
  takeLeftMark(commit, mark) {
@@ -32199,7 +33034,7 @@ var GroupSession = class {
32199
33034
  if (sealed) this.takeSecret(commit.e, sealed);
32200
33035
  this.pruneSecrets();
32201
33036
  this.pruneRelay();
32202
- await this.persist();
33037
+ this.persistSoon();
32203
33038
  this.hooks.changed();
32204
33039
  await this.replayWaiting();
32205
33040
  }
@@ -32221,7 +33056,7 @@ var GroupSession = class {
32221
33056
  taken = this.takeSecret(entry.e, entry.s) || taken;
32222
33057
  }
32223
33058
  if (!taken) return;
32224
- await this.persist();
33059
+ this.persistSoon();
32225
33060
  this.hooks.changed();
32226
33061
  await this.replayWaiting();
32227
33062
  }
@@ -32232,7 +33067,8 @@ var GroupSession = class {
32232
33067
  if (!answered.take()) return;
32233
33068
  this.hear(frame);
32234
33069
  if (frame.e > this.epoch) {
32235
- this.ask(from);
33070
+ this.syncedEpoch.set(from, frame.e);
33071
+ if (!this.awaitsAnswer(from)) this.ask(from);
32236
33072
  this.offerMeta(from, frame.mt);
32237
33073
  this.handOwn(from, frame);
32238
33074
  return;
@@ -32269,12 +33105,7 @@ var GroupSession = class {
32269
33105
  });
32270
33106
  const lacks = missingIn(frame, from);
32271
33107
  const asked = new Set(Array.isArray(frame.ask) ? frame.ask.filter((k) => typeof k === "string" && k !== from && k !== this.myKey && rosterHas(this.roster, k)) : []);
32272
- const handed = this.leaversHanded.get(from);
32273
- const kept = !asked.size && !this.state.leftMarks ? [] : this.kept().filter((f) => {
32274
- if (!this.state.chain[f.e] || !rosterHas(this.state.chain[f.e].m, from) || !lacks(f) || this.isRemoved(f)) return false;
32275
- if (asked.has(f.s)) return true;
32276
- return !rosterHas(this.roster, f.s) && !handed?.has(frameKey$1(f)) && this.handsOn(f.s, f.e);
32277
- });
33108
+ const kept = !asked.size ? [] : this.kept().filter((f) => asked.has(f.s) && !!this.state.chain[f.e] && rosterHas(this.state.chain[f.e].m, from) && lacks(f) && !this.isRemoved(f));
32278
33109
  const written = asWritten(this.ownLacked(from, frame), kept);
32279
33110
  const metas = this.metaFor(from, frame.mt);
32280
33111
  for (const f of written) {
@@ -32286,6 +33117,7 @@ var GroupSession = class {
32286
33117
  const edits = (this.state.relayEdits ?? []).filter((f) => f.s === author && readable(f));
32287
33118
  answer.push(...edits.slice(-GROUP_LIMITS.handOnEdits));
32288
33119
  }
33120
+ const handed = this.leaversHanded.get(from);
32289
33121
  const gone = (this.state.relayEdits ?? []).filter((f) => !rosterHas(this.roster, f.s) && readable(f) && !handed?.has(editKey(f)));
32290
33122
  answer.push(...gone.slice(-GROUP_LIMITS.handOnEdits));
32291
33123
  answer.push(...metas.map((m) => m.frame));
@@ -32992,6 +33824,29 @@ function verifyCommunityCommit(raw, parent, parentRoster, groupId, before) {
32992
33824
  * member's second leave under the one statement there was, and no newcomer could enter that group again.
32993
33825
  */
32994
33826
  function verifyCommunityChain(raw, groupId) {
33827
+ const check = checkChain(raw, groupId);
33828
+ for (;;) {
33829
+ const step = check.next();
33830
+ if (step.done) return step.value;
33831
+ }
33832
+ }
33833
+ /**
33834
+ * `verifyCommunityChain` for a client whose engine shares its page's thread: the same checks, letting the thread go every
33835
+ * `CHAIN_SLICE_MS` of them. One commit's signature takes ~2.6 ms in JavaScript on a desktop CPU, several times that on a
33836
+ * phone, so a history near `COMMUNITY_LIMITS.chain` checked at once was an app that drew nothing for 5 s and more.
33837
+ */
33838
+ async function verifyCommunityChainPaced(raw, groupId) {
33839
+ const check = checkChain(raw, groupId), pause = pacer(CHAIN_SLICE_MS);
33840
+ for (;;) {
33841
+ const step = check.next();
33842
+ if (step.done) return step.value;
33843
+ await pause();
33844
+ }
33845
+ }
33846
+ /** `verifyCommunityChainPaced` checks commits for this long at most before it lets the thread go. */
33847
+ var CHAIN_SLICE_MS = 5;
33848
+ /** The chain's checks, one commit per step. */
33849
+ function* checkChain(raw, groupId) {
32995
33850
  if (!Array.isArray(raw) || raw.length === 0 || raw.length > COMMUNITY_LIMITS.chain) return { error: "Malformed membership chain" };
32996
33851
  const chain = [], rosters = [];
32997
33852
  let entry = "";
@@ -33001,6 +33856,7 @@ function verifyCommunityChain(raw, groupId) {
33001
33856
  chain.push(result.commit);
33002
33857
  rosters.push(result.roster);
33003
33858
  if (result.commit.x !== void 0) entry = result.commit.x;
33859
+ yield;
33004
33860
  }
33005
33861
  return {
33006
33862
  chain,
@@ -33152,6 +34008,18 @@ function isSealed(v) {
33152
34008
  "c"
33153
34009
  ].every((k) => typeof v[k] === "string" && B64.test(v[k]) && v[k].length <= 128);
33154
34010
  }
34011
+ /** A welcome's shape and the whole chain it and the pieces before it carry, not yet checked (`CommunitySession.join`). */
34012
+ function readWelcome(link, pieces, welcome) {
34013
+ if (!welcome || typeof welcome !== "object") return { error: "Malformed welcome" };
34014
+ const w = welcome;
34015
+ if (w.t !== "group-welcome" || w.v !== 2 || w.g !== link.g || !Array.isArray(w.commits) || !Array.isArray(w.secrets) || !isSealed(w.rv) || !isSealed(w.entry)) return { error: "Malformed welcome" };
34016
+ const commits = [...pieces.flatMap((p) => p && typeof p === "object" && Array.isArray(p.commits) ? p.commits : []), ...w.commits];
34017
+ if (commits.length > COMMUNITY_LIMITS.chain) return { error: "Membership chain too long" };
34018
+ return {
34019
+ welcome: w,
34020
+ commits
34021
+ };
34022
+ }
33155
34023
  /** A pair payload's box: an ephemeral key, a nonce and a ciphertext of at most `appBytes` sealed. */
33156
34024
  var MAX_PAIR_BOX = Math.ceil((COMMUNITY_LIMITS.appBytes + 16) * 4 / 3) + 4;
33157
34025
  function isPairBox(v) {
@@ -33166,7 +34034,7 @@ function isMessageFrame(v) {
33166
34034
  * One member's view of a community group: the branch it follows and the ones it knows, the
33167
34035
  * secrets it holds, what it has seen, and the recent frames it keeps for others.
33168
34036
  */
33169
- var CommunitySession = class {
34037
+ var CommunitySession = class CommunitySession {
33170
34038
  hooks;
33171
34039
  state;
33172
34040
  identity;
@@ -33279,12 +34147,17 @@ var CommunitySession = class {
33279
34147
  * add was made by another member (the first one to answer me went away) is as good.
33280
34148
  */
33281
34149
  static join(link, pieces, welcome, seedB64, now = Date.now()) {
33282
- if (!welcome || typeof welcome !== "object") return { error: "Malformed welcome" };
33283
- const w = welcome;
33284
- if (w.t !== "group-welcome" || w.v !== 2 || w.g !== link.g || !Array.isArray(w.commits) || !Array.isArray(w.secrets) || !isSealed(w.rv) || !isSealed(w.entry)) return { error: "Malformed welcome" };
33285
- const commits = [...pieces.flatMap((p) => p && typeof p === "object" && Array.isArray(p.commits) ? p.commits : []), ...w.commits];
33286
- if (commits.length > COMMUNITY_LIMITS.chain) return { error: "Membership chain too long" };
33287
- const verified = verifyCommunityChain(commits, link.g);
34150
+ const read = readWelcome(link, pieces, welcome);
34151
+ if ("error" in read) return read;
34152
+ return CommunitySession.joinVerified(link, read.welcome, verifyCommunityChain(read.commits, link.g), seedB64, now);
34153
+ }
34154
+ /** `join`, its chain checked a slice at a time (`verifyCommunityChainPaced`): what an app sharing its page's thread calls. */
34155
+ static async joinPaced(link, pieces, welcome, seedB64, now = Date.now()) {
34156
+ const read = readWelcome(link, pieces, welcome);
34157
+ if ("error" in read) return read;
34158
+ return CommunitySession.joinVerified(link, read.welcome, await verifyCommunityChainPaced(read.commits, link.g), seedB64, now);
34159
+ }
34160
+ static joinVerified(link, w, verified, seedB64, now) {
33288
34161
  if ("error" in verified) return verified;
33289
34162
  const { chain, roster, entry } = verified;
33290
34163
  const me = identityFromSeedB64(seedB64);
@@ -33392,6 +34265,18 @@ var CommunitySession = class {
33392
34265
  get entryKey() {
33393
34266
  return this.state.entry.key;
33394
34267
  }
34268
+ /**
34269
+ * The entry key of the link my admission that lost was let in by (the one its branch named), where I ask again: a
34270
+ * link replaced since keeps me out as it does anyone. `entryKey` once that admission is no longer held.
34271
+ */
34272
+ get lostEntryKey() {
34273
+ const side = this.state.side;
34274
+ for (let i = side.length - 1; i >= 0; i--) if (side[i].k === "add" && side[i].s === this.myKey) {
34275
+ for (const c of this.ancestry(side[i].p)) if (c.x !== void 0) return c.x;
34276
+ return "";
34277
+ }
34278
+ return this.entryKey;
34279
+ }
33395
34280
  role(key) {
33396
34281
  return this.roster.find(([k]) => k === key)?.[1];
33397
34282
  }
@@ -33399,10 +34284,62 @@ var CommunitySession = class {
33399
34284
  get picture() {
33400
34285
  return groupMetaPicture(this.state.meta);
33401
34286
  }
33402
- /** Members of any epoch in the window: whom a frame may come from. */
34287
+ /**
34288
+ * Members of any epoch in the window: whom a frame may come from. A side commit's roster counts only while its branch
34289
+ * could still win (`mayWin`): one let in only on a branch that lost is not in the roster anyone sees, and the main
34290
+ * branch past where they part, a later link among it, is not its business (`lostAt`).
34291
+ */
33403
34292
  isRecentMember(key) {
33404
- for (const roster of this.rosters.values()) if (rosterHas(roster, key)) return true;
33405
- return false;
34293
+ let side = false;
34294
+ for (const [h, roster] of this.rosters) if (rosterHas(roster, key)) {
34295
+ if (this.mainIndex.has(h)) return true;
34296
+ side = true;
34297
+ }
34298
+ return side && [...this.mayWin()].some((h) => rosterHas(this.rosters.get(h) ?? [], key));
34299
+ }
34300
+ /**
34301
+ * The side commits whose branch could still win: it does not drop an admin change the main branch holds (one that
34302
+ * does never wins, see `better`), and it parts within the window. Kept until the tip or the side moves.
34303
+ */
34304
+ mayWin() {
34305
+ const side = this.state.side, at = `${this.topHash}:${side.length}:${side.length ? communityCommitHash(side[side.length - 1]) : ""}`;
34306
+ if (this.winning?.at === at) return this.winning.set;
34307
+ const counts = this.adminCounts(), main = this.branch(this.topHash), set = /* @__PURE__ */ new Set();
34308
+ for (const c of side) {
34309
+ const h = communityCommitHash(c), branch = this.rosters.has(h) ? this.branch(h) : null;
34310
+ if (!branch || !branch.path.length) continue;
34311
+ const { parent, admin } = this.parting(branch, main, counts);
34312
+ if (!(admin[1] && !admin[0]) && parent >= this.epoch - COMMUNITY_LIMITS.window) set.add(h);
34313
+ }
34314
+ this.winning = {
34315
+ at,
34316
+ set
34317
+ };
34318
+ return set;
34319
+ }
34320
+ winning;
34321
+ /**
34322
+ * 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
34323
+ * the commit that makes it lose (the latest over its branches). Undefined for anyone else.
34324
+ */
34325
+ lostAt(key) {
34326
+ const side = this.state.side, parents = new Set(side.map((c) => c.p)), counts = this.adminCounts();
34327
+ let lost;
34328
+ for (const c of side) {
34329
+ const h = communityCommitHash(c);
34330
+ if (parents.has(h)) continue;
34331
+ const branch = this.branch(h);
34332
+ if (!branch || !branch.path.some((x) => rosterHas(this.rosters.get(x) ?? [], key))) continue;
34333
+ for (let j = branch.fork + 1; j < this.state.chain.length; j++) {
34334
+ if (this.better(branch, this.branch(communityCommitHash(this.state.chain[j])), counts)) continue;
34335
+ lost = {
34336
+ fork: Math.min(lost?.fork ?? j, branch.fork),
34337
+ end: Math.max(lost?.end ?? j, j)
34338
+ };
34339
+ break;
34340
+ }
34341
+ }
34342
+ return lost;
33406
34343
  }
33407
34344
  /**
33408
34345
  * Whether `key` could read message `messageId` (`<s>:<e>:<h>:<n>`) and still can: a member of the roster it was sealed
@@ -34701,6 +35638,7 @@ var CommunitySession = class {
34701
35638
  case "group-left": return this.receiveLeft(frame);
34702
35639
  case "group-entry": {
34703
35640
  if (frame.to !== this.myKey || !isSealed(frame.s) || frame.x !== this.currentEntryKey()) return false;
35641
+ if (this.state.entry.key === frame.x && this.state.entry.seedB64) return false;
34704
35642
  const seed = openSecret(this.identity.seed, this.myKey, frame.s, entryAad(this.id, this.myKey));
34705
35643
  return !!seed && this.takeEntrySeed(toBase64Url(seed));
34706
35644
  }
@@ -34952,10 +35890,23 @@ var CommunitySession = class {
34952
35890
  for (const { from, frame } of ready) await this.receiveMessage(from, frame);
34953
35891
  }
34954
35892
  async receiveSync(from, frame) {
34955
- if (!this.isRecentMember(from) || !isZ32Key(from) || !Number.isSafeInteger(frame.e) || typeof frame.h !== "string") return;
35893
+ if (!isZ32Key(from) || !Number.isSafeInteger(frame.e) || typeof frame.h !== "string") return;
35894
+ const recent = this.isRecentMember(from), lost = recent ? void 0 : this.lostAt(from);
35895
+ if (!recent && !lost) return;
34956
35896
  let answered = this.syncsAnswered.get(from);
34957
35897
  if (!answered) this.syncsAnswered.set(from, answered = new RateWindow(COMMUNITY_LIMITS.syncAnswers, COMMUNITY_LIMITS.syncWindowMs, () => this.hooks.clock?.() ?? Date.now()));
34958
35898
  if (!answered.take()) return;
35899
+ if (lost) {
35900
+ const at = this.mainIndex.get(frame.h);
35901
+ const commits = this.state.chain.slice(at !== void 0 ? at + 1 : lost.fork + 1, lost.end + 1);
35902
+ if (commits.length) this.answers.handOut(from, commits.map((commit) => ({
35903
+ t: "group-commit",
35904
+ v: 2,
35905
+ g: this.id,
35906
+ commit
35907
+ })));
35908
+ return;
35909
+ }
34959
35910
  const answer = [];
34960
35911
  const ask = () => {
34961
35912
  const sync = this.question(from);
@@ -36544,6 +37495,6 @@ function x401ApprovalDigest(subject) {
36544
37495
  return toBase64Url(sha256(utf8Encode(canonical)));
36545
37496
  }
36546
37497
  //#endregion
36547
- export { COMMUNITY_LIMITS as $, bytesEqual as $C, WRITE_FIRST_MS as $S, newHandoffId as $_, LIVENESS_PING_MS as $a, INVITE_LINK_ORIGIN as $b, isServeId as $c, emptyDhtDeliveryState as $d, LINK_PREVIEW_LIMITS as $f, HANDOFF_ATTEMPTS as $g, decodeChunk as $h, sparkAddressKind as $i, DOMAIN_FILE_MAX_BYTES as $l, ANSWER_REFUSED_REDIALS as $m, bip322MessageHash as $n, meshHubs as $o, cardEditNumber as $p, checkDidJws as $r, GROUP_PIN_FRAME as $s, carryMentions as $t, identityRevocationValue as $u, inboxRecord as $v, TURN_SEALED_BYTES as $x, isAppPath as $y, readX401ProofResponseHeader as A, IDENTITY_MEMO_SIZE as AC, CHAT_WATCH_SHARE as AS, handoffBusyFrame as A_, ENDPOINT as Aa, imageSize as Ab, wakeRequest as Ac, ringAuthorization as Ad, isPlayableVideoType as Af, sdpHasCandidates as Ag, TRANSPORTS_GONE_MS as Ah, openDidDhtPayload as Ai, SERVICES_CAPABILITY as Al, expectedRoster as Am, parseGroupMetaFrame as An, fetchesByItself as Ao, wireReaction as Ap, shortAtprotoDid as Ar, FileUplink as As, mergeKnocks as At, dialDescriptors as Au, ENROLL_GRANT as Av, devicePingFrame as Ax, openRequest as Ay, APP_STORE_KINDS as B, sealedLength as BC, HEDGE_MS as BS, handoffHaveFrames as B_, CROSSED_FRESH_MS as Ba, createContactLink as Bb, APP_RANGE_DATA_KIND as Bc, irohDescriptor as Bd, MAX_EDITS_PER_MESSAGE as Bf, HTTP_SERVICE_PROTO as Bg, formatLocalTarget as Bh, USDT_PUBLIC_RPC as Bi, PairedSession as Bl, GROUP_PROFILE as Bm, SshSigError as Bn, GROUP_VERSION_SIGNALS as Bo, BUTTON_ID as Bp, parseAtprotoVerificationKey as Br, TYPING_REFRESH_MS as Bs, mentionedMembers as Bt, IDENTITY_MAX_FRAME as Bu, enrollProofFrame as Bv, TURN_VISIBLE_MS as Bx, APP_CLIENT_NAME as By, buildX401TokenObject as C, parseRelayPayload as CC, turnStatedVerifier as CS, NO_ATTEMPTS as C_, parseLightningDestination as Ca, setAppSignatureFastPath as Cb, newWakeToken as Cc, storageProof as Cd, voiceFileName as Cf, decompressSdp as Cg, OFFER_LOOK_MS as Ch, didDhtDocument as Ci, CALLS_CAPABILITY as Cl, MAX_GROUP_CHAIN as Cm, groupMetaTag as Cn, parseEngineError as Co, reactedFrame as Cp, atprotoDidMethod as Cr, PAIRED_CALL_FRAME as Cs, MAX_KNOCKS as Ct, CAPS_PUBLISH_SPACING_MS as Cu, setUpdateMessage as Cv, deviceFrameCapability as Cx, knockSlotIdentity as Cy, readX401ProofRequest as D, decodeTxtPacket as DC, CHAT_RESERVE as DS, handoffAttemptAllowed as D_, BOLT11_PATTERN as Da, verifyAppSignature as Db, relayRequest as Dc, verifyNostrProof as Dd, PLAYABLE_VIDEO as Df, keepsToRelays as Dg, RELAY_POLL_INTERVALS as Dh, encodeDidDhtDeactivated as Di, KNOWN_SESSION_CAPABILITIES as Dl, SAID_AGAIN as Dm, nextGroupMetaRevision as Dn, GROUP_VERSION_FILES as Do, readDhtReactions as Dp, isAtprotoDid as Dr, FILE_DATA_KIND as Ds, groupEntryUrl as Dt, CapsRefusedError as Du, ENROLL_CANCEL as Dv, deviceLinkRendezvousSeed as Dx, makeStamp as Dy, isX401Protocol as E, decodeDnsAnswers as EC, BACKGROUND_WHILE_SIGNALING as ES, handoffAckFrame as E_, resolveLightningDestination as Ea, verifyAppRevocation as Eb, readWakePayload as Ec, validExternalKey as Ed, voicePeaksOf as Ef, isGlobalIpv4Host as Eg, PRESENCE_WINDOW as Eh, didDhtRecords as Ei, FILES_CAPABILITY as El, OWN_FRAME_LIMIT as Em, keepPastGroupMeta as En, GROUP_HAVE_FRAME as Eo, reactionIsNewer as Ep, checkAtprotoProofRecord as Er, ChatFiles as Es, entryParams as Et, CapsKeys as Eu, DEVICE_KINDS as Ev, deviceLinkParams as Ex, linkRecords as Ey, appRevocationFor as F, sign as FC, GROUP_BURST_ONE_LINK as FS, handoffDigest as F_, parseCashuRequestPayload as Fa, canonicalJson as Fb, encryptPushPayload as Fc, verifyRingEvidence as Fd, EDIT_BUFFER_MS as Ff, RECORD_TTL as Fg, presenceSeenAt as Fh, ONCHAIN_PROVIDER as Fi, UPGRADE_CAPABILITY as Fl, signCommit as Fm, wrapGroupMeta as Fn, readGroupWant as Fo, pairedReplyAuthor as Fp, decodeDagCbor as Fr, transferStalled as Fs, GROUP_WAKE_MEMBER_INTERVAL_MS as Ft, IDENTITY_CHECK_UNAVAILABLE as Fu, enrollDigits as Fv, seedSigner as Fx, seenEntry as Fy, readAppStore as G, sanitizeAvatar as GC, RelaysFailedError as GS, handoffReleaseFrame as G_, DHT_PIN_GRACE_MS as Ga, DEVICE_INVITE_OWN_DEVICE as Gb, appRangeCancelFrame as Gc, ACTIVE_DHT_POLL_MS as Gd, editFrame as Gf, encodeServices as Gg, sanitizeResponseHeaders as Gh, formatPaymentAmount as Gi, HOLD_LIMITS as Gl, encryptText as Gm, sshKeyDigestHex as Gn, SIGNAL_PROVEN_MS as Go, PR_STATES as Gp, DID_DOCUMENT_MAX_BYTES as Gr, TypingSender as Gs, GroupSession as Gt, IDENTITY_REVOCATION_LABEL as Gu, FLOOD_PER_DAY as Gv, TOMBSTONE_TURN as Gx, APP_VIEWS as Gy, checkAppListing as H, MAX_AVATAR_LENGTH as HC, RELAY_REQUESTS_PER_MINUTE as HS, handoffManifestFrames as H_, CROSSED_WAIT_MS as Ha, readContactLink as Hb, APP_RANGE_FRAMES as Hc, rankTransports as Hd, REMOVED_TEXT as Hf, MAX_SERVICES as Hg, relativizeLocation as Hh, arkAddressPrefix as Hi, SESSION_RECEIVE_PENDING as Hl, confirmationTag as Hm, parseSshSignature as Hn, SIGNAL_CARRIERS as Ho, CRON_LINE as Hp, unsignedCommitBytes as Hr, TYPING_STATUS_MAX as Hs, GROUP_LIMITS as Ht, IDENTITY_MAX_VALIDITY as Hu, readEnrollGrant as Hv, keptAtEqualSequence as Hx, APP_ICON_PATH as Hy, appStoreDecision as I, verify as IC, GROUP_OVER_PACE_MS as IS, handoffDoneFrame as I_, parseFedimintRequestPayload as Ia, canonicalJsonBytes as Ib, generateVapidKeys as Ic, RELAY_URL as Id, EDIT_FRAME as If, buildLinkRecords as Ig, unusedInviteWait as Ih, PaymentPreflightError as Ii, WAKE_SESSION_CAPABILITY as Il, sortRoster as Im, SSHSIG_MAX_ARMOR as In, readGroupWantNo as Io, readReply as Ip, encodeDagCbor as Ir, TYPING_FRAME as Is, GROUP_WAKE_RECEIVE_LIMIT as It, IDENTITY_CLOCK_SKEW as Iu, enrollDoneFrame as Iv, webCryptoSigner as Ix, stampHolds as Iy, GROUP_TYPING_FRAME as J, sanitizeDisplayText as JC, SLOW_DEMOTE_MS as JS, handoffStreamKey as J_, GhostLink as Ja, deviceInviteJoinerParams as Jb, appRangeEndFrame as Jc, DHT_MESSAGE_TTL as Jd, parseEditedFrame as Jf, serviceIdFromName as Jg, CHUNK_FLAG_END as Jh, validatePaymentTarget as Ji, isHoldUrl as Jl, openPair as Jm, isLegacySignature as Jn, readGroupSignal as Jo, RUN_RESULTS as Jp, DID_JWS_ALGS as Jr, sanitizeTypingStatus as Js, frameBytes as Jt, IdentityCheckUnavailable as Ju, MAX_WAITING as Jv, TURN_LAST_SEQUENCE as Jx, assembleAppBundle as Jy, readAppStoreSteps as K, MAX_NICK_LENGTH as KC, SIGNALING_ALLOWANCE_SHARE as KS, handoffRequestFrame as K_, EARLY_DIAL_JOIN_MS as Ka, createDeviceInvite as Kb, appRangeChunk as Kc, DHT_FILE_REFUSED as Kd, editedFrame as Kf, isValidServiceId as Kg, viewerResponseHeaders as Kh, isWalletNetwork as Ki, HoldKeys as Kl, epochKeys as Km, sshSignCommand as Kn, SIGNAL_REPLY_MS as Ko, REMOVABLE_KINDS as Kp, DID_FILE_MAX_BYTES as Kr, parseTypingActivity as Ks, asWritten as Kt, IDENTITY_STATEMENT_PREFIX as Ku, MAX_DONE as Kv, TURN_BODY_BYTES as Kx, appDigest as Ky, appUpdateDecision as L, decrypt as LC, GROUP_RATION_WINDOW_MS as LS, handoffEphemeral as L_, ANSWERS_REFUSED_PAUSES as La, readCanonicalJson as Lb, pushRequest as Lc, TRANSPORTS as Ld, EDIT_RATE_WINDOW_MS as Lf, emptyLinkRecords as Lg, GhostlyHttpError as Lh, SEPOLIA_TEST_USDT as Li, parseSessionCapabilities as Ll, verifyChain as Lm, SSHSIG_NAMESPACE as Ln, CARRIED_DEFER_MS as Lo, replySnippet as Lp, findInMst as Lr, TYPING_KINDS as Ls, GroupWakeLimiter as Lt, IDENTITY_FRAME_LIMIT as Lu, enrollGrantFrame as Lv, TURN_PUT_WINDOW_MS as Lx, APP_BUNDLE_LIMITS as Ly, readX401ProofResultHeader as M, identityFromSeed as MC, DEPARTED_READS as MS, handoffContext as M_, fedimintRequestPayload as Ma, parseImageMeta as Mb, WebPushError as Mc, ringEvidence as Md, parseVideoMeta as Mf, waitForIceGathering as Mg, UNUSED_INVITE_WAIT_MAX_MS as Mh, signDidDhtPacket as Mi, STATUS_CARD_CAPABILITY as Ml, rememberAlone as Mm, parseGroupMetaTag as Mn, isGroupMessageId as Mo, REPLY_ID as Mp, AtprotoProofError as Mr, encodeFileData as Ms, GROUP_WAKE_FRAME as Mt, encodePacketTransports as Mu, ENROLL_PROOF as Mv, signDeviceTransports as Mx, readLinkRecord as My, x401AnswerableRequests as N, identityFromSeedB64 as NC, FRESH_READ_MS as NS, handoffContextProof as N_, findEndpoint as Na, previewable as Nb, checkPushEndpoint as Nc, validRingKey as Nd, EDITED_FRAME as Nf, LABEL$1 as Ng, WATCH_PEER_MS as Nh, ETHEREUM_USDT as Ni, SessionCapabilities as Nl, rosterAdmin as Nm, signGroupMeta as Nn, readGroupFileMeta as No, REPLY_LIMITS as Np, atprotoCidFor as Nr, refusalText as Ns, GROUP_WAKE_GROUP_LIMIT as Nt, parsePacketTransports as Nu, enrollCancelFrame as Nv, unsignedDeviceTransports as Nx, requestPlaintextBytes as Ny, readX401ProofRequestHeader as O, encodeTxtPacket as OC, CHAT_RESERVE_MOST_SHARE as OS, handoffAttemptFailed as O_, decodeBolt11 as Oa, verifyAppStatementBytes as Ob, wakeFrame as Oc, verifyPeerProof as Od, VIDEO_LIMITS as Of, parseCallSignal as Og, SIGNAL_OUT_READS as Oh, encodeDidDhtPacket as Oi, PIN_CAPABILITY as Ol, commitHash as Om, openGroupMeta as On, GROUP_WANT_FRAME as Oo, readReaction as Op, normalizeAtprotoHandle as Or, FILE_FRAMES as Os, knockIdentity as Ot, DHT_TEXT_CAPABILITY as Ou, ENROLL_CANCEL_REASONS as Ov, deviceLinkSealKey as Ox, makeStampPaced as Oy, addedAppPermissions as P, publicKeyFromZ32 as PC, GROUP_BURST_MS as PS, handoffDataFrame as P_, isFederationId as Pa, readImageMeta as Pb, decryptPushPayload as Pc, verifyRingAuthorization as Pd, EDIT_BUFFER_MAX as Pf, MAX_MSGS_PAYLOAD_B64 as Pg, countUnusedInvite as Ph, EVM_TEST_CHAINS as Pi, TYPING_CAPABILITY as Pl, rosterHas as Pm, verifyGroupMetaSignature as Pn, readGroupHave as Po, groupReplyAuthor as Pp, decodeAtprotoCommit as Pr, transferEnded as Ps, GROUP_WAKE_GROUP_WINDOW_MS as Pt, IDENTITY_CHALLENGE_WINDOW as Pu, enrollCancelReason as Pv, verifyDeviceTransports as Px, requestRecords as Py, sealGroupTyping as Q, unwrapPasted as QC, WAY_BACK_SHARE as QS, isHandoffPartName as Q_, LIVENESS_MISSED_PINGS as Qa, INVITE_HRP as Qb, encodeAppRangeData as Qc, LIVE_POLL_MS as Qd, LINK_MAX_CHARS as Qf, HANDOFF_ACK as Qg, PROTOCOL_VERSION as Qh, isSparkAddress as Qi, DNS_TYPE as Ql, sha256Hex as Qm, MessageRefusal as Qn, mayBeHub as Qo, buttonLabelClash as Qp, DidError as Qr, COMMUNITY_PIN_FRAME as Qs, GROUP_EDIT_TEXT_BYTES as Qt, identityPresentationBytes as Qu, endedRequests as Qv, TURN_REV_LIMIT as Qx, isAppLicense as Qy, checkAppBeforeRun as R, encrypt as RC, GROUP_SIGNALING_ALLOWANCE_SHARE as RS, handoffFileMissingFrame as R_, ANSWERS_REFUSED_PAUSE_MS as Ra, CONTACT_LINK_BYTES as Rb, vapidAuthorization as Rc, automaticTransport as Rd, EDIT_RECEIVE_LIMIT as Rf, isEmptyLinkPacket as Rg, HttpClient as Rh, SEPOLIA_TEST_USDT_FAUCET as Ri, sessionCapabilitiesFrame as Rl, verifyCommit as Rm, SSH_KEY_TYPES as Rn, CarriedTransport as Ro, wireReply as Rp, parseAtprotoCar as Rr, TYPING_RATE_LIMIT as Rs, groupWakeFrame as Rt, IDENTITY_FRAME_WINDOW_MS as Ru, enrollHelloFrame as Rv, TURN_RAISE_READ_TIMEOUT_MS as Rx, APP_BUNDLE_MAGIC as Ry, buildX401ResultArtifact as S, openRelayPayload as SC, turnSignedMessage as SS, HANDOFF_WINDOW as S_, parseInvoiceCallback as Sa, readAppSignature as Sb, deviceWakeRequest as Sc, proofStatement as Sd, voiceDownloadName as Sf, contactRtcConfig as Sg, OFFER_FAST_MS as Sh, decodeDidDhtPacket as Si, BUTTONS_CAPABILITY as Sl, LEGACY_GROUP_MEMBERS as Sm, groupMetaPicture as Sn, engineText as So, queueReaction as Sp, ATPROTO_PROOF_SCOPE as Sr, MAX_PAIRED_CALL_SIGNAL as Ss, KNOCK_TTL_MS as St, CAPS_LIMITS as Su, setUpdateFrame as Sv, deviceEchoNonce as Sx, knockHolds as Sy, encodeX401Header as T, signRelayPayload as TC, BACKGROUND_REQUESTS_PER_MINUTE as TS, filePartName as T_, requestLnurlInvoice as Ta, signAppRevocation as Tb, readWake as Tc, storageProofPath as Td, voiceLevelsOf as Tf, heardCallSignal as Tg, PRESENCE_HEARTBEAT as Th, didDhtKey as Ti, FILES_BINARY_CAPABILITY as Tl, MEMBER_KEY as Tm, groupName as Tn, GROUP_FILE_LIMITS as To, reactionFrame as Tp, atprotoProofRkey as Tr, parsePairedCallFrame as Ts, encodeGroupEntryLink as Tt, CapsExchange as Tu, verifySetUpdate as Tv, deviceLinkPairing as Tx, knockSlotRecords as Ty, checkAppStoreIndex as U, MAX_AVATAR_SIDE as UC, REQUESTS_PER_MINUTE as US, handoffOfferFrame as U_, DEMOTE_AFTER_FAILURES as Ua, DEVICE_INVITE_BYTES as Ub, APP_RANGE_LIMITS as Uc, relayedTransports as Ud, RateWindow as Uf, SERVICES_VERSION as Ug, resolveTargetUrl as Uh, assertTokenUnits as Ui, HOLD_CAPABILITY as Ul, decryptText as Um, sameSshKey as Un, SIGNAL_FRESH_MS as Uo, ITEM_STATES as Up, verifyAtprotoRecordProof as Ur, TYPING_TIMEOUT_MS as Us, GROUP_REACTED_FRAME as Ut, IDENTITY_PROOF_CAPABILITY as Uu, readEnrollHello as Uv, turnPutSummary as Ux, APP_PERMISSIONS as Uy, APP_STORE_LIMITS as V, tryDecrypt as VC, PREVIOUS_DEFAULT_RELAYS as VS, handoffHelloFrame as V_, CROSSED_PROBE_MS as Va, encodeContactLink as Vb, APP_RANGE_ERRORS as Vc, irohRelayUrl as Vd, MAX_REMOVAL_NUMBER as Vf, LEGACY_SERVICES as Vg, parseLocalTarget as Vh, WALLET_NETWORKS as Vi, SESSION_FRAME_MAX as Vl, confirmationMatches as Vm, parseSshPublicKey as Vn, SIGNALS_PER_MINUTE as Vo, BUTTON_STYLES as Vp, readAtprotoCid as Vr, TYPING_SEND_LIMIT as Vs, parseGroupWakeFrame as Vt, IDENTITY_MAX_RECEIVED as Vu, formatEnrollDigits as Vv, classifyTurnRead as Vx, APP_FORBIDDEN_KEYS as Vy, readAppListing as W, jpegSize$1 as WC, RelayTransport as WS, handoffPakeFrame as W_, DEMOTE_MS as Wa, DEVICE_INVITE_LIFETIME_S as Wb, AppRanges as Wc, transportOrder as Wd, dhtEditId as Wf, decodeServices as Wg, sanitizeRequestHeaders as Wh, assertWholeSats as Wi, HOLD_DATED_BACK_MS as Wl, edgeParams as Wm, sshFingerprint as Wn, SIGNAL_HOLD_MS as Wo, PR_CHECKS as Wp, verifyAtprotoSignature as Wr, TypingReceiver as Ws, GROUP_READ_NOTE as Wt, IDENTITY_PROVIDER_ID as Wu, verifyEnrollProof as Wv, TOMBSTONE_SEQUENCE as Wx, APP_SCREENSHOTS_DIR as Wy, groupTypingEpoch as X, stripHidden as XC, TURN_SOURCE_TIMEOUT_MS as XS, handoffVerifiedMessage as X_, INVITER_DIAL_GRACE_MS as Xa, readDeviceInvite as Xb, appRangeGetFrame as Xc, DHT_TEXT_REFUSED as Xd, validEditNumber as Xf, servicesToWire as Xg, LIMITS as Xh, SPARK_NETWORKS as Xi, readManifest as Xl, sealPair as Xm, verifyBitcoinMessage as Xn, MESH_HUBS as Xo, TASK_STATUSES as Xp, DID_MAX_LENGTH as Xr, typingFrame as Xs, COMMUNITY_EDIT_FRAME as Xt, boundVerifiedIdentity as Xu, REOPEN_BELOW as Xv, TURN_NAME_BYTES as Xx, checkAppManifest as Xy, GroupTypingBoard as Y, sanitizeNick as YC, SLOW_MS as YS, handoffVerifiedFrame as Y_, HANDLED_WAIT_MS as Ya, encodeDeviceInvite as Yb, appRangeErrorFrame as Yc, DHT_TEXT_BYTES as Yd, validEditMessage as Yf, servicesFromWire as Yg, CHUNK_KIND as Yh, walletNetworkOf as Yi, newMailbox as Yl, openSecret as Ym, legacyMessageHash as Yn, GROUP_VERSION_HUBS as Yo, STATUS_CARD_LIMITS as Yp, DID_JWS_MAX_LENGTH as Yr, typingActivity as Ys, groupMessageId as Yt, IdentityExchange as Yu, NEW_PER_HOUR as Yv, TURN_MAX as Yx, buildAppBundle as Yy, openGroupTyping as Z, trimEndOf as ZC, WATCH_SHARE as ZS, handoffVersions as Z_, INVITE_TAKEN as Za, DEVICE_INVITE_VERSION as Zb, decodeAppRangeData as Zc, DhtDelivery as Zd, validRemovalNumber as Zf, viewerTag as Zg, MAX_CHUNK_PAYLOAD_BYTES as Zh, SPARK_PROVIDER as Zi, DNS_LABEL as Zl, sealSecret as Zm, BIP322_REVISION as Zn, NO_HUB_POLICY as Zo, appCardId as Zp, DID_METHODS as Zr, typingKindOf as Zs, GROUP_EDIT_FRAME as Zt, emptyIdentityLedger as Zu, clearMissed as Zv, TURN_NO_ACTIVE as Zx, findAppForbiddenKey as Zy, X401_PROTOCOLS as _, PacketTooLargeError as _C, turnName as _S, HANDOFF_RELEASE as __, LIGHTNING_DESTINATION_PATTERN as _a, isAppRef as _b, WAKE_FRAME as _c, importedProof as _d, fileMessageText as _f, answersOffer as _g, EXPECT_PEER_MS as _h, DID_DHT_MAX_PAYLOAD as _i, isChatAppId as _l, shownTime as _m, encodeGroupMetaBody as _n, parsePaymentNetworks as _o, REACTION_LIMITS as _p, u64 as _r, readBeacon as _s, shortHash as _t, txtValue as _u, SET_ACK as _v, DEVICE_ECHO_FRAME as _x, REQUEST_TEXT_BYTES as _y, X401_DCQL_LIMITS as a, BREAKER_ALL_DOWN_PROBE_MS as aC, encodeTurnFields as aS, HANDOFF_DONE as a_, PUBKY_PROOF_ROOT as aa, yieldThread as ab, nextPinNumber as ac, revokesIdentity as ad, FileTransfers as af, DATA_CHANNEL_ID as ag, OFFER_HOST_GATHER_MS as ah, didWebFile as ai, APP_RATE_LIMIT as al, readStatusCard as am, MENTION_EVERYONE as an, RACE_ANSWERED_MS as ao, parseLinkPreview as ap, ByteReader as ar, beaconKeys as as, communityHasFrame as at, decodeDnsResponse as au, readHandoffDone as av, randomBytes as aw, decodeInviteCode as ax, CONTACT_RECORD_TTL as ay, buildX401ProofRequest as b, measureRecords as bC, turnReleaseMessage as bS, HANDOFF_VERIFIED as b_, findLightningDestination as ba, readAppRevocationShape as bb, WAKE_TTL_SECONDS as bc, proofCapability as bd, parseVoiceMeta as bf, callSignalHeardAt as bg, LinkSession as bh, DID_DHT_VERSION as bi, APPS_CAPABILITY as bl, GROUP_MEMBER_CAP as bm, groupMetaChange as bn, EngineError as bo, parseReactedFrame as bp, ATPROTO_FULL_SCOPE as br, shouldBeHub as bs, verifyCommunityCommit as bt, CAPS_ISSUED_BACK_MS as bu, readSetUpdate as bv, HANDOFF_CAPABILITY as bx, STAMP_BITS_MIN as by, readX401DcqlQuery as c, BREAKER_THRESHOLD as cC, openTurnValue as cS, HANDOFF_HAVE as c_, newPubkyProofFolder as ca, APP_STATEMENT_LIMITS as cb, pinFrame as cc, IDENTITY_TIMELINE_MAX as cd, safeBlobType as cf, RTC_SIGNAL_MAX_AGE_MS as cg, DIRECT_EVIDENCE_MS as ch, didWebHost as ci, APP_SEND_LIMIT as cl, statusCardBytes as cm, mentionsMember as cn, REDESCRIBED_GRACE_MS as co, FORWARD_LIMITS as cp, decodeBitcoinAddress as cr, freshHubs as cs, communityUntaggedHash as ct, domainWellKnownFile as cu, readHandoffHello as cv, toZ32 as cw, inviteLink as cx, KNOCK_SLOT_LABEL as cy, newX401HolderKey as d, budgetRetryMs as dC, sealTurnBody as dS, HANDOFF_LIST_PER_FRAME as d_, pubkyProofFile as da, appRefPublisher as db, pinnedFrame as dc, PROOF_ADAPTERS as dd, PLAYABLE_AUDIO as df, offerIsFresh as dg, DirectPathWatch as dh, parseDidDocument as di, appCloseFrame as dl, usageLeft as dm, GROUP_META_PAST as dn, SWITCH_RETIRE_MS as do, readForwarded as dp, encodeTx as dr, lobbyRecords as ds, encodeCommunityLink as dt, nip05RootKey as du, readHandoffRelease as dv, __commonJSMin as dw, inviteQrText as dx, MAX_SLOT_KNOCKS as dy, currentRelays as eC, TURN_SIGNED_BYTES as eS, HANDOFF_BUSY as e_, sparkInvoiceDetails as ea, isAppUrl as eb, PINNED_FRAME as ec, identityStatement as ed, peekDhtMailbox as ef, decodeControl as eg, CONNECT_TIMEOUT_MS as eh, checkDidSignature as ei, parseAppRangeFrame as el, cardLine as em, communityEditFrame as en, MAX_PAIRED_MESSAGE_FRAME as eo, LINK_TRAILING as ep, bip322ToSign as er, meshRendezvous as es, COMMUNITY_PROFILE as et, DOMAIN_MAX_RECORDS as eu, openHandoffPiece as ev, concatBytes as ew, INVITE_MAX_LENGTH as ex, newInbox as ey, readX401SdJwtVc as f, heldBackError as fC, signTurnBody as fS, HANDOFF_MANIFEST as f_, pubkyProofPath as fa, appRevocationId as fb, readPin as fc, PROOF_CAPABILITY as fd, RECORDING_TYPES as ff, parseRtcSignal as fg, directBlocked as fh, parseDidJws as fi, appDataBytes as fl, MESSAGE_CLOCK_SKEW_MS as fm, GROUP_META_PAST_CHARS as fn, UNPROVEN_AUTH_MS as fo, COMMUNITY_REACTION_FRAME as fp, encodeWitness as fr, mergeBeacon as fs, leaveStands as ft, normalizeDomain as fu, readHandoffTurnFrame as fv, __esmMin as fw, ownInviteRefusal as fx, REQUEST_CLOCK_SKEW_MS as fy, X401_LIMITS as g, PKARR_FUTURE_SKEW_MS as gC, turnKeys as gS, HANDOFF_PIECE_OVERHEAD as g_, pubkyHomeserverOf as ga, isAppKey as gb, WAKE_CALL_WAIT_MS as gc, emptyProofLedger as gd, downsamplePeaks as gf, RTC_CONFIG as gg, DHT_POLL_INTERVALS as gh, strictBase64Url as gi, isAppVersion as gl, receivedTimestamp as gm, MAX_GROUP_PICTURE_LENGTH as gn, pairedMessageFrame as go, REACTION_FRAME as gp, u32$1 as gr, rankHubs as gs, rosterHash as gt, recordsName as gu, sortParts as gv, DEVICE_CAPABILITIES as gx, REQUEST_PACKET_BYTES as gy, X401_HEADERS as h, MAX_DNS_PACKET_BYTES as hC, turnInstance as hS, HANDOFF_PIECE_BYTES as h_, homeserverWebEndpoint as ha, isAppHash as hb, WAKE_CALL_TTL_SECONDS as hc, STORAGE_ROOT as hd, baseMime as hf, PAIRED_CALL_CANDIDATES as hg, DEPARTED_READ_MS as hh, staticDidDocument as hi, chatAppId as hl, heardTime as hm, MAX_GROUP_NAME_LENGTH as hn, pairedMessageFits as ho, REACTED_FRAME as hp, txHash as hr, pickHubs as hs, leftStatement as ht, recordsFromWellKnown as hu, sealHandoffPiece as hv, __toCommonJS as hw, DEVICES_CAPABILITY as hx, REQUEST_NAME_UNITS as hy, x401ApprovalDigest as i, traceLink as iC, TurnRecordError as iS, HANDOFF_DATA as i_, PUBKY_PROOF_MAX_BYTES as ia, sha256Paced as ib, mayPin as ic, receivedIdentityStatus as id, readDhtFile as if, wrapDataChannel as ig, GATHER_STALL_MS as ih, didWebDocumentUrl as ii, APP_PEER_OPEN_MAX as il, checkStatusCard as im, validEditText as in, PONG_WAIT_MS as io, linksIn as ip, BitcoinAddressError as ir, COMMUNITY_TOPOLOGY as is, communityGroupId as it, WELL_KNOWN_PATH as iu, readHandoffData as iv, isZ32Key as iw, createLink as ix, turnOff as iy, readX401ProofResult as j, createIdentity as jC, DEFAULT_RELAYS as jS, handoffCancelFrame as j_, cashuRequestPayload as ja, isImageMime as jb, PUSH_SERVICE_HOSTS as jc, ringClaims as jd, isVideoMime as jf, signalHasVideo as jg, UNUSED_INVITE_READS_PER_MINUTE as jh, resolveDidDht as ji, SESSION_CAPABILITIES_FRAME as jl, parseGroupCommit as jm, parseGroupMetaStatement as jn, groupFileFallback as jo, PAIRED_REPLY_AUTHORS as jp, AtprotoCid as jr, decodeFileData as js, readKnocks as jt, emptyCapsState as ju, ENROLL_HELLO as jv, newDeviceSetSecret as jx, readKnockSlot as jy, readX401ProofResponse as k, readDnsName as kC, CHAT_RESERVE_PER_CHAT as kS, handoffAttemptSucceeded as k_, findBolt11 as ka, IMAGE_LIMITS as kb, wakePayload as kc, RING_LIFETIME as kd, formatVideoDuration as kf, pickCallCandidates as kg, STALLED_LOOK_MS as kh, jwkThumbprint as ki, REACTIONS_CAPABILITY as kl, commitUntaggedHash as km, parseGroupMetaBody as kn, GROUP_WANT_NO_FRAME as ko, validReactionNumber as kp, parseAtprotoDidDocument as kr, FILE_LIMITS as ks, knockRecords as kt, capsDescriptors as ku, ENROLL_DONE as kv, deviceLinkSecret as kx, mergeContactKnocks as ky, x401VpToken as l, RelayBreaker as lC, readTurnBody as lS, HANDOFF_HELLO as l_, normalizePubkyKey as la, appFingerprint as lb, pinIsNewer as lc, applyIdentityEvent as ld, sanitizeFileName as lf, buildDataSdp as lg, DIRECT_OWN_ATTEMPTS as lh, normalizeDid as li, APP_VERSION_MAX as ll, statusCardText as lm, validMentions as ln, RESUME_WAIT_MS as lo, forwardedAgain as lp, decodeTx as lr, hubRank as ls, decodeCommunityLink as lt, encodeDnsQuery as lu, readHandoffManifest as lv, utf8Decode as lw, inviteOwnership as lx, LINK_RECORD_LABEL as ly, x401HolderJwk as m, withRequestOptions as mC, signTurnRelease as mS, HANDOFF_PAKE as m_, encodeSvcbPacket as ma, checkAppRevokeStatement as mb, WAKE_CALL_INTERVAL_MS as mc, STORAGE_LIFETIME as md, VOICE_METER as mf, CALL_SIGNAL_MAX_AGE_MS as mg, AWAITING_PEER_MS as mh, signingKeys as mi, appOpenFrame as ml, claimedTime as mm, MAX_GROUP_NAME_BYTES as mn, WAKE_LOST_MS as mo, QUICK_REACTIONS as mp, sha256d as mr, newerHead as ms, leaveStatement3 as mt, recordsFromTxt as mu, sameDigest as mv, __require as mw, readInviteCode as mx, REQUEST_LIFETIME_MS as my, X401_RESPONSE_MODES as n, readRelayBody as nC, TURN_TTL as nS, HANDOFF_CANCEL as n_, BITCOIN_NETWORKS as na, readAppBundle as nb, PIN_FRAME as nc, isIdentityBinding as nd, dhtFileElements as nf, encodeControl as ng, DataLink as nh, didJwsAlg as ni, APP_DATA_MAX_BYTES as nl, cardTimeUtc as nm, meshMessageRef as nn, PAIRING_ATTEMPT_MS as no, linkEnd as np, decodeBase64 as nr, pickMeshHubs as ns, GROUP_READ_NOTE_COMMUNITY as nt, DOMAIN_TXT_MAX_BYTES as nu, readHandoffBusy as nv, fromBase64Url as nw, OwnInviteError as nx, settleRequest as ny, matchX401Dcql as o, BREAKER_BASE_MS as oC, firstDeviceSetSecret as oS, HANDOFF_FILE_MISSING as o_, isPubkyKey as oa, APP_NAME as ob, parsePinFrame as oc, signIdentityPresentation as od, PREVIEWABLE_IMAGE as of, DATA_CHANNEL_LABEL as og, REANSWERS as oh, didWebFileNames as oi, APP_RATE_WINDOW_MS as ol, removedCardText as om, MENTION_LIMITS as on, RACE_DIRECT_MS as oo, previewImageSize as op, compactSize as or, beaconRecords as os, communityMessageId as ot, dnsProofName as ou, readHandoffFileFrame as ov, toBase64 as ow, encodeGhostlyInvite as ox, ContactRequestError as oy, sameX401HolderJwk as p, isDiscoveryBudgetError as pC, signTurnPacket as pS, HANDOFF_OFFER as p_, decodeSvcbRecords as pa, appSignedBytes as pb, DEVICE_WAKE_TTL_SECONDS as pc, PeerProofs as pd, VOICE_LIMITS as pf, CALL_SIGNAL_FUTURE_MS as pg, symmetricNat as ph, parseDidSignaturePaste as pi, appDataFrame as pl, arrivalKey as pm, MAX_GROUP_META_BODY as pn, WAKE_ANSWER_GRACE_MS as po, GROUP_REACTION_FRAME as pp, hash160 as pr, mergeLobby as ps, leaveStatement as pt, parseDomainTxt as pu, readHandoffVerified as pv, __exportAll as pw, pastedAgain as px, REQUEST_LABEL as py, signAppStore as q, hasVisible as qC, SIGNALING_WINDOW_MS as qS, handoffRetryAfter as q_, FIRST_PAIRING_PACE_MS as qa, deviceInviteJoinerKeyZ32 as qb, appRangeDataFrame as qc, DHT_FILE_TOO_LARGE as qd, parseEditFrame as qf, isViewerTag as qg, webLocalFetch as qh, parsePaymentAmount as qi, HoldRefusedError as ql, newEpochSecret as qm, verifySshSignature as qn, groupSignalFrame as qo, ROUTINE_STATES as qp, DID_GHOSTLY_SERVICE as qr, parseTypingFrame as qs, chainPieces as qt, IDENTITY_SUBJECT as qu, MAX_MISSED as qv, TURN_LABEL as qx, appViewOf as qy, readX401OpenId4VpRequest as r, setLinkTraceSink as rC, TURN_VERSION as rS, HANDOFF_CANCEL_REASONS as r_, isBitcoinAddress as ra, readAppBundleAsync as rb, PIN_LIMITS as rc, newIdentityBinding as rd, dhtFileId as rf, sendBody as rg, GATHER_ATTEMPTS as rh, didSignedMessages as ri, APP_FRAME as rl, cardUrl as rm, parseCommunityEdit as rn, PAIRING_RETRY_MS as ro, linkStop as rp, verifyBip322 as rr, wireHubPolicy as rs, communityCommitHash as rt, NIP05_PATH as ru, readHandoffCancel as rv, fromZ32 as rw, createChatInvite as rx, takeRequest as ry, presentX401SdJwtVc as s, BREAKER_MAX_MS as sC, nextTurnPosition as sS, HANDOFF_FILE_REQUEST as s_, isPubkyProofFolder as sa, APP_PREFIXES as sb, parsePinnedFrame as sc, verifyIdentityPresentation as sd, formatFileSize as sf, RTC_SIGNAL_FUTURE_MS as sg, STALLED_EVIDENCE_MS as sh, didWebFileUrl as si, APP_RESUME_GRACE_MS as sl, sameButtonText as sm, mentionsBytes as sn, RACE_RELAYED_MS as so, sanitizePreviewImage as sp, decodeAnyBitcoinAddress as sr, doorHubs as ss, communityRoster as st, domainTxtRecord as su, readHandoffHave as sv, toBase64Url as sw, encodeInviteCode as sx, KNOCK_SLOTS as sy, X401_REQUEST_LIMITS as t, normalizeRelayUrl as tC, TURN_SLOTS as tS, HANDOFF_BUSY_REASONS as t_, sparkNetworkOf as ta, pacer as tb, PIN_CLOCK_SKEW_MS as tc, identityStatementText as td, DHT_FILE_CAPABILITY as tf, encodeChunk as tg, DATA_SETTLE_MS as th, didGhostlyServiceEntry as ti, readAppRangeFrame as tl, cardLinkHost as tm, communityMessageAuthor as tn, PAIRED_FRAME_TOO_LARGE as to, canonicalUrl as tp, bip322ToSpend as tr, parseHubPolicy as ts, CommunitySession as tt, DOMAIN_METHODS as tu, readHandoffAck as tv, fromBase64 as tw, INVITE_VERSION as tx, planKnocks as ty, X401_CREDENTIAL_LIMITS as u, DiscoveryBudgetError as uC, readTurnPacket as uS, HANDOFF_LATER_BYTES as u_, pubkyProofCapability as ua, appRef as ub, pinNumberHolds as uc, lastSharedWithMe as ud, sanitizeMime as uf, extractRtcParams as ug, DIRECT_PEERS as uh, parseDid as ui, AppSessions as ul, taskProgress as um, wireMentions as un, RTC_UNSTARTED_MS as uo, forwardedMany as up, decodeWitness as ur, lobbyKeys as us, derivedSecret as ut, isPublicAddress as uu, readHandoffPake as uv, utf8Encode as uw, inviteQrSegments as ux, MAX_SEEN as uy, X401_SCHEME as v, RELAY_PAYLOAD_MAX_BYTES as vC, turnPacket as vS, HANDOFF_REQUEST as v_, LNURL_LIMITS as va, isAppSignature as vb, WAKE_INTERVAL_MS as vc, isProofAdapter as vd, formatVoiceDuration as vf, buildSdpFromSignal as vg, FIRST_PUBLISH_MAX_MS as vh, DID_DHT_PREFIX as vi, parseAppFrame as vl, GROUP_ADMIN_OFF_ERROR as vm, groupDisplayName as vn, publishFailure as vo, ReactionWindow as vp, varBytes as vr, readBeaconHead as vs, signCommunity as vt, validDomainRecord as vu, SET_UPDATE as vv, DEVICE_PING_FRAME as vx, STAMP_BITS_DEFAULT as vy, decodeX401Header as w, readOwnRelayPayload as wC, turnVerifierMark as wS, filePartDigest as w_, parsePayParams as wa, signAppObject as wb, parseWakeFrame as wc, storageProofBody as wd, voiceLevel as wf, extractParamsFromSdp as wg, OFFER_STEP_MAX as wh, didDhtFromPublicKey as wi, EDIT_CAPABILITY as wl, MAX_GROUP_MEMBERS as wm, groupMetaToHand as wn, PairingTracker as wo, reactionEmoji as wp, atprotoProofRecord as wr, PairedCalls as ws, decodeGroupEntryLink as wt, CAPS_REFRESH_MS as wu, signTombstone as wv, deviceKeyZ32 as wx, knockSlotOf as wy, buildX401ProofResult as x, newerPacket as xC, turnSequence as xS, HANDOFF_VERSION as x_, invoiceCallbackUrl as xa, readAppRevocations as xb, WakeLimiter as xc, proofHash as xd, recordingMime as xf, compressSdp as xg, MAX_DHT_TEXT_BYTES as xh, DidDhtError as xi, APP_RANGES_CAPABILITY as xl, GROUP_VERSION_LARGE as xm, groupMetaNewer as xn, engineError as xo, parseReactionFrame as xp, ATPROTO_PROOF_COLLECTION as xr, validHead as xs, GROUP_ENTRY_PROFILE as xt, CAPS_LABEL as xu, setAckFrame as xv, deviceEchoFrame as xx, contactDay as xy, X401_VERSION as y, createRelayPayload as yC, turnPayloadSequence as yS, HANDOFF_TIMINGS as y_, fetchLnurlJson as ya, readAppRevocation as yb, WAKE_SUBJECT as yc, nostrProofTemplate as yd, isPlayableAudioType as yf, callRtcConfig as yg, IDLE_THRESHOLD as yh, DID_DHT_TTL as yi, readAppFrame as yl, GROUP_ID as ym, groupMetaBody as yn, ENGINE_ERRORS as yo, nextReactionNumber as yp, ATPROTO_DECLARED_SCOPE as yr, readLobby as ys, verifyCommunityChain as yt, wellKnownUrl as yu, encodeSetSlots as yv, ENROLL_CAPABILITY as yx, STAMP_BITS_MAX as yy, planAppUpdate as z, generateEncryptionKey as zC, HEDGE_MISSING_MS as zS, handoffFileRequestFrame as z_, BLOCKED_DIAL_WAIT_MS as za, CONTACT_LINK_VERSION as zb, vapidKeysMatch as zc, checkedDescriptors as zd, EDIT_SEND_LIMIT as zf, parseLinkRecords as zg, HttpHost as zh, TEST_USDT_FAUCET_AMOUNT as zi, PAIRED_PROFILE as zl, verifyCommitSignature as zm, SSH_PUBLIC_KEY_MAX as zn, GROUP_SIGNAL_FRAME as zo, ACTIVE_TASK_STATUSES as zp, parseAtprotoDidKey as zr, TYPING_RATE_WINDOW_MS as zs, groupWakes as zt, IDENTITY_MAX_EVIDENCE as zu, enrollMessage as zv, TURN_SETTLE_MS as zx, APP_CLIENTS as zy };
37498
+ export { COMMUNITY_LIMITS as $, decodeTxtPacket as $C, CHAT_RESERVE_MOST_SHARE as $S, handoffBusyFrame as $_, LIVENESS_MISSED_PINGS as $a, exifOrientation as $b, decodeAppRangeData as $c, DHT_TEXT_BYTES as $d, validEditMessage as $f, sdpHasCandidates as $g, UNUSED_INVITE_READS_PER_MINUTE as $h, isSparkAddress as $i, DNS_LABEL as $l, openPair as $m, MessageRefusal as $n, mayBeHub as $o, STATUS_CARD_LIMITS as $p, DidError as $r, typingKindOf as $s, GROUP_EDIT_TEXT_BYTES as $t, emptyIdentityLedger as $u, ENROLL_GRANT as $v, deviceLinkSecret as $x, openRequest as $y, readX401ProofResponseHeader as A, traceLink as AC, firstDeviceSetSecret as AS, HANDOFF_FILE_REQUEST as A_, findBolt11 as Aa, APP_PREFIXES as Ab, wakeFrame as Ac, verifyPeerProof as Ad, voicePeaksOf as Af, RTC_SIGNAL_FUTURE_MS as Ag, DIRECT_EVIDENCE_MS as Ah, jwkThumbprint as Ai, PIN_CAPABILITY as Al, MEMBER_KEY as Am, parseGroupMetaBody as An, GROUP_WANT_NO_FRAME as Ao, reactionIsNewer as Ap, parseAtprotoDidDocument as Ar, FILE_LIMITS as As, knockRecords as At, DHT_TEXT_CAPABILITY as Au, readHandoffHave as Av, isZ32Key as Aw, encodeGhostlyInvite as Ax, KNOCK_SLOTS as Ay, APP_STORE_KINDS as B, withRequestOptions as BC, turnKeys as BS, HANDOFF_RELEASE as B_, BLOCKED_DIAL_WAIT_MS as Ba, isAppRef as Bb, vapidAuthorization as Bc, TRANSPORTS as Bd, EDIT_FRAME as Bf, answersOffer as Bg, FIRST_PUBLISH_MAX_MS as Bh, TEST_USDT_FAUCET_AMOUNT as Bi, sessionCapabilitiesFrame as Bl, signCommit as Bm, SSH_PUBLIC_KEY_MAX as Bn, GROUP_SIGNAL_FRAME as Bo, readReply as Bp, parseAtprotoDidKey as Br, TYPING_RATE_LIMIT as Bs, groupWakes as Bt, IDENTITY_FRAME_WINDOW_MS as Bu, SET_ACK as Bv, __require as Bw, DEVICE_CAPABILITIES as Bx, REQUEST_TEXT_BYTES as By, buildX401TokenObject as C, WAY_BACK_SHARE as CC, TURN_SEALED_BYTES as CS, HANDOFF_BUSY as C_, parseInvoiceCallback as Ca, isAppUrl as Cb, WakeLimiter as Cc, proofHash as Cd, isPlayableAudioType as Cf, decodeControl as Cg, DATA_SETTLE_MS as Ch, decodeDidDhtPacket as Ci, APP_RANGES_CAPABILITY as Cl, GROUP_ADMIN_OFF_ERROR as Cm, groupMetaPicture as Cn, engineText as Co, nextReactionNumber as Cp, ATPROTO_PROOF_SCOPE as Cr, MAX_PAIRED_CALL_SIGNAL as Cs, KNOCK_TTL_MS as Ct, CAPS_LABEL as Cu, openHandoffPiece as Cv, trimEndOf as Cw, INVITE_LINK_ORIGIN as Cx, newInbox as Cy, readX401ProofRequest as D, readRelayBody as DC, TURN_VERSION as DS, HANDOFF_DATA as D_, resolveLightningDestination as Da, sha256Paced as Db, readWake as Dc, storageProofPath as Dd, voiceFileName as Df, wrapDataChannel as Dg, OFFER_HOST_GATHER_MS as Dh, didDhtRecords as Di, FILES_BINARY_CAPABILITY as Dl, LEGACY_GROUP_MEMBERS as Dm, keepPastGroupMeta as Dn, GROUP_HAVE_FRAME as Do, reactedFrame as Dp, checkAtprotoProofRecord as Dr, ChatFiles as Ds, entryParams as Dt, CapsExchange as Du, readHandoffData as Dv, fromBase64 as Dw, createChatInvite as Dx, turnOff as Dy, isX401Protocol as E, normalizeRelayUrl as EC, TURN_TTL as ES, HANDOFF_CANCEL_REASONS as E_, requestLnurlInvoice as Ea, readAppBundleAsync as Eb, parseWakeFrame as Ec, storageProofBody as Ed, voiceDownloadName as Ef, sendBody as Eg, GATHER_STALL_MS as Eh, didDhtKey as Ei, EDIT_CAPABILITY as El, GROUP_VERSION_LARGE as Em, groupName as En, GROUP_FILE_LIMITS as Eo, queueReaction as Ep, atprotoProofRkey as Er, parsePairedCallFrame as Es, encodeGroupEntryLink as Et, CAPS_REFRESH_MS as Eu, readHandoffCancel as Ev, concatBytes as Ew, OwnInviteError as Ex, takeRequest as Ey, appRevocationFor as F, RelayBreaker as FC, sealTurnBody as FS, HANDOFF_MANIFEST as F_, isFederationId as Fa, appRevocationId as Fb, checkPushEndpoint as Fc, validRingKey as Fd, isVideoMime as Ff, parseRtcSignal as Fg, symmetricNat as Fh, EVM_TEST_CHAINS as Fi, SessionCapabilities as Fl, expectedRoster as Fm, verifyGroupMetaSignature as Fn, readGroupHave as Fo, PAIRED_REPLY_AUTHORS as Fp, decodeAtprotoCommit as Fr, sentWhole as Fs, GROUP_WAKE_GROUP_WINDOW_MS as Ft, parsePacketTransports as Fu, readHandoffTurnFrame as Fv, utf8Decode as Fw, inviteQrText as Fx, REQUEST_CLOCK_SKEW_MS as Fy, readAppStore as G, createRelayPayload as GC, turnSequence as GS, HANDOFF_WINDOW as G_, DEMOTE_MS as Ga, readAppSignature as Gb, APP_RANGE_LIMITS as Gc, rankTransports as Gd, MAX_REMOVAL_NUMBER as Gf, contactRtcConfig as Gg, OFFER_LOOK_MS as Gh, assertWholeSats as Gi, HOLD_CAPABILITY as Gl, GROUP_PROFILE as Gm, sshFingerprint as Gn, SIGNAL_HOLD_MS as Go, BUTTON_STYLES as Gp, verifyAtprotoSignature as Gr, TYPING_TIMEOUT_MS as Gs, GROUP_READ_NOTE as Gt, IDENTITY_PROOF_CAPABILITY as Gu, setUpdateFrame as Gv, deviceEchoFrame as Gx, knockHolds as Gy, checkAppListing as H, PKARR_FUTURE_SKEW_MS as HC, turnPacket as HS, HANDOFF_TIMINGS as H_, CROSSED_PROBE_MS as Ha, readAppRevocation as Hb, APP_RANGE_DATA_KIND as Hc, checkedDescriptors as Hd, EDIT_RECEIVE_LIMIT as Hf, callRtcConfig as Hg, LinkSession as Hh, WALLET_NETWORKS as Hi, PairedSession as Hl, verifyChain as Hm, parseSshPublicKey as Hn, SIGNALS_PER_MINUTE as Ho, wireReply as Hp, readAtprotoCid as Hr, TYPING_REFRESH_MS as Hs, parseGroupWakeFrame as Ht, IDENTITY_MAX_FRAME as Hu, encodeSetSlots as Hv, DEVICE_PING_FRAME as Hx, STAMP_BITS_MAX as Hy, appStoreDecision as I, DiscoveryBudgetError as IC, signTurnBody as IS, HANDOFF_OFFER as I_, parseCashuRequestPayload as Ia, appSignedBytes as Ib, decryptPushPayload as Ic, verifyRingAuthorization as Id, parseVideoMeta as If, CALL_SIGNAL_FUTURE_MS as Ig, AWAITING_PEER_MS as Ih, ONCHAIN_PROVIDER as Ii, TYPING_CAPABILITY as Il, parseGroupCommit as Im, wrapGroupMeta as In, readGroupWant as Io, REPLY_ID as Ip, decodeDagCbor as Ir, transferEnded as Is, GROUP_WAKE_MEMBER_INTERVAL_MS as It, IDENTITY_CHALLENGE_WINDOW as Iu, readHandoffVerified as Iv, utf8Encode as Iw, ownInviteRefusal as Ix, REQUEST_LABEL as Iy, GROUP_TYPING_FRAME as J, openRelayPayload as JC, turnVerifierMark as JS, filePartName as J_, FIRST_PAIRING_PACE_MS as Ja, signAppRevocation as Jb, appRangeChunk as Jc, transportOrder as Jd, dhtEditId as Jf, heardCallSignal as Jg, PRESENCE_WINDOW as Jh, parsePaymentAmount as Ji, HoldKeys as Jl, decryptText as Jm, verifySshSignature as Jn, groupSignalFrame as Jo, PR_CHECKS as Jp, DID_GHOSTLY_SERVICE as Jr, parseTypingActivity as Js, chainPieces as Jt, IDENTITY_STATEMENT_PREFIX as Ju, verifySetUpdate as Jv, deviceKeyZ32 as Jx, knockSlotRecords as Jy, readAppStoreSteps as K, measureRecords as KC, turnSignedMessage as KS, NO_ATTEMPTS as K_, DHT_PIN_GRACE_MS as Ka, setAppSignatureFastPath as Kb, AppRanges as Kc, relayUrl as Kd, REMOVED_TEXT as Kf, decompressSdp as Kg, OFFER_STEP_MAX as Kh, formatPaymentAmount as Ki, HOLD_DATED_BACK_MS as Kl, confirmationMatches as Km, sshKeyDigestHex as Kn, SIGNAL_PROVEN_MS as Ko, CRON_LINE as Kp, DID_DOCUMENT_MAX_BYTES as Kr, TypingReceiver as Ks, GroupSession as Kt, IDENTITY_PROVIDER_ID as Ku, setUpdateMessage as Kv, deviceEchoNonce as Kx, knockSlotIdentity as Ky, appUpdateDecision as L, budgetRetryMs as LC, signTurnPacket as LS, HANDOFF_PAKE as L_, parseFedimintRequestPayload as La, checkAppRevokeStatement as Lb, encryptPushPayload as Lc, verifyRingEvidence as Ld, EDITED_FRAME as Lf, CALL_SIGNAL_MAX_AGE_MS as Lg, DEPARTED_READ_MS as Lh, PaymentPreflightError as Li, UPGRADE_CAPABILITY as Ll, rememberAlone as Lm, SSHSIG_MAX_ARMOR as Ln, readGroupWantNo as Lo, REPLY_LIMITS as Lp, encodeDagCbor as Lr, transferStalled as Ls, GROUP_WAKE_RECEIVE_LIMIT as Lt, IDENTITY_CHECK_UNAVAILABLE as Lu, sameDigest as Lv, __commonJSMin as Lw, pastedAgain as Lx, REQUEST_LIFETIME_MS as Ly, readX401ProofResultHeader as M, BREAKER_BASE_MS as MC, openTurnValue as MS, HANDOFF_HELLO as M_, cashuRequestPayload as Ma, appFingerprint as Mb, wakeRequest as Mc, ringAuthorization as Md, VIDEO_LIMITS as Mf, buildDataSdp as Mg, DIRECT_PEERS as Mh, resolveDidDht as Mi, SERVICES_CAPABILITY as Ml, SAID_AGAIN as Mm, parseGroupMetaStatement as Mn, groupFileFallback as Mo, readReaction as Mp, AtprotoCid as Mr, decodeFileData as Ms, readKnocks as Mt, dialDescriptors as Mu, readHandoffManifest as Mv, toBase64 as Mw, inviteLink as Mx, LINK_RECORD_LABEL as My, x401AnswerableRequests as N, BREAKER_MAX_MS as NC, readTurnBody as NS, HANDOFF_LATER_BYTES as N_, fedimintRequestPayload as Na, appRef as Nb, PUSH_SERVICE_HOSTS as Nc, ringClaims as Nd, formatVideoDuration as Nf, extractRtcParams as Ng, DirectPathWatch as Nh, signDidDhtPacket as Ni, SESSION_CAPABILITIES_FRAME as Nl, commitHash as Nm, parseGroupMetaTag as Nn, isGroupMessageId as No, validReactionNumber as Np, AtprotoProofError as Nr, encodeFileData as Ns, GROUP_WAKE_FRAME as Nt, emptyCapsState as Nu, readHandoffPake as Nv, toBase64Url as Nw, inviteOwnership as Nx, MAX_SEEN as Ny, readX401ProofRequestHeader as O, relayUrlProblem as OC, TurnRecordError as OS, HANDOFF_DONE as O_, BOLT11_PATTERN as Oa, yieldThread as Ob, readWakePayload as Oc, validExternalKey as Od, voiceLevel as Of, DATA_CHANNEL_ID as Og, REANSWERS as Oh, encodeDidDhtDeactivated as Oi, FILES_CAPABILITY as Ol, MAX_GROUP_CHAIN as Om, nextGroupMetaRevision as On, GROUP_VERSION_FILES as Oo, reactionEmoji as Op, isAtprotoDid as Or, FILE_DATA_KIND as Os, groupEntryUrl as Ot, CapsKeys as Ou, readHandoffDone as Ov, fromBase64Url as Ow, createLink as Ox, CONTACT_RECORD_TTL as Oy, addedAppPermissions as P, BREAKER_THRESHOLD as PC, readTurnPacket as PS, HANDOFF_LIST_PER_FRAME as P_, findEndpoint as Pa, appRefPublisher as Pb, WebPushError as Pc, ringEvidence as Pd, isPlayableVideoType as Pf, offerIsFresh as Pg, directBlocked as Ph, ETHEREUM_USDT as Pi, STATUS_CARD_CAPABILITY as Pl, commitUntaggedHash as Pm, signGroupMeta as Pn, readGroupFileMeta as Po, wireReaction as Pp, atprotoCidFor as Pr, refusalText as Ps, GROUP_WAKE_GROUP_LIMIT as Pt, encodePacketTransports as Pu, readHandoffRelease as Pv, toZ32 as Pw, inviteQrSegments as Px, MAX_SLOT_KNOCKS as Py, sealGroupTyping as Q, decodeDnsAnswers as QC, CHAT_RESERVE as QS, handoffAttemptSucceeded as Q_, INVITE_TAKEN as Qa, IMAGE_LIMITS as Qb, appRangeGetFrame as Qc, DHT_MESSAGE_TTL as Qd, parseEditedFrame as Qf, pickCallCandidates as Qg, TRANSPORTS_GONE_MS as Qh, SPARK_PROVIDER as Qi, readManifest as Ql, newEpochSecret as Qm, BIP322_REVISION as Qn, NO_HUB_POLICY as Qo, RUN_RESULTS as Qp, DID_METHODS as Qr, typingFrame as Qs, GROUP_EDIT_FRAME as Qt, boundVerifiedIdentity as Qu, ENROLL_DONE as Qv, deviceLinkSealKey as Qx, mergeContactKnocks as Qy, checkAppBeforeRun as R, heldBackError as RC, signTurnRelease as RS, HANDOFF_PIECE_BYTES as R_, ANSWERS_REFUSED_PAUSES as Ra, isAppHash as Rb, generateVapidKeys as Rc, RELAY_URL as Rd, EDIT_BUFFER_MAX as Rf, PAIRED_CALL_CANDIDATES as Rg, DHT_POLL_INTERVALS as Rh, SEPOLIA_TEST_USDT as Ri, WAKE_SESSION_CAPABILITY as Rl, rosterAdmin as Rm, SSHSIG_NAMESPACE as Rn, CARRIED_DEFER_MS as Ro, groupReplyAuthor as Rp, findInMst as Rr, TYPING_FRAME as Rs, GroupWakeLimiter as Rt, IDENTITY_CLOCK_SKEW as Ru, sealHandoffPiece as Rv, __esmMin as Rw, readInviteCode as Rx, REQUEST_NAME_UNITS as Ry, buildX401ResultArtifact as S, WATCH_SHARE as SC, TURN_REV_LIMIT as SS, HANDOFF_ATTEMPTS as S_, invoiceCallbackUrl as Sa, isAppPath as Sb, WAKE_TTL_SECONDS as Sc, proofCapability as Sd, formatVoiceDuration as Sf, decodeChunk as Sg, CONNECT_TIMEOUT_MS as Sh, DidDhtError as Si, APPS_CAPABILITY as Sl, shownTime as Sm, groupMetaNewer as Sn, engineError as So, ReactionWindow as Sp, ATPROTO_PROOF_COLLECTION as Sr, validHead as Ss, GROUP_ENTRY_PROFILE as St, CAPS_ISSUED_BACK_MS as Su, newHandoffId as Sv, stripHidden as Sw, INVITE_HRP as Sx, inboxRecord as Sy, encodeX401Header as T, currentRelays as TC, TURN_SLOTS as TS, HANDOFF_CANCEL as T_, parsePayParams as Ta, readAppBundle as Tb, newWakeToken as Tc, storageProof as Td, recordingMime as Tf, encodeControl as Tg, GATHER_ATTEMPTS as Th, didDhtFromPublicKey as Ti, CALLS_CAPABILITY as Tl, GROUP_MEMBER_CAP as Tm, groupMetaToHand as Tn, PairingTracker as To, parseReactionFrame as Tp, atprotoProofRecord as Tr, PairedCalls as Ts, decodeGroupEntryLink as Tt, CAPS_PUBLISH_SPACING_MS as Tu, readHandoffBusy as Tv, bytesEqual as Tw, INVITE_VERSION as Tx, settleRequest as Ty, checkAppStoreIndex as U, PacketTooLargeError as UC, turnPayloadSequence as US, HANDOFF_VERIFIED as U_, CROSSED_WAIT_MS as Ua, readAppRevocationShape as Ub, APP_RANGE_ERRORS as Uc, irohDescriptor as Ud, EDIT_SEND_LIMIT as Uf, callSignalHeardAt as Ug, MAX_DHT_TEXT_BYTES as Uh, arkAddressPrefix as Ui, SESSION_FRAME_MAX as Ul, verifyCommit as Um, parseSshSignature as Un, SIGNAL_CARRIERS as Uo, ACTIVE_TASK_STATUSES as Up, unsignedCommitBytes as Ur, TYPING_SEND_LIMIT as Us, GROUP_LIMITS as Ut, IDENTITY_MAX_RECEIVED as Uu, readSetUpdate as Uv, ENROLL_CAPABILITY as Ux, STAMP_BITS_MIN as Uy, APP_STORE_LIMITS as V, MAX_DNS_PACKET_BYTES as VC, turnName as VS, HANDOFF_REQUEST as V_, CROSSED_FRESH_MS as Va, isAppSignature as Vb, vapidKeysMatch as Vc, automaticTransport as Vd, EDIT_RATE_WINDOW_MS as Vf, buildSdpFromSignal as Vg, IDLE_THRESHOLD as Vh, USDT_PUBLIC_RPC as Vi, PAIRED_PROFILE as Vl, sortRoster as Vm, SshSigError as Vn, GROUP_VERSION_SIGNALS as Vo, replySnippet as Vp, parseAtprotoVerificationKey as Vr, TYPING_RATE_WINDOW_MS as Vs, mentionedMembers as Vt, IDENTITY_MAX_EVIDENCE as Vu, SET_UPDATE as Vv, __toCommonJS as Vw, DEVICE_ECHO_FRAME as Vx, STAMP_BITS_DEFAULT as Vy, readAppListing as W, RELAY_PAYLOAD_MAX_BYTES as WC, turnReleaseMessage as WS, HANDOFF_VERSION as W_, DEMOTE_AFTER_FAILURES as Wa, readAppRevocations as Wb, APP_RANGE_FRAMES as Wc, irohRelayUrl as Wd, MAX_EDITS_PER_MESSAGE as Wf, compressSdp as Wg, OFFER_FAST_MS as Wh, assertTokenUnits as Wi, SESSION_RECEIVE_PENDING as Wl, verifyCommitSignature as Wm, sameSshKey as Wn, SIGNAL_FRESH_MS as Wo, BUTTON_ID as Wp, verifyAtprotoRecordProof as Wr, TYPING_STATUS_MAX as Ws, GROUP_REACTED_FRAME as Wt, IDENTITY_MAX_VALIDITY as Wu, setAckFrame as Wv, HANDOFF_CAPABILITY as Wx, contactDay as Wy, groupTypingEpoch as X, readOwnRelayPayload as XC, BACKGROUND_WHILE_SIGNALING as XS, handoffAttemptAllowed as X_, HANDLED_WAIT_MS as Xa, verifyAppSignature as Xb, appRangeEndFrame as Xc, DHT_FILE_REFUSED as Xd, editedFrame as Xf, keepsToRelays as Xg, SIGNAL_OUT_READS as Xh, walletNetworkOf as Xi, isHoldUrl as Xl, encryptText as Xm, legacyMessageHash as Xn, GROUP_VERSION_HUBS as Xo, REMOVABLE_KINDS as Xp, DID_JWS_MAX_LENGTH as Xr, sanitizeTypingStatus as Xs, groupMessageId as Xt, IdentityCheckUnavailable as Xu, ENROLL_CANCEL as Xv, deviceLinkParams as Xx, makeStamp as Xy, GroupTypingBoard as Y, parseRelayPayload as YC, BACKGROUND_REQUESTS_PER_MINUTE as YS, handoffAckFrame as Y_, GhostLink as Ya, verifyAppRevocation as Yb, appRangeDataFrame as Yc, ACTIVE_DHT_POLL_MS as Yd, editFrame as Yf, isGlobalIpv4Host as Yg, RELAY_POLL_INTERVALS as Yh, validatePaymentTarget as Yi, HoldRefusedError as Yl, edgeParams as Ym, isLegacySignature as Yn, readGroupSignal as Yo, PR_STATES as Yp, DID_JWS_ALGS as Yr, parseTypingFrame as Ys, frameBytes as Yt, IDENTITY_SUBJECT as Yu, DEVICE_KINDS as Yv, deviceLinkPairing as Yx, linkRecords as Yy, openGroupTyping as Z, signRelayPayload as ZC, BACKGROUND_WRITES_SHARE as ZS, handoffAttemptFailed as Z_, INVITER_DIAL_GRACE_MS as Za, verifyAppStatementBytes as Zb, appRangeErrorFrame as Zc, DHT_FILE_TOO_LARGE as Zd, parseEditFrame as Zf, parseCallSignal as Zg, STALLED_LOOK_MS as Zh, SPARK_NETWORKS as Zi, newMailbox as Zl, epochKeys as Zm, verifyBitcoinMessage as Zn, MESH_HUBS as Zo, ROUTINE_STATES as Zp, DID_MAX_LENGTH as Zr, typingActivity as Zs, COMMUNITY_EDIT_FRAME as Zt, IdentityExchange as Zu, ENROLL_CANCEL_REASONS as Zv, deviceLinkRendezvousSeed as Zx, makeStampPaced as Zy, X401_PROTOCOLS as _, SIGNALING_ALLOWANCE_SHARE as _C, TURN_LABEL as _S, serviceIdFromName as __, pubkyHomeserverOf as _a, assembleAppBundle as _b, WAKE_CALL_TTL_SECONDS as _c, STORAGE_ROOT as _d, VOICE_LIMITS as _f, CHUNK_FLAG_END as _g, ratchetRoot as _h, strictBase64Url as _i, chatAppId as _l, MESSAGE_CLOCK_SKEW_MS as _m, MAX_GROUP_PICTURE_LENGTH as _n, pairedMessageFrame as _o, GROUP_REACTION_FRAME as _p, u32$1 as _r, rankHubs as _s, shortHash as _t, recordsFromWellKnown as _u, handoffStreamKey as _v, sanitizeAvatar as _w, deviceInviteJoinerKeyZ32 as _x, MAX_WAITING as _y, X401_DCQL_LIMITS as a, GROUP_BURST_MS as aC, seedSigner as aS, buildLinkRecords as a_, PUBKY_PROOF_MAX_BYTES as aa, stampHolds as ab, PIN_LIMITS as ac, newIdentityBinding as ad, DHT_FILE_CAPABILITY as af, unusedInviteWait as ag, MAX_SKIP as ah, didWebDocumentUrl as ai, APP_FRAME as al, cardLine as am, validEditText as an, PONG_WAIT_MS as ao, canonicalUrl as ap, BitcoinAddressError as ar, COMMUNITY_TOPOLOGY as as, communityHasFrame as at, NIP05_PATH as au, handoffDoneFrame as av, identityFromSeedB64 as aw, canonicalJson as ax, enrollDoneFrame as ay, buildX401ProofRequest as b, SLOW_MS as bC, TURN_NAME_BYTES as bS, viewerTag as b_, fetchLnurlJson as ba, findAppForbiddenKey as bb, WAKE_INTERVAL_MS as bc, isProofAdapter as bd, downsamplePeaks as bf, MAX_CHUNK_PAYLOAD_BYTES as bg, ratchetUnknownSession as bh, DID_DHT_TTL as bi, parseAppFrame as bl, heardTime as bm, groupMetaBody as bn, ENGINE_ERRORS as bo, REACTION_FRAME as bp, ATPROTO_DECLARED_SCOPE as br, readLobby as bs, verifyCommunityChainPaced as bt, validDomainRecord as bu, handoffVersions as bv, sanitizeDisplayText as bw, readDeviceInvite as bx, clearMissed as by, readX401DcqlQuery as c, GROUP_RATION_WINDOW_MS as cC, TURN_RAISE_READ_TIMEOUT_MS as cS, parseLinkRecords as c_, isPubkyProofFolder as ca, APP_CLIENTS as cb, parsePinFrame as cc, signIdentityPresentation as cd, readDhtFile as cf, HttpHost as cg, RATCHET_HEADER_BYTES as ch, didWebFileUrl as ci, APP_RATE_WINDOW_MS as cl, cardUrl as cm, mentionsBytes as cn, RACE_RELAYED_MS as co, linksIn as cp, decodeAnyBitcoinAddress as cr, doorHubs as cs, communityUntaggedHash as ct, dnsProofName as cu, handoffFileRequestFrame as cv, verify as cw, CONTACT_LINK_BYTES as cx, enrollMessage as cy, newX401HolderKey as d, HEDGE_MS as dC, classifyTurnRead as dS, MAX_SERVICES as d_, pubkyProofCapability as da, APP_ICON_PATH as db, pinIsNewer as dc, applyIdentityEvent as dd, formatFileSize as df, relativizeLocation as dg, RatchetBox as dh, parseDid as di, APP_VERSION_MAX as dl, removedCardText as dm, wireMentions as dn, RTC_UNSTARTED_MS as do, sanitizePreviewImage as dp, decodeWitness as dr, lobbyKeys as ds, encodeCommunityLink as dt, encodeDnsQuery as du, handoffManifestFrames as dv, generateEncryptionKey as dw, encodeContactLink as dx, readEnrollGrant as dy, CHAT_RESERVE_PER_CHAT as eC, devicePingFrame as eS, signalHasVideo as e_, sparkAddressKind as ea, readKnockSlot as eb, COMMUNITY_PIN_FRAME as ec, identityPresentationBytes as ed, DHT_TEXT_REFUSED as ef, UNUSED_INVITE_UPKEEP_MS as eg, openSecret as eh, checkDidJws as ei, encodeAppRangeData as el, TASK_STATUSES as em, carryMentions as en, LIVENESS_PING_MS as eo, validEditNumber as ep, bip322MessageHash as er, meshHubs as es, COMMUNITY_PROFILE as et, DNS_TYPE as eu, handoffCancelFrame as ev, encodeTxtPacket as ew, imageSize as ex, ENROLL_HELLO as ey, readX401SdJwtVc as f, PREVIOUS_DEFAULT_RELAYS as fC, keptAtEqualSequence as fS, SERVICES_VERSION as f_, pubkyProofFile as fa, APP_PERMISSIONS as fb, pinNumberHolds as fc, lastSharedWithMe as fd, safeBlobType as ff, resolveTargetUrl as fg, emptyRatchetState as fh, parseDidDocument as fi, AppSessions as fl, sameButtonText as fm, GROUP_META_PAST as fn, SWITCH_RETIRE_MS as fo, FORWARD_LIMITS as fp, encodeTx as fr, lobbyRecords as fs, leaveStands as ft, isPublicAddress as fu, handoffOfferFrame as fv, sealedLength as fw, readContactLink as fx, readEnrollHello as fy, X401_LIMITS as g, RelaysFailedError as gC, TURN_BODY_BYTES as gS, isViewerTag as g_, homeserverWebEndpoint as ga, appViewOf as gb, WAKE_CALL_INTERVAL_MS as gc, STORAGE_LIFETIME as gd, RECORDING_TYPES as gf, webLocalFetch as gg, ratchetOpen as gh, staticDidDocument as gi, appOpenFrame as gl, usageLeft as gm, MAX_GROUP_NAME_LENGTH as gn, pairedMessageFits as go, COMMUNITY_REACTION_FRAME as gp, txHash as gr, pickHubs as gs, rosterHash as gt, recordsFromTxt as gu, handoffRetryAfter as gv, jpegSize$1 as gw, createDeviceInvite as gx, MAX_MISSED as gy, X401_HEADERS as h, RelayTransport as hC, TOMBSTONE_TURN as hS, isValidServiceId as h_, encodeSvcbPacket as ha, appDigest as hb, DEVICE_WAKE_TTL_SECONDS as hc, PeerProofs as hd, PLAYABLE_AUDIO as hf, viewerResponseHeaders as hg, ratchetOn as hh, signingKeys as hi, appDataFrame as hl, taskProgress as hm, MAX_GROUP_NAME_BYTES as hn, WAKE_LOST_MS as ho, readForwarded as hp, sha256d as hr, newerHead as hs, leftStatement as ht, parseDomainTxt as hu, handoffRequestFrame as hv, MAX_AVATAR_SIDE as hw, DEVICE_INVITE_OWN_DEVICE as hx, MAX_DONE as hy, x401ApprovalDigest as i, FRESH_READ_MS as iC, verifyDeviceTransports as iS, RECORD_TTL as i_, isBitcoinAddress as ia, seenEntry as ib, PIN_FRAME as ic, isIdentityBinding as id, peekDhtMailbox as if, presenceSeenAt as ig, FOLLOW_MS as ih, didSignedMessages as ii, APP_DATA_MAX_BYTES as il, cardEditNumber as im, parseCommunityEdit as in, PAIRING_RETRY_MS as io, LINK_TRAILING as ip, verifyBip322 as ir, wireHubPolicy as is, communityGroupId as it, DOMAIN_TXT_MAX_BYTES as iu, handoffDigest as iv, identityFromSeed as iw, readImageMeta as ix, enrollDigits as iy, readX401ProofResult as j, BREAKER_ALL_DOWN_PROBE_MS as jC, nextTurnPosition as jS, HANDOFF_HAVE as j_, ENDPOINT as ja, APP_STATEMENT_LIMITS as jb, wakePayload as jc, RING_LIFETIME as jd, PLAYABLE_VIDEO as jf, RTC_SIGNAL_MAX_AGE_MS as jg, DIRECT_OWN_ATTEMPTS as jh, openDidDhtPayload as ji, REACTIONS_CAPABILITY as jl, OWN_FRAME_LIMIT as jm, parseGroupMetaFrame as jn, fetchesByItself as jo, readDhtReactions as jp, shortAtprotoDid as jr, FileUplink as js, mergeKnocks as jt, capsDescriptors as ju, readHandoffHello as jv, randomBytes as jw, encodeInviteCode as jx, KNOCK_SLOT_LABEL as jy, readX401ProofResponse as k, setLinkTraceSink as kC, encodeTurnFields as kS, HANDOFF_FILE_MISSING as k_, decodeBolt11 as ka, APP_NAME as kb, relayRequest as kc, verifyNostrProof as kd, voiceLevelsOf as kf, DATA_CHANNEL_LABEL as kg, STALLED_EVIDENCE_MS as kh, encodeDidDhtPacket as ki, KNOWN_SESSION_CAPABILITIES as kl, MAX_GROUP_MEMBERS as km, openGroupMeta as kn, GROUP_WANT_FRAME as ko, reactionFrame as kp, normalizeAtprotoHandle as kr, FILE_FRAMES as ks, knockIdentity as kt, CapsRefusedError as ku, readHandoffFileFrame as kv, fromZ32 as kw, decodeInviteCode as kx, ContactRequestError as ky, x401VpToken as l, GROUP_SIGNALING_ALLOWANCE_SHARE as lC, TURN_SETTLE_MS as lS, HTTP_SERVICE_PROTO as l_, newPubkyProofFolder as la, APP_CLIENT_NAME as lb, parsePinnedFrame as lc, verifyIdentityPresentation as ld, FileTransfers as lf, formatLocalTarget as lg, RATCHET_KEEP_MS as lh, didWebHost as li, APP_RESUME_GRACE_MS as ll, checkStatusCard as lm, mentionsMember as ln, REDESCRIBED_GRACE_MS as lo, parseLinkPreview as lp, decodeBitcoinAddress as lr, freshHubs as ls, decodeCommunityLink as lt, domainTxtRecord as lu, handoffHaveFrames as lv, decrypt as lw, CONTACT_LINK_VERSION as lx, enrollProofFrame as ly, x401HolderJwk as m, REQUESTS_PER_MINUTE as mC, TOMBSTONE_SEQUENCE as mS, encodeServices as m_, decodeSvcbRecords as ma, APP_VIEWS as mb, readPin as mc, PROOF_CAPABILITY as md, sanitizeMime as mf, sanitizeResponseHeaders as mg, ratchetHeard as mh, parseDidSignaturePaste as mi, appDataBytes as ml, statusCardText as mm, MAX_GROUP_META_BODY as mn, WAKE_ANSWER_GRACE_MS as mo, forwardedMany as mp, hash160 as mr, mergeLobby as ms, leaveStatement3 as mt, normalizeDomain as mu, handoffReleaseFrame as mv, MAX_AVATAR_LENGTH as mw, DEVICE_INVITE_LIFETIME_S as mx, FLOOD_PER_DAY as my, X401_RESPONSE_MODES as n, DEFAULT_RELAYS as nC, signDeviceTransports as nS, LABEL$1 as n_, sparkNetworkOf as na, requestPlaintextBytes as nb, PINNED_FRAME as nc, identityStatement as nd, LIVE_POLL_MS as nf, WATCH_PEER_MS as ng, sealSecret as nh, didGhostlyServiceEntry as ni, parseAppRangeFrame as nl, appCardUrl as nm, communityMessageAuthor as nn, PAIRED_FRAME_TOO_LARGE as no, LINK_MAX_CHARS as np, bip322ToSpend as nr, parseHubPolicy as ns, GROUP_READ_NOTE_COMMUNITY as nt, DOMAIN_MAX_RECORDS as nu, handoffContextProof as nv, IDENTITY_MEMO_SIZE as nw, parseImageMeta as nx, enrollCancelFrame as ny, matchX401Dcql as o, GROUP_BURST_ONE_LINK as oC, webCryptoSigner as oS, emptyLinkRecords as o_, PUBKY_PROOF_ROOT as oa, APP_BUNDLE_LIMITS as ob, mayPin as oc, receivedIdentityStatus as od, dhtFileElements as of, GhostlyHttpError as og, MAX_SKIPPED_KEYS as oh, didWebFile as oi, APP_PEER_OPEN_MAX as ol, cardLinkHost as om, MENTION_EVERYONE as on, RACE_ANSWERED_MS as oo, linkEnd as op, ByteReader as or, beaconKeys as os, communityMessageId as ot, WELL_KNOWN_PATH as ou, handoffEphemeral as ov, publicKeyFromZ32 as ow, canonicalJsonBytes as ox, enrollGrantFrame as oy, sameX401HolderJwk as p, RELAY_REQUESTS_PER_MINUTE as pC, turnPutSummary as pS, decodeServices as p_, pubkyProofPath as pa, APP_SCREENSHOTS_DIR as pb, pinnedFrame as pc, PROOF_ADAPTERS as pd, sanitizeFileName as pf, sanitizeRequestHeaders as pg, isRatcheted as ph, parseDidJws as pi, appCloseFrame as pl, statusCardBytes as pm, GROUP_META_PAST_CHARS as pn, UNPROVEN_AUTH_MS as po, forwardedAgain as pp, encodeWitness as pr, mergeBeacon as ps, leaveStatement as pt, nip05RootKey as pu, handoffPakeFrame as pv, tryDecrypt as pw, DEVICE_INVITE_BYTES as px, verifyEnrollProof as py, signAppStore as q, newerPacket as qC, turnStatedVerifier as qS, filePartDigest as q_, EARLY_DIAL_JOIN_MS as qa, signAppObject as qb, appRangeCancelFrame as qc, relayedTransports as qd, RateWindow as qf, extractParamsFromSdp as qg, PRESENCE_HEARTBEAT as qh, isWalletNetwork as qi, HOLD_LIMITS as ql, confirmationTag as qm, sshSignCommand as qn, SIGNAL_REPLY_MS as qo, ITEM_STATES as qp, DID_FILE_MAX_BYTES as qr, TypingSender as qs, asWritten as qt, IDENTITY_REVOCATION_LABEL as qu, signTombstone as qv, deviceFrameCapability as qx, knockSlotOf as qy, readX401OpenId4VpRequest as r, DEPARTED_READS as rC, unsignedDeviceTransports as rS, MAX_MSGS_PAYLOAD_B64 as r_, BITCOIN_NETWORKS as ra, requestRecords as rb, PIN_CLOCK_SKEW_MS as rc, identityStatementText as rd, emptyDhtDeliveryState as rf, countUnusedInvite as rg, sha256Hex as rh, didJwsAlg as ri, readAppRangeFrame as rl, buttonLabelClash as rm, meshMessageRef as rn, PAIRING_ATTEMPT_MS as ro, LINK_PREVIEW_LIMITS as rp, decodeBase64 as rr, pickMeshHubs as rs, communityCommitHash as rt, DOMAIN_METHODS as ru, handoffDataFrame as rv, createIdentity as rw, previewable as rx, enrollCancelReason as ry, presentX401SdJwtVc as s, GROUP_OVER_PACE_MS as sC, TURN_PUT_WINDOW_MS as sS, isEmptyLinkPacket as s_, isPubkyKey as sa, APP_BUNDLE_MAGIC as sb, nextPinNumber as sc, revokesIdentity as sd, dhtFileId as sf, HttpClient as sg, RATCHET_CAPABILITY as sh, didWebFileNames as si, APP_RATE_LIMIT as sl, cardTimeUtc as sm, MENTION_LIMITS as sn, RACE_DIRECT_MS as so, linkStop as sp, compactSize as sr, beaconRecords as ss, communityRoster as st, decodeDnsResponse as su, handoffFileMissingFrame as sv, sign as sw, readCanonicalJson as sx, enrollHelloFrame as sy, X401_REQUEST_LIMITS as t, CHAT_WATCH_SHARE as tC, newDeviceSetSecret as tS, waitForIceGathering as t_, sparkInvoiceDetails as ta, readLinkRecord as tb, GROUP_PIN_FRAME as tc, identityRevocationValue as td, DhtDelivery as tf, UNUSED_INVITE_WAIT_MAX_MS as tg, sealPair as th, checkDidSignature as ti, isServeId as tl, appCardId as tm, communityEditFrame as tn, MAX_PAIRED_MESSAGE_FRAME as to, validRemovalNumber as tp, bip322ToSign as tr, meshRendezvous as ts, CommunitySession as tt, DOMAIN_FILE_MAX_BYTES as tu, handoffContext as tv, readDnsName as tw, isImageMime as tx, ENROLL_PROOF as ty, X401_CREDENTIAL_LIMITS as u, HEDGE_MISSING_MS as uC, TURN_VISIBLE_MS as uS, LEGACY_SERVICES as u_, normalizePubkyKey as ua, APP_FORBIDDEN_KEYS as ub, pinFrame as uc, IDENTITY_TIMELINE_MAX as ud, PREVIEWABLE_IMAGE as uf, parseLocalTarget as ug, RATCHET_OVERHEAD as uh, normalizeDid as ui, APP_SEND_LIMIT as ul, readStatusCard as um, validMentions as un, RESUME_WAIT_MS as uo, previewImageSize as up, decodeTx as ur, hubRank as us, derivedSecret as ut, domainWellKnownFile as uu, handoffHelloFrame as uv, encrypt as uw, createContactLink as ux, formatEnrollDigits as uy, X401_SCHEME as v, SIGNALING_WINDOW_MS as vC, TURN_LAST_SEQUENCE as vS, servicesFromWire as v_, LIGHTNING_DESTINATION_PATTERN as va, buildAppBundle as vb, WAKE_CALL_WAIT_MS as vc, emptyProofLedger as vd, VOICE_METER as vf, CHUNK_KIND as vg, ratchetSeal as vh, DID_DHT_MAX_PAYLOAD as vi, isAppVersion as vl, arrivalKey as vm, encodeGroupMetaBody as vn, parsePaymentNetworks as vo, QUICK_REACTIONS as vp, u64 as vr, readBeacon as vs, signCommunity as vt, recordsName as vu, handoffVerifiedFrame as vv, MAX_NICK_LENGTH as vw, deviceInviteJoinerParams as vx, NEW_PER_HOUR as vy, decodeX401Header as w, WRITE_FIRST_MS as wC, TURN_SIGNED_BYTES as wS, HANDOFF_BUSY_REASONS as w_, parseLightningDestination as wa, pacer as wb, deviceWakeRequest as wc, proofStatement as wd, parseVoiceMeta as wf, encodeChunk as wg, DataLink as wh, didDhtDocument as wi, BUTTONS_CAPABILITY as wl, GROUP_ID as wm, groupMetaTag as wn, parseEngineError as wo, parseReactedFrame as wp, atprotoDidMethod as wr, PAIRED_CALL_FRAME as ws, MAX_KNOCKS as wt, CAPS_LIMITS as wu, readHandoffAck as wv, unwrapPasted as ww, INVITE_MAX_LENGTH as wx, planKnocks as wy, buildX401ProofResult as x, TURN_SOURCE_TIMEOUT_MS as xC, TURN_NO_ACTIVE as xS, HANDOFF_ACK as x_, findLightningDestination as xa, isAppLicense as xb, WAKE_SUBJECT as xc, nostrProofTemplate as xd, fileMessageText as xf, PROTOCOL_VERSION as xg, ANSWER_REFUSED_REDIALS as xh, DID_DHT_VERSION as xi, readAppFrame as xl, receivedTimestamp as xm, groupMetaChange as xn, EngineError as xo, REACTION_LIMITS as xp, ATPROTO_FULL_SCOPE as xr, shouldBeHub as xs, verifyCommunityCommit as xt, wellKnownUrl as xu, isHandoffPartName as xv, sanitizeNick as xw, DEVICE_INVITE_VERSION as xx, endedRequests as xy, X401_VERSION as y, SLOW_DEMOTE_MS as yC, TURN_MAX as yS, servicesToWire as y_, LNURL_LIMITS as ya, checkAppManifest as yb, WAKE_FRAME as yc, importedProof as yd, baseMime as yf, LIMITS as yg, ratchetSessionOf as yh, DID_DHT_PREFIX as yi, isChatAppId as yl, claimedTime as ym, groupDisplayName as yn, publishFailure as yo, REACTED_FRAME as yp, varBytes as yr, readBeaconHead as ys, verifyCommunityChain as yt, txtValue as yu, handoffVerifiedMessage as yv, hasVisible as yw, encodeDeviceInvite as yx, REOPEN_BELOW as yy, planAppUpdate as z, isDiscoveryBudgetError as zC, turnInstance as zS, HANDOFF_PIECE_OVERHEAD as z_, ANSWERS_REFUSED_PAUSE_MS as za, isAppKey as zb, pushRequest as zc, RELAY_WITH_SECRETS as zd, EDIT_BUFFER_MS as zf, RTC_CONFIG as zg, EXPECT_PEER_MS as zh, SEPOLIA_TEST_USDT_FAUCET as zi, parseSessionCapabilities as zl, rosterHas as zm, SSH_KEY_TYPES as zn, CarriedTransport as zo, pairedReplyAuthor as zp, parseAtprotoCar as zr, TYPING_KINDS as zs, groupWakeFrame as zt, IDENTITY_FRAME_LIMIT as zu, sortParts as zv, __exportAll as zw, DEVICES_CAPABILITY as zx, REQUEST_PACKET_BYTES as zy };
36548
37499
 
36549
- //# sourceMappingURL=src-B5uLojgn.js.map
37500
+ //# sourceMappingURL=src-DytzSJB6.js.map