@ghostlytools/cli 1.4.5 → 1.5.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 +14 -7
- package/dist/assets/{api-XX7bbtTZ.js → api-C_IHKsrl.js} +2 -2
- package/dist/assets/{api-D70he3-A.js → api-ClHM_G5A.js} +87 -60
- package/dist/assets/api-ClHM_G5A.js.map +1 -0
- package/dist/assets/{apiKit-CpsEqF-1.js → apiKit-gS-yfb25.js} +2 -2
- package/dist/assets/{apiKit-CpsEqF-1.js.map → apiKit-gS-yfb25.js.map} +1 -1
- package/dist/assets/{apps-VA8W_YCQ.js → apps-DP8pElH-.js} +2 -2
- package/dist/assets/{apps-VA8W_YCQ.js.map → apps-DP8pElH-.js.map} +1 -1
- package/dist/assets/{apps-DVMnlwGF.js → apps-DyihkNO-.js} +1 -1
- package/dist/assets/{arkade-DxgW4-dK.js → arkade-GzJoov-w.js} +2 -2
- package/dist/assets/{arkade-DxgW4-dK.js.map → arkade-GzJoov-w.js.map} +1 -1
- package/dist/assets/{backup-BRTH1y3-.js → backup-A_C4hYNO.js} +1 -1
- package/dist/assets/{backup-c9xvXgCS.js → backup-DKDXkaS1.js} +6 -6
- package/dist/assets/{backup-c9xvXgCS.js.map → backup-DKDXkaS1.js.map} +1 -1
- package/dist/assets/bark_ffi_wasm_bg-EY2uc0Bx.js.map +1 -1
- package/dist/assets/{blobFiles-B0rNnHlO.js → blobFiles-1wUBd8ZD.js} +3 -3
- package/dist/assets/{blobFiles-B0rNnHlO.js.map → blobFiles-1wUBd8ZD.js.map} +1 -1
- package/dist/assets/{buttons-D31LBftz.js → buttons-BDw8cqDq.js} +3 -3
- package/dist/assets/{buttons-D31LBftz.js.map → buttons-BDw8cqDq.js.map} +1 -1
- package/dist/assets/buttons-CNkxiN2c.js +2 -0
- package/dist/assets/daemonProof-CWTVNUmr.js +254 -0
- package/dist/assets/daemonProof-CWTVNUmr.js.map +1 -0
- package/dist/assets/{envelope-hAl4pblf.js → envelope-DEvU5FA9.js} +2 -2
- package/dist/assets/{envelope-hAl4pblf.js.map → envelope-DEvU5FA9.js.map} +1 -1
- package/dist/assets/fedimint_client_wasm_bg-BtHHlFpp.js.map +1 -1
- package/dist/assets/{fileBytes-B-fqGdEd.js → fileBytes-B8eTZfAT.js} +3 -3
- package/dist/assets/{fileBytes-B-fqGdEd.js.map → fileBytes-B8eTZfAT.js.map} +1 -1
- package/dist/assets/{fileBytes-C2jycN_7.js → fileBytes-gTd_8l-P.js} +1 -1
- package/dist/assets/{fileBytes-D6fqFQEX.js → fileBytes-uRqLyxa0.js} +2 -2
- package/dist/assets/{fileBytes-D6fqFQEX.js.map → fileBytes-uRqLyxa0.js.map} +1 -1
- package/dist/assets/{fileBytesIdb-_HnxdacI.js → fileBytesIdb-BIFKtgln.js} +3 -3
- package/dist/assets/{fileBytesIdb-_HnxdacI.js.map → fileBytesIdb-BIFKtgln.js.map} +1 -1
- package/dist/assets/fileBytesIdb-BVVr_rWX.js +2 -0
- package/dist/assets/{fileBytesOpfs-p_CANncD.js → fileBytesOpfs-ChrHcCVV.js} +3 -3
- package/dist/assets/{fileBytesOpfs-p_CANncD.js.map → fileBytesOpfs-ChrHcCVV.js.map} +1 -1
- package/dist/assets/{groupFiles-gQ8_792r.js → groupFiles-Cr4Gj9-R.js} +45 -13
- package/dist/assets/groupFiles-Cr4Gj9-R.js.map +1 -0
- package/dist/assets/{host-Dmo6m7So.js → host-D0MIWyOe.js} +15 -122
- package/dist/assets/host-D0MIWyOe.js.map +1 -0
- package/dist/assets/{hyperdhtRelay-DwkZ8vpt.js → hyperdhtRelay-SBo4aoMk.js} +2 -2
- package/dist/assets/{hyperdhtRelay-DwkZ8vpt.js.map → hyperdhtRelay-SBo4aoMk.js.map} +1 -1
- package/dist/assets/{idb-CMVgtn2k.js → idb-BJARz3Qi.js} +5 -3
- package/dist/assets/idb-BJARz3Qi.js.map +1 -0
- package/dist/assets/{irohWeb-DKJhESuV.js → irohWeb-D2WaYPdN.js} +2 -2
- package/dist/assets/{irohWeb-DKJhESuV.js.map → irohWeb-D2WaYPdN.js.map} +1 -1
- package/dist/assets/{main-DgXvK9Cr.js → main-DUG0nGLw.js} +240 -53
- package/dist/assets/main-DUG0nGLw.js.map +1 -0
- package/dist/assets/{mainline-9j_FqcJe.js → mainline-B8NGRodL.js} +2 -2
- package/dist/assets/{mainline-9j_FqcJe.js.map → mainline-B8NGRodL.js.map} +1 -1
- package/dist/assets/{networkReason-Bp8Huk9Z.js → networkReason-BAnNO1Ji.js} +3 -3
- package/dist/assets/{networkReason-Bp8Huk9Z.js.map → networkReason-BAnNO1Ji.js.map} +1 -1
- package/dist/assets/{nwc-DxIjNmYz.js → nwc-DQT3rx-s.js} +3 -3
- package/dist/assets/{nwc-DxIjNmYz.js.map → nwc-DQT3rx-s.js.map} +1 -1
- package/dist/assets/{nwcProvider-CyGVe35t.js → nwcProvider-Dq647EAl.js} +2 -2
- package/dist/assets/{nwcProvider-CyGVe35t.js.map → nwcProvider-Dq647EAl.js.map} +1 -1
- package/dist/assets/{profiles-ClRPr6y8.js → profiles-BehWURA9.js} +7 -3
- package/dist/assets/profiles-BehWURA9.js.map +1 -0
- package/dist/assets/{registry-siqMiD8L.js → registry-DFiOxH5q.js} +1 -1
- package/dist/assets/{registry-BTIRr7gH.js → registry-ieI8INKT.js} +3 -3
- package/dist/assets/registry-ieI8INKT.js.map +1 -0
- package/dist/assets/{resolve-CZ4yb7wp.js → resolve-C39pc4Kf.js} +2 -2
- package/dist/assets/{resolve-CZ4yb7wp.js.map → resolve-C39pc4Kf.js.map} +1 -1
- package/dist/assets/{restoredRows-DeBImGRd.js → restoredRows-DGuKtIBz.js} +2 -2
- package/dist/assets/{restoredRows-DeBImGRd.js.map → restoredRows-DGuKtIBz.js.map} +1 -1
- package/dist/assets/{server-ZrkwMbFo.js → server-DIICuvgy.js} +832 -149
- package/dist/assets/server-DIICuvgy.js.map +1 -0
- package/dist/assets/{src-CxEO33Hb.js → src-CwMTZ5Hj.js} +762 -54
- package/dist/assets/src-CwMTZ5Hj.js.map +1 -0
- package/dist/assets/{usdt-exH8dIZK.js → usdt-CxSyuXq4.js} +3 -3
- package/dist/assets/{usdt-exH8dIZK.js.map → usdt-CxSyuXq4.js.map} +1 -1
- package/dist/assets/{turnRefs-Dndxqyxk.js → words-31VaDW5h.js} +61 -3
- package/dist/assets/words-31VaDW5h.js.map +1 -0
- package/dist/ghostly.mjs +1 -1
- package/package.json +1 -1
- package/skills/ghostly/scripts/status +3 -2
- package/dist/assets/api-D70he3-A.js.map +0 -1
- package/dist/assets/buttons-CtGCix-8.js +0 -2
- package/dist/assets/daemonProof-B53VnZ1Z.js +0 -100
- package/dist/assets/daemonProof-B53VnZ1Z.js.map +0 -1
- package/dist/assets/fileBytesIdb-DOxm_BKt.js +0 -2
- package/dist/assets/groupFiles-gQ8_792r.js.map +0 -1
- package/dist/assets/host-Dmo6m7So.js.map +0 -1
- package/dist/assets/idb-CMVgtn2k.js.map +0 -1
- package/dist/assets/main-DgXvK9Cr.js.map +0 -1
- package/dist/assets/profiles-ClRPr6y8.js.map +0 -1
- package/dist/assets/registry-BTIRr7gH.js.map +0 -1
- package/dist/assets/server-ZrkwMbFo.js.map +0 -1
- package/dist/assets/src-CxEO33Hb.js.map +0 -1
- package/dist/assets/turnRefs-Dndxqyxk.js.map +0 -1
|
@@ -6039,11 +6039,15 @@ var RTC_CONFIG = {
|
|
|
6039
6039
|
* A call's WebRTC configuration: the apps' STUN servers, then the profile's own (Settings → Network → ICE
|
|
6040
6040
|
* servers: a TURN relay, typically). A relay is what connects a call when no direct path works: a VPN that takes
|
|
6041
6041
|
* every packet through its tunnel, or a NAT that maps each destination apart.
|
|
6042
|
+
*
|
|
6043
|
+
* `relayOnly` ("Hide my IP from contacts", WISP 100 § Relay only): the profile's TURN servers alone, no STUN server
|
|
6044
|
+
* (the apps' or the profile's), and the relay policy, so the connection gathers and uses relay candidates only. With
|
|
6045
|
+
* no usable TURN server it has no server at all, and finds no candidate: it fails, it never goes direct.
|
|
6042
6046
|
*/
|
|
6043
|
-
function callRtcConfig(extra = []) {
|
|
6047
|
+
function callRtcConfig(extra = [], { relayOnly = false } = {}) {
|
|
6044
6048
|
const servers = [];
|
|
6045
6049
|
for (const server of extra) {
|
|
6046
|
-
const urls = (Array.isArray(server.urls) ? server.urls : server.urls.split(/[\s,]+/)).filter(Boolean);
|
|
6050
|
+
const urls = (Array.isArray(server.urls) ? server.urls : server.urls.split(/[\s,]+/)).filter(Boolean).filter((url) => !relayOnly || /^turns?:/i.test(url));
|
|
6047
6051
|
if (!urls.length) continue;
|
|
6048
6052
|
if (urls.some((url) => /^turns?:/i.test(url)) && (!server.username?.trim() || !server.credential?.trim())) continue;
|
|
6049
6053
|
servers.push({
|
|
@@ -6052,12 +6056,30 @@ function callRtcConfig(extra = []) {
|
|
|
6052
6056
|
...server.credential ? { credential: server.credential } : {}
|
|
6053
6057
|
});
|
|
6054
6058
|
}
|
|
6059
|
+
if (relayOnly) return {
|
|
6060
|
+
...RTC_CONFIG,
|
|
6061
|
+
iceServers: servers,
|
|
6062
|
+
iceTransportPolicy: "relay"
|
|
6063
|
+
};
|
|
6055
6064
|
return {
|
|
6056
6065
|
...RTC_CONFIG,
|
|
6057
6066
|
iceServers: [...RTC_CONFIG.iceServers ?? [], ...servers]
|
|
6058
6067
|
};
|
|
6059
6068
|
}
|
|
6060
6069
|
/**
|
|
6070
|
+
* The WebRTC configuration of a chat's data link or a group's edge, from the profile's settings: its ICE servers,
|
|
6071
|
+
* and "Hide my IP from contacts" (`relayOnly`), as a call's (`callRtcConfig`). No candidate pool: an app holds one
|
|
6072
|
+
* such connection per chat and per group member, and a call only one.
|
|
6073
|
+
*/
|
|
6074
|
+
function contactRtcConfig(settings) {
|
|
6075
|
+
const { iceCandidatePoolSize: _pool, ...config } = callRtcConfig(settings.iceServers ?? [], { relayOnly: settings.relayOnly === true });
|
|
6076
|
+
return config;
|
|
6077
|
+
}
|
|
6078
|
+
/** Whether a connection keeps to relays (`iceTransportPolicy: "relay"`): what it sends a contact is then relay candidates only. */
|
|
6079
|
+
function keepsToRelays(pc) {
|
|
6080
|
+
return pc?.getConfiguration?.().iceTransportPolicy === "relay";
|
|
6081
|
+
}
|
|
6082
|
+
/**
|
|
6061
6083
|
* The candidates a signal carries, from the `a=candidate:` values of an SDP, when it may carry up to `max`.
|
|
6062
6084
|
*
|
|
6063
6085
|
* A computer often has several interfaces (Wi-Fi, Ethernet, VM bridges, Tailscale, a VPN) and the one listed first is
|
|
@@ -6072,11 +6094,14 @@ function callRtcConfig(extra = []) {
|
|
|
6072
6094
|
*
|
|
6073
6095
|
* UDP only, loopback, link-local and unspecified addresses left out (loopback kept with `loopback`), the related
|
|
6074
6096
|
* address dropped (it is informational, and an IPv6 one broke apps before 0.5).
|
|
6097
|
+
*
|
|
6098
|
+
* `relayOnly` ("Hide my IP from contacts"): relay candidates alone, whatever else the connection gathered. A relay
|
|
6099
|
+
* candidate's address is the TURN server's; its related address, dropped as every one is, would be this device's.
|
|
6075
6100
|
*/
|
|
6076
|
-
function pickCallCandidates(candidates, max = 8, { loopback = false } = {}) {
|
|
6077
|
-
const udp = candidates.map((c) => c.trim()).filter((c) => / udp /i.test(c));
|
|
6078
|
-
const address = (c) => c.split(" ")[4] ?? "";
|
|
6101
|
+
function pickCallCandidates(candidates, max = 8, { loopback = false, relayOnly = false } = {}) {
|
|
6079
6102
|
const type = (c) => / typ (\S+)/.exec(c)?.[1];
|
|
6103
|
+
const udp = candidates.map((c) => c.trim()).filter((c) => / udp /i.test(c) && (!relayOnly || type(c) === "relay"));
|
|
6104
|
+
const address = (c) => c.split(" ")[4] ?? "";
|
|
6080
6105
|
const cost = (c) => Number(/ network-cost (\d+)/.exec(c)?.[1] ?? 0);
|
|
6081
6106
|
const ipv6 = (c) => address(c).includes(":");
|
|
6082
6107
|
const usable = (c) => {
|
|
@@ -6101,9 +6126,10 @@ function pickCallCandidates(candidates, max = 8, { loopback = false } = {}) {
|
|
|
6101
6126
|
/**
|
|
6102
6127
|
* The parameters of a call signal, from an SDP. `maxCandidates` above two (a signal on the chat session) carries
|
|
6103
6128
|
* the candidates `pickCallCandidates` chooses; the default keeps a compatibility chat's one host and one server
|
|
6104
|
-
* reflexive candidate.
|
|
6129
|
+
* reflexive candidate. `relayOnly` ("Hide my IP from contacts"): relay candidates only, in either; a compatibility
|
|
6130
|
+
* chat's two then go to the first two relay ones.
|
|
6105
6131
|
*/
|
|
6106
|
-
function extractParamsFromSdp(sdp, { maxCandidates = 2, loopback = false } = {}) {
|
|
6132
|
+
function extractParamsFromSdp(sdp, { maxCandidates = 2, loopback = false, relayOnly = false } = {}) {
|
|
6107
6133
|
const lines = sdp.split("\r\n");
|
|
6108
6134
|
let ufrag = "";
|
|
6109
6135
|
let pwd = "";
|
|
@@ -6147,7 +6173,10 @@ function extractParamsFromSdp(sdp, { maxCandidates = 2, loopback = false } = {})
|
|
|
6147
6173
|
}
|
|
6148
6174
|
const srflxCandidates = candidates.filter((c) => / typ srflx( |$)/.test(c));
|
|
6149
6175
|
const hostCandidates = candidates.filter((c) => / typ host( |$)/.test(c) && / udp /i.test(c));
|
|
6150
|
-
const selectedCandidates = maxCandidates > 2 ? pickCallCandidates(candidates, maxCandidates, {
|
|
6176
|
+
const selectedCandidates = maxCandidates > 2 || relayOnly ? pickCallCandidates(candidates, maxCandidates, {
|
|
6177
|
+
loopback,
|
|
6178
|
+
relayOnly
|
|
6179
|
+
}) : [...hostCandidates.slice(0, 1), ...srflxCandidates.slice(0, 1)].map((c) => c.replace(/ raddr \S+ rport \d+/, ""));
|
|
6151
6180
|
const ssrcs = [];
|
|
6152
6181
|
if (audioSsrc !== null) ssrcs.push(audioSsrc);
|
|
6153
6182
|
if (videoSsrc !== null) ssrcs.push(videoSsrc);
|
|
@@ -6582,7 +6611,8 @@ function hostRank(parts, reflexiveBases) {
|
|
|
6582
6611
|
const wayOut = reflexiveBases.has(parts[4]) || isGlobalIpv4Host(parts.join(" "));
|
|
6583
6612
|
return (costly ? 2 : 0) + (wayOut ? 0 : 1);
|
|
6584
6613
|
}
|
|
6585
|
-
|
|
6614
|
+
/** `relayOnly` ("Hide my IP from contacts", the connection keeps to relays): relay candidates only, whatever else is in the SDP. */
|
|
6615
|
+
function extractRtcParams(sdp, { relayOnly = false } = {}) {
|
|
6586
6616
|
let u = "";
|
|
6587
6617
|
let p = "";
|
|
6588
6618
|
let f = "";
|
|
@@ -6598,7 +6628,7 @@ function extractRtcParams(sdp) {
|
|
|
6598
6628
|
const parts = line.slice(12).split(" ");
|
|
6599
6629
|
if (parts.length < 8 || parts[1] !== "1" || parts[2].toLowerCase() !== "udp") continue;
|
|
6600
6630
|
const type = CANDIDATE_TYPES[parts[7]];
|
|
6601
|
-
if (!type) continue;
|
|
6631
|
+
if (!type || relayOnly && type !== "r") continue;
|
|
6602
6632
|
const compact = `${type},${parts[4]},${parts[5]}`;
|
|
6603
6633
|
if (found.some((c) => c.compact === compact)) continue;
|
|
6604
6634
|
found.push({
|
|
@@ -8509,7 +8539,7 @@ var DataLink = class {
|
|
|
8509
8539
|
const signal = {
|
|
8510
8540
|
t: "o",
|
|
8511
8541
|
ts: this.myOfferTs,
|
|
8512
|
-
...extractRtcParams(pc.localDescription.sdp)
|
|
8542
|
+
...extractRtcParams(pc.localDescription.sdp, { relayOnly: keepsToRelays(pc) })
|
|
8513
8543
|
};
|
|
8514
8544
|
this.options.publishSignal(JSON.stringify(signal));
|
|
8515
8545
|
} catch {
|
|
@@ -8696,7 +8726,7 @@ var DataLink = class {
|
|
|
8696
8726
|
t: "a",
|
|
8697
8727
|
ts: Date.now(),
|
|
8698
8728
|
o: offer.ts,
|
|
8699
|
-
...extractRtcParams(pc.localDescription.sdp)
|
|
8729
|
+
...extractRtcParams(pc.localDescription.sdp, { relayOnly: keepsToRelays(pc) })
|
|
8700
8730
|
};
|
|
8701
8731
|
this.options.publishSignal(JSON.stringify(signal));
|
|
8702
8732
|
this.setState("connecting");
|
|
@@ -9270,10 +9300,13 @@ var PR_CHECKS = [
|
|
|
9270
9300
|
"failing",
|
|
9271
9301
|
"pending"
|
|
9272
9302
|
];
|
|
9303
|
+
/** The kinds a sender may take back (WISP 405 § Removing a card). */
|
|
9304
|
+
var REMOVABLE_KINDS = ["task", "routine"];
|
|
9273
9305
|
var ID$4 = /^[A-Za-z0-9_.:][A-Za-z0-9_.:-]{0,63}$/;
|
|
9274
9306
|
/** A button's id: 1 to 32 of `A-Z a-z 0-9 _ . : -`, not starting with `-`. */
|
|
9275
9307
|
var BUTTON_ID = /^[A-Za-z0-9_.:][A-Za-z0-9_.:-]{0,31}$/;
|
|
9276
|
-
|
|
9308
|
+
/** A routine's cron line, trimmed: 1 to 64 of `0-9 A-Z a-z * , / ? # -` and spaces (shown, never run). */
|
|
9309
|
+
var CRON_LINE = /^[0-9A-Za-z*,/?#\- ]{1,64}$/;
|
|
9277
9310
|
/**
|
|
9278
9311
|
* Whether a typed answer is a button's label or id (WISP 406 · Message Buttons): ignoring case and spaces at the ends.
|
|
9279
9312
|
* Not the device's locale's case: the presser's and the author's apps must agree ("I" is not "ı" anywhere).
|
|
@@ -9452,6 +9485,14 @@ function readStatusCard(raw, now = Date.now()) {
|
|
|
9452
9485
|
...raw.opened === true && { opened: true }
|
|
9453
9486
|
};
|
|
9454
9487
|
}
|
|
9488
|
+
if (raw.kind === "removed") {
|
|
9489
|
+
const of = oneOf(REMOVABLE_KINDS, raw.of);
|
|
9490
|
+
return of && {
|
|
9491
|
+
kind: "removed",
|
|
9492
|
+
id,
|
|
9493
|
+
of
|
|
9494
|
+
};
|
|
9495
|
+
}
|
|
9455
9496
|
const latest = now + MESSAGE_CLOCK_SKEW_MS;
|
|
9456
9497
|
if (raw.kind === "usage") return readUsage(raw, id, now);
|
|
9457
9498
|
const links = readLinks(raw.links);
|
|
@@ -9515,7 +9556,7 @@ function readStatusCard(raw, now = Date.now()) {
|
|
|
9515
9556
|
if (raw.kind === "routine") {
|
|
9516
9557
|
const name = cardLine(raw.name, STATUS_CARD_LIMITS.title), schedule = cardLine(raw.schedule, STATUS_CARD_LIMITS.schedule), state = oneOf(ROUTINE_STATES, raw.state);
|
|
9517
9558
|
if (!name || !schedule || !state) return void 0;
|
|
9518
|
-
const cron = typeof raw.cron === "string" &&
|
|
9559
|
+
const cron = typeof raw.cron === "string" && CRON_LINE.test(raw.cron.trim()) ? raw.cron.trim() : void 0;
|
|
9519
9560
|
const lastRun = readRun(raw.lastRun, now);
|
|
9520
9561
|
const nextRunAt = typeof raw.nextRunAt === "number" && Number.isSafeInteger(raw.nextRunAt) && raw.nextRunAt > 0 && raw.nextRunAt <= now + STATUS_CARD_LIMITS.nextRunMs ? raw.nextRunAt : void 0;
|
|
9521
9562
|
const runs = [];
|
|
@@ -9572,7 +9613,7 @@ function checkStatusCard(raw, now = Date.now()) {
|
|
|
9572
9613
|
if (!isObject$4(raw)) return { error: "A card is an object" };
|
|
9573
9614
|
const bytes = statusCardBytes(raw);
|
|
9574
9615
|
if (bytes > STATUS_CARD_LIMITS.bytes) return { error: `The card takes ${bytes} bytes; at most ${STATUS_CARD_LIMITS.bytes}` };
|
|
9575
|
-
if (raw.kind !== "task" && raw.kind !== "routine" && raw.kind !== "buttons" && raw.kind !== "app" && raw.kind !== "usage") return { error: "kind is task, routine, buttons, app or
|
|
9616
|
+
if (raw.kind !== "task" && raw.kind !== "routine" && raw.kind !== "buttons" && raw.kind !== "app" && raw.kind !== "usage" && raw.kind !== "removed") return { error: "kind is task, routine, buttons, app, usage or removed" };
|
|
9576
9617
|
if (typeof raw.id !== "string" || !ID$4.test(raw.id)) return { error: `id is 1 to ${STATUS_CARD_LIMITS.id} of A-Z a-z 0-9 _ . : - and does not start with -` };
|
|
9577
9618
|
const line = (field, value, max, required = false) => {
|
|
9578
9619
|
if (value === void 0 && !required) return null;
|
|
@@ -9595,7 +9636,11 @@ function checkStatusCard(raw, now = Date.now()) {
|
|
|
9595
9636
|
}
|
|
9596
9637
|
const share = (field, value) => value === void 0 || typeof value === "number" && Number.isFinite(value) && value >= 0 && value <= 100 ? null : `${field} is a number from 0 to 100`;
|
|
9597
9638
|
const reset = (field, value) => value === void 0 || ahead(value, now) !== void 0 ? null : `${field} is a time in milliseconds, within a year`;
|
|
9598
|
-
if (raw.kind === "
|
|
9639
|
+
if (raw.kind === "removed") {
|
|
9640
|
+
if (!oneOf(REMOVABLE_KINDS, raw.of)) errors.push(`of is one of ${REMOVABLE_KINDS.join(", ")}`);
|
|
9641
|
+
const extra = Object.keys(raw).find((key) => key !== "kind" && key !== "id" && key !== "of");
|
|
9642
|
+
if (extra) errors.push(`a removed card takes only kind, id and of, not ${extra}`);
|
|
9643
|
+
} else if (raw.kind === "usage") {
|
|
9599
9644
|
if (raw.links !== void 0) errors.push("a usage card takes no links");
|
|
9600
9645
|
if (raw.left === void 0 && raw.used === void 0) errors.push("left (a percent) or used and limit");
|
|
9601
9646
|
errors.push(share("left", raw.left));
|
|
@@ -9702,7 +9747,7 @@ function checkStatusCard(raw, now = Date.now()) {
|
|
|
9702
9747
|
} else {
|
|
9703
9748
|
errors.push(line("name", raw.name, STATUS_CARD_LIMITS.title, true), line("schedule", raw.schedule, STATUS_CARD_LIMITS.schedule, true));
|
|
9704
9749
|
if (!oneOf(ROUTINE_STATES, raw.state)) errors.push(`state is one of ${ROUTINE_STATES.join(", ")}`);
|
|
9705
|
-
if (raw.cron !== void 0 && !(typeof raw.cron === "string" &&
|
|
9750
|
+
if (raw.cron !== void 0 && !(typeof raw.cron === "string" && CRON_LINE.test(raw.cron.trim()))) errors.push(`cron is a cron line of at most ${STATUS_CARD_LIMITS.cron} characters`);
|
|
9706
9751
|
if (raw.nextRunAt !== void 0 && !(typeof raw.nextRunAt === "number" && Number.isSafeInteger(raw.nextRunAt) && raw.nextRunAt > 0 && raw.nextRunAt <= now + STATUS_CARD_LIMITS.nextRunMs)) errors.push("nextRunAt is a time in milliseconds, within a year");
|
|
9707
9752
|
const run = (field, value) => {
|
|
9708
9753
|
if (!isObject$4(value)) return errors.push(`${field} is an object`);
|
|
@@ -9752,10 +9797,18 @@ function cardTimeUtc(ms) {
|
|
|
9752
9797
|
return `${new Date(ms).toISOString().slice(0, 16).replace("T", " ")} UTC`;
|
|
9753
9798
|
}
|
|
9754
9799
|
/**
|
|
9800
|
+
* The text a removed card's message carries (WISP 405 § Removing a card): "🗑 Task removed", with the card's title or
|
|
9801
|
+
* name when the sender knows it ("🗑 Task removed: Fix relay rotation"). An app without the `removed` kind shows it.
|
|
9802
|
+
*/
|
|
9803
|
+
function removedCardText(of, title) {
|
|
9804
|
+
return `🗑 ${of === "task" ? "Task" : "Routine"} removed${title ? `: ${title}` : ""}`;
|
|
9805
|
+
}
|
|
9806
|
+
/**
|
|
9755
9807
|
* The text a card's message carries: what an app without cards shows, the DHT floor carries, the chat list previews
|
|
9756
9808
|
* and search finds. Plain lines, the first naming the card, no bars or layout that would read badly elsewhere.
|
|
9757
9809
|
*/
|
|
9758
9810
|
function statusCardText(card) {
|
|
9811
|
+
if (card.kind === "removed") return removedCardText(card.of);
|
|
9759
9812
|
if (card.kind === "app") {
|
|
9760
9813
|
const named = `${card.title}${card.version ? ` ${card.version}` : ""}`;
|
|
9761
9814
|
return [card.opened ? `🧩 Opened ${named} in this chat (Ghostly app)` : `🧩 ${named} (Ghostly app)`, ...card.url ? [card.url] : []].join("\n");
|
|
@@ -10253,13 +10306,24 @@ function parseLinkPreview(raw, text) {
|
|
|
10253
10306
|
* message. A status card (`sc`, WISP 405 · Status Cards) may come with it too; a card message takes up to
|
|
10254
10307
|
* `STATUS_CARD_LIMITS.edits` edits, a number past `MAX_EDITS_PER_MESSAGE` holding only with a card. Older apps drop
|
|
10255
10308
|
* both frames: they have an id, but a `t` they do not know.
|
|
10309
|
+
*
|
|
10310
|
+
* A removal (WISP 400 § Delete for everyone) is the message's last edit, flagged `rm`, with a fallback text and
|
|
10311
|
+
* nothing else beside it; an app from before removals shows that text as the edit:
|
|
10312
|
+
*
|
|
10313
|
+
* {"t":"paired-edit","id":"<the message's wire id>","e":4,"ts":1790000000000,"m":"🗑 Message removed","rm":true}
|
|
10256
10314
|
*/
|
|
10257
10315
|
var EDIT_FRAME = "paired-edit";
|
|
10258
10316
|
var EDITED_FRAME = "paired-edited";
|
|
10317
|
+
/** A removal is numbered one past the message's last edit, so it may pass a card message's bound by one. */
|
|
10318
|
+
var MAX_REMOVAL_NUMBER = STATUS_CARD_LIMITS.edits + 1;
|
|
10319
|
+
/** The text a removal carries: only what an app from before removals shows in the message's place. */
|
|
10320
|
+
var REMOVED_TEXT = "🗑 Message removed";
|
|
10259
10321
|
var EDIT_RATE_WINDOW_MS = 1e4;
|
|
10260
10322
|
/** An edit of a message not here yet waits this long for it, at most `EDIT_BUFFER_MAX` of them per chat. */
|
|
10261
10323
|
var EDIT_BUFFER_MS = 6e4;
|
|
10262
10324
|
var ID$3 = /^[A-Za-z0-9_-]{22}$/;
|
|
10325
|
+
/** A removal may name a file too (WISP 401 § Edits): its offer's id, as a file's id holds (`files.ts`). */
|
|
10326
|
+
var REMOVAL_ID = /^[A-Za-z0-9_-]{8,64}$/;
|
|
10263
10327
|
/** Largest edit frame sent with a preview: the preview is left out past it, as with a message. */
|
|
10264
10328
|
var MAX_EDIT_FRAME = 57344;
|
|
10265
10329
|
/**
|
|
@@ -10267,6 +10331,14 @@ var MAX_EDIT_FRAME = 57344;
|
|
|
10267
10331
|
* goes: it is bounded well under what the frame has room for, and it is what a card message is.
|
|
10268
10332
|
*/
|
|
10269
10333
|
function editFrame(edit) {
|
|
10334
|
+
if (edit.rm) return JSON.stringify({
|
|
10335
|
+
t: EDIT_FRAME,
|
|
10336
|
+
id: edit.id,
|
|
10337
|
+
e: edit.e,
|
|
10338
|
+
ts: edit.ts,
|
|
10339
|
+
m: edit.m,
|
|
10340
|
+
rm: true
|
|
10341
|
+
});
|
|
10270
10342
|
const base = {
|
|
10271
10343
|
t: EDIT_FRAME,
|
|
10272
10344
|
id: edit.id,
|
|
@@ -10295,6 +10367,10 @@ function editedFrame(id, e) {
|
|
|
10295
10367
|
function validEditNumber(e) {
|
|
10296
10368
|
return Number.isSafeInteger(e) && e >= 1 && e <= 100;
|
|
10297
10369
|
}
|
|
10370
|
+
/** A removal's number: any up to one past a card message's bound, card or not. */
|
|
10371
|
+
function validRemovalNumber(e) {
|
|
10372
|
+
return Number.isSafeInteger(e) && e >= 1 && e <= MAX_REMOVAL_NUMBER;
|
|
10373
|
+
}
|
|
10298
10374
|
/** A message's new text: not empty, no space around it, within a chat message's bytes. The same on a session and on the DHT. */
|
|
10299
10375
|
function validEditMessage(m) {
|
|
10300
10376
|
return typeof m === "string" && !!m.trim() && m === m.trim() && utf8Encode(m).length <= LIMITS.maxChatMessageBytes;
|
|
@@ -10302,14 +10378,22 @@ function validEditMessage(m) {
|
|
|
10302
10378
|
/**
|
|
10303
10379
|
* The edit a `paired-edit` frame says, or null when it is malformed (then it says nothing and is not confirmed). A
|
|
10304
10380
|
* preview or a card that does not hold is dropped, never the edit; an edit numbered past `MAX_EDITS_PER_MESSAGE`
|
|
10305
|
-
* holds only with a card.
|
|
10381
|
+
* holds only with a card. A removal carries its fallback text alone, and a `rm` other than `true` is no edit.
|
|
10306
10382
|
*/
|
|
10307
10383
|
function parseEditFrame(frame, now = Date.now()) {
|
|
10308
10384
|
if (frame?.t !== "paired-edit") return null;
|
|
10309
|
-
const { id, e, ts, m } = frame;
|
|
10310
|
-
if (
|
|
10385
|
+
const { id, e, ts, m, rm } = frame;
|
|
10386
|
+
if (rm !== void 0 && rm !== true) return null;
|
|
10387
|
+
if (typeof id !== "string" || !(rm ? REMOVAL_ID : ID$3).test(id) || typeof e !== "number" || !(rm ? validRemovalNumber(e) : cardEditNumber(e))) return null;
|
|
10311
10388
|
if (typeof ts !== "number" || !Number.isSafeInteger(ts) || ts <= 0) return null;
|
|
10312
10389
|
if (!validEditMessage(m)) return null;
|
|
10390
|
+
if (rm) return {
|
|
10391
|
+
id,
|
|
10392
|
+
e,
|
|
10393
|
+
ts,
|
|
10394
|
+
m,
|
|
10395
|
+
rm
|
|
10396
|
+
};
|
|
10313
10397
|
const sc = frame.sc === void 0 ? void 0 : readStatusCard(frame.sc, now);
|
|
10314
10398
|
if (!validEditNumber(e) && !sc) return null;
|
|
10315
10399
|
const pv = frame.pv === void 0 ? void 0 : parseLinkPreview(frame.pv, m);
|
|
@@ -10325,7 +10409,7 @@ function parseEditFrame(frame, now = Date.now()) {
|
|
|
10325
10409
|
/** The confirmation a `paired-edited` frame says, or null when it is malformed. */
|
|
10326
10410
|
function parseEditedFrame(frame) {
|
|
10327
10411
|
if (frame?.t !== "paired-edited") return null;
|
|
10328
|
-
return typeof frame.id === "string" &&
|
|
10412
|
+
return typeof frame.id === "string" && REMOVAL_ID.test(frame.id) && validRemovalNumber(frame.e) ? {
|
|
10329
10413
|
id: frame.id,
|
|
10330
10414
|
e: frame.e
|
|
10331
10415
|
} : null;
|
|
@@ -10382,7 +10466,7 @@ var VIDEO_LIMITS = {
|
|
|
10382
10466
|
function isVideoMime(mime) {
|
|
10383
10467
|
return mime.split(";")[0].trim().toLowerCase().startsWith("video/");
|
|
10384
10468
|
}
|
|
10385
|
-
var BASE64URL = /^[A-Za-z0-9_-]+$/;
|
|
10469
|
+
var BASE64URL$1 = /^[A-Za-z0-9_-]+$/;
|
|
10386
10470
|
var JPEG_START = [
|
|
10387
10471
|
255,
|
|
10388
10472
|
216,
|
|
@@ -10405,7 +10489,7 @@ function parseVideoMeta(value, mime) {
|
|
|
10405
10489
|
width,
|
|
10406
10490
|
height
|
|
10407
10491
|
};
|
|
10408
|
-
if (typeof poster === "string" && poster.length <= Math.ceil(VIDEO_LIMITS.maxPosterBytes * 4 / 3) && BASE64URL.test(poster)) try {
|
|
10492
|
+
if (typeof poster === "string" && poster.length <= Math.ceil(VIDEO_LIMITS.maxPosterBytes * 4 / 3) && BASE64URL$1.test(poster)) try {
|
|
10409
10493
|
const bytes = fromBase64Url(poster);
|
|
10410
10494
|
const size = bytes.length <= VIDEO_LIMITS.maxPosterBytes && JPEG_START.every((b, i) => bytes[i] === b) ? imageSize(bytes) : void 0;
|
|
10411
10495
|
if (size && Math.max(size.width, size.height) <= VIDEO_LIMITS.posterEdge) meta.poster = poster;
|
|
@@ -15480,6 +15564,11 @@ var UPGRADE_CAPABILITY = "upgrade/1";
|
|
|
15480
15564
|
* `pairedApps.ts`). Offered only while the apps feature is on.
|
|
15481
15565
|
*/
|
|
15482
15566
|
var APPS_CAPABILITY = "apps/1";
|
|
15567
|
+
/**
|
|
15568
|
+
* The read lane of mini-apps (WISP 1200 § A read lane to the contact, `pairedAppRanges.ts`): the contact's app reads a
|
|
15569
|
+
* file this side's app serves, in ranges, outside `apps/1`. Offered beside `apps/1` only.
|
|
15570
|
+
*/
|
|
15571
|
+
var APP_RANGES_CAPABILITY = "app-ranges/1";
|
|
15483
15572
|
/** Every capability this app knows on a session: what `receive` reports changes of. */
|
|
15484
15573
|
var KNOWN_SESSION_CAPABILITIES = [
|
|
15485
15574
|
CALLS_CAPABILITY,
|
|
@@ -15494,7 +15583,8 @@ var KNOWN_SESSION_CAPABILITIES = [
|
|
|
15494
15583
|
STATUS_CARD_CAPABILITY,
|
|
15495
15584
|
BUTTONS_CAPABILITY,
|
|
15496
15585
|
UPGRADE_CAPABILITY,
|
|
15497
|
-
APPS_CAPABILITY
|
|
15586
|
+
APPS_CAPABILITY,
|
|
15587
|
+
APP_RANGES_CAPABILITY
|
|
15498
15588
|
];
|
|
15499
15589
|
var SESSION_CAPABILITIES_FRAME = "paired-capabilities";
|
|
15500
15590
|
var MAX_ENTRIES$1 = 32;
|
|
@@ -15826,6 +15916,411 @@ var AppSessions = class {
|
|
|
15826
15916
|
}
|
|
15827
15917
|
};
|
|
15828
15918
|
//#endregion
|
|
15919
|
+
//#region ../core/src/pairedAppRanges.ts
|
|
15920
|
+
/**
|
|
15921
|
+
* The read lane of mini-apps in a 1:1 chat (WISP 1200 § A read lane to the contact: `app-ranges/1`): the contact's app
|
|
15922
|
+
* reads, in ranges, a file this side's app serves, over the chat's session but not through `apps/1`.
|
|
15923
|
+
*
|
|
15924
|
+
* {"t":"ar-get","a":"<chat app id>","s":"<serve id>","r":7,"o":0,"n":1048576}
|
|
15925
|
+
* {"t":"ar-data","a":"<chat app id>","r":7,"o":0,"d":"<base64url>"}
|
|
15926
|
+
* {"t":"ar-end","a":"<chat app id>","r":7,"z":734003200}
|
|
15927
|
+
* {"t":"ar-err","a":"<chat app id>","r":7,"e":"not-served"}
|
|
15928
|
+
* {"t":"ar-cancel","a":"<chat app id>","r":7}
|
|
15929
|
+
*
|
|
15930
|
+
* The asker sends `ar-get` (request `r`, a number of its own, for `n` bytes at offset `o` of serve `s`) and may send
|
|
15931
|
+
* `ar-cancel`; the server answers with the bytes in chunks of at most `APP_RANGE_LIMITS.chunkBytes`, then `ar-end`
|
|
15932
|
+
* once every byte asked was sent (fewer at the end of the file), with `z` the served file's size, or `ar-err` instead of
|
|
15933
|
+
* any. A read of one byte at 0 is how the asker learns the size. Where `files/4` is on,
|
|
15934
|
+
* a chunk is a binary message of kind `APP_RANGE_DATA_KIND` (`encodeAppRangeData`) in place of `ar-data`. It needs
|
|
15935
|
+
* `app-ranges/1` in `paired-capabilities` on both sides. A reader ignores keys it does not know, so a later version
|
|
15936
|
+
* can add some.
|
|
15937
|
+
*/
|
|
15938
|
+
var APP_RANGE_FRAMES = /* @__PURE__ */ new Set([
|
|
15939
|
+
"ar-get",
|
|
15940
|
+
"ar-data",
|
|
15941
|
+
"ar-end",
|
|
15942
|
+
"ar-err",
|
|
15943
|
+
"ar-cancel"
|
|
15944
|
+
]);
|
|
15945
|
+
var APP_RANGE_LIMITS = {
|
|
15946
|
+
/** One `ar-get`, at most: as one `remote.read` of the app. */
|
|
15947
|
+
requestBytes: 1048576,
|
|
15948
|
+
/** One chunk, `ar-data` or binary: as a chat file's. */
|
|
15949
|
+
chunkBytes: 16384,
|
|
15950
|
+
/** The largest request number: it is 4 bytes in a binary chunk. */
|
|
15951
|
+
maxRequest: 4294967295,
|
|
15952
|
+
/** Requests a server takes in flight per app; one more is answered `busy`. An asker keeps the rest waiting. */
|
|
15953
|
+
inFlight: 4
|
|
15954
|
+
};
|
|
15955
|
+
/**
|
|
15956
|
+
* What an `ar-err` says. `not-served`: no serve of that id on this session (never given, or ended); `changed` and
|
|
15957
|
+
* `gone`: the file under it, as `files.read` says them; `busy`: past the requests the server takes in flight. A
|
|
15958
|
+
* later version may add one: an asker reads a code it does not know as a failure.
|
|
15959
|
+
*/
|
|
15960
|
+
var APP_RANGE_ERRORS = [
|
|
15961
|
+
"not-served",
|
|
15962
|
+
"changed",
|
|
15963
|
+
"gone",
|
|
15964
|
+
"busy"
|
|
15965
|
+
];
|
|
15966
|
+
/** A serve id as it is on the wire: 22 base64url characters (16 random bytes, no padding), as a chat app id. */
|
|
15967
|
+
var isServeId = isChatAppId;
|
|
15968
|
+
var isRequest = (value) => typeof value === "number" && Number.isInteger(value) && value >= 0 && value <= APP_RANGE_LIMITS.maxRequest;
|
|
15969
|
+
var isOffset = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
15970
|
+
var ERROR_CODE = /^[a-z][a-z-]{0,31}$/;
|
|
15971
|
+
var BASE64URL = /^[A-Za-z0-9_-]*$/;
|
|
15972
|
+
/** The bytes of `d`, or null when it is not 1 to `chunkBytes` bytes of canonical base64url without padding. */
|
|
15973
|
+
function appRangeChunk(d) {
|
|
15974
|
+
if (typeof d !== "string" || !d.length || d.length % 4 === 1 || d.length > Math.ceil(APP_RANGE_LIMITS.chunkBytes * 4 / 3) || !BASE64URL.test(d)) return null;
|
|
15975
|
+
let bytes;
|
|
15976
|
+
try {
|
|
15977
|
+
bytes = fromBase64Url(d);
|
|
15978
|
+
} catch {
|
|
15979
|
+
return null;
|
|
15980
|
+
}
|
|
15981
|
+
return bytes.length && bytes.length <= APP_RANGE_LIMITS.chunkBytes && toBase64Url(bytes) === d ? bytes : null;
|
|
15982
|
+
}
|
|
15983
|
+
function appRangeGetFrame(app, serve, request, offset, length) {
|
|
15984
|
+
const frame = {
|
|
15985
|
+
t: "ar-get",
|
|
15986
|
+
a: app,
|
|
15987
|
+
s: serve,
|
|
15988
|
+
r: request,
|
|
15989
|
+
o: offset,
|
|
15990
|
+
n: length
|
|
15991
|
+
};
|
|
15992
|
+
if (!readAppRangeFrame(frame).ok) throw new Error("Not an app range request");
|
|
15993
|
+
return frame;
|
|
15994
|
+
}
|
|
15995
|
+
function appRangeDataFrame(app, request, offset, data) {
|
|
15996
|
+
const frame = {
|
|
15997
|
+
t: "ar-data",
|
|
15998
|
+
a: app,
|
|
15999
|
+
r: request,
|
|
16000
|
+
o: offset,
|
|
16001
|
+
d: toBase64Url(data)
|
|
16002
|
+
};
|
|
16003
|
+
if (!readAppRangeFrame(frame).ok) throw new Error("Not app range data");
|
|
16004
|
+
return frame;
|
|
16005
|
+
}
|
|
16006
|
+
function appRangeEndFrame(app, request, size) {
|
|
16007
|
+
if (!isChatAppId(app) || !isRequest(request) || !isOffset(size)) throw new Error("Not an app range end");
|
|
16008
|
+
return {
|
|
16009
|
+
t: "ar-end",
|
|
16010
|
+
a: app,
|
|
16011
|
+
r: request,
|
|
16012
|
+
z: size
|
|
16013
|
+
};
|
|
16014
|
+
}
|
|
16015
|
+
function appRangeErrorFrame(app, request, error) {
|
|
16016
|
+
if (!isChatAppId(app) || !isRequest(request) || !APP_RANGE_ERRORS.includes(error)) throw new Error("Not an app range error");
|
|
16017
|
+
return {
|
|
16018
|
+
t: "ar-err",
|
|
16019
|
+
a: app,
|
|
16020
|
+
r: request,
|
|
16021
|
+
e: error
|
|
16022
|
+
};
|
|
16023
|
+
}
|
|
16024
|
+
function appRangeCancelFrame(app, request) {
|
|
16025
|
+
if (!isChatAppId(app) || !isRequest(request)) throw new Error("Not an app range cancel");
|
|
16026
|
+
return {
|
|
16027
|
+
t: "ar-cancel",
|
|
16028
|
+
a: app,
|
|
16029
|
+
r: request
|
|
16030
|
+
};
|
|
16031
|
+
}
|
|
16032
|
+
/**
|
|
16033
|
+
* An `ar-*` frame as the peer sent it, or why a reader must refuse it: an unknown `t`, no valid `a`, an `ar-get`
|
|
16034
|
+
* without a valid `s`, a request number that is not 0 to 2^32 - 1, an offset that is not a safe whole number at or
|
|
16035
|
+
* above 0, an `n` that is not 1 to `requestBytes` (or runs past 2^53 - 1), a `d` that is not 1 to `chunkBytes` bytes of
|
|
16036
|
+
* canonical base64url, an `e` that is not a code (lower case letters and `-`, at most 32), an `ar-end` whose `z` is not
|
|
16037
|
+
* a size (a safe whole number at or above 0). Other keys are ignored.
|
|
16038
|
+
*/
|
|
16039
|
+
function readAppRangeFrame(frame) {
|
|
16040
|
+
const refuse = (refusal) => ({
|
|
16041
|
+
ok: false,
|
|
16042
|
+
refusal
|
|
16043
|
+
});
|
|
16044
|
+
const t = frame?.t;
|
|
16045
|
+
if (typeof t !== "string" || !APP_RANGE_FRAMES.has(t)) return refuse("not-ranges");
|
|
16046
|
+
if (!isChatAppId(frame.a)) return refuse("bad-a");
|
|
16047
|
+
const a = frame.a;
|
|
16048
|
+
if (t === "ar-get" && !isServeId(frame.s)) return refuse("bad-s");
|
|
16049
|
+
if (!isRequest(frame.r)) return refuse("bad-r");
|
|
16050
|
+
const r = frame.r;
|
|
16051
|
+
switch (t) {
|
|
16052
|
+
case "ar-get": {
|
|
16053
|
+
if (!isOffset(frame.o)) return refuse("bad-o");
|
|
16054
|
+
const n = frame.n;
|
|
16055
|
+
if (typeof n !== "number" || !Number.isInteger(n) || n < 1 || n > APP_RANGE_LIMITS.requestBytes || !Number.isSafeInteger(frame.o + n)) return refuse("bad-n");
|
|
16056
|
+
return {
|
|
16057
|
+
ok: true,
|
|
16058
|
+
frame: {
|
|
16059
|
+
t,
|
|
16060
|
+
a,
|
|
16061
|
+
s: frame.s,
|
|
16062
|
+
r,
|
|
16063
|
+
o: frame.o,
|
|
16064
|
+
n
|
|
16065
|
+
}
|
|
16066
|
+
};
|
|
16067
|
+
}
|
|
16068
|
+
case "ar-data":
|
|
16069
|
+
if (!isOffset(frame.o)) return refuse("bad-o");
|
|
16070
|
+
if (!appRangeChunk(frame.d)) return refuse("bad-d");
|
|
16071
|
+
return {
|
|
16072
|
+
ok: true,
|
|
16073
|
+
frame: {
|
|
16074
|
+
t,
|
|
16075
|
+
a,
|
|
16076
|
+
r,
|
|
16077
|
+
o: frame.o,
|
|
16078
|
+
d: frame.d
|
|
16079
|
+
}
|
|
16080
|
+
};
|
|
16081
|
+
case "ar-err": return typeof frame.e === "string" && ERROR_CODE.test(frame.e) ? {
|
|
16082
|
+
ok: true,
|
|
16083
|
+
frame: {
|
|
16084
|
+
t,
|
|
16085
|
+
a,
|
|
16086
|
+
r,
|
|
16087
|
+
e: frame.e
|
|
16088
|
+
}
|
|
16089
|
+
} : refuse("bad-e");
|
|
16090
|
+
case "ar-end": return isOffset(frame.z) ? {
|
|
16091
|
+
ok: true,
|
|
16092
|
+
frame: {
|
|
16093
|
+
t,
|
|
16094
|
+
a,
|
|
16095
|
+
r,
|
|
16096
|
+
z: frame.z
|
|
16097
|
+
}
|
|
16098
|
+
} : refuse("bad-z");
|
|
16099
|
+
default: return {
|
|
16100
|
+
ok: true,
|
|
16101
|
+
frame: {
|
|
16102
|
+
t: "ar-cancel",
|
|
16103
|
+
a,
|
|
16104
|
+
r
|
|
16105
|
+
}
|
|
16106
|
+
};
|
|
16107
|
+
}
|
|
16108
|
+
}
|
|
16109
|
+
var HEAD = 29;
|
|
16110
|
+
/** The binary message for the bytes of request `request` of app `app` at `offset`. Throws on what no receiver would take. */
|
|
16111
|
+
function encodeAppRangeData(app, request, offset, data) {
|
|
16112
|
+
if (!isChatAppId(app) || !isRequest(request) || !isOffset(offset) || !data.length || data.length > APP_RANGE_LIMITS.chunkBytes) throw new Error("Invalid app range data");
|
|
16113
|
+
const id = fromBase64Url(app);
|
|
16114
|
+
if (id.length !== 16) throw new Error("Invalid app range data");
|
|
16115
|
+
const out = new Uint8Array(HEAD + data.length);
|
|
16116
|
+
out[0] = 5;
|
|
16117
|
+
out.set(id, 1);
|
|
16118
|
+
const view = new DataView(out.buffer);
|
|
16119
|
+
view.setUint32(17, request);
|
|
16120
|
+
view.setUint32(21, Math.floor(offset / 2 ** 32));
|
|
16121
|
+
view.setUint32(25, offset % 2 ** 32);
|
|
16122
|
+
out.set(data, HEAD);
|
|
16123
|
+
return out;
|
|
16124
|
+
}
|
|
16125
|
+
/** What a binary message from the contact says, or null when it is not well-formed app range data. `data` is a view of `message`. */
|
|
16126
|
+
function decodeAppRangeData(message) {
|
|
16127
|
+
if (message.length <= HEAD || message[0] !== 5 || message.length - HEAD > APP_RANGE_LIMITS.chunkBytes) return null;
|
|
16128
|
+
const view = new DataView(message.buffer, message.byteOffset, message.byteLength);
|
|
16129
|
+
const high = view.getUint32(21);
|
|
16130
|
+
if (high > 2097151) return null;
|
|
16131
|
+
return {
|
|
16132
|
+
a: toBase64Url(message.slice(1, 17)),
|
|
16133
|
+
r: view.getUint32(17),
|
|
16134
|
+
o: high * 2 ** 32 + view.getUint32(25),
|
|
16135
|
+
data: message.subarray(HEAD)
|
|
16136
|
+
};
|
|
16137
|
+
}
|
|
16138
|
+
var slot = (app, request) => `${app}:${request}`;
|
|
16139
|
+
/**
|
|
16140
|
+
* The read lane of one chat, both ways (WISP 1200 § A read lane to the contact). As the side that serves it keeps the
|
|
16141
|
+
* serve ids it gave out on this session and answers the contact's `ar-get` for those only, at most
|
|
16142
|
+
* `APP_RANGE_LIMITS.inFlight` per app (`busy` past it); the bytes themselves are read and sent by the session, which
|
|
16143
|
+
* calls `finish` or `fail` for each task. As the side that asks it sends at most `inFlight` requests per app, keeps
|
|
16144
|
+
* the rest waiting, and puts each answer back together, in order, from the offset asked. Serves and requests last one
|
|
16145
|
+
* session: `reset` ends them all, `closeApp` those of one app.
|
|
16146
|
+
*/
|
|
16147
|
+
var AppRanges = class {
|
|
16148
|
+
send;
|
|
16149
|
+
newServeId;
|
|
16150
|
+
serves = /* @__PURE__ */ new Map();
|
|
16151
|
+
serving = /* @__PURE__ */ new Map();
|
|
16152
|
+
/** Tasks cancelled or unserved that the session is still reading or sending: each counts in its app's `inFlight` until settled. */
|
|
16153
|
+
draining = /* @__PURE__ */ new Set();
|
|
16154
|
+
asking = /* @__PURE__ */ new Map();
|
|
16155
|
+
waiting = /* @__PURE__ */ new Map();
|
|
16156
|
+
nextRequest = 0;
|
|
16157
|
+
constructor(send, newServeId = () => toBase64Url(randomBytes(16))) {
|
|
16158
|
+
this.send = send;
|
|
16159
|
+
this.newServeId = newServeId;
|
|
16160
|
+
}
|
|
16161
|
+
/** Lets the contact's `app` read `file` on this session: the serve id to tell it. */
|
|
16162
|
+
serve(app, file) {
|
|
16163
|
+
if (!isChatAppId(app)) throw new Error("Not a chat app id");
|
|
16164
|
+
let id = this.newServeId();
|
|
16165
|
+
while (this.serves.has(id)) id = this.newServeId();
|
|
16166
|
+
this.serves.set(id, {
|
|
16167
|
+
app,
|
|
16168
|
+
file
|
|
16169
|
+
});
|
|
16170
|
+
return id;
|
|
16171
|
+
}
|
|
16172
|
+
/** Ends one serve: requests under it still being sent stop. False when it was not served. */
|
|
16173
|
+
unserve(serveId) {
|
|
16174
|
+
if (!this.serves.get(serveId)) return false;
|
|
16175
|
+
this.serves.delete(serveId);
|
|
16176
|
+
for (const task of this.serving.values()) if (task.serve === serveId) this.drop(task, true);
|
|
16177
|
+
return true;
|
|
16178
|
+
}
|
|
16179
|
+
/** The serve ids `app` has given out on this session (what the panel's "Sharing with" line shows). */
|
|
16180
|
+
servesOf(app) {
|
|
16181
|
+
return [...this.serves].filter(([, serve]) => serve.app === app).map(([id]) => id);
|
|
16182
|
+
}
|
|
16183
|
+
/** An `ar-get` from the contact: the task to read and send, or null when it was refused (the refusal is sent) or dropped. */
|
|
16184
|
+
receiveGet(frame) {
|
|
16185
|
+
const { a: app, r: request } = frame;
|
|
16186
|
+
if (this.serving.has(slot(app, request))) return null;
|
|
16187
|
+
const serve = this.serves.get(frame.s);
|
|
16188
|
+
if (!serve || serve.app !== app) {
|
|
16189
|
+
this.send(appRangeErrorFrame(app, request, "not-served"));
|
|
16190
|
+
return null;
|
|
16191
|
+
}
|
|
16192
|
+
if ([...this.serving.values(), ...this.draining].filter((task) => task.app === app).length >= APP_RANGE_LIMITS.inFlight) {
|
|
16193
|
+
this.send(appRangeErrorFrame(app, request, "busy"));
|
|
16194
|
+
return null;
|
|
16195
|
+
}
|
|
16196
|
+
const task = {
|
|
16197
|
+
app,
|
|
16198
|
+
request,
|
|
16199
|
+
serve: frame.s,
|
|
16200
|
+
file: serve.file,
|
|
16201
|
+
offset: frame.o,
|
|
16202
|
+
length: frame.n,
|
|
16203
|
+
live: true
|
|
16204
|
+
};
|
|
16205
|
+
this.serving.set(slot(app, request), task);
|
|
16206
|
+
return task;
|
|
16207
|
+
}
|
|
16208
|
+
/** An `ar-cancel` from the contact: that request sends nothing more, and its number frees; its place frees once it is settled. */
|
|
16209
|
+
receiveCancel(frame) {
|
|
16210
|
+
const task = this.serving.get(slot(frame.a, frame.r));
|
|
16211
|
+
if (task) this.drop(task, true);
|
|
16212
|
+
}
|
|
16213
|
+
/** Every byte of `task` was sent: `ar-end` goes with the file's size, unless the task was dropped meanwhile. */
|
|
16214
|
+
finish(task, size) {
|
|
16215
|
+
if (this.take(task)) this.send(appRangeEndFrame(task.app, task.request, size));
|
|
16216
|
+
}
|
|
16217
|
+
/** The file under `task` could not be read: `ar-err` goes in place of the rest, unless the task was dropped meanwhile. */
|
|
16218
|
+
fail(task, error) {
|
|
16219
|
+
if (this.take(task)) this.send(appRangeErrorFrame(task.app, task.request, error));
|
|
16220
|
+
}
|
|
16221
|
+
/** The session stopped working on `task` without an answer (it is no longer live, or the channel went): its place frees, nothing is sent. */
|
|
16222
|
+
release(task) {
|
|
16223
|
+
this.take(task);
|
|
16224
|
+
}
|
|
16225
|
+
/** Reads `length` bytes at `offset` of what the contact's `app` serves as `serve`: the bytes (fewer at the end) and the file's size. */
|
|
16226
|
+
read(app, serve, offset, length) {
|
|
16227
|
+
appRangeGetFrame(app, serve, 0, offset, length);
|
|
16228
|
+
return new Promise((resolve, reject) => {
|
|
16229
|
+
const ask = {
|
|
16230
|
+
app,
|
|
16231
|
+
serve,
|
|
16232
|
+
offset,
|
|
16233
|
+
length,
|
|
16234
|
+
chunks: [],
|
|
16235
|
+
got: 0,
|
|
16236
|
+
resolve,
|
|
16237
|
+
reject
|
|
16238
|
+
};
|
|
16239
|
+
const queue = this.waiting.get(app) ?? [];
|
|
16240
|
+
queue.push(ask);
|
|
16241
|
+
this.waiting.set(app, queue);
|
|
16242
|
+
this.pump(app);
|
|
16243
|
+
});
|
|
16244
|
+
}
|
|
16245
|
+
/** Bytes of a request of ours, from `ar-data` or a binary chunk. Out of order or past what was asked fails the request. */
|
|
16246
|
+
receiveData(app, request, offset, data) {
|
|
16247
|
+
const ask = this.asking.get(slot(app, request));
|
|
16248
|
+
if (!ask) return;
|
|
16249
|
+
if (offset !== ask.offset + ask.got || ask.got + data.length > ask.length) {
|
|
16250
|
+
this.send(appRangeCancelFrame(app, request));
|
|
16251
|
+
return this.settle(ask, "failed");
|
|
16252
|
+
}
|
|
16253
|
+
ask.chunks.push(data.slice());
|
|
16254
|
+
ask.got += data.length;
|
|
16255
|
+
}
|
|
16256
|
+
/** The contact's `ar-end` or `ar-err` for a request of ours. */
|
|
16257
|
+
receiveAnswer(frame) {
|
|
16258
|
+
const ask = this.asking.get(slot(frame.a, frame.r));
|
|
16259
|
+
if (!ask) return;
|
|
16260
|
+
if (frame.t === "ar-err") return this.settle(ask, [
|
|
16261
|
+
"not-served",
|
|
16262
|
+
"changed",
|
|
16263
|
+
"gone"
|
|
16264
|
+
].find((code) => code === frame.e) ?? "failed");
|
|
16265
|
+
if (ask.got !== Math.max(0, Math.min(ask.length, frame.z - ask.offset))) return this.settle(ask, "failed");
|
|
16266
|
+
this.settle(ask);
|
|
16267
|
+
ask.resolve({
|
|
16268
|
+
bytes: concatBytes$1(...ask.chunks),
|
|
16269
|
+
size: frame.z
|
|
16270
|
+
});
|
|
16271
|
+
}
|
|
16272
|
+
/** `app` closed on either side: its serves end, what it was sending stops and what it asked fails with `error`. */
|
|
16273
|
+
closeApp(app, error = "peer-closed") {
|
|
16274
|
+
for (const [id, serve] of this.serves) if (serve.app === app) this.serves.delete(id);
|
|
16275
|
+
for (const task of this.serving.values()) if (task.app === app) this.drop(task);
|
|
16276
|
+
for (const task of this.draining) if (task.app === app) this.draining.delete(task);
|
|
16277
|
+
for (const ask of this.waiting.get(app) ?? []) ask.reject(new Error(error));
|
|
16278
|
+
this.waiting.delete(app);
|
|
16279
|
+
for (const ask of this.asking.values()) if (ask.app === app) this.settle(ask, error);
|
|
16280
|
+
}
|
|
16281
|
+
/** The session ended: no serve id lasts into the next, and every request fails with `offline`. */
|
|
16282
|
+
reset() {
|
|
16283
|
+
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)));
|
|
16284
|
+
for (const app of apps) this.closeApp(app, "offline");
|
|
16285
|
+
}
|
|
16286
|
+
/** Stops `task` and frees its request number; `draining` keeps it counted until it is settled. */
|
|
16287
|
+
drop(task, draining = false) {
|
|
16288
|
+
task.live = false;
|
|
16289
|
+
this.serving.delete(slot(task.app, task.request));
|
|
16290
|
+
if (draining) this.draining.add(task);
|
|
16291
|
+
}
|
|
16292
|
+
/** Frees `task`'s place; false when it was no longer live (nothing to send for it). */
|
|
16293
|
+
take(task) {
|
|
16294
|
+
if (this.draining.delete(task)) return false;
|
|
16295
|
+
const held = this.serving.get(slot(task.app, task.request));
|
|
16296
|
+
if (held !== task || !held.live) return false;
|
|
16297
|
+
this.drop(held);
|
|
16298
|
+
return true;
|
|
16299
|
+
}
|
|
16300
|
+
/** Ends `ask` (failing it with `error` when given) and sends the next one waiting for its app. */
|
|
16301
|
+
settle(ask, error) {
|
|
16302
|
+
if (ask.request === void 0 || this.asking.get(slot(ask.app, ask.request)) !== ask) return;
|
|
16303
|
+
this.asking.delete(slot(ask.app, ask.request));
|
|
16304
|
+
if (error) ask.reject(new Error(error));
|
|
16305
|
+
this.pump(ask.app);
|
|
16306
|
+
}
|
|
16307
|
+
pump(app) {
|
|
16308
|
+
const queue = this.waiting.get(app);
|
|
16309
|
+
let inFlight = [...this.asking.values()].filter((ask) => ask.app === app).length;
|
|
16310
|
+
while (queue?.length && inFlight < APP_RANGE_LIMITS.inFlight) {
|
|
16311
|
+
const ask = queue.shift();
|
|
16312
|
+
let request = this.nextRequest;
|
|
16313
|
+
while (this.asking.has(slot(app, request))) request = request === APP_RANGE_LIMITS.maxRequest ? 0 : request + 1;
|
|
16314
|
+
this.nextRequest = request === APP_RANGE_LIMITS.maxRequest ? 0 : request + 1;
|
|
16315
|
+
ask.request = request;
|
|
16316
|
+
this.asking.set(slot(app, request), ask);
|
|
16317
|
+
inFlight++;
|
|
16318
|
+
this.send(appRangeGetFrame(app, ask.serve, request, ask.offset, ask.length));
|
|
16319
|
+
}
|
|
16320
|
+
if (queue && !queue.length) this.waiting.delete(app);
|
|
16321
|
+
}
|
|
16322
|
+
};
|
|
16323
|
+
//#endregion
|
|
15829
16324
|
//#region ../core/src/webPush.ts
|
|
15830
16325
|
var WebPushError = class extends Error {};
|
|
15831
16326
|
var RECORD_SIZE = 4096;
|
|
@@ -19281,6 +19776,12 @@ var GhostLink = class {
|
|
|
19281
19776
|
typingReceiver = new TypingReceiver((typing, activity) => this.options.events?.onPeerTyping?.(typing, activity));
|
|
19282
19777
|
/** Mini-apps on this session (`apps/1`): this side's open apps (kept across sessions), the peer's, the limits. */
|
|
19283
19778
|
apps;
|
|
19779
|
+
/** The read lane on this session (`app-ranges/1`): what this side serves and what it asked; none of it outlives the session. */
|
|
19780
|
+
appRanges = new AppRanges((frame) => {
|
|
19781
|
+
if (this.supportsAppRanges && this.channel) try {
|
|
19782
|
+
this.channel.send(JSON.stringify(frame));
|
|
19783
|
+
} catch {}
|
|
19784
|
+
});
|
|
19284
19785
|
/** Reaction frames the contact may send per window; the rest go unconfirmed and come again. */
|
|
19285
19786
|
reactionsReceived = new ReactionWindow(REACTION_LIMITS.receive);
|
|
19286
19787
|
/** Pin frames the contact may send per window; the rest go unconfirmed and come again. */
|
|
@@ -22011,6 +22512,7 @@ var GhostLink = class {
|
|
|
22011
22512
|
if (this.options.buttonsSupport) offered.push(BUTTONS_CAPABILITY);
|
|
22012
22513
|
if (this.options.upgradeSupport) offered.push(UPGRADE_CAPABILITY);
|
|
22013
22514
|
if (this.options.appsSupport) offered.push(APPS_CAPABILITY);
|
|
22515
|
+
if (this.options.appsSupport && this.options.appRangesSupport) offered.push(APP_RANGES_CAPABILITY);
|
|
22014
22516
|
if (this.options.deviceCapabilities) offered.push(...this.options.deviceCapabilities);
|
|
22015
22517
|
return offered;
|
|
22016
22518
|
}
|
|
@@ -22133,7 +22635,7 @@ var GhostLink = class {
|
|
|
22133
22635
|
if (!this.options.params.profile) return "Edits need a current chat";
|
|
22134
22636
|
if (this.channel && this.isDataLinkOpen) {
|
|
22135
22637
|
if (!this.supportsEdits) return "Your contact's app does not show edits yet";
|
|
22136
|
-
if (!validEditNumber(edit.e) && !(edit.sc && this.supportsStatusCards)) return "Your contact's app takes no more edits of this message";
|
|
22638
|
+
if (!edit.rm && !validEditNumber(edit.e) && !(edit.sc && this.supportsStatusCards)) return "Your contact's app takes no more edits of this message";
|
|
22137
22639
|
try {
|
|
22138
22640
|
this.channel.send(editFrame(edit));
|
|
22139
22641
|
return null;
|
|
@@ -22142,6 +22644,7 @@ var GhostLink = class {
|
|
|
22142
22644
|
}
|
|
22143
22645
|
}
|
|
22144
22646
|
if (edit.sc) return "A card's update goes when you are live";
|
|
22647
|
+
if (edit.rm) return "A removal goes when you are live";
|
|
22145
22648
|
if (dht && this.dht && this.textDelivery === "dht") return this.dht.send(edit.m, edit.ts, dhtEditId(edit.id, edit.e), void 0, [edit.id, edit.e]);
|
|
22146
22649
|
return "Edits go when you are live";
|
|
22147
22650
|
}
|
|
@@ -22199,6 +22702,7 @@ var GhostLink = class {
|
|
|
22199
22702
|
closeApp(app) {
|
|
22200
22703
|
const frame = JSON.stringify(appCloseFrame(app));
|
|
22201
22704
|
if (!this.apps.open.delete(app)) return;
|
|
22705
|
+
this.appRanges.closeApp(app, "offline");
|
|
22202
22706
|
if (this.supportsApps && this.channel) try {
|
|
22203
22707
|
this.channel.send(frame);
|
|
22204
22708
|
} catch {}
|
|
@@ -22233,8 +22737,98 @@ var GhostLink = class {
|
|
|
22233
22737
|
if (files) files.appAhead = Math.min(files.appAhead + frame.length, APP_AHEAD_OF_FILES + APP_DATA_MAX_BYTES);
|
|
22234
22738
|
return null;
|
|
22235
22739
|
}
|
|
22740
|
+
/** Both sides offer `app-ranges/1` (and `apps/1`) on the open session: an app's files can be read from the other side. */
|
|
22741
|
+
get supportsAppRanges() {
|
|
22742
|
+
return this.supportsApps && this.sessionCapabilities.agreed("app-ranges/1");
|
|
22743
|
+
}
|
|
22744
|
+
/** Why the read lane cannot be used for `app` now, or null when it can: open on both sides, on a live session that has it. */
|
|
22745
|
+
appRangesRefusal(app) {
|
|
22746
|
+
if (!this.apps.open.has(app)) return "not-open";
|
|
22747
|
+
if (!this.channel || !this.isDataLinkOpen) return "offline";
|
|
22748
|
+
return this.supportsAppRanges && this.apps.peerOpen.has(app) ? null : "peer-closed";
|
|
22749
|
+
}
|
|
22750
|
+
/**
|
|
22751
|
+
* Lets the contact's `app` read `file` (what this side's app calls it) for as long as both have the app open on this
|
|
22752
|
+
* session: the serve id to tell it, or why not.
|
|
22753
|
+
*/
|
|
22754
|
+
serveAppFile(app, file) {
|
|
22755
|
+
const error = this.appRangesRefusal(app);
|
|
22756
|
+
return error ? { error } : { serve: this.appRanges.serve(app, file) };
|
|
22757
|
+
}
|
|
22758
|
+
/** Ends a serve; false when it was not served (any more). */
|
|
22759
|
+
unserveAppFile(serve) {
|
|
22760
|
+
return this.appRanges.unserve(serve);
|
|
22761
|
+
}
|
|
22762
|
+
/** The serve ids `app` has given out on this session. */
|
|
22763
|
+
appServes(app) {
|
|
22764
|
+
return this.appRanges.servesOf(app);
|
|
22765
|
+
}
|
|
22766
|
+
/**
|
|
22767
|
+
* Reads `length` bytes at `offset` of what the contact's `app` serves as `serve`: the bytes (fewer at the end of the
|
|
22768
|
+
* file) and the file's size. Rejects with an `Error` whose message is an `AppRangeReadError` or `not-open`.
|
|
22769
|
+
*/
|
|
22770
|
+
readAppRange(app, serve, offset, length) {
|
|
22771
|
+
const error = this.appRangesRefusal(app);
|
|
22772
|
+
return error ? Promise.reject(new Error(error)) : this.appRanges.read(app, serve, offset, length);
|
|
22773
|
+
}
|
|
22774
|
+
/**
|
|
22775
|
+
* The bytes `task` asked for (fewer at the end of the file, none past it) and the file's size: sent in chunks as the
|
|
22776
|
+
* channel has room, sharing files' line (`filesWritable`), as binary messages where `files/4` is agreed, then
|
|
22777
|
+
* `ar-end`. Stops when the task is no longer live or the session changes.
|
|
22778
|
+
*/
|
|
22779
|
+
async sendAppRange(task, bytes, size) {
|
|
22780
|
+
bytes = bytes.subarray(0, task.length);
|
|
22781
|
+
const channel = this.channel;
|
|
22782
|
+
try {
|
|
22783
|
+
if (!channel) return;
|
|
22784
|
+
for (let at = 0; at < bytes.length; at += APP_RANGE_LIMITS.chunkBytes) {
|
|
22785
|
+
for (let room = this.filesWritable(); room; room = this.channel === channel ? this.filesWritable() : void 0) await room;
|
|
22786
|
+
if (!task.live || this.channel !== channel || !this.supportsAppRanges) return;
|
|
22787
|
+
const chunk = bytes.subarray(at, at + APP_RANGE_LIMITS.chunkBytes);
|
|
22788
|
+
const message = this.supportsBinaryFiles ? encodeAppRangeData(task.app, task.request, task.offset + at, chunk) : JSON.stringify(appRangeDataFrame(task.app, task.request, task.offset + at, chunk));
|
|
22789
|
+
try {
|
|
22790
|
+
channel.send(message);
|
|
22791
|
+
} catch {
|
|
22792
|
+
await new Promise((resolve) => setTimeout(resolve, FILE_LIMITS.sendRetryMs));
|
|
22793
|
+
at -= APP_RANGE_LIMITS.chunkBytes;
|
|
22794
|
+
continue;
|
|
22795
|
+
}
|
|
22796
|
+
this.filesWrote(channel, typeof message === "string" ? message.length : message.byteLength);
|
|
22797
|
+
}
|
|
22798
|
+
this.appRanges.finish(task, size);
|
|
22799
|
+
} finally {
|
|
22800
|
+
this.appRanges.release(task);
|
|
22801
|
+
}
|
|
22802
|
+
}
|
|
22803
|
+
/** `task`'s file cannot be read: `changed` or `gone` goes in place of its bytes (nothing once it is no longer live, but its place frees). */
|
|
22804
|
+
failAppRange(task, error) {
|
|
22805
|
+
this.appRanges.fail(task, error);
|
|
22806
|
+
}
|
|
22807
|
+
/** An `ar-*` frame from the contact, on a session that agreed `app-ranges/1`. */
|
|
22808
|
+
receiveAppRange(frame) {
|
|
22809
|
+
const read = readAppRangeFrame(frame);
|
|
22810
|
+
if (!read.ok) return;
|
|
22811
|
+
const ranges = read.frame;
|
|
22812
|
+
switch (ranges.t) {
|
|
22813
|
+
case "ar-get": {
|
|
22814
|
+
if (this.appRangesRefusal(ranges.a)) {
|
|
22815
|
+
try {
|
|
22816
|
+
this.channel?.send(JSON.stringify(appRangeErrorFrame(ranges.a, ranges.r, "not-served")));
|
|
22817
|
+
} catch {}
|
|
22818
|
+
return;
|
|
22819
|
+
}
|
|
22820
|
+
const task = this.appRanges.receiveGet(ranges);
|
|
22821
|
+
if (task) this.options.events?.onAppRangeTask?.(task);
|
|
22822
|
+
return;
|
|
22823
|
+
}
|
|
22824
|
+
case "ar-cancel": return this.appRanges.receiveCancel(ranges);
|
|
22825
|
+
case "ar-data": return this.appRanges.receiveData(ranges.a, ranges.r, ranges.o, appRangeChunk(ranges.d));
|
|
22826
|
+
default: return this.appRanges.receiveAnswer(ranges);
|
|
22827
|
+
}
|
|
22828
|
+
}
|
|
22236
22829
|
/** What the contact had open is gone (`apps/1` is no longer agreed, or this link stopped): each app hears it now. */
|
|
22237
22830
|
appsEnded() {
|
|
22831
|
+
this.appRanges.reset();
|
|
22238
22832
|
if (this.appsGrace) {
|
|
22239
22833
|
clearTimeout(this.appsGrace);
|
|
22240
22834
|
this.appsGrace = null;
|
|
@@ -22248,6 +22842,7 @@ var GhostLink = class {
|
|
|
22248
22842
|
* hears only that open, not a close first; one not said again by then is closed with `offline`.
|
|
22249
22843
|
*/
|
|
22250
22844
|
appsSuspended() {
|
|
22845
|
+
this.appRanges.reset();
|
|
22251
22846
|
this.apps.sessionSuspended();
|
|
22252
22847
|
if (!this.apps.holding || this.appsGrace) return;
|
|
22253
22848
|
this.appsGrace = setTimeout(() => {
|
|
@@ -22413,6 +23008,7 @@ var GhostLink = class {
|
|
|
22413
23008
|
if (!this.supportsApps) this.appsEnded();
|
|
22414
23009
|
this.options.events?.onAppsSupport?.(this.supportsApps);
|
|
22415
23010
|
}
|
|
23011
|
+
if (changed.includes("app-ranges/1") && !this.supportsAppRanges) this.appRanges.reset();
|
|
22416
23012
|
const devices = this.options.deviceCapabilities;
|
|
22417
23013
|
if (devices && changed.some((capability) => devices.includes(capability))) this.options.events?.onDeviceCapabilities?.(devices.filter((capability) => this.supportsDevice(capability)));
|
|
22418
23014
|
this.emitPairingState();
|
|
@@ -22957,6 +23553,11 @@ var GhostLink = class {
|
|
|
22957
23553
|
this.heardFromPeer();
|
|
22958
23554
|
this.framesHeard++;
|
|
22959
23555
|
if (typeof data !== "string") {
|
|
23556
|
+
if (data[0] === 5) {
|
|
23557
|
+
const range = this.supportsAppRanges && this.supportsBinaryFiles ? decodeAppRangeData(data) : null;
|
|
23558
|
+
if (range) this.appRanges.receiveData(range.a, range.r, range.o, range.data);
|
|
23559
|
+
return;
|
|
23560
|
+
}
|
|
22960
23561
|
const chunk = this.supportsBinaryFiles ? decodeFileData(data) : null;
|
|
22961
23562
|
if (!chunk) return;
|
|
22962
23563
|
this.activityAt = Date.now();
|
|
@@ -23104,9 +23705,14 @@ var GhostLink = class {
|
|
|
23104
23705
|
if (frame?.t === "paired-app") {
|
|
23105
23706
|
if (!this.supportsApps) return;
|
|
23106
23707
|
const event = this.apps.receive(frame);
|
|
23708
|
+
if (event && "o" in event && event.o === "close") this.appRanges.closeApp(event.app);
|
|
23107
23709
|
if (event) this.options.events?.onAppFrame?.(event);
|
|
23108
23710
|
return;
|
|
23109
23711
|
}
|
|
23712
|
+
if (APP_RANGE_FRAMES.has(String(frame?.t))) {
|
|
23713
|
+
if (this.supportsAppRanges) this.receiveAppRange(frame);
|
|
23714
|
+
return;
|
|
23715
|
+
}
|
|
23110
23716
|
if (frame?.t === "paired-reaction") {
|
|
23111
23717
|
if (!this.supportsReactions || !this.reactionsReceived.take()) return;
|
|
23112
23718
|
const reaction = parseReactionFrame(frame);
|
|
@@ -27411,6 +28017,10 @@ var wireMentions = (mentions) => mentions.map(({ k, o, l }) => ({
|
|
|
27411
28017
|
* `sc` is the status card of this version (WISP 405 · Status Cards); an edit with one may be numbered up to
|
|
27412
28018
|
* `STATUS_CARD_LIMITS.edits`, one without only up to `MAX_EDITS_PER_MESSAGE`.
|
|
27413
28019
|
*
|
|
28020
|
+
* A removal (WISP 400 § Delete for everyone) is an edit with `rm: true` and a fallback text, nothing else beside it,
|
|
28021
|
+
* numbered up to `MAX_REMOVAL_NUMBER`: in a mesh group's box as `{ "text", "rm": true }`, in a community's frame beside
|
|
28022
|
+
* `text`. A `rm` other than `true` is no edit.
|
|
28023
|
+
*
|
|
27414
28024
|
* Older apps drop both: a mesh session ignores a `t` it does not know, a community app the `x` frames it does not know.
|
|
27415
28025
|
*/
|
|
27416
28026
|
var GROUP_EDIT_FRAME = "group-edit";
|
|
@@ -27440,6 +28050,14 @@ function validEditText(text) {
|
|
|
27440
28050
|
}
|
|
27441
28051
|
/** The `x` frame a community edit travels as. */
|
|
27442
28052
|
function communityEditFrame(edit) {
|
|
28053
|
+
if (edit.rm) return {
|
|
28054
|
+
t: COMMUNITY_EDIT_FRAME,
|
|
28055
|
+
id: edit.id,
|
|
28056
|
+
v: edit.e,
|
|
28057
|
+
ts: edit.ts,
|
|
28058
|
+
text: edit.m,
|
|
28059
|
+
rm: true
|
|
28060
|
+
};
|
|
27443
28061
|
return {
|
|
27444
28062
|
t: COMMUNITY_EDIT_FRAME,
|
|
27445
28063
|
id: edit.id,
|
|
@@ -27457,9 +28075,17 @@ function communityEditFrame(edit) {
|
|
|
27457
28075
|
*/
|
|
27458
28076
|
function parseCommunityEdit(frame, sender) {
|
|
27459
28077
|
if (frame?.t !== "edit") return null;
|
|
27460
|
-
const { id, v, ts, text } = frame;
|
|
27461
|
-
if (
|
|
28078
|
+
const { id, v, ts, text, rm } = frame;
|
|
28079
|
+
if (rm !== void 0 && rm !== true) return null;
|
|
28080
|
+
if (typeof id !== "string" || communityMessageAuthor(id) !== sender || typeof v !== "number" || !(rm ? validRemovalNumber(v) : cardEditNumber(v))) return null;
|
|
27462
28081
|
if (typeof ts !== "number" || !Number.isSafeInteger(ts) || ts <= 0 || !validEditText(text)) return null;
|
|
28082
|
+
if (rm) return {
|
|
28083
|
+
id,
|
|
28084
|
+
e: v,
|
|
28085
|
+
ts,
|
|
28086
|
+
m: text,
|
|
28087
|
+
rm
|
|
28088
|
+
};
|
|
27463
28089
|
const sc = frame.sc === void 0 ? void 0 : readStatusCard(frame.sc);
|
|
27464
28090
|
if (!validEditNumber(v) && !sc) return null;
|
|
27465
28091
|
const k = validMentions(frame.m, text, false);
|
|
@@ -27859,7 +28485,7 @@ var editSigned = (f) => utf8Encode(JSON.stringify([
|
|
|
27859
28485
|
function isEditFrame(v) {
|
|
27860
28486
|
if (!v || typeof v !== "object") return false;
|
|
27861
28487
|
const f = v;
|
|
27862
|
-
return f.t === "group-edit" && typeof f.g === "string" && GROUP_ID.test(f.g) && Number.isSafeInteger(f.e) && f.e >= 0 && typeof f.s === "string" && MEMBER_KEY.test(f.s) && Number.isSafeInteger(f.n) && f.n >= 0 &&
|
|
28488
|
+
return f.t === "group-edit" && typeof f.g === "string" && GROUP_ID.test(f.g) && Number.isSafeInteger(f.e) && f.e >= 0 && typeof f.s === "string" && MEMBER_KEY.test(f.s) && Number.isSafeInteger(f.n) && f.n >= 0 && validRemovalNumber(f.v) && Number.isSafeInteger(f.ts) && f.ts > 0 && typeof f.nn === "string" && f.nn.length === 32 && B64$1.test(f.nn) && typeof f.c === "string" && f.c.length <= MAX_EDIT_BOX && B64$1.test(f.c) && typeof f.sig === "string" && f.sig.length === 86 && B64$1.test(f.sig);
|
|
27863
28489
|
}
|
|
27864
28490
|
/**
|
|
27865
28491
|
* Where a frame said again was first said (`o`): an earlier epoch than the frame's own and a sequence number there, or
|
|
@@ -28197,13 +28823,24 @@ var GroupSession = class {
|
|
|
28197
28823
|
return this.roster.map(([k]) => k).filter((k) => k !== this.myKey);
|
|
28198
28824
|
}
|
|
28199
28825
|
/**
|
|
28200
|
-
* Whether `key` could read message `messageId` (`<s>:<e>:<n>`) and still can: in the roster
|
|
28201
|
-
*
|
|
28826
|
+
* Whether `key` could read message `messageId` (`<s>:<e>:<n>`) and still can: in the roster now, and in the roster of
|
|
28827
|
+
* its epoch or, given the message's time `ts`, in the roster of the epoch its author, behind on the chain, said it
|
|
28828
|
+
* again under (`saidAgainEpoch`): the newest after its own that comes before any `add` dated later than it. That
|
|
28829
|
+
* member read it under its first id. A holder serves a group file only to such a member (WISP 503 § Asking).
|
|
28202
28830
|
*/
|
|
28203
|
-
couldRead(key, messageId) {
|
|
28831
|
+
couldRead(key, messageId, ts) {
|
|
28204
28832
|
const e = Number(messageId.split(":")[1]);
|
|
28205
28833
|
const then = this.state.chain.find((c) => c.e === e);
|
|
28206
|
-
|
|
28834
|
+
if (!then || !rosterHas(this.roster, key)) return false;
|
|
28835
|
+
if (rosterHas(then.m, key)) return true;
|
|
28836
|
+
if (ts === void 0) return false;
|
|
28837
|
+
let again;
|
|
28838
|
+
for (let later = e + 1; later <= this.epoch; later++) {
|
|
28839
|
+
const c = this.state.chain[later];
|
|
28840
|
+
if (!c || c.k === "add" && c.ts > ts) break;
|
|
28841
|
+
again = c;
|
|
28842
|
+
}
|
|
28843
|
+
return !!again && rosterHas(again.m, key);
|
|
28207
28844
|
}
|
|
28208
28845
|
role(key) {
|
|
28209
28846
|
return this.roster.find(([k]) => k === key)?.[1];
|
|
@@ -28828,12 +29465,15 @@ var GroupSession = class {
|
|
|
28828
29465
|
const ref = meshMessageRef(messageId);
|
|
28829
29466
|
const commit = ref && this.state.chain[ref.e];
|
|
28830
29467
|
if (!ref || ref.s !== this.myKey || !commit || !rosterHas(commit.m, this.myKey)) return { error: "Only your own messages can be edited" };
|
|
28831
|
-
if (!(edit.card ? cardEditNumber(edit.v) : validEditNumber(edit.v))) return { error: "This message was edited too many times" };
|
|
29468
|
+
if (!(edit.remove ? validRemovalNumber(edit.v) : edit.card ? cardEditNumber(edit.v) : validEditNumber(edit.v))) return { error: "This message was edited too many times" };
|
|
28832
29469
|
const text = edit.text.trim();
|
|
28833
29470
|
if (!validEditText(text)) return { error: text ? "Message exceeds 16 KiB" : "An edit cannot be empty" };
|
|
28834
29471
|
if (!this.secret(ref.e)) return { error: "This message is too old to edit: its epoch's key is gone" };
|
|
28835
29472
|
const named = validMentions(wireMentions(edit.mentions ?? []), text, rosterAdmin(commit.m) === this.myKey && this.isAdmin);
|
|
28836
|
-
const plain = JSON.stringify({
|
|
29473
|
+
const plain = JSON.stringify(edit.remove ? {
|
|
29474
|
+
text,
|
|
29475
|
+
rm: true
|
|
29476
|
+
} : {
|
|
28837
29477
|
text,
|
|
28838
29478
|
...named.length ? { m: named } : {},
|
|
28839
29479
|
...edit.card ? { sc: edit.card } : {}
|
|
@@ -29230,9 +29870,12 @@ var GroupSession = class {
|
|
|
29230
29870
|
return;
|
|
29231
29871
|
}
|
|
29232
29872
|
if (!body || typeof body !== "object" || !validEditText(body.text)) return;
|
|
29233
|
-
|
|
29234
|
-
const
|
|
29235
|
-
if (!
|
|
29873
|
+
if (body.rm !== void 0 && body.rm !== true) return;
|
|
29874
|
+
const rm = body.rm === true;
|
|
29875
|
+
if (!rm && !cardEditNumber(raw.v)) return;
|
|
29876
|
+
const k = rm ? [] : validMentions(body.m, body.text, rosterAdmin(commit.m) === raw.s && this.admin === raw.s);
|
|
29877
|
+
const sc = rm || body.sc === void 0 ? void 0 : readStatusCard(body.sc);
|
|
29878
|
+
if (!rm && !validEditNumber(raw.v) && !sc) return;
|
|
29236
29879
|
const copy = this.kept().find((f) => f.s === raw.s && f.e === raw.e && f.n === raw.n);
|
|
29237
29880
|
const first = copy && readFirstPlace(copy.o, copy.e);
|
|
29238
29881
|
await this.hooks.edit?.({
|
|
@@ -29242,7 +29885,8 @@ var GroupSession = class {
|
|
|
29242
29885
|
ts: raw.ts,
|
|
29243
29886
|
m: body.text,
|
|
29244
29887
|
...k.length ? { k } : {},
|
|
29245
|
-
...sc ? { sc } : {}
|
|
29888
|
+
...sc ? { sc } : {},
|
|
29889
|
+
...rm ? { rm: true } : {}
|
|
29246
29890
|
});
|
|
29247
29891
|
if (this.keepEdit(raw)) {
|
|
29248
29892
|
await this.persist();
|
|
@@ -30009,12 +30653,16 @@ var FRESH = /* @__PURE__ */ new Set([
|
|
|
30009
30653
|
* history keeps room for everyone else to get out after it: two commits a member (a leave or a remove is one, and a
|
|
30010
30654
|
* leaving admin hands the role over first). The history is never compacted, and one that filled with people in it
|
|
30011
30655
|
* took no leave, remove or handover any more. Its own rule: a history up to `COMMUNITY_LIMITS.chain` verifies as before.
|
|
30656
|
+
* A member takes in such a commit from someone else only when it keeps that room too (`receiveCommit`): an app that
|
|
30657
|
+
* does not keep it could otherwise fill the history for everyone.
|
|
30012
30658
|
*/
|
|
30013
30659
|
var GROWS = /* @__PURE__ */ new Set([
|
|
30014
30660
|
"add",
|
|
30015
30661
|
"rotate",
|
|
30016
30662
|
"link"
|
|
30017
30663
|
]);
|
|
30664
|
+
/** Whether a history whose last commit is at `epoch`, with `roster` in it, still has room for everyone else to get out. */
|
|
30665
|
+
var keepsRoom = (epoch, roster) => epoch + 1 + 2 * (roster.length - 1) <= COMMUNITY_LIMITS.chain;
|
|
30018
30666
|
/**
|
|
30019
30667
|
* Kinds only the admin commits. They are final: a branch that drops one never replaces the branch
|
|
30020
30668
|
* that has it, however long, so no member can undo a removal, a hand-over, a rotation or a link change
|
|
@@ -30076,6 +30724,30 @@ var leftStatement = (g, h, hi) => utf8Encode(JSON.stringify([
|
|
|
30076
30724
|
Object.entries(hi).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0)
|
|
30077
30725
|
]));
|
|
30078
30726
|
var LEFT_EPOCH = /^\d{1,15}:[a-f0-9]{16}$/;
|
|
30727
|
+
/** A leave of one admission: `h` is the hash of the commit that last put `s` in the roster (its `add`, or the `create` it signed). */
|
|
30728
|
+
var leaveStatement3 = (g, s, h) => utf8Encode(JSON.stringify([
|
|
30729
|
+
"ghostly-group/3 leave",
|
|
30730
|
+
g,
|
|
30731
|
+
s,
|
|
30732
|
+
h
|
|
30733
|
+
]));
|
|
30734
|
+
/**
|
|
30735
|
+
* Whether a leave holds after `before` (the commits before it, newest first): its `ls3` names the commit that last
|
|
30736
|
+
* admitted the leaver, or, from an app that signs no such statement, no earlier leave carries its `ls`. `ls` says the
|
|
30737
|
+
* same for every admission of a member, so by itself it ends one admission only.
|
|
30738
|
+
*/
|
|
30739
|
+
function leaveStands(leave, before) {
|
|
30740
|
+
if (!leave.s || !leave.ls) return false;
|
|
30741
|
+
let admitted = false;
|
|
30742
|
+
for (const c of before) {
|
|
30743
|
+
if (!admitted && (c.k === "add" && c.s === leave.s || c.k === "create" && c.by === leave.s)) {
|
|
30744
|
+
admitted = true;
|
|
30745
|
+
if (leave.ls3 && SIG.test(leave.ls3) && verify(fromBase64Url(leave.ls3), leaveStatement3(leave.g, leave.s, communityCommitHash(c)), publicKeyFromZ32(leave.s))) return true;
|
|
30746
|
+
}
|
|
30747
|
+
if (c.k === "leave" && c.ls === leave.ls) return false;
|
|
30748
|
+
}
|
|
30749
|
+
return true;
|
|
30750
|
+
}
|
|
30079
30751
|
/** The secret of an epoch that adds, re-roles or re-links: from the previous one and the commit. */
|
|
30080
30752
|
function derivedSecret(previous, untaggedHash) {
|
|
30081
30753
|
return hkdf(sha256, previous, utf8Encode(untaggedHash), utf8Encode("ghostly-group/2 derived"), 32);
|
|
@@ -30101,6 +30773,7 @@ function parseCommit(raw) {
|
|
|
30101
30773
|
if (c.x !== void 0) out.x = c.x;
|
|
30102
30774
|
if (c.n !== void 0) out.n = c.n;
|
|
30103
30775
|
if (c.ls !== void 0) out.ls = c.ls;
|
|
30776
|
+
if (out.k === "leave" && typeof c.ls3 === "string" && SIG.test(c.ls3)) out.ls3 = c.ls3;
|
|
30104
30777
|
return out;
|
|
30105
30778
|
}
|
|
30106
30779
|
/**
|
|
@@ -30133,15 +30806,18 @@ function communityRoster(previous, c, trusted = false) {
|
|
|
30133
30806
|
/**
|
|
30134
30807
|
* One commit against its parent (null for a genesis) and the parent's roster: shape, id, link,
|
|
30135
30808
|
* authority, roster arithmetic, roster hash and signature. The confirmation tag is checked once
|
|
30136
|
-
* the secret is known.
|
|
30809
|
+
* the secret is known. `before`: the commits before it on its branch, newest first; given, a `leave` is held to the
|
|
30810
|
+
* admission it ends (`leaveStands`). A member gives it for every commit it takes in after its own admission; the chain
|
|
30811
|
+
* of a welcome is not held to it (`verifyCommunityChain`).
|
|
30137
30812
|
*/
|
|
30138
|
-
function verifyCommunityCommit(raw, parent, parentRoster, groupId) {
|
|
30813
|
+
function verifyCommunityCommit(raw, parent, parentRoster, groupId, before) {
|
|
30139
30814
|
const commit = parseCommit(raw);
|
|
30140
30815
|
if (!commit) return { error: "Malformed membership commit" };
|
|
30141
30816
|
if (groupId && commit.g !== groupId) return { error: "Commit for another group" };
|
|
30142
30817
|
if (parent) {
|
|
30143
30818
|
if (commit.g !== parent.g) return { error: "Commit for another group" };
|
|
30144
30819
|
if (commit.e !== parent.e + 1) return { error: "Commit out of sequence" };
|
|
30820
|
+
if (commit.e >= COMMUNITY_LIMITS.chain) return { error: "Membership chain too long" };
|
|
30145
30821
|
if (commit.p !== communityCommitHash(parent)) return { error: "Commit does not follow its parent" };
|
|
30146
30822
|
} else {
|
|
30147
30823
|
if (commit.e !== 0 || commit.p !== "" || commit.k !== "create") return { error: "The chain does not start with the creation of the group" };
|
|
@@ -30151,6 +30827,7 @@ function verifyCommunityCommit(raw, parent, parentRoster, groupId) {
|
|
|
30151
30827
|
if (commit.k !== "leave" && commit.ls !== void 0) return { error: "Malformed membership commit" };
|
|
30152
30828
|
const roster = communityRoster(parent ? parentRoster : null, commit);
|
|
30153
30829
|
if (!roster) return { error: "Unauthorized or inconsistent membership change" };
|
|
30830
|
+
if (commit.k === "leave" && before && !leaveStands(commit, before)) return { error: "This leave is not for the member's current admission" };
|
|
30154
30831
|
if (rosterHash(roster) !== commit.m) return { error: "The roster hash does not match the change" };
|
|
30155
30832
|
if (!verify(fromBase64Url(commit.sig), utf8Encode(tuple(commit)), publicKeyFromZ32(commit.by))) return { error: "Membership commit signature is invalid" };
|
|
30156
30833
|
return {
|
|
@@ -30158,7 +30835,11 @@ function verifyCommunityCommit(raw, parent, parentRoster, groupId) {
|
|
|
30158
30835
|
roster
|
|
30159
30836
|
};
|
|
30160
30837
|
}
|
|
30161
|
-
/**
|
|
30838
|
+
/**
|
|
30839
|
+
* A whole chain from its genesis; the rosters after each commit and the entry key at the end. What a newcomer is
|
|
30840
|
+
* handed: a `leave` in it is not held to the admission it ends, since a chain from before 2026-10-10 may hold a
|
|
30841
|
+
* member's second leave under the one statement there was, and no newcomer could enter that group again.
|
|
30842
|
+
*/
|
|
30162
30843
|
function verifyCommunityChain(raw, groupId) {
|
|
30163
30844
|
if (!Array.isArray(raw) || raw.length === 0 || raw.length > COMMUNITY_LIMITS.chain) return { error: "Malformed membership chain" };
|
|
30164
30845
|
const chain = [], rosters = [];
|
|
@@ -30649,13 +31330,17 @@ var CommunitySession = class {
|
|
|
30649
31330
|
placeSide(commit) {
|
|
30650
31331
|
const parent = this.known.get(commit.p), parentRoster = parent ? this.rosterAt(commit.p) : void 0;
|
|
30651
31332
|
if (!parentRoster || !parent) return false;
|
|
30652
|
-
const result = verifyCommunityCommit(commit, parent, parentRoster, this.id);
|
|
31333
|
+
const result = verifyCommunityCommit(commit, parent, parentRoster, this.id, this.ancestry(commit.p));
|
|
30653
31334
|
if ("error" in result) return false;
|
|
30654
31335
|
const h = communityCommitHash(result.commit);
|
|
30655
31336
|
this.known.set(h, result.commit);
|
|
30656
31337
|
this.rosters.set(h, result.roster);
|
|
30657
31338
|
return true;
|
|
30658
31339
|
}
|
|
31340
|
+
/** The commit `h` and those before it on its branch, newest first. */
|
|
31341
|
+
*ancestry(h) {
|
|
31342
|
+
for (let c = this.known.get(h); c; c = this.known.get(c.p)) yield c;
|
|
31343
|
+
}
|
|
30659
31344
|
rosterOf(h) {
|
|
30660
31345
|
return this.rosterAt(h);
|
|
30661
31346
|
}
|
|
@@ -30778,8 +31463,9 @@ var CommunitySession = class {
|
|
|
30778
31463
|
}
|
|
30779
31464
|
const parsed = parseCommit(raw);
|
|
30780
31465
|
if (!parsed || this.known.has(communityCommitHash(parsed))) return false;
|
|
30781
|
-
const result = verifyCommunityCommit(raw, parent, parentRoster, this.id);
|
|
31466
|
+
const result = verifyCommunityCommit(raw, parent, parentRoster, this.id, this.ancestry(p));
|
|
30782
31467
|
if ("error" in result) return false;
|
|
31468
|
+
if (GROWS.has(result.commit.k) && !keepsRoom(result.commit.e, result.roster)) return false;
|
|
30783
31469
|
const commit = result.commit, h = communityCommitHash(commit);
|
|
30784
31470
|
const admin = rosterAdmin(parentRoster);
|
|
30785
31471
|
if (commit.by === admin) {
|
|
@@ -31010,8 +31696,8 @@ var CommunitySession = class {
|
|
|
31010
31696
|
ts: now
|
|
31011
31697
|
};
|
|
31012
31698
|
const roster = communityRoster(this.roster, draftBase);
|
|
31013
|
-
if (!roster) throw new Error("This change is not allowed");
|
|
31014
|
-
if (GROWS.has(kind) &&
|
|
31699
|
+
if (!roster || kind === "leave" && !leaveStands(draftBase, this.ancestry(parentHash))) throw new Error("This change is not allowed");
|
|
31700
|
+
if (GROWS.has(kind) && !keepsRoom(draftBase.e, roster)) throw new Error("This group has reached its membership history limit. Create a new group.");
|
|
31015
31701
|
const draft = {
|
|
31016
31702
|
...draftBase,
|
|
31017
31703
|
m: rosterHash(roster)
|
|
@@ -31181,6 +31867,10 @@ var CommunitySession = class {
|
|
|
31181
31867
|
s: this.myKey,
|
|
31182
31868
|
ls: toBase64Url(sign(leaveStatement(this.id, this.myKey), this.identity.seed))
|
|
31183
31869
|
};
|
|
31870
|
+
for (const c of this.ancestry(this.topHash)) if (c.k === "add" && c.s === this.myKey || c.k === "create" && c.by === this.myKey) {
|
|
31871
|
+
frame.ls3 = toBase64Url(sign(leaveStatement3(this.id, this.myKey, communityCommitHash(c)), this.identity.seed));
|
|
31872
|
+
break;
|
|
31873
|
+
}
|
|
31184
31874
|
this.hooks.broadcast(frame);
|
|
31185
31875
|
this.out("left", "You left this group");
|
|
31186
31876
|
await this.persist();
|
|
@@ -31202,7 +31892,8 @@ var CommunitySession = class {
|
|
|
31202
31892
|
try {
|
|
31203
31893
|
const { hash } = await this.commit("leave", {
|
|
31204
31894
|
s: request.s,
|
|
31205
|
-
ls: request.ls
|
|
31895
|
+
ls: request.ls,
|
|
31896
|
+
...request.ls3 ? { ls3: request.ls3 } : {}
|
|
31206
31897
|
}, now);
|
|
31207
31898
|
this.markLeft(hash, request.s);
|
|
31208
31899
|
done++;
|
|
@@ -31340,17 +32031,18 @@ var CommunitySession = class {
|
|
|
31340
32031
|
return this.serialize(async () => {
|
|
31341
32032
|
if (!this.isMember) return { error: this.state.statusReason ?? "You are not in this group" };
|
|
31342
32033
|
if (communityMessageAuthor(edit.id) !== this.myKey) return { error: "Only your own messages can be edited" };
|
|
31343
|
-
if (!(edit.card ? cardEditNumber(edit.v) : validEditNumber(edit.v))) return { error: "This message was edited too many times" };
|
|
32034
|
+
if (!(edit.remove ? validRemovalNumber(edit.v) : edit.card ? cardEditNumber(edit.v) : validEditNumber(edit.v))) return { error: "This message was edited too many times" };
|
|
31344
32035
|
const text = edit.text.trim();
|
|
31345
32036
|
if (!validEditText(text)) return { error: text ? "Message exceeds 16 KiB" : "An edit cannot be empty" };
|
|
31346
|
-
const named = validMentions(wireMentions(edit.mentions ?? []), text, false);
|
|
32037
|
+
const named = edit.remove ? [] : validMentions(wireMentions(edit.mentions ?? []), text, false);
|
|
31347
32038
|
const frame = communityEditFrame({
|
|
31348
32039
|
id: edit.id,
|
|
31349
32040
|
e: edit.v,
|
|
31350
32041
|
ts: edit.ts,
|
|
31351
32042
|
m: text,
|
|
31352
32043
|
k: named,
|
|
31353
|
-
...edit.card && { sc: edit.card }
|
|
32044
|
+
...edit.card && !edit.remove && { sc: edit.card },
|
|
32045
|
+
...edit.remove && { rm: true }
|
|
31354
32046
|
});
|
|
31355
32047
|
const room = COMMUNITY_LIMITS.textBytes + 256, clean = sanitizeNick(nick);
|
|
31356
32048
|
const size = (withNick) => utf8Encode(JSON.stringify(withNick && clean ? {
|
|
@@ -31600,11 +32292,27 @@ var CommunitySession = class {
|
|
|
31600
32292
|
receiveLeave(frame) {
|
|
31601
32293
|
const s = frame.s, ls = frame.ls;
|
|
31602
32294
|
if (typeof s !== "string" || !MEMBER_KEY.test(s) || typeof ls !== "string" || !SIG.test(ls) || !rosterHas(this.roster, s)) return false;
|
|
31603
|
-
|
|
32295
|
+
const ls3 = typeof frame.ls3 === "string" && SIG.test(frame.ls3) ? frame.ls3 : void 0;
|
|
32296
|
+
let held = this.state.pendingLeaves.find((r) => r.s === s);
|
|
32297
|
+
if (held && !leaveStands({
|
|
32298
|
+
g: this.id,
|
|
32299
|
+
...held
|
|
32300
|
+
}, this.ancestry(this.topHash))) {
|
|
32301
|
+
this.state.pendingLeaves = this.state.pendingLeaves.filter((r) => r !== held);
|
|
32302
|
+
held = void 0;
|
|
32303
|
+
}
|
|
32304
|
+
if (held && (held.ls3 || !ls3)) return false;
|
|
31604
32305
|
if (!verify(fromBase64Url(ls), leaveStatement(this.id, s), publicKeyFromZ32(s))) return false;
|
|
31605
|
-
|
|
32306
|
+
if (!leaveStands({
|
|
32307
|
+
g: this.id,
|
|
32308
|
+
s,
|
|
32309
|
+
ls,
|
|
32310
|
+
ls3
|
|
32311
|
+
}, this.ancestry(this.topHash))) return false;
|
|
32312
|
+
this.state.pendingLeaves = [...this.state.pendingLeaves.filter((r) => r !== held), {
|
|
31606
32313
|
s,
|
|
31607
|
-
ls
|
|
32314
|
+
ls,
|
|
32315
|
+
...ls3 ? { ls3 } : {}
|
|
31608
32316
|
}].slice(-COMMUNITY_LIMITS.pendingLeaves);
|
|
31609
32317
|
this.persistSoon();
|
|
31610
32318
|
return true;
|
|
@@ -32765,6 +33473,6 @@ function readX401SdJwtVc(text) {
|
|
|
32765
33473
|
};
|
|
32766
33474
|
}
|
|
32767
33475
|
//#endregion
|
|
32768
|
-
export { parseSshPublicKey as $, GROUP_MEMBER_CAP as $a, DEVICES_CAPABILITY as $c, DHT_MESSAGE_TTL as $i, bytesEqual as $l, readGroupWantNo as $n, handoffContextProof as $o, chatAppId as $r, knockSlotIdentity as $s, SEPOLIA_TEST_USDT_FAUCET as $t, knockRecords as A, wireReaction as Aa, isAppRef as Ac, capsDescriptors as Ai, RelaysFailedError as Al, findEndpoint as An, signalHasVideo as Ao, transferStalled as Ar, ENROLL_HELLO as As, didWebDocumentUrl as At, GROUP_READ_NOTE as B, appCardId as Ba, createContactLink as Bc, identityStatement as Bi, RELAY_PAYLOAD_MAX_BYTES as Bl, engineError as Bn, HANDOFF_OFFER as Bo, pinIsNewer as Br, readEnrollHello as Bs, staticDidDocument as Bt, decodeCommunityLink as C, ReactionWindow as Ca, APP_PREFIXES as Cc, recordsFromTxt as Ci, turnKeys as Cl, pubkyHomeserverOf as Cn, RTC_CONFIG as Co, readBeacon as Cr, readSetUpdate as Cs, DID_JWS_MAX_LENGTH as Ct, encodeGroupEntryLink as D, reactionIsNewer as Da, checkAppRevokeStatement as Dc, wellKnownUrl as Di, DEFAULT_RELAYS as Dl, ENDPOINT as Dn, callSignalHeardAt as Do, ChatFiles as Dr, verifySetUpdate as Ds, didGhostlyServiceEntry as Dt, decodeGroupEntryLink as E, reactionEmoji as Ea, appRef as Ec, txtValue as Ei, turnVerifierMark as El, decodeBolt11 as En, callRtcConfig as Eo, shouldBeHub as Er, signTombstone as Es, checkDidSignature as Et, groupWakeFrame as F, ITEM_STATES as Fa, parseImageMeta as Fc, IdentityCheckUnavailable as Fi, traceLink as Fl, INVITE_TAKEN as Fn, HANDOFF_ACK as Fo, typingActivity as Fr, enrollDoneFrame as Fs, normalizeDid as Ft, GROUP_EDIT_TEXT_BYTES as G, sameButtonText as Ga, readDeviceInvite as Gc, PeerProofs as Gi, createIdentity as Gl, GROUP_WANT_FRAME as Gn, HANDOFF_VERIFIED as Go, deviceWakeRequest as Gr, newInbox as Gs, encodeDidDhtPacket as Gt, frameBytes as H, cardLine as Ha, readContactLink as Hc, receivedIdentityStatus as Hi, newerPacket as Hl, parseEngineError as Hn, HANDOFF_PIECE_BYTES as Ho, readPin as Hr, clearMissed as Hs, didDhtDocument as Ht, groupWakes as I, PR_CHECKS as Ia, readImageMeta as Ic, IdentityExchange as Ii, budgetRetryMs as Il, LIVENESS_PING_MS as In, HANDOFF_CANCEL as Io, GROUP_PIN_FRAME as Ir, enrollGrantFrame as Is, parseDid as It, mentionsMember as J, claimedTime as Ja, decodeInviteCode as Jc, TRANSPORTS as Ji, publicKeyFromZ32 as Jl, groupFileFallback as Jn, handoffAttemptFailed as Jo, relayRequest as Jr, takeRequest as Js, ETHEREUM_USDT as Jt, carryMentions as K, statusCardText as Ka, OwnInviteError as Kc, emptyProofLedger as Ki, identityFromSeed as Kl, GROUP_WANT_NO_FRAME as Kn, filePartName as Ko, newWakeToken as Kr, planKnocks as Ks, resolveDidDht as Kt, parseGroupWakeFrame as L, PR_STATES as La, canonicalJson as Lc, boundVerifiedIdentity as Li, isDiscoveryBudgetError as Ll, PAIRED_FRAME_TOO_LARGE as Ln, HANDOFF_DONE as Lo, PIN_LIMITS as Lr, enrollHelloFrame as Ls, parseDidDocument as Lt, readKnocks as M, readReply as Ma, readAppRevocations as Mc, IDENTITY_MAX_EVIDENCE as Mi, currentRelays as Ml, parseCashuRequestPayload as Mn, HTTP_SERVICE_PROTO as Mo, TYPING_REFRESH_MS as Mr, enrollCancelFrame as Ms, didWebFileNames as Mt, GROUP_WAKE_FRAME as N, replySnippet as Na, signAppObject as Nc, IDENTITY_MAX_VALIDITY as Ni, normalizeRelayUrl as Nl, parseFedimintRequestPayload as Nn, LEGACY_SERVICES as No, TypingSender as Nr, enrollCancelReason as Ns, didWebFileUrl as Nt, entryParams as O, readReaction as Oa, isAppHash as Oc, CapsExchange as Oi, HEDGE_MS as Ol, cashuRequestPayload as On, extractParamsFromSdp as Oo, FILE_LIMITS as Or, ENROLL_DONE as Os, didJwsAlg as Ot, GroupWakeLimiter as P, BUTTON_ID as Pa, signAppRevocation as Pc, IDENTITY_REVOCATION_LABEL as Pi, setLinkTraceSink as Pl, GhostLink as Pn, serviceIdFromName as Po, sanitizeTypingStatus as Pr, enrollDigits as Ps, didWebHost as Pt, SshSigError as Q, GROUP_ADMIN_OFF_ERROR as Qa, ownInviteRefusal as Qc, DHT_FILE_TOO_LARGE as Qi, sanitizeDisplayText as Ql, readGroupWant as Qn, handoffContext as Qo, APP_DATA_MAX_BYTES as Qr, contactDay as Qs, SEPOLIA_TEST_USDT as Qt, GROUP_LIMITS as R, RUN_RESULTS as Ra, canonicalJsonBytes as Rc, emptyIdentityLedger as Ri, withRequestOptions as Rl, pairedMessageFits as Rn, HANDOFF_HAVE as Ro, mayPin as Rr, enrollProofFrame as Rs, parseDidSignaturePaste as Rt, communityHasFrame as S, REACTION_LIMITS as Sa, sha256Paced as Sc, normalizeDomain as Si, turnInstance as Sl, homeserverWebEndpoint as Sn, CALL_SIGNAL_MAX_AGE_MS as So, rankHubs as Sr, SET_UPDATE as Ss, DID_FILE_MAX_BYTES as St, KNOCK_TTL_MS as T, queueReaction as Ta, appFingerprint as Tc, recordsName as Ti, turnStatedVerifier as Tl, resolveLightningDestination as Tn, buildSdpFromSignal as To, readLobby as Tr, setUpdateFrame as Ts, checkDidJws as Tt, COMMUNITY_EDIT_FRAME as U, cardUrl as Ua, createDeviceInvite as Uc, revokesIdentity as Ui, openRelayPayload as Ul, GROUP_FILE_LIMITS as Un, HANDOFF_REQUEST as Uo, WAKE_CALL_INTERVAL_MS as Ur, endedRequests as Us, didDhtFromPublicKey as Ut, GroupSession as V, buttonLabelClash as Va, encodeContactLink as Vc, newIdentityBinding as Vi, createRelayPayload as Vl, engineText as Vn, HANDOFF_PAKE as Vo, pinNumberHolds as Vr, verifyEnrollProof as Vs, strictBase64Url as Vt, GROUP_EDIT_FRAME as W, checkStatusCard as Wa, deviceInviteJoinerParams as Wc, lastSharedWithMe as Wi, parseRelayPayload as Wl, GROUP_HAVE_FRAME as Wn, HANDOFF_TIMINGS as Wo, WakeLimiter as Wr, inboxRecord as Ws, encodeDidDhtDeactivated as Wt, SSHSIG_MAX_ARMOR as X, receivedTimestamp as Xa, inviteLink as Xc, irohDescriptor as Xi, MAX_AVATAR_LENGTH as Xl, readGroupFileMeta as Xn, handoffBusyFrame as Xo, checkPushEndpoint as Xr, ContactRequestError as Xs, ONCHAIN_PROVIDER as Xt, groupName as Y, heardTime as Ya, encodeInviteCode as Yc, automaticTransport as Yi, verify as Yl, isGroupMessageId as Yn, handoffAttemptSucceeded as Yo, wakeRequest as Yr, turnOff as Ys, EVM_TEST_CHAINS as Yt, SSHSIG_NAMESPACE as Z, shownTime as Za, inviteOwnership as Zc, irohRelayUrl as Zi, sanitizeAvatar as Zl, readGroupHave as Zn, handoffCancelFrame as Zo, vapidKeysMatch as Zr, REQUEST_LIFETIME_MS as Zs, PaymentPreflightError as Zt, openGroupTyping as _, parseLinkPreview as _a, checkAppManifest as _c, domainTxtRecord as _i, firstDeviceSetSecret as _l, newPubkyProofFolder as _n, parseLocalTarget as _o, lobbyRecords as _r, readHandoffPake as _s, parseAtprotoDidDocument as _t, appStoreDecision as a, sanitizeMime as aa, openRequest as ac, UPGRADE_CAPABILITY as ai, deviceLinkPairing as al, assertWholeSats as an, rosterHas as ao, groupSignalFrame as ar, handoffOfferFrame as as, BitcoinAddressError as at, utf8Decode as au, CommunitySession as b, COMMUNITY_REACTION_FRAME as ba, readAppBundle as bc, isPublicAddress as bi, signTurnPacket as bl, pubkyProofFile as bn, decodeControl as bo, newerHead as br, sealHandoffPiece as bs, verifyAtprotoRecordProof as bt, planAppUpdate as c, baseMime as ca, requestRecords as cc, HOLD_LIMITS as ci, seedSigner as cl, walletNetworkOf as cn, DirectPathWatch as co, mayBeHub as cr, handoffRetryAfter as cs, ATPROTO_FULL_SCOPE as ct, readAppStore as d, voicePeaksOf as da, APP_BUNDLE_MAGIC as dc, isHoldUrl as di, TURN_RAISE_READ_TIMEOUT_MS as dl, sparkAddressKind as dn, EXPECT_PEER_MS as do, COMMUNITY_TOPOLOGY as dr, newHandoffId as ds, atprotoDidMethod as dt, peekDhtMailbox as ea, knockSlotOf as ec, isAppVersion as ei, ENROLL_CAPABILITY as el, TEST_USDT_FAUCET_AMOUNT as en, MAX_GROUP_CHAIN as eo, CarriedTransport as er, handoffDataFrame as es, parseSshSignature as et, fromBase64Url as eu, readAppStoreSteps as f, parseVideoMeta as fa, APP_ICON_PATH as fc, newMailbox as fi, TURN_SETTLE_MS as fl, sparkInvoiceDetails as fn, RELAY_POLL_INTERVALS as fo, beaconKeys as fr, readHandoffAck as fs, atprotoProofRecord as ft, groupTypingEpoch as g, dhtEditId as ga, assembleAppBundle as gc, dnsProofName as gi, TURN_MAX as gl, isPubkyProofFolder as gn, formatLocalTarget as go, lobbyKeys as gr, readHandoffHello as gs, normalizeAtprotoHandle as gt, GroupTypingBoard as h, RateWindow as ha, appViewOf as hc, decodeDnsResponse as hi, TURN_LAST_SEQUENCE as hl, isPubkyKey as hn, GhostlyHttpError as ho, freshHubs as hr, readHandoffHave as hs, isAtprotoDid as ht, appRevocationFor as i, sanitizeFileName as ia, mergeContactKnocks as ic, STATUS_CARD_CAPABILITY as ii, deviceKeyZ32 as il, assertTokenUnits as in, rosterAdmin as io, SIGNAL_REPLY_MS as ir, handoffManifestFrames as is, verifyBitcoinMessage as it, toZ32 as iu, mergeKnocks as j, pairedReplyAuthor as ja, readAppRevocation as jc, dialDescriptors as ji, SLOW_MS as jl, isFederationId as jn, emptyLinkRecords as jo, TYPING_KINDS as jr, ENROLL_PROOF as js, didWebFile as jt, knockIdentity as k, validReactionNumber as ka, isAppKey as kc, DHT_TEXT_CAPABILITY as ki, RelayTransport as kl, fedimintRequestPayload as kn, parseCallSignal as ko, transferEnded as kr, ENROLL_GRANT as ks, didSignedMessages as kt, APP_STORE_LIMITS as l, fileMessageText as la, seenEntry as lc, HoldKeys as li, webCryptoSigner as ll, SPARK_NETWORKS as ln, AWAITING_PEER_MS as lo, meshHubs as lr, handoffStreamKey as ls, ATPROTO_PROOF_COLLECTION as lt, GROUP_TYPING_FRAME as m, EDIT_RATE_WINDOW_MS as ma, appDigest as mc, DOMAIN_FILE_MAX_BYTES as mi, turnPutSummary as ml, PUBKY_PROOF_MAX_BYTES as mn, presenceSeenAt as mo, doorHubs as mr, readHandoffDone as ms, checkAtprotoProofRecord as mt, readX401SdJwtVc as n, dhtFileId as na, linkRecords as nc, BUTTONS_CAPABILITY as ni, deviceEchoFrame as nl, WALLET_NETWORKS as nn, commitHash as no, SIGNAL_FRESH_MS as nr, handoffEphemeral as ns, sshSignCommand as nt, randomBytes as nu, appUpdateDecision as o, PLAYABLE_AUDIO as oa, readKnockSlot as oc, HOLD_CAPABILITY as oi, devicePingFrame as ol, formatPaymentAmount as on, verifyCommitSignature as oo, readGroupSignal as or, handoffPakeFrame as os, decodeAnyBitcoinAddress as ot, utf8Encode as ou, signAppStore as p, EDIT_BUFFER_MS as pa, APP_PERMISSIONS as pc, readManifest as pi, classifyTurnRead as pl, isBitcoinAddress as pn, WATCH_PEER_MS as po, beaconRecords as pr, readHandoffCancel as ps, atprotoProofRkey as pt, parseCommunityEdit as q, arrivalKey as qa, createChatInvite as qc, validExternalKey as qi, identityFromSeedB64 as ql, fetchesByItself as qn, handoffAttemptAllowed as qo, parseWakeFrame as qr, settleRequest as qs, signDidDhtPacket as qt, sameX401HolderJwk as r, formatFileSize as ra, makeStampPaced as rc, EDIT_CAPABILITY as ri, deviceEchoNonce as rl, arkAddressPrefix as rn, parseGroupCommit as ro, SIGNAL_HOLD_MS as rr, handoffHelloFrame as rs, verifySshSignature as rt, toBase64Url as ru, checkAppBeforeRun as s, VOICE_LIMITS as sa, readLinkRecord as sc, HOLD_DATED_BACK_MS as si, newDeviceSetSecret as sl, validatePaymentTarget as sn, edgeParams as so, MESH_HUBS as sr, handoffReleaseFrame as ss, ATPROTO_DECLARED_SCOPE as st, newX401HolderKey as t, DHT_FILE_CAPABILITY as ta, knockSlotRecords as tc, APPS_CAPABILITY as ti, HANDOFF_CAPABILITY as tl, USDT_PUBLIC_RPC as tn, MEMBER_KEY as to, GROUP_SIGNAL_FRAME as tr, handoffDigest as ts, sameSshKey as tt, isZ32Key as tu, checkAppStoreIndex as u, parseVoiceMeta as ua, APP_BUNDLE_LIMITS as uc, HoldRefusedError as ui, TURN_PUT_WINDOW_MS as ul, SPARK_PROVIDER as un, DHT_POLL_INTERVALS as uo, pickMeshHubs as ur, handoffVersions as us, ATPROTO_PROOF_SCOPE as ut, sealGroupTyping as v, forwardedAgain as va, isAppUrl as vc, domainWellKnownFile as vi, nextTurnPosition as vl, normalizePubkyKey as vn, webLocalFetch as vo, mergeBeacon as vr, readHandoffTurnFrame as vs, shortAtprotoDid as vt, encodeCommunityLink as w, nextReactionNumber as wa, APP_STATEMENT_LIMITS as wc, recordsFromWellKnown as wi, turnName as wl, requestLnurlInvoice as wn, answersOffer as wo, readBeaconHead as wr, setAckFrame as ws, DidError as wt, GROUP_READ_NOTE_COMMUNITY as x, GROUP_REACTION_FRAME as xa, readAppBundleAsync as xc, nip05RootKey as xi, signTurnRelease as xl, pubkyProofPath as xn, encodeControl as xo, pickHubs as xr, SET_ACK as xs, DID_DOCUMENT_MAX_BYTES as xt, COMMUNITY_LIMITS as y, readForwarded as ya, pacer as yc, encodeDnsQuery as yi, readTurnPacket as yl, pubkyProofCapability as yn, LIMITS as yo, mergeLobby as yr, readHandoffVerified as ys, AtprotoProofError as yt, GROUP_REACTED_FRAME as z, STATUS_CARD_LIMITS as za, readCanonicalJson as zc, identityRevocationValue as zi, PacketTooLargeError as zl, pairedMessageFrame as zn, HANDOFF_HELLO as zo, nextPinNumber as zr, readEnrollGrant as zs, signingKeys as zt };
|
|
33476
|
+
export { parseSshPublicKey as $, statusCardText as $a, readDeviceInvite as $c, irohRelayUrl as $i, createIdentity as $l, readGroupWantNo as $n, HANDOFF_VERIFIED as $o, isServeId as $r, newInbox as $s, SEPOLIA_TEST_USDT_FAUCET as $t, knockRecords as A, reactionEmoji as Aa, sha256Paced as Ac, CapsExchange as Ai, turnInstance as Al, findEndpoint as An, RTC_CONFIG as Ao, transferStalled as Ar, SET_UPDATE as As, didWebDocumentUrl as At, GROUP_READ_NOTE as B, ITEM_STATES as Ba, readAppRevocations as Bc, emptyIdentityLedger as Bi, currentRelays as Bl, engineError as Bn, HTTP_SERVICE_PROTO as Bo, pinIsNewer as Br, enrollCancelFrame as Bs, staticDidDocument as Bt, decodeCommunityLink as C, readForwarded as Ca, appViewOf as Cc, nip05RootKey as Ci, TURN_LAST_SEQUENCE as Cl, pubkyHomeserverOf as Cn, formatLocalTarget as Co, readBeacon as Cr, readHandoffHave as Cs, DID_JWS_MAX_LENGTH as Ct, encodeGroupEntryLink as D, ReactionWindow as Da, pacer as Dc, recordsName as Di, readTurnPacket as Dl, ENDPOINT as Dn, decodeControl as Do, ChatFiles as Dr, readHandoffVerified as Ds, didGhostlyServiceEntry as Dt, decodeGroupEntryLink as E, REACTION_LIMITS as Ea, isAppUrl as Ec, recordsFromWellKnown as Ei, nextTurnPosition as El, decodeBolt11 as En, LIMITS as Eo, shouldBeHub as Er, readHandoffTurnFrame as Es, checkDidSignature as Et, groupWakeFrame as F, pairedReplyAuthor as Fa, checkAppRevokeStatement as Fc, IDENTITY_MAX_VALIDITY as Fi, DEFAULT_RELAYS as Fl, INVITE_TAKEN as Fn, contactRtcConfig as Fo, typingActivity as Fr, verifySetUpdate as Fs, normalizeDid as Ft, GROUP_EDIT_TEXT_BYTES as G, STATUS_CARD_LIMITS as Ga, canonicalJson as Gc, revokesIdentity as Gi, isDiscoveryBudgetError as Gl, GROUP_WANT_FRAME as Gn, HANDOFF_DONE as Go, deviceWakeRequest as Gr, enrollHelloFrame as Gs, encodeDidDhtPacket as Gt, frameBytes as H, PR_STATES as Ha, signAppRevocation as Hc, identityStatement as Hi, setLinkTraceSink as Hl, parseEngineError as Hn, serviceIdFromName as Ho, readPin as Hr, enrollDigits as Hs, didDhtDocument as Ht, groupWakes as I, readReply as Ia, isAppHash as Ic, IDENTITY_REVOCATION_LABEL as Ii, HEDGE_MS as Il, LIVENESS_PING_MS as In, extractParamsFromSdp as Io, GROUP_PIN_FRAME as Ir, ENROLL_DONE as Is, parseDid as It, mentionsMember as J, buttonLabelClash as Ja, createContactLink as Jc, emptyProofLedger as Ji, RELAY_PAYLOAD_MAX_BYTES as Jl, groupFileFallback as Jn, HANDOFF_OFFER as Jo, relayRequest as Jr, readEnrollHello as Js, ETHEREUM_USDT as Jt, carryMentions as K, TASK_STATUSES as Ka, canonicalJsonBytes as Kc, lastSharedWithMe as Ki, withRequestOptions as Kl, GROUP_WANT_NO_FRAME as Kn, HANDOFF_HAVE as Ko, newWakeToken as Kr, enrollProofFrame as Ks, resolveDidDht as Kt, parseGroupWakeFrame as L, replySnippet as La, isAppKey as Lc, IdentityCheckUnavailable as Li, RelayTransport as Ll, PAIRED_FRAME_TOO_LARGE as Ln, parseCallSignal as Lo, PIN_LIMITS as Lr, ENROLL_GRANT as Ls, parseDidDocument as Lt, readKnocks as M, readReaction as Ma, APP_STATEMENT_LIMITS as Mc, capsDescriptors as Mi, turnName as Ml, parseCashuRequestPayload as Mn, buildSdpFromSignal as Mo, TYPING_REFRESH_MS as Mr, setAckFrame as Ms, didWebFileNames as Mt, GROUP_WAKE_FRAME as N, validReactionNumber as Na, appFingerprint as Nc, dialDescriptors as Ni, turnStatedVerifier as Nl, parseFedimintRequestPayload as Nn, callRtcConfig as No, TypingSender as Nr, setUpdateFrame as Ns, didWebFileUrl as Nt, entryParams as O, nextReactionNumber as Oa, readAppBundle as Oc, txtValue as Oi, signTurnPacket as Ol, cashuRequestPayload as On, encodeControl as Oo, FILE_LIMITS as Or, sealHandoffPiece as Os, didJwsAlg as Ot, GroupWakeLimiter as P, wireReaction as Pa, appRef as Pc, IDENTITY_MAX_EVIDENCE as Pi, turnVerifierMark as Pl, GhostLink as Pn, callSignalHeardAt as Po, sanitizeTypingStatus as Pr, signTombstone as Ps, didWebHost as Pt, SshSigError as Q, sameButtonText as Qa, deviceInviteJoinerParams as Qc, irohDescriptor as Qi, parseRelayPayload as Ql, readGroupWant as Qn, HANDOFF_TIMINGS as Qo, APP_RANGE_LIMITS as Qr, inboxRecord as Qs, SEPOLIA_TEST_USDT as Qt, GROUP_LIMITS as R, BUTTON_ID as Ra, isAppRef as Rc, IdentityExchange as Ri, RelaysFailedError as Rl, pairedMessageFits as Rn, signalHasVideo as Ro, mayPin as Rr, ENROLL_HELLO as Rs, parseDidSignaturePaste as Rt, communityHasFrame as S, forwardedAgain as Sa, appDigest as Sc, isPublicAddress as Si, turnPutSummary as Sl, homeserverWebEndpoint as Sn, GhostlyHttpError as So, rankHubs as Sr, readHandoffDone as Ss, DID_FILE_MAX_BYTES as St, KNOCK_TTL_MS as T, GROUP_REACTION_FRAME as Ta, checkAppManifest as Tc, recordsFromTxt as Ti, firstDeviceSetSecret as Tl, resolveLightningDestination as Tn, webLocalFetch as To, readLobby as Tr, readHandoffPake as Ts, checkDidJws as Tt, COMMUNITY_EDIT_FRAME as U, ROUTINE_STATES as Ua, parseImageMeta as Uc, newIdentityBinding as Ui, traceLink as Ul, GROUP_FILE_LIMITS as Un, HANDOFF_ACK as Uo, WAKE_CALL_INTERVAL_MS as Ur, enrollDoneFrame as Us, didDhtFromPublicKey as Ut, GroupSession as V, PR_CHECKS as Va, signAppObject as Vc, identityRevocationValue as Vi, normalizeRelayUrl as Vl, engineText as Vn, LEGACY_SERVICES as Vo, pinNumberHolds as Vr, enrollCancelReason as Vs, strictBase64Url as Vt, GROUP_EDIT_FRAME as W, RUN_RESULTS as Wa, readImageMeta as Wc, receivedIdentityStatus as Wi, budgetRetryMs as Wl, GROUP_HAVE_FRAME as Wn, HANDOFF_CANCEL as Wo, WakeLimiter as Wr, enrollGrantFrame as Ws, encodeDidDhtDeactivated as Wt, SSHSIG_MAX_ARMOR as X, cardUrl as Xa, readContactLink as Xc, TRANSPORTS as Xi, newerPacket as Xl, readGroupFileMeta as Xn, HANDOFF_PIECE_BYTES as Xo, checkPushEndpoint as Xr, clearMissed as Xs, ONCHAIN_PROVIDER as Xt, groupName as Y, cardLine as Ya, encodeContactLink as Yc, validExternalKey as Yi, createRelayPayload as Yl, isGroupMessageId as Yn, HANDOFF_PAKE as Yo, wakeRequest as Yr, verifyEnrollProof as Ys, EVM_TEST_CHAINS as Yt, SSHSIG_NAMESPACE as Z, checkStatusCard as Za, createDeviceInvite as Zc, automaticTransport as Zi, openRelayPayload as Zl, readGroupHave as Zn, HANDOFF_REQUEST as Zo, vapidKeysMatch as Zr, endedRequests as Zs, PaymentPreflightError as Zt, openGroupTyping as _, MAX_REMOVAL_NUMBER as _a, seenEntry as _c, decodeDnsResponse as _i, webCryptoSigner as _l, newPubkyProofFolder as _n, DHT_POLL_INTERVALS as _o, lobbyRecords as _r, handoffStreamKey as _s, parseAtprotoDidDocument as _t, appStoreDecision as a, formatFileSize as aa, REQUEST_LIFETIME_MS as ac, EDIT_CAPABILITY as ai, inviteOwnership as al, assertWholeSats as an, GROUP_ADMIN_OFF_ERROR as ao, groupSignalFrame as ar, handoffCancelFrame as as, BitcoinAddressError as at, sanitizeAvatar as au, CommunitySession as b, dhtEditId as ba, APP_ICON_PATH as bc, domainWellKnownFile as bi, TURN_SETTLE_MS as bl, pubkyProofFile as bn, WATCH_PEER_MS as bo, newerHead as br, readHandoffAck as bs, verifyAtprotoRecordProof as bt, planAppUpdate as c, PLAYABLE_AUDIO as ca, knockSlotOf as cc, HOLD_CAPABILITY as ci, ENROLL_CAPABILITY as cl, walletNetworkOf as cn, MEMBER_KEY as co, mayBeHub as cr, handoffDataFrame as cs, ATPROTO_FULL_SCOPE as ct, fromBase64Url as cu, readAppStore as d, fileMessageText as da, makeStampPaced as dc, HoldKeys as di, deviceEchoNonce as dl, sparkAddressKind as dn, rosterAdmin as do, COMMUNITY_TOPOLOGY as dr, handoffHelloFrame as ds, atprotoDidMethod as dt, toBase64Url as du, DHT_FILE_TOO_LARGE as ea, planKnocks as ec, APP_DATA_MAX_BYTES as ei, OwnInviteError as el, TEST_USDT_FAUCET_AMOUNT as en, arrivalKey as eo, CarriedTransport as er, filePartName as es, parseSshSignature as et, identityFromSeed as eu, readAppStoreSteps as f, parseVoiceMeta as fa, mergeContactKnocks as fc, HoldRefusedError as fi, deviceKeyZ32 as fl, sparkInvoiceDetails as fn, rosterHas as fo, beaconKeys as fr, handoffManifestFrames as fs, atprotoProofRecord as ft, toZ32 as fu, groupTypingEpoch as g, EDIT_RATE_WINDOW_MS as ga, requestRecords as gc, DOMAIN_FILE_MAX_BYTES as gi, seedSigner as gl, isPubkyProofFolder as gn, AWAITING_PEER_MS as go, lobbyKeys as gr, handoffRetryAfter as gs, normalizeAtprotoHandle as gt, GroupTypingBoard as h, EDIT_BUFFER_MS as ha, readLinkRecord as hc, readManifest as hi, newDeviceSetSecret as hl, isPubkyKey as hn, DirectPathWatch as ho, freshHubs as hr, handoffReleaseFrame as hs, isAtprotoDid as ht, appRevocationFor as i, dhtFileId as ia, ContactRequestError as ic, BUTTONS_CAPABILITY as ii, inviteLink as il, assertTokenUnits as in, shownTime as io, SIGNAL_REPLY_MS as ir, handoffBusyFrame as is, verifyBitcoinMessage as it, MAX_AVATAR_LENGTH as iu, mergeKnocks as j, reactionIsNewer as ja, APP_PREFIXES as jc, DHT_TEXT_CAPABILITY as ji, turnKeys as jl, isFederationId as jn, answersOffer as jo, TYPING_KINDS as jr, readSetUpdate as js, didWebFile as jt, knockIdentity as k, queueReaction as ka, readAppBundleAsync as kc, wellKnownUrl as ki, signTurnRelease as kl, fedimintRequestPayload as kn, CALL_SIGNAL_MAX_AGE_MS as ko, transferEnded as kr, SET_ACK as ks, didSignedMessages as kt, APP_STORE_LIMITS as l, VOICE_LIMITS as la, knockSlotRecords as lc, HOLD_DATED_BACK_MS as li, HANDOFF_CAPABILITY as ll, SPARK_NETWORKS as ln, commitHash as lo, meshHubs as lr, handoffDigest as ls, ATPROTO_PROOF_COLLECTION as lt, isZ32Key as lu, GROUP_TYPING_FRAME as m, parseVideoMeta as ma, readKnockSlot as mc, newMailbox as mi, devicePingFrame as ml, PUBKY_PROOF_MAX_BYTES as mn, edgeParams as mo, doorHubs as mr, handoffPakeFrame as ms, checkAtprotoProofRecord as mt, utf8Encode as mu, readX401SdJwtVc as n, peekDhtMailbox as na, takeRequest as nc, isAppVersion as ni, decodeInviteCode as nl, WALLET_NETWORKS as nn, heardTime as no, SIGNAL_FRESH_MS as nr, handoffAttemptFailed as ns, sshSignCommand as nt, publicKeyFromZ32 as nu, appUpdateDecision as o, sanitizeFileName as oa, contactDay as oc, STATUS_CARD_CAPABILITY as oi, ownInviteRefusal as ol, formatPaymentAmount as on, GROUP_MEMBER_CAP as oo, readGroupSignal as or, handoffContext as os, decodeAnyBitcoinAddress as ot, sanitizeDisplayText as ou, signAppStore as p, voicePeaksOf as pa, openRequest as pc, isHoldUrl as pi, deviceLinkPairing as pl, isBitcoinAddress as pn, verifyCommitSignature as po, beaconRecords as pr, handoffOfferFrame as ps, atprotoProofRkey as pt, utf8Decode as pu, parseCommunityEdit as q, appCardId as qa, readCanonicalJson as qc, PeerProofs as qi, PacketTooLargeError as ql, fetchesByItself as qn, HANDOFF_HELLO as qo, parseWakeFrame as qr, readEnrollGrant as qs, signDidDhtPacket as qt, sameX401HolderJwk as r, DHT_FILE_CAPABILITY as ra, turnOff as rc, APPS_CAPABILITY as ri, encodeInviteCode as rl, arkAddressPrefix as rn, receivedTimestamp as ro, SIGNAL_HOLD_MS as rr, handoffAttemptSucceeded as rs, verifySshSignature as rt, verify as ru, checkAppBeforeRun as s, sanitizeMime as sa, knockSlotIdentity as sc, UPGRADE_CAPABILITY as si, DEVICES_CAPABILITY as sl, validatePaymentTarget as sn, MAX_GROUP_CHAIN as so, MESH_HUBS as sr, handoffContextProof as ss, ATPROTO_DECLARED_SCOPE as st, bytesEqual as su, newX401HolderKey as t, DHT_MESSAGE_TTL as ta, settleRequest as tc, chatAppId as ti, createChatInvite as tl, USDT_PUBLIC_RPC as tn, claimedTime as to, GROUP_SIGNAL_FRAME as tr, handoffAttemptAllowed as ts, sameSshKey as tt, identityFromSeedB64 as tu, checkAppStoreIndex as u, baseMime as ua, linkRecords as uc, HOLD_LIMITS as ui, deviceEchoFrame as ul, SPARK_PROVIDER as un, parseGroupCommit as uo, pickMeshHubs as ur, handoffEphemeral as us, ATPROTO_PROOF_SCOPE as ut, randomBytes as uu, sealGroupTyping as v, REMOVED_TEXT as va, APP_BUNDLE_LIMITS as vc, dnsProofName as vi, TURN_PUT_WINDOW_MS as vl, normalizePubkyKey as vn, EXPECT_PEER_MS as vo, mergeBeacon as vr, handoffVersions as vs, shortAtprotoDid as vt, encodeCommunityLink as w, COMMUNITY_REACTION_FRAME as wa, assembleAppBundle as wc, normalizeDomain as wi, TURN_MAX as wl, requestLnurlInvoice as wn, parseLocalTarget as wo, readBeaconHead as wr, readHandoffHello as ws, DidError as wt, GROUP_READ_NOTE_COMMUNITY as x, parseLinkPreview as xa, APP_PERMISSIONS as xc, encodeDnsQuery as xi, classifyTurnRead as xl, pubkyProofPath as xn, presenceSeenAt as xo, pickHubs as xr, readHandoffCancel as xs, DID_DOCUMENT_MAX_BYTES as xt, COMMUNITY_LIMITS as y, RateWindow as ya, APP_BUNDLE_MAGIC as yc, domainTxtRecord as yi, TURN_RAISE_READ_TIMEOUT_MS as yl, pubkyProofCapability as yn, RELAY_POLL_INTERVALS as yo, mergeLobby as yr, newHandoffId as ys, AtprotoProofError as yt, GROUP_REACTED_FRAME as z, CRON_LINE as za, readAppRevocation as zc, boundVerifiedIdentity as zi, SLOW_MS as zl, pairedMessageFrame as zn, emptyLinkRecords as zo, nextPinNumber as zr, ENROLL_PROOF as zs, signingKeys as zt };
|
|
32769
33477
|
|
|
32770
|
-
//# sourceMappingURL=src-
|
|
33478
|
+
//# sourceMappingURL=src-CwMTZ5Hj.js.map
|