@ghostlytools/cli 1.8.0 → 1.8.1
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 +4 -4
- package/dist/assets/{api-I_KbuXHa.js → api-BpQC8dAw.js} +68 -33
- package/dist/assets/api-BpQC8dAw.js.map +1 -0
- package/dist/assets/{api-Dj1yn0px.js → api-CttDF-S5.js} +2 -2
- package/dist/assets/{apiKit-C-_PWZvy.js → apiKit-CSMeHKgo.js} +2 -2
- package/dist/assets/{apiKit-C-_PWZvy.js.map → apiKit-CSMeHKgo.js.map} +1 -1
- package/dist/assets/{apps-DKIe8VjF.js → apps-DqTyZ40T.js} +2 -2
- package/dist/assets/{apps-DKIe8VjF.js.map → apps-DqTyZ40T.js.map} +1 -1
- package/dist/assets/{apps-DbEfL_3b.js → apps-DzFMdVt6.js} +1 -1
- package/dist/assets/{arkade-k1bdSm70.js → arkade-Cu3TbPxC.js} +2 -2
- package/dist/assets/{arkade-k1bdSm70.js.map → arkade-Cu3TbPxC.js.map} +1 -1
- package/dist/assets/{backup-Cdd6-HNu.js → backup-CLZOORFC.js} +1 -1
- package/dist/assets/{backup-beKfbfNk.js → backup-CyTZhu28.js} +4 -4
- package/dist/assets/{backup-beKfbfNk.js.map → backup-CyTZhu28.js.map} +1 -1
- package/dist/assets/{buttons-ClI13rdv.js → buttons-Bd9fR31r.js} +173 -20
- package/dist/assets/buttons-Bd9fR31r.js.map +1 -0
- package/dist/assets/buttons-c4CJnL6i.js +2 -0
- package/dist/assets/{envelope-B88yiCQj.js → envelope-CGfUsR1m.js} +2 -2
- package/dist/assets/{envelope-B88yiCQj.js.map → envelope-CGfUsR1m.js.map} +1 -1
- package/dist/assets/fixedHosts-BiukTsd9.js +24 -0
- package/dist/assets/fixedHosts-BiukTsd9.js.map +1 -0
- package/dist/assets/{ghostly_iroh_web-CO0onry8.js → ghostly_iroh_web-BzAXJUYH.js} +10 -10
- package/dist/assets/{ghostly_iroh_web-CO0onry8.js.map → ghostly_iroh_web-BzAXJUYH.js.map} +1 -1
- package/dist/assets/ghostly_iroh_web_bg.wasm +0 -0
- package/dist/assets/{groupFiles-DjQc5XXv.js → groupFiles-CeF9nPv9.js} +631 -12
- package/dist/assets/groupFiles-CeF9nPv9.js.map +1 -0
- package/dist/assets/{host-CNWGB3-j.js → host-CKAehWP6.js} +30 -18
- package/dist/assets/host-CKAehWP6.js.map +1 -0
- package/dist/assets/hyperdhtRelay-1wzya_0L.js +25 -0
- package/dist/assets/hyperdhtRelay-1wzya_0L.js.map +1 -0
- package/dist/assets/{hyperdhtRelay-g7eXzf5h.js → hyperdhtRelay-B8Pdykhg.js} +15 -3
- package/dist/assets/hyperdhtRelay-B8Pdykhg.js.map +1 -0
- package/dist/assets/{irohWeb-Bx8dI4be.js → irohWeb-D6tAPHZa.js} +11 -7
- package/dist/assets/{irohWeb-Bx8dI4be.js.map → irohWeb-D6tAPHZa.js.map} +1 -1
- package/dist/assets/{main-BRxhBctJ.js → main-BDY-pfpz.js} +17 -17
- package/dist/assets/{main-BRxhBctJ.js.map → main-BDY-pfpz.js.map} +1 -1
- package/dist/assets/{mainline-CwuS6ngj.js → mainline-3ueXpFQL.js} +2 -2
- package/dist/assets/{mainline-CwuS6ngj.js.map → mainline-3ueXpFQL.js.map} +1 -1
- package/dist/assets/{networkReason-CIAMieQm.js → networkReason-DhJYOomu.js} +2 -2
- package/dist/assets/{networkReason-CIAMieQm.js.map → networkReason-DhJYOomu.js.map} +1 -1
- package/dist/assets/{nwc-C9JLJJkL.js → nwc-B1Quqda-.js} +3 -3
- package/dist/assets/{nwc-C9JLJJkL.js.map → nwc-B1Quqda-.js.map} +1 -1
- package/dist/assets/{nwcProvider-pFMrsUJh.js → nwcProvider-DUB6xO-b.js} +2 -2
- package/dist/assets/{nwcProvider-pFMrsUJh.js.map → nwcProvider-DUB6xO-b.js.map} +1 -1
- package/dist/assets/ownDid-BfqHJdA6.js +281 -0
- package/dist/assets/ownDid-BfqHJdA6.js.map +1 -0
- package/dist/assets/{registry-DY2ixQfU.js → registry-CZTmtSws.js} +1 -1
- package/dist/assets/{registry-Cks7FA_o.js → registry-DwlTNQjr.js} +5 -246
- package/dist/assets/registry-DwlTNQjr.js.map +1 -0
- package/dist/assets/{resolve-C4Y2HPqQ.js → resolve-BVwhiYjj.js} +3 -280
- package/dist/assets/resolve-BVwhiYjj.js.map +1 -0
- package/dist/assets/{server-D9RAmGdm.js → server-Br3XPwFG.js} +365 -107
- package/dist/assets/server-Br3XPwFG.js.map +1 -0
- package/dist/assets/{src-1RU4TilT.js → src-C4sOH4zH.js} +233 -106
- package/dist/assets/src-C4sOH4zH.js.map +1 -0
- package/dist/assets/sshForges-CQQomStK.js +253 -0
- package/dist/assets/sshForges-CQQomStK.js.map +1 -0
- package/dist/assets/{translate-od5GbpvR.js → translate-C2aNyUkR.js} +11 -5
- package/dist/assets/translate-C2aNyUkR.js.map +1 -0
- package/dist/assets/{usdt-DldXV0MR.js → usdt-CMwatDnQ.js} +3 -3
- package/dist/assets/{usdt-DldXV0MR.js.map → usdt-CMwatDnQ.js.map} +1 -1
- package/dist/assets/{words-BS2qq_vV.js → words-CqN2KG1r.js} +2 -2
- package/dist/assets/{words-BS2qq_vV.js.map → words-CqN2KG1r.js.map} +1 -1
- package/dist/ghostly.mjs +1 -1
- package/package.json +1 -1
- package/dist/assets/api-I_KbuXHa.js.map +0 -1
- package/dist/assets/buttons-BO1_7V4L.js +0 -2
- package/dist/assets/buttons-ClI13rdv.js.map +0 -1
- package/dist/assets/groupFiles-DjQc5XXv.js.map +0 -1
- package/dist/assets/host-CNWGB3-j.js.map +0 -1
- package/dist/assets/hyperdhtRelay-BT_wRxab.js +0 -21
- package/dist/assets/hyperdhtRelay-BT_wRxab.js.map +0 -1
- package/dist/assets/hyperdhtRelay-g7eXzf5h.js.map +0 -1
- package/dist/assets/registry-Cks7FA_o.js.map +0 -1
- package/dist/assets/resolve-C4Y2HPqQ.js.map +0 -1
- package/dist/assets/server-D9RAmGdm.js.map +0 -1
- package/dist/assets/src-1RU4TilT.js.map +0 -1
- package/dist/assets/translate-od5GbpvR.js.map +0 -1
|
@@ -1,281 +1,4 @@
|
|
|
1
|
-
import { Ai as recordsFromWellKnown,
|
|
2
|
-
import { l as providerDescriptorProblems } from "./types-C4_KafL_.js";
|
|
3
|
-
//#region ../browser/src/shared/features.ts
|
|
4
|
-
/**
|
|
5
|
-
* A build that may be put into test mode: a development build (`import.meta.env.DEV`, which vitest also sets) or the
|
|
6
|
-
* e2e suite's build (`VITE_APPS_TEST`, fixed when the build is made, as the mini-app switch is). A release build is
|
|
7
|
-
* neither: Vite folds this to `false` there, so the storage flags the test fakes answer to are ignored. The fakes
|
|
8
|
-
* themselves are still in the bundle (the registries import them); plugins may still pass fakes to the registry.
|
|
9
|
-
*/
|
|
10
|
-
var testBuild = () => {
|
|
11
|
-
try {
|
|
12
|
-
return false;
|
|
13
|
-
} catch {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* A suite's switch in the page's storage (`localStorage["ghostly-test-…"]`), read only in a test build (`testBuild`): a
|
|
19
|
-
* release build reads none, so a leftover or pasted key changes nothing there. Null when unset, unreadable or released.
|
|
20
|
-
*/
|
|
21
|
-
var testSwitch = (key) => {
|
|
22
|
-
if (!testBuild()) return null;
|
|
23
|
-
try {
|
|
24
|
-
return globalThis.localStorage?.getItem(key) ?? null;
|
|
25
|
-
} catch {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
//#endregion
|
|
30
|
-
//#region ../browser/src/proofs/verify.ts
|
|
31
|
-
var DAY = 86400;
|
|
32
|
-
/**
|
|
33
|
-
* The checks every proof goes through, whatever its provider: known provider, validity within the
|
|
34
|
-
* provider's limit, bounded evidence, strict parsing, the provider's own check, and the category rule
|
|
35
|
-
* (a self-custodied proof proves exactly the subject it names; an attested one says who attests it).
|
|
36
|
-
* The engine verifies a contact's proof, and the person's own proof before saving it, only through this.
|
|
37
|
-
*/
|
|
38
|
-
async function verifyIdentity(providers, statement, evidence, ctx) {
|
|
39
|
-
const { binding } = statement;
|
|
40
|
-
const provider = providers.find((p) => p.id === binding.provider);
|
|
41
|
-
if (!provider) throw new Error("This app cannot verify this kind of identity");
|
|
42
|
-
if (binding.expiresAt - binding.issuedAt > Math.min(provider.validity.maxDays * DAY, 3456e4)) throw new Error("The proof lasts longer than this kind of identity allows");
|
|
43
|
-
if (JSON.stringify(evidence ?? null).length > 16384) throw new Error("Evidence too large");
|
|
44
|
-
const parsed = provider.parseEvidence(evidence);
|
|
45
|
-
const verified = boundVerifiedIdentity(await provider.verify(statement, parsed, ctx));
|
|
46
|
-
if (provider.category === "self-custodied" && verified.subject !== binding.subject) throw new Error("The evidence is for another identity");
|
|
47
|
-
if (provider.category === "provider-attested" && !verified.attester) throw new Error("The evidence does not say who attests it");
|
|
48
|
-
return verified;
|
|
49
|
-
}
|
|
50
|
-
/** Problems with a provider's descriptor, empty when it is well-formed. The registry and the contract suite use it. */
|
|
51
|
-
function descriptorProblems(p) {
|
|
52
|
-
const problems = [];
|
|
53
|
-
if (!/^[a-z][a-z0-9-]{0,31}$/.test(p.id)) problems.push("id must match ^[a-z][a-z0-9-]{0,31}$");
|
|
54
|
-
if (!p.label?.trim()) problems.push("label is empty");
|
|
55
|
-
if (!p.description?.trim()) problems.push("description is empty");
|
|
56
|
-
if (!p.privacy?.trim()) problems.push("privacy is empty: say what verify contacts");
|
|
57
|
-
if (p.category !== "self-custodied" && p.category !== "provider-attested") problems.push("category is unknown");
|
|
58
|
-
if (!p.platforms.length) problems.push("no platforms");
|
|
59
|
-
const { defaultDays, maxDays } = p.validity;
|
|
60
|
-
if (!(Number.isInteger(defaultDays) && Number.isInteger(maxDays) && defaultDays >= 1 && defaultDays <= maxDays && maxDays * DAY <= 3456e4)) problems.push("validity must be whole days, 1 ≤ default ≤ max ≤ 400");
|
|
61
|
-
if (p.recheck && !(Number.isInteger(p.recheck.afterSeconds) && p.recheck.afterSeconds >= 60)) problems.push("recheck.afterSeconds must be at least 60");
|
|
62
|
-
if (!p.signers.length) problems.push("no signers");
|
|
63
|
-
const ids = p.signers.map((s) => s.id);
|
|
64
|
-
if (new Set(ids).size !== ids.length) problems.push("signer ids are not unique");
|
|
65
|
-
for (const s of p.signers) {
|
|
66
|
-
if (![
|
|
67
|
-
"in-app",
|
|
68
|
-
"external-tool",
|
|
69
|
-
"redirect",
|
|
70
|
-
"publish"
|
|
71
|
-
].includes(s.kind)) problems.push(`signer ${s.id} has an unknown kind`);
|
|
72
|
-
if (s.kind === "in-app" && typeof s.run !== "function") problems.push(`signer ${s.id} has no run()`);
|
|
73
|
-
if (s.kind === "external-tool" && (typeof s.instructions !== "function" || typeof s.parse !== "function")) problems.push(`signer ${s.id} needs instructions() and parse()`);
|
|
74
|
-
if (s.kind === "redirect" && typeof s.start !== "function") problems.push(`signer ${s.id} has no start()`);
|
|
75
|
-
if (s.kind === "publish" && (typeof s.instructions !== "function" || typeof s.evidence !== "function")) problems.push(`signer ${s.id} needs instructions() and evidence()`);
|
|
76
|
-
}
|
|
77
|
-
return problems;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* The engine's `ctx.fetch`: HTTPS GET only, no credentials or referrer, a time-out, a size cap,
|
|
81
|
-
* redirects refused unless asked for.
|
|
82
|
-
* `online` false refuses everything (the person turned the network off).
|
|
83
|
-
*/
|
|
84
|
-
function boundedIdentityFetch(options = { online: () => true }) {
|
|
85
|
-
return async (url, { headers, maxBytes = 65536, signal, redirect = "error" } = {}) => {
|
|
86
|
-
if (!options.online()) throw new Error("Offline: this identity cannot be checked now");
|
|
87
|
-
const target = new URL(url);
|
|
88
|
-
if (target.protocol !== "https:" || target.username || target.password) throw new Error("Identity checks use HTTPS only");
|
|
89
|
-
const timeout = AbortSignal.timeout(options.timeoutMs ?? 1e4);
|
|
90
|
-
const response = await (options.fetcher ?? fetch)(target.href, {
|
|
91
|
-
headers,
|
|
92
|
-
signal: signal ? AbortSignal.any([signal, timeout]) : timeout,
|
|
93
|
-
credentials: "omit",
|
|
94
|
-
referrerPolicy: "no-referrer",
|
|
95
|
-
cache: "no-store",
|
|
96
|
-
redirect
|
|
97
|
-
});
|
|
98
|
-
if (Number(response.headers.get("content-length")) > maxBytes) throw new Error("Identity check response too large");
|
|
99
|
-
const reader = response.body?.getReader();
|
|
100
|
-
const parts = [];
|
|
101
|
-
let length = 0;
|
|
102
|
-
if (reader) try {
|
|
103
|
-
for (;;) {
|
|
104
|
-
const { done, value } = await reader.read();
|
|
105
|
-
if (done) break;
|
|
106
|
-
length += value.length;
|
|
107
|
-
if (length > maxBytes) throw new Error("Identity check response too large");
|
|
108
|
-
parts.push(value);
|
|
109
|
-
}
|
|
110
|
-
} finally {
|
|
111
|
-
await reader.cancel().catch(() => {});
|
|
112
|
-
}
|
|
113
|
-
const bytes = new Uint8Array(length);
|
|
114
|
-
let offset = 0;
|
|
115
|
-
for (const part of parts) {
|
|
116
|
-
bytes.set(part, offset);
|
|
117
|
-
offset += part.length;
|
|
118
|
-
}
|
|
119
|
-
return {
|
|
120
|
-
status: response.status,
|
|
121
|
-
contentType: response.headers.get("content-type") ?? "",
|
|
122
|
-
text: new TextDecoder().decode(bytes),
|
|
123
|
-
bytes
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
//#endregion
|
|
128
|
-
//#region ../browser/src/plugins/bundled.ts
|
|
129
|
-
/**
|
|
130
|
-
* The adapter plugins compiled into this build. Empty unless the build lists some: `GHOSTLY_PLUGINS`
|
|
131
|
-
* names their modules (comma-separated paths from the repository root, each default-exporting a
|
|
132
|
-
* `GhostlyAdapterPlugin`), and the Vite plugin in `packages/browser/vite-plugin.ts` swaps this module
|
|
133
|
-
* for one that imports them. Release builds never set it; the e2e build carries the SDK example.
|
|
134
|
-
*/
|
|
135
|
-
var BUNDLED_PLUGINS = [];
|
|
136
|
-
var PLUGIN_ID = /^[a-z][a-z0-9-]{0,63}$/;
|
|
137
|
-
var KEY = Symbol.for("ghostly.adapters/1");
|
|
138
|
-
function store() {
|
|
139
|
-
const g = globalThis;
|
|
140
|
-
return g[KEY] ??= {
|
|
141
|
-
plugins: /* @__PURE__ */ new Map(),
|
|
142
|
-
reserved: {
|
|
143
|
-
lightning: /* @__PURE__ */ new Set(),
|
|
144
|
-
onchain: /* @__PURE__ */ new Set(),
|
|
145
|
-
identity: /* @__PURE__ */ new Set()
|
|
146
|
-
},
|
|
147
|
-
listeners: /* @__PURE__ */ new Set(),
|
|
148
|
-
seeded: false
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
var ids = (kind, plugin) => {
|
|
152
|
-
const list = kind === "identity" ? plugin.identities : kind === "lightning" ? plugin.lightning : plugin.onchain;
|
|
153
|
-
return Array.isArray(list) ? list.map((a) => a?.id) : [];
|
|
154
|
-
};
|
|
155
|
-
var KINDS = [
|
|
156
|
-
"lightning",
|
|
157
|
-
"onchain",
|
|
158
|
-
"identity"
|
|
159
|
-
];
|
|
160
|
-
/** Problems with a plugin, empty when it can be registered. Does not look at what is already registered. */
|
|
161
|
-
function pluginProblems(plugin) {
|
|
162
|
-
const problems = [];
|
|
163
|
-
if (!plugin || typeof plugin !== "object") return ["not a plugin object"];
|
|
164
|
-
if (!PLUGIN_ID.test(plugin.id ?? "")) problems.push("plugin id must match ^[a-z][a-z0-9-]{0,63}$");
|
|
165
|
-
if (plugin.sdk !== 1) problems.push(`plugin was written for SDK API ${String(plugin.sdk)}; this app speaks 1`);
|
|
166
|
-
if (plugin.version !== void 0 && (typeof plugin.version !== "string" || plugin.version.length > 64)) problems.push("version must be a short string");
|
|
167
|
-
for (const kind of ["lightning", "onchain"]) {
|
|
168
|
-
const list = plugin[kind];
|
|
169
|
-
if (list === void 0) continue;
|
|
170
|
-
if (!Array.isArray(list)) {
|
|
171
|
-
problems.push(`${kind} must be a list of descriptors`);
|
|
172
|
-
continue;
|
|
173
|
-
}
|
|
174
|
-
for (const d of list) {
|
|
175
|
-
if (!d || typeof d !== "object") {
|
|
176
|
-
problems.push(`${kind} ${String(d)}: not a descriptor`);
|
|
177
|
-
continue;
|
|
178
|
-
}
|
|
179
|
-
const own = providerDescriptorProblems(d);
|
|
180
|
-
if (d?.kind && d.kind !== kind) own.push(`is listed under ${kind} but says kind ${String(d.kind)}`);
|
|
181
|
-
problems.push(...own.map((p) => `${kind} ${String(d?.id)}: ${p}`));
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
if (plugin.identities !== void 0) {
|
|
185
|
-
if (!Array.isArray(plugin.identities)) problems.push("identities must be a list of providers");
|
|
186
|
-
else for (const p of plugin.identities) if (!p || typeof p !== "object") problems.push(`identity ${String(p)}: not a provider`);
|
|
187
|
-
else problems.push(...descriptorProblems(p).map((m) => `identity ${String(p.id)}: ${m}`));
|
|
188
|
-
}
|
|
189
|
-
for (const kind of KINDS) {
|
|
190
|
-
const list = ids(kind, plugin);
|
|
191
|
-
if (new Set(list).size !== list.length) problems.push(`${kind} ids are not unique within the plugin`);
|
|
192
|
-
}
|
|
193
|
-
if (!KINDS.some((kind) => ids(kind, plugin).length)) problems.push("the plugin brings no adapter");
|
|
194
|
-
return problems;
|
|
195
|
-
}
|
|
196
|
-
/** The built-in registries say which ids are theirs. A plugin using one is refused. */
|
|
197
|
-
function reserveAdapterIds(kind, list) {
|
|
198
|
-
const s = store();
|
|
199
|
-
for (const id of list) s.reserved[kind].add(id);
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Registers a plugin's adapters. Throws, registering nothing, when the plugin is malformed, its id or
|
|
203
|
-
* one of its adapters' ids is taken (by a built-in or by another plugin), or its contract generation
|
|
204
|
-
* is another one. Returns the function that unregisters it.
|
|
205
|
-
*/
|
|
206
|
-
function registerAdapters(plugin) {
|
|
207
|
-
const problems = pluginProblems(plugin);
|
|
208
|
-
const s = store();
|
|
209
|
-
if (!problems.length) {
|
|
210
|
-
if (s.plugins.has(plugin.id)) problems.push(`a plugin with id ${plugin.id} is already registered`);
|
|
211
|
-
for (const kind of KINDS) for (const id of ids(kind, plugin)) {
|
|
212
|
-
if (s.reserved[kind].has(id)) problems.push(`${kind} ${id} is a built-in of this app`);
|
|
213
|
-
for (const other of s.plugins.values()) if (ids(kind, other).includes(id)) problems.push(`${kind} ${id} is already registered by plugin ${other.id}`);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
if (problems.length) throw new Error(`Cannot register plugin ${String(plugin?.id)}: ${problems.join("; ")}`);
|
|
217
|
-
s.plugins.set(plugin.id, plugin);
|
|
218
|
-
notify(s);
|
|
219
|
-
return () => {
|
|
220
|
-
if (s.plugins.get(plugin.id) === plugin) {
|
|
221
|
-
s.plugins.delete(plugin.id);
|
|
222
|
-
notify(s);
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
function notify(s) {
|
|
227
|
-
for (const listener of s.listeners) try {
|
|
228
|
-
listener();
|
|
229
|
-
} catch {}
|
|
230
|
-
}
|
|
231
|
-
/** Called when a plugin registers or unregisters: the engine re-reads the lists. */
|
|
232
|
-
function onAdaptersChanged(listener) {
|
|
233
|
-
const s = store();
|
|
234
|
-
s.listeners.add(listener);
|
|
235
|
-
return () => {
|
|
236
|
-
s.listeners.delete(listener);
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
/** Every registered plugin, in registration order (bundled ones first). */
|
|
240
|
-
function registeredPlugins() {
|
|
241
|
-
seed();
|
|
242
|
-
return [...store().plugins.values()];
|
|
243
|
-
}
|
|
244
|
-
function registeredLightningProviders() {
|
|
245
|
-
return registeredPlugins().flatMap((p) => p.lightning ?? []);
|
|
246
|
-
}
|
|
247
|
-
function registeredOnchainProviders() {
|
|
248
|
-
return registeredPlugins().flatMap((p) => p.onchain ?? []);
|
|
249
|
-
}
|
|
250
|
-
function registeredIdentityProviders() {
|
|
251
|
-
return registeredPlugins().flatMap((p) => p.identities ?? []);
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* The plugins compiled into this build register once, when they are first asked for. A broken one is
|
|
255
|
-
* reported and skipped rather than taking the app down with it; the e2e that expects it fails instead.
|
|
256
|
-
*/
|
|
257
|
-
function seed() {
|
|
258
|
-
const s = store();
|
|
259
|
-
if (s.seeded) return;
|
|
260
|
-
s.seeded = true;
|
|
261
|
-
for (const plugin of BUNDLED_PLUGINS) try {
|
|
262
|
-
registerAdapters(plugin);
|
|
263
|
-
} catch (error) {
|
|
264
|
-
console.error(`[ghostly] a bundled adapter plugin was not loaded: ${error instanceof Error ? error.message : String(error)}`);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
//#endregion
|
|
268
|
-
//#region ../browser/src/proofs/ownDid.ts
|
|
269
|
-
/**
|
|
270
|
-
* The profile's own Ghostly did:dht, which the DID provider refuses as an external identity. The UI and the engine each
|
|
271
|
-
* set where to read it. Here, not in the provider, so setting it does not load the providers.
|
|
272
|
-
*/
|
|
273
|
-
var source = () => void 0;
|
|
274
|
-
function setOwnDidSource(read) {
|
|
275
|
-
source = read;
|
|
276
|
-
}
|
|
277
|
-
var ownDid = () => source();
|
|
278
|
-
//#endregion
|
|
1
|
+
import { Ai as recordsFromWellKnown, Di as nip05RootKey, Ei as isPublicAddress, Mi as txtValue, Mu as toBase64Url, Ni as wellKnownUrl, Oi as normalizeDomain, Si as dnsProofName, Ti as encodeDnsQuery, Vi as IdentityCheckUnavailable, bi as DOMAIN_FILE_MAX_BYTES, ft as atprotoDidMethod, gt as isAtprotoDid, ji as recordsName, ki as recordsFromTxt, vt as parseAtprotoDidDocument, xi as decodeDnsResponse } from "./src-C4sOH4zH.js";
|
|
279
2
|
//#region ../browser/src/proofs/domain.ts
|
|
280
3
|
/** Public resolvers that answer RFC 8484 wire-format GETs with CORS (checked 2026-09-23). */
|
|
281
4
|
var DOH_RESOLVERS = [
|
|
@@ -650,6 +373,6 @@ async function verifiedAtprotoHandle(doc, options) {
|
|
|
650
373
|
return { missing: found.did || found.checked ? "elsewhere" : "unchecked" };
|
|
651
374
|
}
|
|
652
375
|
//#endregion
|
|
653
|
-
export {
|
|
376
|
+
export { verifiedAtprotoHandle as a, assertDomainRecord as c, chosenResolver as d, resolverById as f, resolveAtprotoHandle as i, assertNip05 as l, plcDirectory as n, DOH_RESOLVERS as o, resolveAtprotoDid as r, DomainCheckError as s, assertPublicServer as t, assertPublicHost as u };
|
|
654
377
|
|
|
655
|
-
//# sourceMappingURL=resolve-
|
|
378
|
+
//# sourceMappingURL=resolve-BVwhiYjj.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-BVwhiYjj.js","names":[],"sources":["../../../browser/src/proofs/domain.ts","../../../browser/src/proofs/atproto/resolve.ts"],"sourcesContent":["import {\n DOMAIN_FILE_MAX_BYTES, decodeDnsResponse, dnsProofName, encodeDnsQuery, IdentityCheckUnavailable, isPublicAddress, nip05RootKey, normalizeDomain,\n recordsFromTxt, recordsFromWellKnown, recordsName, toBase64Url, txtValue, wellKnownUrl,\n type DnsResponse, type DnsType, type DomainMethod, type DomainRecord,\n} from '@ghostly/core';\nimport type { IdentityFetch } from './contract';\n\n/**\n * Network side of domain proofs: DNS TXT through DNS over HTTPS and the\n * `/.well-known/` files, under strict limits. Nothing here trusts the prover:\n * the domain comes from the signed binding, the URLs are built here, every\n * answer is bounded and parsed strictly, and lookups are cached only briefly.\n *\n * What a check reveals, and to whom:\n * - DNS: the chosen resolver learns that this device looked up `_ghostly.<domain>`\n * (the next one in DOH_RESOLVERS too, when the chosen one gives no answer).\n * The domain's own servers see only the resolver.\n * - HTTPS / NIP-05: the resolver learns the domain (its addresses are looked up\n * first, to refuse private networks), and the domain's web server — run by\n * the person being checked — sees this device's IP address and when.\n */\n\nexport type DohResolverId = 'quad9' | 'cloudflare' | 'google';\nexport interface DohResolver { id: DohResolverId; name: string; url: string }\n/** Public resolvers that answer RFC 8484 wire-format GETs with CORS (checked 2026-09-23). */\nexport const DOH_RESOLVERS: readonly DohResolver[] = [\n { id: 'quad9', name: 'Quad9', url: 'https://dns.quad9.net/dns-query' },\n { id: 'cloudflare', name: 'Cloudflare', url: 'https://cloudflare-dns.com/dns-query' },\n { id: 'google', name: 'Google', url: 'https://dns.google/dns-query' },\n];\nexport const DEFAULT_RESOLVER: DohResolverId = 'quad9';\nexport const resolverById = (id: string | null | undefined): DohResolver =>\n DOH_RESOLVERS.find(r => r.id === id) ?? DOH_RESOLVERS.find(r => r.id === DEFAULT_RESOLVER)!;\n\n/** The person's resolver choice, per browser profile (UI and engine share the origin). */\nexport const RESOLVER_SETTING = 'ghostly-doh-resolver';\nexport function chosenResolver(): DohResolver {\n try { return resolverById(globalThis.localStorage?.getItem(RESOLVER_SETTING)); } catch { return resolverById(undefined); }\n}\nexport function chooseResolver(id: DohResolverId): void {\n try { globalThis.localStorage?.setItem(RESOLVER_SETTING, resolverById(id).id); } catch { /* not persisted: the default stays */ }\n}\n\nexport const DNS_MAX_BYTES = 16 * 1024;\n/**\n * Lookups are shared between checks for the DNS TTL, capped: never staler than the resolver itself would\n * be, so a re-check sees a removal as soon as DNS does. Files have no TTL and are only shared in flight.\n */\nconst CACHE_MAX_MS = 30_000, CACHE_FILE_MS = 0;\n\n/** The contract's `ctx.fetch`: HTTPS GET, no credentials, bounded, redirects refused unless asked, with raw bytes. */\nexport type DomainFetch = IdentityFetch;\n\nexport interface DomainLookupOptions {\n fetch: DomainFetch;\n resolver?: DohResolverId;\n signal?: AbortSignal;\n /** Milliseconds. */\n now?: () => number;\n}\n\n/** A check that did not confirm the record, with a message for people. */\nexport class DomainCheckError extends Error {}\n\n/** A resolver that gave no DNS answer at all: not reached, or it refused the request. The next one may answer. */\nclass ResolverUnavailable extends IdentityCheckUnavailable {}\n\n/*\n * What this side's resolver, or the network between it and a host, did (no answer, an error, an HTTP status other\n * than the file or its absence) is IdentityCheckUnavailable: the contact is told only that the check could not be\n * finished, never the host, port or status seen here.\n */\n\n/** One RFC 8484 GET to one resolver. The query has ID 0 and no client subnet, so it carries only the name. */\nasync function askResolver(resolver: DohResolver, name: string, type: DnsType, options: DomainLookupOptions): Promise<DnsResponse> {\n let response: Awaited<ReturnType<DomainFetch>>;\n try {\n response = await options.fetch(`${resolver.url}?dns=${toBase64Url(encodeDnsQuery(name, type))}`, {\n headers: { accept: 'application/dns-message' }, maxBytes: DNS_MAX_BYTES, signal: options.signal, redirect: 'error' });\n } catch (e) {\n throw /too large/i.test(String(e))\n ? new IdentityCheckUnavailable(`${resolver.name} sent an answer that is too large`)\n : new ResolverUnavailable(`${resolver.name} could not be reached`);\n }\n if (response.status !== 200 || !/^application\\/dns-message\\b/i.test(response.contentType))\n throw new ResolverUnavailable(`${resolver.name} refused the lookup`);\n let answer: DnsResponse;\n try { answer = decodeDnsResponse(response.bytes, name, type); } catch { throw new IdentityCheckUnavailable(`${resolver.name} sent an unusable answer`); }\n if (answer.rcode !== 0 && answer.rcode !== 3) throw new IdentityCheckUnavailable(`${resolver.name} could not resolve ${name}`);\n return answer;\n}\n\n/**\n * A lookup through the chosen resolver, and through the others in turn (in list order) only when it gives no DNS\n * answer at all. Quad9, for one, cannot be read from WebKit (the Mac desktop app, Safari): its HTTP/3 answers carry\n * no CORS header. An answer, even \"no such name\" or a failure, is never asked again elsewhere. `resolver`: who answered.\n */\nexport async function dohQuery(name: string, type: DnsType, options: DomainLookupOptions): Promise<DnsResponse & { resolver: DohResolverId }> {\n const chosen = resolverById(options.resolver);\n let first: IdentityCheckUnavailable | undefined;\n for (const resolver of [chosen, ...DOH_RESOLVERS.filter(r => r !== chosen)]) {\n try { return { ...await askResolver(resolver, name, type, options), resolver: resolver.id }; }\n catch (e) {\n if (!(e instanceof ResolverUnavailable) || options.signal?.aborted) throw e;\n first ??= e;\n }\n }\n throw first!;\n}\n\n/**\n * Refuses a domain whose addresses are not all public before its web server is\n * contacted, so a proof cannot make a contact's app probe their own network.\n * The browser resolves again when it fetches; a name that changes its answer in\n * between (rebinding) is not fully excluded by this check — see the draft.\n */\nexport async function assertPublicHost(domain: string, options: DomainLookupOptions): Promise<void> {\n const [v4, v6] = await Promise.all([dohQuery(domain, 'A', options), dohQuery(domain, 'AAAA', options)]);\n const addresses = [...v4.answers, ...v6.answers].map(a => a.data);\n if (!addresses.length) throw new IdentityCheckUnavailable(`${domain} has no address`);\n if (!addresses.every(isPublicAddress)) throw new IdentityCheckUnavailable(`${domain} points to a private network address, so it was not contacted`);\n}\n\n/** A well-known file: https only, no redirects, bounded. `undefined` when the server says it is not there. */\nexport async function fetchWellKnown(domain: string, method: 'https' | 'nip05', options: DomainLookupOptions): Promise<string | undefined> {\n await assertPublicHost(domain, options);\n const url = wellKnownUrl(domain, method);\n let response: Awaited<ReturnType<DomainFetch>>;\n try {\n response = await options.fetch(url, { headers: { accept: 'application/json' }, maxBytes: DOMAIN_FILE_MAX_BYTES, signal: options.signal, redirect: 'error' });\n } catch (e) {\n if (/too large/i.test(String(e))) throw new DomainCheckError(`${url} is too large`);\n throw new IdentityCheckUnavailable(`${domain} could not be reached. The file must be served at exactly this address, without a redirect, with the header Access-Control-Allow-Origin: *`);\n }\n if (response.status === 404 || response.status === 410) return;\n if (response.status >= 300 && response.status < 400) throw new IdentityCheckUnavailable(`${domain} answered with a redirect; the file must be served at exactly ${url}`);\n if (response.status !== 200) throw new IdentityCheckUnavailable(`${domain} answered ${response.status}`);\n try { return new TextDecoder('utf-8', { fatal: true }).decode(response.bytes); } catch { throw new DomainCheckError(`${url} is not text`); }\n}\n\nexport interface DomainLookup {\n domain: string;\n method: DomainMethod;\n /** DNS / HTTPS: the Ghostly records found. */\n records: DomainRecord[];\n /** NIP-05: the Nostr key named for the domain itself. */\n nostrKey?: string;\n /** A record or file exists at all (as opposed to nothing there). */\n found: boolean;\n /** The resolver reported DNSSEC validation of the TXT answer. */\n dnssec: boolean;\n resolver: DohResolverId;\n}\n\nasync function lookup(domain: string, method: DomainMethod, options: DomainLookupOptions): Promise<DomainLookup & { ttlMs: number }> {\n const resolver = resolverById(options.resolver).id;\n if (method === 'dns') {\n const answer = await dohQuery(dnsProofName(domain), 'TXT', options);\n const values: string[] = [];\n for (const record of answer.answers.slice(0, 32)) { try { values.push(txtValue(record.data)); } catch { /* not text: not ours */ } }\n const ttlMs = answer.answers.length ? Math.min(...answer.answers.map(a => a.ttl)) * 1000 : 0;\n return { domain, method, resolver: answer.resolver, records: recordsFromTxt(values), found: answer.answers.length > 0, dnssec: answer.authenticated, ttlMs };\n }\n const text = await fetchWellKnown(domain, method, options);\n const base = { domain, method, resolver, dnssec: false, records: [] as DomainRecord[], ttlMs: CACHE_FILE_MS };\n if (text === undefined) return { ...base, found: false };\n try {\n return method === 'nip05' ? { ...base, found: true, nostrKey: nip05RootKey(text) } : { ...base, found: true, records: recordsFromWellKnown(text) };\n } catch { throw new DomainCheckError(`${wellKnownUrl(domain, method)} is not a valid ${method === 'nip05' ? 'NIP-05' : 'Ghostly'} file`); }\n}\n\nconst cache = new Map<string, { until: number; result: Promise<DomainLookup & { ttlMs: number }> }>();\n/** Tests only. */\nexport function clearDomainCache(): void { cache.clear(); }\n\n/** What a domain publishes by one method. Concurrent and back-to-back checks share one lookup. */\nexport async function lookupDomain(domainInput: string, method: DomainMethod, options: DomainLookupOptions): Promise<DomainLookup> {\n const domain = normalizeDomain(domainInput), now = options.now ?? Date.now, resolver = resolverById(options.resolver).id;\n const id = `${resolver}|${method}|${domain}`;\n const hit = cache.get(id);\n if (hit && hit.until > now()) { const { ttlMs: _ttl, ...result } = await hit.result; return result; }\n const started = now();\n const entry = { until: started + CACHE_MAX_MS, result: lookup(domain, method, { ...options, resolver }) };\n cache.set(id, entry);\n if (cache.size > 128) cache.delete(cache.keys().next().value!);\n try {\n const { ttlMs, ...result } = await entry.result;\n entry.until = started + Math.min(CACHE_MAX_MS, ttlMs);\n return result;\n } catch (e) {\n if (cache.get(id) === entry) cache.delete(id);\n throw e;\n }\n}\n\n/** Throws unless `domain` publishes `record` by `method` (DNS or HTTPS). Returns what was found. */\nexport async function assertDomainRecord(domain: string, method: 'dns' | 'https', record: DomainRecord, options: DomainLookupOptions): Promise<DomainLookup> {\n const found = await lookupDomain(domain, method, options);\n if (recordsName(found.records, record)) return found;\n const where = method === 'dns' ? `The TXT record at ${dnsProofName(domain)}` : wellKnownUrl(domain);\n if (found.records.some(r => r.key === record.key)) throw new DomainCheckError(`${where} is for another proof of this key`);\n if (found.records.length) throw new DomainCheckError(`${where} names another Ghostly key: this proof was replaced or removed`);\n throw new DomainCheckError(method === 'dns'\n ? `No Ghostly TXT record at ${dnsProofName(domain)}${found.found ? '' : ' (DNS changes can take a few minutes)'}`\n : found.found ? `${wellKnownUrl(domain)} names no Ghostly proof` : `${wellKnownUrl(domain)} was not found`);\n}\n\n/** Throws unless the domain's NIP-05 root name is `nostrKey`. */\nexport async function assertNip05(domain: string, nostrKey: string, options: DomainLookupOptions): Promise<DomainLookup> {\n const found = await lookupDomain(domain, 'nip05', options);\n if (found.nostrKey === nostrKey) return found;\n const url = wellKnownUrl(domain, 'nip05');\n throw new DomainCheckError(!found.found ? `${url} was not found` : found.nostrKey\n ? `${url} names another Nostr key for ${domain}` : `${url} has no root name \"_\" for ${domain}`);\n}\n","import { atprotoDidMethod, IdentityCheckUnavailable, isAtprotoDid, parseAtprotoDidDocument, txtValue, type AtprotoDidDocument } from \"@ghostly/core\";\nimport type { IdentityFetch } from \"../contract\";\nimport { assertPublicHost, dohQuery, type DohResolverId } from \"../domain\";\n\n/**\n * AT Protocol identity resolution, the network half: a DID to its document (the PLC directory for\n * did:plc, the host's `/.well-known/did.json` for did:web), and a handle to a DID (DNS TXT\n * `_atproto.<handle>` through the person's DNS-over-HTTPS resolver, then\n * `https://<handle>/.well-known/atproto-did`). Every request goes through the contract's bounded\n * fetch: HTTPS only, no redirects, a size cap, a time-out. URLs are built here from the DID or the\n * handle, never taken from a proof.\n */\n\nexport const PLC_DIRECTORY = \"https://plc.directory\";\nconst TEST_HOST = /^https:\\/\\/[a-z0-9-]+(\\.[a-z0-9-]+)*\\.test$/;\n/** DID documents are small; a large answer is not one. */\nexport const DID_DOCUMENT_MAX_BYTES = 32 * 1024;\nconst HANDLE_DID_MAX_BYTES = 2048;\n\n/**\n * The PLC directory. A build made for the e2e suite with VITE_ATPROTO_TEST_PLC may point it at a\n * `.test` host (a name reserved for testing); a release build always uses plc.directory.\n */\nexport function plcDirectory(): string {\n try {\n const value = import.meta.env?.VITE_ATPROTO_TEST_PLC as string | undefined;\n return value && TEST_HOST.test(value) ? value : PLC_DIRECTORY;\n } catch { return PLC_DIRECTORY; }\n}\n\nexport interface AtprotoResolveOptions {\n fetch: IdentityFetch;\n signal?: AbortSignal;\n /** The DoH resolver for handles (the person's choice, as for domains). */\n resolver?: DohResolverId;\n /** The PLC directory; plcDirectory() by default. */\n plc?: string;\n}\n\n/** Where a DID's document lives. */\nexport function didDocumentUrl(did: string, plc = plcDirectory()): string {\n const method = atprotoDidMethod(did);\n if (method === \"plc\") return `${plc}/${did}`;\n if (method === \"web\") return `https://${did.slice(\"did:web:\".length)}/.well-known/did.json`;\n throw new Error(\"Not an AT Protocol DID\");\n}\n\n/**\n * Refuses a host the account chose (a did:web host, the PDS its document names) that points to a private\n * network address: a contact's app never knocks on its own local network for someone else's proof.\n */\nexport async function assertPublicServer(host: string, options: AtprotoResolveOptions): Promise<void> {\n try { await assertPublicHost(host, { fetch: options.fetch, signal: options.signal, resolver: options.resolver }); }\n catch (e) { throw new IdentityCheckUnavailable(`The account's server ${host} was not contacted: ${e instanceof Error ? e.message : String(e)}`); }\n}\n\n/** A DID's document, checked (parseAtprotoDidDocument). Throws a message people can read. */\nexport async function resolveAtprotoDid(did: string, options: AtprotoResolveOptions): Promise<AtprotoDidDocument> {\n const url = didDocumentUrl(did, options.plc);\n if (atprotoDidMethod(did) === \"web\") await assertPublicServer(did.slice(\"did:web:\".length), options);\n let response: Awaited<ReturnType<IdentityFetch>>;\n try {\n response = await options.fetch(url, { headers: { accept: \"application/did+ld+json, application/json\" }, maxBytes: DID_DOCUMENT_MAX_BYTES, signal: options.signal, redirect: \"error\" });\n } catch (e) {\n // eslint-disable-next-line preserve-caught-error -- A message people can act on; the library's error stays out of the UI (ES2020 has no Error.cause).\n if (/too large/i.test(String(e))) throw new Error(\"The account's DID document is too large\");\n throw new IdentityCheckUnavailable(\"The account's DID could not be resolved\");\n }\n if (response.status === 404 || response.status === 410) throw new Error(\"The account's DID is not registered, or was deactivated\");\n if (response.status !== 200) throw new IdentityCheckUnavailable(\"The account's DID could not be resolved\");\n let doc: unknown;\n try { doc = JSON.parse(response.text); } catch { throw new Error(\"The account's DID document is malformed\"); }\n return parseAtprotoDidDocument(doc, did);\n}\n\n/**\n * The DID a handle points to, or null when it points nowhere (or to two different DIDs). DNS first,\n * then HTTPS, as the handle spec says. The HTTPS lookup first checks the handle's addresses are public,\n * so a handle cannot make a contact's app knock on its local network.\n */\nexport async function resolveAtprotoHandle(handle: string, options: AtprotoResolveOptions): Promise<string | null> {\n return (await lookupAtprotoHandle(handle, options)).did;\n}\n\n/**\n * resolveAtprotoHandle, and whether the answer is one: `checked` is false when a lookup failed on the way (the\n * resolver or the handle's website could not be reached) so the handle may point somewhere after all. A cancel\n * throws.\n */\nasync function lookupAtprotoHandle(handle: string, options: AtprotoResolveOptions): Promise<{ did: string | null; checked: boolean }> {\n options.signal?.throwIfAborted();\n const lookup = { fetch: options.fetch, signal: options.signal, resolver: options.resolver };\n let dnsAnswered = false;\n try {\n const answer = await dohQuery(`_atproto.${handle}`, \"TXT\", lookup);\n dnsAnswered = true;\n const dids = new Set<string>();\n for (const a of answer.answers) {\n if (a.type !== 16) continue;\n let text: string;\n try { text = txtValue(a.data); } catch { continue; }\n if (text.startsWith(\"did=\")) dids.add(text.slice(4));\n }\n if (dids.size > 1) return { did: null, checked: true };\n const [did] = dids;\n if (did) return { did: isAtprotoDid(did) ? did : null, checked: true };\n } catch { options.signal?.throwIfAborted(); /* The resolver failed: try HTTPS. */ }\n // A handle with no public address points nowhere, if the resolver answered (a name it could not resolve may).\n try { await assertPublicHost(handle, lookup); }\n catch { options.signal?.throwIfAborted(); return { did: null, checked: dnsAnswered }; }\n let response: Awaited<ReturnType<IdentityFetch>>;\n try { response = await options.fetch(`https://${handle}/.well-known/atproto-did`, { headers: { accept: \"text/plain\" }, maxBytes: HANDLE_DID_MAX_BYTES, signal: options.signal, redirect: \"error\" }); }\n catch { options.signal?.throwIfAborted(); return { did: null, checked: false }; }\n const did = response.status === 200 ? response.text.trim() : \"\";\n // A DNS record the resolver could not read may still name the DID.\n return isAtprotoDid(did) ? { did, checked: true } : { did: null, checked: dnsAnswered };\n}\n\n/** Why a DID's handle is not shown: its document names none, the handle points elsewhere (or nowhere), or the lookup failed. */\nexport type AtprotoHandleCheck = { handle: string; missing?: undefined } | { handle?: undefined; missing: \"none\" | \"elsewhere\" | \"unchecked\" };\n\n/**\n * The handle to show for a DID: the one its document claims, and only if that handle resolves back to\n * the same DID. Otherwise the reason: the card shows the DID. Throws only when cancelled.\n */\nexport async function verifiedAtprotoHandle(doc: AtprotoDidDocument, options: AtprotoResolveOptions): Promise<AtprotoHandleCheck> {\n if (!doc.handle) return { missing: \"none\" };\n const found = await lookupAtprotoHandle(doc.handle, options);\n if (found.did === doc.did) return { handle: doc.handle };\n return { missing: found.did || found.checked ? \"elsewhere\" : \"unchecked\" };\n}\n"],"mappings":";;;AAyBA,IAAa,gBAAwC;CACnD;EAAE,IAAI;EAAS,MAAM;EAAS,KAAK;CAAkC;CACrE;EAAE,IAAI;EAAc,MAAM;EAAc,KAAK;CAAuC;CACpF;EAAE,IAAI;EAAU,MAAM;EAAU,KAAK;CAA+B;AACtE;AAEA,IAAa,gBAAgB,OAC3B,cAAc,MAAK,MAAK,EAAE,OAAO,EAAE,KAAK,cAAc,MAAK,MAAK,EAAE,OAAA,OAAuB;;AAG3F,IAAa,mBAAmB;AAChC,SAAgB,iBAA8B;CAC5C,IAAI;EAAE,OAAO,aAAa,WAAW,cAAc,QAAQ,gBAAgB,CAAC;CAAG,QAAQ;EAAE,OAAO,aAAa,KAAA,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