@ghostlytools/cli 1.8.1 → 1.9.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.
Files changed (78) hide show
  1. package/README.md +8 -5
  2. package/SKILL.md +4 -3
  3. package/dist/assets/{api-BpQC8dAw.js → api-DFCgr6RH.js} +40 -16
  4. package/dist/assets/api-DFCgr6RH.js.map +1 -0
  5. package/dist/assets/{api-CttDF-S5.js → api-raWw9j_m.js} +2 -2
  6. package/dist/assets/{apiKit-CSMeHKgo.js → apiKit-CCavJJcl.js} +2 -2
  7. package/dist/assets/{apiKit-CSMeHKgo.js.map → apiKit-CCavJJcl.js.map} +1 -1
  8. package/dist/assets/{apps-DzFMdVt6.js → apps-B7o2BPj6.js} +1 -1
  9. package/dist/assets/{apps-DqTyZ40T.js → apps-DmxEG147.js} +2 -2
  10. package/dist/assets/{apps-DqTyZ40T.js.map → apps-DmxEG147.js.map} +1 -1
  11. package/dist/assets/{arkade-Cu3TbPxC.js → arkade-DtYR9H0c.js} +2 -2
  12. package/dist/assets/{arkade-Cu3TbPxC.js.map → arkade-DtYR9H0c.js.map} +1 -1
  13. package/dist/assets/{backup-CLZOORFC.js → backup-BserdrNk.js} +1 -1
  14. package/dist/assets/{backup-CyTZhu28.js → backup-YIB2XIES.js} +4 -4
  15. package/dist/assets/{backup-CyTZhu28.js.map → backup-YIB2XIES.js.map} +1 -1
  16. package/dist/assets/bitcoindevkit_bg-B-iLWrmX.js.map +1 -1
  17. package/dist/assets/buttons-CuRfKnPI.js +1331 -0
  18. package/dist/assets/buttons-CuRfKnPI.js.map +1 -0
  19. package/dist/assets/buttons-De3LPdSG.js +2 -0
  20. package/dist/assets/{envelope-CGfUsR1m.js → envelope-Dt75vrmY.js} +2 -2
  21. package/dist/assets/{envelope-CGfUsR1m.js.map → envelope-Dt75vrmY.js.map} +1 -1
  22. package/dist/assets/fedimint_client_wasm_bg-BtHHlFpp.js.map +1 -1
  23. package/dist/assets/{fixedHosts-BiukTsd9.js → fixedHosts-B598JzbC.js} +4 -4
  24. package/dist/assets/{fixedHosts-BiukTsd9.js.map → fixedHosts-B598JzbC.js.map} +1 -1
  25. package/dist/assets/{groupFiles-CeF9nPv9.js → groupFiles-FXel6zIc.js} +10 -599
  26. package/dist/assets/groupFiles-FXel6zIc.js.map +1 -0
  27. package/dist/assets/{host-CKAehWP6.js → host-DIBeK_c_.js} +73 -18
  28. package/dist/assets/host-DIBeK_c_.js.map +1 -0
  29. package/dist/assets/{hyperdhtRelay-B8Pdykhg.js → hyperdhtRelay-D185dETu.js} +2 -2
  30. package/dist/assets/{hyperdhtRelay-B8Pdykhg.js.map → hyperdhtRelay-D185dETu.js.map} +1 -1
  31. package/dist/assets/{irohWeb-D6tAPHZa.js → irohWeb-BSv_BWyG.js} +16 -3
  32. package/dist/assets/{irohWeb-D6tAPHZa.js.map → irohWeb-BSv_BWyG.js.map} +1 -1
  33. package/dist/assets/{main-BDY-pfpz.js → main-BbhfMTt8.js} +50 -22
  34. package/dist/assets/main-BbhfMTt8.js.map +1 -0
  35. package/dist/assets/{mainline-3ueXpFQL.js → mainline-9Vc3c3SA.js} +2 -2
  36. package/dist/assets/{mainline-3ueXpFQL.js.map → mainline-9Vc3c3SA.js.map} +1 -1
  37. package/dist/assets/{networkReason-DhJYOomu.js → networkReason-BncJ9KSM.js} +2 -2
  38. package/dist/assets/{networkReason-DhJYOomu.js.map → networkReason-BncJ9KSM.js.map} +1 -1
  39. package/dist/assets/{nwc-B1Quqda-.js → nwc-QX3Yt1Sb.js} +3 -3
  40. package/dist/assets/{nwc-B1Quqda-.js.map → nwc-QX3Yt1Sb.js.map} +1 -1
  41. package/dist/assets/{nwcProvider-DUB6xO-b.js → nwcProvider-CzX3xH47.js} +2 -2
  42. package/dist/assets/{nwcProvider-DUB6xO-b.js.map → nwcProvider-CzX3xH47.js.map} +1 -1
  43. package/dist/assets/{ownDid-BfqHJdA6.js → ownDid-D8z5gwGI.js} +2 -2
  44. package/dist/assets/{ownDid-BfqHJdA6.js.map → ownDid-D8z5gwGI.js.map} +1 -1
  45. package/dist/assets/{registry-DwlTNQjr.js → registry-B2Dtnibo.js} +5 -5
  46. package/dist/assets/{registry-DwlTNQjr.js.map → registry-B2Dtnibo.js.map} +1 -1
  47. package/dist/assets/{registry-CZTmtSws.js → registry-PTtBMaYZ.js} +1 -1
  48. package/dist/assets/{resolve-BVwhiYjj.js → resolve-ZxVzwFNA.js} +2 -2
  49. package/dist/assets/{resolve-BVwhiYjj.js.map → resolve-ZxVzwFNA.js.map} +1 -1
  50. package/dist/assets/{server-Br3XPwFG.js → server-Dw1o8z1o.js} +796 -269
  51. package/dist/assets/server-Dw1o8z1o.js.map +1 -0
  52. package/dist/assets/{src-C4sOH4zH.js → src-BD8RBVEp.js} +1038 -30
  53. package/dist/assets/src-BD8RBVEp.js.map +1 -0
  54. package/dist/assets/{sshForges-CQQomStK.js → sshForges-DWrESWkK.js} +2 -2
  55. package/dist/assets/{sshForges-CQQomStK.js.map → sshForges-DWrESWkK.js.map} +1 -1
  56. package/dist/assets/{translate-C2aNyUkR.js → translate-D1uP0q32.js} +9 -3
  57. package/dist/assets/translate-D1uP0q32.js.map +1 -0
  58. package/dist/assets/{usdt-CMwatDnQ.js → usdt-DhVN8geQ.js} +3 -3
  59. package/dist/assets/{usdt-CMwatDnQ.js.map → usdt-DhVN8geQ.js.map} +1 -1
  60. package/dist/assets/{waitNotice-Ck3el3_Z.js → waitNotice-B8D8WhbE.js} +2 -2
  61. package/dist/assets/waitNotice-B8D8WhbE.js.map +1 -0
  62. package/dist/assets/{words-CqN2KG1r.js → words-DdXPkB3n.js} +3 -2
  63. package/dist/assets/words-DdXPkB3n.js.map +1 -0
  64. package/dist/ghostly.mjs +1 -1
  65. package/examples/call-echo.mjs +7 -5
  66. package/package.json +1 -1
  67. package/dist/assets/api-BpQC8dAw.js.map +0 -1
  68. package/dist/assets/buttons-Bd9fR31r.js +0 -698
  69. package/dist/assets/buttons-Bd9fR31r.js.map +0 -1
  70. package/dist/assets/buttons-c4CJnL6i.js +0 -2
  71. package/dist/assets/groupFiles-CeF9nPv9.js.map +0 -1
  72. package/dist/assets/host-CKAehWP6.js.map +0 -1
  73. package/dist/assets/main-BDY-pfpz.js.map +0 -1
  74. package/dist/assets/server-Br3XPwFG.js.map +0 -1
  75. package/dist/assets/src-C4sOH4zH.js.map +0 -1
  76. package/dist/assets/translate-C2aNyUkR.js.map +0 -1
  77. package/dist/assets/waitNotice-Ck3el3_Z.js.map +0 -1
  78. package/dist/assets/words-CqN2KG1r.js.map +0 -1
