@ghostlytools/cli 1.9.0 → 1.10.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 +35 -27
- package/SKILL.md +7 -3
- package/dist/assets/api-BOWLZYXM.js +3 -0
- package/dist/assets/{api-DFCgr6RH.js → api-Bi6hCcwG.js} +100 -47
- package/dist/assets/api-Bi6hCcwG.js.map +1 -0
- package/dist/assets/{apiKit-CCavJJcl.js → apiKit-DzXHZojD.js} +26 -9
- package/dist/assets/apiKit-DzXHZojD.js.map +1 -0
- package/dist/assets/{apps-B7o2BPj6.js → apps-0Ks6KjqS.js} +1 -1
- package/dist/assets/{apps-DmxEG147.js → apps-DIQbzG08.js} +33 -10
- package/dist/assets/apps-DIQbzG08.js.map +1 -0
- package/dist/assets/{arkade-DtYR9H0c.js → arkade-zozCldAE.js} +2 -2
- package/dist/assets/{arkade-DtYR9H0c.js.map → arkade-zozCldAE.js.map} +1 -1
- package/dist/assets/{backup-YIB2XIES.js → backup-BL49Kt-T.js} +7 -6
- package/dist/assets/{backup-YIB2XIES.js.map → backup-BL49Kt-T.js.map} +1 -1
- package/dist/assets/{backup-BserdrNk.js → backup-BvIFcZM7.js} +1 -1
- package/dist/assets/bark_ffi_wasm_bg-EY2uc0Bx.js.map +1 -1
- package/dist/assets/bitcoindevkit_bg-B-iLWrmX.js.map +1 -1
- package/dist/assets/{blobFiles-DOQDRdDI.js → blobFiles-BnjN_Vrz.js} +3 -3
- package/dist/assets/{blobFiles-DOQDRdDI.js.map → blobFiles-BnjN_Vrz.js.map} +1 -1
- package/dist/assets/buttons-CAW5v5EE.js +332 -0
- package/dist/assets/buttons-CAW5v5EE.js.map +1 -0
- package/dist/assets/buttons-oJI5mHSL.js +2 -0
- package/dist/assets/childEnv-BVOQK9EA.js +21 -0
- package/dist/assets/childEnv-BVOQK9EA.js.map +1 -0
- package/dist/assets/client-CyApKBEw.js +473 -0
- package/dist/assets/client-CyApKBEw.js.map +1 -0
- package/dist/assets/codec-DqFxxB_q.js +13 -0
- package/dist/assets/codec-DqFxxB_q.js.map +1 -0
- package/dist/assets/{endpoint-BdaeBw2L.js → endpoint-DWHkXWVM.js} +101 -16
- package/dist/assets/endpoint-DWHkXWVM.js.map +1 -0
- package/dist/assets/{envelope-Dt75vrmY.js → envelope-CMUgz31I.js} +3 -12
- package/dist/assets/envelope-CMUgz31I.js.map +1 -0
- package/dist/assets/fedimint_client_wasm_bg-BtHHlFpp.js.map +1 -1
- package/dist/assets/{fileBytes-BPDKufla.js → fileBytes-DMzrIdCu.js} +1 -1
- package/dist/assets/{fileBytes-DNgrRL0R.js → fileBytes-DjBYYyXT.js} +3 -3
- package/dist/assets/{fileBytes-DNgrRL0R.js.map → fileBytes-DjBYYyXT.js.map} +1 -1
- package/dist/assets/{fileBytes-Q3ehcEr8.js → fileBytes-Douk1yOp.js} +2 -2
- package/dist/assets/{fileBytes-Q3ehcEr8.js.map → fileBytes-Douk1yOp.js.map} +1 -1
- package/dist/assets/fileBytesIdb-CD5Uv490.js +2 -0
- package/dist/assets/{fileBytesIdb-Dm1EyEbT.js → fileBytesIdb-CkClu9YI.js} +3 -3
- package/dist/assets/{fileBytesIdb-Dm1EyEbT.js.map → fileBytesIdb-CkClu9YI.js.map} +1 -1
- package/dist/assets/{fileBytesOpfs-ZGD21c4Q.js → fileBytesOpfs-WryQuOgK.js} +3 -3
- package/dist/assets/{fileBytesOpfs-ZGD21c4Q.js.map → fileBytesOpfs-WryQuOgK.js.map} +1 -1
- package/dist/assets/{fixedHosts-B598JzbC.js → fixedHosts-C2hdCfzK.js} +4 -4
- package/dist/assets/{fixedHosts-B598JzbC.js.map → fixedHosts-C2hdCfzK.js.map} +1 -1
- package/dist/assets/{groupFiles-FXel6zIc.js → groupFiles-BAQIt_bJ.js} +404 -161
- package/dist/assets/groupFiles-BAQIt_bJ.js.map +1 -0
- package/dist/assets/{host-DIBeK_c_.js → host-CaRlDMTd.js} +206 -49
- package/dist/assets/host-CaRlDMTd.js.map +1 -0
- package/dist/assets/{hyperdhtRelay-D185dETu.js → hyperdhtRelay-BxADl3SG.js} +2 -2
- package/dist/assets/{hyperdhtRelay-D185dETu.js.map → hyperdhtRelay-BxADl3SG.js.map} +1 -1
- package/dist/assets/{idb-BkOJES5_.js → idb-BHsAqENE.js} +37 -6
- package/dist/assets/idb-BHsAqENE.js.map +1 -0
- package/dist/assets/{irohWeb-BSv_BWyG.js → irohWeb-D2sh6EWp.js} +65 -7
- package/dist/assets/irohWeb-D2sh6EWp.js.map +1 -0
- package/dist/assets/{main-BbhfMTt8.js → main-Bc4Ow56Z.js} +221 -287
- package/dist/assets/main-Bc4Ow56Z.js.map +1 -0
- package/dist/assets/{mainline-9Vc3c3SA.js → mainline-DWh4Ccri.js} +2 -2
- package/dist/assets/{mainline-9Vc3c3SA.js.map → mainline-DWh4Ccri.js.map} +1 -1
- package/dist/assets/networkReason-DT_D_Wpc.js +474 -0
- package/dist/assets/networkReason-DT_D_Wpc.js.map +1 -0
- package/dist/assets/{nwc-QX3Yt1Sb.js → nwc-DoSEhUKb.js} +3 -3
- package/dist/assets/{nwc-QX3Yt1Sb.js.map → nwc-DoSEhUKb.js.map} +1 -1
- package/dist/assets/{nwcProvider-CzX3xH47.js → nwcProvider-CGWqUjpB.js} +2 -2
- package/dist/assets/{nwcProvider-CzX3xH47.js.map → nwcProvider-CGWqUjpB.js.map} +1 -1
- package/dist/assets/{ownDid-D8z5gwGI.js → ownDid-CbGjRLBn.js} +3 -3
- package/dist/assets/ownDid-CbGjRLBn.js.map +1 -0
- package/dist/assets/{profiles-MFtCmJwK.js → profiles-DgIfvBeN.js} +47 -4
- package/dist/assets/profiles-DgIfvBeN.js.map +1 -0
- package/dist/assets/{registry-B2Dtnibo.js → registry-BSyxGjN6.js} +11 -9
- package/dist/assets/registry-BSyxGjN6.js.map +1 -0
- package/dist/assets/{registry-PTtBMaYZ.js → registry-C5cn80Rw.js} +1 -1
- package/dist/assets/{resolve-ZxVzwFNA.js → resolve-D-9YRFhl.js} +2 -2
- package/dist/assets/{resolve-ZxVzwFNA.js.map → resolve-D-9YRFhl.js.map} +1 -1
- package/dist/assets/{restoredRows-BCRCjhdF.js → restoredRows-CRYwIx3g.js} +2 -2
- package/dist/assets/{restoredRows-BCRCjhdF.js.map → restoredRows-CRYwIx3g.js.map} +1 -1
- package/dist/assets/{buttons-CuRfKnPI.js → secretGuard-CSVNxXVW.js} +80 -330
- package/dist/assets/secretGuard-CSVNxXVW.js.map +1 -0
- package/dist/assets/secretGuard-Q2BKq0q0.js +2 -0
- package/dist/assets/{server-Dw1o8z1o.js → server-BufntkX8.js} +1734 -369
- package/dist/assets/server-BufntkX8.js.map +1 -0
- package/dist/assets/{src-BD8RBVEp.js → src-CCt5s4DK.js} +3073 -1890
- package/dist/assets/src-CCt5s4DK.js.map +1 -0
- package/dist/assets/{sshForges-DWrESWkK.js → sshForges-D8CPaIbR.js} +16 -9
- package/dist/assets/{sshForges-DWrESWkK.js.map → sshForges-D8CPaIbR.js.map} +1 -1
- package/dist/assets/{translate-D1uP0q32.js → translate-Cb-6hMhD.js} +17 -12
- package/dist/assets/translate-Cb-6hMhD.js.map +1 -0
- package/dist/assets/{usdt-DhVN8geQ.js → usdt-ds461mzA.js} +3 -3
- package/dist/assets/{usdt-DhVN8geQ.js.map → usdt-ds461mzA.js.map} +1 -1
- package/dist/assets/{words-DdXPkB3n.js → words-B1ylON2h.js} +4 -2
- package/dist/assets/words-B1ylON2h.js.map +1 -0
- package/dist/ghostly.mjs +1 -1
- package/package.json +1 -1
- package/dist/assets/api-DFCgr6RH.js.map +0 -1
- package/dist/assets/api-raWw9j_m.js +0 -3
- package/dist/assets/apiKit-CCavJJcl.js.map +0 -1
- package/dist/assets/apps-DmxEG147.js.map +0 -1
- package/dist/assets/buttons-CuRfKnPI.js.map +0 -1
- package/dist/assets/buttons-De3LPdSG.js +0 -2
- package/dist/assets/daemonProof-DtrL5lE5.js +0 -236
- package/dist/assets/daemonProof-DtrL5lE5.js.map +0 -1
- package/dist/assets/endpoint-BdaeBw2L.js.map +0 -1
- package/dist/assets/envelope-Dt75vrmY.js.map +0 -1
- package/dist/assets/fileBytesIdb-DZcESfTt.js +0 -2
- package/dist/assets/groupFiles-FXel6zIc.js.map +0 -1
- package/dist/assets/host-DIBeK_c_.js.map +0 -1
- package/dist/assets/idb-BkOJES5_.js.map +0 -1
- package/dist/assets/irohWeb-BSv_BWyG.js.map +0 -1
- package/dist/assets/main-BbhfMTt8.js.map +0 -1
- package/dist/assets/networkReason-BncJ9KSM.js +0 -154
- package/dist/assets/networkReason-BncJ9KSM.js.map +0 -1
- package/dist/assets/ownDid-D8z5gwGI.js.map +0 -1
- package/dist/assets/profiles-MFtCmJwK.js.map +0 -1
- package/dist/assets/registry-B2Dtnibo.js.map +0 -1
- package/dist/assets/server-Dw1o8z1o.js.map +0 -1
- package/dist/assets/src-BD8RBVEp.js.map +0 -1
- package/dist/assets/translate-D1uP0q32.js.map +0 -1
- package/dist/assets/words-DdXPkB3n.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as identityProvider, r as identityProviders, t as IDENTITY_PROVIDERS } from "./registry-
|
|
1
|
+
import { n as identityProvider, r as identityProviders, t as IDENTITY_PROVIDERS } from "./registry-BSyxGjN6.js";
|
|
2
2
|
export { IDENTITY_PROVIDERS, identityProvider, identityProviders };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Oi as IdentityCheckUnavailable, Yu as toBase64Url, _t as isAtprotoDid, ca as nip05RootKey, da as recordsFromWellKnown, fa as recordsName, la as normalizeDomain, ma as wellKnownUrl, na as decodeDnsResponse, oa as encodeDnsQuery, pa as txtValue, pt as atprotoDidMethod, ra as dnsProofName, sa as isPublicAddress, ta as DOMAIN_FILE_MAX_BYTES, ua as recordsFromTxt, yt as parseAtprotoDidDocument } from "./src-CCt5s4DK.js";
|
|
2
2
|
//#region ../browser/src/proofs/domain.ts
|
|
3
3
|
/** Public resolvers that answer RFC 8484 wire-format GETs with CORS (checked 2026-09-23). */
|
|
4
4
|
var DOH_RESOLVERS = [
|
|
@@ -375,4 +375,4 @@ async function verifiedAtprotoHandle(doc, options) {
|
|
|
375
375
|
//#endregion
|
|
376
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 };
|
|
377
377
|
|
|
378
|
-
//# sourceMappingURL=resolve-
|
|
378
|
+
//# sourceMappingURL=resolve-D-9YRFhl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-ZxVzwFNA.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,IAA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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,CAAS;CAAG;AAC3H;AAKA,IAAa,gBAAgB;;;;;AAK7B,IAAM,eAAe;AAAQ,IAAA,gBAAgB;;AAc7C,IAAa,mBAAb,cAAsC,MAAM,CAAC;;AAG7C,IAAM,sBAAN,cAAkC,yBAAyB,CAAC;;AAS5D,eAAe,YAAY,UAAuB,MAAc,MAAe,SAAoD;CACjI,IAAI;CACJ,IAAI;EACF,WAAW,MAAM,QAAQ,MAAM,GAAG,SAAS,IAAI,OAAO,YAAY,eAAe,MAAM,IAAI,CAAC,KAAK;GAC/F,SAAS,EAAE,QAAQ,0BAA0B;GAAG,UAAU;GAAe,QAAQ,QAAQ;GAAQ,UAAU;EAAQ,CAA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WAAW,OAAO,2BAA2B;GAAE,SAAS,EAAE,QAAQ,aAAa;GAAG,UAAU;GAAsB,QAAQ,QAAQ;GAAQ,UAAU;EAAQ,CAAC;CAAG,QAC/L;EAAE,QAAQ,QAAQ,eAAe;EAAG,OAAO;GAAE,KAAK;GAAM,SAAS;EAAM;CAAG;CAChF,MAAM,MAAM,SAAS,WAAW,MAAM,SAAS,KAAK,KAAK,IAAI;CAE7D,OAAO,aAAa,GAAG,IAAI;EAAE;EAAK,SAAS;CAAK,IAAI;EAAE,KAAK;EAAM,SAAS;CAAY;AACxF;;;;;AASA,eAAsB,sBAAsB,KAAyB,SAA6D;CAChI,IAAI,CAAC,IAAI,QAAQ,OAAO,EAAE,SAAS,OAAO;CAC1C,MAAM,QAAQ,MAAM,oBAAoB,IAAI,QAAQ,OAAO;CAC3D,IAAI,MAAM,QAAQ,IAAI,KAAK,OAAO,EAAE,QAAQ,IAAI,OAAO;CACvD,OAAO,EAAE,SAAS,MAAM,OAAO,MAAM,UAAU,cAAc,YAAY;AAC3E"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as openDb, i as STORES } from "./idb-
|
|
1
|
+
import { f as openDb, i as STORES } from "./idb-BHsAqENE.js";
|
|
2
2
|
//#region ../browser/src/shared/restoredRows.ts
|
|
3
3
|
/**
|
|
4
4
|
* What a restore changes in the money a backup carries (WISP 05 § Restoring). A bundle holds the wallet as it stood
|
|
@@ -135,4 +135,4 @@ async function forgetRatchets() {
|
|
|
135
135
|
//#endregion
|
|
136
136
|
export { forgetRatchets, markLeftOutFiles, markRestoredWallet };
|
|
137
137
|
|
|
138
|
-
//# sourceMappingURL=restoredRows-
|
|
138
|
+
//# sourceMappingURL=restoredRows-CRYwIx3g.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restoredRows-
|
|
1
|
+
{"version":3,"file":"restoredRows-CRYwIx3g.js","names":[],"sources":["../../../browser/src/shared/restoredRows.ts"],"sourcesContent":["import { STORES, openDb } from \"./idb\";\n\n/**\n * What a restore changes in the money a backup carries (WISP 05 § Restoring). A bundle holds the wallet as it stood\n * when the backup was made, and the profile it came from may have gone on since: none of it is taken at its word.\n */\nexport const RESTORED_WALLET_STORES: readonly string[] = [STORES.proofs, STORES.swaps, STORES.intents];\n\n/** One row of `store` as a restore writes it. A row of any other store, or one that is not what it should be, is kept as it is. */\nexport function restoredWalletRow(store: string, value: unknown): unknown {\n if (!value || typeof value !== \"object\") return value;\n if (store === STORES.proofs) {\n // Ecash as it was when the backup was made: what was spent since is found by asking the mint, once the wallet runs.\n const proof = value as { secret?: unknown; reserved?: boolean };\n return typeof proof.secret === \"string\" && !proof.reserved ? { ...proof, unchecked: true } : value;\n }\n // A swap as it stood when the backup was made: what it brings is checked like the copy's ecash.\n if (store === STORES.swaps) return { ...value, restored: true };\n if (store === STORES.intents) {\n // An older copy cannot prove an unfinished attempt was never sent; it may not authorize a new one.\n const intent = value as { review?: { state?: string; method?: string } };\n // An on-chain review never approved stays unapproved: only Approve on this profile could send it, and a copy has none.\n if (intent.review?.method === \"bitcoin\" && intent.review.state === \"pending\") return { ...intent, review: { ...intent.review, state: \"cancelled\" } };\n return intent.review && [\"pending\", \"submitted\", \"unknown\"].includes(intent.review.state ?? \"\") ? { ...intent, review: { ...intent.review, state: \"unknown\" } } : value;\n }\n return value;\n}\n\n/**\n * The same, for a restore that brought the profile's database back whole (the headless CLI's): every wallet row of\n * this profile's database is rewritten as `restoredWalletRow` says, in one transaction, before the engine reads any.\n * Doing it twice changes nothing more.\n */\nexport async function markRestoredWallet(): Promise<void> {\n const db = await openDb();\n const names = RESTORED_WALLET_STORES.filter((name) => db.objectStoreNames.contains(name));\n if (!names.length) return;\n const tx = db.transaction(names, \"readwrite\");\n const done = new Promise<void>((resolve, reject) => {\n tx.oncomplete = () => resolve();\n tx.onabort = () => reject(tx.error ?? new Error(\"The restored wallet could not be marked\"));\n tx.onerror = () => reject(tx.error ?? new Error(\"The restored wallet could not be marked\"));\n });\n for (const name of names) {\n const walk = tx.objectStore(name).openCursor();\n walk.onsuccess = () => {\n const cursor = walk.result;\n if (!cursor) return;\n const next = restoredWalletRow(name, cursor.value);\n if (next !== cursor.value) cursor.update(next);\n cursor.continue();\n };\n }\n return done;\n}\n\n/**\n * Files a light backup left out (WISP 05 § Light backups), for a restore that brought the database back whole (the\n * headless CLI's): each record is marked `leftOut`, and nothing of it says any longer where its bytes were. A file\n * not in the database is passed over. Doing it twice changes nothing more.\n */\nexport async function markLeftOutFiles(ids: readonly string[]): Promise<void> {\n if (!ids.length) return;\n const db = await openDb();\n const tx = db.transaction([STORES.files, STORES.fileState], \"readwrite\");\n const done = new Promise<void>((resolve, reject) => {\n tx.oncomplete = () => resolve();\n tx.onabort = () => reject(tx.error ?? new Error(\"The files left out could not be marked\"));\n tx.onerror = () => reject(tx.error ?? new Error(\"The files left out could not be marked\"));\n });\n const files = tx.objectStore(STORES.files), states = tx.objectStore(STORES.fileState);\n for (const id of ids) {\n const read = files.get(id);\n read.onsuccess = () => {\n const record = read.result as { blob?: unknown; bytes?: unknown } | undefined;\n if (!record) return;\n const { blob: _blob, bytes: _bytes, ...rest } = record;\n files.put({ ...rest, leftOut: true });\n };\n const state = states.get(id);\n state.onsuccess = () => {\n const value = state.result as { bytes?: unknown } | undefined;\n if (!value || !(\"bytes\" in value)) return;\n const { bytes: _bytes, ...rest } = value;\n states.put(rest);\n };\n }\n return done;\n}\n\n/**\n * A chat's ratchet (WISP 4xx), for a restore that brought the database back whole (the headless CLI's): dropped from\n * every chat, so the restored copy starts a new session with each contact and never seals with keys the profile it\n * came from used. A backup made before backups left it out carries it. Doing it twice changes nothing more.\n */\nexport async function forgetRatchets(): Promise<void> {\n const db = await openDb();\n if (!db.objectStoreNames.contains(STORES.links)) return;\n const tx = db.transaction([STORES.links], \"readwrite\");\n const done = new Promise<void>((resolve, reject) => {\n tx.oncomplete = () => resolve();\n tx.onabort = () => reject(tx.error ?? new Error(\"The restored chats could not be read\"));\n tx.onerror = () => reject(tx.error ?? new Error(\"The restored chats could not be read\"));\n });\n const walk = tx.objectStore(STORES.links).openCursor();\n walk.onsuccess = () => {\n const cursor = walk.result;\n if (!cursor) return;\n const { ratchetState, ...link } = cursor.value as { ratchetState?: unknown };\n if (ratchetState !== undefined) cursor.update(link);\n cursor.continue();\n };\n return done;\n}\n"],"mappings":";;;;;;AAMA,IAAa,yBAA4C;CAAC,OAAO;CAAQ,OAAO;CAAO,OAAO;AAAO;;AAGrG,SAAgB,kBAAkB,OAAe,OAAyB;CACxE,IAAI,CAAC,SAAS,OAAO,UAAU,UAAU,OAAO;CAChD,IAAI,UAAU,OAAO,QAAQ;EAE3B,MAAM,QAAQ;EACd,OAAO,OAAO,MAAM,WAAW,YAAY,CAAC,MAAM,WAAW;GAAE,GAAG;GAAO,WAAW;EAAK,IAAI;CAC/F;CAEA,IAAI,UAAU,OAAO,OAAO,OAAO;EAAE,GAAG;EAAO,UAAU;CAAK;CAC9D,IAAI,UAAU,OAAO,SAAS;EAE5B,MAAM,SAAS;EAEf,IAAI,OAAO,QAAQ,WAAW,aAAa,OAAO,OAAO,UAAU,WAAW,OAAO;GAAE,GAAG;GAAQ,QAAQ;IAAE,GAAG,OAAO;IAAQ,OAAO;GAAY;EAAE;EACnJ,OAAO,OAAO,UAAU;GAAC;GAAW;GAAa;EAAS,CAAC,CAAC,SAAS,OAAO,OAAO,SAAS,EAAE,IAAI;GAAE,GAAG;GAAQ,QAAQ;IAAE,GAAG,OAAO;IAAQ,OAAO;GAAU;EAAE,IAAI;CACpK;CACA,OAAO;AACT;;;;;;AAOA,eAAsB,qBAAoC;CACxD,MAAM,KAAK,MAAM,OAAO;CACxB,MAAM,QAAQ,uBAAuB,QAAQ,SAAS,GAAG,iBAAiB,SAAS,IAAI,CAAC;CACxF,IAAI,CAAC,MAAM,QAAQ;CACnB,MAAM,KAAK,GAAG,YAAY,OAAO,WAAW;CAC5C,MAAM,OAAO,IAAI,SAAe,SAAS,WAAW;EAClD,GAAG,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