@ghostlytools/cli 1.7.0 → 1.7.2

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 (90) hide show
  1. package/README.md +22 -12
  2. package/dist/assets/{api-BnCmJLiQ.js → api-CcuCtc1H.js} +2 -2
  3. package/dist/assets/{api-BIqr8SpM.js → api-tSZELCPQ.js} +133 -40
  4. package/dist/assets/api-tSZELCPQ.js.map +1 -0
  5. package/dist/assets/{apiKit-CWalYh1t.js → apiKit-BFk7GAk9.js} +9 -5
  6. package/dist/assets/{apiKit-CWalYh1t.js.map → apiKit-BFk7GAk9.js.map} +1 -1
  7. package/dist/assets/{apps-Bx3tXbJ9.js → apps-C5Mi6x9Q.js} +36 -13
  8. package/dist/assets/apps-C5Mi6x9Q.js.map +1 -0
  9. package/dist/assets/{apps-_hVUaHIT.js → apps-D6THreq_.js} +1 -1
  10. package/dist/assets/{arkade-AxrcyS1C.js → arkade-Cz0B9bJ0.js} +2 -2
  11. package/dist/assets/{arkade-AxrcyS1C.js.map → arkade-Cz0B9bJ0.js.map} +1 -1
  12. package/dist/assets/{backup-d_XvXpEK.js → backup-A0hIa9GE.js} +1 -1
  13. package/dist/assets/{backup-Y1V1Yxqr.js → backup-Wb2sm2dd.js} +6 -6
  14. package/dist/assets/{backup-Y1V1Yxqr.js.map → backup-Wb2sm2dd.js.map} +1 -1
  15. package/dist/assets/{blobFiles-B6nf0gCG.js → blobFiles-Bckz9fjp.js} +2 -2
  16. package/dist/assets/{blobFiles-B6nf0gCG.js.map → blobFiles-Bckz9fjp.js.map} +1 -1
  17. package/dist/assets/buttons-Bxxu3lSk.js +2 -0
  18. package/dist/assets/{buttons-BiQyQBb0.js → buttons-Cf70NVYq.js} +12 -7
  19. package/dist/assets/buttons-Cf70NVYq.js.map +1 -0
  20. package/dist/assets/{daemonProof-ui8jtIw0.js → daemonProof-Bp9lJDxf.js} +2 -2
  21. package/dist/assets/{daemonProof-ui8jtIw0.js.map → daemonProof-Bp9lJDxf.js.map} +1 -1
  22. package/dist/assets/{envelope-D3oeVhv8.js → envelope-kQ5kYjVE.js} +2 -2
  23. package/dist/assets/{envelope-D3oeVhv8.js.map → envelope-kQ5kYjVE.js.map} +1 -1
  24. package/dist/assets/{errors-CzXgR8Cc.js → errors-mnjSQlbX.js} +2 -1
  25. package/dist/assets/errors-mnjSQlbX.js.map +1 -0
  26. package/dist/assets/{fileBytes-BMEBas7S.js → fileBytes-BD0v3rRG.js} +10 -2
  27. package/dist/assets/{fileBytes-BMEBas7S.js.map → fileBytes-BD0v3rRG.js.map} +1 -1
  28. package/dist/assets/{fileBytes-CtwagJ8h.js → fileBytes-OolN5cSY.js} +1 -1
  29. package/dist/assets/{fileBytes-CFNrRfcl.js → fileBytes-_fd-2JRY.js} +2 -2
  30. package/dist/assets/{fileBytes-CFNrRfcl.js.map → fileBytes-_fd-2JRY.js.map} +1 -1
  31. package/dist/assets/fileBytesIdb-CsSQcSxD.js +2 -0
  32. package/dist/assets/{fileBytesIdb-BXAN7i-N.js → fileBytesIdb-NtA8r9EM.js} +2 -2
  33. package/dist/assets/{fileBytesIdb-BXAN7i-N.js.map → fileBytesIdb-NtA8r9EM.js.map} +1 -1
  34. package/dist/assets/{fileBytesOpfs-Do1Vpkis.js → fileBytesOpfs-B8fJwkwM.js} +3 -3
  35. package/dist/assets/{fileBytesOpfs-Do1Vpkis.js.map → fileBytesOpfs-B8fJwkwM.js.map} +1 -1
  36. package/dist/assets/{ghostly_iroh_web-BXCsSxxo.js → ghostly_iroh_web-CO0onry8.js} +33 -27
  37. package/dist/assets/ghostly_iroh_web-CO0onry8.js.map +1 -0
  38. package/dist/assets/ghostly_iroh_web_bg.wasm +0 -0
  39. package/dist/assets/{groupFiles-DU1wMGI9.js → groupFiles-D9Ttlm3M.js} +41 -25
  40. package/dist/assets/groupFiles-D9Ttlm3M.js.map +1 -0
  41. package/dist/assets/{host-DDMQfR7B.js → host-DpypH-fR.js} +44 -21
  42. package/dist/assets/host-DpypH-fR.js.map +1 -0
  43. package/dist/assets/{hyperdhtRelay-B2v8eqRd.js → hyperdhtRelay-D1rj84v2.js} +2 -2
  44. package/dist/assets/{hyperdhtRelay-B2v8eqRd.js.map → hyperdhtRelay-D1rj84v2.js.map} +1 -1
  45. package/dist/assets/{irohWeb-9RVIbF_l.js → irohWeb-BTSlWgEX.js} +3 -3
  46. package/dist/assets/{irohWeb-9RVIbF_l.js.map → irohWeb-BTSlWgEX.js.map} +1 -1
  47. package/dist/assets/{main-BNwNEPEy.js → main-BwgoQZVu.js} +270 -97
  48. package/dist/assets/main-BwgoQZVu.js.map +1 -0
  49. package/dist/assets/{mainline-RXv5_Fby.js → mainline-B1urhbEZ.js} +27 -8
  50. package/dist/assets/mainline-B1urhbEZ.js.map +1 -0
  51. package/dist/assets/{networkReason-CIn4yN9h.js → networkReason-D2Z0BdIj.js} +2 -2
  52. package/dist/assets/{networkReason-CIn4yN9h.js.map → networkReason-D2Z0BdIj.js.map} +1 -1
  53. package/dist/assets/{nwc-BNPzuT-6.js → nwc-T2aUK6bi.js} +3 -3
  54. package/dist/assets/{nwc-BNPzuT-6.js.map → nwc-T2aUK6bi.js.map} +1 -1
  55. package/dist/assets/{nwcProvider-C9Y6PUNC.js → nwcProvider-Dz-ty_DE.js} +2 -2
  56. package/dist/assets/{nwcProvider-C9Y6PUNC.js.map → nwcProvider-Dz-ty_DE.js.map} +1 -1
  57. package/dist/assets/{profiles-CEnZfN78.js → profiles-C6XWqre5.js} +92 -20
  58. package/dist/assets/profiles-C6XWqre5.js.map +1 -0
  59. package/dist/assets/{registry-B9aYHNNf.js → registry-Bazitl0a.js} +3 -3
  60. package/dist/assets/{registry-B9aYHNNf.js.map → registry-Bazitl0a.js.map} +1 -1
  61. package/dist/assets/{registry-DOkDhUAu.js → registry-BlSTJlbv.js} +1 -1
  62. package/dist/assets/{resolve-imkCgogd.js → resolve-Bx1Eeg-w.js} +2 -2
  63. package/dist/assets/{resolve-imkCgogd.js.map → resolve-Bx1Eeg-w.js.map} +1 -1
  64. package/dist/assets/{server-CB9_JuWZ.js → server-CnPj9wWh.js} +661 -229
  65. package/dist/assets/server-CnPj9wWh.js.map +1 -0
  66. package/dist/assets/{src-BBG_NwMc.js → src-BsznF3XG.js} +305 -83
  67. package/dist/assets/src-BsznF3XG.js.map +1 -0
  68. package/dist/assets/{translate-BcP139SV.js → translate-cDBotA-b.js} +11 -11
  69. package/dist/assets/{translate-BcP139SV.js.map → translate-cDBotA-b.js.map} +1 -1
  70. package/dist/assets/types-C4_KafL_.js.map +1 -1
  71. package/dist/assets/{usdt-C5Gf9-IC.js → usdt-DxxLdG60.js} +3 -3
  72. package/dist/assets/{usdt-C5Gf9-IC.js.map → usdt-DxxLdG60.js.map} +1 -1
  73. package/dist/assets/{words-ZUiQo4yo.js → words-qH8gGtmc.js} +2 -2
  74. package/dist/assets/{words-ZUiQo4yo.js.map → words-qH8gGtmc.js.map} +1 -1
  75. package/dist/ghostly.mjs +1 -1
  76. package/package.json +1 -1
  77. package/dist/assets/api-BIqr8SpM.js.map +0 -1
  78. package/dist/assets/apps-Bx3tXbJ9.js.map +0 -1
  79. package/dist/assets/buttons-BiQyQBb0.js.map +0 -1
  80. package/dist/assets/buttons-LO3Ql1Hd.js +0 -2
  81. package/dist/assets/errors-CzXgR8Cc.js.map +0 -1
  82. package/dist/assets/fileBytesIdb-C20oXDdr.js +0 -2
  83. package/dist/assets/ghostly_iroh_web-BXCsSxxo.js.map +0 -1
  84. package/dist/assets/groupFiles-DU1wMGI9.js.map +0 -1
  85. package/dist/assets/host-DDMQfR7B.js.map +0 -1
  86. package/dist/assets/main-BNwNEPEy.js.map +0 -1
  87. package/dist/assets/mainline-RXv5_Fby.js.map +0 -1
  88. package/dist/assets/profiles-CEnZfN78.js.map +0 -1
  89. package/dist/assets/server-CB9_JuWZ.js.map +0 -1
  90. package/dist/assets/src-BBG_NwMc.js.map +0 -1
@@ -898,6 +898,8 @@ var isGroupRead = (who) => who.group && !who.write && !who.background;
898
898
  var isTurnRead = (who) => !who.write && !who.door && (who.background || !who.group);
899
899
  /** A write that goes first once the budget frees a request (see `WRITE_FIRST_MS`): a chat's or a group's, never a background one. */
900
900
  var firstWriter = (who) => !who.write || who.background ? null : who.group ? "group" : "chat";
901
+ /** A key's turn neither asked nor read in the last minute: it is dropped, and asking again starts a new one (`TURNS_PRUNE_MS`). */
902
+ var staleTurn = (turn, now) => now - Math.max(turn.askedAt, turn.servedAt) >= 6e4;
901
903
  /**
902
904
  * Public Pkarr relays. They are generic Pkarr infrastructure (an HTTP bridge to
903
905
  * the Mainline DHT), not a Ghostly backend: they only ever see signed,
@@ -1031,6 +1033,11 @@ var WATCH_TURN_MS = 5e3;
1031
1033
  */
1032
1034
  var READ_TURN_MS = 5e3;
1033
1035
  /**
1036
+ * The keys' turns asked and read over a minute ago are dropped at most this often: walking every key on each ask cost in
1037
+ * proportion to the chats, 12-14% of an idle web app's script with 200 chats.
1038
+ */
1039
+ var TURNS_PRUNE_MS = 1e3;
1040
+ /**
1034
1041
  * A 1:1 chat's read the budget held back this long without a break is starved: it goes before the writes that wait
1035
1042
  * (`WRITE_FIRST_MS`) and past the background share, within the minute, the key held back longest first. A daemon back
1036
1043
  * after a restart spends its whole minute on writes (each chat's and edge's offer, its packets after the attempt), which
@@ -1205,6 +1212,8 @@ var RelayTransport = class {
1205
1212
  readTurns = /* @__PURE__ */ new Map();
1206
1213
  /** Per key read in turn (`isTurnRead`), when a read of it last went out and when it last asked (`READ_TURN_MS`). */
1207
1214
  keyTurns = /* @__PURE__ */ new Map();
1215
+ /** When `readTurns` and `keyTurns` last dropped their stale turns (`TURNS_PRUNE_MS`). */
1216
+ turnsPrunedAt = /* @__PURE__ */ new Map();
1208
1217
  /** Groups' reads (not background ones) on each relay in the last `GROUP_RATION_WINDOW_MS`. */
1209
1218
  spentGroupReads = /* @__PURE__ */ new Map();
1210
1219
  /** When a group's read last found each relay's minute full: its reads there are rationed for `GROUP_RATION_MS`. */