@@ -1,605 +1,14 @@
1
- import { $n as readGroupHave, Bi as IDENTITY_REVOCATION_LABEL, Dn as decodeBolt11, Ea as RateWindow, En as resolveLightningDestination, Gi as identityRevocationValue, Gn as GROUP_FILE_LIMITS, Hi as IdentityExchange, Hn as engineError, Ji as receivedIdentityStatus, Jn as GROUP_WANT_NO_FRAME, Ka as replySnippet, Ki as identityStatement, Kn as GROUP_HAVE_FRAME, Mu as toBase64Url, Nr as transferEnded, Tn as requestLnurlInvoice, Un as engineText, Vi as IdentityCheckUnavailable, Wi as emptyIdentityLedger, Xn as groupFileFallback, Yi as revokesIdentity, Yn as fetchesByItself, Zn as isGroupMessageId, _a as fileMessageText, cl as exifOrientation, er as readGroupWant, jr as FileUplink, ju as randomBytes, kr as ChatFiles, ku as fromBase64Url, ln as walletNetworkOf, qi as newIdentityBinding, rn as WALLET_NETWORKS, tr as readGroupWantNo } from "./src-C4sOH4zH.js";
1
+ import { $a as replySnippet, $i as identityStatement, $n as GROUP_HAVE_FRAME, Br as transferEnded, Dn as decodeBolt11, En as resolveLightningDestination, Fu as fromBase64Url, Ir as ChatFiles, Ji as IdentityCheckUnavailable, Lu as randomBytes, Na as RateWindow, Qi as identityRevocationValue, Qn as GROUP_FILE_LIMITS, Rr as FileUplink, Ru as toBase64Url, Tn as requestLnurlInvoice, Xn as engineText, Yi as IdentityExchange, Yn as engineError, Zi as emptyIdentityLedger, cr as readGroupWantNo, ea as newIdentityBinding, ir as isGroupMessageId, ln as walletNetworkOf, na as revokesIdentity, nr as fetchesByItself, or as readGroupHave, qi as IDENTITY_REVOCATION_LABEL, rn as WALLET_NETWORKS, rr as groupFileFallback, sr as readGroupWant, ta as receivedIdentityStatus, tr as GROUP_WANT_NO_FRAME, wa as fileMessageText } from "./src-BD8RBVEp.js";
2
2
  import { a as describeProvider, c as offeredIn, d as sourceProblem, n as PROVIDER_PLATFORMS, o as isNothingSpentError, s as networkMode, t as NothingSpentError, u as redact } from "./types-C4_KafL_.js";
