@ghostlytools/cli 1.13.0 → 1.13.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.
- package/README.md +13 -10
- package/dist/assets/api-DV52o7A8.js +3 -0
- package/dist/assets/{api-CjOaoG-v.js → api-O57SNJcb.js} +495 -99
- package/dist/assets/api-O57SNJcb.js.map +1 -0
- package/dist/assets/{apiKit-BAGvlQtm.js → apiKit-CPTFJHA7.js} +40 -8
- package/dist/assets/{apiKit-BAGvlQtm.js.map → apiKit-CPTFJHA7.js.map} +1 -1
- package/dist/assets/{appFetch-BwJd-kNq.js → appFetch-Ca9DNQQ2.js} +2 -2
- package/dist/assets/{appFetch-BwJd-kNq.js.map → appFetch-Ca9DNQQ2.js.map} +1 -1
- package/dist/assets/{apps-Cuk45sz5.js → apps-gXpGFPiv.js} +16 -14
- package/dist/assets/apps-gXpGFPiv.js.map +1 -0
- package/dist/assets/{apps-DjY095Af.js → apps-uZTu5FlR.js} +1 -1
- package/dist/assets/{arkade-DryM-q5n.js → arkade-B6UNf5HI.js} +2 -2
- package/dist/assets/{arkade-DryM-q5n.js.map → arkade-B6UNf5HI.js.map} +1 -1
- package/dist/assets/{backup-DekVCDWv.js → backup-CxH3auHB.js} +9 -7
- package/dist/assets/backup-CxH3auHB.js.map +1 -0
- package/dist/assets/{backup-B56sQqoQ.js → backup-Di2U6QVH.js} +1 -1
- package/dist/assets/bark_ffi_wasm_bg-CcafsJla.js.map +1 -1
- package/dist/assets/{bitcoind-B2bbVSzh.js → bitcoind-BpZn3bRN.js} +2 -2
- package/dist/assets/{bitcoind-B2bbVSzh.js.map → bitcoind-BpZn3bRN.js.map} +1 -1
- package/dist/assets/bitcoindevkit_bg-BWQHx7vd.js.map +1 -1
- package/dist/assets/{buttons-BGxzOtrq.js → buttons-D4udKEvT.js} +8 -8
- package/dist/assets/buttons-D4udKEvT.js.map +1 -0
- package/dist/assets/buttons-YTYEqvGC.js +1 -0
- package/dist/assets/{client-DcQAfc3h.js → client-DGx7E8b3.js} +3 -3
- package/dist/assets/{client-DcQAfc3h.js.map → client-DGx7E8b3.js.map} +1 -1
- package/dist/assets/{domainProofs-BDNP1dIy.js → domainProofs-b3Y1Gj9g.js} +6 -2
- package/dist/assets/{domainProofs-BDNP1dIy.js.map → domainProofs-b3Y1Gj9g.js.map} +1 -1
- package/dist/assets/{engineErrors--9hfgKlK.js → engineErrors-wWlLy54D.js} +11 -3
- package/dist/assets/engineErrors-wWlLy54D.js.map +1 -0
- package/dist/assets/{errors-DDLFO4Gf.js → errors-JVJsO8Iu.js} +18 -2
- package/dist/assets/errors-JVJsO8Iu.js.map +1 -0
- package/dist/assets/{fixedHosts-C3hBliM9.js → fixedHosts-CODN2pTL.js} +3 -3
- package/dist/assets/{fixedHosts-C3hBliM9.js.map → fixedHosts-CODN2pTL.js.map} +1 -1
- package/dist/assets/{ghostly_iroh_web-DIj5xGmR.js → ghostly_iroh_web-9VOwZcJQ.js} +30 -35
- package/dist/assets/ghostly_iroh_web-9VOwZcJQ.js.map +1 -0
- package/dist/assets/ghostly_iroh_web_bg.wasm +0 -0
- package/dist/assets/{groupMeta-goASqzOt.js → groupMeta-CeZpqVVC.js} +174 -37
- package/dist/assets/groupMeta-CeZpqVVC.js.map +1 -0
- package/dist/assets/{host-C2WRKj3g.js → host-CRA7h5A2.js} +270 -64
- package/dist/assets/host-CRA7h5A2.js.map +1 -0
- package/dist/assets/{hyperdhtRelay-DLUiwfnt.js → hyperdhtRelay-B34Zhz4P.js} +2 -2
- package/dist/assets/{hyperdhtRelay-DLUiwfnt.js.map → hyperdhtRelay-B34Zhz4P.js.map} +1 -1
- package/dist/assets/{hyperdhtRelay-bjNGacf5.js → hyperdhtRelay-DDwU5b4P.js} +2 -2
- package/dist/assets/{hyperdhtRelay-bjNGacf5.js.map → hyperdhtRelay-DDwU5b4P.js.map} +1 -1
- package/dist/assets/{identityProofs-Cksc_K7_.js → identityProofs-B8zCp5_0.js} +140 -27
- package/dist/assets/identityProofs-B8zCp5_0.js.map +1 -0
- package/dist/assets/{irohWeb-NfthOL98.js → irohWeb-mnOi2Jp7.js} +10838 -4837
- package/dist/assets/irohWeb-mnOi2Jp7.js.map +1 -0
- package/dist/assets/{linkPreview-DdMf-YAc.js → linkPreview-5kHmKUTN.js} +20 -8
- package/dist/assets/linkPreview-5kHmKUTN.js.map +1 -0
- package/dist/assets/{main-Dh7fePd8.js → main-Chc871HV.js} +119 -81
- package/dist/assets/main-Chc871HV.js.map +1 -0
- package/dist/assets/{mainline-DY95WbuK.js → mainline-CDUXtV-I.js} +2 -2
- package/dist/assets/{mainline-DY95WbuK.js.map → mainline-CDUXtV-I.js.map} +1 -1
- package/dist/assets/{networkReason-Be-hMghr.js → networkReason-DYlPZS5M.js} +2 -2
- package/dist/assets/{networkReason-Be-hMghr.js.map → networkReason-DYlPZS5M.js.map} +1 -1
- package/dist/assets/{ownDid-BErplN7N.js → ownDid-BOuSlDv-.js} +10 -6
- package/dist/assets/ownDid-BOuSlDv-.js.map +1 -0
- package/dist/assets/{ownStatus-ClrFjd7h.js → ownStatus-CLA1VPkL.js} +6 -6
- package/dist/assets/{ownStatus-ClrFjd7h.js.map → ownStatus-CLA1VPkL.js.map} +1 -1
- package/dist/assets/{pairedTransports-BKmvlKz1.js → pairedTransports-DAzupLYo.js} +23 -17
- package/dist/assets/pairedTransports-DAzupLYo.js.map +1 -0
- package/dist/assets/{paymentIntent-DySU3Ajm.js → paymentIntent-Cr3uZa_0.js} +2 -2
- package/dist/assets/{paymentIntent-DySU3Ajm.js.map → paymentIntent-Cr3uZa_0.js.map} +1 -1
- package/dist/assets/{profiles-B8xO8-oj.js → profiles-BH1bH9aE.js} +3 -3
- package/dist/assets/{profiles-B8xO8-oj.js.map → profiles-BH1bH9aE.js.map} +1 -1
- package/dist/assets/{registry--Rg2YvOH.js → registry-DAq16T-V.js} +1 -1
- package/dist/assets/{registry-CU8PevhI.js → registry-DP_-RA-v.js} +11 -7
- package/dist/assets/registry-DP_-RA-v.js.map +1 -0
- package/dist/assets/{relay-CHWg5hpZ.js → relay-gJTOYQJZ.js} +93 -7
- package/dist/assets/relay-gJTOYQJZ.js.map +1 -0
- package/dist/assets/{resolve-B1upovPM.js → resolve-B1eQ4dVQ.js} +10 -5
- package/dist/assets/resolve-B1eQ4dVQ.js.map +1 -0
- package/dist/assets/secretGuard-Bh11MPdI.js +1 -0
- package/dist/assets/{secretGuard-BrATm_gl.js → secretGuard-oz_3hBfW.js} +19 -2
- package/dist/assets/{secretGuard-BrATm_gl.js.map → secretGuard-oz_3hBfW.js.map} +1 -1
- package/dist/assets/{server-Dgxx_DaN.js → server-Bd2ofxc1.js} +1283 -6628
- package/dist/assets/server-Bd2ofxc1.js.map +1 -0
- package/dist/assets/{sshForges-BnvwmNj-.js → sshForges-As7dbGXM.js} +2 -2
- package/dist/assets/{sshForges-BnvwmNj-.js.map → sshForges-As7dbGXM.js.map} +1 -1
- package/dist/assets/{translate-BcbSWkuq.js → translate-DnuQMfj0.js} +22 -11
- package/dist/assets/translate-DnuQMfj0.js.map +1 -0
- package/dist/assets/{usdt-CBJ4Q5Ji.js → usdt-DLmtf8F9.js} +4 -4
- package/dist/assets/{usdt-CBJ4Q5Ji.js.map → usdt-DLmtf8F9.js.map} +1 -1
- package/dist/assets/{waitNotice-ylU3XwjO.js → waitNotice-BHuMofaH.js} +57 -3
- package/dist/assets/waitNotice-BHuMofaH.js.map +1 -0
- package/dist/ghostly.mjs +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/dist/assets/api-CVtg7MpI.js +0 -3
- package/dist/assets/api-CjOaoG-v.js.map +0 -1
- package/dist/assets/apps-Cuk45sz5.js.map +0 -1
- package/dist/assets/backup-DekVCDWv.js.map +0 -1
- package/dist/assets/buttons-BGxzOtrq.js.map +0 -1
- package/dist/assets/buttons-CsN2WJOf.js +0 -1
- package/dist/assets/engineErrors--9hfgKlK.js.map +0 -1
- package/dist/assets/errors-DDLFO4Gf.js.map +0 -1
- package/dist/assets/ghostly_iroh_web-DIj5xGmR.js.map +0 -1
- package/dist/assets/groupMeta-goASqzOt.js.map +0 -1
- package/dist/assets/host-C2WRKj3g.js.map +0 -1
- package/dist/assets/identityProofs-Cksc_K7_.js.map +0 -1
- package/dist/assets/irohWeb-NfthOL98.js.map +0 -1
- package/dist/assets/linkPreview-DdMf-YAc.js.map +0 -1
- package/dist/assets/main-Dh7fePd8.js.map +0 -1
- package/dist/assets/ownDid-BErplN7N.js.map +0 -1
- package/dist/assets/pairedTransports-BKmvlKz1.js.map +0 -1
- package/dist/assets/registry-CU8PevhI.js.map +0 -1
- package/dist/assets/relay-CHWg5hpZ.js.map +0 -1
- package/dist/assets/resolve-B1upovPM.js.map +0 -1
- package/dist/assets/secretGuard-Bm6nci0I.js +0 -1
- package/dist/assets/server-Dgxx_DaN.js.map +0 -1
- package/dist/assets/translate-BcbSWkuq.js.map +0 -1
- package/dist/assets/waitNotice-ylU3XwjO.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { a as fromZ32, c as toBase64, d as utf8Decode, f as utf8Encode, i as fromBase64Url, l as toBase64Url, n as concatBytes, o as isZ32Key, r as fromBase64, s as randomBytes, t as bytesEqual, u as toZ32 } from "./bytes-C1DNGY18.js";
|
|
2
2
|
import { a as stripHidden, i as sanitizeNick, n as hasVisible, o as trimEndOf, r as sanitizeDisplayText, s as unwrapPasted } from "./text-li76pThX.js";
|
|
3
|
-
import {
|
|
4
|
-
import { C as
|
|
3
|
+
import { a as parseLinkPreview, s as sanitizeAvatar } from "./linkPreview-5kHmKUTN.js";
|
|
4
|
+
import { C as encrypt, E as tryDecrypt, T as sealedLength, a as checkedDescriptors, c as irohRelayUrl, f as relayedTransports, i as automaticTransport, l as rankTransports, m as HOLD_CAPABILITY, n as RELAY_WITH_SECRETS, p as transportOrder, r as TRANSPORTS, t as RELAY_URL, u as relayUrl, w as generateEncryptionKey } from "./pairedTransports-DAzupLYo.js";
|
|
5
5
|
import { S as verify, _ as identityFromSeed, a as createRelayPayload, g as createIdentity, i as RELAY_PAYLOAD_MAX_BYTES, l as parseRelayPayload, n as PKARR_FUTURE_SKEW_MS, o as measureRecords, s as newerPacket, t as MAX_DNS_PACKET_BYTES, v as identityFromSeedB64, x as sign, y as publicKeyFromZ32 } from "./pkarr-BQo4PcCg.js";
|
|
6
|
-
import { a as RelaysFailedError, d as traceLink, h as publishedNowhere, m as isDiscoveryBudgetError, p as budgetRetryMs } from "./relay-
|
|
7
|
-
import { a as IDENTITY_PROOF_CAPABILITY, t as IDENTITY_FRAME_WINDOW_MS } from "./identityProofs-
|
|
8
|
-
import {
|
|
6
|
+
import { a as RelaysFailedError, d as traceLink, h as publishedNowhere, m as isDiscoveryBudgetError, p as budgetRetryMs } from "./relay-gJTOYQJZ.js";
|
|
7
|
+
import { a as IDENTITY_PROOF_CAPABILITY, t as IDENTITY_FRAME_WINDOW_MS } from "./identityProofs-B8zCp5_0.js";
|
|
8
|
+
import { r as engineError } from "./engineErrors-wWlLy54D.js";
|
|
9
9
|
import b4a from "b4a";
|
|
10
10
|
import { ed25519, x25519 } from "@noble/curves/ed25519.js";
|
|
11
11
|
import { sha256 } from "@noble/hashes/sha2.js";
|
|
@@ -501,6 +501,42 @@ function readCanonicalJson(bytes) {
|
|
|
501
501
|
value
|
|
502
502
|
};
|
|
503
503
|
}
|
|
504
|
+
/**
|
|
505
|
+
* The entries of bytes that must be a canonical JSON list, each as its own bytes, one at a time: a scan that builds no
|
|
506
|
+
* value and goes no further than the entry it yields, so a caller reads (and may refuse) each before the next is
|
|
507
|
+
* found. It ends with null at the closing `]`; `not-list` past `maxEntries` entries, at an entry over `maxEntryBytes`,
|
|
508
|
+
* or when the bytes are not within `[` and `]`; `not-json` when brackets or quotes do not close. A canonical list is
|
|
509
|
+
* `[`, its entries' canonical texts joined by `,`, then `]`, so the bytes are canonical exactly when the scan ends with
|
|
510
|
+
* null and each entry read alone with `readCanonicalJson` is.
|
|
511
|
+
*/
|
|
512
|
+
function* canonicalJsonListEntries(bytes, maxEntries, maxEntryBytes) {
|
|
513
|
+
const end = bytes.length - 1;
|
|
514
|
+
if (end < 1 || bytes[0] !== 91 || bytes[end] !== 93) return "not-list";
|
|
515
|
+
if (end === 1) return null;
|
|
516
|
+
let depth = 0;
|
|
517
|
+
let inString = false;
|
|
518
|
+
let start = 1;
|
|
519
|
+
let count = 0;
|
|
520
|
+
for (let i = 1; i <= end; i++) {
|
|
521
|
+
const b = bytes[i];
|
|
522
|
+
if (i === end || b === 44 && depth === 0 && !inString) {
|
|
523
|
+
if (i === end && (depth !== 0 || inString)) return "not-json";
|
|
524
|
+
if (count === maxEntries || i - start > maxEntryBytes) return "not-list";
|
|
525
|
+
count++;
|
|
526
|
+
yield bytes.subarray(start, i);
|
|
527
|
+
start = i + 1;
|
|
528
|
+
continue;
|
|
529
|
+
}
|
|
530
|
+
if (i - start >= maxEntryBytes) return "not-list";
|
|
531
|
+
if (inString) {
|
|
532
|
+
if (b === 92) i++;
|
|
533
|
+
else if (b === 34) inString = false;
|
|
534
|
+
} else if (b === 34) inString = true;
|
|
535
|
+
else if (b === 91 || b === 123) depth++;
|
|
536
|
+
else if ((b === 93 || b === 125) && --depth < 0) return "not-json";
|
|
537
|
+
}
|
|
538
|
+
return start === end + 1 ? null : "not-json";
|
|
539
|
+
}
|
|
504
540
|
// ../core/src/image.ts
|
|
505
541
|
var IMAGE_LIMITS = {
|
|
506
542
|
/** Pixels on either side: the most a JPEG can say, well past what anyone sends as a picture. */
|
|
@@ -680,7 +716,12 @@ var APP_STATEMENT_LIMITS = {
|
|
|
680
716
|
/** A revocation's reason, in characters. */
|
|
681
717
|
reason: 200,
|
|
682
718
|
/** Revocations in one `ghostly-revoke.json`. */
|
|
683
|
-
revocations: 4096
|
|
719
|
+
revocations: 4096,
|
|
720
|
+
/**
|
|
721
|
+
* One signed revocation's canonical bytes: twice the largest a valid one can be (64 digests, a 32-character name and
|
|
722
|
+
* a 200-character reason of 4-byte characters: about 4.1 KB), so a reader refuses a larger entry before parsing it.
|
|
723
|
+
*/
|
|
724
|
+
revocationBytes: 8192
|
|
684
725
|
};
|
|
685
726
|
/** A z-base32 Ed25519 public key: 52 characters that decode to 32 bytes and encode back to the same text. */
|
|
686
727
|
function isAppKey(value) {
|
|
@@ -962,24 +1003,39 @@ function verifyAppRevocation(revocation, checked) {
|
|
|
962
1003
|
* file, as a store index's `revoked` does. With `checked`, a revocation it holds is not checked again.
|
|
963
1004
|
*/
|
|
964
1005
|
function readAppRevocations(bytes, checked) {
|
|
965
|
-
const read = readCanonicalJson(bytes);
|
|
966
|
-
if (!read.ok) return read;
|
|
967
|
-
if (!Array.isArray(read.value) || read.value.length > APP_STATEMENT_LIMITS.revocations) return {
|
|
968
|
-
ok: false,
|
|
969
|
-
reason: "bad-revocation",
|
|
970
|
-
detail: "Not a list of at most 4096 revocations"
|
|
971
|
-
};
|
|
972
1006
|
const revocations = [];
|
|
973
|
-
|
|
974
|
-
|
|
1007
|
+
const entries = appRevocationsFileEntries(bytes);
|
|
1008
|
+
let next = entries.next();
|
|
1009
|
+
for (; !next.done; next = entries.next()) {
|
|
1010
|
+
const read = readCanonicalJson(next.value);
|
|
1011
|
+
if (!read.ok) return read;
|
|
1012
|
+
const one = readAppRevocation(read.value, checked);
|
|
975
1013
|
if (!one.ok) return one;
|
|
976
1014
|
revocations.push(one.revocation);
|
|
977
1015
|
}
|
|
978
|
-
return {
|
|
1016
|
+
return next.value ?? {
|
|
979
1017
|
ok: true,
|
|
980
1018
|
revocations
|
|
981
1019
|
};
|
|
982
1020
|
}
|
|
1021
|
+
/**
|
|
1022
|
+
* The entries of a `ghostly-revoke.json`, each as its own bytes, one at a time and with nothing parsed: a file past
|
|
1023
|
+
* 4096 entries, or with one larger than any revocation can be, is refused there, however large it is. It ends with null
|
|
1024
|
+
* when the list closed. Each entry read alone (`readCanonicalJson`, then `readAppRevocation`) refuses exactly the files
|
|
1025
|
+
* reading the file whole refuses.
|
|
1026
|
+
*/
|
|
1027
|
+
function* appRevocationsFileEntries(bytes) {
|
|
1028
|
+
const end = yield* canonicalJsonListEntries(bytes, APP_STATEMENT_LIMITS.revocations, APP_STATEMENT_LIMITS.revocationBytes);
|
|
1029
|
+
if (end === "not-list") return {
|
|
1030
|
+
ok: false,
|
|
1031
|
+
reason: "bad-revocation",
|
|
1032
|
+
detail: "Not a list of at most 4096 revocations"
|
|
1033
|
+
};
|
|
1034
|
+
return end && {
|
|
1035
|
+
ok: false,
|
|
1036
|
+
reason: end
|
|
1037
|
+
};
|
|
1038
|
+
}
|
|
983
1039
|
// ../core/src/appBundle.ts
|
|
984
1040
|
var APP_BUNDLE_MAGIC = "GHOSTLYAPP1";
|
|
985
1041
|
var MAGIC = utf8Encode(APP_BUNDLE_MAGIC);
|
|
@@ -3346,6 +3402,7 @@ var VIEWER_PERMISSIONS_POLICY = [
|
|
|
3346
3402
|
"serial",
|
|
3347
3403
|
"hid",
|
|
3348
3404
|
"clipboard-read",
|
|
3405
|
+
"clipboard-write",
|
|
3349
3406
|
"idle-detection",
|
|
3350
3407
|
"local-fonts",
|
|
3351
3408
|
"window-management",
|
|
@@ -4176,9 +4233,9 @@ var LinkSession = class {
|
|
|
4176
4233
|
if (publish) this.publish().catch(() => {});
|
|
4177
4234
|
if (read) this.pollNow();
|
|
4178
4235
|
}
|
|
4179
|
-
/** This side's packet goes out now, unless one already did. */
|
|
4236
|
+
/** This side's packet goes out now, unless one already did (in this run, once it left DHT only: `presenceDue`). */
|
|
4180
4237
|
ensureAdvertised() {
|
|
4181
|
-
if (!this.running || this.lastPublishedAt > 0 || this.publishing) return;
|
|
4238
|
+
if (!this.running || this.lastPublishedAt > 0 && !this.presenceDueOut || this.publishing) return;
|
|
4182
4239
|
this.publish().catch(() => {});
|
|
4183
4240
|
}
|
|
4184
4241
|
/** This side's packet goes out again as it is: another writer of its key (a second device on a device code) may have replaced it. */
|
|
@@ -6780,6 +6837,15 @@ function removedCardText(of, title) {
|
|
|
6780
6837
|
return `🗑 ${of === "task" ? "Task" : "Routine"} removed${title ? `: ${title}` : ""}`;
|
|
6781
6838
|
}
|
|
6782
6839
|
/**
|
|
6840
|
+
* A message's text without the line that is its app card's link (`statusCardText` puts it on a line of its own for an
|
|
6841
|
+
* older app): what a line quoting the message says where the card is not drawn, never the bundle's raw link. Any other
|
|
6842
|
+
* message's text as it is.
|
|
6843
|
+
*/
|
|
6844
|
+
function withoutAppLink(text, card) {
|
|
6845
|
+
const url = card?.kind === "app" ? card.url : void 0;
|
|
6846
|
+
return url ? text.split("\n").filter((line) => line.trim() !== url).join("\n") : text;
|
|
6847
|
+
}
|
|
6848
|
+
/**
|
|
6783
6849
|
* The text a card's message carries: what an app without cards shows, the DHT floor carries, the chat list previews
|
|
6784
6850
|
* and search finds. Plain lines, the first naming the card, no bars or layout that would read badly elsewhere.
|
|
6785
6851
|
*/
|
|
@@ -8452,7 +8518,7 @@ var DhtDelivery = class DhtDelivery {
|
|
|
8452
8518
|
const id = dhtFileId(file.wireId);
|
|
8453
8519
|
if (reply !== void 0 && !REPLY_TO.test(reply)) reply = void 0;
|
|
8454
8520
|
const error = this.validate(file.name, timestamp, id);
|
|
8455
|
-
if (error) return error ===
|
|
8521
|
+
if (error) return error === "DHT text is limited to 256 UTF-8 bytes. Shorten it or choose a live connection." ? DHT_FILE_TOO_LARGE : error;
|
|
8456
8522
|
const now = Date.now(), pending = this.state.pending;
|
|
8457
8523
|
if (pending?.message[0] === id && pending.expires > now) return pending;
|
|
8458
8524
|
const message = [
|
|
@@ -9606,7 +9672,7 @@ var TransportSwitch = class {
|
|
|
9606
9672
|
remoteReplaces = false;
|
|
9607
9673
|
/** This side chose while no session was open: the next one begins with it as a choice. */
|
|
9608
9674
|
apart = false;
|
|
9609
|
-
policiesRead = new RateWindow(
|
|
9675
|
+
policiesRead = new RateWindow(30, POLICY_RECEIVE_WINDOW_MS);
|
|
9610
9676
|
/** The session on which the contact's policy, the one read already, was said again and read for free (`handle`). */
|
|
9611
9677
|
repeatRead = "";
|
|
9612
9678
|
policyHeld = null;
|
|
@@ -13572,6 +13638,19 @@ function storeFailure(error) {
|
|
|
13572
13638
|
const message = (error instanceof Error ? error.message : String(error)).trim();
|
|
13573
13639
|
return `Could not store the file: ${error?.name === "QuotaExceededError" && !message.startsWith("QuotaExceededError") ? `QuotaExceededError${message ? `: ${message}` : ""}` : message}`;
|
|
13574
13640
|
}
|
|
13641
|
+
/**
|
|
13642
|
+
* The room this device tells a contact (`pf-room`, a `no-room` refusal): its free space rounded down to a power of two or
|
|
13643
|
+
* one and a half of one. The exact bytes would be the same from every profile on the device, and move with whatever it
|
|
13644
|
+
* stores, so a contact could tell one device from another, or watch it, by asking. Never more than the room itself.
|
|
13645
|
+
*/
|
|
13646
|
+
function coarseRoom(room) {
|
|
13647
|
+
if (!Number.isSafeInteger(room)) return null;
|
|
13648
|
+
if (room <= 0) return 0;
|
|
13649
|
+
let step = 2 ** Math.floor(Math.log2(room));
|
|
13650
|
+
while (step > room) step /= 2;
|
|
13651
|
+
while (step * 2 <= room) step *= 2;
|
|
13652
|
+
return room >= step * 1.5 ? step * 1.5 : step;
|
|
13653
|
+
}
|
|
13575
13654
|
/** What a refusal means to the sender's person. */
|
|
13576
13655
|
function refusalText(why, room) {
|
|
13577
13656
|
switch (why) {
|
|
@@ -13825,9 +13904,19 @@ var ChatFiles = class {
|
|
|
13825
13904
|
}
|
|
13826
13905
|
async sayRoom() {
|
|
13827
13906
|
const room = await this.host.room?.().catch(() => null);
|
|
13828
|
-
|
|
13907
|
+
const max = typeof room === "number" ? coarseRoom(room) : null;
|
|
13908
|
+
if (max !== null) this.send({
|
|
13829
13909
|
t: "pf-room",
|
|
13830
|
-
max
|
|
13910
|
+
max
|
|
13911
|
+
});
|
|
13912
|
+
}
|
|
13913
|
+
refuseOffer(id, decision) {
|
|
13914
|
+
const room = decision.room !== void 0 ? coarseRoom(decision.room) : null;
|
|
13915
|
+
this.send({
|
|
13916
|
+
t: "pf-refuse",
|
|
13917
|
+
id,
|
|
13918
|
+
why: decision.refuse,
|
|
13919
|
+
...room !== null && { room }
|
|
13831
13920
|
});
|
|
13832
13921
|
}
|
|
13833
13922
|
/** A new file to send: offered now if a session is open, or on the next one. */
|
|
@@ -14251,12 +14340,7 @@ var ChatFiles = class {
|
|
|
14251
14340
|
}
|
|
14252
14341
|
if (this.entries.has(key("in", id))) return;
|
|
14253
14342
|
if (typeof decision === "object") {
|
|
14254
|
-
this.
|
|
14255
|
-
t: "pf-refuse",
|
|
14256
|
-
id,
|
|
14257
|
-
why: decision.refuse,
|
|
14258
|
-
...decision.room !== void 0 && { room: decision.room }
|
|
14259
|
-
});
|
|
14343
|
+
this.refuseOffer(id, decision);
|
|
14260
14344
|
return;
|
|
14261
14345
|
}
|
|
14262
14346
|
const entry = {
|
|
@@ -14310,12 +14394,7 @@ var ChatFiles = class {
|
|
|
14310
14394
|
decision = { refuse: "invalid" };
|
|
14311
14395
|
}
|
|
14312
14396
|
if (typeof decision === "object") {
|
|
14313
|
-
this.
|
|
14314
|
-
t: "pf-refuse",
|
|
14315
|
-
id: record.id,
|
|
14316
|
-
why: decision.refuse,
|
|
14317
|
-
...decision.room !== void 0 && { room: decision.room }
|
|
14318
|
-
});
|
|
14397
|
+
this.refuseOffer(record.id, decision);
|
|
14319
14398
|
return false;
|
|
14320
14399
|
}
|
|
14321
14400
|
if (decision === "ask") {
|
|
@@ -16283,6 +16362,44 @@ var MESSAGE_RECEIVE_LIMITS = {
|
|
|
16283
16362
|
hourly: 1800,
|
|
16284
16363
|
hourWindowMs: 36e5
|
|
16285
16364
|
};
|
|
16365
|
+
/** What `sendMessage` says of a text the contact's windows have no room for yet: it did not go (`MessagePace`). */
|
|
16366
|
+
var MESSAGE_PACED = "Your contact takes a limited number of texts at a time. It goes by itself once they can take more.";
|
|
16367
|
+
/** How long a text sent with no receipt yet counts as taken past its send: one in flight is taken when it lands. */
|
|
16368
|
+
var PACE_UNANSWERED_MS = 6e4;
|
|
16369
|
+
/**
|
|
16370
|
+
* The texts this side sent on a paired session, counted against the contact's windows (`MESSAGE_RECEIVE_LIMITS`), so
|
|
16371
|
+
* none goes that the contact would refuse. A refused text went unconfirmed and came again with the outbox's backoff,
|
|
16372
|
+
* after texts written later that found room meanwhile: the contact read them out of order. Past the hour's total it
|
|
16373
|
+
* was sent until its attempts ran out, well inside the hour, and ended failed. Each counts from its receipt, the latest
|
|
16374
|
+
* the contact can have taken it: counted from its send, a frame that sat in a queue was taken later than counted.
|
|
16375
|
+
*/
|
|
16376
|
+
var MessagePace = class {
|
|
16377
|
+
now;
|
|
16378
|
+
sent = [];
|
|
16379
|
+
constructor(now = Date.now) {
|
|
16380
|
+
this.now = now;
|
|
16381
|
+
}
|
|
16382
|
+
/** The contact's windows have room for one more text now. */
|
|
16383
|
+
room() {
|
|
16384
|
+
const now = this.now(), { burst, burstWindowMs, hourly, hourWindowMs } = MESSAGE_RECEIVE_LIMITS;
|
|
16385
|
+
const counts = (entry, windowMs) => entry.answered !== void 0 ? now - entry.answered < windowMs : now - entry.at < windowMs + PACE_UNANSWERED_MS;
|
|
16386
|
+
this.sent = this.sent.filter((entry) => counts(entry, hourWindowMs));
|
|
16387
|
+
return this.sent.length < hourly && this.sent.filter((entry) => counts(entry, burstWindowMs)).length < burst;
|
|
16388
|
+
}
|
|
16389
|
+
took(id) {
|
|
16390
|
+
this.sent.push({
|
|
16391
|
+
id,
|
|
16392
|
+
at: this.now()
|
|
16393
|
+
});
|
|
16394
|
+
}
|
|
16395
|
+
/** Its receipt came: the contact counted it by now. */
|
|
16396
|
+
answered(id) {
|
|
16397
|
+
for (let i = this.sent.length - 1; i >= 0; i--) if (this.sent[i].id === id && this.sent[i].answered === void 0) {
|
|
16398
|
+
this.sent[i].answered = this.now();
|
|
16399
|
+
return;
|
|
16400
|
+
}
|
|
16401
|
+
}
|
|
16402
|
+
};
|
|
16286
16403
|
/**
|
|
16287
16404
|
* A `paired-message` frame. The preview (`pv`) is left out when the frame would pass `MAX_PAIRED_MESSAGE_FRAME`
|
|
16288
16405
|
* with it: the text matters, the card does not. A reply (`r`, WISP 401 § Replies) is a few hundred bytes at most
|
|
@@ -16506,6 +16623,8 @@ var GhostLink = class {
|
|
|
16506
16623
|
editsReceived = new RateWindow(30, EDIT_RATE_WINDOW_MS);
|
|
16507
16624
|
/** Text frames the contact may send per window (`MESSAGE_RECEIVE_LIMITS`); the rest go unconfirmed and come again. */
|
|
16508
16625
|
messagesReceived = [new RateWindow(MESSAGE_RECEIVE_LIMITS.burst, MESSAGE_RECEIVE_LIMITS.burstWindowMs), new RateWindow(MESSAGE_RECEIVE_LIMITS.hourly, MESSAGE_RECEIVE_LIMITS.hourWindowMs)];
|
|
16626
|
+
/** The texts sent to the contact, against their `messagesReceived` (`MessagePace`). */
|
|
16627
|
+
messagesSent = new MessagePace();
|
|
16509
16628
|
/** Call signals the contact may send per window; the rest are dropped. */
|
|
16510
16629
|
callsReceived = new RateWindow(150, CALL_RATE_WINDOW_MS);
|
|
16511
16630
|
/** WebRTC signals the contact may send on the session (`paired-rtc`) per window; the rest are dropped. */
|
|
@@ -17375,6 +17494,10 @@ var GhostLink = class {
|
|
|
17375
17494
|
get canSendText() {
|
|
17376
17495
|
return this.textDelivery !== "unavailable";
|
|
17377
17496
|
}
|
|
17497
|
+
/** A text on the live session would find room in the contact's windows now (`MessagePace`); the DHT floor has its own pace. */
|
|
17498
|
+
get textRoom() {
|
|
17499
|
+
return this.textDelivery !== "stream" || this.messagesSent.room();
|
|
17500
|
+
}
|
|
17378
17501
|
get dhtDelivery() {
|
|
17379
17502
|
return this.dht?.view;
|
|
17380
17503
|
}
|
|
@@ -17431,11 +17554,11 @@ var GhostLink = class {
|
|
|
17431
17554
|
if (this.myPubKeyZ32 > this.options.params.peerPubKeyZ32) this.session.presenceDue();
|
|
17432
17555
|
this.session.start();
|
|
17433
17556
|
}
|
|
17434
|
-
await this.dht.setMode(mode);
|
|
17435
17557
|
if (mode === "dht") {
|
|
17436
17558
|
await this.session.stop(false);
|
|
17437
17559
|
await Promise.allSettled([...this.endpoints.keys()].map((t) => this.releaseEndpoint(t)));
|
|
17438
17560
|
}
|
|
17561
|
+
await this.dht.setMode(mode);
|
|
17439
17562
|
this.streamBlockChanged();
|
|
17440
17563
|
this.emitDeliveryState();
|
|
17441
17564
|
}
|
|
@@ -18884,9 +19007,11 @@ var GhostLink = class {
|
|
|
18884
19007
|
if (!/^[A-Za-z0-9_-]{22}$/.test(id)) return "Invalid message ID";
|
|
18885
19008
|
const frame = pairedMessageFrame(id, timestamp, trimmed, preview, reply, forwarded, card);
|
|
18886
19009
|
if (frame.length > 61440) return PAIRED_FRAME_TOO_LARGE;
|
|
19010
|
+
if (!this.messagesSent.room()) return MESSAGE_PACED;
|
|
18887
19011
|
this.pairedPending.set(id, timestamp);
|
|
18888
19012
|
try {
|
|
18889
19013
|
this.channel.send(frame);
|
|
19014
|
+
this.messagesSent.took(id);
|
|
18890
19015
|
return null;
|
|
18891
19016
|
} catch {
|
|
18892
19017
|
this.pairedPending.delete(id);
|
|
@@ -19676,6 +19801,17 @@ var GhostLink = class {
|
|
|
19676
19801
|
if (dht && this.dht && this.textDelivery === "dht") return this.dht.send(edit.m, edit.ts, dhtEditId(edit.id, edit.e), void 0, [edit.id, edit.e]);
|
|
19677
19802
|
return "Edits go when you are live";
|
|
19678
19803
|
}
|
|
19804
|
+
/**
|
|
19805
|
+
* Why the DHT floor can never carry this edit, or null (WISP 403 § Edits): it goes there as a text with the edit's
|
|
19806
|
+
* element, which must fit the packet once sealed, as a text must (`validateText`). One past the 256 bytes never fits
|
|
19807
|
+
* it either, and says so with the same reason. Null off the floor, and for what only makes it wait there (a text
|
|
19808
|
+
* awaiting its receipt): that one goes in its turn.
|
|
19809
|
+
*/
|
|
19810
|
+
dhtEditTooBig(edit) {
|
|
19811
|
+
if (this.isDataLinkOpen || this.textDelivery !== "dht") return null;
|
|
19812
|
+
const error = this.dht.validate(edit.m, edit.ts, dhtEditId(edit.id, edit.e), void 0, [edit.id, edit.e]);
|
|
19813
|
+
return error === "Text and authentication exceed the DHT packet budget. Shorten the message." || error === "DHT text is limited to 256 UTF-8 bytes. Shorten it or choose a live connection." ? DHT_PACKET_BUDGET : null;
|
|
19814
|
+
}
|
|
19679
19815
|
/** Confirms an edit of the contact's that waited for its message (`onMessageEdit` returned false). */
|
|
19680
19816
|
confirmEdit(id, e) {
|
|
19681
19817
|
if (!this.channel || !this.supportsEdits) return;
|
|
@@ -21036,6 +21172,7 @@ var GhostLink = class {
|
|
|
21036
21172
|
id: frame.id
|
|
21037
21173
|
}));
|
|
21038
21174
|
} else if (frame.t === "paired-received") {
|
|
21175
|
+
this.messagesSent.answered(frame.id);
|
|
21039
21176
|
if (this.pairedPending.get(frame.id) !== void 0) {
|
|
21040
21177
|
await this.options.events?.onMessageReceipt?.(frame.id);
|
|
21041
21178
|
await this.dht?.acknowledge(frame.id);
|
|
@@ -21891,6 +22028,6 @@ function groupMetaChange(before, after, first) {
|
|
|
21891
22028
|
if (a.pic !== b.pic) change.picture = b.pic ?? null;
|
|
21892
22029
|
return "name" in change || "picture" in change ? change : null;
|
|
21893
22030
|
}
|
|
21894
|
-
export {
|
|
22031
|
+
export { beaconKeys as $, readImageMeta as $a, MAX_SHARED_APPS as $i, reactionEmoji as $n, sortRoster as $r, vapidKeysMatch as $t, GROUP_WANT_FRAME as A, sha256Paced as Aa, GhostlyHttpError as Ai, baseMime as An, statusCardText as Ar, TypingSender as At, GROUP_SIGNAL_FRAME as B, isAppLine as Ba, QUICK_REDIAL_MS as Bi, REMOVED_TEXT as Bn, GROUP_MEMBER_CAP as Br, WAKE_CALL_INTERVAL_MS as Bt, MESSAGE_PACED as C, assembleAppBundle as Ca, DAEMON_WATCH_PEER_IDLE_MS as Ci, dhtFileId as Cn, cardEditNumber as Cr, liveStatus as Ct, pairedMessageFrame as D, pacer as Da, RELAY_POLL_INTERVALS as Di, PLAYABLE_AUDIO as Dn, readStatusCard as Dr, TYPING_KINDS as Dt, pairedMessageFits as E, isAppUrl as Ea, PRESENCE_WINDOW as Ei, sanitizeMime as En, checkStatusCard as Er, TYPING_FRAME as Et, readGroupFileMeta as F, appRefPublisher as Fa, LIMITS as Fi, voiceLevel as Fn, heardTime as Fr, mayPin as Ft, readGroupSignal as G, readAppSignature as Ga, callSignalHeardAt as Gi, forwardedAgain as Gn, commitHash as Gr, WakeLimiter as Gt, SIGNAL_HOLD_MS as H, readAppRevocation as Ha, answersOffer as Hi, dhtEditId as Hn, MEMBER_KEY as Hr, WAKE_ONLINE_BATCH_MS as Ht, readGroupHave as I, appRevocationsFileEntries as Ia, decodeControl as Ii, parseVideoMeta as In, receivedTimestamp as Ir, nextPinNumber as It, mayBeHub as J, signAppRevocation as Ja, parseCallSignal as Ji, GROUP_REACTION_FRAME as Jn, parseGroupCommit as Jr, parseWakeFrame as Jt, MESH_HUBS as K, setAppSignatureFastPath as Ka, contactRtcConfig as Ki, readForwarded as Kn, commitUntaggedHash as Kr, deviceWakeRequest as Kt, readGroupWant as L, checkAppRevokeStatement as La, encodeControl as Li, EDIT_BUFFER_MS as Ln, shownTime as Lr, pinIsNewer as Lt, fetchesByItself as M, APP_STATEMENT_LIMITS as Ma, formatLocalTarget as Mi, fileMessageText as Mn, MESSAGE_CLOCK_SKEW_MS as Mr, typingActivity as Mt, groupFileFallback as N, appFingerprint as Na, parseLocalTarget as Ni, parseVoiceMeta as Nn, arrivalKey as Nr, GROUP_PIN_FRAME as Nt, GROUP_FILE_LIMITS as O, readAppBundle as Oa, WATCH_PEER_MS as Oi, VOICE_LIMITS as On, sameButtonText as Or, TYPING_REFRESH_MS as Ot, isGroupMessageId as P, appRef as Pa, webLocalFetch as Pi, voiceDownloadName as Pn, claimedTime as Pr, PIN_LIMITS as Pt, COMMUNITY_TOPOLOGY as Q, parseImageMeta as Qa, LEGACY_SERVICES as Qi, queueReaction as Qn, signCommit as Qr, checkPushEndpoint as Qt, readGroupWantNo as R, isAppHash as Ra, BURST_RING_MS as Ri, EDIT_RATE_WINDOW_MS as Rn, GROUP_ADMIN_OFF_ERROR as Rr, pinNumberHolds as Rt, LIVENESS_PING_MS as S, appViewOf as Sa, AWAITING_PEER_MS as Si, DHT_FILE_CAPABILITY as Sn, buttonLabelClash as Sr, STATUS_IDLE_AFTER_MS as St, pairedEditFits as T, findAppForbiddenKey as Ta, EXPECT_PEER_MS as Ti, sanitizeFileName as Tn, cardUrl as Tr, sanitizeStatusText as Tt, SIGNAL_REPLY_MS as U, readAppRevocationShape as Ua, buildSdpFromSignal as Ui, validEditNumber as Un, OWN_FRAME_LIMIT as Ur, WAKE_ONLINE_DELAY_MS as Ut, SIGNAL_FRESH_MS as V, isAppRef as Va, RTC_CONFIG as Vi, RateWindow as Vn, MAX_GROUP_CHAIN as Vr, WAKE_INTERVAL_MS as Vt, groupSignalFrame as W, readAppRevocations as Wa, callRtcConfig as Wi, validRemovalNumber as Wn, SAID_AGAIN as Wr, WAKE_ONLINE_INTERVAL_MS as Wt, meshRendezvous as X, verifyAppSignature as Xa, emptyLinkRecords as Xi, ReactionWindow as Xn, rosterAdmin as Xr, wakeFrame as Xt, meshHubs as Y, verifyAppRevocation as Ya, signalHasVideo as Yi, REACTION_LIMITS as Yn, rememberAlone as Yr, relayRequest as Yt, pickMeshHubs as Z, exifOrientation as Za, HTTP_SERVICE_PROTO as Zi, nextReactionNumber as Zn, rosterHas as Zr, wakeRequest as Zt, signGroupMeta as _, seenEntry as _a, RATCHET_CAPABILITY as _i, ACTIVE_DHT_POLL_MS as _n, deviceEchoNonce as _o, RUN_RESULTS as _r, FileUplink as _t, groupMetaChange as a, contactDay as aa, confirmationTag as ai, APPS_CAPABILITY as an, OwnInviteError as ao, groupReplyAuthor as ar, lobbyRecords as at, GhostLink as b, APP_ICON_PATH as ba, ratchetSessionOf as bi, DHT_PACKET_BUDGET as bn, devicePingFrame as bo, appCardId as br, transferStalled as bt, groupMetaTag as c, knockSlotOf as ca, encryptText as ci, STATUS_CARD_CAPABILITY as cn, encodeInviteCode as co, replySnippet as cr, newerHead as ct, keepPastGroupMeta as d, makeStampPaced as da, newEpochSecret as di, DHT_TEXT_CAPABILITY as dn, ownInviteRefusal as do, BUTTON_STYLES as dr, readBeacon as dt, serviceIdFromName as ea, verifyChain as ei, APP_RANGE_LIMITS as en, canonicalJson as eo, reactionIsNewer as er, beaconRecords as et, nextGroupMetaRevision as f, mergeContactKnocks as fa, openPair as fi, capsDescriptors as fn, pastedAgain as fo, CRON_LINE as fr, readBeaconHead as ft, parseGroupMetaTag as g, requestRecords as ga, sha256Hex as gi, validExternalKey as gn, deviceEchoFrame as go, ROUTINE_STATES as gr, FILE_LIMITS as gt, parseGroupMetaFrame as h, readLinkRecord as ha, sealSecret as hi, emptyProofLedger as hn, HANDOFF_CAPABILITY as ho, PR_STATES as hr, ChatFiles as ht, groupMetaBody as i, contactAskerHolds as ia, confirmationMatches as ii, isAppVersion as in, INVITE_MAX_LENGTH as io, REPLY_LIMITS as ir, lobbyKeys as it, GROUP_WANT_NO_FRAME as j, APP_PREFIXES as ja, VIEWER_PERMISSIONS_POLICY as ji, downsamplePeaks as jn, withoutAppLink as jr, sanitizeTypingStatus as jt, GROUP_HAVE_FRAME as k, readAppBundleAsync as ka, presenceSeenAt as ki, VOICE_METER as kn, statusCardBytes as kr, TypingReceiver as kt, groupMetaToHand as l, knockSlotRecords as la, epochKeys as li, UPGRADE_CAPABILITY as ln, inviteLink as lo, wireReply as lr, pickHubs as lt, parseGroupMetaBody as m, readKnockSlot as ma, sealPair as mi, PeerProofs as mn, ENROLL_CAPABILITY as mo, PR_CHECKS as mr, shouldBeHub as mt, groupCallSfu as n, REQUEST_LIFETIME_MS as na, verifyCommitSignature as ni, APP_DATA_MAX_BYTES as nn, readCanonicalJson as no, validReactionNumber as nr, freshHubs as nt, groupMetaNewer as o, knockHolds as oa, decryptText as oi, BUTTONS_CAPABILITY as on, createChatInvite as oo, pairedReplyAuthor as or, mergeBeacon as ot, openGroupMeta as p, openRequest as pa, openSecret as pi, dialDescriptors as pn, DEVICES_CAPABILITY as po, ITEM_STATES as pr, readLobby as pt, NO_HUB_POLICY as q, signAppObject as qa, extractParamsFromSdp as qi, COMMUNITY_REACTION_FRAME as qn, expectedRoster as qr, newWakeToken as qt, groupDisplayName as r, contactAskerFrame as ra, GROUP_PROFILE as ri, chatAppId as rn, INVITE_HRP as ro, wireReaction as rr, hubRank as rt, groupMetaPicture as s, knockSlotIdentity as sa, edgeParams as si, EDIT_CAPABILITY as sn, decodeInviteCode as so, readReply as sr, mergeLobby as st, encodeGroupMetaBody as t, ContactRequestError as ta, verifyCommit as ti, isServeId as tn, canonicalJsonBytes as to, readReaction as tr, doorHubs as tt, groupName as u, linkRecords as ua, groupCallKey as ui, CapsExchange as un, inviteOwnership as uo, BUTTON_ID as ur, rankHubs as ut, verifyGroupMetaSignature as v, APP_BUNDLE_LIMITS as va, RatchetBox as vi, DHT_FILE_TOO_LARGE as vn, deviceKeyZ32 as vo, STATUS_CARD_LIMITS as vr, sentWhole as vt, PAIRED_FRAME_TOO_LARGE as w, checkAppManifest as wa, DHT_POLL_INTERVALS as wi, formatFileSize as wn, cardLine as wr, personStatus as wt, INVITE_TAKEN as x, appDigest as xa, DirectPathWatch as xi, peekDhtMailbox as xn, newDeviceSetSecret as xo, appCardUrl as xr, STATUS_AVAILABILITIES as xt, wrapGroupMeta as y, APP_BUNDLE_MAGIC as ya, emptyRatchetState as yi, DHT_MESSAGE_TTL as yn, deviceLinkPairing as yo, TASK_STATUSES as yr, transferEnded as yt, CarriedTransport as z, isAppKey as za, CALL_SIGNAL_MAX_AGE_MS as zi, MAX_REMOVAL_NUMBER as zn, GROUP_ID as zr, readPin as zt };
|
|
21895
22032
|
|
|
21896
|
-
//# sourceMappingURL=groupMeta-
|
|
22033
|
+
//# sourceMappingURL=groupMeta-CeZpqVVC.js.map
|