@ghostlytools/cli 1.9.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -20
- package/SKILL.md +5 -1
- package/dist/assets/{api-DFCgr6RH.js → api-BF_KwecF.js} +84 -38
- package/dist/assets/api-BF_KwecF.js.map +1 -0
- package/dist/assets/{api-raWw9j_m.js → api-DdrA86Ur.js} +2 -2
- package/dist/assets/{apiKit-CCavJJcl.js → apiKit-Du1u2l4x.js} +8 -8
- package/dist/assets/apiKit-Du1u2l4x.js.map +1 -0
- package/dist/assets/{apps-B7o2BPj6.js → apps-Bti9fDoW.js} +1 -1
- package/dist/assets/{apps-DmxEG147.js → apps-DwPfp54I.js} +5 -3
- package/dist/assets/apps-DwPfp54I.js.map +1 -0
- package/dist/assets/{arkade-DtYR9H0c.js → arkade-DOWpA2Kr.js} +2 -2
- package/dist/assets/{arkade-DtYR9H0c.js.map → arkade-DOWpA2Kr.js.map} +1 -1
- package/dist/assets/{backup-BserdrNk.js → backup-CeRckyl2.js} +1 -1
- package/dist/assets/{backup-YIB2XIES.js → backup-DZ_Q1eSu.js} +6 -6
- package/dist/assets/{backup-YIB2XIES.js.map → backup-DZ_Q1eSu.js.map} +1 -1
- package/dist/assets/bitcoindevkit_bg-B-iLWrmX.js.map +1 -1
- package/dist/assets/{blobFiles-DOQDRdDI.js → blobFiles-BnjN_Vrz.js} +3 -3
- package/dist/assets/{blobFiles-DOQDRdDI.js.map → blobFiles-BnjN_Vrz.js.map} +1 -1
- package/dist/assets/buttons-BxIThdg9.js +332 -0
- package/dist/assets/buttons-BxIThdg9.js.map +1 -0
- package/dist/assets/buttons-D9QBHS9Y.js +2 -0
- package/dist/assets/client-D5E1RQYB.js +473 -0
- package/dist/assets/client-D5E1RQYB.js.map +1 -0
- package/dist/assets/{endpoint-BdaeBw2L.js → endpoint-DWHkXWVM.js} +101 -16
- package/dist/assets/endpoint-DWHkXWVM.js.map +1 -0
- package/dist/assets/{envelope-Dt75vrmY.js → envelope-CugS9qwQ.js} +2 -2
- package/dist/assets/{envelope-Dt75vrmY.js.map → envelope-CugS9qwQ.js.map} +1 -1
- package/dist/assets/fedimint_client_wasm_bg-BtHHlFpp.js.map +1 -1
- package/dist/assets/{fileBytes-BPDKufla.js → fileBytes-DMzrIdCu.js} +1 -1
- package/dist/assets/{fileBytes-DNgrRL0R.js → fileBytes-DjBYYyXT.js} +3 -3
- package/dist/assets/{fileBytes-DNgrRL0R.js.map → fileBytes-DjBYYyXT.js.map} +1 -1
- package/dist/assets/{fileBytes-Q3ehcEr8.js → fileBytes-Douk1yOp.js} +2 -2
- package/dist/assets/{fileBytes-Q3ehcEr8.js.map → fileBytes-Douk1yOp.js.map} +1 -1
- package/dist/assets/fileBytesIdb-CD5Uv490.js +2 -0
- package/dist/assets/{fileBytesIdb-Dm1EyEbT.js → fileBytesIdb-CkClu9YI.js} +3 -3
- package/dist/assets/{fileBytesIdb-Dm1EyEbT.js.map → fileBytesIdb-CkClu9YI.js.map} +1 -1
- package/dist/assets/{fileBytesOpfs-ZGD21c4Q.js → fileBytesOpfs-WryQuOgK.js} +3 -3
- package/dist/assets/{fileBytesOpfs-ZGD21c4Q.js.map → fileBytesOpfs-WryQuOgK.js.map} +1 -1
- package/dist/assets/{fixedHosts-B598JzbC.js → fixedHosts-B4E4VrYE.js} +4 -4
- package/dist/assets/{fixedHosts-B598JzbC.js.map → fixedHosts-B4E4VrYE.js.map} +1 -1
- package/dist/assets/{groupFiles-FXel6zIc.js → groupFiles-NonOYBKN.js} +378 -59
- package/dist/assets/groupFiles-NonOYBKN.js.map +1 -0
- package/dist/assets/{host-DIBeK_c_.js → host-DvcVt5YI.js} +79 -23
- package/dist/assets/{host-DIBeK_c_.js.map → host-DvcVt5YI.js.map} +1 -1
- package/dist/assets/{hyperdhtRelay-D185dETu.js → hyperdhtRelay-Ce42sR8x.js} +2 -2
- package/dist/assets/{hyperdhtRelay-D185dETu.js.map → hyperdhtRelay-Ce42sR8x.js.map} +1 -1
- package/dist/assets/{idb-BkOJES5_.js → idb-BHsAqENE.js} +37 -6
- package/dist/assets/idb-BHsAqENE.js.map +1 -0
- package/dist/assets/{irohWeb-BSv_BWyG.js → irohWeb-C9ChbD-c.js} +57 -3
- package/dist/assets/{irohWeb-BSv_BWyG.js.map → irohWeb-C9ChbD-c.js.map} +1 -1
- package/dist/assets/{main-BbhfMTt8.js → main-4qE381KM.js} +194 -276
- package/dist/assets/main-4qE381KM.js.map +1 -0
- package/dist/assets/{mainline-9Vc3c3SA.js → mainline-DOwZDHVy.js} +2 -2
- package/dist/assets/{mainline-9Vc3c3SA.js.map → mainline-DOwZDHVy.js.map} +1 -1
- package/dist/assets/{networkReason-BncJ9KSM.js → networkReason-MInk1Y63.js} +3 -3
- package/dist/assets/{networkReason-BncJ9KSM.js.map → networkReason-MInk1Y63.js.map} +1 -1
- package/dist/assets/{nwc-QX3Yt1Sb.js → nwc-CHLWFV1R.js} +3 -3
- package/dist/assets/{nwc-QX3Yt1Sb.js.map → nwc-CHLWFV1R.js.map} +1 -1
- package/dist/assets/{nwcProvider-CzX3xH47.js → nwcProvider-BlkPOJen.js} +2 -2
- package/dist/assets/{nwcProvider-CzX3xH47.js.map → nwcProvider-BlkPOJen.js.map} +1 -1
- package/dist/assets/{ownDid-D8z5gwGI.js → ownDid-yXtY_1B5.js} +3 -3
- package/dist/assets/ownDid-yXtY_1B5.js.map +1 -0
- package/dist/assets/{profiles-MFtCmJwK.js → profiles-vbXHs0Mq.js} +40 -3
- package/dist/assets/profiles-vbXHs0Mq.js.map +1 -0
- package/dist/assets/{registry-PTtBMaYZ.js → registry-BN9r2pR4.js} +1 -1
- package/dist/assets/{registry-B2Dtnibo.js → registry-chCD0KWS.js} +5 -5
- package/dist/assets/registry-chCD0KWS.js.map +1 -0
- package/dist/assets/{resolve-ZxVzwFNA.js → resolve-Dtzogt2W.js} +2 -2
- package/dist/assets/{resolve-ZxVzwFNA.js.map → resolve-Dtzogt2W.js.map} +1 -1
- package/dist/assets/{restoredRows-BCRCjhdF.js → restoredRows-CRYwIx3g.js} +2 -2
- package/dist/assets/{restoredRows-BCRCjhdF.js.map → restoredRows-CRYwIx3g.js.map} +1 -1
- package/dist/assets/{buttons-CuRfKnPI.js → secretGuard-CSVNxXVW.js} +80 -330
- package/dist/assets/secretGuard-CSVNxXVW.js.map +1 -0
- package/dist/assets/secretGuard-Q2BKq0q0.js +2 -0
- package/dist/assets/{server-Dw1o8z1o.js → server-BZnsm5X5.js} +1749 -335
- package/dist/assets/server-BZnsm5X5.js.map +1 -0
- package/dist/assets/{src-BD8RBVEp.js → src-DZagapGt.js} +1043 -197
- package/dist/assets/src-DZagapGt.js.map +1 -0
- package/dist/assets/{sshForges-DWrESWkK.js → sshForges-BkTgy5rx.js} +16 -9
- package/dist/assets/{sshForges-DWrESWkK.js.map → sshForges-BkTgy5rx.js.map} +1 -1
- package/dist/assets/{translate-D1uP0q32.js → translate-B9SMd6uf.js} +8 -7
- package/dist/assets/translate-B9SMd6uf.js.map +1 -0
- package/dist/assets/{usdt-DhVN8geQ.js → usdt-BU4ezonh.js} +3 -3
- package/dist/assets/{usdt-DhVN8geQ.js.map → usdt-BU4ezonh.js.map} +1 -1
- package/dist/assets/{words-DdXPkB3n.js → words-jYy7lTcb.js} +4 -2
- package/dist/assets/words-jYy7lTcb.js.map +1 -0
- package/dist/ghostly.mjs +1 -1
- package/package.json +1 -1
- package/dist/assets/api-DFCgr6RH.js.map +0 -1
- package/dist/assets/apiKit-CCavJJcl.js.map +0 -1
- package/dist/assets/apps-DmxEG147.js.map +0 -1
- package/dist/assets/buttons-CuRfKnPI.js.map +0 -1
- package/dist/assets/buttons-De3LPdSG.js +0 -2
- package/dist/assets/daemonProof-DtrL5lE5.js +0 -236
- package/dist/assets/daemonProof-DtrL5lE5.js.map +0 -1
- package/dist/assets/endpoint-BdaeBw2L.js.map +0 -1
- package/dist/assets/fileBytesIdb-DZcESfTt.js +0 -2
- package/dist/assets/groupFiles-FXel6zIc.js.map +0 -1
- package/dist/assets/idb-BkOJES5_.js.map +0 -1
- package/dist/assets/main-BbhfMTt8.js.map +0 -1
- package/dist/assets/ownDid-D8z5gwGI.js.map +0 -1
- package/dist/assets/profiles-MFtCmJwK.js.map +0 -1
- package/dist/assets/registry-B2Dtnibo.js.map +0 -1
- package/dist/assets/server-Dw1o8z1o.js.map +0 -1
- package/dist/assets/src-BD8RBVEp.js.map +0 -1
- package/dist/assets/translate-D1uP0q32.js.map +0 -1
- package/dist/assets/words-DdXPkB3n.js.map +0 -1
|
@@ -155,6 +155,45 @@ var KEEP = /[\u200c\u200d]/;
|
|
|
155
155
|
function stripHidden(text) {
|
|
156
156
|
return text.replace(HIDDEN, (char) => KEEP.test(char) ? char : "");
|
|
157
157
|
}
|
|
158
|
+
/** The variation selectors other than VS15 and VS16: a symbol's, an ideograph's, a Mongolian letter's. */
|
|
159
|
+
var SELECTOR = /[︀-︍᠋-᠍᠏\u{e0100}-\u{e01ef}]/u;
|
|
160
|
+
/** Letters of the alphabets that neither join their letters nor make conjuncts: a joiner beside one changes nothing. */
|
|
161
|
+
var NO_JOINING = /[\p{sc=Latin}\p{sc=Greek}\p{sc=Cyrillic}\p{sc=Armenian}\p{sc=Georgian}\p{sc=Hebrew}\p{sc=Han}\p{sc=Hiragana}\p{sc=Katakana}\p{sc=Hangul}\p{sc=Thai}\p{sc=Lao}\p{sc=Ethiopic}]/u;
|
|
162
|
+
var EUROPEAN = /[\p{sc=Latin}\p{sc=Greek}\p{sc=Cyrillic}]/u;
|
|
163
|
+
var LETTER = /\p{L}/u;
|
|
164
|
+
var MARK = /\p{M}/u;
|
|
165
|
+
var SYMBOL = /\p{S}/u;
|
|
166
|
+
var PICTOGRAPH$1 = /\p{Extended_Pictographic}/u;
|
|
167
|
+
/** What an emoji sequence's joiner follows: a pictograph, a skin tone, or VS16 after a pictograph. */
|
|
168
|
+
var BEFORE_EMOJI_JOINER = /[\p{Extended_Pictographic}\p{Emoji_Modifier}️]/u;
|
|
169
|
+
var EMOJI = /\p{Emoji}/u;
|
|
170
|
+
var ASCII = /^[\0-\x7f]$/;
|
|
171
|
+
var KEYCAP_BASE = /^[#*0-9]$/;
|
|
172
|
+
var joining = (char) => LETTER.test(char) && !NO_JOINING.test(char);
|
|
173
|
+
/**
|
|
174
|
+
* `text` without the joiners and variation selectors that join or select nothing, which draw nothing and could only
|
|
175
|
+
* make a name look like another one, or one nobody can type. A zero-width joiner stays between two emoji (a skin tone
|
|
176
|
+
* or VS16 before it) and either joiner between two letters of a script that joins its letters or makes conjuncts
|
|
177
|
+
* (Persian, the Indic scripts; the marks after the first letter, a virama, don't count); VS15 and VS16 stay after an
|
|
178
|
+
* emoji (an ASCII one only in a keycap), and the other selectors after a symbol or a letter that is not Latin, Greek or
|
|
179
|
+
* Cyrillic.
|
|
180
|
+
*/
|
|
181
|
+
function dropLoneJoiners(text) {
|
|
182
|
+
const chars = Array.from(text);
|
|
183
|
+
let out = "", last = "", base = "";
|
|
184
|
+
for (let i = 0; i < chars.length; i++) {
|
|
185
|
+
const char = chars[i], next = chars[i + 1] ?? "";
|
|
186
|
+
let keep = true;
|
|
187
|
+
if (char === "" || char === "") keep = char === "" && BEFORE_EMOJI_JOINER.test(last) && PICTOGRAPH$1.test(next) || joining(base) && joining(next);
|
|
188
|
+
else if (char === "︎" || char === "️") keep = EMOJI.test(last) && !ASCII.test(last) || KEYCAP_BASE.test(last) && next === "⃣";
|
|
189
|
+
else if (SELECTOR.test(char)) keep = SYMBOL.test(last) || LETTER.test(last) && !EUROPEAN.test(last);
|
|
190
|
+
if (!keep) continue;
|
|
191
|
+
out += char;
|
|
192
|
+
last = char;
|
|
193
|
+
if (!MARK.test(char)) base = char;
|
|
194
|
+
}
|
|
195
|
+
return out;
|
|
196
|
+
}
|
|
158
197
|
/**
|
|
159
198
|
* What draws nothing when it stands alone and `HIDDEN` leaves in, since text needs it beside something else: the
|
|
160
199
|
* joiners, the fillers, the variation selectors and the other default-ignorable code points, combining marks, white
|
|
@@ -2642,11 +2681,11 @@ var isZero = (bytes) => bytes.every((b) => b === 0);
|
|
|
2642
2681
|
* A device's name as its slot holds it: UTF-8, cut at a character boundary to 16 bytes, and with no NUL (the padding).
|
|
2643
2682
|
* A character is what a person sees as one (a grapheme), so a cut never leaves half an emoji or a lone joiner.
|
|
2644
2683
|
* A name is display text a device chooses for itself and every device of the set shows: it is cleaned as a nickname is
|
|
2645
|
-
* (`sanitizeDisplayText`: no control, invisible or direction-changing character, and empty when nothing of it shows)
|
|
2646
|
-
* and trimmed, made and read alike.
|
|
2684
|
+
* (`sanitizeDisplayText`: no control, invisible or direction-changing character, and empty when nothing of it shows),
|
|
2685
|
+
* without a joiner or variation selector that joins nothing (`dropLoneJoiners`), and trimmed, made and read alike.
|
|
2647
2686
|
*/
|
|
2648
2687
|
function turnName(name) {
|
|
2649
|
-
const clean = stripHidden(name).trim();
|
|
2688
|
+
const clean = dropLoneJoiners(stripHidden(name)).trim();
|
|
2650
2689
|
const Segmenter = typeof Intl === "undefined" ? void 0 : Intl.Segmenter;
|
|
2651
2690
|
const characters = Segmenter ? Array.from(new Segmenter(void 0, { granularity: "grapheme" }).segment(clean), (s) => s.segment) : Array.from(clean);
|
|
2652
2691
|
let out = "", length = 0;
|
|
@@ -2656,7 +2695,7 @@ function turnName(name) {
|
|
|
2656
2695
|
out += character;
|
|
2657
2696
|
length += size;
|
|
2658
2697
|
}
|
|
2659
|
-
return hasVisible(out) ? out.trimEnd() : "";
|
|
2698
|
+
return hasVisible(out) ? dropLoneJoiners(out).trimEnd() : "";
|
|
2660
2699
|
}
|
|
2661
2700
|
function u32$4(value) {
|
|
2662
2701
|
return Uint8Array.of(value >>> 24 & 255, value >>> 16 & 255, value >>> 8 & 255, value & 255);
|
|
@@ -4235,7 +4274,17 @@ function verifyAppSignature(prefix, canonical, signature, key) {
|
|
|
4235
4274
|
};
|
|
4236
4275
|
}
|
|
4237
4276
|
var isSequence = (v) => typeof v === "number" && Number.isSafeInteger(v) && v >= 1;
|
|
4238
|
-
|
|
4277
|
+
/**
|
|
4278
|
+
* One line of an app's text, from `min` to `max` code points: a title, a tagline, a store's name, a removal's or a
|
|
4279
|
+
* revocation's reason. It is shown alone (a heading, a window title), so it holds no control character and none of
|
|
4280
|
+
* what `stripHidden` takes from a nickname (invisible and direction-changing characters, line and paragraph
|
|
4281
|
+
* separators), and when it is not empty it shows something (`hasVisible`). The joiners an emoji or a script needs stay.
|
|
4282
|
+
*/
|
|
4283
|
+
var isAppLine = (v, max, min = 0) => {
|
|
4284
|
+
if (typeof v !== "string") return false;
|
|
4285
|
+
const length = [...v].length;
|
|
4286
|
+
return length >= min && length <= max && stripHidden(v) === v && (v === "" || hasVisible(v));
|
|
4287
|
+
};
|
|
4239
4288
|
/** Checks a revocation statement's shape; the reason it is refused, or null. */
|
|
4240
4289
|
function checkAppRevokeStatement(value) {
|
|
4241
4290
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return "Not an object";
|
|
@@ -4253,7 +4302,7 @@ function checkAppRevokeStatement(value) {
|
|
|
4253
4302
|
if (!Array.isArray(d) || d.length < 1 || d.length > APP_STATEMENT_LIMITS.revokeDigests) return "digests is not 1 to 64 digests";
|
|
4254
4303
|
if (!d.every(isAppHash) || new Set(d).size !== d.length) return "digests holds a bad or repeated digest";
|
|
4255
4304
|
} else if (!isSequence(v.upTo)) return "upTo is not a sequence";
|
|
4256
|
-
if (v.reason !== void 0 && !
|
|
4305
|
+
if (v.reason !== void 0 && !isAppLine(v.reason, APP_STATEMENT_LIMITS.reason)) return "reason is not one line of 200 characters";
|
|
4257
4306
|
return null;
|
|
4258
4307
|
}
|
|
4259
4308
|
/** Signs a revocation with the publisher's key. */
|
|
@@ -4457,8 +4506,6 @@ var SEMVER$1 = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[
|
|
|
4457
4506
|
var HOST = /^>=(0|[1-9]\d*)\.(0|[1-9]\d*)(\.(0|[1-9]\d*))?$/;
|
|
4458
4507
|
var SEGMENT$1 = /^[A-Za-z0-9._-]+$/;
|
|
4459
4508
|
var codePoints = (s) => [...s].length;
|
|
4460
|
-
/** One line: no control character. */
|
|
4461
|
-
var isLine$1 = (v, max, min = 0) => typeof v === "string" && codePoints(v) >= min && codePoints(v) <= max && !/\p{Cc}/u.test(v);
|
|
4462
4509
|
/** Text of several lines: no control character but the line feed. */
|
|
4463
4510
|
var isText$2 = (v, max) => typeof v === "string" && codePoints(v) <= max && !/[^\P{Cc}\n]/u.test(v);
|
|
4464
4511
|
var isSafeCount = (v, min) => typeof v === "number" && Number.isSafeInteger(v) && v >= min;
|
|
@@ -4576,10 +4623,10 @@ function checkAppManifest(value, options = {}) {
|
|
|
4576
4623
|
if (typeof m.version !== "string" || m.version.length > APP_BUNDLE_LIMITS.version || !SEMVER$1.test(m.version)) return bad("version");
|
|
4577
4624
|
if (!isSafeCount(m.sequence, 1)) return bad("sequence");
|
|
4578
4625
|
if (m.kind !== "mini-app") return bad("kind");
|
|
4579
|
-
if (!
|
|
4580
|
-
if (!
|
|
4626
|
+
if (!isAppLine(m.title, APP_BUNDLE_LIMITS.title, 1)) return bad("title");
|
|
4627
|
+
if (!isAppLine(m.tagline, APP_BUNDLE_LIMITS.tagline, 1)) return bad("tagline");
|
|
4581
4628
|
if (m.description !== void 0 && !isText$2(m.description, APP_BUNDLE_LIMITS.description)) return bad("description");
|
|
4582
|
-
if (m.releaseNotes !== void 0 && !
|
|
4629
|
+
if (m.releaseNotes !== void 0 && !isAppLine(m.releaseNotes, APP_BUNDLE_LIMITS.releaseNotes)) return bad("releaseNotes");
|
|
4583
4630
|
const permissions = m.permissions;
|
|
4584
4631
|
if (!Array.isArray(permissions) || new Set(permissions).size !== permissions.length || !permissions.every((p) => APP_PERMISSIONS.includes(p))) return bad("permissions");
|
|
4585
4632
|
if (m.view !== void 0 && !APP_VIEWS.includes(m.view)) return bad("view", `view is "chat" or "full"`);
|
|
@@ -5132,6 +5179,42 @@ function openRequest(linkSeedB64, askerZ32, records, now) {
|
|
|
5132
5179
|
return null;
|
|
5133
5180
|
}
|
|
5134
5181
|
}
|
|
5182
|
+
/**
|
|
5183
|
+
* The asker's proof (WISP 8xx § Accept): in the chat a request started, the requester's app says on the live session
|
|
5184
|
+
* that it holds the asker key the request came under. The invite a request carries is a bearer code, so whoever made
|
|
5185
|
+
* the chat the owner joined may be someone other than the asker; until this proof comes, the request's text shows as
|
|
5186
|
+
* not confirmed. Signed by *K* over the link key, *K*, and both sides' participation keys in that chat: the joiner's is
|
|
5187
|
+
* new with the join, so a proof is made in the chat and for it, never before.
|
|
5188
|
+
*/
|
|
5189
|
+
var CONTACT_ASKER_FRAME = "contact-asker";
|
|
5190
|
+
function askerProofBytes(linkKeyZ32, askerZ32, chat) {
|
|
5191
|
+
return concatBytes$1(label$1("ghostly-contact/1 asker"), publicKeyFromZ32(linkKeyZ32), publicKeyFromZ32(askerZ32), publicKeyFromZ32(chat.inviter), publicKeyFromZ32(chat.joiner));
|
|
5192
|
+
}
|
|
5193
|
+
/** The requester's proof for the chat its request started. */
|
|
5194
|
+
function contactAskerFrame(askerSeedB64, linkKeyZ32, chat) {
|
|
5195
|
+
const asker = identityFromSeedB64(askerSeedB64);
|
|
5196
|
+
return {
|
|
5197
|
+
t: CONTACT_ASKER_FRAME,
|
|
5198
|
+
l: linkKeyZ32,
|
|
5199
|
+
k: asker.pubKeyZ32,
|
|
5200
|
+
s: toBase64Url(ed25519.sign(askerProofBytes(linkKeyZ32, asker.pubKeyZ32, chat), asker.seed))
|
|
5201
|
+
};
|
|
5202
|
+
}
|
|
5203
|
+
/**
|
|
5204
|
+
* Whether a proof heard in a chat is the one the owner waits for there: the link and asker keys of the request it
|
|
5205
|
+
* accepted, signed by that asker key for this chat's two participation keys. Anything else proves nothing.
|
|
5206
|
+
*/
|
|
5207
|
+
function contactAskerHolds(frame, expected, chat) {
|
|
5208
|
+
const f = frame;
|
|
5209
|
+
if (!f || typeof f !== "object" || f.t !== "contact-asker" || f.l !== expected.link || f.k !== expected.key) return false;
|
|
5210
|
+
if (typeof f.s !== "string" || !/^[A-Za-z0-9_-]{86}$/.test(f.s)) return false;
|
|
5211
|
+
if (![chat.inviter, chat.joiner].every((key) => Z32_KEY$1.test(key))) return false;
|
|
5212
|
+
try {
|
|
5213
|
+
return ed25519.verify(fromBase64Url(f.s), askerProofBytes(f.l, f.k, chat), publicKeyFromZ32(f.k));
|
|
5214
|
+
} catch {
|
|
5215
|
+
return false;
|
|
5216
|
+
}
|
|
5217
|
+
}
|
|
5135
5218
|
var HOUR_MS = 36e5;
|
|
5136
5219
|
var SEEN_FOR_MS = 168 * HOUR_MS;
|
|
5137
5220
|
function newInbox(now) {
|
|
@@ -11230,7 +11313,10 @@ function parseEditedFrame(frame) {
|
|
|
11230
11313
|
function dhtEditId(id, e) {
|
|
11231
11314
|
return toBase64Url(sha256(utf8Encode(`ghostly-edit/1:${id}:${e}`)).slice(0, 16));
|
|
11232
11315
|
}
|
|
11233
|
-
/**
|
|
11316
|
+
/**
|
|
11317
|
+
* A sliding window of `limit` events per `windowMs`: the sender's pace and the receiver's limit. A time later than now
|
|
11318
|
+
* (the device clock went back) is long gone, or the window would stay full for as long as the clock went back.
|
|
11319
|
+
*/
|
|
11234
11320
|
var RateWindow = class {
|
|
11235
11321
|
limit;
|
|
11236
11322
|
windowMs;
|
|
@@ -11244,7 +11330,7 @@ var RateWindow = class {
|
|
|
11244
11330
|
/** Counts one now; false (and not counted) when the window is full. */
|
|
11245
11331
|
take() {
|
|
11246
11332
|
const now = this.now();
|
|
11247
|
-
this.recent = this.recent.filter((at) => now - at < this.windowMs);
|
|
11333
|
+
this.recent = this.recent.filter((at) => at <= now && now - at < this.windowMs);
|
|
11248
11334
|
if (this.recent.length >= this.limit) return false;
|
|
11249
11335
|
this.recent.push(now);
|
|
11250
11336
|
return true;
|
|
@@ -11252,7 +11338,7 @@ var RateWindow = class {
|
|
|
11252
11338
|
/** Milliseconds until the window has room again; 0 when it has room now. */
|
|
11253
11339
|
wait() {
|
|
11254
11340
|
const now = this.now();
|
|
11255
|
-
this.recent = this.recent.filter((at) => now - at < this.windowMs);
|
|
11341
|
+
this.recent = this.recent.filter((at) => at <= now && now - at < this.windowMs);
|
|
11256
11342
|
return this.recent.length < this.limit ? 0 : this.recent[0] + this.windowMs - now;
|
|
11257
11343
|
}
|
|
11258
11344
|
reset() {
|
|
@@ -14656,16 +14742,19 @@ var IdentityExchange = class {
|
|
|
14656
14742
|
subject: s.subject,
|
|
14657
14743
|
reason: "withdrawn"
|
|
14658
14744
|
});
|
|
14659
|
-
if (connected)
|
|
14660
|
-
|
|
14661
|
-
|
|
14662
|
-
|
|
14745
|
+
if (connected) try {
|
|
14746
|
+
this.send({
|
|
14747
|
+
t: "idp-withdraw",
|
|
14748
|
+
id
|
|
14749
|
+
});
|
|
14750
|
+
} catch {}
|
|
14663
14751
|
}
|
|
14664
14752
|
/**
|
|
14665
14753
|
* Run the checks again on a received proof: its revocation record, then (unless `revocationOnly`) the
|
|
14666
|
-
* provider's check (a domain record may be gone).
|
|
14754
|
+
* provider's check (a domain record may be gone). `keepUnavailable`: a check that could not run (IdentityCheckUnavailable)
|
|
14755
|
+
* is thrown, and the proof is left as it was, for a check this side started on its own.
|
|
14667
14756
|
*/
|
|
14668
|
-
async recheck(id, { revocationOnly = false } = {}) {
|
|
14757
|
+
async recheck(id, { revocationOnly = false, keepUnavailable = false } = {}) {
|
|
14669
14758
|
const r = this.options.storage.read().received.find((x) => x.id === id);
|
|
14670
14759
|
if (!r) throw new Error("Unknown identity");
|
|
14671
14760
|
if (r.status === "revoked") return r;
|
|
@@ -14698,6 +14787,7 @@ var IdentityExchange = class {
|
|
|
14698
14787
|
error: void 0
|
|
14699
14788
|
});
|
|
14700
14789
|
} catch (e) {
|
|
14790
|
+
if (keepUnavailable && e instanceof IdentityCheckUnavailable) throw e;
|
|
14701
14791
|
const error = shortError(e);
|
|
14702
14792
|
outcome = (x) => ({
|
|
14703
14793
|
...x,
|
|
@@ -14739,19 +14829,29 @@ var IdentityExchange = class {
|
|
|
14739
14829
|
case "idp-result": {
|
|
14740
14830
|
const s = id ? this.shared(id) : void 0;
|
|
14741
14831
|
if (!s || s.status !== "pending") return;
|
|
14742
|
-
const
|
|
14743
|
-
|
|
14832
|
+
const ok = frame.ok === true;
|
|
14833
|
+
const error = ok ? void 0 : clean$1(frame.error, ERROR_MAX) ?? "Your contact could not verify it";
|
|
14834
|
+
const entry = {
|
|
14744
14835
|
...s,
|
|
14745
|
-
status:
|
|
14836
|
+
status: ok ? "accepted" : "rejected",
|
|
14746
14837
|
at: this.now(),
|
|
14747
14838
|
error
|
|
14839
|
+
};
|
|
14840
|
+
const replaced = (x) => ok && x.status === "accepted" && x.provider === s.provider && x.subject === s.subject;
|
|
14841
|
+
await this.options.storage.update((l) => this.log({
|
|
14842
|
+
...l,
|
|
14843
|
+
shared: [...l.shared.filter((x) => x.id !== s.id).map((x) => replaced(x) ? {
|
|
14844
|
+
...x,
|
|
14845
|
+
status: "withdrawn",
|
|
14846
|
+
at: entry.at
|
|
14847
|
+
} : x), entry]
|
|
14748
14848
|
}, {
|
|
14749
14849
|
type: "result",
|
|
14750
14850
|
side: "mine",
|
|
14751
14851
|
proof: s.id,
|
|
14752
|
-
ok
|
|
14852
|
+
ok,
|
|
14753
14853
|
error
|
|
14754
|
-
});
|
|
14854
|
+
}));
|
|
14755
14855
|
return;
|
|
14756
14856
|
}
|
|
14757
14857
|
case "idp-withdraw": {
|
|
@@ -14771,6 +14871,13 @@ var IdentityExchange = class {
|
|
|
14771
14871
|
subject: r.verified.subject,
|
|
14772
14872
|
reason: "withdrawn"
|
|
14773
14873
|
}));
|
|
14874
|
+
if (this.options.storage.read().challenges.some((c) => c.id === id && !c.withdrawn)) await this.options.storage.update((l) => ({
|
|
14875
|
+
...l,
|
|
14876
|
+
challenges: l.challenges.map((c) => c.id === id ? {
|
|
14877
|
+
...c,
|
|
14878
|
+
withdrawn: true
|
|
14879
|
+
} : c)
|
|
14880
|
+
}));
|
|
14774
14881
|
this.send({
|
|
14775
14882
|
t: "idp-withdrawn",
|
|
14776
14883
|
id
|
|
@@ -14883,6 +14990,7 @@ var IdentityExchange = class {
|
|
|
14883
14990
|
let error;
|
|
14884
14991
|
/** The same, as this side's own timeline says it. */
|
|
14885
14992
|
let reason;
|
|
14993
|
+
let withdrawn = false;
|
|
14886
14994
|
try {
|
|
14887
14995
|
const mayReplace = (r) => r.binding.provider === binding.provider && (r.binding.subject === binding.subject || r.verified.subject === binding.subject);
|
|
14888
14996
|
if (revokedHere(this.options.storage.read().received, id)) throw new Error(REVOKED);
|
|
@@ -14926,6 +15034,7 @@ var IdentityExchange = class {
|
|
|
14926
15034
|
...logged,
|
|
14927
15035
|
challenges
|
|
14928
15036
|
};
|
|
15037
|
+
withdrawn = !!challenge.withdrawn;
|
|
14929
15038
|
const record = {
|
|
14930
15039
|
id,
|
|
14931
15040
|
binding,
|
|
@@ -14936,15 +15045,23 @@ var IdentityExchange = class {
|
|
|
14936
15045
|
context: scope.context,
|
|
14937
15046
|
verifiedAt: now,
|
|
14938
15047
|
checkedAt: now,
|
|
14939
|
-
status: "verified"
|
|
15048
|
+
status: withdrawn ? "withdrawn" : "verified"
|
|
14940
15049
|
};
|
|
14941
|
-
|
|
15050
|
+
const kept = {
|
|
14942
15051
|
...logged,
|
|
14943
15052
|
challenges,
|
|
14944
15053
|
received: [...received, record]
|
|
14945
15054
|
};
|
|
15055
|
+
return withdrawn ? this.log(kept, {
|
|
15056
|
+
type: "stopped",
|
|
15057
|
+
side: "theirs",
|
|
15058
|
+
proof: id,
|
|
15059
|
+
provider: binding.provider,
|
|
15060
|
+
subject: verified.subject,
|
|
15061
|
+
reason: "withdrawn"
|
|
15062
|
+
}) : kept;
|
|
14946
15063
|
});
|
|
14947
|
-
this.send(verified ? {
|
|
15064
|
+
if (!withdrawn) this.send(verified ? {
|
|
14948
15065
|
t: "idp-result",
|
|
14949
15066
|
id,
|
|
14950
15067
|
ok: true
|
|
@@ -16154,7 +16271,8 @@ var LOCAL_SUFFIXES = [
|
|
|
16154
16271
|
* A URL a bundle or manifest may be fetched from. The contact chose it and this device fetches it on its own, so it
|
|
16155
16272
|
* is HTTPS, without a user or password, at a public name or a public IPv4 address: never this machine or its network.
|
|
16156
16273
|
* A name with no dot or under a local suffix is a local one. A public name may still resolve to a local address:
|
|
16157
|
-
* where the host can resolve, its `fetch` refuses that too (the CLI's, packages/cli/src/runtime/holdFetch.ts
|
|
16274
|
+
* where the host can resolve, its `fetch` refuses that too (the CLI's, packages/cli/src/runtime/holdFetch.ts, and
|
|
16275
|
+
* Desktop's, apps/desktop/src/hold_fetch.rs).
|
|
16158
16276
|
* `loopback` adds plain HTTP to this machine, for a test against a local server; no shipped app passes it.
|
|
16159
16277
|
*/
|
|
16160
16278
|
function isHoldUrl(value, loopback = false) {
|
|
@@ -17299,7 +17417,7 @@ var slot = (app, request) => `${app}:${request}`;
|
|
|
17299
17417
|
* are read and sent by the session, which calls `finish` or `fail` for each task. As the side that asks it sends at
|
|
17300
17418
|
* most `inFlight` requests per app, keeps
|
|
17301
17419
|
* the rest waiting, and puts each answer back together, in order, from the offset asked. Serves and requests last one
|
|
17302
|
-
* session: `reset` ends them all, `closeApp` those of one app.
|
|
17420
|
+
* session: `reset` ends them all, `closeApp` those of one app; a task still being read counts until it is settled.
|
|
17303
17421
|
*/
|
|
17304
17422
|
var AppRanges = class {
|
|
17305
17423
|
send;
|
|
@@ -17307,7 +17425,10 @@ var AppRanges = class {
|
|
|
17307
17425
|
now;
|
|
17308
17426
|
serves = /* @__PURE__ */ new Map();
|
|
17309
17427
|
serving = /* @__PURE__ */ new Map();
|
|
17310
|
-
/**
|
|
17428
|
+
/**
|
|
17429
|
+
* Tasks cancelled, unserved, or stopped by the contact's close or a session's end, that this side is still reading or
|
|
17430
|
+
* sending: each counts in its app's `inFlight` until settled, across sessions.
|
|
17431
|
+
*/
|
|
17311
17432
|
draining = /* @__PURE__ */ new Set();
|
|
17312
17433
|
asking = /* @__PURE__ */ new Map();
|
|
17313
17434
|
waiting = /* @__PURE__ */ new Map();
|
|
@@ -17418,8 +17539,8 @@ var AppRanges = class {
|
|
|
17418
17539
|
this.take(task);
|
|
17419
17540
|
}
|
|
17420
17541
|
/**
|
|
17421
|
-
* Whether `task`
|
|
17422
|
-
* settled, or
|
|
17542
|
+
* Whether `task` still holds a place: serving, or no longer live and draining until it is settled. False once it was
|
|
17543
|
+
* settled, or this side's app closed, which frees its place: an answer to it sends and frees nothing.
|
|
17423
17544
|
*/
|
|
17424
17545
|
holds(task) {
|
|
17425
17546
|
return this.draining.has(task) || this.serving.get(slot(task.app, task.request)) === task;
|
|
@@ -17475,17 +17596,24 @@ var AppRanges = class {
|
|
|
17475
17596
|
size: frame.z
|
|
17476
17597
|
});
|
|
17477
17598
|
}
|
|
17478
|
-
/**
|
|
17479
|
-
|
|
17599
|
+
/**
|
|
17600
|
+
* `app` closed on either side: its serves end, what it was sending stops and what it asked fails with `error`. A task
|
|
17601
|
+
* this side is still reading keeps its place until it is settled, as a cancelled one does, so a contact that closes
|
|
17602
|
+
* and opens its app again meets `busy`; only `stopped` (this side's app closed: nothing reads for it any more) frees
|
|
17603
|
+
* them now.
|
|
17604
|
+
*/
|
|
17605
|
+
closeApp(app, error = "peer-closed", stopped = false) {
|
|
17480
17606
|
for (const [id, serve] of this.serves) if (serve.app === app) this.serves.delete(id);
|
|
17481
|
-
for (const task of this.serving.values()) if (task.app === app) this.drop(task);
|
|
17482
|
-
|
|
17607
|
+
for (const task of this.serving.values()) if (task.app === app) this.drop(task, !stopped);
|
|
17608
|
+
if (stopped) {
|
|
17609
|
+
for (const task of this.draining) if (task.app === app) this.draining.delete(task);
|
|
17610
|
+
}
|
|
17483
17611
|
for (const ask of this.waiting.get(app) ?? []) ask.reject(new Error(error));
|
|
17484
17612
|
this.waiting.delete(app);
|
|
17485
17613
|
for (const ask of this.asking.values()) if (ask.app === app) this.settle(ask, error);
|
|
17486
17614
|
for (const key of [...this.sizes.keys()]) if (key.startsWith(`${app} `)) this.sizes.delete(key);
|
|
17487
17615
|
}
|
|
17488
|
-
/** The session ended: no serve id lasts into the next, and every request fails with `offline`. */
|
|
17616
|
+
/** The session ended: no serve id lasts into the next, and every request fails with `offline`. Tasks still being read keep their places into the next. */
|
|
17489
17617
|
reset() {
|
|
17490
17618
|
this.sizes.clear();
|
|
17491
17619
|
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)));
|
|
@@ -20066,10 +20194,16 @@ function readLobby(keys, records) {
|
|
|
20066
20194
|
/**
|
|
20067
20195
|
* The beacon to publish: my entry (or none, `mine` null, when I step down) with the other fresh
|
|
20068
20196
|
* hubs, newest first, at most `maxHubs`. A hub not in the roster any more is dropped.
|
|
20197
|
+
*
|
|
20198
|
+
* Anyone holding the rendezvous secret writes this record, so what is in it does not decide what stays: my entry always
|
|
20199
|
+
* does, then the keys I know as members (`known`) before keys I do not, and an entry dated ahead of now ranks as one of
|
|
20200
|
+
* now. Entries stay as their hubs dated them.
|
|
20069
20201
|
*/
|
|
20070
|
-
function mergeBeacon(existing, me, mine, now = Date.now(), isMember = () => true) {
|
|
20202
|
+
function mergeBeacon(existing, me, mine, now = Date.now(), isMember = () => true, known = () => true) {
|
|
20071
20203
|
const fresh = existing.filter((h) => h.key !== me && now - h.ts < COMMUNITY_TOPOLOGY.beaconFreshMs && h.ts <= now + 6e4 && isMember(h.key));
|
|
20072
|
-
|
|
20204
|
+
const rank = (h) => known(h.key) ? 0 : 1;
|
|
20205
|
+
const others = fresh.sort((a, b) => rank(a) - rank(b) || Math.min(b.ts, now) - Math.min(a.ts, now));
|
|
20206
|
+
return (mine ? [mine, ...others] : others).slice(0, COMMUNITY_TOPOLOGY.maxHubs);
|
|
20073
20207
|
}
|
|
20074
20208
|
/** The lobby to publish: my request refreshed, others' still fresh, newest last. */
|
|
20075
20209
|
function mergeLobby(existing, mine, now = Date.now()) {
|
|
@@ -20542,6 +20676,13 @@ var GROUP_FILE_LIMITS = {
|
|
|
20542
20676
|
serveMoveBytes: 16384,
|
|
20543
20677
|
/** How long a served transfer keeps its place while all are taken and another member asks: past it, the place is theirs. */
|
|
20544
20678
|
servePlaceMs: 3e5,
|
|
20679
|
+
/**
|
|
20680
|
+
* A served transfer's pace is what it confirmed in the last `servePaceMs` (at most twice that), counted from its offer.
|
|
20681
|
+
* While all places are taken and a member holding none asks or waits, the slowest served that long gives it its place,
|
|
20682
|
+
* if at its pace more is left to go than it has been served and than `servePaceMs`: members on fast links do not wait
|
|
20683
|
+
* for slow ones that asked first. Each member's transfer of a file loses its place so once per holder.
|
|
20684
|
+
*/
|
|
20685
|
+
servePaceMs: 1e4,
|
|
20545
20686
|
/** File announcements a member sends to one group in a minute. */
|
|
20546
20687
|
announcePerMinute: 8,
|
|
20547
20688
|
/** File announcements of one member of a group fetched by themselves in `announceWindowMs`; past it, kept for a Download. */
|
|
@@ -20569,6 +20710,14 @@ var GROUP_FILE_LIMITS = {
|
|
|
20569
20710
|
haveFramesTaken: 20,
|
|
20570
20711
|
communityHaveEveryMs: 6e4,
|
|
20571
20712
|
/**
|
|
20713
|
+
* `group-want` frames an edge sends in `wantWindowMs`, and takes from its member, the rest dropped before anything is
|
|
20714
|
+
* looked up: twice what it may send, as for `group-have`. A member back from away in a group of 16 asked one member
|
|
20715
|
+
* for at most 47 in 10 seconds, its files coming as fast as the network lets them.
|
|
20716
|
+
*/
|
|
20717
|
+
wantFrames: 50,
|
|
20718
|
+
wantFramesTaken: 100,
|
|
20719
|
+
wantWindowMs: 1e4,
|
|
20720
|
+
/**
|
|
20572
20721
|
* How long a want waits for an offer before the next holder is asked; a transfer that does not move for as long is
|
|
20573
20722
|
* left for the next holder too.
|
|
20574
20723
|
*/
|
|
@@ -21132,7 +21281,8 @@ var QUIET_FRAMES = /* @__PURE__ */ new Set([
|
|
|
21132
21281
|
"paired-groups",
|
|
21133
21282
|
"paired-services",
|
|
21134
21283
|
"paired-reconnect",
|
|
21135
|
-
"paired-reconnect-ack"
|
|
21284
|
+
"paired-reconnect-ack",
|
|
21285
|
+
CONTACT_ASKER_FRAME
|
|
21136
21286
|
]);
|
|
21137
21287
|
/**
|
|
21138
21288
|
* A ping with nothing at all back this long after it went: the contact may have crashed and started again, with its new
|
|
@@ -21396,6 +21546,8 @@ var GhostLink = class {
|
|
|
21396
21546
|
/** Edit frames the contact may send per window; the rest go unconfirmed and come again. */
|
|
21397
21547
|
editsReceived = new RateWindow(30, EDIT_RATE_WINDOW_MS);
|
|
21398
21548
|
wakeReceived = new RateWindow(6, 6e4);
|
|
21549
|
+
/** Said once a session by the requester's app: a few a minute at most. */
|
|
21550
|
+
askerReceived = new RateWindow(4, 6e4);
|
|
21399
21551
|
/**
|
|
21400
21552
|
* The contact's name and picture, its word on held items, its ways of paying and its transport descriptors, each saved
|
|
21401
21553
|
* on this side when it changes: said once a session and when changed, so a handful a minute each. Past that only the
|
|
@@ -22355,6 +22507,14 @@ var GhostLink = class {
|
|
|
22355
22507
|
});
|
|
22356
22508
|
});
|
|
22357
22509
|
}
|
|
22510
|
+
/**
|
|
22511
|
+
* `connect` for what only needs the link (a request, a file, a payment step): on a live session it does nothing, where
|
|
22512
|
+
* `connect` is a retry that says this side's transport policy again, and the contact reads 10 a minute
|
|
22513
|
+
* (POLICY_RECEIVE_LIMIT). A shared app's every file, each file sent and each payment step used to spend one.
|
|
22514
|
+
*/
|
|
22515
|
+
open() {
|
|
22516
|
+
return this.paired?.state.status === "ready" && !this.streamBlocked ? Promise.resolve() : this.connect();
|
|
22517
|
+
}
|
|
22358
22518
|
/** Closes what a switch replaced once the contact has had time to move too. */
|
|
22359
22519
|
retire(old, also, rtc = false) {
|
|
22360
22520
|
if (this.retiring.has(old)) return;
|
|
@@ -22932,6 +23092,14 @@ var GhostLink = class {
|
|
|
22932
23092
|
}
|
|
22933
23093
|
if (!this.channel) this.maybeAutoConnect(this.presence);
|
|
22934
23094
|
}
|
|
23095
|
+
/**
|
|
23096
|
+
* This side's listener on `transport` is up again after it was let go while the contact was away (the engine's
|
|
23097
|
+
* `releaseGoneListeners`), and the contact is back: it is dialled once now, whichever side's turn it is, as after a
|
|
23098
|
+
* restart. The contact's own dials found no listener here meanwhile, and wait out their backoff (half a minute).
|
|
23099
|
+
*/
|
|
23100
|
+
knockOnReturn(transport) {
|
|
23101
|
+
this.knock(transport);
|
|
23102
|
+
}
|
|
22935
23103
|
/** The knock under way (`knock`): its transport, its attempt, and whether it was knocked again (`knockAgain`). */
|
|
22936
23104
|
knocking = null;
|
|
22937
23105
|
/**
|
|
@@ -23704,7 +23872,7 @@ var GhostLink = class {
|
|
|
23704
23872
|
/** Issues an HTTP request to a service the peer advertises. */
|
|
23705
23873
|
async request(serviceId, request) {
|
|
23706
23874
|
if (this.options.params.profile) {
|
|
23707
|
-
await this.
|
|
23875
|
+
await this.open();
|
|
23708
23876
|
if (!this.supportsServices) throw new GhostlyHttpError("unavailable", this.isDataLinkOpen ? "Your contact's app cannot share services in this chat, or needs an updated Ghostly" : "Shared services need a live connection");
|
|
23709
23877
|
if (!this.pairedHttp) throw new GhostlyHttpError("closed", "Data link is closed");
|
|
23710
23878
|
return this.pairedHttp.client.request(serviceId, request);
|
|
@@ -23775,7 +23943,7 @@ var GhostLink = class {
|
|
|
23775
23943
|
}
|
|
23776
23944
|
/** Sends a file over the data link, opening it first if needed. Files never travel through Pkarr. */
|
|
23777
23945
|
async sendFile(file, source) {
|
|
23778
|
-
await this.
|
|
23946
|
+
await this.open();
|
|
23779
23947
|
if (this.options.params.profile) {
|
|
23780
23948
|
if (!this.supportsFiles || !this.pairedFiles) throw new Error("This contact does not support files. Both peers need an updated Ghostly.");
|
|
23781
23949
|
return this.pairedFiles.send(file, source);
|
|
@@ -24291,6 +24459,31 @@ var GhostLink = class {
|
|
|
24291
24459
|
return false;
|
|
24292
24460
|
}
|
|
24293
24461
|
}
|
|
24462
|
+
/**
|
|
24463
|
+
* This side's participation key and the pinned contact's, on a paired session that is open and ready: what the asker's
|
|
24464
|
+
* proof of a contact request is made for (WISP 8xx § Accept). Undefined otherwise.
|
|
24465
|
+
*/
|
|
24466
|
+
get participationKeys() {
|
|
24467
|
+
const credentials = this.options.pairing?.credentials;
|
|
24468
|
+
if (!this.options.params.profile || !credentials?.peerKey || !this.channel || !this.isDataLinkOpen || this.paired?.state.status !== "ready") return void 0;
|
|
24469
|
+
return {
|
|
24470
|
+
mine: credentials.signer ? toZ32(credentials.signer.publicKey) : identityFromSeedB64(credentials.seedB64).pubKeyZ32,
|
|
24471
|
+
peer: credentials.peerKey
|
|
24472
|
+
};
|
|
24473
|
+
}
|
|
24474
|
+
/**
|
|
24475
|
+
* Says on the live session that this side asked through the contact's link (WISP 8xx § Accept). No capability: an app
|
|
24476
|
+
* that does not know the frame drops it. False when it could not go now: the caller says it again on the next session.
|
|
24477
|
+
*/
|
|
24478
|
+
sendContactAsker(frame) {
|
|
24479
|
+
if (!this.channel || !this.participationKeys) return false;
|
|
24480
|
+
try {
|
|
24481
|
+
this.channel.send(JSON.stringify(frame));
|
|
24482
|
+
return true;
|
|
24483
|
+
} catch {
|
|
24484
|
+
return false;
|
|
24485
|
+
}
|
|
24486
|
+
}
|
|
24294
24487
|
/** Both sides offer `pin/1` on the open session: a pin can be said and confirmed. */
|
|
24295
24488
|
get supportsPins() {
|
|
24296
24489
|
return this.isDataLinkOpen && this.sessionCapabilities.agreed("pin/1");
|
|
@@ -24394,7 +24587,7 @@ var GhostLink = class {
|
|
|
24394
24587
|
closeApp(app) {
|
|
24395
24588
|
const frame = JSON.stringify(appCloseFrame(app));
|
|
24396
24589
|
if (!this.apps.open.delete(app)) return;
|
|
24397
|
-
this.appRanges.closeApp(app, "offline");
|
|
24590
|
+
this.appRanges.closeApp(app, "offline", true);
|
|
24398
24591
|
if (this.supportsApps && this.channel) try {
|
|
24399
24592
|
this.channel.send(frame);
|
|
24400
24593
|
} catch {}
|
|
@@ -24520,7 +24713,7 @@ var GhostLink = class {
|
|
|
24520
24713
|
failAppRange(task, error) {
|
|
24521
24714
|
this.appRanges.fail(task, error);
|
|
24522
24715
|
}
|
|
24523
|
-
/** Whether `task` still
|
|
24716
|
+
/** Whether `task` still holds a place until it is answered (`AppRanges.holds`): one that does not needs no answer. */
|
|
24524
24717
|
holdsAppRange(task) {
|
|
24525
24718
|
return this.appRanges.holds(task);
|
|
24526
24719
|
}
|
|
@@ -24801,7 +24994,7 @@ var GhostLink = class {
|
|
|
24801
24994
|
async requirePaymentSupport() {
|
|
24802
24995
|
if (!PAYMENT_METHODS.some((m) => this.paymentEnabled(m))) throw new Error("Payments are turned off in this chat.");
|
|
24803
24996
|
if (this.contactAway) throw engineError("contactAway");
|
|
24804
|
-
await this.
|
|
24997
|
+
await this.open();
|
|
24805
24998
|
if (this.supportsPayments) return;
|
|
24806
24999
|
const networks = this.peerNetworks;
|
|
24807
25000
|
throw engineError(networks && !Object.keys(networks).length ? "contactNoWallet" : "contactNoPayments");
|
|
@@ -25447,6 +25640,11 @@ var GhostLink = class {
|
|
|
25447
25640
|
if (target !== void 0) this.options.events?.onPeerWake?.(target);
|
|
25448
25641
|
return;
|
|
25449
25642
|
}
|
|
25643
|
+
if (frame?.t === "contact-asker") {
|
|
25644
|
+
const keys = this.participationKeys;
|
|
25645
|
+
if (keys && this.askerReceived.take()) this.options.events?.onContactAsker?.(frame, keys);
|
|
25646
|
+
return;
|
|
25647
|
+
}
|
|
25450
25648
|
if (frame?.t === "paired-typing") {
|
|
25451
25649
|
if (this.supportsTyping) this.typingReceiver.receive(frame);
|
|
25452
25650
|
return;
|
|
@@ -26240,8 +26438,10 @@ function jpegKeeps(marker, b, payload) {
|
|
|
26240
26438
|
if (marker === 238) return starts(b, payload, "Adobe");
|
|
26241
26439
|
return false;
|
|
26242
26440
|
}
|
|
26243
|
-
/** An
|
|
26244
|
-
var
|
|
26441
|
+
/** An Exif (its TIFF), big-endian, whose IFD0 holds `orientation` alone: all a picture keeps of its Exif. */
|
|
26442
|
+
var orientationTiff = (orientation) => Uint8Array.of(77, 77, 0, 42, 0, 0, 0, 8, 0, 1, 1, 18, 0, 3, 0, 0, 0, 1, 0, orientation, 0, 0, 0, 0, 0, 0);
|
|
26443
|
+
/** An APP1 Exif whose IFD0 holds `orientation` alone. */
|
|
26444
|
+
var orientationOnly = (orientation) => Uint8Array.of(255, 225, 0, 34, 69, 120, 105, 102, 0, 0, ...orientationTiff(orientation));
|
|
26245
26445
|
function stripJpeg(b) {
|
|
26246
26446
|
const parts = [b.subarray(0, 2)];
|
|
26247
26447
|
let at = 2, framed = false, scanned = false, exif = false;
|
|
@@ -26262,7 +26462,8 @@ function stripJpeg(b) {
|
|
|
26262
26462
|
check$1(marker !== 0 && marker !== 216 && at + 2 <= b.length);
|
|
26263
26463
|
const length = u16be(b, at);
|
|
26264
26464
|
check$1(length >= 2 && at + length <= b.length);
|
|
26265
|
-
if (
|
|
26465
|
+
if (marker === 224 && length > 16 && starts(b, at + 2, "JFIF\0")) parts.push(Uint8Array.of(255, 224, 0, 16, ...b.subarray(at + 2, at + 14), 0, 0));
|
|
26466
|
+
else if (jpegKeeps(marker, b, at + 2)) {
|
|
26266
26467
|
parts.push(Uint8Array.of(255, marker), b.subarray(at, at + length));
|
|
26267
26468
|
if (JPEG_FRAME.has(marker)) framed = true;
|
|
26268
26469
|
} else if (marker === 225 && !scanned && !exif && starts(b, at + 2, "Exif\0\0")) {
|
|
@@ -26310,9 +26511,24 @@ var PNG_DRAWS = /* @__PURE__ */ new Set([
|
|
|
26310
26511
|
"fcTL",
|
|
26311
26512
|
"fdAT"
|
|
26312
26513
|
]);
|
|
26514
|
+
var CRC_TABLE = Array.from({ length: 256 }, (_, n) => {
|
|
26515
|
+
for (let k = 0; k < 8; k++) n = n & 1 ? 3988292384 ^ n >>> 1 : n >>> 1;
|
|
26516
|
+
return n >>> 0;
|
|
26517
|
+
});
|
|
26518
|
+
/** A PNG chunk: its length, type, data and the CRC of its type and data. */
|
|
26519
|
+
function pngChunk(type, data) {
|
|
26520
|
+
const out = new Uint8Array(12 + data.length), view = new DataView(out.buffer);
|
|
26521
|
+
view.setUint32(0, data.length);
|
|
26522
|
+
for (let i = 0; i < 4; i++) out[4 + i] = type.charCodeAt(i);
|
|
26523
|
+
out.set(data, 8);
|
|
26524
|
+
let crc = -1;
|
|
26525
|
+
for (const byte of out.subarray(4, 8 + data.length)) crc = CRC_TABLE[(crc ^ byte) & 255] ^ crc >>> 8;
|
|
26526
|
+
view.setUint32(8 + data.length, ~crc >>> 0);
|
|
26527
|
+
return out;
|
|
26528
|
+
}
|
|
26313
26529
|
function stripPng(b) {
|
|
26314
26530
|
const parts = [b.subarray(0, 8)];
|
|
26315
|
-
let at = 8;
|
|
26531
|
+
let at = 8, exif = false, imaged = false;
|
|
26316
26532
|
for (;;) {
|
|
26317
26533
|
check$1(at + 12 <= b.length);
|
|
26318
26534
|
const length = u32be$1(b, at), type = text$1(b, at + 4, 4);
|
|
@@ -26320,6 +26536,12 @@ function stripPng(b) {
|
|
|
26320
26536
|
const critical = (b[at + 4] & 32) === 0;
|
|
26321
26537
|
check$1(!critical || PNG_CRITICAL.has(type));
|
|
26322
26538
|
if (critical || PNG_DRAWS.has(type)) parts.push(b.subarray(at, at + 12 + length));
|
|
26539
|
+
else if (type === "eXIf" && !exif && !imaged) {
|
|
26540
|
+
exif = true;
|
|
26541
|
+
const orientation = exifOrientation(b, at + 8, at + 8 + length);
|
|
26542
|
+
if (orientation >= 2) parts.push(pngChunk("eXIf", orientationTiff(orientation)));
|
|
26543
|
+
}
|
|
26544
|
+
if (type === "IDAT") imaged = true;
|
|
26323
26545
|
at += 12 + length;
|
|
26324
26546
|
if (type === "IEND") return parts;
|
|
26325
26547
|
}
|
|
@@ -26338,19 +26560,38 @@ function stripWebp(b) {
|
|
|
26338
26560
|
const riffEnd = 8 + u32le(b, 4);
|
|
26339
26561
|
check$1(riffEnd <= b.length && riffEnd % 2 === 0);
|
|
26340
26562
|
const parts = [];
|
|
26341
|
-
let at = 12, size = 4, drawn = false;
|
|
26563
|
+
let at = 12, size = 4, drawn = false, exif = false, vp8x;
|
|
26342
26564
|
while (at < riffEnd) {
|
|
26343
26565
|
check$1(at + 8 <= riffEnd);
|
|
26344
26566
|
const type = text$1(b, at, 4), length = u32le(b, at + 4), end = at + 8 + length + (length & 1);
|
|
26345
26567
|
check$1(end <= riffEnd && (at > 12 || type === "VP8 " || type === "VP8L" || type === "VP8X"));
|
|
26568
|
+
let chunk;
|
|
26346
26569
|
if (WEBP_KEEPS.has(type)) {
|
|
26347
|
-
|
|
26570
|
+
chunk = b.subarray(at, end);
|
|
26348
26571
|
if (type === "VP8X") {
|
|
26349
26572
|
check$1(length >= 10);
|
|
26350
|
-
chunk = chunk.slice();
|
|
26573
|
+
chunk = vp8x = chunk.slice();
|
|
26351
26574
|
chunk[8] = chunk[8] & -13;
|
|
26352
26575
|
}
|
|
26353
26576
|
if (type === "VP8 " || type === "VP8L" || type === "ANMF") drawn = true;
|
|
26577
|
+
} else if (type === "EXIF" && !exif && vp8x) {
|
|
26578
|
+
exif = true;
|
|
26579
|
+
const orientation = exifOrientation(b, starts(b, at + 8, "Exif\0\0") ? at + 14 : at + 8, at + 8 + length);
|
|
26580
|
+
if (orientation >= 2) {
|
|
26581
|
+
const data = orientationTiff(orientation);
|
|
26582
|
+
chunk = new Uint8Array(8 + data.length);
|
|
26583
|
+
chunk.set([
|
|
26584
|
+
69,
|
|
26585
|
+
88,
|
|
26586
|
+
73,
|
|
26587
|
+
70,
|
|
26588
|
+
data.length
|
|
26589
|
+
]);
|
|
26590
|
+
chunk.set(data, 8);
|
|
26591
|
+
vp8x[8] = vp8x[8] | 8;
|
|
26592
|
+
}
|
|
26593
|
+
}
|
|
26594
|
+
if (chunk) {
|
|
26354
26595
|
parts.push(chunk);
|
|
26355
26596
|
size += chunk.length;
|
|
26356
26597
|
}
|
|
@@ -26439,6 +26680,8 @@ function stripHeif(b) {
|
|
|
26439
26680
|
check$1(at + 6 <= infe.end);
|
|
26440
26681
|
if (HEIF_METADATA_ITEMS.has(text$1(b, at + 2, 4))) metadata.add(id);
|
|
26441
26682
|
}
|
|
26683
|
+
/** `free` and `skip` boxes, at the top and in `meta`: their bodies go as zeros. */
|
|
26684
|
+
const space = [...top, ...children].filter((box) => box.type === "free" || box.type === "skip");
|
|
26442
26685
|
const out = b.slice();
|
|
26443
26686
|
const version = b[iloc.body];
|
|
26444
26687
|
check$1(version <= 2);
|
|
@@ -26471,13 +26714,18 @@ function stripHeif(b) {
|
|
|
26471
26714
|
for (let e = 0; e < extents; e++) {
|
|
26472
26715
|
if (indexSize) read(indexSize);
|
|
26473
26716
|
const offset = read(offsetSize), length = read(lengthSize);
|
|
26474
|
-
if (!metadata.has(id))
|
|
26717
|
+
if (!metadata.has(id)) {
|
|
26718
|
+
const start = base + offset, end = length ? start + length : b.length;
|
|
26719
|
+
check$1(reference !== 0 || method !== 0 || !space.some((box) => start < box.end && end > box.body));
|
|
26720
|
+
continue;
|
|
26721
|
+
}
|
|
26475
26722
|
check$1(reference === 0 && length > 0 && (method === 0 || method === 1 && !!idat));
|
|
26476
26723
|
const start = (method === 1 ? idat.body : 0) + base + offset, limit = method === 1 ? idat.end : b.length;
|
|
26477
26724
|
check$1(start + length <= limit);
|
|
26478
26725
|
out.fill(0, start, start + length);
|
|
26479
26726
|
}
|
|
26480
26727
|
}
|
|
26728
|
+
for (const box of space) out.fill(0, box.body, box.end);
|
|
26481
26729
|
return [out];
|
|
26482
26730
|
}
|
|
26483
26731
|
var GIF_APPS_KEPT = /* @__PURE__ */ new Set([
|
|
@@ -26751,13 +26999,18 @@ async function withoutPictureMetadata(source, mime) {
|
|
|
26751
26999
|
/**
|
|
26752
27000
|
* What a video leaves with. An MP4 or QuickTime file says more than its frames: its `udta` and `meta` boxes hold where
|
|
26753
27001
|
* it was recorded (`©xyz`, `com.apple.quicktime.location.ISO6709`), the device, often its software; a timed metadata
|
|
26754
|
-
* track (an iPhone's location and motion, a GoPro's GPS) holds them sample by sample
|
|
26755
|
-
*
|
|
26756
|
-
*
|
|
26757
|
-
*
|
|
27002
|
+
* track (an iPhone's location and motion, a GoPro's GPS) holds them sample by sample; the movie's, each track's and
|
|
27003
|
+
* each track's media header (`mvhd`, `tkhd`, `mdhd`) say when it was recorded, to the second, and a camera's timecode
|
|
27004
|
+
* track the time of day. The sender removes them before the file is stored and its digest computed, without decoding
|
|
27005
|
+
* or re-encoding a frame: each such box becomes a `free` box of the same size, zeroed, the headers' creation and
|
|
27006
|
+
* modification times are zeroed (0 is "unknown"), the space already left in it (`free`, `skip`, `wide`: what an edit in
|
|
27007
|
+
* place left behind, a recorder's GPS log) is zeroed after its header, so are the names of its handlers and of the
|
|
27008
|
+
* compressor that made its frames, and each metadata and timecode track's samples are zeroed where they are, so no
|
|
27009
|
+
* offset in the file moves and it plays as it did. Only the boxes' headers, `moov` and `moof` are read; the
|
|
27010
|
+
* media goes untouched.
|
|
26758
27011
|
*
|
|
26759
27012
|
* Fail-closed: a file that is an MP4 or QuickTime video, by its bytes or by its type, and whose metadata cannot be
|
|
26760
|
-
* removed (truncated, malformed, a part this does not know) is refused with `NO_VIDEO_METADATA`, never sent as it was.
|
|
27013
|
+
* removed (truncated, malformed, a part of its movie this does not know) is refused with `NO_VIDEO_METADATA`, never sent as it was.
|
|
26761
27014
|
* A picture (HEIF is pictureMetadata.ts's), a file without a video track (an M4A) and any other file go as they are.
|
|
26762
27015
|
*/
|
|
26763
27016
|
var VIDEO_METADATA_LIMITS = {
|
|
@@ -26778,14 +27031,20 @@ var STRIPPED_TYPES = /* @__PURE__ */ new Set([
|
|
|
26778
27031
|
"video/3gpp",
|
|
26779
27032
|
"video/3gpp2"
|
|
26780
27033
|
]);
|
|
26781
|
-
/**
|
|
27034
|
+
/**
|
|
27035
|
+
* The first box of an MP4 (`ftyp`), of a QuickTime file written without one, or of one a tool or a preview was put
|
|
27036
|
+
* before (`uuid`, `pnot`): a file that starts with one is a movie, refused when it is not one.
|
|
27037
|
+
*/
|
|
26782
27038
|
var FIRST_BOXES = /* @__PURE__ */ new Set([
|
|
26783
27039
|
"ftyp",
|
|
26784
27040
|
"moov",
|
|
26785
27041
|
"mdat",
|
|
26786
27042
|
"wide",
|
|
26787
27043
|
"free",
|
|
26788
|
-
"skip"
|
|
27044
|
+
"skip",
|
|
27045
|
+
"uuid",
|
|
27046
|
+
"pnot",
|
|
27047
|
+
"PICT"
|
|
26789
27048
|
]);
|
|
26790
27049
|
/** Boxes that hold metadata wherever they are: emptied into `free`. */
|
|
26791
27050
|
var METADATA = /* @__PURE__ */ new Set([
|
|
@@ -26793,7 +27052,20 @@ var METADATA = /* @__PURE__ */ new Set([
|
|
|
26793
27052
|
"meta",
|
|
26794
27053
|
"uuid"
|
|
26795
27054
|
]);
|
|
26796
|
-
/**
|
|
27055
|
+
/**
|
|
27056
|
+
* Space left in a file (padding, or an old `moov` or `udta` an edit in place left behind), and what a recorder puts
|
|
27057
|
+
* there (a dashcam's GPS log, a thumbnail): kept where it is, its body zeroed.
|
|
27058
|
+
*/
|
|
27059
|
+
var SPACE = /* @__PURE__ */ new Set([
|
|
27060
|
+
"free",
|
|
27061
|
+
"skip",
|
|
27062
|
+
"wide"
|
|
27063
|
+
]);
|
|
27064
|
+
/**
|
|
27065
|
+
* At the top: what makes the movie, kept (`moov` and `moof` looked into). Any other box is emptied, unless the movie's
|
|
27066
|
+
* samples are in it: the ones known at a movie's top (a preview picture, an event message, the wall-clock time a
|
|
27067
|
+
* fragment was made, `prft`) and a device's own (Samsung's `sefd`, a GPS track's `gps0`) alike.
|
|
27068
|
+
*/
|
|
26797
27069
|
var TOP_KEEPS = /* @__PURE__ */ new Set([
|
|
26798
27070
|
"ftyp",
|
|
26799
27071
|
"styp",
|
|
@@ -26803,18 +27075,17 @@ var TOP_KEEPS = /* @__PURE__ */ new Set([
|
|
|
26803
27075
|
"mfra",
|
|
26804
27076
|
"sidx",
|
|
26805
27077
|
"ssix",
|
|
26806
|
-
"prft",
|
|
26807
27078
|
"pdin",
|
|
26808
|
-
|
|
26809
|
-
"skip",
|
|
26810
|
-
"wide"
|
|
27079
|
+
...SPACE
|
|
26811
27080
|
]);
|
|
27081
|
+
/** The boxes emptied that are known at a movie's top: a file that starts with one is read as boxes. */
|
|
26812
27082
|
var TOP_EMPTIED = /* @__PURE__ */ new Set([
|
|
26813
27083
|
...METADATA,
|
|
26814
27084
|
"pnot",
|
|
26815
27085
|
"PICT",
|
|
26816
27086
|
"emsg",
|
|
26817
|
-
"Xtra"
|
|
27087
|
+
"Xtra",
|
|
27088
|
+
"prft"
|
|
26818
27089
|
]);
|
|
26819
27090
|
var MOOV_KEEPS = /* @__PURE__ */ new Set([
|
|
26820
27091
|
"mvhd",
|
|
@@ -26822,9 +27093,7 @@ var MOOV_KEEPS = /* @__PURE__ */ new Set([
|
|
|
26822
27093
|
"mvex",
|
|
26823
27094
|
"iods",
|
|
26824
27095
|
"ctab",
|
|
26825
|
-
|
|
26826
|
-
"skip",
|
|
26827
|
-
"wide"
|
|
27096
|
+
...SPACE
|
|
26828
27097
|
]);
|
|
26829
27098
|
var TRAK_KEEPS = /* @__PURE__ */ new Set([
|
|
26830
27099
|
"tkhd",
|
|
@@ -26835,9 +27104,7 @@ var TRAK_KEEPS = /* @__PURE__ */ new Set([
|
|
|
26835
27104
|
"load",
|
|
26836
27105
|
"txas",
|
|
26837
27106
|
"matt",
|
|
26838
|
-
|
|
26839
|
-
"skip",
|
|
26840
|
-
"wide"
|
|
27107
|
+
...SPACE
|
|
26841
27108
|
]);
|
|
26842
27109
|
/** Boxes looked into below a track (and in a fragment) for the metadata boxes in them. */
|
|
26843
27110
|
var CONTAINERS = /* @__PURE__ */ new Set([
|
|
@@ -26849,7 +27116,7 @@ var CONTAINERS = /* @__PURE__ */ new Set([
|
|
|
26849
27116
|
"mvex",
|
|
26850
27117
|
"traf"
|
|
26851
27118
|
]);
|
|
26852
|
-
/** Track handlers kept as they are: picture, sound, text and subtitles, timecode, hints. `meta` tracks have their samples zeroed. */
|
|
27119
|
+
/** Track handlers kept as they are: picture, sound, text and subtitles, timecode, hints. `meta` tracks have their samples zeroed, `tmcd` ones too. */
|
|
26853
27120
|
var HANDLERS = /* @__PURE__ */ new Set([
|
|
26854
27121
|
"vide",
|
|
26855
27122
|
"soun",
|
|
@@ -26865,6 +27132,12 @@ var HANDLERS = /* @__PURE__ */ new Set([
|
|
|
26865
27132
|
"odsm",
|
|
26866
27133
|
"subp"
|
|
26867
27134
|
]);
|
|
27135
|
+
/** The handlers whose sample descriptions are a visual one's, a compressor's name in each. */
|
|
27136
|
+
var VISUAL = /* @__PURE__ */ new Set([
|
|
27137
|
+
"vide",
|
|
27138
|
+
"auxv",
|
|
27139
|
+
"pict"
|
|
27140
|
+
]);
|
|
26868
27141
|
/** Zeros put in a Blob a part at a time. */
|
|
26869
27142
|
var ZEROS = /* @__PURE__ */ new Uint8Array(1048576);
|
|
26870
27143
|
var u32be = (b, at) => (b[at] << 24 >>> 0) + (b[at + 1] << 16) + (b[at + 2] << 8) + b[at + 3];
|
|
@@ -26912,22 +27185,59 @@ function empty(b, box) {
|
|
|
26912
27185
|
], box.start + 4);
|
|
26913
27186
|
b.fill(0, box.start + (u32be(b, box.start) === 1 ? 16 : 8), box.end);
|
|
26914
27187
|
}
|
|
26915
|
-
/**
|
|
27188
|
+
/**
|
|
27189
|
+
* Every metadata box in a container's children (and in theirs, for the containers below a track) emptied, every
|
|
27190
|
+
* free space's body zeroed, and every handler's name (an `hdlr`'s after its 24 bytes of fields: "Core Media Video",
|
|
27191
|
+
* an encoder's or an app's) zeroed in place, its type kept.
|
|
27192
|
+
*/
|
|
26916
27193
|
function emptyWithin(b, start, end) {
|
|
26917
27194
|
for (const box of boxes(b, start, end)) if (METADATA.has(box.type)) empty(b, box);
|
|
27195
|
+
else if (SPACE.has(box.type)) b.fill(0, box.body, box.end);
|
|
27196
|
+
else if (box.type === "hdlr") b.fill(0, Math.min(box.body + 24, box.end), box.end);
|
|
26918
27197
|
else if (CONTAINERS.has(box.type)) emptyWithin(b, box.body, box.end);
|
|
26919
27198
|
}
|
|
27199
|
+
/**
|
|
27200
|
+
* A visual track's sample descriptions with the name of the compressor that made them zeroed (32 bytes at 42 of each
|
|
27201
|
+
* entry's body, MP4's `compressorname` and QuickTime's alike: an encoder's version, a camera's).
|
|
27202
|
+
*/
|
|
27203
|
+
function zeroCompressorNames(b, stbl) {
|
|
27204
|
+
const stsd = child(b, stbl, "stsd");
|
|
27205
|
+
check(!!stsd && stsd.body + 8 <= stsd.end);
|
|
27206
|
+
for (const entry of boxes(b, stsd.body + 8, stsd.end)) {
|
|
27207
|
+
check(entry.body + 74 <= entry.end);
|
|
27208
|
+
b.fill(0, entry.body + 42, entry.body + 74);
|
|
27209
|
+
}
|
|
27210
|
+
}
|
|
27211
|
+
/** A `mvhd`, `tkhd` or `mdhd` with its creation and modification times zeroed: 32 bits each in version 0, 64 in 1. */
|
|
27212
|
+
function zeroTimes(b, box) {
|
|
27213
|
+
const version = b[box.body], bytes = version === 1 ? 16 : 8;
|
|
27214
|
+
check(version <= 1 && box.body + 4 + bytes <= box.end);
|
|
27215
|
+
b.fill(0, box.body + 4, box.body + 4 + bytes);
|
|
27216
|
+
}
|
|
26920
27217
|
var child = (b, parent, type) => {
|
|
26921
27218
|
if (!parent) return void 0;
|
|
26922
27219
|
const of = boxes(b, parent.body, parent.end).filter((box) => box.type === type);
|
|
26923
27220
|
check(of.length <= 1);
|
|
26924
27221
|
return of[0];
|
|
26925
27222
|
};
|
|
27223
|
+
/** A sample table's chunks, from its `stco` or `co64`: how many, and where each starts in the file. */
|
|
27224
|
+
function chunkOffsets(b, stbl) {
|
|
27225
|
+
const stco = child(b, stbl, "stco"), co64 = child(b, stbl, "co64");
|
|
27226
|
+
check(!!stco !== !!co64);
|
|
27227
|
+
const offsets = stco ?? co64;
|
|
27228
|
+
check(offsets.body + 8 <= offsets.end);
|
|
27229
|
+
const chunks = u32be(b, offsets.body + 4);
|
|
27230
|
+
check(offsets.body + 8 + chunks * (co64 ? 8 : 4) <= offsets.end);
|
|
27231
|
+
const offsetOf = (i) => co64 ? u32be(b, co64.body + 8 + i * 8) * 2 ** 32 + u32be(b, co64.body + 12 + i * 8) : u32be(b, stco.body + 8 + i * 4);
|
|
27232
|
+
return {
|
|
27233
|
+
chunks,
|
|
27234
|
+
offsetOf
|
|
27235
|
+
};
|
|
27236
|
+
}
|
|
26926
27237
|
/** The byte ranges of a track's samples in the file, one per chunk, from its sample table. */
|
|
26927
27238
|
function sampleRanges(b, stbl) {
|
|
26928
27239
|
const stsz = child(b, stbl, "stsz"), stz2 = child(b, stbl, "stz2"), stsc = child(b, stbl, "stsc");
|
|
26929
|
-
|
|
26930
|
-
check(!!stsc && !!stsz !== !!stz2 && !!stco !== !!co64);
|
|
27240
|
+
check(!!stsc && !!stsz !== !!stz2);
|
|
26931
27241
|
const need = (box, at, bytes) => check(at + bytes <= box.end);
|
|
26932
27242
|
const sizeTable = stsz ?? stz2;
|
|
26933
27243
|
need(sizeTable, sizeTable.body, 12);
|
|
@@ -26946,11 +27256,7 @@ function sampleRanges(b, stbl) {
|
|
|
26946
27256
|
const at = stz2.body + 12;
|
|
26947
27257
|
sizeOf = field === 16 ? (i) => b[at + i * 2] << 8 | b[at + i * 2 + 1] : field === 8 ? (i) => b[at + i] : (i) => i & 1 ? b[at + (i >> 1)] & 15 : b[at + (i >> 1)] >> 4;
|
|
26948
27258
|
}
|
|
26949
|
-
const
|
|
26950
|
-
need(offsets, offsets.body, 8);
|
|
26951
|
-
const chunks = u32be(b, offsets.body + 4);
|
|
26952
|
-
need(offsets, offsets.body + 8, chunks * (co64 ? 8 : 4));
|
|
26953
|
-
const offsetOf = (i) => co64 ? u32be(b, co64.body + 8 + i * 8) * 2 ** 32 + u32be(b, co64.body + 12 + i * 8) : u32be(b, stco.body + 8 + i * 4);
|
|
27259
|
+
const { chunks, offsetOf } = chunkOffsets(b, stbl);
|
|
26954
27260
|
need(stsc, stsc.body, 8);
|
|
26955
27261
|
const runs = u32be(b, stsc.body + 4);
|
|
26956
27262
|
need(stsc, stsc.body + 8, runs * 12);
|
|
@@ -26973,6 +27279,79 @@ function sampleRanges(b, stbl) {
|
|
|
26973
27279
|
check(sample === count);
|
|
26974
27280
|
return ranges;
|
|
26975
27281
|
}
|
|
27282
|
+
/** Each track's default sample size in fragments, from `moov`'s `mvex/trex` boxes, by track ID. */
|
|
27283
|
+
function defaultSampleSizes(moov) {
|
|
27284
|
+
const sizes = /* @__PURE__ */ new Map();
|
|
27285
|
+
const mvex = child(moov, header(moov, 0, moov.length), "mvex");
|
|
27286
|
+
for (const trex of mvex ? boxes(moov, mvex.body, mvex.end) : []) {
|
|
27287
|
+
if (trex.type !== "trex") continue;
|
|
27288
|
+
check(trex.body + 24 <= trex.end);
|
|
27289
|
+
sizes.set(u32be(moov, trex.body + 4), u32be(moov, trex.body + 16));
|
|
27290
|
+
}
|
|
27291
|
+
return sizes;
|
|
27292
|
+
}
|
|
27293
|
+
/**
|
|
27294
|
+
* The byte ranges of a fragment's samples in the file, one per track run (`trun`), from its `moof` read whole (`at` its
|
|
27295
|
+
* offset in the file): each run starts at its data offset from its track fragment's base (`tfhd`'s base data offset,
|
|
27296
|
+
* else the `moof`'s start for the first track fragment or one that says so, else where the previous one's data ended),
|
|
27297
|
+
* or where the previous run ended; its length is its samples' sizes, its own or `tfhd`'s or `trex`'s default.
|
|
27298
|
+
*/
|
|
27299
|
+
function fragmentRanges(b, at, sizes) {
|
|
27300
|
+
const ranges = [];
|
|
27301
|
+
let previous = at;
|
|
27302
|
+
for (const traf of boxes(b, header(b, 0, b.length).body, b.length)) {
|
|
27303
|
+
if (traf.type !== "traf") continue;
|
|
27304
|
+
const tfhd = child(b, traf, "tfhd");
|
|
27305
|
+
check(!!tfhd && tfhd.body + 8 <= tfhd.end);
|
|
27306
|
+
const flags = u32be(b, tfhd.body) & 16777215;
|
|
27307
|
+
let field = tfhd.body + 8, base = flags & 131072 ? at : previous;
|
|
27308
|
+
if (flags & 1) {
|
|
27309
|
+
check(field + 8 <= tfhd.end);
|
|
27310
|
+
base = u32be(b, field) * 2 ** 32 + u32be(b, field + 4);
|
|
27311
|
+
field += 8;
|
|
27312
|
+
}
|
|
27313
|
+
if (flags & 2) field += 4;
|
|
27314
|
+
if (flags & 8) field += 4;
|
|
27315
|
+
let size = sizes.get(u32be(b, tfhd.body + 4));
|
|
27316
|
+
if (flags & 16) {
|
|
27317
|
+
check(field + 4 <= tfhd.end);
|
|
27318
|
+
size = u32be(b, field);
|
|
27319
|
+
}
|
|
27320
|
+
let next = base;
|
|
27321
|
+
for (const trun of boxes(b, traf.body, traf.end)) {
|
|
27322
|
+
if (trun.type !== "trun") continue;
|
|
27323
|
+
check(trun.body + 8 <= trun.end);
|
|
27324
|
+
const runFlags = u32be(b, trun.body) & 16777215, count = u32be(b, trun.body + 4);
|
|
27325
|
+
let field = trun.body + 8;
|
|
27326
|
+
if (runFlags & 1) {
|
|
27327
|
+
check(field + 4 <= trun.end);
|
|
27328
|
+
next = base + (u32be(b, field) | 0);
|
|
27329
|
+
field += 4;
|
|
27330
|
+
}
|
|
27331
|
+
if (runFlags & 4) field += 4;
|
|
27332
|
+
const stride = [
|
|
27333
|
+
256,
|
|
27334
|
+
512,
|
|
27335
|
+
1024,
|
|
27336
|
+
2048
|
|
27337
|
+
].filter((flag) => runFlags & flag).length * 4;
|
|
27338
|
+
check(field + count * stride <= trun.end);
|
|
27339
|
+
let length = 0;
|
|
27340
|
+
if (runFlags & 512) {
|
|
27341
|
+
const sizeAt = field + (runFlags & 256 ? 4 : 0);
|
|
27342
|
+
for (let i = 0; i < count; i++) length += u32be(b, sizeAt + i * stride);
|
|
27343
|
+
} else if (count) {
|
|
27344
|
+
check(size !== void 0);
|
|
27345
|
+
length = count * size;
|
|
27346
|
+
}
|
|
27347
|
+
check(Number.isSafeInteger(next) && Number.isSafeInteger(next + length));
|
|
27348
|
+
if (length) ranges.push([next, next + length]);
|
|
27349
|
+
next += length;
|
|
27350
|
+
}
|
|
27351
|
+
previous = next;
|
|
27352
|
+
}
|
|
27353
|
+
return ranges;
|
|
27354
|
+
}
|
|
26976
27355
|
/** Whether every data reference of a track is this file (a self-contained `url ` or `alis`). */
|
|
26977
27356
|
function selfContained(b, minf) {
|
|
26978
27357
|
const dref = child(b, child(b, minf, "dinf"), "dref");
|
|
@@ -26980,18 +27359,21 @@ function selfContained(b, minf) {
|
|
|
26980
27359
|
return boxes(b, dref.body + 8, dref.end).every((entry) => entry.body + 4 <= entry.end && (b[entry.body + 3] & 1) === 1);
|
|
26981
27360
|
}
|
|
26982
27361
|
/**
|
|
26983
|
-
* `moov` with its metadata boxes emptied, read whole: whether it has a video track,
|
|
26984
|
-
* metadata tracks' samples (zeroed by the caller where they are)
|
|
27362
|
+
* `moov` with its metadata boxes emptied and its headers' times zeroed, read whole: whether it has a video track, the
|
|
27363
|
+
* byte ranges of its metadata and timecode tracks' samples (zeroed by the caller where they are), whether a metadata
|
|
27364
|
+
* track has any, and every track's sample table.
|
|
26985
27365
|
*/
|
|
26986
27366
|
function stripMoov(b) {
|
|
26987
|
-
let video = false, fragmented = false;
|
|
26988
|
-
const zeroed = [];
|
|
27367
|
+
let video = false, fragmented = false, metadata = false;
|
|
27368
|
+
const zeroed = [], tables = [];
|
|
26989
27369
|
for (const box of boxes(b, header(b, 0, b.length).body, b.length)) {
|
|
26990
27370
|
if (METADATA.has(box.type)) {
|
|
26991
27371
|
empty(b, box);
|
|
26992
27372
|
continue;
|
|
26993
27373
|
}
|
|
26994
27374
|
check(MOOV_KEEPS.has(box.type));
|
|
27375
|
+
if (SPACE.has(box.type)) b.fill(0, box.body, box.end);
|
|
27376
|
+
if (box.type === "mvhd") zeroTimes(b, box);
|
|
26995
27377
|
if (box.type === "mvex") {
|
|
26996
27378
|
fragmented = true;
|
|
26997
27379
|
emptyWithin(b, box.body, box.end);
|
|
@@ -27004,44 +27386,65 @@ function stripMoov(b) {
|
|
|
27004
27386
|
continue;
|
|
27005
27387
|
}
|
|
27006
27388
|
check(TRAK_KEEPS.has(part.type));
|
|
27389
|
+
if (part.type === "tkhd") zeroTimes(b, part);
|
|
27007
27390
|
if (part.type === "mdia") {
|
|
27008
27391
|
check(!mdia);
|
|
27009
27392
|
mdia = part;
|
|
27010
27393
|
}
|
|
27011
27394
|
}
|
|
27012
27395
|
check(!!mdia);
|
|
27013
|
-
const hdlr = child(b, mdia, "hdlr"), minf = child(b, mdia, "minf");
|
|
27396
|
+
const hdlr = child(b, mdia, "hdlr"), minf = child(b, mdia, "minf"), mdhd = child(b, mdia, "mdhd");
|
|
27014
27397
|
check(!!hdlr && !!minf && hdlr.body + 12 <= hdlr.end);
|
|
27398
|
+
if (mdhd) zeroTimes(b, mdhd);
|
|
27015
27399
|
const handler = text(b, hdlr.body + 8, 4);
|
|
27016
27400
|
const stbl = child(b, minf, "stbl");
|
|
27017
27401
|
check(!!stbl);
|
|
27402
|
+
tables.push(stbl);
|
|
27018
27403
|
if (handler === "meta") {
|
|
27019
27404
|
check(selfContained(b, minf));
|
|
27020
|
-
|
|
27021
|
-
|
|
27405
|
+
const ranges = sampleRanges(b, stbl);
|
|
27406
|
+
metadata ||= ranges.length > 0;
|
|
27407
|
+
for (const range of ranges) zeroed.push(range);
|
|
27408
|
+
} else if (handler === "tmcd" && selfContained(b, minf)) for (const range of sampleRanges(b, stbl)) zeroed.push(range);
|
|
27409
|
+
else check(HANDLERS.has(handler));
|
|
27022
27410
|
if (handler === "vide") video = true;
|
|
27411
|
+
if (VISUAL.has(handler)) zeroCompressorNames(b, stbl);
|
|
27023
27412
|
emptyWithin(b, box.body, box.end);
|
|
27024
27413
|
}
|
|
27025
27414
|
return {
|
|
27026
27415
|
video,
|
|
27027
27416
|
fragmented,
|
|
27028
|
-
|
|
27417
|
+
metadata,
|
|
27418
|
+
zeroed,
|
|
27419
|
+
tables
|
|
27029
27420
|
};
|
|
27030
27421
|
}
|
|
27031
|
-
/** A box's header in the file at `at`, read from it. */
|
|
27422
|
+
/** A whole box's header in the file at `at`, read from it; undefined where none fits (bytes after the last box). */
|
|
27032
27423
|
async function headerAt(source, at) {
|
|
27033
|
-
|
|
27424
|
+
const head = await source.read(at, 16);
|
|
27425
|
+
try {
|
|
27426
|
+
return header(head, 0, source.size, at);
|
|
27427
|
+
} catch {
|
|
27428
|
+
return;
|
|
27429
|
+
}
|
|
27034
27430
|
}
|
|
27035
27431
|
/** A box read whole, within the limit. */
|
|
27036
27432
|
async function whole(source, box) {
|
|
27037
27433
|
check(box.end - box.start <= VIDEO_METADATA_LIMITS.maxBoxBytes);
|
|
27038
|
-
const bytes =
|
|
27434
|
+
const bytes = await source.read(box.start, box.end - box.start);
|
|
27039
27435
|
check(bytes.length === box.end - box.start);
|
|
27040
27436
|
return bytes;
|
|
27041
27437
|
}
|
|
27042
|
-
/**
|
|
27043
|
-
|
|
27044
|
-
|
|
27438
|
+
/**
|
|
27439
|
+
* What a file is by its first box: a movie (`FIRST_BOXES`), a file of boxes that is one when it holds a `moov` (any
|
|
27440
|
+
* other box found at the top of a movie: a stream's segment holds none), or another file. An HEIF picture is
|
|
27441
|
+
* pictureMetadata.ts's.
|
|
27442
|
+
*/
|
|
27443
|
+
function containerOf(head, mime) {
|
|
27444
|
+
const first = head.length >= 8 ? text(head, 4, 4) : "";
|
|
27445
|
+
if (isStrippedPicture(head, mime)) return void 0;
|
|
27446
|
+
if (FIRST_BOXES.has(first)) return "movie";
|
|
27447
|
+
return TOP_KEEPS.has(first) || TOP_EMPTIED.has(first) ? "boxes" : void 0;
|
|
27045
27448
|
}
|
|
27046
27449
|
/**
|
|
27047
27450
|
* `source` as it is sent: an MP4 or QuickTime video without its metadata, made of `source`'s own bytes but for the
|
|
@@ -27049,50 +27452,97 @@ function isVideoContainer(head, mime) {
|
|
|
27049
27452
|
* Throws `NO_VIDEO_METADATA` for a video whose metadata cannot be removed; an error reading `source` as it is.
|
|
27050
27453
|
*/
|
|
27051
27454
|
async function withoutVideoMetadata(source, mime) {
|
|
27052
|
-
const
|
|
27455
|
+
const patches = await videoMetadataPatches({
|
|
27456
|
+
size: source.size,
|
|
27457
|
+
read: async (offset, length) => new Uint8Array(await source.slice(offset, offset + length).arrayBuffer())
|
|
27458
|
+
}, mime);
|
|
27459
|
+
if (!patches) return void 0;
|
|
27460
|
+
const parts = [];
|
|
27461
|
+
let at = 0;
|
|
27462
|
+
for (const patch of patches) {
|
|
27463
|
+
if (patch.start > at) parts.push(source.slice(at, patch.start));
|
|
27464
|
+
if (patch.bytes) parts.push(patch.bytes);
|
|
27465
|
+
else for (let left = patch.end - patch.start; left > 0; left -= ZEROS.length) parts.push(ZEROS.subarray(0, Math.min(left, ZEROS.length)));
|
|
27466
|
+
at = patch.end;
|
|
27467
|
+
}
|
|
27468
|
+
if (at < source.size) parts.push(source.slice(at));
|
|
27469
|
+
return new Blob(parts, { type: mime });
|
|
27470
|
+
}
|
|
27471
|
+
/**
|
|
27472
|
+
* What `withoutVideoMetadata` changes in a video read from `source` (one not held in a Blob: a file kept in storage):
|
|
27473
|
+
* the parts replaced, in order and apart, the rest of its bytes going as they are; undefined when it goes as it is.
|
|
27474
|
+
* Throws `NO_VIDEO_METADATA` as it does.
|
|
27475
|
+
*/
|
|
27476
|
+
async function videoMetadataPatches(source, mime) {
|
|
27477
|
+
const head = await source.read(0, VIDEO_METADATA_LIMITS.headBytes);
|
|
27053
27478
|
const typed = STRIPPED_TYPES.has(mime.split(";")[0].trim().toLowerCase());
|
|
27054
|
-
|
|
27479
|
+
const container = containerOf(head, mime);
|
|
27480
|
+
if (!container) {
|
|
27055
27481
|
if (typed && !isStrippedPicture(head, mime)) throw new Error(NO_VIDEO_METADATA);
|
|
27056
27482
|
return;
|
|
27057
27483
|
}
|
|
27058
27484
|
/** What replaces the file's bytes, by where it starts: a box rewritten, or zeros (no `bytes`). */
|
|
27059
27485
|
const patches = [];
|
|
27060
27486
|
const top = [];
|
|
27487
|
+
/** What goes as zeros at the top: the boxes emptied, the space's bodies, and the bytes after the last box. */
|
|
27488
|
+
const dropped = [];
|
|
27489
|
+
let trailer = false;
|
|
27061
27490
|
for (let at = 0; at < source.size;) {
|
|
27062
27491
|
check(top.length < VIDEO_METADATA_LIMITS.maxBoxes);
|
|
27063
27492
|
const box = await headerAt(source, at);
|
|
27064
|
-
if (top.length && box.type === "\0\0\0\0"
|
|
27493
|
+
if (!box || top.length && box.type === "\0\0\0\0") {
|
|
27065
27494
|
patches.push({
|
|
27066
27495
|
start: at,
|
|
27067
27496
|
end: source.size
|
|
27068
27497
|
});
|
|
27498
|
+
dropped.push([at, source.size]);
|
|
27499
|
+
trailer = !box || box.end !== source.size;
|
|
27069
27500
|
break;
|
|
27070
27501
|
}
|
|
27071
|
-
check(TOP_KEEPS.has(box.type) || TOP_EMPTIED.has(box.type));
|
|
27072
27502
|
top.push(box);
|
|
27503
|
+
if (SPACE.has(box.type)) dropped.push([box.body, box.end]);
|
|
27504
|
+
else if (!TOP_KEEPS.has(box.type)) dropped.push([box.start, box.end]);
|
|
27073
27505
|
at = box.end;
|
|
27074
27506
|
}
|
|
27075
27507
|
const moovs = top.filter((box) => box.type === "moov");
|
|
27508
|
+
if (!moovs.length && container === "boxes" && !typed) {
|
|
27509
|
+
check(!trailer && top.every((box) => TOP_KEEPS.has(box.type) || TOP_EMPTIED.has(box.type)));
|
|
27510
|
+
return;
|
|
27511
|
+
}
|
|
27076
27512
|
check(moovs.length === 1);
|
|
27077
27513
|
const moov = await whole(source, moovs[0]);
|
|
27078
|
-
const { video, fragmented, zeroed } = stripMoov(moov);
|
|
27514
|
+
const { video, fragmented, metadata, zeroed, tables } = stripMoov(moov);
|
|
27079
27515
|
if (!video && !typed) return void 0;
|
|
27080
27516
|
patches.push({
|
|
27081
27517
|
start: moovs[0].start,
|
|
27082
27518
|
end: moovs[0].end,
|
|
27083
27519
|
bytes: moov
|
|
27084
27520
|
});
|
|
27085
|
-
|
|
27521
|
+
if (dropped.length) for (const stbl of tables) {
|
|
27522
|
+
const { chunks, offsetOf } = chunkOffsets(moov, stbl);
|
|
27523
|
+
for (let i = 0; i < chunks; i++) {
|
|
27524
|
+
const offset = offsetOf(i);
|
|
27525
|
+
check(!dropped.some(([start, end]) => offset >= start && offset < end));
|
|
27526
|
+
}
|
|
27527
|
+
}
|
|
27528
|
+
check(!fragmented || !metadata);
|
|
27529
|
+
const sizes = dropped.length && fragmented ? defaultSampleSizes(moov) : void 0;
|
|
27086
27530
|
for (const box of top) if (box.type === "moof") {
|
|
27087
27531
|
const moof = await whole(source, box);
|
|
27532
|
+
if (dropped.length) for (const [start, end] of fragmentRanges(moof, box.start, sizes ?? /* @__PURE__ */ new Map())) check(!dropped.some(([from, to]) => start < to && end > from));
|
|
27088
27533
|
emptyWithin(moof, box.body - box.start, moof.length);
|
|
27089
27534
|
patches.push({
|
|
27090
27535
|
start: box.start,
|
|
27091
27536
|
end: box.end,
|
|
27092
27537
|
bytes: moof
|
|
27093
27538
|
});
|
|
27094
|
-
} else if (
|
|
27095
|
-
|
|
27539
|
+
} else if (SPACE.has(box.type)) {
|
|
27540
|
+
if (box.body < box.end) patches.push({
|
|
27541
|
+
start: box.body,
|
|
27542
|
+
end: box.end
|
|
27543
|
+
});
|
|
27544
|
+
} else if (!TOP_KEEPS.has(box.type)) {
|
|
27545
|
+
const head = await source.read(box.start, box.body - box.start);
|
|
27096
27546
|
empty(head, {
|
|
27097
27547
|
type: box.type,
|
|
27098
27548
|
start: 0,
|
|
@@ -27120,17 +27570,12 @@ async function withoutVideoMetadata(source, mime) {
|
|
|
27120
27570
|
start,
|
|
27121
27571
|
end
|
|
27122
27572
|
});
|
|
27123
|
-
const parts = [];
|
|
27124
27573
|
let at = 0;
|
|
27125
27574
|
for (const patch of patches.sort((a, b) => a.start - b.start)) {
|
|
27126
27575
|
check(patch.start >= at);
|
|
27127
|
-
if (patch.start > at) parts.push(source.slice(at, patch.start));
|
|
27128
|
-
if (patch.bytes) parts.push(patch.bytes);
|
|
27129
|
-
else for (let left = patch.end - patch.start; left > 0; left -= ZEROS.length) parts.push(ZEROS.subarray(0, Math.min(left, ZEROS.length)));
|
|
27130
27576
|
at = patch.end;
|
|
27131
27577
|
}
|
|
27132
|
-
|
|
27133
|
-
return new Blob(parts, { type: mime });
|
|
27578
|
+
return patches;
|
|
27134
27579
|
}
|
|
27135
27580
|
//#endregion
|
|
27136
27581
|
//#region ../core/src/payments.ts
|
|
@@ -30689,10 +31134,11 @@ function groupMetaNewer(a, b) {
|
|
|
30689
31134
|
/**
|
|
30690
31135
|
* The revision of the next statement signed under `epoch`: one past the held statement's under the same epoch, else 1.
|
|
30691
31136
|
* Counting on from a statement of an earlier epoch would let a former admin who signed the highest safe revision leave
|
|
30692
|
-
* every later admin with a revision no member accepts.
|
|
31137
|
+
* every later admin with a revision no member accepts. Never under `floor` (WISP 06 § Raised counters): a copy started
|
|
31138
|
+
* from older state signs above every revision the device it replaced may have signed under the same commit.
|
|
30693
31139
|
*/
|
|
30694
|
-
function nextGroupMetaRevision(before, epoch) {
|
|
30695
|
-
return before && before.e === epoch ? before.r + 1 : 1;
|
|
31140
|
+
function nextGroupMetaRevision(before, epoch, floor = 0) {
|
|
31141
|
+
return Math.max(before && before.e === epoch ? before.r + 1 : 1, Number.isSafeInteger(floor) ? floor : 0);
|
|
30696
31142
|
}
|
|
30697
31143
|
/** The statements kept from before, once `before` gives way to `after`; none for the same body signed again. */
|
|
30698
31144
|
function keepPastGroupMeta(past, before, after) {
|
|
@@ -31055,10 +31501,11 @@ var GROUP_LIMITS = {
|
|
|
31055
31501
|
secretsPerFrame: 16,
|
|
31056
31502
|
/**
|
|
31057
31503
|
* Other members' messages kept to hand on to a member who missed them (any member catches up the others): count
|
|
31058
|
-
* and total
|
|
31504
|
+
* and total bytes as `frameBytes` counts them. The oldest go first. The bytes hold 256 texts of `textBytes` (about
|
|
31505
|
+
* 22 KB each as a frame), so only messages carrying boxes beside a long text give way before their count.
|
|
31059
31506
|
*/
|
|
31060
31507
|
relay: 256,
|
|
31061
|
-
relayBytes:
|
|
31508
|
+
relayBytes: 6291456,
|
|
31062
31509
|
/** Other members' edits kept to hand on, the latest per message (WISP 902 § Edits): count and ciphertext bytes. */
|
|
31063
31510
|
relayEdits: 64,
|
|
31064
31511
|
relayEditBytes: 524288,
|
|
@@ -31090,7 +31537,9 @@ var GROUP_LIMITS = {
|
|
|
31090
31537
|
/** Between two slices, when the member's app cannot say it handled one (`handled` resolves `false`). */
|
|
31091
31538
|
catchUpPauseMs: 500,
|
|
31092
31539
|
/** A received message is in the saved state within this long (`persistSoon`): a burst of them is one save, not one each. */
|
|
31093
|
-
saveWithinMs: 1e3
|
|
31540
|
+
saveWithinMs: 1e3,
|
|
31541
|
+
/** New name records of one member taken in `syncWindowMs` (WISP 902 § Messages, "The name record"): one a rename. */
|
|
31542
|
+
namesPerMember: 4
|
|
31094
31543
|
};
|
|
31095
31544
|
/** What every member should know about who can read what, in the words the apps show. */
|
|
31096
31545
|
var GROUP_READ_NOTE = `Everyone in the group can read everything sent while they are a member. Someone removed keeps what they already received and cannot read what comes after; someone who joins later cannot read what came before. Messages go to each member; whoever was away gets what they missed from any member who has it (the group's last ${GROUP_LIMITS.relay} messages) when they meet again.`;
|
|
@@ -31098,7 +31547,7 @@ var GROUP_READ_NOTE = `Everyone in the group can read everything sent while they
|
|
|
31098
31547
|
* After my sync to a member, how long what comes from it may be its answer (a catch-up), and after each frame of the
|
|
31099
31548
|
* answer: slices go one after another, each once my app handled the last (`CATCH_UP_PAUSE_MS` at most between them).
|
|
31100
31549
|
*/
|
|
31101
|
-
var ANSWER_WINDOW_MS = 5e3;
|
|
31550
|
+
var ANSWER_WINDOW_MS$1 = 5e3;
|
|
31102
31551
|
var MAX_TEXT_BOX$1 = Math.ceil((GROUP_LIMITS.textBytes + 16) * 4 / 3) + 4;
|
|
31103
31552
|
/** Sixteen mentions as JSON, each a key and two offsets, with room to spare, sealed. */
|
|
31104
31553
|
var MAX_MENTIONS_BOX = Math.ceil((MENTION_LIMITS.count * 96 + 16) * 4 / 3) + 4;
|
|
@@ -31166,6 +31615,37 @@ var nickSigned = (f, nk) => utf8Encode(JSON.stringify([
|
|
|
31166
31615
|
nk.c
|
|
31167
31616
|
]));
|
|
31168
31617
|
var isNickBox = isSealedBox(MAX_NICK_BOX);
|
|
31618
|
+
/** A name record's box: the name as JSON (each character escaped at worst) and the signature. */
|
|
31619
|
+
var MAX_NAME_BOX = Math.ceil(1216) + 4;
|
|
31620
|
+
var nameSigned = (g, k, v, nm) => utf8Encode(JSON.stringify([
|
|
31621
|
+
"ghostly-group/1 name",
|
|
31622
|
+
g,
|
|
31623
|
+
k,
|
|
31624
|
+
v,
|
|
31625
|
+
nm
|
|
31626
|
+
]));
|
|
31627
|
+
var nameAad = (f) => JSON.stringify([
|
|
31628
|
+
"ghostly-group/1 name",
|
|
31629
|
+
f.g,
|
|
31630
|
+
f.e,
|
|
31631
|
+
f.k,
|
|
31632
|
+
f.v
|
|
31633
|
+
]);
|
|
31634
|
+
/** A name record's frame as it came, its fields checked, or null. */
|
|
31635
|
+
function readNameFrame(v) {
|
|
31636
|
+
if (!v || typeof v !== "object") return null;
|
|
31637
|
+
const f = v;
|
|
31638
|
+
if (f.t !== "group-name" || typeof f.g !== "string" || !GROUP_ID.test(f.g) || !Number.isSafeInteger(f.e) || f.e < 0 || typeof f.k !== "string" || !MEMBER_KEY.test(f.k) || !Number.isSafeInteger(f.v) || f.v <= 0 || typeof f.nn !== "string" || f.nn.length !== 32 || !B64$1.test(f.nn) || typeof f.c !== "string" || f.c.length > MAX_NAME_BOX || !B64$1.test(f.c)) return null;
|
|
31639
|
+
return {
|
|
31640
|
+
t: "group-name",
|
|
31641
|
+
g: f.g,
|
|
31642
|
+
e: f.e,
|
|
31643
|
+
k: f.k,
|
|
31644
|
+
v: f.v,
|
|
31645
|
+
nn: f.nn,
|
|
31646
|
+
c: f.c
|
|
31647
|
+
};
|
|
31648
|
+
}
|
|
31169
31649
|
var isSignature = (v) => typeof v === "string" && v.length === 86 && B64$1.test(v);
|
|
31170
31650
|
var B64$1 = /^[A-Za-z0-9_-]*$/;
|
|
31171
31651
|
var secretAad$1 = (g, e, member) => JSON.stringify([
|
|
@@ -31429,8 +31909,15 @@ var GroupSession = class {
|
|
|
31429
31909
|
asked = /* @__PURE__ */ new Map();
|
|
31430
31910
|
/** The signed leave of each member I last passed on, kept for an admin that was away (`byesHeld`). In memory only. */
|
|
31431
31911
|
byesPassed = /* @__PURE__ */ new Map();
|
|
31432
|
-
/**
|
|
31912
|
+
/**
|
|
31913
|
+
* Member → when the name I hold for it was said: its message's time, its name record's version, or the moment an edge
|
|
31914
|
+
* said it (`heardName`). In memory only; the records held start it.
|
|
31915
|
+
*/
|
|
31433
31916
|
nickAt = /* @__PURE__ */ new Map();
|
|
31917
|
+
/** The version of my name record last said to every member (`sayName`). In memory only: said again once per start. */
|
|
31918
|
+
nameSaid;
|
|
31919
|
+
/** New name records taken per member, a few a minute (`GROUP_LIMITS.namesPerMember`). In memory only. */
|
|
31920
|
+
namesTaken = /* @__PURE__ */ new Map();
|
|
31434
31921
|
queue = Promise.resolve();
|
|
31435
31922
|
/** One metadata frame that names a commit or an epoch I do not have yet: tried again when the chain moves. */
|
|
31436
31923
|
pendingMeta;
|
|
@@ -31498,6 +31985,7 @@ var GroupSession = class {
|
|
|
31498
31985
|
key: (frame) => frame.t === "group-msg" ? frameKey$1(frame) : frame.t === "group-commit" ? `commit:${frame.commit.e}` : void 0
|
|
31499
31986
|
});
|
|
31500
31987
|
this.provisional = new Set((state.provisional ?? []).slice(-GROUP_LIMITS.provisional));
|
|
31988
|
+
for (const [key, record] of Object.entries(state.names ?? {})) this.nickAt.set(key, record.v);
|
|
31501
31989
|
this.chainMovedAt = this.clock();
|
|
31502
31990
|
}
|
|
31503
31991
|
clock() {
|
|
@@ -31623,23 +32111,19 @@ var GroupSession = class {
|
|
|
31623
32111
|
}
|
|
31624
32112
|
/**
|
|
31625
32113
|
* Whether `key` could read message `messageId` (`<s>:<e>:<n>`) and still can: in the roster now, and in the roster of
|
|
31626
|
-
* its epoch or
|
|
31627
|
-
*
|
|
31628
|
-
*
|
|
31629
|
-
|
|
31630
|
-
|
|
31631
|
-
|
|
31632
|
-
const
|
|
31633
|
-
|
|
32114
|
+
* its epoch, or of an epoch it was said again under (its author was behind, `resealBehind`): `arrived`, the one its
|
|
32115
|
+
* copy reached this device under, or, for a message of mine, one I said it again under. That member read it under its
|
|
32116
|
+
* first id. Decided by the epochs a frame was sealed under, never by comparing two devices' clocks. A holder serves a
|
|
32117
|
+
* group file only to such a member (WISP 503 § Asking).
|
|
32118
|
+
*/
|
|
32119
|
+
couldRead(key, messageId, arrived) {
|
|
32120
|
+
const ref = meshMessageRef(messageId);
|
|
32121
|
+
const then = ref && this.state.chain[ref.e];
|
|
32122
|
+
if (!ref || !then || !rosterHas(this.roster, key)) return false;
|
|
31634
32123
|
if (rosterHas(then.m, key)) return true;
|
|
31635
|
-
|
|
31636
|
-
|
|
31637
|
-
|
|
31638
|
-
const c = this.state.chain[later];
|
|
31639
|
-
if (!c || c.k === "add" && c.ts > ts) break;
|
|
31640
|
-
again = c;
|
|
31641
|
-
}
|
|
31642
|
-
return !!again && rosterHas(again.m, key);
|
|
32124
|
+
const again = ref.s === this.myKey ? this.state.sent.filter((f) => f.o?.e === ref.e && f.o.n === ref.n).map((f) => f.e) : [];
|
|
32125
|
+
if (arrived !== void 0 && arrived > ref.e) again.push(arrived);
|
|
32126
|
+
return again.some((e) => rosterHas(this.state.chain[e]?.m ?? [], key));
|
|
31643
32127
|
}
|
|
31644
32128
|
role(key) {
|
|
31645
32129
|
return this.roster.find(([k]) => k === key)?.[1];
|
|
@@ -32005,11 +32489,19 @@ var GroupSession = class {
|
|
|
32005
32489
|
const epochs = Object.keys(this.state.secrets).map(Number).sort((a, b) => a - b);
|
|
32006
32490
|
for (const e of epochs.slice(0, Math.max(0, epochs.length - GROUP_LIMITS.secrets))) delete this.state.secrets[e];
|
|
32007
32491
|
}
|
|
32008
|
-
/**
|
|
32009
|
-
|
|
32492
|
+
/**
|
|
32493
|
+
* Leaves: my secrets go now; the admin removes me from the roster when it hears. `pick`: whom an admin with other
|
|
32494
|
+
* members hands the role to first, in the same turn. The role can reach me while my leave is under way (a hand-over
|
|
32495
|
+
* said at the same moment, agents#2890): without it the leave is refused, and the role would end with me.
|
|
32496
|
+
*/
|
|
32497
|
+
leave(pick) {
|
|
32010
32498
|
return this.serialize(async () => {
|
|
32011
32499
|
if (this.state.status !== "active") return;
|
|
32012
|
-
if (this.isAdmin && this.others.length)
|
|
32500
|
+
if (this.isAdmin && this.others.length) {
|
|
32501
|
+
const next = pick?.();
|
|
32502
|
+
if (!next || next === this.myKey || !rosterHas(this.roster, next)) throw new Error("Make someone else the admin before leaving");
|
|
32503
|
+
await this.commit("role", next, Date.now());
|
|
32504
|
+
}
|
|
32013
32505
|
const admin = this.admin;
|
|
32014
32506
|
this.out("left", "You left this group");
|
|
32015
32507
|
await this.persist();
|
|
@@ -32020,6 +32512,45 @@ var GroupSession = class {
|
|
|
32020
32512
|
this.hooks.changed();
|
|
32021
32513
|
});
|
|
32022
32514
|
}
|
|
32515
|
+
/**
|
|
32516
|
+
* After I left (WISP 902 § Admission and departure, "A role that reaches a leave"): the next commit of my chain, by the
|
|
32517
|
+
* admin of its tip, that keeps me in the roster. Kept, without its secret, so that my leave follows the role to whoever
|
|
32518
|
+
* holds it now, and a role that names me goes on (`handOnAfterLeave`). True when taken. The commit that takes me out
|
|
32519
|
+
* is the end of the leave, which the engine reads itself.
|
|
32520
|
+
*/
|
|
32521
|
+
followAfterLeave(raw) {
|
|
32522
|
+
return this.serialize(async () => {
|
|
32523
|
+
if (this.state.status !== "left" || !raw || typeof raw !== "object") return false;
|
|
32524
|
+
const frame = raw;
|
|
32525
|
+
if (frame.t !== "group-commit" || frame.g !== this.id) return false;
|
|
32526
|
+
const result = verifyCommit(frame.commit, this.top, this.id);
|
|
32527
|
+
if ("error" in result || !rosterHas(result.commit.m, this.myKey)) return false;
|
|
32528
|
+
this.state.chain.push(result.commit);
|
|
32529
|
+
this.chainMovedAt = this.clock();
|
|
32530
|
+
this.takeLeftMark(result.commit, frame.left);
|
|
32531
|
+
await this.persist();
|
|
32532
|
+
return true;
|
|
32533
|
+
});
|
|
32534
|
+
}
|
|
32535
|
+
/**
|
|
32536
|
+
* After I left, a chain that names me the admin (a hand-over that crossed my leave): the role goes on to
|
|
32537
|
+
* `pick(<the member who handed it to me>)` with a `role` commit of mine, as an admin's leave hands it. Its secret is
|
|
32538
|
+
* sealed to the members as any commit's, and not kept: I am gone. True when it went.
|
|
32539
|
+
*/
|
|
32540
|
+
handOnAfterLeave(pick, now = Date.now()) {
|
|
32541
|
+
return this.serialize(async () => {
|
|
32542
|
+
if (this.state.status !== "left" || this.admin !== this.myKey) return false;
|
|
32543
|
+
const next = pick(this.top.by);
|
|
32544
|
+
if (!next || next === this.myKey || !rosterHas(this.roster, next)) return false;
|
|
32545
|
+
try {
|
|
32546
|
+
await this.commit("role", next, now);
|
|
32547
|
+
} finally {
|
|
32548
|
+
this.state.secrets = {};
|
|
32549
|
+
}
|
|
32550
|
+
await this.persist();
|
|
32551
|
+
return true;
|
|
32552
|
+
});
|
|
32553
|
+
}
|
|
32023
32554
|
/** Told out of band (the admin's contact chat) that I was removed, before or instead of the commit. */
|
|
32024
32555
|
markRemoved() {
|
|
32025
32556
|
return this.serialize(async () => {
|
|
@@ -32310,7 +32841,7 @@ var GroupSession = class {
|
|
|
32310
32841
|
* member it goes to, whose frames for a while may be its answer, a catch-up (never `live`).
|
|
32311
32842
|
*/
|
|
32312
32843
|
syncFrame(ask = [], to) {
|
|
32313
|
-
if (to) this.answering.set(to, this.now() + ANSWER_WINDOW_MS);
|
|
32844
|
+
if (to) this.answering.set(to, this.now() + ANSWER_WINDOW_MS$1);
|
|
32314
32845
|
const have = {};
|
|
32315
32846
|
const miss = {};
|
|
32316
32847
|
for (const [sender, epochs] of Object.entries(this.state.seen)) {
|
|
@@ -32322,6 +32853,7 @@ var GroupSession = class {
|
|
|
32322
32853
|
}
|
|
32323
32854
|
}
|
|
32324
32855
|
const wanted = ask.filter((k) => k !== this.myKey && rosterHas(this.roster, k));
|
|
32856
|
+
this.ownName();
|
|
32325
32857
|
return {
|
|
32326
32858
|
t: "group-sync",
|
|
32327
32859
|
g: this.id,
|
|
@@ -32331,9 +32863,125 @@ var GroupSession = class {
|
|
|
32331
32863
|
secrets: this.readableEpochs,
|
|
32332
32864
|
mt: groupMetaTag(this.state.meta),
|
|
32333
32865
|
...Object.keys(miss).length ? { miss } : {},
|
|
32334
|
-
...wanted.length ? { ask: wanted } : {}
|
|
32866
|
+
...wanted.length ? { ask: wanted } : {},
|
|
32867
|
+
nt: this.namesTag()
|
|
32868
|
+
};
|
|
32869
|
+
}
|
|
32870
|
+
/** Which name records I hold, of members in the roster: a sync whose tag differs is answered with them all. */
|
|
32871
|
+
namesTag() {
|
|
32872
|
+
return sha256Hex(utf8Encode(Object.entries(this.state.names ?? {}).filter(([key]) => rosterHas(this.roster, key)).map(([key, r]) => `${key}.${r.v}`).sort().join(","))).slice(0, 16);
|
|
32873
|
+
}
|
|
32874
|
+
/**
|
|
32875
|
+
* My name record, signed again when the name my app shares changed since, and once after my counters were raised (WISP
|
|
32876
|
+
* 06 § Raised counters): a copy from older state holds the record from before any rename the device it replaces made
|
|
32877
|
+
* since, which every other member holds newer. None while my app shares no name.
|
|
32878
|
+
*/
|
|
32879
|
+
ownName() {
|
|
32880
|
+
const nm = sanitizeNick(this.hooks.nick?.());
|
|
32881
|
+
if (this.state.status !== "active" || nm === void 0) return void 0;
|
|
32882
|
+
const held = this.state.names?.[this.myKey], floor = this.seqFloor();
|
|
32883
|
+
if (held?.nm === nm && (held.nf ?? 0) >= floor) return held;
|
|
32884
|
+
const v = Math.max(this.clock(), (held?.v ?? 0) + 1);
|
|
32885
|
+
const record = {
|
|
32886
|
+
v,
|
|
32887
|
+
nm,
|
|
32888
|
+
sig: toBase64Url(sign(nameSigned(this.id, this.myKey, v, nm), this.identity.seed)),
|
|
32889
|
+
...floor ? { nf: floor } : {}
|
|
32890
|
+
};
|
|
32891
|
+
(this.state.names ??= {})[this.myKey] = record;
|
|
32892
|
+
this.persistSoon();
|
|
32893
|
+
return record;
|
|
32894
|
+
}
|
|
32895
|
+
/** `key`'s record sealed under my current epoch, or none. */
|
|
32896
|
+
nameFrameOf(key, record) {
|
|
32897
|
+
const secret = this.secret(this.epoch);
|
|
32898
|
+
if (!secret) return void 0;
|
|
32899
|
+
const header = {
|
|
32900
|
+
g: this.id,
|
|
32901
|
+
e: this.epoch,
|
|
32902
|
+
k: key,
|
|
32903
|
+
v: record.v
|
|
32904
|
+
};
|
|
32905
|
+
const { n: nn, c } = encryptText(epochKeys(secret, this.id, this.epoch).message, nameAad(header), JSON.stringify({
|
|
32906
|
+
nm: record.nm,
|
|
32907
|
+
sig: record.sig
|
|
32908
|
+
}));
|
|
32909
|
+
return {
|
|
32910
|
+
t: "group-name",
|
|
32911
|
+
...header,
|
|
32912
|
+
nn,
|
|
32913
|
+
c
|
|
32335
32914
|
};
|
|
32336
32915
|
}
|
|
32916
|
+
/** My name record, for an edge that just opened; none while my app shares no name. */
|
|
32917
|
+
nameFrame() {
|
|
32918
|
+
const record = this.ownName();
|
|
32919
|
+
return record && this.nameFrameOf(this.myKey, record);
|
|
32920
|
+
}
|
|
32921
|
+
/**
|
|
32922
|
+
* On each tick: my name record to every member, once per start and again when the name my app shares changes. Past
|
|
32923
|
+
* 16 members most have no edge with me: hubs pass it on, and whoever holds it hands it over at sync.
|
|
32924
|
+
*/
|
|
32925
|
+
sayName() {
|
|
32926
|
+
return this.serialize(async () => {
|
|
32927
|
+
const record = this.ownName();
|
|
32928
|
+
if (!record || record.v === this.nameSaid) return;
|
|
32929
|
+
const frame = this.nameFrameOf(this.myKey, record);
|
|
32930
|
+
if (!frame) return;
|
|
32931
|
+
this.nameSaid = record.v;
|
|
32932
|
+
for (const key of this.others) this.hooks.send(key, frame);
|
|
32933
|
+
});
|
|
32934
|
+
}
|
|
32935
|
+
/** Every record I hold of members in the roster but `to`, sealed under my current epoch, for a sync whose tag differs from mine. */
|
|
32936
|
+
namesFor(to, theirTag) {
|
|
32937
|
+
if (typeof theirTag !== "string") return [];
|
|
32938
|
+
this.ownName();
|
|
32939
|
+
if (theirTag === this.namesTag()) return [];
|
|
32940
|
+
return Object.entries(this.state.names ?? {}).filter(([key]) => key !== to && rosterHas(this.roster, key)).map(([key, record]) => this.nameFrameOf(key, record)).filter((f) => !!f);
|
|
32941
|
+
}
|
|
32942
|
+
/**
|
|
32943
|
+
* A member's name record, from its edge or handed on: taken when it is newer than the one I hold, both the member and
|
|
32944
|
+
* whoever handed it are in the roster, its box opens and the member's signature holds. Its name shows when it is newer
|
|
32945
|
+
* than the last one a message or an edge said. A few new ones a minute per member; passed on the first time only.
|
|
32946
|
+
*/
|
|
32947
|
+
async receiveName(from, raw) {
|
|
32948
|
+
const frame = readNameFrame(raw);
|
|
32949
|
+
if (!frame || frame.k === this.myKey || !rosterHas(this.roster, from) || !rosterHas(this.roster, frame.k) || frame.e > this.epoch) return;
|
|
32950
|
+
if (frame.v <= (this.state.names?.[frame.k]?.v ?? 0)) return;
|
|
32951
|
+
const secret = this.secret(frame.e);
|
|
32952
|
+
if (!secret) return;
|
|
32953
|
+
const plain = decryptText(epochKeys(secret, this.id, frame.e).message, nameAad(frame), frame.nn, frame.c);
|
|
32954
|
+
if (plain === null) return;
|
|
32955
|
+
let body;
|
|
32956
|
+
try {
|
|
32957
|
+
body = JSON.parse(plain);
|
|
32958
|
+
} catch {
|
|
32959
|
+
return;
|
|
32960
|
+
}
|
|
32961
|
+
if (!body || typeof body !== "object" || typeof body.nm !== "string" || sanitizeNick(body.nm) !== body.nm || !isSignature(body.sig)) return;
|
|
32962
|
+
try {
|
|
32963
|
+
if (!verify(fromBase64Url(body.sig), nameSigned(this.id, frame.k, frame.v, body.nm), publicKeyFromZ32(frame.k))) return;
|
|
32964
|
+
} catch {
|
|
32965
|
+
return;
|
|
32966
|
+
}
|
|
32967
|
+
let taken = this.namesTaken.get(frame.k);
|
|
32968
|
+
if (!taken) this.namesTaken.set(frame.k, taken = new RateWindow(GROUP_LIMITS.namesPerMember, GROUP_LIMITS.syncWindowMs, () => this.clock()));
|
|
32969
|
+
if (!taken.take()) return;
|
|
32970
|
+
(this.state.names ??= {})[frame.k] = {
|
|
32971
|
+
v: frame.v,
|
|
32972
|
+
nm: body.nm,
|
|
32973
|
+
sig: body.sig
|
|
32974
|
+
};
|
|
32975
|
+
if (frame.v > (this.nickAt.get(frame.k) ?? 0)) {
|
|
32976
|
+
this.nickAt.set(frame.k, frame.v);
|
|
32977
|
+
if (this.state.nicks[frame.k] !== body.nm) {
|
|
32978
|
+
this.state.nicks[frame.k] = body.nm;
|
|
32979
|
+
this.hooks.changed();
|
|
32980
|
+
}
|
|
32981
|
+
}
|
|
32982
|
+
this.persistSoon();
|
|
32983
|
+
this.took(frame);
|
|
32984
|
+
}
|
|
32337
32985
|
/** Sequence numbers below the highest seen that never arrived, the newest `miss` of them. */
|
|
32338
32986
|
gaps(entry) {
|
|
32339
32987
|
const got = new Set(entry.window), gaps = [];
|
|
@@ -32387,6 +33035,9 @@ var GroupSession = class {
|
|
|
32387
33035
|
case "group-bye":
|
|
32388
33036
|
await this.receiveBye(from, raw);
|
|
32389
33037
|
break;
|
|
33038
|
+
case "group-name":
|
|
33039
|
+
await this.receiveName(from, raw);
|
|
33040
|
+
break;
|
|
32390
33041
|
case "group-leave": if (this.isAdmin && this.hooks.adminWork?.() !== false && rosterHas(this.roster, from) && from !== this.myKey) await this.commitUnlessTurnUnconfirmed("remove", from, true);
|
|
32391
33042
|
}
|
|
32392
33043
|
return this.state.status === "active" ? this.passOn : this.state.status === "removed" ? this.passOn.filter((f) => f.t === "group-commit") : [];
|
|
@@ -32549,7 +33200,7 @@ var GroupSession = class {
|
|
|
32549
33200
|
}
|
|
32550
33201
|
const relayed = raw.s !== from;
|
|
32551
33202
|
const now = this.now(), answer = (this.answering.get(from) ?? 0) > now;
|
|
32552
|
-
if (answer) this.answering.set(from, now + ANSWER_WINDOW_MS);
|
|
33203
|
+
if (answer) this.answering.set(from, now + ANSWER_WINDOW_MS$1);
|
|
32553
33204
|
if (relayed && (!rosterHas(this.roster, from) || !this.handsOn(raw.s))) return;
|
|
32554
33205
|
if (this.isDuplicate(raw)) return;
|
|
32555
33206
|
const signedWhole = relayed && this.wholeSigned(raw);
|
|
@@ -32841,7 +33492,7 @@ var GroupSession = class {
|
|
|
32841
33492
|
const raw = frame.commit;
|
|
32842
33493
|
if (!raw || typeof raw !== "object" || !Number.isSafeInteger(raw.e)) return;
|
|
32843
33494
|
const e = raw.e;
|
|
32844
|
-
if (this.awaitsAnswer(from)) this.answering.set(from, this.now() + ANSWER_WINDOW_MS);
|
|
33495
|
+
if (this.awaitsAnswer(from)) this.answering.set(from, this.now() + ANSWER_WINDOW_MS$1);
|
|
32845
33496
|
if (e <= this.epoch) {
|
|
32846
33497
|
const known = this.state.chain[e];
|
|
32847
33498
|
const result = verifyCommit(raw, this.state.chain[e - 1] ?? null, this.id);
|
|
@@ -32909,6 +33560,7 @@ var GroupSession = class {
|
|
|
32909
33560
|
if (sealed) this.takeSecret(commit.e, sealed);
|
|
32910
33561
|
this.pruneSecrets();
|
|
32911
33562
|
this.pruneRelay();
|
|
33563
|
+
for (const key of Object.keys(this.state.names ?? {})) if (!rosterHas(commit.m, key)) delete this.state.names[key];
|
|
32912
33564
|
this.persistSoon();
|
|
32913
33565
|
this.hooks.changed();
|
|
32914
33566
|
await this.replayWaiting();
|
|
@@ -32996,6 +33648,7 @@ var GroupSession = class {
|
|
|
32996
33648
|
const gone = (this.state.relayEdits ?? []).filter((f) => !rosterHas(this.roster, f.s) && readable(f) && !handed?.has(editKey(f)));
|
|
32997
33649
|
answer.push(...gone.slice(-GROUP_LIMITS.handOnEdits));
|
|
32998
33650
|
answer.push(...metas.map((m) => m.frame));
|
|
33651
|
+
answer.push(...this.namesFor(from, frame.nt));
|
|
32999
33652
|
this.handOut(from, answer);
|
|
33000
33653
|
}
|
|
33001
33654
|
/**
|
|
@@ -33067,14 +33720,22 @@ var GroupSession = class {
|
|
|
33067
33720
|
}), now);
|
|
33068
33721
|
});
|
|
33069
33722
|
}
|
|
33070
|
-
/**
|
|
33071
|
-
|
|
33723
|
+
/**
|
|
33724
|
+
* Signs a body under my current commit, keeps it and sends it to every member. Inside `serialize`. Like a commit, only
|
|
33725
|
+
* with admin work on and a good turn read (WISP 06 § Forced takeover): refused otherwise, or, `quiet`, not made.
|
|
33726
|
+
*/
|
|
33727
|
+
async publishMeta(body, now, quiet = false) {
|
|
33728
|
+
const refused = this.hooks.adminWork?.() === false ? new Error(GROUP_ADMIN_OFF_ERROR) : this.hooks.adminTurn && !await this.hooks.adminTurn() ? engineError("groupTurnUnconfirmed") : void 0;
|
|
33729
|
+
if (refused) {
|
|
33730
|
+
if (quiet) return;
|
|
33731
|
+
throw refused;
|
|
33732
|
+
}
|
|
33072
33733
|
const before = this.state.meta;
|
|
33073
33734
|
const meta = signGroupMeta({
|
|
33074
33735
|
g: this.id,
|
|
33075
33736
|
e: this.epoch,
|
|
33076
33737
|
h: commitHash(this.top),
|
|
33077
|
-
r: nextGroupMetaRevision(before, this.epoch),
|
|
33738
|
+
r: nextGroupMetaRevision(before, this.epoch, this.seqFloor()),
|
|
33078
33739
|
ts: now
|
|
33079
33740
|
}, body, this.identity.seed, this.myKey);
|
|
33080
33741
|
this.state.meta = meta;
|
|
@@ -33169,7 +33830,7 @@ var GroupSession = class {
|
|
|
33169
33830
|
const pending = this.pendingMeta;
|
|
33170
33831
|
this.pendingMeta = void 0;
|
|
33171
33832
|
if (pending) await this.receiveMeta(pending.from, pending.frame);
|
|
33172
|
-
if (this.isAdmin && this.state.meta && this.state.meta.by !== this.myKey) await this.publishMeta(this.state.meta.body, this.state.meta.ts);
|
|
33833
|
+
if (this.isAdmin && this.state.meta && this.state.meta.by !== this.myKey) await this.publishMeta(this.state.meta.body, this.state.meta.ts, true);
|
|
33173
33834
|
}
|
|
33174
33835
|
async fork(reason) {
|
|
33175
33836
|
if (this.state.status !== "active") return;
|
|
@@ -33410,6 +34071,8 @@ var COMMUNITY_LIMITS = {
|
|
|
33410
34071
|
replay: 256,
|
|
33411
34072
|
/** Commits in one welcome or chain piece. */
|
|
33412
34073
|
chainPiece: 100,
|
|
34074
|
+
/** Admissions members other than the admin may commit in a row while the admin is away (`memberAdmissions`). */
|
|
34075
|
+
memberAdmissions: 32,
|
|
33413
34076
|
pendingLeaves: 64,
|
|
33414
34077
|
/** Leaves whose mark (`group-left`) is kept, and the epochs one names. */
|
|
33415
34078
|
leftMarks: 64,
|
|
@@ -33436,8 +34099,18 @@ var COMMUNITY_LIMITS = {
|
|
|
33436
34099
|
*/
|
|
33437
34100
|
catchUpSlice: 16,
|
|
33438
34101
|
/** Between two slices, when the member's app cannot say it handled one (`handled` resolves `false`). */
|
|
33439
|
-
catchUpPauseMs: 500
|
|
34102
|
+
catchUpPauseMs: 500,
|
|
34103
|
+
/**
|
|
34104
|
+
* A message a member handed on with its live mark (`lv`, WISP 903 § Relaying) is live here only when the time it says
|
|
34105
|
+
* is at most this long before my clock: the mark is that member's word, and past this it would make a catch-up ring.
|
|
34106
|
+
*/
|
|
34107
|
+
liveMarkMs: 6e5
|
|
33440
34108
|
};
|
|
34109
|
+
/**
|
|
34110
|
+
* After I send a member my sync: how long what comes over its edge may be its answer (a catch-up, never `live`). Each
|
|
34111
|
+
* frame of the answer keeps it open, since it goes a slice at a time. As a private group's.
|
|
34112
|
+
*/
|
|
34113
|
+
var ANSWER_WINDOW_MS = 5e3;
|
|
33441
34114
|
/** What every member should know about who can read what, and what the link does, in the words the apps show. */
|
|
33442
34115
|
var GROUP_READ_NOTE_COMMUNITY = `Anyone with the group's link can join, and any member can let people in. Everyone in the group can read everything sent while they are a member; someone removed cannot read what comes after, someone who joins later cannot read what came before. Members who were away get the last ${COMMUNITY_LIMITS.store} messages from whoever is there when they return.`;
|
|
33443
34116
|
/** A community group's link: `group2/<group id>/<entry key>` (web: `#/join/group2/…`). */
|
|
@@ -33503,6 +34176,23 @@ var ADMIN_ONLY = /* @__PURE__ */ new Set([
|
|
|
33503
34176
|
"rotate",
|
|
33504
34177
|
"link"
|
|
33505
34178
|
]);
|
|
34179
|
+
/**
|
|
34180
|
+
* The admissions signed by members other than `admin` on a branch (`before`: its commits, newest first) since the admin
|
|
34181
|
+
* last let someone in, rotated, changed the link or handed the role on, or since the group began. A removal or a leave
|
|
34182
|
+
* the admin commits does not count as the admin being there: its app commits leaves by itself, and a removal while
|
|
34183
|
+
* the admin clears keys let in would otherwise make room for as many more each time. An admission is a member's
|
|
34184
|
+
* right, and costs nothing: a key nobody holds is as good as anyone's, so without a bound one member could fill the
|
|
34185
|
+
* group to its cap in seconds. `COMMUNITY_LIMITS.memberAdmissions` in a row, then the admin's turn.
|
|
34186
|
+
*/
|
|
34187
|
+
function memberAdmissions(admin, before) {
|
|
34188
|
+
let n = 0;
|
|
34189
|
+
for (const c of before) {
|
|
34190
|
+
if (c.k === "create" || c.k === "role" || c.by === admin && c.k !== "remove" && c.k !== "leave") break;
|
|
34191
|
+
if (c.k === "add") n++;
|
|
34192
|
+
}
|
|
34193
|
+
return n;
|
|
34194
|
+
}
|
|
34195
|
+
var MEMBER_ADMISSIONS_ERROR = "Members can let no one else in until the admin does";
|
|
33506
34196
|
var HASH = /^[a-f0-9]{64}$/;
|
|
33507
34197
|
var TAG = /^[A-Za-z0-9_-]{43}$/;
|
|
33508
34198
|
var SIG = /^[A-Za-z0-9_-]{86}$/;
|
|
@@ -33908,6 +34598,10 @@ var CommunitySession = class CommunitySession {
|
|
|
33908
34598
|
waiting = [];
|
|
33909
34599
|
waitingBytes = 0;
|
|
33910
34600
|
asked = /* @__PURE__ */ new Map();
|
|
34601
|
+
/** Per member: until when what comes over its edge may be its answer to my sync (`ANSWER_WINDOW_MS`). In memory only. */
|
|
34602
|
+
answering = /* @__PURE__ */ new Map();
|
|
34603
|
+
/** The message frames given to `handle` that came live here (`CommunityIncomingMessage.live`): `passOn` marks them. */
|
|
34604
|
+
cameLive = /* @__PURE__ */ new WeakSet();
|
|
33911
34605
|
/** Syncs answered per member, a few a minute (`COMMUNITY_LIMITS.syncAnswers`). In memory only. */
|
|
33912
34606
|
syncsAnswered = /* @__PURE__ */ new Map();
|
|
33913
34607
|
/** Messages taken per author, a few a second (`MessagePace`). In memory only. */
|
|
@@ -33926,6 +34620,8 @@ var CommunitySession = class CommunitySession {
|
|
|
33926
34620
|
pendingMeta;
|
|
33927
34621
|
/** The store's frames the app holds with their messages (`storeKey` → message id): in memory here, not in what is saved. */
|
|
33928
34622
|
onRows = /* @__PURE__ */ new Map();
|
|
34623
|
+
/** The oldest epoch whose seen marks are kept, as of the last `pruneSeen`. In memory only. */
|
|
34624
|
+
seenFrom = -1;
|
|
33929
34625
|
/** `rows`: the frames the app holds with the messages it stored (`CommunityIncomingMessage.frame`). They join the store. */
|
|
33930
34626
|
constructor(state, hooks, rows = []) {
|
|
33931
34627
|
this.hooks = hooks;
|
|
@@ -33940,6 +34636,7 @@ var CommunitySession = class CommunitySession {
|
|
|
33940
34636
|
key: (frame) => frame.t === "group-msg" ? communityMessageId(frame.s, frame.e, frame.h, frame.n) : frame.t === "group-commit" ? `commit:${communityCommitHash(frame.commit)}` : frame.t === "group-secret" ? `secret:${frame.h}` : void 0
|
|
33941
34637
|
});
|
|
33942
34638
|
this.rebuild();
|
|
34639
|
+
this.pruneSeen();
|
|
33943
34640
|
if ((state.status === "active" || state.status === "lost") && this.bestBranch().tip !== this.topHash) this.serialize(() => this.chooseBranch());
|
|
33944
34641
|
}
|
|
33945
34642
|
static create(name, now = Date.now()) {
|
|
@@ -34427,7 +35124,7 @@ var CommunitySession = class CommunitySession {
|
|
|
34427
35124
|
this.state.chain.forEach((c, i) => counts.push((i ? counts[i - 1] : 0) + (ADMIN_ONLY.has(c.k) ? 1 : 0)));
|
|
34428
35125
|
return counts;
|
|
34429
35126
|
}
|
|
34430
|
-
/** What each of two branches holds after their common parent: whether it has an admin change,
|
|
35127
|
+
/** What each of two branches holds after their common parent: whether it has an admin change, its first commit, and its hand-overs. */
|
|
34431
35128
|
parting(a, b, counts) {
|
|
34432
35129
|
const m = Math.min(a.fork, b.fork);
|
|
34433
35130
|
let shared = 0;
|
|
@@ -34435,34 +35132,73 @@ var CommunitySession = class CommunitySession {
|
|
|
34435
35132
|
const parent = shared ? this.known.get(a.path[shared - 1]).e : this.state.chain[m].e;
|
|
34436
35133
|
const side = (x) => {
|
|
34437
35134
|
const path = x.path.slice(shared);
|
|
35135
|
+
const admin = counts[x.fork] - counts[m] > 0 || path.some((h) => ADMIN_ONLY.has(this.known.get(h).k));
|
|
34438
35136
|
return {
|
|
34439
|
-
admin
|
|
34440
|
-
first: x.fork > m ? communityCommitHash(this.state.chain[m + 1]) : path[0] ?? ""
|
|
35137
|
+
admin,
|
|
35138
|
+
first: x.fork > m ? communityCommitHash(this.state.chain[m + 1]) : path[0] ?? "",
|
|
35139
|
+
roles: !admin ? [] : [...this.state.chain.slice(m + 1, x.fork + 1).filter((c) => c.k === "role").map((c) => communityCommitHash(c)), ...path.filter((h) => this.known.get(h).k === "role")]
|
|
34441
35140
|
};
|
|
34442
35141
|
};
|
|
34443
35142
|
const sa = side(a), sb = side(b);
|
|
34444
35143
|
return {
|
|
34445
35144
|
parent,
|
|
34446
35145
|
admin: [sa.admin, sb.admin],
|
|
34447
|
-
first: [sa.first, sb.first]
|
|
35146
|
+
first: [sa.first, sb.first],
|
|
35147
|
+
roles: [sa.roles, sb.roles]
|
|
34448
35148
|
};
|
|
34449
35149
|
}
|
|
34450
35150
|
/**
|
|
34451
|
-
*
|
|
34452
|
-
*
|
|
34453
|
-
*
|
|
34454
|
-
*
|
|
35151
|
+
* Whether a hand-over (`h`, a `role`) went to a member whose leave of that admission I know on a branch that does not
|
|
35152
|
+
* hold the hand-over: signed on a view from before the leave, it would leave the role with someone gone for good (a
|
|
35153
|
+
* leave never names the admin). Not when that member signed a commit after the hand-over: it took the role while still
|
|
35154
|
+
* in, so its leave came later, and a branch from before the hand-over must not undo what it and later admins did.
|
|
35155
|
+
*/
|
|
35156
|
+
handedToLeaver(h) {
|
|
35157
|
+
const role = this.known.get(h), at = this.mainIndex.get(h), fork = this.branch(h)?.fork;
|
|
35158
|
+
if (fork === void 0 || this.signedAfter(h, role.s)) return false;
|
|
35159
|
+
return [...at === void 0 ? this.state.chain.slice(fork + 1) : [], ...this.state.side].some((c) => {
|
|
35160
|
+
if (c.k !== "leave" || c.s !== role.s) return false;
|
|
35161
|
+
const b = this.branch(communityCommitHash(c));
|
|
35162
|
+
if (!b || (at !== void 0 ? b.fork >= at : b.path.includes(h))) return false;
|
|
35163
|
+
return leaveStands(c, this.ancestry(role.p));
|
|
35164
|
+
});
|
|
35165
|
+
}
|
|
35166
|
+
/** Whether `key` signed a commit I know that comes after `h` (on the main branch past it, or on a side branch through it). */
|
|
35167
|
+
signedAfter(h, key) {
|
|
35168
|
+
const at = this.mainIndex.get(h);
|
|
35169
|
+
if (!key) return false;
|
|
35170
|
+
if (at !== void 0 && this.state.chain.slice(at + 1).some((c) => c.by === key)) return true;
|
|
35171
|
+
return this.state.side.some((c) => {
|
|
35172
|
+
if (c.by !== key) return false;
|
|
35173
|
+
const b = this.branch(communityCommitHash(c));
|
|
35174
|
+
return !!b && (at !== void 0 ? b.fork >= at : b.path.includes(h));
|
|
35175
|
+
});
|
|
35176
|
+
}
|
|
35177
|
+
/**
|
|
35178
|
+
* Is branch `a` better than branch `b`? After their common parent: first, the one that does not hand the
|
|
35179
|
+
* role to a member who left (`handedToLeaver`); then the one that keeps an admin change, however short
|
|
35180
|
+
* and however far back it parts; then one I can read over one whose tip lists me and whose secret I lack;
|
|
35181
|
+
* then the longer; then, parting within the window, the lower hash of the first commit. Both holding admin changes means the admin signed two histories: `b` stays (a fresh one
|
|
35182
|
+
* halts the group, see `receiveCommit`).
|
|
34455
35183
|
*/
|
|
34456
35184
|
better(a, b, counts) {
|
|
34457
35185
|
if (a.tip === b.tip) return false;
|
|
34458
|
-
const { parent, admin, first } = this.parting(a, b, counts);
|
|
35186
|
+
const { parent, admin, first, roles } = this.parting(a, b, counts);
|
|
35187
|
+
const toLeaver = roles.map((r) => r.some((h) => this.handedToLeaver(h)));
|
|
35188
|
+
if (toLeaver[0] !== toLeaver[1]) return toLeaver[1];
|
|
34459
35189
|
if (admin[0] !== admin[1]) return admin[0];
|
|
34460
35190
|
if (admin[0]) return false;
|
|
35191
|
+
const wa = this.awaitsSecret(a.tip), wb = this.awaitsSecret(b.tip);
|
|
35192
|
+
if (wa !== wb) return wb;
|
|
34461
35193
|
const ea = this.known.get(a.tip).e, eb = this.known.get(b.tip).e;
|
|
34462
35194
|
if (ea !== eb) return ea > eb;
|
|
34463
35195
|
if (parent < this.epoch - COMMUNITY_LIMITS.window) return false;
|
|
34464
35196
|
return first[0] < first[1];
|
|
34465
35197
|
}
|
|
35198
|
+
/** A commit whose roster lists me and whose secret I do not hold (yet). */
|
|
35199
|
+
awaitsSecret(h) {
|
|
35200
|
+
return !this.state.secrets[h] && rosterHas(this.rosterAt(h) ?? [], this.myKey);
|
|
35201
|
+
}
|
|
34466
35202
|
/**
|
|
34467
35203
|
* Takes in a commit (from a frame or from me): placed in the tree if it verifies against its
|
|
34468
35204
|
* parent, a fork if the admin signed another commit after the same parent, and then the best
|
|
@@ -34500,6 +35236,8 @@ var CommunitySession = class CommunitySession {
|
|
|
34500
35236
|
if (!confirmationMatches(epochKeys(derivedSecret(fromBase64Url(previous), untagged), this.id, result.commit.e).confirm, untagged, result.commit.c)) return false;
|
|
34501
35237
|
}
|
|
34502
35238
|
if (GROWS.has(result.commit.k) && !keepsRoom(result.commit.e, result.roster)) return false;
|
|
35239
|
+
const parentAdmin = rosterAdmin(parentRoster);
|
|
35240
|
+
if (result.commit.k === "add" && result.commit.by !== parentAdmin && memberAdmissions(parentAdmin, this.ancestry(p)) >= COMMUNITY_LIMITS.memberAdmissions) return false;
|
|
34503
35241
|
const commit = result.commit, h = communityCommitHash(commit);
|
|
34504
35242
|
const admin = rosterAdmin(parentRoster);
|
|
34505
35243
|
if (commit.by === admin) {
|
|
@@ -34517,7 +35255,7 @@ var CommunitySession = class CommunitySession {
|
|
|
34517
35255
|
if (branch && branch.path.length) {
|
|
34518
35256
|
const { admin } = this.parting(branch, this.branch(this.topHash), this.adminCounts());
|
|
34519
35257
|
if (ADMIN_ONLY.has(commit.k) && admin[1]) {
|
|
34520
|
-
if (commit.by !== this.admin) {
|
|
35258
|
+
if (commit.by !== this.admin || commit.k === "role" && this.handedToLeaver(h)) {
|
|
34521
35259
|
this.known.delete(h);
|
|
34522
35260
|
this.rosters.delete(h);
|
|
34523
35261
|
return false;
|
|
@@ -34673,6 +35411,22 @@ var CommunitySession = class CommunitySession {
|
|
|
34673
35411
|
}
|
|
34674
35412
|
}
|
|
34675
35413
|
this.pruneSecrets();
|
|
35414
|
+
this.pruneSeen();
|
|
35415
|
+
}
|
|
35416
|
+
/**
|
|
35417
|
+
* Seen marks of epochs older than the window go, every sender's, once the branch I follow moves past them: as
|
|
35418
|
+
* `markSeen` drops the sender's it marks. Before, only that sender's went, so a member who left or went quiet kept
|
|
35419
|
+
* an entry for every epoch it wrote in, and its window of numbers, for the life of the group (agents#2904). Those
|
|
35420
|
+
* within the window stay, a leaver's too: what it wrote before its leave is still taken up to its mark there.
|
|
35421
|
+
*/
|
|
35422
|
+
pruneSeen() {
|
|
35423
|
+
const from = this.epoch - COMMUNITY_LIMITS.window;
|
|
35424
|
+
if (from === this.seenFrom) return;
|
|
35425
|
+
this.seenFrom = from;
|
|
35426
|
+
for (const [sender, bySender] of Object.entries(this.state.seen)) {
|
|
35427
|
+
for (const key of Object.keys(bySender)) if (Number(key.split(":")[0]) < from) delete bySender[key];
|
|
35428
|
+
if (!Object.keys(bySender).length) delete this.state.seen[sender];
|
|
35429
|
+
}
|
|
34676
35430
|
}
|
|
34677
35431
|
pruneSecrets() {
|
|
34678
35432
|
const order = [...this.state.chain.slice(-COMMUNITY_LIMITS.window - 1), ...this.state.side].map((c) => communityCommitHash(c));
|
|
@@ -34777,6 +35531,7 @@ var CommunitySession = class CommunitySession {
|
|
|
34777
35531
|
const roster = communityRoster(this.roster, draftBase);
|
|
34778
35532
|
if (!roster || kind === "leave" && !leaveStands(draftBase, this.ancestry(parentHash))) throw new Error("This change is not allowed");
|
|
34779
35533
|
if (GROWS.has(kind) && !keepsRoom(draftBase.e, roster)) throw new Error("This group has reached its membership history limit. Create a new group.");
|
|
35534
|
+
if (kind === "add" && !this.isAdmin && memberAdmissions(this.admin, this.ancestry(parentHash)) >= COMMUNITY_LIMITS.memberAdmissions) throw new Error(MEMBER_ADMISSIONS_ERROR);
|
|
34780
35535
|
const draft = {
|
|
34781
35536
|
...draftBase,
|
|
34782
35537
|
m: rosterHash(roster)
|
|
@@ -34897,12 +35652,49 @@ var CommunitySession = class CommunitySession {
|
|
|
34897
35652
|
});
|
|
34898
35653
|
return frames;
|
|
34899
35654
|
}
|
|
34900
|
-
|
|
34901
|
-
|
|
35655
|
+
/**
|
|
35656
|
+
* Takes a member out, and with it everyone it let in who is still in, and whom those let in in turn
|
|
35657
|
+
* (`admittedThrough`): keys a member let in cost it nothing, and one by one they were the admin's to clear. A
|
|
35658
|
+
* `remove` commit each, as before (an app from before follows them), one at a time, so what arrives meanwhile is
|
|
35659
|
+
* heard, and an admission signed meanwhile by one of them is taken out too (`memberAdmissions` bounds them, as a
|
|
35660
|
+
* removal is not the admin letting anyone in). A member already out still has those it let in cleared.
|
|
35661
|
+
*/
|
|
35662
|
+
async remove(memberKey, now = Date.now()) {
|
|
35663
|
+
for (let first = true;; first = false) if (await this.serialize(async () => {
|
|
34902
35664
|
this.requireAdmin();
|
|
34903
|
-
if (
|
|
34904
|
-
|
|
34905
|
-
|
|
35665
|
+
if (memberKey === this.myKey) throw new Error("Not a member");
|
|
35666
|
+
const next = rosterHas(this.roster, memberKey) ? memberKey : this.admittedThrough(memberKey)[0];
|
|
35667
|
+
if (next === void 0) {
|
|
35668
|
+
if (first) throw new Error("Not a member");
|
|
35669
|
+
return true;
|
|
35670
|
+
}
|
|
35671
|
+
await this.commit("remove", { s: next }, now);
|
|
35672
|
+
return false;
|
|
35673
|
+
})) return;
|
|
35674
|
+
}
|
|
35675
|
+
/**
|
|
35676
|
+
* The members still in whose admission, on the main branch, `root` signed, or one of them did, and so on: in the
|
|
35677
|
+
* order they were let in. An admission signed by whoever was the admin then is the admin's, not counted: removing
|
|
35678
|
+
* a former admin does not take out everyone it let in. Never the admin nor me.
|
|
35679
|
+
*/
|
|
35680
|
+
admittedThrough(root) {
|
|
35681
|
+
const by = /* @__PURE__ */ new Map();
|
|
35682
|
+
let admin = "";
|
|
35683
|
+
for (const c of this.state.chain) if (c.k === "create") admin = c.by;
|
|
35684
|
+
else if (c.k === "role" && c.s) admin = c.s;
|
|
35685
|
+
else if (c.k === "add" && c.s) {
|
|
35686
|
+
by.delete(c.s);
|
|
35687
|
+
if (c.by !== admin) by.set(c.s, c.by);
|
|
35688
|
+
}
|
|
35689
|
+
const through = /* @__PURE__ */ new Set([root]);
|
|
35690
|
+
for (let grew = true; grew;) {
|
|
35691
|
+
grew = false;
|
|
35692
|
+
for (const [key, signer] of by) if (!through.has(key) && through.has(signer)) {
|
|
35693
|
+
through.add(key);
|
|
35694
|
+
grew = true;
|
|
35695
|
+
}
|
|
35696
|
+
}
|
|
35697
|
+
return [...by.keys()].filter((key) => key !== root && through.has(key) && key !== this.myKey && key !== this.admin && rosterHas(this.roster, key));
|
|
34906
35698
|
}
|
|
34907
35699
|
transferAdmin(memberKey, now = Date.now()) {
|
|
34908
35700
|
return this.serialize(async () => {
|
|
@@ -34996,11 +35788,21 @@ var CommunitySession = class CommunitySession {
|
|
|
34996
35788
|
return done;
|
|
34997
35789
|
});
|
|
34998
35790
|
}
|
|
34999
|
-
/**
|
|
35791
|
+
/**
|
|
35792
|
+
* Signs and says how far I had heard a member whose leave I just committed (`group-left`): per epoch, up to the first
|
|
35793
|
+
* number of my window of it I never heard, so a copy of the leaver's state cannot sign one later into the gap. A gap
|
|
35794
|
+
* at the window's bottom (a jump past it, or a counter raised by a restore) leaves the epoch out: nothing of it then.
|
|
35795
|
+
*/
|
|
35000
35796
|
markLeft(h, leaver) {
|
|
35001
35797
|
const hi = {};
|
|
35002
35798
|
const heard = Object.entries(this.state.seen[leaver] ?? {}).filter(([k]) => LEFT_EPOCH.test(k)).slice(-COMMUNITY_LIMITS.leftMarks);
|
|
35003
|
-
for (const [k, entry] of heard)
|
|
35799
|
+
for (const [k, entry] of heard) {
|
|
35800
|
+
const bottom = Math.max(0, entry.high - COMMUNITY_LIMITS.replay + 1);
|
|
35801
|
+
let n = bottom;
|
|
35802
|
+
while (n < entry.high && entry.window.includes(n)) n++;
|
|
35803
|
+
const top = n === entry.high ? n : n - 1;
|
|
35804
|
+
if (top >= bottom) hi[k] = top;
|
|
35805
|
+
}
|
|
35004
35806
|
const sig = toBase64Url(sign(leftStatement(this.id, h, hi), this.identity.seed));
|
|
35005
35807
|
this.keepLeft(h, {
|
|
35006
35808
|
hi,
|
|
@@ -35083,14 +35885,20 @@ var CommunitySession = class CommunitySession {
|
|
|
35083
35885
|
/**
|
|
35084
35886
|
* An application frame to everyone in the group (a note about a payment, a request anyone may pay): sealed to
|
|
35085
35887
|
* the epoch like text, signed, kept and caught up like text, and handed to the other members' `app` hook
|
|
35086
|
-
* instead of their history.
|
|
35888
|
+
* instead of their history. A fleeting one (`CommunitySessionHooks.fleeting`) is only said to those up now.
|
|
35087
35889
|
*/
|
|
35088
35890
|
sendApp(frame, nick, now = Date.now()) {
|
|
35089
35891
|
return this.serialize(async () => {
|
|
35090
35892
|
if (!this.isMember) return { error: this.state.statusReason ?? "You are not in this group" };
|
|
35091
35893
|
if (!isObject$2(frame) || utf8Encode(JSON.stringify(frame)).length > COMMUNITY_LIMITS.appBytes) return { error: "Too large for the group" };
|
|
35092
|
-
const
|
|
35894
|
+
const fleeting = this.hooks.fleeting?.(frame) === true;
|
|
35895
|
+
const sent = await this.sendPayload(() => ({ x: frame }), nick, now, !fleeting);
|
|
35093
35896
|
if ("error" in sent) return sent;
|
|
35897
|
+
if (fleeting) {
|
|
35898
|
+
await this.persist();
|
|
35899
|
+
this.hooks.broadcast(sent.frame);
|
|
35900
|
+
return { id: sent.id };
|
|
35901
|
+
}
|
|
35094
35902
|
this.keepLasting({
|
|
35095
35903
|
id: sent.id,
|
|
35096
35904
|
sender: this.myKey,
|
|
@@ -35173,7 +35981,7 @@ var CommunitySession = class CommunitySession {
|
|
|
35173
35981
|
});
|
|
35174
35982
|
}
|
|
35175
35983
|
/** Seals, signs and keeps a frame under the current epoch (the caller holds the queue, persists and broadcasts). */
|
|
35176
|
-
async sendPayload(body, nick, now) {
|
|
35984
|
+
async sendPayload(body, nick, now, kept = true) {
|
|
35177
35985
|
const h = this.topHash, secret = this.state.secrets[h];
|
|
35178
35986
|
if (!secret) return { error: "This epoch's key has not arrived yet. Wait for a member to catch you up." };
|
|
35179
35987
|
if (this.state.seqH !== h) {
|
|
@@ -35209,7 +36017,7 @@ var CommunitySession = class CommunitySession {
|
|
|
35209
36017
|
sig: toBase64Url(sign(messageSigned(unsigned), this.identity.seed))
|
|
35210
36018
|
};
|
|
35211
36019
|
this.markSeen(frame);
|
|
35212
|
-
this.keep(frame);
|
|
36020
|
+
if (kept) this.keep(frame);
|
|
35213
36021
|
return {
|
|
35214
36022
|
id: communityMessageId(this.myKey, header.e, header.h, n),
|
|
35215
36023
|
frame
|
|
@@ -35428,7 +36236,11 @@ var CommunitySession = class CommunitySession {
|
|
|
35428
36236
|
* what was left of the first from its start: a member back after 256 messages was handed 288 (2026-10-14).
|
|
35429
36237
|
*/
|
|
35430
36238
|
syncFrame(to) {
|
|
35431
|
-
if (to)
|
|
36239
|
+
if (to) {
|
|
36240
|
+
const now = this.hooks.clock?.() ?? Date.now();
|
|
36241
|
+
this.asked.set(to, now);
|
|
36242
|
+
this.answering.set(to, now + ANSWER_WINDOW_MS);
|
|
36243
|
+
}
|
|
35432
36244
|
const have = {};
|
|
35433
36245
|
const recent = new Set(this.state.store.map((f) => seenKey(f.e, f.h)));
|
|
35434
36246
|
for (const [sender, byKey] of Object.entries(this.state.seen)) for (const [key, entry] of Object.entries(byKey)) {
|
|
@@ -35463,6 +36275,8 @@ var CommunitySession = class CommunitySession {
|
|
|
35463
36275
|
if (!raw || typeof raw !== "object") return false;
|
|
35464
36276
|
const frame = raw;
|
|
35465
36277
|
if (frame.g !== this.id || frame.v !== 2) return false;
|
|
36278
|
+
const now = this.hooks.clock?.() ?? Date.now();
|
|
36279
|
+
if ((this.answering.get(from) ?? 0) > now) this.answering.set(from, now + ANSWER_WINDOW_MS);
|
|
35466
36280
|
if (this.state.status !== "active" && !(this.state.status === "lost" && (frame.t === "group-commit" || frame.t === "group-secret" || frame.t === "group-secrets"))) return false;
|
|
35467
36281
|
switch (frame.t) {
|
|
35468
36282
|
case "group-msg": return this.receiveMessage(from, raw);
|
|
@@ -35470,22 +36284,14 @@ var CommunitySession = class CommunitySession {
|
|
|
35470
36284
|
case "group-secret": {
|
|
35471
36285
|
if (frame.to !== this.myKey || typeof frame.h !== "string") return false;
|
|
35472
36286
|
const took = this.takeSecret(frame.h, frame.s);
|
|
35473
|
-
if (took)
|
|
35474
|
-
this.persistSoon();
|
|
35475
|
-
this.hooks.changed();
|
|
35476
|
-
await this.replayWaiting();
|
|
35477
|
-
}
|
|
36287
|
+
if (took) await this.tookSecrets();
|
|
35478
36288
|
return took;
|
|
35479
36289
|
}
|
|
35480
36290
|
case "group-secrets": {
|
|
35481
36291
|
if (!Array.isArray(frame.secrets) || frame.secrets.length > COMMUNITY_LIMITS.secrets) return false;
|
|
35482
36292
|
let took = false;
|
|
35483
36293
|
for (const entry of frame.secrets) if (entry && typeof entry.h === "string") took = this.takeSecret(entry.h, entry.s) || took;
|
|
35484
|
-
if (took)
|
|
35485
|
-
this.persistSoon();
|
|
35486
|
-
this.hooks.changed();
|
|
35487
|
-
await this.replayWaiting();
|
|
35488
|
-
}
|
|
36294
|
+
if (took) await this.tookSecrets();
|
|
35489
36295
|
return false;
|
|
35490
36296
|
}
|
|
35491
36297
|
case "group-sync":
|
|
@@ -35504,6 +36310,16 @@ var CommunitySession = class CommunitySession {
|
|
|
35504
36310
|
}
|
|
35505
36311
|
});
|
|
35506
36312
|
}
|
|
36313
|
+
/** After a secret came that confirms: a branch that waited for it may be the one to follow now (see `better`). */
|
|
36314
|
+
async tookSecrets() {
|
|
36315
|
+
if (this.bestBranch().tip !== this.topHash) {
|
|
36316
|
+
await this.chooseBranch();
|
|
36317
|
+
return;
|
|
36318
|
+
}
|
|
36319
|
+
this.persistSoon();
|
|
36320
|
+
this.hooks.changed();
|
|
36321
|
+
await this.replayWaiting();
|
|
36322
|
+
}
|
|
35507
36323
|
receiveLeave(frame) {
|
|
35508
36324
|
const s = frame.s, ls = frame.ls;
|
|
35509
36325
|
if (typeof s !== "string" || !MEMBER_KEY.test(s) || typeof ls !== "string" || !SIG.test(ls) || !rosterHas(this.roster, s)) return false;
|
|
@@ -35532,12 +36348,31 @@ var CommunitySession = class CommunitySession {
|
|
|
35532
36348
|
this.persistSoon();
|
|
35533
36349
|
return true;
|
|
35534
36350
|
}
|
|
35535
|
-
|
|
35536
|
-
|
|
36351
|
+
/**
|
|
36352
|
+
* What a hub hands on of a frame it took (`handle` said it was new): as it came, without the live mark of whoever
|
|
36353
|
+
* handed it to me, and with mine when it came live here (WISP 903 § Relaying, revision 2026-11-03). Hand it on at
|
|
36354
|
+
* once: the mark says it is passed on as it came.
|
|
36355
|
+
*/
|
|
36356
|
+
passOn(frame) {
|
|
36357
|
+
if (frame.t !== "group-msg") return frame;
|
|
36358
|
+
const { lv: _mark, ...rest } = frame;
|
|
36359
|
+
return this.cameLive.has(frame) ? {
|
|
36360
|
+
...rest,
|
|
36361
|
+
lv: this.myKey
|
|
36362
|
+
} : rest;
|
|
36363
|
+
}
|
|
36364
|
+
/** `waited`: it waited for a commit or a secret (`replayWaiting`), so it is not live. */
|
|
36365
|
+
async receiveMessage(from, input, waited = false) {
|
|
36366
|
+
if (!isMessageFrame(input)) return false;
|
|
36367
|
+
const { lv: mark, ...unmarked } = input;
|
|
36368
|
+
const raw = unmarked;
|
|
35537
36369
|
if (raw.s === this.myKey) {
|
|
35538
36370
|
this.ownFrame(raw);
|
|
35539
36371
|
return false;
|
|
35540
36372
|
}
|
|
36373
|
+
const now = this.hooks.clock?.() ?? Date.now();
|
|
36374
|
+
const live = !waited && (raw.s === from ? (this.answering.get(from) ?? 0) <= now : mark === from && rosterHas(this.roster, from) && now - raw.ts <= COMMUNITY_LIMITS.liveMarkMs);
|
|
36375
|
+
if (live) this.cameLive.add(input);
|
|
35541
36376
|
if (this.isDuplicate(raw)) return false;
|
|
35542
36377
|
if (!verify(fromBase64Url(raw.sig), messageSigned(raw), publicKeyFromZ32(raw.s))) return false;
|
|
35543
36378
|
if (!this.heardAfterOut(raw)) return false;
|
|
@@ -35609,7 +36444,7 @@ var CommunitySession = class CommunitySession {
|
|
|
35609
36444
|
this.state.nicks[raw.s] = nick;
|
|
35610
36445
|
this.hooks.changed();
|
|
35611
36446
|
}
|
|
35612
|
-
let onRow = false;
|
|
36447
|
+
let onRow = false, fleeting = false;
|
|
35613
36448
|
if (text !== void 0) {
|
|
35614
36449
|
const mentions = validMentions(parsed.m, text, false);
|
|
35615
36450
|
const reply = parsed.r === void 0 ? void 0 : readReply(parsed.r, groupReplyAuthor);
|
|
@@ -35628,7 +36463,8 @@ var CommunitySession = class CommunitySession {
|
|
|
35628
36463
|
...forwarded ? { forwarded } : {},
|
|
35629
36464
|
...card ? { card } : {},
|
|
35630
36465
|
...file ? { file } : {},
|
|
35631
|
-
frame: raw
|
|
36466
|
+
frame: raw,
|
|
36467
|
+
...live ? { live: true } : {}
|
|
35632
36468
|
});
|
|
35633
36469
|
} else if (isObject$2(parsed.x)) {
|
|
35634
36470
|
const app = {
|
|
@@ -35638,7 +36474,8 @@ var CommunitySession = class CommunitySession {
|
|
|
35638
36474
|
timestamp: raw.ts,
|
|
35639
36475
|
frame: parsed.x
|
|
35640
36476
|
};
|
|
35641
|
-
this.
|
|
36477
|
+
fleeting = this.hooks.fleeting?.(parsed.x) === true;
|
|
36478
|
+
if (!fleeting) this.keepLasting(app, raw);
|
|
35642
36479
|
await this.hooks.app?.(app);
|
|
35643
36480
|
} else {
|
|
35644
36481
|
const box = parsed.p;
|
|
@@ -35663,7 +36500,7 @@ var CommunitySession = class CommunitySession {
|
|
|
35663
36500
|
...raw,
|
|
35664
36501
|
...original
|
|
35665
36502
|
});
|
|
35666
|
-
this.keep(raw);
|
|
36503
|
+
if (!fleeting) this.keep(raw);
|
|
35667
36504
|
if (onRow === true) this.onRows.set(storeKey(raw), id);
|
|
35668
36505
|
this.persistSoon();
|
|
35669
36506
|
return true;
|
|
@@ -35734,6 +36571,7 @@ var CommunitySession = class CommunitySession {
|
|
|
35734
36571
|
const now = this.hooks.clock?.() ?? Date.now();
|
|
35735
36572
|
if (now - (this.asked.get(from) ?? 0) < 5e3) return null;
|
|
35736
36573
|
this.asked.set(from, now);
|
|
36574
|
+
this.answering.set(from, now + ANSWER_WINDOW_MS);
|
|
35737
36575
|
return this.syncFrame();
|
|
35738
36576
|
}
|
|
35739
36577
|
async replayWaiting() {
|
|
@@ -35745,7 +36583,7 @@ var CommunitySession = class CommunitySession {
|
|
|
35745
36583
|
if (!ready.length) return;
|
|
35746
36584
|
this.waiting = this.waiting.filter((w) => !ready.includes(w));
|
|
35747
36585
|
this.waitingBytes = this.waiting.reduce((sum, w) => sum + w.frame.c.length, 0);
|
|
35748
|
-
for (const { from, frame } of ready) await this.receiveMessage(from, frame);
|
|
36586
|
+
for (const { from, frame } of ready) await this.receiveMessage(from, frame, true);
|
|
35749
36587
|
}
|
|
35750
36588
|
async receiveSync(from, frame) {
|
|
35751
36589
|
if (!isZ32Key(from) || !Number.isSafeInteger(frame.e) || typeof frame.h !== "string") return;
|
|
@@ -35950,14 +36788,23 @@ var CommunitySession = class CommunitySession {
|
|
|
35950
36788
|
if (body !== this.state.meta?.body) await this.publishMeta(body, now);
|
|
35951
36789
|
});
|
|
35952
36790
|
}
|
|
35953
|
-
/**
|
|
35954
|
-
|
|
36791
|
+
/**
|
|
36792
|
+
* Signs a body under my current commit, keeps it and sends it to everyone (hubs relay it). Inside `serialize`. Like a
|
|
36793
|
+
* commit, only with admin work on and a good turn read (WISP 06 § Forced takeover): refused otherwise, or, `quiet`,
|
|
36794
|
+
* not made. Its revision is never under the floor (WISP 06 § Raised counters).
|
|
36795
|
+
*/
|
|
36796
|
+
async publishMeta(body, now, quiet = false) {
|
|
36797
|
+
const refused = !this.adminWork ? new Error(GROUP_ADMIN_OFF_ERROR) : this.hooks.adminTurn && !await this.hooks.adminTurn() ? engineError("groupTurnUnconfirmed") : void 0;
|
|
36798
|
+
if (refused) {
|
|
36799
|
+
if (quiet) return;
|
|
36800
|
+
throw refused;
|
|
36801
|
+
}
|
|
35955
36802
|
const before = this.state.meta;
|
|
35956
36803
|
const meta = signGroupMeta({
|
|
35957
36804
|
g: this.id,
|
|
35958
36805
|
e: this.epoch,
|
|
35959
36806
|
h: this.topHash,
|
|
35960
|
-
r: nextGroupMetaRevision(before, this.epoch),
|
|
36807
|
+
r: nextGroupMetaRevision(before, this.epoch, this.hooks.seqFloor?.()),
|
|
35961
36808
|
ts: now
|
|
35962
36809
|
}, body, this.identity.seed, this.myKey);
|
|
35963
36810
|
this.state.meta = meta;
|
|
@@ -36058,7 +36905,7 @@ var CommunitySession = class CommunitySession {
|
|
|
36058
36905
|
this.pendingMeta = void 0;
|
|
36059
36906
|
if (pending && await this.receiveMeta(pending.from, pending.frame)) this.hooks.relay?.(pending.frame);
|
|
36060
36907
|
const meta = this.state.meta;
|
|
36061
|
-
if (this.isAdmin && meta && (meta.by !== this.myKey || !this.mainIndex.has(meta.h))) await this.publishMeta(meta.body, meta.ts);
|
|
36908
|
+
if (this.isAdmin && meta && (meta.by !== this.myKey || !this.mainIndex.has(meta.h))) await this.publishMeta(meta.body, meta.ts, true);
|
|
36062
36909
|
}
|
|
36063
36910
|
async fork(reason) {
|
|
36064
36911
|
if (this.state.status !== "active") return;
|
|
@@ -36201,7 +37048,6 @@ var APP_STORE_LIMITS = {
|
|
|
36201
37048
|
};
|
|
36202
37049
|
var APP_STORE_KINDS = ["curated", "indexed"];
|
|
36203
37050
|
var isObject$1 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
36204
|
-
var isLine = (v, max, min = 0) => typeof v === "string" && [...v].length >= min && [...v].length <= max && !/\p{Cc}/u.test(v);
|
|
36205
37051
|
var isText = (v, max) => typeof v === "string" && [...v].length <= max && !/[^\P{Cc}\n]/u.test(v);
|
|
36206
37052
|
var isCount = (v, min) => typeof v === "number" && Number.isSafeInteger(v) && v >= min;
|
|
36207
37053
|
var fine = { ok: true };
|
|
@@ -36258,13 +37104,13 @@ function checkAppListing(value, options = {}) {
|
|
|
36258
37104
|
if (!isAppHash(value.digest)) return bad("digest");
|
|
36259
37105
|
const urls = value.urls;
|
|
36260
37106
|
if (!Array.isArray(urls) || urls.length < 1 || urls.length > APP_STORE_LIMITS.urls || !urls.every(isAppUrl)) return bad("urls");
|
|
36261
|
-
if (!
|
|
36262
|
-
if (!
|
|
37107
|
+
if (!isAppLine(value.title, APP_STORE_LIMITS.title, 1)) return bad("title");
|
|
37108
|
+
if (!isAppLine(value.tagline, APP_STORE_LIMITS.tagline, 1)) return bad("tagline");
|
|
36263
37109
|
for (const k of [
|
|
36264
37110
|
"category",
|
|
36265
37111
|
"developer",
|
|
36266
37112
|
"submitter"
|
|
36267
|
-
]) if (value[k] !== void 0 && !
|
|
37113
|
+
]) if (value[k] !== void 0 && !isAppLine(value[k], APP_STORE_LIMITS.label, 1)) return bad(k);
|
|
36268
37114
|
for (const k of ["repo", "support"]) if (value[k] !== void 0 && !isAppUrl(value[k])) return bad(k);
|
|
36269
37115
|
return fine;
|
|
36270
37116
|
}
|
|
@@ -36281,7 +37127,7 @@ function checkRemoval(value, options) {
|
|
|
36281
37127
|
"at"
|
|
36282
37128
|
], [], options);
|
|
36283
37129
|
if (!keys.ok) return keys;
|
|
36284
|
-
if (!isAppRef(value.ref) || !isAppHash(value.digest) || !
|
|
37130
|
+
if (!isAppRef(value.ref) || !isAppHash(value.digest) || !isAppLine(value.reason, APP_STORE_LIMITS.reason, 1) || !isCount(value.at, 0)) return {
|
|
36285
37131
|
ok: false,
|
|
36286
37132
|
reason: "bad-field",
|
|
36287
37133
|
detail: "removed: not {ref, digest, reason, at}"
|
|
@@ -36339,7 +37185,7 @@ function* checkAppStoreFieldsSteps(value, options = {}) {
|
|
|
36339
37185
|
detail: field
|
|
36340
37186
|
});
|
|
36341
37187
|
if (!isAppKey(value.key)) return bad("key");
|
|
36342
|
-
if (!
|
|
37188
|
+
if (!isAppLine(value.name, APP_STORE_LIMITS.name, 1)) return bad("name");
|
|
36343
37189
|
if (value.description !== void 0 && !isText(value.description, APP_STORE_LIMITS.description)) return bad("description");
|
|
36344
37190
|
if (!APP_STORE_KINDS.includes(value.kind)) return bad("kind");
|
|
36345
37191
|
if (!isCount(value.sequence, 1)) return bad("sequence");
|
|
@@ -36729,6 +37575,6 @@ function readX401SdJwtVc(text) {
|
|
|
36729
37575
|
};
|
|
36730
37576
|
}
|
|
36731
37577
|
//#endregion
|
|
36732
|
-
export { SshSigError as $, replySnippet as $a, readAppBundle as $c, identityStatement as $i, readTurnPacket as $l, GROUP_HAVE_FRAME as $n, CALL_SIGNAL_MAX_AGE_MS as $o, readPin as $r, sealHandoffPiece as $s, SEPOLIA_TEST_USDT as $t, knockIdentity as A, EDIT_RATE_WINDOW_MS as Aa, REQUEST_LIFETIME_MS as Ac, domainTxtRecord as Ai, inviteLink as Al, fedimintRequestPayload as An, rosterAdmin as Ao, pickHubs as Ar, handoffCancelFrame as As, didSignedMessages as At, verify as Au, GROUP_REACTED_FRAME as B, COMMUNITY_REACTION_FRAME as Ba, readLinkRecord as Bc, wellKnownUrl as Bi, devicePingFrame as Bl, stripPictureMetadata as Bn, DHT_POLL_INTERVALS as Bo, transferEnded as Br, handoffReleaseFrame as Bs, signingKeys as Bt, utf8Decode as Bu, communityHasFrame as C, downsamplePeaks as Ca, inboxRecord as Cc, HoldRefusedError as Ci, createDeviceInvite as Cl, homeserverWebEndpoint as Cn, shownTime as Co, doorHubs as Cr, HANDOFF_VERIFIED as Cs, DID_FILE_MAX_BYTES as Ct, newerPacket as Cu, decodeGroupEntryLink as D, voiceLevel as Da, takeRequest as Dc, DOMAIN_FILE_MAX_BYTES as Di, createChatInvite as Dl, decodeBolt11 as Dn, MEMBER_KEY as Do, mergeBeacon as Dr, handoffAttemptFailed as Ds, checkDidSignature as Dt, identityFromSeed as Du, KNOCK_TTL_MS as E, voiceDownloadName as Ea, settleRequest as Ec, readManifest as Ei, OwnInviteError as El, resolveLightningDestination as En, MAX_GROUP_CHAIN as Eo, lobbyRecords as Er, handoffAttemptAllowed as Es, checkDidJws as Et, createIdentity as Eu, GroupWakeLimiter as F, LINK_TRAILING as Fa, linkRecords as Fc, normalizeDomain as Fi, HANDOFF_CAPABILITY as Fl, NO_VIDEO_METADATA as Fn, RatchetBox as Fo, shouldBeHub as Fr, handoffEphemeral as Fs, didWebHost as Ft, fromBase64Url as Fu, GROUP_EDIT_FRAME as G, queueReaction as Ga, APP_ICON_PATH as Gc, IDENTITY_MAX_EVIDENCE as Gi, TURN_RAISE_READ_TIMEOUT_MS as Gl, PAIRED_FRAME_TOO_LARGE as Gn, presenceSeenAt as Go, sanitizeTypingStatus as Gr, readHandoffAck as Gs, encodeDidDhtDeactivated as Gt, GroupSession as H, REACTION_LIMITS as Ha, seenEntry as Hc, DHT_TEXT_CAPABILITY as Hi, seedSigner as Hl, GhostLink as Hn, PRESENCE_WINDOW as Ho, TYPING_KINDS as Hr, handoffStreamKey as Hs, strictBase64Url as Ht, groupWakeFrame as I, linkStop as Ia, makeStampPaced as Ic, recordsFromTxt as Ii, deviceEchoFrame as Il, withoutVideoMetadata as In, emptyRatchetState as Io, ChatFiles as Ir, handoffHelloFrame as Is, normalizeDid as It, isZ32Key as Iu, parseCommunityEdit as J, readReaction as Ja, appViewOf as Jc, IdentityCheckUnavailable as Ji, turnPutSummary as Jl, EngineError as Jn, parseLocalTarget as Jo, PIN_LIMITS as Jr, readHandoffHave as Js, signDidDhtPacket as Jt, GROUP_EDIT_TEXT_BYTES as K, reactionEmoji as Ka, APP_PERMISSIONS as Kc, IDENTITY_MAX_VALIDITY as Ki, TURN_SETTLE_MS as Kl, pairedMessageFits as Kn, GhostlyHttpError as Ko, typingActivity as Kr, readHandoffCancel as Ks, encodeDidDhtPacket as Kt, groupWakes as L, parseLinkPreview as La, mergeContactKnocks as Lc, recordsFromWellKnown as Li, deviceEchoNonce as Ll, NO_PICTURE_METADATA as Ln, ratchetSessionOf as Lo, FILE_LIMITS as Lr, handoffManifestFrames as Ls, parseDid as Lt, randomBytes as Lu, mergeKnocks as M, REMOVED_TEXT as Ma, knockSlotIdentity as Mc, encodeDnsQuery as Mi, ownInviteRefusal as Ml, isFederationId as Mn, verifyCommitSignature as Mo, readBeacon as Mr, handoffContextProof as Ms, didWebFile as Mt, sanitizeAvatar as Mu, readKnocks as N, RateWindow as Na, knockSlotOf as Nc, isPublicAddress as Ni, DEVICES_CAPABILITY as Nl, parseCashuRequestPayload as Nn, edgeParams as No, readBeaconHead as Nr, handoffDataFrame as Ns, didWebFileNames as Nt, sanitizeDisplayText as Nu, encodeGroupEntryLink as O, parseVideoMeta as Oa, turnOff as Oc, decodeDnsResponse as Oi, decodeInviteCode as Ol, ENDPOINT as On, commitHash as Oo, mergeLobby as Or, handoffAttemptSucceeded as Os, didGhostlyServiceEntry as Ot, identityFromSeedB64 as Ou, GROUP_WAKE_FRAME as P, dhtEditId as Pa, knockSlotRecords as Pc, nip05RootKey as Pi, ENROLL_CAPABILITY as Pl, parseFedimintRequestPayload as Pn, RATCHET_CAPABILITY as Po, readLobby as Pr, handoffDigest as Ps, didWebFileUrl as Pt, bytesEqual as Pu, SSHSIG_NAMESPACE as Q, readReply as Qa, pacer as Qc, identityRevocationValue as Qi, nextTurnPosition as Ql, GROUP_FILE_LIMITS as Qn, encodeControl as Qo, pinNumberHolds as Qr, readHandoffVerified as Qs, PaymentPreflightError as Qt, parseGroupWakeFrame as R, forwardedAgain as Ra, openRequest as Rc, recordsName as Ri, deviceKeyZ32 as Rl, PICTURE_METADATA_LIMITS as Rn, DirectPathWatch as Ro, FileUplink as Rr, handoffOfferFrame as Rs, parseDidDocument as Rt, toBase64Url as Ru, GROUP_READ_NOTE_COMMUNITY as S, baseMime as Sa, endedRequests as Sc, HoldKeys as Si, readContactLink as Sl, pubkyProofPath as Sn, receivedTimestamp as So, beaconRecords as Sr, HANDOFF_TIMINGS as Ss, DID_DOCUMENT_MAX_BYTES as St, createRelayPayload as Su, encodeCommunityLink as T, parseVoiceMeta as Ta, planKnocks as Tc, newMailbox as Ti, readDeviceInvite as Tl, requestLnurlInvoice as Tn, GROUP_MEMBER_CAP as To, lobbyKeys as Tr, filePartName as Ts, DidError as Tt, parseRelayPayload as Tu, frameBytes as U, ReactionWindow as Ua, APP_BUNDLE_LIMITS as Uc, capsDescriptors as Ui, webCryptoSigner as Ul, INVITE_TAKEN as Un, RELAY_POLL_INTERVALS as Uo, TYPING_REFRESH_MS as Ur, handoffVersions as Us, didDhtDocument as Ut, GROUP_READ_NOTE as V, GROUP_REACTION_FRAME as Va, requestRecords as Vc, CapsExchange as Vi, newDeviceSetSecret as Vl, withoutPictureMetadata as Vn, EXPECT_PEER_MS as Vo, transferStalled as Vr, handoffRetryAfter as Vs, staticDidDocument as Vt, utf8Encode as Vu, COMMUNITY_EDIT_FRAME as W, nextReactionNumber as Wa, APP_BUNDLE_MAGIC as Wc, dialDescriptors as Wi, TURN_PUT_WINDOW_MS as Wl, LIVENESS_PING_MS as Wn, WATCH_PEER_MS as Wo, TypingSender as Wr, newHandoffId as Ws, didDhtFromPublicKey as Wt, groupName as X, wireReaction as Xa, checkAppManifest as Xc, boundVerifiedIdentity as Xi, TURN_MAX as Xl, engineText as Xn, LIMITS as Xo, nextPinNumber as Xr, readHandoffPake as Xs, EVM_TEST_CHAINS as Xt, mentionsMember as Y, validReactionNumber as Ya, assembleAppBundle as Yc, IdentityExchange as Yi, TURN_LAST_SEQUENCE as Yl, engineError as Yn, webLocalFetch as Yo, mayPin as Yr, readHandoffHello as Ys, ETHEREUM_USDT as Yt, SSHSIG_MAX_ARMOR as Z, pairedReplyAuthor as Za, isAppUrl as Zc, emptyIdentityLedger as Zi, firstDeviceSetSecret as Zl, parseEngineError as Zn, decodeControl as Zo, pinIsNewer as Zr, readHandoffTurnFrame as Zs, ONCHAIN_PROVIDER as Zt, groupTypingEpoch as _, sanitizeFileName as _a, enrollProofFrame as _c, STATUS_CARD_CAPABILITY as _i, canonicalJson as _l, isPubkyProofFolder as _n, statusCardBytes as _o, mayBeHub as _r, HANDOFF_HELLO as _s, normalizeAtprotoHandle as _t, budgetRetryMs as _u, appRevocationFor as a, emptyProofLedger as aa, signTombstone as ac, relayRequest as ai, appRef as al, assertTokenUnits as an, PR_STATES as ao, readGroupFileMeta as ar, contactRtcConfig as as, verifyBitcoinMessage as at, turnStatedVerifier as au, COMMUNITY_LIMITS as b, VOICE_LIMITS as ba, verifyEnrollProof as bc, HOLD_DATED_BACK_MS as bi, createContactLink as bl, pubkyProofCapability as bn, claimedTime as bo, COMMUNITY_TOPOLOGY as br, HANDOFF_PIECE_BYTES as bs, AtprotoProofError as bt, PacketTooLargeError as bu, checkAppBeforeRun as c, automaticTransport as ca, ENROLL_GRANT as cc, vapidKeysMatch as ci, isAppKey as cl, validatePaymentTarget as cn, STATUS_CARD_LIMITS as co, readGroupWantNo as cr, signalHasVideo as cs, ATPROTO_DECLARED_SCOPE as ct, HEDGE_MISSING_MS as cu, checkAppStoreIndex as d, DHT_FILE_TOO_LARGE as da, enrollCancelFrame as dc, APP_DATA_MAX_BYTES as di, readAppRevocations as dl, SPARK_PROVIDER as dn, appCardUrl as do, SIGNAL_FRESH_MS as dr, LEGACY_SERVICES as ds, ATPROTO_PROOF_SCOPE as dt, RelaysFailedError as du, newIdentityBinding as ea, SET_ACK as ec, WAKE_CALL_INTERVAL_MS as ei, readAppBundleAsync as el, SEPOLIA_TEST_USDT_FAUCET as en, BUTTON_ID as eo, GROUP_WANT_FRAME as er, RTC_CONFIG as es, parseSshPublicKey as et, signTurnPacket as eu, readAppStore as f, DHT_MESSAGE_TTL as fa, enrollCancelReason as fc, chatAppId as fi, setAppSignatureFastPath as fl, sparkAddressKind as fn, buttonLabelClash as fo, SIGNAL_HOLD_MS as fr, serviceIdFromName as fs, atprotoDidMethod as ft, SLOW_MS as fu, GroupTypingBoard as g, formatFileSize as ga, enrollHelloFrame as gc, EDIT_CAPABILITY as gi, readImageMeta as gl, isPubkyKey as gn, sameButtonText as go, MESH_HUBS as gr, HANDOFF_HAVE as gs, isAtprotoDid as gt, traceLink as gu, GROUP_TYPING_FRAME as h, dhtFileId as ha, enrollGrantFrame as hc, BUTTONS_CAPABILITY as hi, parseImageMeta as hl, PUBKY_PROOF_MAX_BYTES as hn, checkStatusCard as ho, readGroupSignal as hr, HANDOFF_DONE as hs, checkAtprotoProofRecord as ht, setLinkTraceSink as hu, addedAppPermissions as i, PeerProofs as ia, setUpdateFrame as ic, parseWakeFrame as ii, appFingerprint as il, arkAddressPrefix as in, PR_CHECKS as io, isGroupMessageId as ir, callSignalHeardAt as is, verifySshSignature as it, turnName as iu, knockRecords as j, MAX_REMOVAL_NUMBER as ja, contactDay as jc, domainWellKnownFile as ji, inviteOwnership as jl, findEndpoint as jn, rosterHas as jo, rankHubs as jr, handoffContext as js, didWebDocumentUrl as jt, MAX_AVATAR_LENGTH as ju, entryParams as k, EDIT_BUFFER_MS as ka, ContactRequestError as kc, dnsProofName as ki, encodeInviteCode as kl, cashuRequestPayload as kn, parseGroupCommit as ko, newerHead as kr, handoffBusyFrame as ks, didJwsAlg as kt, publicKeyFromZ32 as ku, planAppUpdate as l, irohDescriptor as la, ENROLL_HELLO as lc, APP_RANGE_LIMITS as li, isAppRef as ll, walletNetworkOf as ln, TASK_STATUSES as lo, CarriedTransport as lr, emptyLinkRecords as ls, ATPROTO_FULL_SCOPE as lt, HEDGE_MS as lu, signAppStore as m, DHT_FILE_CAPABILITY as ma, enrollDoneFrame as mc, APPS_CAPABILITY as mi, signAppRevocation as ml, isBitcoinAddress as mn, cardUrl as mo, groupSignalFrame as mr, HANDOFF_CANCEL as ms, atprotoProofRkey as mt, normalizeRelayUrl as mu, readX401SdJwtVc as n, revokesIdentity as na, readSetUpdate as nc, deviceWakeRequest as ni, APP_PREFIXES as nl, USDT_PUBLIC_RPC as nn, CRON_LINE as no, fetchesByItself as nr, buildSdpFromSignal as ns, sameSshKey as nt, turnInstance as nu, appStoreDecision as o, validExternalKey as oa, verifySetUpdate as oc, wakeRequest as oi, checkAppRevokeStatement as ol, assertWholeSats as on, ROUTINE_STATES as oo, readGroupHave as or, extractParamsFromSdp as os, BitcoinAddressError as ot, turnVerifierMark as ou, readAppStoreSteps as p, peekDhtMailbox as pa, enrollDigits as pc, isAppVersion as pi, signAppObject as pl, sparkInvoiceDetails as pn, cardLine as po, SIGNAL_REPLY_MS as pr, HANDOFF_ACK as ps, atprotoProofRecord as pt, currentRelays as pu, carryMentions as q, reactionIsNewer as qa, appDigest as qc, IDENTITY_REVOCATION_LABEL as qi, classifyTurnRead as ql, pairedMessageFrame as qn, formatLocalTarget as qo, GROUP_PIN_FRAME as qr, readHandoffDone as qs, resolveDidDht as qt, sameX401HolderJwk as r, lastSharedWithMe as ra, setAckFrame as rc, newWakeToken as ri, APP_STATEMENT_LIMITS as rl, WALLET_NETWORKS as rn, ITEM_STATES as ro, groupFileFallback as rr, callRtcConfig as rs, sshSignCommand as rt, turnKeys as ru, appUpdateDecision as s, TRANSPORTS as sa, ENROLL_DONE as sc, checkPushEndpoint as si, isAppHash as sl, formatPaymentAmount as sn, RUN_RESULTS as so, readGroupWant as sr, parseCallSignal as ss, decodeAnyBitcoinAddress as st, DEFAULT_RELAYS as su, newX401HolderKey as t, receivedIdentityStatus as ta, SET_UPDATE as tc, WakeLimiter as ti, sha256Paced as tl, TEST_USDT_FAUCET_AMOUNT as tn, BUTTON_STYLES as to, GROUP_WANT_NO_FRAME as tr, answersOffer as ts, parseSshSignature as tt, signTurnRelease as tu, APP_STORE_LIMITS as u, irohRelayUrl as ua, ENROLL_PROOF as uc, isServeId as ui, readAppRevocation as ul, SPARK_NETWORKS as un, appCardId as uo, GROUP_SIGNAL_FRAME as ur, HTTP_SERVICE_PROTO as us, ATPROTO_PROOF_COLLECTION as ut, RelayTransport as uu, openGroupTyping as v, sanitizeMime as va, readEnrollGrant as vc, UPGRADE_CAPABILITY as vi, canonicalJsonBytes as vl, newPubkyProofFolder as vn, statusCardText as vo, meshHubs as vr, HANDOFF_OFFER as vs, parseAtprotoDidDocument as vt, isDiscoveryBudgetError as vu, decodeCommunityLink as w, fileMessageText as wa, newInbox as wc, isHoldUrl as wi, deviceInviteJoinerParams as wl, pubkyHomeserverOf as wn, GROUP_ADMIN_OFF_ERROR as wo, freshHubs as wr, NO_ATTEMPTS as ws, DID_JWS_MAX_LENGTH as wt, openRelayPayload as wu, CommunitySession as x, VOICE_METER as xa, clearMissed as xc, HOLD_LIMITS as xi, encodeContactLink as xl, pubkyProofFile as xn, heardTime as xo, beaconKeys as xr, HANDOFF_REQUEST as xs, verifyAtprotoRecordProof as xt, RELAY_PAYLOAD_MAX_BYTES as xu, sealGroupTyping as y, PLAYABLE_AUDIO as ya, readEnrollHello as yc, HOLD_CAPABILITY as yi, readCanonicalJson as yl, normalizePubkyKey as yn, arrivalKey as yo, pickMeshHubs as yr, HANDOFF_PAKE as ys, shortAtprotoDid as yt, withRequestOptions as yu, GROUP_LIMITS as z, readForwarded as za, readKnockSlot as zc, txtValue as zi, deviceLinkPairing as zl, isStrippedPicture as zn, AWAITING_PEER_MS as zo, sentWhole as zr, handoffPakeFrame as zs, parseDidSignaturePaste as zt, toZ32 as zu };
|
|
37578
|
+
export { SSHSIG_NAMESPACE as $, wireReaction as $a, appViewOf as $c, emptyIdentityLedger as $i, TURN_SETTLE_MS as $l, parseEngineError as $n, LIMITS as $o, pinIsNewer as $r, readHandoffPake as $s, PaymentPreflightError as $t, knockIdentity as A, voiceLevel as Aa, takeRequest as Ac, decodeDnsResponse as Ai, createDeviceInvite as Al, cashuRequestPayload as An, MEMBER_KEY as Ao, mergeLobby as Ar, handoffAttemptFailed as As, didJwsAlg as At, newerPacket as Au, GROUP_REACTED_FRAME as B, parseLinkPreview as Ba, linkRecords as Bc, recordsName as Bi, DEVICES_CAPABILITY as Bl, PICTURE_METADATA_LIMITS as Bn, ratchetSessionOf as Bo, FileUplink as Br, handoffManifestFrames as Bs, parseDidSignaturePaste as Bt, sanitizeDisplayText as Bu, communityHasFrame as C, VOICE_LIMITS as Ca, verifyEnrollProof as Cc, HOLD_LIMITS as Ci, readImageMeta as Cl, pubkyProofPath as Cn, claimedTime as Co, beaconKeys as Cr, HANDOFF_PIECE_BYTES as Cs, DID_DOCUMENT_MAX_BYTES as Ct, traceLink as Cu, decodeGroupEntryLink as D, fileMessageText as Da, newInbox as Dc, newMailbox as Di, createContactLink as Dl, resolveLightningDestination as Dn, GROUP_ADMIN_OFF_ERROR as Do, lobbyKeys as Dr, NO_ATTEMPTS as Ds, checkDidJws as Dt, PacketTooLargeError as Du, KNOCK_TTL_MS as E, downsamplePeaks as Ea, inboxRecord as Ec, isHoldUrl as Ei, readCanonicalJson as El, requestLnurlInvoice as En, shownTime as Eo, freshHubs as Er, HANDOFF_VERIFIED as Es, DidError as Et, withRequestOptions as Eu, GroupWakeLimiter as F, REMOVED_TEXT as Fa, contactAskerHolds as Fc, isPublicAddress as Fi, decodeInviteCode as Fl, parseFedimintRequestPayload as Fn, verifyCommitSignature as Fo, readBeaconHead as Fr, handoffContextProof as Fs, didWebFileUrl as Ft, identityFromSeedB64 as Fu, GROUP_EDIT_FRAME as G, REACTION_LIMITS as Ga, readLinkRecord as Gc, capsDescriptors as Gi, deviceKeyZ32 as Gl, INVITE_TAKEN as Gn, PRESENCE_WINDOW as Go, TYPING_REFRESH_MS as Gr, handoffStreamKey as Gs, didDhtFromPublicKey as Gt, toBase64Url as Gu, GroupSession as H, readForwarded as Ha, mergeContactKnocks as Hc, wellKnownUrl as Hi, HANDOFF_CAPABILITY as Hl, stripPictureMetadata as Hn, AWAITING_PEER_MS as Ho, transferEnded as Hr, handoffPakeFrame as Hs, staticDidDocument as Ht, fromBase64Url as Hu, groupWakeFrame as I, RateWindow as Ia, contactDay as Ic, nip05RootKey as Ii, encodeInviteCode as Il, NO_VIDEO_METADATA as In, edgeParams as Io, readLobby as Ir, handoffDataFrame as Is, didWebHost as It, publicKeyFromZ32 as Iu, meshMessageRef as J, queueReaction as Ja, APP_BUNDLE_LIMITS as Jc, IDENTITY_MAX_VALIDITY as Ji, newDeviceSetSecret as Jl, pairedMessageFits as Jn, presenceSeenAt as Jo, typingActivity as Jr, readHandoffAck as Js, resolveDidDht as Jt, utf8Encode as Ju, GROUP_EDIT_TEXT_BYTES as K, ReactionWindow as Ka, requestRecords as Kc, dialDescriptors as Ki, deviceLinkPairing as Kl, LIVENESS_PING_MS as Kn, RELAY_POLL_INTERVALS as Ko, TypingSender as Kr, handoffVersions as Ks, encodeDidDhtDeactivated as Kt, toZ32 as Ku, groupWakes as L, dhtEditId as La, knockSlotIdentity as Lc, normalizeDomain as Li, inviteLink as Ll, videoMetadataPatches as Ln, RATCHET_CAPABILITY as Lo, shouldBeHub as Lr, handoffDigest as Ls, normalizeDid as Lt, verify as Lu, mergeKnocks as M, EDIT_BUFFER_MS as Ma, ContactRequestError as Mc, domainTxtRecord as Mi, readDeviceInvite as Ml, findEndpoint as Mn, parseGroupCommit as Mo, pickHubs as Mr, handoffBusyFrame as Ms, didWebDocumentUrl as Mt, parseRelayPayload as Mu, readKnocks as N, EDIT_RATE_WINDOW_MS as Na, REQUEST_LIFETIME_MS as Nc, domainWellKnownFile as Ni, OwnInviteError as Nl, isFederationId as Nn, rosterAdmin as No, rankHubs as Nr, handoffCancelFrame as Ns, didWebFile as Nt, createIdentity as Nu, encodeGroupEntryLink as O, parseVoiceMeta as Oa, planKnocks as Oc, readManifest as Oi, encodeContactLink as Ol, decodeBolt11 as On, GROUP_MEMBER_CAP as Oo, lobbyRecords as Or, filePartName as Os, checkDidSignature as Ot, RELAY_PAYLOAD_MAX_BYTES as Ou, GROUP_WAKE_FRAME as P, MAX_REMOVAL_NUMBER as Pa, contactAskerFrame as Pc, encodeDnsQuery as Pi, createChatInvite as Pl, parseCashuRequestPayload as Pn, rosterHas as Po, readBeacon as Pr, handoffContext as Ps, didWebFileNames as Pt, identityFromSeed as Pu, SSHSIG_MAX_ARMOR as Q, validReactionNumber as Qa, appDigest as Qc, boundVerifiedIdentity as Qi, TURN_RAISE_READ_TIMEOUT_MS as Ql, engineText as Qn, webLocalFetch as Qo, nextPinNumber as Qr, readHandoffHello as Qs, ONCHAIN_PROVIDER as Qt, parseGroupWakeFrame as R, LINK_TRAILING as Ra, knockSlotOf as Rc, recordsFromTxt as Ri, inviteOwnership as Rl, withoutVideoMetadata as Rn, RatchetBox as Ro, ChatFiles as Rr, handoffEphemeral as Rs, parseDid as Rt, MAX_AVATAR_LENGTH as Ru, GROUP_READ_NOTE_COMMUNITY as S, PLAYABLE_AUDIO as Sa, readEnrollHello as Sc, HOLD_DATED_BACK_MS as Si, parseImageMeta as Sl, pubkyProofFile as Sn, arrivalKey as So, COMMUNITY_TOPOLOGY as Sr, HANDOFF_PAKE as Ss, verifyAtprotoRecordProof as St, setLinkTraceSink as Su, encodeCommunityLink as T, baseMime as Ta, endedRequests as Tc, HoldRefusedError as Ti, canonicalJsonBytes as Tl, pubkyHomeserverOf as Tn, receivedTimestamp as To, doorHubs as Tr, HANDOFF_TIMINGS as Ts, DID_JWS_MAX_LENGTH as Tt, isDiscoveryBudgetError as Tu, frameBytes as U, COMMUNITY_REACTION_FRAME as Ua, openRequest as Uc, CapsExchange as Ui, deviceEchoFrame as Ul, withoutPictureMetadata as Un, DHT_POLL_INTERVALS as Uo, transferStalled as Ur, handoffReleaseFrame as Us, strictBase64Url as Ut, isZ32Key as Uu, GROUP_READ_NOTE as V, forwardedAgain as Va, makeStampPaced as Vc, txtValue as Vi, ENROLL_CAPABILITY as Vl, isStrippedPicture as Vn, DirectPathWatch as Vo, sentWhole as Vr, handoffOfferFrame as Vs, signingKeys as Vt, bytesEqual as Vu, COMMUNITY_EDIT_FRAME as W, GROUP_REACTION_FRAME as Wa, readKnockSlot as Wc, DHT_TEXT_CAPABILITY as Wi, deviceEchoNonce as Wl, GhostLink as Wn, EXPECT_PEER_MS as Wo, TYPING_KINDS as Wr, handoffRetryAfter as Ws, didDhtDocument as Wt, randomBytes as Wu, mentionsMember as X, reactionIsNewer as Xa, APP_ICON_PATH as Xc, IdentityCheckUnavailable as Xi, webCryptoSigner as Xl, EngineError as Xn, formatLocalTarget as Xo, PIN_LIMITS as Xr, readHandoffDone as Xs, ETHEREUM_USDT as Xt, parseCommunityEdit as Y, reactionEmoji as Ya, APP_BUNDLE_MAGIC as Yc, IDENTITY_REVOCATION_LABEL as Yi, seedSigner as Yl, pairedMessageFrame as Yn, GhostlyHttpError as Yo, GROUP_PIN_FRAME as Yr, readHandoffCancel as Ys, signDidDhtPacket as Yt, groupName as Z, readReaction as Za, APP_PERMISSIONS as Zc, IdentityExchange as Zi, TURN_PUT_WINDOW_MS as Zl, engineError as Zn, parseLocalTarget as Zo, mayPin as Zr, readHandoffHave as Zs, EVM_TEST_CHAINS as Zt, groupTypingEpoch as _, DHT_FILE_CAPABILITY as _a, enrollDoneFrame as _c, BUTTONS_CAPABILITY as _i, readAppRevocationShape as _l, isPubkyKey as _n, cardUrl as _o, readGroupSignal as _r, HANDOFF_CANCEL as _s, isAtprotoDid as _t, RelayTransport as _u, appRevocationFor as a, revokesIdentity as aa, readSetUpdate as ac, newWakeToken as ai, readAppBundleAsync as al, arkAddressPrefix as an, CRON_LINE as ao, groupFileFallback as ar, buildSdpFromSignal as as, verifySshSignature as at, nextTurnPosition as au, COMMUNITY_LIMITS as b, sanitizeFileName as ba, enrollProofFrame as bc, UPGRADE_CAPABILITY as bi, signAppObject as bl, normalizePubkyKey as bn, statusCardBytes as bo, meshHubs as br, HANDOFF_HELLO as bs, shortAtprotoDid as bt, currentRelays as bu, checkAppBeforeRun as c, emptyProofLedger as ca, signTombstone as cc, wakeRequest as ci, APP_STATEMENT_LIMITS as cl, formatPaymentAmount as cn, PR_STATES as co, readGroupHave as cr, contactRtcConfig as cs, decodeAnyBitcoinAddress as ct, signTurnRelease as cu, checkAppStoreIndex as d, automaticTransport as da, ENROLL_GRANT as dc, APP_RANGE_LIMITS as di, appRefPublisher as dl, SPARK_NETWORKS as dn, STATUS_CARD_LIMITS as do, CarriedTransport as dr, signalHasVideo as ds, ATPROTO_PROOF_COLLECTION as dt, turnName as du, identityRevocationValue as ea, readHandoffTurnFrame as ec, pinNumberHolds as ei, assembleAppBundle as el, SEPOLIA_TEST_USDT as en, pairedReplyAuthor as eo, GROUP_FILE_LIMITS as er, decodeControl as es, SshSigError as et, classifyTurnRead as eu, readAppStore as f, irohDescriptor as fa, ENROLL_HELLO as fc, isServeId as fi, checkAppRevokeStatement as fl, SPARK_PROVIDER as fn, TASK_STATUSES as fo, GROUP_SIGNAL_FRAME as fr, emptyLinkRecords as fs, ATPROTO_PROOF_SCOPE as ft, turnStatedVerifier as fu, GroupTypingBoard as g, peekDhtMailbox as ga, enrollDigits as gc, APPS_CAPABILITY as gi, readAppRevocation as gl, PUBKY_PROOF_MAX_BYTES as gn, cardLine as go, groupSignalFrame as gr, HANDOFF_ACK as gs, checkAtprotoProofRecord as gt, HEDGE_MS as gu, GROUP_TYPING_FRAME as h, DHT_MESSAGE_TTL as ha, enrollCancelReason as hc, isAppVersion as hi, isAppRef as hl, isBitcoinAddress as hn, buttonLabelClash as ho, SIGNAL_REPLY_MS as hr, serviceIdFromName as hs, atprotoProofRkey as ht, HEDGE_MISSING_MS as hu, addedAppPermissions as i, receivedIdentityStatus as ia, SET_UPDATE as ic, deviceWakeRequest as ii, readAppBundle as il, WALLET_NETWORKS as in, BUTTON_STYLES as io, fetchesByItself as ir, answersOffer as is, sshSignCommand as it, firstDeviceSetSecret as iu, knockRecords as j, parseVideoMeta as ja, turnOff as jc, dnsProofName as ji, deviceInviteJoinerParams as jl, fedimintRequestPayload as jn, commitHash as jo, newerHead as jr, handoffAttemptSucceeded as js, didSignedMessages as jt, openRelayPayload as ju, entryParams as k, voiceDownloadName as ka, settleRequest as kc, DOMAIN_FILE_MAX_BYTES as ki, readContactLink as kl, ENDPOINT as kn, MAX_GROUP_CHAIN as ko, mergeBeacon as kr, handoffAttemptAllowed as ks, didGhostlyServiceEntry as kt, createRelayPayload as ku, planAppUpdate as l, validExternalKey as la, verifySetUpdate as lc, checkPushEndpoint as li, appFingerprint as ll, validatePaymentTarget as ln, ROUTINE_STATES as lo, readGroupWant as lr, extractParamsFromSdp as ls, ATPROTO_DECLARED_SCOPE as lt, turnInstance as lu, signAppStore as m, DHT_FILE_TOO_LARGE as ma, enrollCancelFrame as mc, chatAppId as mi, isAppKey as ml, sparkInvoiceDetails as mn, appCardUrl as mo, SIGNAL_HOLD_MS as mr, LEGACY_SERVICES as ms, atprotoProofRecord as mt, DEFAULT_RELAYS as mu, readX401SdJwtVc as n, isIdentityBinding as na, sealHandoffPiece as nc, WAKE_CALL_INTERVAL_MS as ni, isAppUrl as nl, TEST_USDT_FAUCET_AMOUNT as nn, replySnippet as no, GROUP_WANT_FRAME as nr, CALL_SIGNAL_MAX_AGE_MS as ns, parseSshSignature as nt, TURN_LAST_SEQUENCE as nu, appStoreDecision as o, lastSharedWithMe as oa, setAckFrame as oc, parseWakeFrame as oi, sha256Paced as ol, assertTokenUnits as on, ITEM_STATES as oo, isGroupMessageId as or, callRtcConfig as os, verifyBitcoinMessage as ot, readTurnPacket as ou, readAppStoreSteps as p, irohRelayUrl as pa, ENROLL_PROOF as pc, APP_DATA_MAX_BYTES as pi, isAppHash as pl, sparkAddressKind as pn, appCardId as po, SIGNAL_FRESH_MS as pr, HTTP_SERVICE_PROTO as ps, atprotoDidMethod as pt, turnVerifierMark as pu, carryMentions as q, nextReactionNumber as qa, seenEntry as qc, IDENTITY_MAX_EVIDENCE as qi, devicePingFrame as ql, PAIRED_FRAME_TOO_LARGE as qn, WATCH_PEER_MS as qo, sanitizeTypingStatus as qr, newHandoffId as qs, encodeDidDhtPacket as qt, utf8Decode as qu, sameX401HolderJwk as r, newIdentityBinding as ra, SET_ACK as rc, WakeLimiter as ri, pacer as rl, USDT_PUBLIC_RPC as rn, BUTTON_ID as ro, GROUP_WANT_NO_FRAME as rr, RTC_CONFIG as rs, sameSshKey as rt, TURN_MAX as ru, appUpdateDecision as s, PeerProofs as sa, setUpdateFrame as sc, relayRequest as si, APP_PREFIXES as sl, assertWholeSats as sn, PR_CHECKS as so, readGroupFileMeta as sr, callSignalHeardAt as ss, BitcoinAddressError as st, signTurnPacket as su, newX401HolderKey as t, identityStatement as ta, readHandoffVerified as tc, readPin as ti, checkAppManifest as tl, SEPOLIA_TEST_USDT_FAUCET as tn, readReply as to, GROUP_HAVE_FRAME as tr, encodeControl as ts, parseSshPublicKey as tt, turnPutSummary as tu, APP_STORE_LIMITS as u, TRANSPORTS as ua, ENROLL_DONE as uc, vapidKeysMatch as ui, appRef as ul, walletNetworkOf as un, RUN_RESULTS as uo, readGroupWantNo as ur, parseCallSignal as us, ATPROTO_FULL_SCOPE as ut, turnKeys as uu, openGroupTyping as v, dhtFileId as va, enrollGrantFrame as vc, EDIT_CAPABILITY as vi, readAppRevocations as vl, isPubkyProofFolder as vn, checkStatusCard as vo, MESH_HUBS as vr, HANDOFF_DONE as vs, normalizeAtprotoHandle as vt, RelaysFailedError as vu, decodeCommunityLink as w, VOICE_METER as wa, clearMissed as wc, HoldKeys as wi, canonicalJson as wl, homeserverWebEndpoint as wn, heardTime as wo, beaconRecords as wr, HANDOFF_REQUEST as ws, DID_FILE_MAX_BYTES as wt, budgetRetryMs as wu, CommunitySession as x, sanitizeMime as xa, readEnrollGrant as xc, HOLD_CAPABILITY as xi, signAppRevocation as xl, pubkyProofCapability as xn, statusCardText as xo, pickMeshHubs as xr, HANDOFF_OFFER as xs, AtprotoProofError as xt, normalizeRelayUrl as xu, sealGroupTyping as y, formatFileSize as ya, enrollHelloFrame as yc, STATUS_CARD_CAPABILITY as yi, setAppSignatureFastPath as yl, newPubkyProofFolder as yn, sameButtonText as yo, mayBeHub as yr, HANDOFF_HAVE as ys, parseAtprotoDidDocument as yt, SLOW_MS as yu, GROUP_LIMITS as z, linkStop as za, knockSlotRecords as zc, recordsFromWellKnown as zi, ownInviteRefusal as zl, NO_PICTURE_METADATA as zn, emptyRatchetState as zo, FILE_LIMITS as zr, handoffHelloFrame as zs, parseDidDocument as zt, sanitizeAvatar as zu };
|
|
36733
37579
|
|
|
36734
|
-
//# sourceMappingURL=src-
|
|
37580
|
+
//# sourceMappingURL=src-DZagapGt.js.map
|