3
3
  import { g as wrap, h as transact, i as STORES, m as store, s as databaseName, u as fileStore } from "./idb-BkOJES5_.js";
4
- import { a as sealSeed, i as newDeviceKey, o as unsealSeed, t as networkReason } from "./networkReason-DhJYOomu.js";
4
+ import { a as sealSeed, i as newDeviceKey, o as unsealSeed, t as networkReason } from "./networkReason-BncJ9KSM.js";
5
5
  import { t as BITCOIN_INVOICE_ON_TESTNET, u as mintNetwork } from "./mints-j5XAOk4f.js";
6
- import { c as boundedIdentityFetch, l as verifyIdentity } from "./ownDid-BfqHJdA6.js";
7
- import { i as fromBase64Url$1 } from "./envelope-CGfUsR1m.js";
6
+ import { c as boundedIdentityFetch, l as verifyIdentity } from "./ownDid-D8z5gwGI.js";
7
+ import { i as fromBase64Url$1 } from "./envelope-Dt75vrmY.js";
8
8
  import { f as FILE_BYTES_STEP, o as fileBytes, s as fileBytesOf } from "./fileBytes-DNgrRL0R.js";
9
9
  import { sha256 } from "@noble/hashes/sha2.js";
10
10
  import { validateMnemonic } from "@scure/bip39";
11
11
  import { wordlist } from "@scure/bip39/wordlists/english.js";