@@ -1358,7 +1367,8 @@ var RelayTransport = class {
1358
1367
  * which this client has not read (an inviter's warm packet under the key it gave its contact, from a clock ahead of
1359
1368
  * this one). That packet is read from that relay, and the records go again dated just past it, once. Without this
1360
1369
  * the packet was refused until this device's clock passed the other one's, however long that took, and on a relay
1361
- * that did take it, readers still preferred the later-dated empty packet of another relay.
1370
+ * that did take it, readers still preferred the later-dated empty packet of another relay. `read`: how to learn the
1371
+ * held packet's date where it is not a relay to ask (the CLI's DHT, whose nodes answer 302 for a later-dated packet).
1362
1372
  */
1363
1373
  async publishDated(identity, records, put, options = {}, again = false, elsewhere = false) {
1364
1374
  const key = identity.pubKeyZ32;
@@ -1368,10 +1378,10 @@ var RelayTransport = class {
1368
1378
  }
1369
1379
  const timestamp = this.nextTimestamp(key);
1370
1380
  let redated;
1371
- const conflict = (relay) => {
1381
+ const conflict = (relay, read) => {
1372
1382
  if (again || redated) return;
1373
1383
  redated = (async () => {
1374
- const held = await this.heldAt(relay, key, asker(options, true));
1384
+ const held = read ? await read().catch(() => null) : await this.heldAt(relay, key, asker(options, true));
1375
1385
  if (held === null || held < timestamp) return false;
1376
1386
  traceLink(key, "publish-redated", {
1377
1387
  aheadMs: Number((held - timestamp) / 1000n),
@@ -1475,6 +1485,19 @@ var RelayTransport = class {
1475
1485
  await this.putRedated(pubKeyZ32, payload, seq, options, PAYLOAD_REDATES);
1476
1486
  }
1477
1487
  /**
1488
+ * A payload every relay's budget held back while another path took it (the CLI's DHT): the publish is out, and each
1489
+ * relay gets it once its budget frees a request for the same asker (`catchUpLater`), unless a newer packet of the key
1490
+ * goes there first. Retried by the link instead, each try was signed and put on the DHT again (1-1.6 puts a minute per
1491
+ * chat at budget, not one per 4 min). `timestamp`: its date when signed here; read from the payload otherwise.
1492
+ */
1493
+ putLater(pubKeyZ32, payload, timestamp, options = {}) {
1494
+ const at = timestamp ?? options.signedAt ?? openRelayPayload(pubKeyZ32, payload).seq;
1495
+ try {
1496
+ this.written.set(pubKeyZ32, readOwnRelayPayload(pubKeyZ32, payload));
1497
+ } catch {}
1498
+ for (const relay of this.relays) this.catchUpLater(relay, pubKeyZ32, payload, at, asker(options, true));
1499
+ }
1500
+ /**
1478
1501
  * A payload signed in this process (a group edge's offer or answer, `CarriedTransport`) put on every relay, past what
1479
1502
  * a relay that answers 409 holds: that one is read, and the records go again at once, signed by `options.redate` dated
1480
1503
  * just past it, `left` times at most. A packet put here is the key's latest too: a publish dated here next
@@ -2099,10 +2122,10 @@ var RelayTransport = class {
2099
2122
  }
2100
2123
  /** A group's read of `key`, or a chat's watch read, asks: it waits for its turn from now on, unless it is taken (`readsAhead`). */
2101
2124
  readAsked(key, who, now) {
2102
- for (const [other, turn] of this.readTurns) if (now - Math.max(turn.askedAt, turn.servedAt) >= 6e4) this.readTurns.delete(other);
2125
+ this.pruneTurns(this.readTurns, now);
2103
2126
  const turn = this.readTurns.get(key);
2104
2127
  this.readTurns.set(key, {
2105
- servedAt: turn?.servedAt ?? -Infinity,
2128
+ servedAt: turn && !staleTurn(turn, now) ? turn.servedAt : -Infinity,
2106
2129
  askedAt: now,
2107
2130
  waiting: true,
2108
2131
  watch: isWatch(who) || isChatWatch(who),
@@ -2126,14 +2149,21 @@ var RelayTransport = class {
2126
2149
  }
2127
2150
  /** A read of `key` that takes turns asks: it waits for its turn from now on, unless it is taken (`turnAhead`). */
2128
2151
  turnAsked(key, who, now) {
2129
- for (const [other, turn] of this.keyTurns) if (now - Math.max(turn.askedAt, turn.servedAt) >= 6e4) this.keyTurns.delete(other);
2152
+ this.pruneTurns(this.keyTurns, now);
2153
+ const turn = this.keyTurns.get(key);
2130
2154
  this.keyTurns.set(key, {
2131
- servedAt: this.keyTurns.get(key)?.servedAt ?? -Infinity,
2155
+ servedAt: turn && !staleTurn(turn, now) ? turn.servedAt : -Infinity,
2132
2156
  askedAt: now,
2133
2157
  waiting: true,
2134
2158
  who
2135
2159
  });
2136
2160
  }
2161
+ /** Drops the turns asked and read over a minute ago, at most once in `TURNS_PRUNE_MS` (or when the clock went back). */
2162
+ pruneTurns(turns, now) {
2163
+ if (Math.abs(now - (this.turnsPrunedAt.get(turns) ?? -Infinity)) < TURNS_PRUNE_MS) return;
2164
+ this.turnsPrunedAt.set(turns, now);
2165
+ for (const [key, turn] of turns) if (staleTurn(turn, now)) turns.delete(key);
2166
+ }
2137
2167
  /**
2138
2168
  * Whether a key read in turn longer ago than `key`, still asking, would take this relay's next request: one read in the
2139
2169
  * background for a background read, and a chat's that is starved (`READ_STARVED_MS`) for any. One asks again after
@@ -3958,11 +3988,77 @@ async function signAppObject(prefix, value, signer) {
3958
3988
  }
3959
3989
  };
3960
3990
  }
3991
+ var fastPath = null;
3992
+ /** Gives (or, with `null`, takes back) the faster check of every app signature this process verifies. */
3993
+ function setAppSignatureFastPath(check) {
3994
+ fastPath = check;
3995
+ }
3996
+ /** The group order L, little-endian: an S at or above it is refused by the strict check. */
3997
+ var GROUP_ORDER = Uint8Array.from([
3998
+ 237,
3999
+ 211,
4000
+ 245,
4001
+ 92,
4002
+ 26,
4003
+ 99,
4004
+ 18,
4005
+ 88,
4006
+ 214,
4007
+ 156,
4008
+ 247,
4009
+ 162,
4010
+ 222,
4011
+ 249,
4012
+ 222,
4013
+ 20,
4014
+ 0,
4015
+ 0,
4016
+ 0,
4017
+ 0,
4018
+ 0,
4019
+ 0,
4020
+ 0,
4021
+ 0,
4022
+ 0,
4023
+ 0,
4024
+ 0,
4025
+ 0,
4026
+ 0,
4027
+ 0,
4028
+ 0,
4029
+ 16
4030
+ ]);
4031
+ /** Whether each key seen lately is a canonical encoding of a point not of small order: a list repeats its publishers. */
4032
+ var keysFit = /* @__PURE__ */ new Map();
4033
+ function fastPathTakes(signature, publicKey) {
4034
+ if (signature.length !== 64 || publicKey.length !== 32) return false;
4035
+ let below = false;
4036
+ for (let i = 31; i >= 0; i--) if (signature[32 + i] !== GROUP_ORDER[i]) {
4037
+ below = signature[32 + i] < GROUP_ORDER[i];
4038
+ break;
4039
+ }
4040
+ if (!below) return false;
4041
+ const id = toBase64Url(publicKey);
4042
+ let fit = keysFit.get(id);
4043
+ if (fit === void 0) {
4044
+ try {
4045
+ fit = !ed25519.Point.fromBytes(publicKey, false).isSmallOrder();
4046
+ } catch {
4047
+ fit = false;
4048
+ }
4049
+ if (keysFit.size >= 256) keysFit.clear();
4050
+ keysFit.set(id, fit);
4051
+ }
4052
+ return fit;
4053
+ }
3961
4054
  /**
3962
4055
  * Ed25519 verification as RFC 8032 writes it (`zip215: false`): canonical encodings of the point and the scalar only,
3963
4056
  * so every parser (this one, a Rust one with `verify_strict`) accepts exactly the same signatures.
3964
4057
  */
3965
4058
  function strictVerify(signature, message, publicKey) {
4059
+ if (fastPath && fastPathTakes(signature, publicKey)) try {
4060
+ if (fastPath(signature, message, publicKey)) return true;
4061
+ } catch {}
3966
4062
  try {
3967
4063
  return ed25519.verify(signature, message, publicKey, { zip215: false });
3968
4064
  } catch {
@@ -4108,9 +4204,9 @@ function verifyAppRevocation(revocation, checked) {
4108
4204
  }
4109
4205
  /**
4110
4206
  * Reads `ghostly-revoke.json`: canonical bytes holding a list of signed revocations. One that does not verify refuses the
4111
- * file, as a store index's `revoked` does.
4207
+ * file, as a store index's `revoked` does. With `checked`, a revocation it holds is not checked again.
4112
4208
  */
4113
- function readAppRevocations(bytes) {
4209
+ function readAppRevocations(bytes, checked) {
4114
4210
  const read = readCanonicalJson(bytes);
4115
4211
  if (!read.ok) return read;
4116
4212
  if (!Array.isArray(read.value) || read.value.length > APP_STATEMENT_LIMITS.revocations) return {
@@ -4120,7 +4216,7 @@ function readAppRevocations(bytes) {
4120
4216
  };
4121
4217
  const revocations = [];
4122
4218
  for (const entry of read.value) {
4123
- const one = readAppRevocation(entry);
4219
+ const one = readAppRevocation(entry, checked);
4124
4220
  if (!one.ok) return one;
4125
4221
  revocations.push(one.revocation);
4126
4222
  }
@@ -5758,6 +5854,10 @@ var HANDOFF_ATTEMPTS = {
5758
5854
  hourMs: 36e5,
5759
5855
  total: 15
5760
5856
  };
5857
+ var NO_ATTEMPTS = {
5858
+ recent: [],
5859
+ total: 0
5860
+ };
5761
5861
  /** Whether a device may try now: `refused` after 15 failures with no success, until the person lets it try again. */
5762
5862
  function handoffAttemptAllowed(attempts, now) {
5763
5863
  if (!attempts) return "ok";
@@ -6055,16 +6155,18 @@ var DEFAULT_OPUS_PT = 111;
6055
6155
  var DEFAULT_VP8_PT = 96;
6056
6156
  /** Dynamic RTP payload types: 96-127 (RFC 3551), and 35-63, which WebRTC engines use too. */
6057
6157
  var dynamicPayloadType = (n) => Number.isInteger(n) && (n >= 96 && n <= 127 || n >= 35 && n <= 63);
6058
- var RTC_CONFIG = {
6059
- iceServers: [
6060
- { urls: "stun:stun.l.google.com:19302" },
6061
- { urls: "stun:stun1.l.google.com:19302" },
6062
- { urls: "stun:stun2.l.google.com:19302" },
6063
- { urls: "stun:stun3.l.google.com:19302" },
6064
- { urls: "stun:stun4.l.google.com:19302" }
6065
- ],
6066
- iceCandidatePoolSize: 10
6067
- };
6158
+ /**
6159
+ * The apps' STUN servers. No candidate pool: a call's connection is made when the call is placed and its offer follows
6160
+ * at once, so pre-gathered sessions save no time, and each one opens its own sockets, asks every STUN server and takes
6161
+ * its own TURN allocation (a TURN server's per-user quota then refuses the call's own).
6162
+ */
6163
+ var RTC_CONFIG = { iceServers: [
6164
+ { urls: "stun:stun.l.google.com:19302" },
6165
+ { urls: "stun:stun1.l.google.com:19302" },
6166
+ { urls: "stun:stun2.l.google.com:19302" },
6167
+ { urls: "stun:stun3.l.google.com:19302" },
6168
+ { urls: "stun:stun4.l.google.com:19302" }
6169
+ ] };
6068
6170
  /**
6069
6171
  * A call's WebRTC configuration: the apps' STUN servers, then the profile's own (Settings → Network → ICE
6070
6172
  * servers: a TURN relay, typically). A relay is what connects a call when no direct path works: a VPN that takes
@@ -6098,12 +6200,10 @@ function callRtcConfig(extra = [], { relayOnly = false } = {}) {
6098
6200
  }
6099
6201
  /**
6100
6202
  * The WebRTC configuration of a chat's data link or a group's edge, from the profile's settings: its ICE servers,
6101
- * and "Hide my IP from contacts" (`relayOnly`), as a call's (`callRtcConfig`). No candidate pool: an app holds one
6102
- * such connection per chat and per group member, and a call only one.
6203
+ * and "Hide my IP from contacts" (`relayOnly`), as a call's (`callRtcConfig`).
6103
6204
  */
6104
6205
  function contactRtcConfig(settings) {
6105
- const { iceCandidatePoolSize: _pool, ...config } = callRtcConfig(settings.iceServers ?? [], { relayOnly: settings.relayOnly === true });
6106
- return config;
6206
+ return callRtcConfig(settings.iceServers ?? [], { relayOnly: settings.relayOnly === true });
6107
6207
  }
6108
6208
  /** Whether a connection keeps to relays (`iceTransportPolicy: "relay"`): what it sends a contact is then relay candidates only. */
6109
6209
  function keepsToRelays(pc) {
@@ -6990,9 +7090,20 @@ function decodeChunk(data) {
6990
7090
  payload: data.subarray(CHUNK_HEADER_BYTES)
6991
7091
  };
6992
7092
  }
6993
- function wrapDataChannel(dc) {
7093
+ /**
7094
+ * `ended`: its connection was torn down. The channel closes then as if the data channel had said so, and lets go of
7095
+ * the data channel's events: node-datachannel does not always report a channel of a closed connection closed, and its
7096
+ * native handle would hold whatever listens to it (the session, the link) for good.
7097
+ */
7098
+ function wrapDataChannel(dc, ended) {
6994
7099
  dc.binaryType = "arraybuffer";
6995
7100
  dc.bufferedAmountLowThreshold = LIMITS.sendLowWaterMark;
7101
+ const listening = new AbortController();
7102
+ const closed = () => {
7103
+ if (listening.signal.aborted) return;
7104
+ listening.abort();
7105
+ channel.onClose?.();
7106
+ };
6996
7107
  const channel = {
6997
7108
  send(data) {
6998
7109
  if (dc.readyState !== "open") throw new Error("Data link is not open");
@@ -7003,15 +7114,15 @@ function wrapDataChannel(dc) {
7003
7114
  return dc.bufferedAmount;
7004
7115
  },
7005
7116
  drained() {
7006
- if (dc.bufferedAmount <= LIMITS.sendLowWaterMark || dc.readyState !== "open") return Promise.resolve();
7117
+ if (dc.bufferedAmount <= LIMITS.sendLowWaterMark || dc.readyState !== "open" || listening.signal.aborted) return Promise.resolve();
7007
7118
  return new Promise((resolve) => {
7008
7119
  const done = () => {
7009
7120
  dc.removeEventListener("bufferedamountlow", done);
7010
- dc.removeEventListener("close", done);
7121
+ listening.signal.removeEventListener("abort", done);
7011
7122
  resolve();
7012
7123
  };
7013
7124
  dc.addEventListener("bufferedamountlow", done);
7014
- dc.addEventListener("close", done);
7125
+ listening.signal.addEventListener("abort", done);
7015
7126
  });
7016
7127
  },
7017
7128
  close() {
@@ -7021,12 +7132,14 @@ function wrapDataChannel(dc) {
7021
7132
  onMessage: null,
7022
7133
  onClose: null
7023
7134
  };
7135
+ const { signal } = listening;
7024
7136
  dc.addEventListener("message", (event) => {
7025
7137
  const data = event.data;
7026
7138
  if (typeof data === "string") channel.onMessage?.(data);
7027
7139
  else if (data instanceof ArrayBuffer) channel.onMessage?.(new Uint8Array(data));
7028
- });
7029
- dc.addEventListener("close", () => channel.onClose?.());
7140
+ }, { signal });
7141
+ dc.addEventListener("close", closed, { signal });
7142
+ ended?.addEventListener("abort", closed, { signal });
7030
7143
  return channel;
7031
7144
  }
7032
7145
  /**
@@ -7091,6 +7204,7 @@ function parseLocalTarget(input) {
7091
7204
  if (url.username || url.password) throw new Error("Credentials in the target URL are not supported");
7092
7205
  if (!LOOPBACK_HOSTS.has(url.hostname)) throw new Error("Only services on this machine can be shared (localhost, 127.0.0.1 or [::1])");
7093
7206
  if (url.search || url.hash) throw new Error("The target cannot contain a query or fragment");
7207
+ if (url.port === "0") throw new Error("Port 0 is not a port a web app can listen on");
7094
7208
  return {
7095
7209
  origin: url.origin,
7096
7210
  basePath: url.pathname.replace(/\/+$/, "")
@@ -7769,6 +7883,8 @@ var LinkSession = class {
7769
7883
  fastPollUntil = 0;
7770
7884
  /** An offer to a saved contact is out: from then on its fast window looks less often (`OFFER_FAST_MS`); 0 for none. */
7771
7885
  fastStepsAfter = 0;
7886
+ /** Fast reads still signaling since this side's last new offer or answer went out (`SIGNAL_OUT_READS`). */
7887
+ signalReadsLeft = 0;
7772
7888
  /** When the last `expectPeer` window ends (or ended): the pace slows down from there step by step. */
7773
7889
  expectUntil = 0;
7774
7890
  /**
@@ -7921,6 +8037,7 @@ var LinkSession = class {
7921
8037
  setFastPoll(fast, offer = false) {
7922
8038
  this.fastPollUntil = fast ? Date.now() + (offer ? OFFER_LOOK_MS : FAST_POLL_MAX_MS) : 0;
7923
8039
  this.fastStepsAfter = fast && offer ? Date.now() + OFFER_FAST_MS : 0;
8040
+ this.signalReadsLeft = 0;
7924
8041
  if (fast) this.pollNow();
7925
8042
  }
7926
8043
  /**
@@ -8158,21 +8275,25 @@ var LinkSession = class {
8158
8275
  }
8159
8276
  async publishOnce(advertise, upkeep = false) {
8160
8277
  const rtcSignal = advertise ? this.rtcSignal : null;
8161
- const built = buildLinkRecords(this.identity.pubKeyZ32, {
8162
- messages: this.sentBuffer,
8163
- ackTimestamp: this.myAck,
8164
- nick: this.nick,
8165
- callSignal: this.callSignal,
8166
- rtcSignal,
8167
- services: advertise ? this.getServices() : void 0,
8168
- transports: advertise ? this.transports : null
8169
- }, this.encKey);
8170
8278
  const started = Date.now();
8279
+ let keptMessages;
8171
8280
  try {
8172
8281
  const awaited = this.connected || this.presence.online || this.sentBuffer.length > 0 || this.callSignal !== null || this.awaitingPeer();
8173
8282
  const takesBack = !rtcSignal && this.rtcSignalOut !== null;
8174
8283
  const options = rtcSignal && rtcSignal !== this.rtcSignalOut ? { signal: true } : this.watching() ? { watch: true } : upkeep && (this.connected || takesBack) || !rtcSignal && !awaited ? { background: true } : void 0;
8175
8284
  this.wroteInBackground = options?.background === true;
8285
+ const held = this.transport.publishHeld?.(this.identity.pubKeyZ32, options);
8286
+ if (held) throw held;
8287
+ const built = buildLinkRecords(this.identity.pubKeyZ32, {
8288
+ messages: this.sentBuffer,
8289
+ ackTimestamp: this.myAck,
8290
+ nick: this.nick,
8291
+ callSignal: this.callSignal,
8292
+ rtcSignal,
8293
+ services: advertise ? this.getServices() : void 0,
8294
+ transports: advertise ? this.transports : null
8295
+ }, this.encKey);
8296
+ keptMessages = built.keptMessages;
8176
8297
  await this.transport.publish(this.identity, built.records, options);
8177
8298
  } catch (error) {
8178
8299
  const ms = Date.now() - started, waiting = isDiscoveryBudgetError(error);
@@ -8199,6 +8320,7 @@ var LinkSession = class {
8199
8320
  const ms = Date.now() - started;
8200
8321
  this.lastPublishedAt = Date.now();
8201
8322
  const signalOut = !!rtcSignal && rtcSignal !== this.rtcSignalOut;
8323
+ this.signalReadsLeft = signalOut ? 3 : rtcSignal ? this.signalReadsLeft : 0;
8202
8324
  if (signalOut && this.fastPollUntil > 0) {
8203
8325
  const lapsed = this.fastPollUntil <= Date.now() || this.fastStepsAfter > 0 && this.fastStepsAfter <= Date.now();
8204
8326
  this.fastPollUntil = Math.max(this.fastPollUntil, Date.now() + (this.fastStepsAfter ? OFFER_LOOK_MS : FAST_POLL_MAX_MS));
@@ -8217,7 +8339,7 @@ var LinkSession = class {
8217
8339
  ...signalOut && { signalOut }
8218
8340
  });
8219
8341
  this.discoveryResult("publish");
8220
- return built.keptMessages;
8342
+ return keptMessages;
8221
8343
  }
8222
8344
  /**
8223
8345
  * When a publish that failed goes again: when the relays' budget frees a request, if that held it back; a chat's or a
@@ -8243,7 +8365,8 @@ var LinkSession = class {
8243
8365
  let heldBackMs;
8244
8366
  try {
8245
8367
  const pace = this.pace();
8246
- const signal = pace === "fast" && this.fastStepsAfter > 0 && this.rtcSignalOut !== null;
8368
+ const signal = pace === "fast" && this.rtcSignalOut !== null && (this.fastStepsAfter > 0 || this.signalReadsLeft > 0);
8369
+ if (signal && !this.fastStepsAfter) this.signalReadsLeft--;
8247
8370
  const watch = !signal && this.watching();
8248
8371
  const departed = !signal && Date.now() < this.departedUntil;
8249
8372
  const background = pace === "background" || pace === "connected";
@@ -8534,6 +8657,8 @@ var DataLink = class {
8534
8657
  options;
8535
8658
  state = "idle";
8536
8659
  pc = null;
8660
+ /** Each connection's listeners, and its data channel's (`wrapDataChannel`), dropped once it is closed. */
8661
+ ends = /* @__PURE__ */ new WeakMap();
8537
8662
  myOfferTs = 0;
8538
8663
  /**
8539
8664
  * An offer or answer of this side's that went without a public candidate came to nothing (both descriptions were
@@ -8805,7 +8930,7 @@ var DataLink = class {
8805
8930
  let stalled = null;
8806
8931
  for (let attempt = 1;; attempt++) {
8807
8932
  const pc = this.createConnection();
8808
- stalled?.close();
8933
+ if (stalled) this.closeConnection(stalled);
8809
8934
  await describe(pc);
8810
8935
  if (this.pc !== pc) return null;
8811
8936
  const gathering = Date.now();
@@ -8840,6 +8965,9 @@ var DataLink = class {
8840
8965
  createConnection() {
8841
8966
  const pc = this.options.createPeerConnection();
8842
8967
  this.pc = pc;
8968
+ const ended = new AbortController();
8969
+ this.ends.set(pc, ended);
8970
+ const { signal } = ended;
8843
8971
  const dc = pc.createDataChannel(DATA_CHANNEL_LABEL, {
8844
8972
  negotiated: true,
8845
8973
  id: 0,
@@ -8855,12 +8983,12 @@ var DataLink = class {
8855
8983
  this.options.setFastPoll(false);
8856
8984
  this.options.publishSignal(null);
8857
8985
  this.options.onDirect?.("open");
8858
- this.options.onOpen(wrapDataChannel(dc));
8986
+ this.options.onOpen(wrapDataChannel(dc, signal));
8859
8987
  tracePair(this.options.myPubKeyZ32, pc);
8860
- });
8988
+ }, { signal });
8861
8989
  dc.addEventListener("close", () => {
8862
8990
  if (this.pc === pc) this.failed(true);
8863
- });
8991
+ }, { signal });
8864
8992
  pc.addEventListener("connectionstatechange", () => {
8865
8993
  if (this.pc !== pc) return;
8866
8994
  if (this.disconnectTimer) {
@@ -8875,7 +9003,7 @@ var DataLink = class {
8875
9003
  if (this.pc === pc) this.failed();
8876
9004
  }, DISCONNECT_GRACE_MS);
8877
9005
  }
8878
- });
9006
+ }, { signal });
8879
9007
  this.startAttemptTimer(pc);
8880
9008
  return pc;
8881
9009
  }
@@ -8908,9 +9036,19 @@ var DataLink = class {
8908
9036
  this.myOfferTs = 0;
8909
9037
  this.remoteSdp = null;
8910
9038
  if (!pc) return false;
8911
- pc.close();
9039
+ this.closeConnection(pc);
8912
9040
  return true;
8913
9041
  }
9042
+ /**
9043
+ * Closes `pc` and drops its listeners and its data channel's. The channel tells it closed (`wrapDataChannel`) a
9044
+ * microtask later, after the link's own `onClose`, as when the data channel said so itself: node-datachannel does not
9045
+ * always report a closed connection's channel closed, and the listeners it kept would hold the link for good.
9046
+ */
9047
+ closeConnection(pc) {
9048
+ pc.close();
9049
+ const ended = this.ends.get(pc);
9050
+ if (ended) queueMicrotask(() => ended.abort());
9051
+ }
8914
9052
  reset() {
8915
9053
  const wasOpen = this.state === "open";
8916
9054
  const hadConnection = this.teardown();
@@ -10646,10 +10784,12 @@ var EXTENSIONS = {
10646
10784
  "audio/aac": "aac",
10647
10785
  "audio/wav": "wav"
10648
10786
  };
10787
+ /** A time no date can hold (past Date's end, NaN) makes a name without one, never "NaN-NaN-NaN". */
10649
10788
  function voiceName(prefix, mime, timestamp) {
10650
- const date = new Date(timestamp);
10789
+ const date = new Date(timestamp), extension = EXTENSIONS[baseMime(mime)] ?? "audio";
10790
+ if (Number.isNaN(date.getTime())) return `${prefix}.${extension}`;
10651
10791
  const pad = (n) => String(n).padStart(2, "0");
10652
- return `${prefix} ${`${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}.${pad(date.getMinutes())}.${pad(date.getSeconds())}`}.${EXTENSIONS[baseMime(mime)] ?? "audio"}`;
10792
+ return `${prefix} ${`${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}.${pad(date.getMinutes())}.${pad(date.getSeconds())}`}.${extension}`;
10653
10793
  }
10654
10794
  /**
10655
10795
  * The name a downloaded voice message is saved under, made here from the message's time and its
@@ -16275,6 +16415,12 @@ var AppRanges = class {
16275
16415
  draining = /* @__PURE__ */ new Set();
16276
16416
  asking = /* @__PURE__ */ new Map();
16277
16417
  waiting = /* @__PURE__ */ new Map();
16418
+ /**
16419
+ * The size each serve of the contact said (its last `ar-end`), by app and serve id: an ask past it is cut to it. The
16420
+ * server counts the bytes asked against its 32 MiB a second; an app reading small files with remote.read's 1 MiB
16421
+ * length was refused `busy` from the 33rd read in a second, having moved about 1 MiB (agents#1766).
16422
+ */
16423
+ sizes = /* @__PURE__ */ new Map();
16278
16424
  nextRequest = 0;
16279
16425
  /** The asks taken in the last second (when, how many bytes) and their sum: what `bytesPerSecond` counts. Kept across sessions. */
16280
16426
  taken = [];
@@ -16284,9 +16430,13 @@ var AppRanges = class {
16284
16430
  this.newServeId = newServeId;
16285
16431
  this.now = now;
16286
16432
  }
16287
- /** Lets the contact's `app` read `file` on this session: the serve id to tell it. */
16433
+ /**
16434
+ * Lets the contact's `app` read `file` on this session: the serve id to tell it. A file the app serves already answers
16435
+ * the id it has, so an app that serves again on each play holds one serve per file, not one per call.
16436
+ */
16288
16437
  serve(app, file) {
16289
16438
  if (!isChatAppId(app)) throw new Error("Not a chat app id");
16439
+ for (const [served, serve] of this.serves) if (serve.app === app && serve.file === file) return served;
16290
16440
  let id = this.newServeId();
16291
16441
  while (this.serves.has(id)) id = this.newServeId();
16292
16442
  this.serves.set(id, {
@@ -16320,15 +16470,20 @@ var AppRanges = class {
16320
16470
  return null;
16321
16471
  }
16322
16472
  const at = this.now();
16323
- while (this.taken.length && this.taken[0].at <= at - 1e3) this.takenBytes -= this.taken.shift().bytes;
16473
+ while (this.taken.length && this.taken[0].at <= at - 1e3) {
16474
+ const old = this.taken.shift();
16475
+ old.out = true;
16476
+ this.takenBytes -= old.bytes;
16477
+ }
16324
16478
  if (this.takenBytes + frame.n > APP_RANGE_LIMITS.bytesPerSecond) {
16325
16479
  this.send(appRangeErrorFrame(app, request, "busy"));
16326
16480
  return null;
16327
16481
  }
16328
- this.taken.push({
16482
+ const charge = {
16329
16483
  at,
16330
16484
  bytes: frame.n
16331
- });
16485
+ };
16486
+ this.taken.push(charge);
16332
16487
  this.takenBytes += frame.n;
16333
16488
  const task = {
16334
16489
  app,
@@ -16337,7 +16492,8 @@ var AppRanges = class {
16337
16492
  file: serve.file,
16338
16493
  offset: frame.o,
16339
16494
  length: frame.n,
16340
- live: true
16495
+ live: true,
16496
+ charge
16341
16497
  };
16342
16498
  this.serving.set(slot(app, request), task);
16343
16499
  return task;
@@ -16349,7 +16505,13 @@ var AppRanges = class {
16349
16505
  }
16350
16506
  /** Every byte of `task` was sent: `ar-end` goes with the file's size, unless the task was dropped meanwhile. */
16351
16507
  finish(task, size) {
16352
- if (this.take(task)) this.send(appRangeEndFrame(task.app, task.request, size));
16508
+ if (!this.take(task)) return;
16509
+ const charge = task.charge, sent = Math.max(0, Math.min(task.length, size - task.offset));
16510
+ if (charge && !charge.out && charge.bytes > sent) {
16511
+ this.takenBytes -= charge.bytes - sent;
16512
+ charge.bytes = sent;
16513
+ }
16514
+ this.send(appRangeEndFrame(task.app, task.request, size));
16353
16515
  }
16354
16516
  /** The file under `task` could not be read: `ar-err` goes in place of the rest, unless the task was dropped meanwhile. */
16355
16517
  fail(task, error) {
@@ -16369,6 +16531,8 @@ var AppRanges = class {
16369
16531
  /** Reads `length` bytes at `offset` of what the contact's `app` serves as `serve`: the bytes (fewer at the end) and the file's size. */
16370
16532
  read(app, serve, offset, length) {
16371
16533
  appRangeGetFrame(app, serve, 0, offset, length);
16534
+ const size = this.sizes.get(`${app} ${serve}`);
16535
+ if (size !== void 0 && size > offset) length = Math.min(length, size - offset);
16372
16536
  return new Promise((resolve, reject) => {
16373
16537
  const ask = {
16374
16538
  app,
@@ -16404,10 +16568,12 @@ var AppRanges = class {
16404
16568
  if (frame.t === "ar-err") return this.settle(ask, [
16405
16569
  "not-served",
16406
16570
  "changed",
16407
- "gone"
16571
+ "gone",
16572
+ "busy"
16408
16573
  ].find((code) => code === frame.e) ?? "failed");
16409
16574
  if (ask.got !== Math.max(0, Math.min(ask.length, frame.z - ask.offset))) return this.settle(ask, "failed");
16410
16575
  this.settle(ask);
16576
+ this.sizes.set(`${ask.app} ${ask.serve}`, frame.z);
16411
16577
  ask.resolve({
16412
16578
  bytes: concatBytes$1(...ask.chunks),
16413
16579
  size: frame.z
@@ -16421,9 +16587,11 @@ var AppRanges = class {
16421
16587
  for (const ask of this.waiting.get(app) ?? []) ask.reject(new Error(error));
16422
16588
  this.waiting.delete(app);
16423
16589
  for (const ask of this.asking.values()) if (ask.app === app) this.settle(ask, error);
16590
+ for (const key of [...this.sizes.keys()]) if (key.startsWith(`${app} `)) this.sizes.delete(key);
16424
16591
  }
16425
16592
  /** The session ended: no serve id lasts into the next, and every request fails with `offline`. */
16426
16593
  reset() {
16594
+ this.sizes.clear();
16427
16595
  const apps = new Set([...this.serves.values()].map((serve) => serve.app).concat([...this.serving.values(), ...this.draining].map((task) => task.app), [...this.waiting.keys()], [...this.asking.values()].map((ask) => ask.app)));
16428
16596
  for (const app of apps) this.closeApp(app, "offline");
16429
16597
  }
@@ -18649,10 +18817,7 @@ var PairedCalls = class {
18649
18817
  * a call outlasts its offer's freshness.
18650
18818
  */
18651
18819
  hangUp(options = {}) {
18652
- let said = {};
18653
- if (this.latest) try {
18654
- said = JSON.parse(this.latest.signal);
18655
- } catch {}
18820
+ const said = this.said();
18656
18821
  const ours = said.t === "o" || said.t === "a" || said.t === "v" || said.t === "r";
18657
18822
  const peer = this.peer;
18658
18823
  const ringing = options.declineRinging === true && peer?.kind === "o" && peer.at > this.saidAt && this.now() - peer.at <= 12e4 ? peer : null;
@@ -18663,6 +18828,29 @@ var PairedCalls = class {
18663
18828
  ts
18664
18829
  }));
18665
18830
  }
18831
+ /**
18832
+ * The hang-up of a call this side placed or answered, for the transport to send should the app go without a word
18833
+ * (`FrameChannel.parting`: a logout ends the Desktop's page with the app), or null when no call of ours is on. Nothing
18834
+ * is said or changed here. Its time is just after this side's latest signal, so it stays the same until that changes;
18835
+ * a hang-up the page itself says on its way out too (`hangUp`) is no older, and finds the call over already.
18836
+ */
18837
+ parting() {
18838
+ const said = this.said();
18839
+ if (!(said.t === "o" || said.t === "a" || said.t === "v" || said.t === "r") || typeof said.ts !== "number") return null;
18840
+ return {
18841
+ t: PAIRED_CALL_FRAME,
18842
+ s: JSON.stringify({
18843
+ t: "h",
18844
+ ts: said.ts + 1
18845
+ })
18846
+ };
18847
+ }
18848
+ said() {
18849
+ if (this.latest) try {
18850
+ return JSON.parse(this.latest.signal);
18851
+ } catch {}
18852
+ return {};
18853
+ }
18666
18854
  /** On a new session that carries calls: the latest signal again, if it is still fresh enough to act on. */
18667
18855
  pending() {
18668
18856
  if (!this.latest) return null;
@@ -19107,7 +19295,6 @@ var CarriedTransport = class {
19107
19295
  subscribe;
19108
19296
  networkChanged;
19109
19297
  configure;
19110
- publishHeld;
19111
19298
  constructor(inner, myKey, peerKey, hooks) {
19112
19299
  this.inner = inner;
19113
19300
  this.myKey = myKey;
@@ -19119,7 +19306,6 @@ var CarriedTransport = class {
19119
19306
  if (inner.subscribe) this.subscribe = (listener) => inner.subscribe(listener);
19120
19307
  if (inner.networkChanged) this.networkChanged = () => inner.networkChanged();
19121
19308
  if (inner.configure) this.configure = (options) => inner.configure(options);
19122
- if (inner.publishHeld) this.publishHeld = (key, options) => inner.publishHeld(key, options);
19123
19309
  }
19124
19310
  describe() {
19125
19311
  return this.inner.describe();
@@ -19674,6 +19860,7 @@ var ENGINE_ERRORS = {
19674
19860
  invalidMintUrl: "That is not a valid mint URL",
19675
19861
  mintNotHttps: "Mints must use https",
19676
19862
  notEnoughSats: "Not enough sats in your wallet",
19863
+ notEnoughForFee: "Not enough sats in your wallet: {amount} sats leave room for the fee",
19677
19864
  noSharedMint: "You share no mint with this contact",
19678
19865
  ecashAlreadySpent: "This ecash was already spent somewhere else",
19679
19866
  ecashBeingReceived: "This ecash is already being received",
@@ -20157,6 +20344,8 @@ var GhostLink = class {
20157
20344
  /** What each side announced after the handshake (`paired-capabilities`): calls, services. */
20158
20345
  sessionCapabilities = new SessionCapabilities(() => this.offeredCapabilities());
20159
20346
  pairedCalls = new PairedCalls();
20347
+ /** The channel holding this side's call hang-up, to be sent by the transport should the page go first (`leaveHangUp`). */
20348
+ partingOn = null;
20160
20349
  /** Typing on this session (`typing/1`): when to say `start` again, and the contact's word with its timeout. */
20161
20350
  typingSender = new TypingSender();
20162
20351
  typingReceiver = new TypingReceiver((typing, activity) => this.options.events?.onPeerTyping?.(typing, activity));
@@ -22410,6 +22599,7 @@ var GhostLink = class {
22410
22599
  async setCallSignal(signal) {
22411
22600
  if (this.options.params.profile) {
22412
22601
  const frame = this.pairedCalls.set(signal);
22602
+ this.leaveHangUp();
22413
22603
  if (!frame) return;
22414
22604
  if (!this.supportsCalls || !this.channel) throw new Error(this.callsUnavailable ?? "Calls need a live connection");
22415
22605
  this.channel.send(JSON.stringify(frame));
@@ -22423,6 +22613,19 @@ var GhostLink = class {
22423
22613
  } catch {}
22424
22614
  await this.session.setCallSignal(signal);
22425
22615
  }
22616
+ /**
22617
+ * Hands the transport the hang-up of the call this side is on (`PairedCalls.parting`), for it to send as the app
22618
+ * exits should the page be gone by then: a logout or a shutdown ends the Desktop's WebView with the app, and its
22619
+ * goodbye (`depart`) never ran, the contact's call stalling until its media gave up 16 s later. Taken back once no
22620
+ * call of ours is on, and from a session no longer the chat's.
22621
+ */
22622
+ leaveHangUp() {
22623
+ const channel = this.supportsCalls && this.paired?.state.status === "ready" ? this.channel : null;
22624
+ const frame = channel ? this.pairedCalls.parting() : null;
22625
+ if (this.partingOn && this.partingOn !== channel) this.partingOn.parting?.(null);
22626
+ this.partingOn = channel?.parting ? channel : null;
22627
+ this.partingOn?.parting?.(frame ? JSON.stringify(frame) : null);
22628
+ }
22426
22629
  /** Issues an HTTP request to a service the peer advertises. */
22427
22630
  async request(serviceId, request) {
22428
22631
  if (this.options.params.profile) {
@@ -23428,6 +23631,7 @@ var GhostLink = class {
23428
23631
  this.channel.send(JSON.stringify(pending));
23429
23632
  } catch {}
23430
23633
  }
23634
+ if (changed.includes("calls/1")) this.leaveHangUp();
23431
23635
  if (changed.includes("typing/1")) {
23432
23636
  if (!this.supportsTyping) {
23433
23637
  this.typingSender.reset();
@@ -23958,6 +24162,7 @@ var GhostLink = class {
23958
24162
  this.peerNetworks = null;
23959
24163
  this.peerHoldOverride = null;
23960
24164
  this.sessionCapabilities.reset();
24165
+ this.leaveHangUp();
23961
24166
  this.typingSender.reset();
23962
24167
  this.typingReceiver.clear();
23963
24168
  this.appsSuspended();
@@ -24553,6 +24758,7 @@ var GhostLink = class {
24553
24758
  if (hangUp) try {
24554
24759
  this.channel.send(JSON.stringify(hangUp));
24555
24760
  } catch {}
24761
+ this.leaveHangUp();
24556
24762
  try {
24557
24763
  this.channel.send(JSON.stringify({ t: "paired-bye" }));
24558
24764
  } catch {}
@@ -24726,6 +24932,7 @@ var GhostLink = class {
24726
24932
  this.pairedHttp?.close();
24727
24933
  this.pairedHttp = null;
24728
24934
  this.channel = this.httpHost = this.httpClient = this.files = null;
24935
+ this.leaveHangUp();
24729
24936
  this.peerServicesOverride = null;
24730
24937
  this.peerNickOverride = null;
24731
24938
  this.dropPeerSaid();
@@ -29596,6 +29803,7 @@ var GroupSession = class {
29596
29803
  const previous = this.top;
29597
29804
  const roster = expectedRoster(previous.m, kind, this.myKey, subject);
29598
29805
  if (!roster) throw new Error("This change is not allowed");
29806
+ if ((kind === "add" || kind === "rotate") && this.state.chain.length + 1 + 2 * (roster.length - 1) > 1024) throw new Error("This group has reached its membership history limit. Create a new group.");
29599
29807
  const epoch = previous.e + 1;
29600
29808
  const secret = newEpochSecret();
29601
29809
  const draft = {
@@ -30843,19 +31051,24 @@ var GroupSession = class {
30843
31051
  /**
30844
31052
  * Who made the change a statement brings me: its signer, when they were the admin all along since the statement I
30845
31053
  * held (or, with none, since I got in). A new admin signs again what the last one set (`metaFollowsChain`): to a
30846
- * member that missed that, it is no change of theirs it can tell apart, so nobody is named.
31054
+ * member that missed that, it is no change of theirs it can tell apart, so nobody is named. With none held, theirs is
31055
+ * one dated after the commit that made them the admin: what they sign again keeps its date.
30847
31056
  */
30848
31057
  metaAuthor(before, s) {
30849
31058
  const chain = this.state.chain, from = before ? before.e : chain.findIndex((c) => rosterHas(c.m, this.myKey));
30850
- for (let e = Math.max(0, from); e <= s.e; e++) if (rosterAdmin(chain[e].m) !== s.by) return void 0;
30851
- return s.by;
31059
+ let moved;
31060
+ for (let e = Math.max(0, from); e <= s.e; e++) if (rosterAdmin(chain[e].m) !== s.by) {
31061
+ if (before) return void 0;
31062
+ moved = e + 1;
31063
+ }
31064
+ return moved === void 0 || s.ts > chain[moved].ts ? s.by : void 0;
30852
31065
  }
30853
31066
  /** After the chain or my secrets moved: the waiting statement, and, if I became the admin, the name and picture signed again as mine. */
30854
31067
  async metaFollowsChain() {
30855
31068
  const pending = this.pendingMeta;
30856
31069
  this.pendingMeta = void 0;
30857
31070
  if (pending) await this.receiveMeta(pending.from, pending.frame);
30858
- if (this.isAdmin && this.state.meta && this.state.meta.by !== this.myKey) await this.publishMeta(this.state.meta.body, Date.now());
31071
+ if (this.isAdmin && this.state.meta && this.state.meta.by !== this.myKey) await this.publishMeta(this.state.meta.body, this.state.meta.ts);
30859
31072
  }
30860
31073
  async fork(reason) {
30861
31074
  if (this.state.status !== "active") return;
@@ -33434,25 +33647,33 @@ var CommunitySession = class {
33434
33647
  /**
33435
33648
  * Who made the change a statement brings me (`at`: its commit's place on my main branch): its signer, when they were
33436
33649
  * the admin all along since the statement I held (or, with none, since I got in). A new admin signs again what the
33437
- * last one set (`metaFollowsChain`): to a member that missed that, it is no change of theirs it can tell apart.
33650
+ * last one set (`metaFollowsChain`): to a member that missed that, it is no change of theirs it can tell apart. With
33651
+ * none held, theirs is one dated after the commit that made them the admin: what they sign again keeps its date.
33438
33652
  */
33439
33653
  metaAuthor(before, s, at) {
33440
33654
  const from = before ? this.mainIndex.get(before.h) : void 0;
33441
- let roster = before && from !== void 0 ? this.rosterAt(before.h) ?? null : null, counted = from !== void 0;
33655
+ let roster = before && from !== void 0 ? this.rosterAt(before.h) ?? null : null, counted = from !== void 0, moved;
33442
33656
  for (let i = from ?? 0; i <= at; i++) {
33443
33657
  if (i !== from) roster = communityRoster(roster, this.state.chain[i]);
33444
33658
  if (!roster) return void 0;
33445
33659
  counted ||= rosterHas(roster, this.myKey);
33446
- if (counted && rosterAdmin(roster) !== s.by) return void 0;
33660
+ if (counted && rosterAdmin(roster) !== s.by) {
33661
+ if (before) return void 0;
33662
+ moved = i + 1;
33663
+ }
33447
33664
  }
33448
- return s.by;
33665
+ return moved === void 0 || s.ts > this.state.chain[moved].ts ? s.by : void 0;
33449
33666
  }
33450
- /** After the chain or my secrets moved: the waiting statement, and, if I became the admin, the name and picture signed again as mine. */
33667
+ /**
33668
+ * After the chain or my secrets moved: the waiting statement, and, if I became the admin, or my statement's commit
33669
+ * went with a branch that lost a fork, the name and picture signed again as mine under the main branch.
33670
+ */
33451
33671
  async metaFollowsChain() {
33452
33672
  const pending = this.pendingMeta;
33453
33673
  this.pendingMeta = void 0;
33454
33674
  if (pending && await this.receiveMeta(pending.from, pending.frame)) this.hooks.relay?.(pending.frame);
33455
- if (this.isAdmin && this.state.meta && this.state.meta.by !== this.myKey) await this.publishMeta(this.state.meta.body, this.hooks.clock?.() ?? Date.now());
33675
+ const meta = this.state.meta;
33676
+ if (this.isAdmin && meta && (meta.by !== this.myKey || !this.mainIndex.has(meta.h))) await this.publishMeta(meta.body, meta.ts);
33456
33677
  }
33457
33678
  async fork(reason) {
33458
33679
  if (this.state.status !== "active") return;
@@ -33704,11 +33925,11 @@ function inOneRun(steps) {
33704
33925
  * Checks an index's fields and bounds, and every revocation it carries (one that does not verify refuses the index:
33705
33926
  * the store copied it, so a broken one is the store's fault). The signature and `expires` are `readAppStore`'s. An
33706
33927
  * unknown key of the index, a listing or a removal is ignored unless `strict`; a revocation is its publisher's signed
33707
- * statement and keeps its exact keys.
33928
+ * statement and keeps its exact keys. With `checked`, a revocation it holds is not checked again.
33708
33929
  */
33709
- function checkAppStoreIndex(value, options = {}) {
33930
+ function checkAppStoreIndex(value, options = {}, checked) {
33710
33931
  const fields = inOneRun(checkAppStoreFieldsSteps(value, options));
33711
- return fields.ok ? inOneRun(checkAppStoreRevocationsSteps(value)) : fields;
33932
+ return fields.ok ? inOneRun(checkAppStoreRevocationsSteps(value, checked)) : fields;
33712
33933
  }
33713
33934
  /**
33714
33935
  * The first half of `checkAppStoreIndex`: the fields and bounds, and the shape of every revocation, with no signature
@@ -33790,10 +34011,10 @@ function* checkAppStoreRevocationsSteps(index, checked) {
33790
34011
  * signature, the signature of each revocation, then `expires` against `now` (seconds): more than 90 days ahead is
33791
34012
  * refused, past is `expired`. The index's own signature comes before its revocations': an index nobody signed costs
33792
34013
  * its reader one signature check, whatever it carries. A key it does not know is ignored (a later store's optional
33793
- * field) and stays in the bytes the signature covers.
34014
+ * field) and stays in the bytes the signature covers. With `checked`, a revocation it holds is not checked again.
33794
34015
  */
33795
- function readAppStore(indexBytes, sigBytes, now, heldKey) {
33796
- return inOneRun(readAppStoreSteps(indexBytes, sigBytes, now, heldKey));
34016
+ function readAppStore(indexBytes, sigBytes, now, heldKey, checked) {
34017
+ return inOneRun(readAppStoreSteps(indexBytes, sigBytes, now, heldKey, checked));
33797
34018
  }
33798
34019
  /**
33799
34020
  * `readAppStore` in steps, for a reader that shares its thread (a page): it stops after each listing, removal and
@@ -33838,11 +34059,12 @@ function* readAppStoreSteps(indexBytes, sigBytes, now, heldKey, checked) {
33838
34059
  }
33839
34060
  /**
33840
34061
  * Signs an index with the store key: its canonical bytes and the `ghostly-store.sig` bytes. Throws on a bad index, and
33841
- * on a key this format does not define: a writer is strict, so a misspelt key is never signed.
34062
+ * on a key this format does not define: a writer is strict, so a misspelt key is never signed. With `revocations`, a
34063
+ * revocation it holds is not checked again.
33842
34064
  */
33843
- async function signAppStore(index, signer) {
34065
+ async function signAppStore(index, signer, revocations) {
33844
34066
  if (index.key !== toZ32(signer.publicKey)) throw new Error("A store index is signed by its own key");
33845
- const checked = checkAppStoreIndex(JSON.parse(JSON.stringify(index)), { strict: true });
34067
+ const checked = checkAppStoreIndex(JSON.parse(JSON.stringify(index)), { strict: true }, revocations);
33846
34068
  if (!checked.ok) throw new Error(`Not a valid store index (${checked.reason}${checked.detail ? `: ${checked.detail}` : ""})`);
33847
34069
  const { bytes, signature } = await signAppObject(APP_PREFIXES.store, index, signer);
33848
34070
  return {
@@ -34122,6 +34344,6 @@ function readX401SdJwtVc(text) {
34122
34344
  };
34123
34345
  }
34124
34346
  //#endregion
34125
- export { parseSshPublicKey as $, buttonLabelClash as $a, createContactLink as $c, automaticTransport as $i, PacketTooLargeError as $l, readGroupWant as $n, HANDOFF_OFFER as $o, vapidKeysMatch as $r, readEnrollHello as $s, SEPOLIA_TEST_USDT_FAUCET as $t, knockRecords as A, GROUP_REACTION_FRAME as Aa, checkAppManifest as Ac, txtValue as Ai, firstDeviceSetSecret as Al, findEndpoint as An, webLocalFetch as Ao, FileUplink as Ar, readHandoffPake as As, didWebDocumentUrl as At, GROUP_READ_NOTE as B, pairedReplyAuthor as Ba, checkAppRevokeStatement as Bc, IdentityExchange as Bi, DEFAULT_RELAYS as Bl, EngineError as Bn, contactRtcConfig as Bo, mayPin as Br, verifySetUpdate as Bs, staticDidDocument as Bt, decodeCommunityLink as C, REMOVED_TEXT as Ca, APP_BUNDLE_LIMITS as Cc, encodeDnsQuery as Ci, TURN_PUT_WINDOW_MS as Cl, pubkyHomeserverOf as Cn, EXPECT_PEER_MS as Co, rankHubs as Cr, handoffVersions as Cs, DID_JWS_MAX_LENGTH as Ct, encodeGroupEntryLink as D, forwardedAgain as Da, appDigest as Dc, recordsFromTxt as Di, turnPutSummary as Dl, ENDPOINT as Dn, GhostlyHttpError as Do, shouldBeHub as Dr, readHandoffDone as Ds, didGhostlyServiceEntry as Dt, decodeGroupEntryLink as E, parseLinkPreview as Ea, APP_PERMISSIONS as Ec, normalizeDomain as Ei, classifyTurnRead as El, decodeBolt11 as En, presenceSeenAt as Eo, readLobby as Er, readHandoffCancel as Es, checkDidSignature as Et, groupWakeFrame as F, reactionEmoji as Fa, sha256Paced as Fc, dialDescriptors as Fi, turnInstance as Fl, INVITE_TAKEN as Fn, RTC_CONFIG as Fo, TypingSender as Fr, SET_UPDATE as Fs, normalizeDid as Ft, GROUP_EDIT_TEXT_BYTES as G, ITEM_STATES as Ga, readAppRevocations as Gc, newIdentityBinding as Gi, SLOW_MS as Gl, GROUP_HAVE_FRAME as Gn, HTTP_SERVICE_PROTO as Go, WAKE_CALL_INTERVAL_MS as Gr, enrollCancelFrame as Gs, encodeDidDhtPacket as Gt, frameBytes as H, replySnippet as Ha, isAppKey as Hc, emptyIdentityLedger as Hi, HEDGE_MS as Hl, engineText as Hn, parseCallSignal as Ho, pinIsNewer as Hr, ENROLL_GRANT as Hs, didDhtDocument as Ht, groupWakes as I, reactionIsNewer as Ia, APP_PREFIXES as Ic, IDENTITY_MAX_EVIDENCE as Ii, turnKeys as Il, LIVENESS_PING_MS as In, answersOffer as Io, sanitizeTypingStatus as Ir, readSetUpdate as Is, parseDid as It, mentionsMember as J, ROUTINE_STATES as Ja, parseImageMeta as Jc, lastSharedWithMe as Ji, setLinkTraceSink as Jl, fetchesByItself as Jn, HANDOFF_ACK as Jo, newWakeToken as Jr, enrollDoneFrame as Js, ETHEREUM_USDT as Jt, carryMentions as K, PR_CHECKS as Ka, signAppObject as Kc, receivedIdentityStatus as Ki, currentRelays as Kl, GROUP_WANT_FRAME as Kn, LEGACY_SERVICES as Ko, WakeLimiter as Kr, enrollCancelReason as Ks, resolveDidDht as Kt, parseGroupWakeFrame as L, readReaction as La, APP_STATEMENT_LIMITS as Lc, IDENTITY_MAX_VALIDITY as Li, turnName as Ll, PAIRED_FRAME_TOO_LARGE as Ln, buildSdpFromSignal as Lo, typingActivity as Lr, setAckFrame as Ls, parseDidDocument as Lt, readKnocks as M, ReactionWindow as Ma, pacer as Mc, CapsExchange as Mi, readTurnPacket as Ml, parseCashuRequestPayload as Mn, decodeControl as Mo, transferStalled as Mr, readHandoffVerified as Ms, didWebFileNames as Mt, GROUP_WAKE_FRAME as N, nextReactionNumber as Na, readAppBundle as Nc, DHT_TEXT_CAPABILITY as Ni, signTurnPacket as Nl, parseFedimintRequestPayload as Nn, encodeControl as No, TYPING_KINDS as Nr, sealHandoffPiece as Ns, didWebFileUrl as Nt, entryParams as O, readForwarded as Oa, appViewOf as Oc, recordsFromWellKnown as Oi, TURN_LAST_SEQUENCE as Ol, cashuRequestPayload as On, formatLocalTarget as Oo, ChatFiles as Or, readHandoffHave as Os, didJwsAlg as Ot, GroupWakeLimiter as P, queueReaction as Pa, readAppBundleAsync as Pc, capsDescriptors as Pi, signTurnRelease as Pl, GhostLink as Pn, CALL_SIGNAL_MAX_AGE_MS as Po, TYPING_REFRESH_MS as Pr, SET_ACK as Ps, didWebHost as Pt, SshSigError as Q, appCardId as Qa, readCanonicalJson as Qc, TRANSPORTS as Qi, withRequestOptions as Ql, readGroupHave as Qn, HANDOFF_HELLO as Qo, checkPushEndpoint as Qr, readEnrollGrant as Qs, SEPOLIA_TEST_USDT as Qt, GROUP_LIMITS as R, validReactionNumber as Ra, appFingerprint as Rc, IDENTITY_REVOCATION_LABEL as Ri, turnStatedVerifier as Rl, pairedMessageFits as Rn, callRtcConfig as Ro, GROUP_PIN_FRAME as Rr, setUpdateFrame as Rs, parseDidSignaturePaste as Rt, communityHasFrame as S, MAX_REMOVAL_NUMBER as Sa, seenEntry as Sc, domainWellKnownFile as Si, webCryptoSigner as Sl, homeserverWebEndpoint as Sn, DHT_POLL_INTERVALS as So, pickHubs as Sr, handoffStreamKey as Ss, DID_FILE_MAX_BYTES as St, KNOCK_TTL_MS as T, dhtEditId as Ta, APP_ICON_PATH as Tc, nip05RootKey as Ti, TURN_SETTLE_MS as Tl, resolveLightningDestination as Tn, WATCH_PEER_MS as To, readBeaconHead as Tr, readHandoffAck as Ts, checkDidJws as Tt, COMMUNITY_EDIT_FRAME as U, BUTTON_ID as Ua, isAppRef as Uc, identityRevocationValue as Ui, RelayTransport as Ul, parseEngineError as Un, signalHasVideo as Uo, pinNumberHolds as Ur, ENROLL_HELLO as Us, didDhtFromPublicKey as Ut, GroupSession as V, readReply as Va, isAppHash as Vc, boundVerifiedIdentity as Vi, HEDGE_MISSING_MS as Vl, engineError as Vn, extractParamsFromSdp as Vo, nextPinNumber as Vr, ENROLL_DONE as Vs, strictBase64Url as Vt, GROUP_EDIT_FRAME as W, CRON_LINE as Wa, readAppRevocation as Wc, identityStatement as Wi, RelaysFailedError as Wl, GROUP_FILE_LIMITS as Wn, emptyLinkRecords as Wo, readPin as Wr, ENROLL_PROOF as Ws, encodeDidDhtDeactivated as Wt, SSHSIG_MAX_ARMOR as X, STATUS_CARD_LIMITS as Xa, canonicalJson as Xc, emptyProofLedger as Xi, budgetRetryMs as Xl, isGroupMessageId as Xn, HANDOFF_DONE as Xo, relayRequest as Xr, enrollHelloFrame as Xs, ONCHAIN_PROVIDER as Xt, groupName as Y, RUN_RESULTS as Ya, readImageMeta as Yc, PeerProofs as Yi, traceLink as Yl, groupFileFallback as Yn, HANDOFF_CANCEL as Yo, parseWakeFrame as Yr, enrollGrantFrame as Ys, EVM_TEST_CHAINS as Yt, SSHSIG_NAMESPACE as Z, TASK_STATUSES as Za, canonicalJsonBytes as Zc, validExternalKey as Zi, isDiscoveryBudgetError as Zl, readGroupFileMeta as Zn, HANDOFF_HAVE as Zo, wakeRequest as Zr, enrollProofFrame as Zs, PaymentPreflightError as Zt, openGroupTyping as _, voiceDownloadName as _a, mergeContactKnocks as _c, readManifest as _i, deviceKeyZ32 as _l, newPubkyProofFolder as _n, rosterHas as _o, lobbyKeys as _r, handoffManifestFrames as _s, parseAtprotoDidDocument as _t, toBase64Url as _u, appStoreDecision as a, DHT_FILE_CAPABILITY as aa, planKnocks as ac, APPS_CAPABILITY as ai, OwnInviteError as al, assertWholeSats as an, arrivalKey as ao, SIGNAL_REPLY_MS as ar, filePartName as as, BitcoinAddressError as at, createIdentity as au, CommunitySession as b, EDIT_BUFFER_MS as ba, readLinkRecord as bc, dnsProofName as bi, newDeviceSetSecret as bl, pubkyProofFile as bn, DirectPathWatch as bo, mergeLobby as br, handoffReleaseFrame as bs, verifyAtprotoRecordProof as bt, utf8Encode as bu, planAppUpdate as c, sanitizeFileName as ca, turnOff as cc, STATUS_CARD_CAPABILITY as ci, encodeInviteCode as cl, walletNetworkOf as cn, receivedTimestamp as co, MESH_HUBS as cr, handoffAttemptSucceeded as cs, ATPROTO_FULL_SCOPE as ct, publicKeyFromZ32 as cu, readAppStore as d, VOICE_LIMITS as da, contactDay as dc, HOLD_DATED_BACK_MS as di, ownInviteRefusal as dl, sparkAddressKind as dn, GROUP_MEMBER_CAP as do, pickMeshHubs as dr, handoffContext as ds, atprotoDidMethod as dt, sanitizeAvatar as du, irohDescriptor as ea, verifyEnrollProof as ec, APP_RANGE_LIMITS as ei, encodeContactLink as el, TEST_USDT_FAUCET_AMOUNT as en, cardLine as eo, readGroupWantNo as er, HANDOFF_PAKE as es, parseSshSignature as et, RELAY_PAYLOAD_MAX_BYTES as eu, readAppStoreSteps as f, VOICE_METER as fa, knockSlotIdentity as fc, HOLD_LIMITS as fi, DEVICES_CAPABILITY as fl, sparkInvoiceDetails as fn, MAX_GROUP_CHAIN as fo, COMMUNITY_TOPOLOGY as fr, handoffContextProof as fs, atprotoProofRecord as ft, sanitizeDisplayText as fu, groupTypingEpoch as g, parseVoiceMeta as ga, makeStampPaced as gc, newMailbox as gi, deviceEchoNonce as gl, isPubkyProofFolder as gn, rosterAdmin as go, freshHubs as gr, handoffHelloFrame as gs, normalizeAtprotoHandle as gt, randomBytes as gu, GroupTypingBoard as h, fileMessageText as ha, linkRecords as hc, isHoldUrl as hi, deviceEchoFrame as hl, isPubkyKey as hn, parseGroupCommit as ho, doorHubs as hr, handoffEphemeral as hs, isAtprotoDid as ht, isZ32Key as hu, appRevocationFor as i, peekDhtMailbox as ia, newInbox as ic, isAppVersion as ii, readDeviceInvite as il, assertTokenUnits as in, statusCardText as io, SIGNAL_HOLD_MS as ir, HANDOFF_VERIFIED as is, verifyBitcoinMessage as it, parseRelayPayload as iu, mergeKnocks as j, REACTION_LIMITS as ja, isAppUrl as jc, wellKnownUrl as ji, nextTurnPosition as jl, isFederationId as jn, LIMITS as jo, transferEnded as jr, readHandoffTurnFrame as js, didWebFile as jt, knockIdentity as k, COMMUNITY_REACTION_FRAME as ka, assembleAppBundle as kc, recordsName as ki, TURN_MAX as kl, fedimintRequestPayload as kn, parseLocalTarget as ko, FILE_LIMITS as kr, readHandoffHello as ks, didSignedMessages as kt, APP_STORE_LIMITS as l, sanitizeMime as la, ContactRequestError as lc, UPGRADE_CAPABILITY as li, inviteLink as ll, SPARK_NETWORKS as ln, shownTime as lo, mayBeHub as lr, handoffBusyFrame as ls, ATPROTO_PROOF_COLLECTION as lt, verify as lu, GROUP_TYPING_FRAME as m, downsamplePeaks as ma, knockSlotRecords as mc, HoldRefusedError as mi, HANDOFF_CAPABILITY as ml, PUBKY_PROOF_MAX_BYTES as mn, commitHash as mo, beaconRecords as mr, handoffDigest as ms, checkAtprotoProofRecord as mt, fromBase64Url as mu, readX401SdJwtVc as n, DHT_FILE_TOO_LARGE as na, endedRequests as nc, APP_DATA_MAX_BYTES as ni, createDeviceInvite as nl, WALLET_NETWORKS as nn, checkStatusCard as no, GROUP_SIGNAL_FRAME as nr, HANDOFF_REQUEST as ns, sshSignCommand as nt, newerPacket as nu, appUpdateDecision as o, dhtFileId as oa, settleRequest as oc, BUTTONS_CAPABILITY as oi, createChatInvite as ol, formatPaymentAmount as on, claimedTime as oo, groupSignalFrame as or, handoffAttemptAllowed as os, decodeAnyBitcoinAddress as ot, identityFromSeed as ou, signAppStore as p, baseMime as pa, knockSlotOf as pc, HoldKeys as pi, ENROLL_CAPABILITY as pl, isBitcoinAddress as pn, MEMBER_KEY as po, beaconKeys as pr, handoffDataFrame as ps, atprotoProofRkey as pt, bytesEqual as pu, parseCommunityEdit as q, PR_STATES as qa, signAppRevocation as qc, revokesIdentity as qi, normalizeRelayUrl as ql, GROUP_WANT_NO_FRAME as qn, serviceIdFromName as qo, deviceWakeRequest as qr, enrollDigits as qs, signDidDhtPacket as qt, sameX401HolderJwk as r, DHT_MESSAGE_TTL as ra, inboxRecord as rc, chatAppId as ri, deviceInviteJoinerParams as rl, arkAddressPrefix as rn, sameButtonText as ro, SIGNAL_FRESH_MS as rr, HANDOFF_TIMINGS as rs, verifySshSignature as rt, openRelayPayload as ru, checkAppBeforeRun as s, formatFileSize as sa, takeRequest as sc, EDIT_CAPABILITY as si, decodeInviteCode as sl, validatePaymentTarget as sn, heardTime as so, readGroupSignal as sr, handoffAttemptFailed as ss, ATPROTO_DECLARED_SCOPE as st, identityFromSeedB64 as su, newX401HolderKey as t, irohRelayUrl as ta, clearMissed as tc, isServeId as ti, readContactLink as tl, USDT_PUBLIC_RPC as tn, cardUrl as to, CarriedTransport as tr, HANDOFF_PIECE_BYTES as ts, sameSshKey as tt, createRelayPayload as tu, checkAppStoreIndex as u, PLAYABLE_AUDIO as ua, REQUEST_LIFETIME_MS as uc, HOLD_CAPABILITY as ui, inviteOwnership as ul, SPARK_PROVIDER as un, GROUP_ADMIN_OFF_ERROR as uo, meshHubs as ur, handoffCancelFrame as us, ATPROTO_PROOF_SCOPE as ut, MAX_AVATAR_LENGTH as uu, sealGroupTyping as v, voiceLevel as va, openRequest as vc, DOMAIN_FILE_MAX_BYTES as vi, deviceLinkPairing as vl, normalizePubkyKey as vn, verifyCommitSignature as vo, lobbyRecords as vr, handoffOfferFrame as vs, shortAtprotoDid as vt, toZ32 as vu, encodeCommunityLink as w, RateWindow as wa, APP_BUNDLE_MAGIC as wc, isPublicAddress as wi, TURN_RAISE_READ_TIMEOUT_MS as wl, requestLnurlInvoice as wn, RELAY_POLL_INTERVALS as wo, readBeacon as wr, newHandoffId as ws, DidError as wt, GROUP_READ_NOTE_COMMUNITY as x, EDIT_RATE_WINDOW_MS as xa, requestRecords as xc, domainTxtRecord as xi, seedSigner as xl, pubkyProofPath as xn, AWAITING_PEER_MS as xo, newerHead as xr, handoffRetryAfter as xs, DID_DOCUMENT_MAX_BYTES as xt, COMMUNITY_LIMITS as y, parseVideoMeta as ya, readKnockSlot as yc, decodeDnsResponse as yi, devicePingFrame as yl, pubkyProofCapability as yn, edgeParams as yo, mergeBeacon as yr, handoffPakeFrame as ys, AtprotoProofError as yt, utf8Decode as yu, GROUP_REACTED_FRAME as z, wireReaction as za, appRef as zc, IdentityCheckUnavailable as zi, turnVerifierMark as zl, pairedMessageFrame as zn, callSignalHeardAt as zo, PIN_LIMITS as zr, signTombstone as zs, signingKeys as zt };
34347
+ export { parseSshPublicKey as $, appCardId as $a, readImageMeta as $c, automaticTransport as $i, traceLink as $l, readGroupWant as $n, HANDOFF_HAVE as $o, vapidKeysMatch as $r, enrollHelloFrame as $s, SEPOLIA_TEST_USDT_FAUCET as $t, knockRecords as A, GROUP_REACTION_FRAME as Aa, appDigest as Ac, txtValue as Ai, classifyTurnRead as Al, findEndpoint as An, formatLocalTarget as Ao, FileUplink as Ar, readHandoffDone as As, didWebDocumentUrl as At, GROUP_READ_NOTE as B, pairedReplyAuthor as Ba, APP_STATEMENT_LIMITS as Bc, IdentityExchange as Bi, turnKeys as Bl, EngineError as Bn, callRtcConfig as Bo, mayPin as Br, setAckFrame as Bs, staticDidDocument as Bt, decodeCommunityLink as C, REMOVED_TEXT as Ca, readLinkRecord as Cc, encodeDnsQuery as Ci, devicePingFrame as Cl, pubkyHomeserverOf as Cn, AWAITING_PEER_MS as Co, rankHubs as Cr, handoffReleaseFrame as Cs, DID_JWS_MAX_LENGTH as Ct, utf8Decode as Cu, encodeGroupEntryLink as D, forwardedAgain as Da, APP_BUNDLE_MAGIC as Dc, recordsFromTxt as Di, TURN_PUT_WINDOW_MS as Dl, ENDPOINT as Dn, WATCH_PEER_MS as Do, shouldBeHub as Dr, newHandoffId as Ds, didGhostlyServiceEntry as Dt, decodeGroupEntryLink as E, parseLinkPreview as Ea, APP_BUNDLE_LIMITS as Ec, normalizeDomain as Ei, webCryptoSigner as El, decodeBolt11 as En, RELAY_POLL_INTERVALS as Eo, readLobby as Er, handoffVersions as Es, checkDidSignature as Et, groupWakeFrame as F, reactionEmoji as Fa, pacer as Fc, dialDescriptors as Fi, nextTurnPosition as Fl, INVITE_TAKEN as Fn, encodeControl as Fo, TypingSender as Fr, readHandoffVerified as Fs, normalizeDid as Ft, GROUP_EDIT_TEXT_BYTES as G, CRON_LINE as Ga, isAppKey as Gc, newIdentityBinding as Gi, HEDGE_MISSING_MS as Gl, GROUP_HAVE_FRAME as Gn, signalHasVideo as Go, WAKE_CALL_INTERVAL_MS as Gr, ENROLL_GRANT as Gs, encodeDidDhtPacket as Gt, frameBytes as H, replySnippet as Ha, appRef as Hc, emptyIdentityLedger as Hi, turnStatedVerifier as Hl, engineText as Hn, contactRtcConfig as Ho, pinIsNewer as Hr, signTombstone as Hs, didDhtDocument as Ht, groupWakes as I, reactionIsNewer as Ia, readAppBundle as Ic, IDENTITY_MAX_EVIDENCE as Ii, readTurnPacket as Il, LIVENESS_PING_MS as In, CALL_SIGNAL_MAX_AGE_MS as Io, sanitizeTypingStatus as Ir, sealHandoffPiece as Is, parseDid as It, mentionsMember as J, PR_STATES as Ja, readAppRevocations as Jc, lastSharedWithMe as Ji, RelaysFailedError as Jl, fetchesByItself as Jn, LEGACY_SERVICES as Jo, newWakeToken as Jr, enrollCancelFrame as Js, ETHEREUM_USDT as Jt, carryMentions as K, ITEM_STATES as Ka, isAppRef as Kc, receivedIdentityStatus as Ki, HEDGE_MS as Kl, GROUP_WANT_FRAME as Kn, emptyLinkRecords as Ko, WakeLimiter as Kr, ENROLL_HELLO as Ks, resolveDidDht as Kt, parseGroupWakeFrame as L, readReaction as La, readAppBundleAsync as Lc, IDENTITY_MAX_VALIDITY as Li, signTurnPacket as Ll, PAIRED_FRAME_TOO_LARGE as Ln, RTC_CONFIG as Lo, typingActivity as Lr, SET_ACK as Ls, parseDidDocument as Lt, readKnocks as M, ReactionWindow as Ma, assembleAppBundle as Mc, CapsExchange as Mi, TURN_LAST_SEQUENCE as Ml, parseCashuRequestPayload as Mn, webLocalFetch as Mo, transferStalled as Mr, readHandoffHello as Ms, didWebFileNames as Mt, GROUP_WAKE_FRAME as N, nextReactionNumber as Na, checkAppManifest as Nc, DHT_TEXT_CAPABILITY as Ni, TURN_MAX as Nl, parseFedimintRequestPayload as Nn, LIMITS as No, TYPING_KINDS as Nr, readHandoffPake as Ns, didWebFileUrl as Nt, entryParams as O, readForwarded as Oa, APP_ICON_PATH as Oc, recordsFromWellKnown as Oi, TURN_RAISE_READ_TIMEOUT_MS as Ol, cashuRequestPayload as On, presenceSeenAt as Oo, ChatFiles as Or, readHandoffAck as Os, didJwsAlg as Ot, GroupWakeLimiter as P, queueReaction as Pa, isAppUrl as Pc, capsDescriptors as Pi, firstDeviceSetSecret as Pl, GhostLink as Pn, decodeControl as Po, TYPING_REFRESH_MS as Pr, readHandoffTurnFrame as Ps, didWebHost as Pt, SshSigError as Q, TASK_STATUSES as Qa, parseImageMeta as Qc, TRANSPORTS as Qi, setLinkTraceSink as Ql, readGroupHave as Qn, HANDOFF_DONE as Qo, checkPushEndpoint as Qr, enrollGrantFrame as Qs, SEPOLIA_TEST_USDT as Qt, GROUP_LIMITS as R, validReactionNumber as Ra, sha256Paced as Rc, IDENTITY_REVOCATION_LABEL as Ri, signTurnRelease as Rl, pairedMessageFits as Rn, answersOffer as Ro, GROUP_PIN_FRAME as Rr, SET_UPDATE as Rs, parseDidSignaturePaste as Rt, communityHasFrame as S, MAX_REMOVAL_NUMBER as Sa, readKnockSlot as Sc, domainWellKnownFile as Si, deviceLinkPairing as Sl, homeserverWebEndpoint as Sn, DirectPathWatch as So, pickHubs as Sr, handoffPakeFrame as Ss, DID_FILE_MAX_BYTES as St, toZ32 as Su, KNOCK_TTL_MS as T, dhtEditId as Ta, seenEntry as Tc, nip05RootKey as Ti, seedSigner as Tl, resolveLightningDestination as Tn, EXPECT_PEER_MS as To, readBeaconHead as Tr, handoffStreamKey as Ts, checkDidJws as Tt, COMMUNITY_EDIT_FRAME as U, BUTTON_ID as Ua, checkAppRevokeStatement as Uc, identityRevocationValue as Ui, turnVerifierMark as Ul, parseEngineError as Un, extractParamsFromSdp as Uo, pinNumberHolds as Ur, verifySetUpdate as Us, didDhtFromPublicKey as Ut, GroupSession as V, readReply as Va, appFingerprint as Vc, boundVerifiedIdentity as Vi, turnName as Vl, engineError as Vn, callSignalHeardAt as Vo, nextPinNumber as Vr, setUpdateFrame as Vs, strictBase64Url as Vt, GROUP_EDIT_FRAME as W, BUTTON_STYLES as Wa, isAppHash as Wc, identityStatement as Wi, DEFAULT_RELAYS as Wl, GROUP_FILE_LIMITS as Wn, parseCallSignal as Wo, readPin as Wr, ENROLL_DONE as Ws, encodeDidDhtDeactivated as Wt, SSHSIG_MAX_ARMOR as X, RUN_RESULTS as Xa, signAppObject as Xc, emptyProofLedger as Xi, currentRelays as Xl, isGroupMessageId as Xn, HANDOFF_ACK as Xo, relayRequest as Xr, enrollDigits as Xs, ONCHAIN_PROVIDER as Xt, groupName as Y, ROUTINE_STATES as Ya, setAppSignatureFastPath as Yc, PeerProofs as Yi, SLOW_MS as Yl, groupFileFallback as Yn, serviceIdFromName as Yo, parseWakeFrame as Yr, enrollCancelReason as Ys, EVM_TEST_CHAINS as Yt, SSHSIG_NAMESPACE as Z, STATUS_CARD_LIMITS as Za, signAppRevocation as Zc, validExternalKey as Zi, normalizeRelayUrl as Zl, readGroupFileMeta as Zn, HANDOFF_CANCEL as Zo, wakeRequest as Zr, enrollDoneFrame as Zs, PaymentPreflightError as Zt, openGroupTyping as _, voiceDownloadName as _a, knockSlotRecords as _c, readManifest as _i, ENROLL_CAPABILITY as _l, newPubkyProofFolder as _n, parseGroupCommit as _o, lobbyKeys as _r, handoffDigest as _s, parseAtprotoDidDocument as _t, bytesEqual as _u, appStoreDecision as a, DHT_FILE_CAPABILITY as aa, endedRequests as ac, APPS_CAPABILITY as ai, readContactLink as al, assertWholeSats as an, statusCardBytes as ao, SIGNAL_REPLY_MS as ar, HANDOFF_TIMINGS as as, BitcoinAddressError as at, createRelayPayload as au, CommunitySession as b, EDIT_BUFFER_MS as ba, mergeContactKnocks as bc, dnsProofName as bi, deviceEchoNonce as bl, pubkyProofFile as bn, verifyCommitSignature as bo, mergeLobby as br, handoffManifestFrames as bs, verifyAtprotoRecordProof as bt, randomBytes as bu, planAppUpdate as c, sanitizeFileName as ca, planKnocks as cc, STATUS_CARD_CAPABILITY as ci, readDeviceInvite as cl, walletNetworkOf as cn, claimedTime as co, MESH_HUBS as cr, filePartName as cs, ATPROTO_FULL_SCOPE as ct, parseRelayPayload as cu, readAppStore as d, VOICE_LIMITS as da, turnOff as dc, HOLD_DATED_BACK_MS as di, decodeInviteCode as dl, sparkAddressKind as dn, shownTime as do, pickMeshHubs as dr, handoffAttemptSucceeded as ds, atprotoDidMethod as dt, identityFromSeedB64 as du, irohDescriptor as ea, enrollProofFrame as ec, APP_RANGE_LIMITS as ei, canonicalJson as el, TEST_USDT_FAUCET_AMOUNT as en, buttonLabelClash as eo, readGroupWantNo as er, HANDOFF_HELLO as es, parseSshSignature as et, budgetRetryMs as eu, readAppStoreSteps as f, VOICE_METER as fa, ContactRequestError as fc, HOLD_LIMITS as fi, encodeInviteCode as fl, sparkInvoiceDetails as fn, GROUP_ADMIN_OFF_ERROR as fo, COMMUNITY_TOPOLOGY as fr, handoffBusyFrame as fs, atprotoProofRecord as ft, publicKeyFromZ32 as fu, groupTypingEpoch as g, parseVoiceMeta as ga, knockSlotOf as gc, newMailbox as gi, DEVICES_CAPABILITY as gl, isPubkyProofFolder as gn, commitHash as go, freshHubs as gr, handoffDataFrame as gs, normalizeAtprotoHandle as gt, sanitizeDisplayText as gu, GroupTypingBoard as h, fileMessageText as ha, knockSlotIdentity as hc, isHoldUrl as hi, ownInviteRefusal as hl, isPubkyKey as hn, MEMBER_KEY as ho, doorHubs as hr, handoffContextProof as hs, isAtprotoDid as ht, sanitizeAvatar as hu, appRevocationFor as i, peekDhtMailbox as ia, clearMissed as ic, isAppVersion as ii, encodeContactLink as il, assertTokenUnits as in, sameButtonText as io, SIGNAL_HOLD_MS as ir, HANDOFF_REQUEST as is, verifyBitcoinMessage as it, RELAY_PAYLOAD_MAX_BYTES as iu, mergeKnocks as j, REACTION_LIMITS as ja, appViewOf as jc, wellKnownUrl as ji, turnPutSummary as jl, isFederationId as jn, parseLocalTarget as jo, transferEnded as jr, readHandoffHave as js, didWebFile as jt, knockIdentity as k, COMMUNITY_REACTION_FRAME as ka, APP_PERMISSIONS as kc, recordsName as ki, TURN_SETTLE_MS as kl, fedimintRequestPayload as kn, GhostlyHttpError as ko, FILE_LIMITS as kr, readHandoffCancel as ks, didSignedMessages as kt, APP_STORE_LIMITS as l, sanitizeMime as la, settleRequest as lc, UPGRADE_CAPABILITY as li, OwnInviteError as ll, SPARK_NETWORKS as ln, heardTime as lo, mayBeHub as lr, handoffAttemptAllowed as ls, ATPROTO_PROOF_COLLECTION as lt, createIdentity as lu, GROUP_TYPING_FRAME as m, downsamplePeaks as ma, contactDay as mc, HoldRefusedError as mi, inviteOwnership as ml, PUBKY_PROOF_MAX_BYTES as mn, MAX_GROUP_CHAIN as mo, beaconRecords as mr, handoffContext as ms, checkAtprotoProofRecord as mt, MAX_AVATAR_LENGTH as mu, readX401SdJwtVc as n, DHT_FILE_TOO_LARGE as na, readEnrollHello as nc, APP_DATA_MAX_BYTES as ni, readCanonicalJson as nl, WALLET_NETWORKS as nn, cardUrl as no, GROUP_SIGNAL_FRAME as nr, HANDOFF_PAKE as ns, sshSignCommand as nt, withRequestOptions as nu, appUpdateDecision as o, dhtFileId as oa, inboxRecord as oc, BUTTONS_CAPABILITY as oi, createDeviceInvite as ol, formatPaymentAmount as on, statusCardText as oo, groupSignalFrame as or, HANDOFF_VERIFIED as os, decodeAnyBitcoinAddress as ot, newerPacket as ou, signAppStore as p, baseMime as pa, REQUEST_LIFETIME_MS as pc, HoldKeys as pi, inviteLink as pl, isBitcoinAddress as pn, GROUP_MEMBER_CAP as po, beaconKeys as pr, handoffCancelFrame as ps, atprotoProofRkey as pt, verify as pu, parseCommunityEdit as q, PR_CHECKS as qa, readAppRevocation as qc, revokesIdentity as qi, RelayTransport as ql, GROUP_WANT_NO_FRAME as qn, HTTP_SERVICE_PROTO as qo, deviceWakeRequest as qr, ENROLL_PROOF as qs, signDidDhtPacket as qt, sameX401HolderJwk as r, DHT_MESSAGE_TTL as ra, verifyEnrollProof as rc, chatAppId as ri, createContactLink as rl, arkAddressPrefix as rn, checkStatusCard as ro, SIGNAL_FRESH_MS as rr, HANDOFF_PIECE_BYTES as rs, verifySshSignature as rt, PacketTooLargeError as ru, checkAppBeforeRun as s, formatFileSize as sa, newInbox as sc, EDIT_CAPABILITY as si, deviceInviteJoinerParams as sl, validatePaymentTarget as sn, arrivalKey as so, readGroupSignal as sr, NO_ATTEMPTS as ss, ATPROTO_DECLARED_SCOPE as st, openRelayPayload as su, newX401HolderKey as t, irohRelayUrl as ta, readEnrollGrant as tc, isServeId as ti, canonicalJsonBytes as tl, USDT_PUBLIC_RPC as tn, cardLine as to, CarriedTransport as tr, HANDOFF_OFFER as ts, sameSshKey as tt, isDiscoveryBudgetError as tu, checkAppStoreIndex as u, PLAYABLE_AUDIO as ua, takeRequest as uc, HOLD_CAPABILITY as ui, createChatInvite as ul, SPARK_PROVIDER as un, receivedTimestamp as uo, meshHubs as ur, handoffAttemptFailed as us, ATPROTO_PROOF_SCOPE as ut, identityFromSeed as uu, sealGroupTyping as v, voiceLevel as va, linkRecords as vc, DOMAIN_FILE_MAX_BYTES as vi, HANDOFF_CAPABILITY as vl, normalizePubkyKey as vn, rosterAdmin as vo, lobbyRecords as vr, handoffEphemeral as vs, shortAtprotoDid as vt, fromBase64Url as vu, encodeCommunityLink as w, RateWindow as wa, requestRecords as wc, isPublicAddress as wi, newDeviceSetSecret as wl, requestLnurlInvoice as wn, DHT_POLL_INTERVALS as wo, readBeacon as wr, handoffRetryAfter as ws, DidError as wt, utf8Encode as wu, GROUP_READ_NOTE_COMMUNITY as x, EDIT_RATE_WINDOW_MS as xa, openRequest as xc, domainTxtRecord as xi, deviceKeyZ32 as xl, pubkyProofPath as xn, edgeParams as xo, newerHead as xr, handoffOfferFrame as xs, DID_DOCUMENT_MAX_BYTES as xt, toBase64Url as xu, COMMUNITY_LIMITS as y, parseVideoMeta as ya, makeStampPaced as yc, decodeDnsResponse as yi, deviceEchoFrame as yl, pubkyProofCapability as yn, rosterHas as yo, mergeBeacon as yr, handoffHelloFrame as ys, AtprotoProofError as yt, isZ32Key as yu, GROUP_REACTED_FRAME as z, wireReaction as za, APP_PREFIXES as zc, IdentityCheckUnavailable as zi, turnInstance as zl, pairedMessageFrame as zn, buildSdpFromSignal as zo, PIN_LIMITS as zr, readSetUpdate as zs, signingKeys as zt };
34126
34348
 
34127
- //# sourceMappingURL=src-BBG_NwMc.js.map
34349
+ //# sourceMappingURL=src-BsznF3XG.js.map