12
- //#region ../core/src/pictureMetadata.ts
13
- /**
14
- * What a picture leaves with. A photo's file says more than its pixels: its Exif and XMP hold where it was taken, the
15
- * device, the time, often a thumbnail of the uncropped original. The sender removes them before the file is stored and
16
- * its digest computed, so what the contact (or anyone in a community) receives is the picture alone: JPEG, PNG, WebP
17
- * and HEIF (HEIC, AVIF), without decoding or re-encoding a pixel.
18
- *
19
- * Fail-closed: a file that is one of these pictures, by its bytes or by its type, and whose metadata cannot be removed
20
- * (truncated, malformed, a part this does not know) is refused with `NO_PICTURE_METADATA`, never sent as it was. Any
21
- * other file goes as it is.
22
- */
23
- var PICTURE_METADATA_LIMITS = {
24
- /** The largest picture read whole to remove its metadata: past this it is refused. */
25
- maxBytes: 268435456,
26
- /** Bytes read first to tell a picture from another file. */
27
- headBytes: 64
28
- };
29
- /** Why a picture is refused: its metadata could not be removed, so it does not go at all. */
30
- var NO_PICTURE_METADATA = "This picture cannot be sent: Ghostly could not remove the details saved in it, like where it was taken";
31
- /** The types of the pictures stripped here: a file of one of them whose bytes are not that picture is refused. */
32
- var STRIPPED_TYPES = /* @__PURE__ */ new Set([
33
- "image/jpeg",
34
- "image/jpg",
35
- "image/pjpeg",
36
- "image/png",
37
- "image/apng",
38
- "image/webp",
39
- "image/heic",
40
- "image/heif",
41
- "image/heic-sequence",
42
- "image/heif-sequence",
43
- "image/avif",
44
- "image/gif",
45
- "image/tiff",
46
- "image/tiff-fx"
47
- ]);
48
- /** HEIF brands (HEIC, AVIF, the generic `mif1`): an MP4 video's `ftyp` names none of them. */
49
- var HEIF_BRANDS = /* @__PURE__ */ new Set([
50
- "heic",
51
- "heix",
52
- "heim",
53
- "heis",
54
- "hevc",
55
- "hevx",
56
- "mif1",
57
- "mif2",
58
- "msf1",
59
- "avif",
60
- "avis"
61
- ]);
62
- var u16be = (b, at) => b[at] << 8 | b[at + 1];
63
- var u32be = (b, at) => (b[at] << 24 >>> 0) + (b[at + 1] << 16) + (b[at + 2] << 8) + b[at + 3];
64
- var u32le = (b, at) => (b[at] | b[at + 1] << 8 | b[at + 2] << 16 | b[at + 3] << 24) >>> 0;
65
- var text = (b, at, length) => String.fromCharCode(...b.subarray(at, at + length));
66
- var starts = (b, at, prefix) => at + prefix.length <= b.length && text(b, at, prefix.length) === prefix;
67
- /** A picture this strips, by its first bytes. */
68
- function kindOf(b) {
69
- if (b.length >= 3 && b[0] === 255 && b[1] === 216 && b[2] === 255) return "jpeg";
70
- if (b.length >= 8 && b[0] === 137 && starts(b, 1, "PNG\r\n\n")) return "png";
71
- if (b.length >= 12 && starts(b, 0, "RIFF") && starts(b, 8, "WEBP")) return "webp";
72
- if (starts(b, 0, "GIF87a") || starts(b, 0, "GIF89a")) return "gif";
73
- if (starts(b, 0, "II*\0") || starts(b, 0, "MM\0*") || starts(b, 0, "II+\0") || starts(b, 0, "MM\0+")) return "tiff";
74
- if (b.length >= 16 && starts(b, 4, "ftyp")) {
75
- const end = Math.min(b.length, u32be(b, 0));
76
- for (let at = 8; at + 4 <= end; at += 4) if (at !== 12 && HEIF_BRANDS.has(text(b, at, 4))) return "heif";
77
- }
78
- }
79
- /** Refuses the picture where its bytes are not what this expects. */
80
- function check(ok) {
81
- if (!ok) throw new Error(NO_PICTURE_METADATA);
82
- }
83
- /** SOFn markers: every frame type but DHT (C4), JPG (C8) and DAC (CC). */
84
- var JPEG_FRAME = /* @__PURE__ */ new Set([
85
- 192,
86
- 193,
87
- 194,
88
- 195,
89
- 197,
90
- 198,
91
- 199,
92
- 201,
93
- 202,
94
- 203,
95
- 205,
96
- 206,
97
- 207
98
- ]);
99
- function jpegKeeps(marker, b, payload) {
100
- if (marker >= 192 && marker <= 207 || marker >= 218 && marker <= 223) return true;
101
- if (marker === 224) return starts(b, payload, "JFIF\0");
102
- if (marker === 226) return starts(b, payload, "ICC_PROFILE\0");
103
- if (marker === 238) return starts(b, payload, "Adobe");
104
- return false;
105
- }
106
- /** An APP1 Exif, big-endian, whose IFD0 holds `orientation` alone. */
107
- var orientationOnly = (orientation) => Uint8Array.of(255, 225, 0, 34, 69, 120, 105, 102, 0, 0, 77, 77, 0, 42, 0, 0, 0, 8, 0, 1, 1, 18, 0, 3, 0, 0, 0, 1, 0, orientation, 0, 0, 0, 0, 0, 0);
108
- function stripJpeg(b) {
109
- const parts = [b.subarray(0, 2)];
110
- let at = 2, framed = false, scanned = false, exif = false;
111
- for (;;) {
112
- check(at < b.length && b[at] === 255);
113
- while (at < b.length && b[at] === 255) at++;
114
- check(at < b.length);
115
- const marker = b[at++];
116
- if (marker === 217) {
117
- check(framed && scanned);
118
- parts.push(Uint8Array.of(255, 217));
119
- return parts;
120
- }
121
- if (marker === 1 || marker >= 208 && marker <= 215) {
122
- parts.push(Uint8Array.of(255, marker));
123
- continue;
124
- }
125
- check(marker !== 0 && marker !== 216 && at + 2 <= b.length);
126
- const length = u16be(b, at);
127
- check(length >= 2 && at + length <= b.length);
128
- if (jpegKeeps(marker, b, at + 2)) {
129
- parts.push(Uint8Array.of(255, marker), b.subarray(at, at + length));
130
- if (JPEG_FRAME.has(marker)) framed = true;
131
- } else if (marker === 225 && !scanned && !exif && starts(b, at + 2, "Exif\0\0")) {
132
- exif = true;
133
- const orientation = exifOrientation(b, at + 8, at + length);
134
- if (orientation >= 2) parts.push(orientationOnly(orientation));
135
- }
136
- at += length;
137
- if (marker !== 218) continue;
138
- check(framed);
139
- scanned = true;
140
- let end = at;
141
- for (;;) {
142
- end = b.indexOf(255, end);
143
- check(end >= 0);
144
- let next = end + 1;
145
- while (next < b.length && b[next] === 255) next++;
146
- check(next < b.length);
147
- if (b[next] !== 0 && !(b[next] >= 208 && b[next] <= 215)) break;
148
- end = next + 1;
149
- }
150
- parts.push(b.subarray(at, end));
151
- at = end;
152
- }
153
- }
154
- var PNG_CRITICAL = /* @__PURE__ */ new Set([
155
- "IHDR",
156
- "PLTE",
157
- "IDAT",
158
- "IEND"
159
- ]);
160
- var PNG_DRAWS = /* @__PURE__ */ new Set([
161
- "tRNS",
162
- "gAMA",
163
- "cHRM",
164
- "sRGB",
165
- "iCCP",
166
- "sBIT",
167
- "bKGD",
168
- "pHYs",
169
- "cICP",
170
- "mDCV",
171
- "cLLI",
172
- "acTL",
173
- "fcTL",
174
- "fdAT"
175
- ]);
176
- function stripPng(b) {
177
- const parts = [b.subarray(0, 8)];
178
- let at = 8;
179
- for (;;) {
180
- check(at + 12 <= b.length);
181
- const length = u32be(b, at), type = text(b, at + 4, 4);
182
- check(at + 12 + length <= b.length && (at > 8 || type === "IHDR"));
183
- const critical = (b[at + 4] & 32) === 0;
184
- check(!critical || PNG_CRITICAL.has(type));
185
- if (critical || PNG_DRAWS.has(type)) parts.push(b.subarray(at, at + 12 + length));
186
- at += 12 + length;
187
- if (type === "IEND") return parts;
188
- }
189
- }
190
- var WEBP_KEEPS = /* @__PURE__ */ new Set([
191
- "VP8 ",
192
- "VP8L",
193
- "VP8X",
194
- "ALPH",
195
- "ANIM",
196
- "ANMF",
197
- "ICCP"
198
- ]);
199
- function stripWebp(b) {
200
- check(b.length >= 20);
201
- const riffEnd = 8 + u32le(b, 4);
202
- check(riffEnd <= b.length && riffEnd % 2 === 0);
203
- const parts = [];
204
- let at = 12, size = 4, drawn = false;
205
- while (at < riffEnd) {
206
- check(at + 8 <= riffEnd);
207
- const type = text(b, at, 4), length = u32le(b, at + 4), end = at + 8 + length + (length & 1);
208
- check(end <= riffEnd && (at > 12 || type === "VP8 " || type === "VP8L" || type === "VP8X"));
209
- if (WEBP_KEEPS.has(type)) {
210
- let chunk = b.subarray(at, end);
211
- if (type === "VP8X") {
212
- check(length >= 10);
213
- chunk = chunk.slice();
214
- chunk[8] = chunk[8] & -13;
215
- }
216
- if (type === "VP8 " || type === "VP8L" || type === "ANMF") drawn = true;
217
- parts.push(chunk);
218
- size += chunk.length;
219
- }
220
- at = end;
221
- }
222
- check(drawn);
223
- const header = /* @__PURE__ */ new Uint8Array(12);
224
- header.set(b.subarray(0, 12));
225
- new DataView(header.buffer).setUint32(4, size, true);
226
- return [header, ...parts];
227
- }
228
- var HEIF_TOP = /* @__PURE__ */ new Set([
229
- "ftyp",
230
- "meta",
231
- "mdat",
232
- "free",
233
- "skip"
234
- ]);
235
- var HEIF_META = /* @__PURE__ */ new Set([
236
- "hdlr",
237
- "dinf",
238
- "pitm",
239
- "iloc",
240
- "iinf",
241
- "iref",
242
- "iprp",
243
- "idat",
244
- "grpl",
245
- "free",
246
- "skip"
247
- ]);
248
- /** Items that hold metadata: Exif, and XMP (or any other document) as a MIME item. */
249
- var HEIF_METADATA_ITEMS = /* @__PURE__ */ new Set([
250
- "Exif",
251
- "mime",
252
- "uri "
253
- ]);
254
- function boxes(b, start, end) {
255
- const found = [];
256
- for (let at = start; at < end;) {
257
- check(at + 8 <= end);
258
- let size = u32be(b, at), body = at + 8;
259
- const type = text(b, at + 4, 4);
260
- if (size === 1) {
261
- check(at + 16 <= end);
262
- size = u32be(b, at + 8) * 2 ** 32 + u32be(b, at + 12);
263
- body = at + 16;
264
- } else if (size === 0) size = end - at;
265
- if (type === "uuid") body += 16;
266
- check(size >= body - at && at + size <= end);
267
- found.push({
268
- type,
269
- start: at,
270
- body,
271
- end: at + size
272
- });
273
- at += size;
274
- }
275
- return found;
276
- }
277
- function stripHeif(b) {
278
- const top = boxes(b, 0, b.length);
279
- check(top[0]?.type === "ftyp" && top.every((box) => HEIF_TOP.has(box.type)));
280
- const metas = top.filter((box) => box.type === "meta");
281
- check(metas.length === 1);
282
- const meta = metas[0];
283
- const children = boxes(b, meta.body + 4, meta.end);
284
- check(children.every((box) => HEIF_META.has(box.type)));
285
- const one = (type) => {
286
- const of = children.filter((box) => box.type === type);
287
- check(of.length <= 1);
288
- return of[0];
289
- };
290
- const iinf = one("iinf"), iloc = one("iloc"), idat = one("idat");
291
- check(!!iinf && !!iloc);
292
- const metadata = /* @__PURE__ */ new Set();
293
- const infeVersion = b[iinf.body];
294
- const entries = boxes(b, iinf.body + 4 + (infeVersion === 0 ? 2 : 4), iinf.end);
295
- for (const infe of entries) {
296
- check(infe.type === "infe" && infe.body + 4 <= infe.end);
297
- const version = b[infe.body];
298
- check(version === 2 || version === 3);
299
- let at = infe.body + 4;
300
- const id = version === 2 ? u16be(b, at) : u32be(b, at);
301
- at += version === 2 ? 2 : 4;
302
- check(at + 6 <= infe.end);
303
- if (HEIF_METADATA_ITEMS.has(text(b, at + 2, 4))) metadata.add(id);
304
- }
305
- const out = b.slice();
306
- const version = b[iloc.body];
307
- check(version <= 2);
308
- let at = iloc.body + 4;
309
- /** The next field of `size` bytes (0, 2, 4 or 8), big-endian. */
310
- const read = (size) => {
311
- check(at + size <= iloc.end);
312
- const value = size === 0 ? 0 : size === 2 ? u16be(b, at) : size === 4 ? u32be(b, at) : size === 8 ? u32be(b, at) * 2 ** 32 + u32be(b, at + 4) : NaN;
313
- check(Number.isSafeInteger(value));
314
- at += size;
315
- return value;
316
- };
317
- const read2 = () => read(2);
318
- check(at + 2 <= iloc.end);
319
- const offsetSize = b[at] >> 4, lengthSize = b[at] & 15, baseSize = b[at + 1] >> 4, indexSize = version > 0 ? b[at + 1] & 15 : 0;
320
- check([
321
- offsetSize,
322
- lengthSize,
323
- baseSize,
324
- indexSize
325
- ].every((size) => size === 0 || size === 4 || size === 8));
326
- at += 2;
327
- const count = read(version < 2 ? 2 : 4);
328
- for (let i = 0; i < count; i++) {
329
- const id = version < 2 ? read2() : read(4);
330
- const method = version > 0 ? read2() & 15 : 0;
331
- const reference = read2();
332
- const base = read(baseSize);
333
- const extents = read2();
334
- for (let e = 0; e < extents; e++) {
335
- if (indexSize) read(indexSize);
336
- const offset = read(offsetSize), length = read(lengthSize);
337
- if (!metadata.has(id)) continue;
338
- check(reference === 0 && length > 0 && (method === 0 || method === 1 && !!idat));
339
- const start = (method === 1 ? idat.body : 0) + base + offset, limit = method === 1 ? idat.end : b.length;
340
- check(start + length <= limit);
341
- out.fill(0, start, start + length);
342
- }
343
- }
344
- return [out];
345
- }
346
- var GIF_APPS_KEPT = /* @__PURE__ */ new Set([
347
- "NETSCAPE2.0",
348
- "ANIMEXTS1.0",
349
- "ICCRGBG1012"
350
- ]);
351
- function stripGif(b) {
352
- check(b.length >= 13);
353
- /** A colour table's bytes, from the flags that say it is there and its size. */
354
- const table = (flags) => flags & 128 ? 3 << (flags & 7) + 1 : 0;
355
- /** The end of the data sub-blocks at `at`, past their empty block. */
356
- const blocks = (at) => {
357
- for (;;) {
358
- check(at < b.length);
359
- const length = b[at];
360
- at += 1 + length;
361
- if (!length) return at;
362
- }
363
- };
364
- let at = 13 + table(b[10]), framed = false;
365
- check(at <= b.length);
366
- const parts = [b.subarray(0, at)];
367
- for (;;) {
368
- check(at < b.length);
369
- const introducer = b[at];
370
- if (introducer === 59) {
371
- check(framed);
372
- parts.push(Uint8Array.of(59));
373
- return parts;
374
- }
375
- if (introducer === 44) {
376
- check(at + 10 <= b.length);
377
- const data = at + 10 + table(b[at + 9]);
378
- check(data < b.length);
379
- const end = blocks(data + 1);
380
- parts.push(b.subarray(at, end));
381
- framed = true;
382
- at = end;
383
- continue;
384
- }
385
- check(introducer === 33 && at + 2 < b.length);
386
- const label = b[at + 1], end = blocks(at + 2);
387
- const app = label === 255 && b[at + 2] === 11 && GIF_APPS_KEPT.has(text(b, at + 3, 11));
388
- if (label === 249 || label === 1 || app) parts.push(b.subarray(at, end));
389
- else check(label === 254 || label === 255);
390
- at = end;
391
- }
392
- }
393
- var TIFF_DRAWS = /* @__PURE__ */ new Set([
394
- 254,
395
- 255,
396
- 256,
397
- 257,
398
- 258,
399
- 259,
400
- 262,
401
- 263,
402
- 264,
403
- 265,
404
- 266,
405
- 273,
406
- 274,
407
- 277,
408
- 278,
409
- 279,
410
- 280,
411
- 281,
412
- 282,
413
- 283,
414
- 284,
415
- 286,
416
- 287,
417
- 290,
418
- 291,
419
- 292,
420
- 293,
421
- 296,
422
- 297,
423
- 301,
424
- 317,
425
- 318,
426
- 319,
427
- 320,
428
- 321,
429
- 322,
430
- 323,
431
- 324,
432
- 325,
433
- 332,
434
- 334,
435
- 336,
436
- 338,
437
- 339,
438
- 340,
439
- 341,
440
- 529,
441
- 530,
442
- 531,
443
- 532,
444
- 34675
445
- ]);
446
- /** Text and documents about the picture: DocumentName to HostComputer, InkNames, XMP, Copyright, IPTC, Photoshop, Windows' XP tags, PrintIM. */
447
- var TIFF_METADATA = /* @__PURE__ */ new Set([
448
- 269,
449
- 270,
450
- 271,
451
- 272,
452
- 285,
453
- 305,
454
- 306,
455
- 315,
456
- 316,
457
- 333,
458
- 700,
459
- 33432,
460
- 33723,
461
- 34377,
462
- 18246,
463
- 18249,
464
- 40091,
465
- 40092,
466
- 40093,
467
- 40094,
468
- 40095,
469
- 50341
470
- ]);
471
- /** The IFDs of Exif, GPS and interoperability, emptied whole. */
472
- var TIFF_METADATA_IFDS = /* @__PURE__ */ new Set([
473
- 34665,
474
- 34853,
475
- 40965
476
- ]);
477
- /** Compression without JPEG: none, CCITT, LZW, Deflate, PackBits. */
478
- var TIFF_COMPRESSION = /* @__PURE__ */ new Set([
479
- 1,
480
- 2,
481
- 3,
482
- 4,
483
- 5,
484
- 8,
485
- 32773,
486
- 32946
487
- ]);
488
- /** Bytes per value of each field type. */
489
- var TIFF_TYPE_BYTES = [
490
- 0,
491
- 1,
492
- 1,
493
- 2,
494
- 4,
495
- 8,
496
- 1,
497
- 1,
498
- 2,
499
- 4,
500
- 8,
501
- 4,
502
- 8,
503
- 4
504
- ];
505
- function stripTiff(b) {
506
- const little = b[0] === 73;
507
- const u16 = (at) => {
508
- check(at + 2 <= b.length);
509
- return little ? b[at] | b[at + 1] << 8 : u16be(b, at);
510
- };
511
- const u32 = (at) => {
512
- check(at + 4 <= b.length);
513
- return little ? u32le(b, at) : u32be(b, at);
514
- };
515
- check(b.length >= 8 && u16(2) === 42);
516
- const out = b.slice(), seen = /* @__PURE__ */ new Set();
517
- /** An IFD's entries: tag, type, the value's first byte (in the entry or where it points) and its bytes. */
518
- const entries = (ifd) => {
519
- check(ifd >= 8 && !seen.has(ifd) && seen.size < 1024);
520
- seen.add(ifd);
521
- const count = u16(ifd), next = ifd + 2 + count * 12;
522
- u32(next);
523
- return {
524
- next,
525
- list: Array.from({ length: count }, (_, i) => {
526
- const at = ifd + 2 + i * 12, tag = u16(at), type = u16(at + 2);
527
- check(type >= 1 && type < TIFF_TYPE_BYTES.length);
528
- const bytes = TIFF_TYPE_BYTES[type] * u32(at + 4);
529
- const value = bytes <= 4 ? at + 8 : u32(at + 8);
530
- check(Number.isSafeInteger(bytes) && value + bytes <= b.length);
531
- return {
532
- at,
533
- tag,
534
- type,
535
- value,
536
- bytes
537
- };
538
- })
539
- };
540
- };
541
- /** An Exif, GPS or interoperability IFD: every value zeroed, then the IFD itself, so it holds no entry. */
542
- const empty = (ifd) => {
543
- const { next, list } = entries(ifd);
544
- for (const entry of list) {
545
- check(entry.tag !== 37500);
546
- if (TIFF_METADATA_IFDS.has(entry.tag)) empty(u32(entry.value));
547
- out.fill(0, entry.value, entry.value + entry.bytes);
548
- }
549
- out.fill(0, ifd, next + 4);
550
- };
551
- for (let ifd = u32(4); ifd;) {
552
- const { next, list } = entries(ifd);
553
- for (const { tag, value, bytes } of list) {
554
- if (tag === 259) check(TIFF_COMPRESSION.has(u16(value)));
555
- if (TIFF_METADATA_IFDS.has(tag)) empty(u32(value));
556
- else if (TIFF_METADATA.has(tag)) out.fill(0, value, value + bytes);
557
- else check(TIFF_DRAWS.has(tag));
558
- }
559
- ifd = u32(next);
560
- }
561
- return [out];
562
- }
563
- var STRIP = {
564
- jpeg: stripJpeg,
565
- png: stripPng,
566
- webp: stripWebp,
567
- heif: stripHeif,
568
- gif: stripGif,
569
- tiff: stripTiff
570
- };
571
- /**
572
- * A picture's bytes without its metadata, as parts to put in a Blob; undefined when the file is not a picture this
573
- * strips (by its bytes and its type), so it goes as it is. Throws `NO_PICTURE_METADATA` when it is one but its
574
- * metadata cannot be removed.
575
- */
576
- function stripPictureMetadata(bytes, mime) {
577
- const kind = kindOf(bytes);
578
- if (!kind) {
579
- if (STRIPPED_TYPES.has(mime.split(";")[0].trim().toLowerCase())) throw new Error(NO_PICTURE_METADATA);
580
- return;
581
- }
582
- return STRIP[kind](bytes);
583
- }
584
- /**
585
- * Whether a file is a picture whose metadata goes before it is sent, by its first `PICTURE_METADATA_LIMITS.headBytes`
586
- * bytes or by its type: then it is read whole and stripped (`stripPictureMetadata`), else it goes as it is.
587
- */
588
- function isStrippedPicture(head, mime) {
589
- return !!kindOf(head) || STRIPPED_TYPES.has(mime.split(";")[0].trim().toLowerCase());
590
- }
591
- /**
592
- * `source` as it is sent: without its metadata when it is a picture (`stripPictureMetadata`), or undefined when it is
593
- * not one and goes as it is. Only its first bytes are read for any other file. Throws `NO_PICTURE_METADATA` for a
594
- * picture that cannot be stripped or is past `PICTURE_METADATA_LIMITS.maxBytes`; an error reading `source` as it is.
595
- */
596
- async function withoutPictureMetadata(source, mime) {
597
- if (!isStrippedPicture(new Uint8Array(await source.slice(0, PICTURE_METADATA_LIMITS.headBytes).arrayBuffer()), mime)) return void 0;
598
- if (source.size > PICTURE_METADATA_LIMITS.maxBytes) throw new Error(NO_PICTURE_METADATA);
599
- const parts = stripPictureMetadata(new Uint8Array(await source.arrayBuffer()), mime);
600
- return parts && new Blob(parts, { type: mime });
601
- }
602
- //#endregion
603
12
  //#region ../browser/src/engine/paymentAdapters/away.ts
604
13
  var away = /* @__PURE__ */ new Map();
605
14
  /** The wallets away from this device, by wallet id, with the name of their home device ("" when it has none here). */
@@ -732,6 +141,7 @@ var ModeGate = class {
732
141
  */
733
142
  function iceServerProblem(server) {
734
143
  if (typeof server?.urls !== "string") return "Each ICE server needs urls: one address, or several comma-separated (turn:host:port)";
144
+ if ([server.username, server.credential].some((value) => value !== void 0 && typeof value !== "string")) return "A TURN server's username and credential are texts";
735
145
  const urls = server.urls.split(/[\s,]+/).filter(Boolean);
736
146
  if (!urls.length) return "Enter the TURN server address";
737
147
  for (const url of urls) {
@@ -2650,7 +2060,7 @@ var registry;
2650
2060
  var loading;
2651
2061
  var listeners = /* @__PURE__ */ new Set();
2652
2062
  function loadIdentityProviders() {
2653
- return loading ??= import("./registry-CZTmtSws.js").then((m) => {
2063
+ return loading ??= import("./registry-PTtBMaYZ.js").then((m) => {
2654
2064
  registry = m;
2655
2065
  for (const listener of listeners) listener();
2656
2066
  return m;
@@ -2799,7 +2209,7 @@ var IdentityProofs = class {
2799
2209
  */
2800
2210
  verifyContact = async (statement, evidence) => {
2801
2211
  if (!this.host.relayOnly?.()) return this.verify(statement, evidence);
2802
- const { fixedIdentityHosts } = await import("./fixedHosts-BiukTsd9.js");
2212
+ const { fixedIdentityHosts } = await import("./fixedHosts-B598JzbC.js");
2803
2213
  const fixed = fixedIdentityHosts();
2804
2214
  let refused;
2805
2215
  const fetch = async (url, options) => {
@@ -2868,6 +2278,7 @@ var IdentityProofs = class {
2868
2278
  if (!draft) throw new Error("This proof was started too long ago. Start again.");
2869
2279
  const statement = identityStatement(draft.binding);
2870
2280
  const verified = await this.verify(statement, JSON.parse(JSON.stringify(evidence ?? null)));
2281
+ if (this.drafts.get(draftId) !== draft) throw new Error("This proof was started too long ago. Start again.");
2871
2282
  if (this.proofs.length >= MAX_PROOFS) throw new Error("Remove an identity first");
2872
2283
  this.drafts.delete(draftId);
2873
2284
  const stored = {
@@ -4701,6 +4112,6 @@ function messageFile(kept) {
4701
4112
  };
4702
4113
  }
4703
4114
  //#endregion
4704
- export { ModeChanged as $, IdentityProofs as A, INVOICE_PACE as B, FileAppender as C, streamStored as D, storedSize as E, LightningCards as F, cashuMint as G, ProviderSources as H, cardsKey as I, breezDatabasesFor as J, breezDatabase as K, isRecoveryPhrase as L, sealSecret as M, whenDataKeyDropped as N, waitingGroupFile as O, CASHU_CARD as P, relayOnlyProblem as Q, normalizePhrase as R, WALLET_TYPES as S, removeStored as T, sourceKey as U, nextInvoiceAsk as V, CASHU_MINT_SOURCE as W, iceServerProblem as X, dropBreezDatabase as Y, iceServerSetting as Z, crossNetwork as _, storedGroupFiles as a, requireTurn as at, walletInstances as b, receivedPairedReply as c, NO_PICTURE_METADATA as ct, paymentAlias as d, stripPictureMetadata as dt, ModeGate as et, paymentWireId as f, withoutPictureMetadata as ft, createTiming as g, createFailure as h, groupOfFile as i, refuseAway as it, openSecret as j, IDENTITY_DRAFT_TTL_MS as k, replyRef as l, PICTURE_METADATA_LIMITS as lt, assertConfirmedReal as m, groupFileId as n, networkLabel as nt, groupReply as o, setAwayWallets as ot, WALLET_NAMES as p, breezDatabaseInUse as q, groupFileText as r, awayFrom as rt, pairedWireReply as s, setSingleWriterGate as st, GroupFileDesk as t, WrongNetworkError as tt, replyTo as u, isStrippedPicture as ut, paymentNetwork as v, readStored as w, MESSAGE_DETAILS_MAX_BYTES as x, paymentNetworksOf as y, lightningPaying as z };
4115
+ export { ModeChanged as $, IdentityProofs as A, INVOICE_PACE as B, FileAppender as C, streamStored as D, storedSize as E, LightningCards as F, cashuMint as G, ProviderSources as H, cardsKey as I, breezDatabasesFor as J, breezDatabase as K, isRecoveryPhrase as L, sealSecret as M, whenDataKeyDropped as N, waitingGroupFile as O, CASHU_CARD as P, relayOnlyProblem as Q, normalizePhrase as R, WALLET_TYPES as S, removeStored as T, sourceKey as U, nextInvoiceAsk as V, CASHU_MINT_SOURCE as W, iceServerProblem as X, dropBreezDatabase as Y, iceServerSetting as Z, crossNetwork as _, storedGroupFiles as a, requireTurn as at, walletInstances as b, receivedPairedReply as c, paymentAlias as d, ModeGate as et, paymentWireId as f, createTiming as g, createFailure as h, groupOfFile as i, refuseAway as it, openSecret as j, IDENTITY_DRAFT_TTL_MS as k, replyRef as l, assertConfirmedReal as m, groupFileId as n, networkLabel as nt, groupReply as o, setAwayWallets as ot, WALLET_NAMES as p, breezDatabaseInUse as q, groupFileText as r, awayFrom as rt, pairedWireReply as s, setSingleWriterGate as st, GroupFileDesk as t, WrongNetworkError as tt, replyTo as u, paymentNetwork as v, readStored as w, MESSAGE_DETAILS_MAX_BYTES as x, paymentNetworksOf as y, lightningPaying as z };
4705
4116
 
4706
- //# sourceMappingURL=groupFiles-CeF9nPv9.js.map
4117
+ //# sourceMappingURL=groupFiles-FXel6zIc.js.map