@ghostlytools/cli 1.10.1 → 1.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -10
- package/SKILL.md +3 -2
- package/dist/assets/{api-BOWLZYXM.js → api-BdaxsDvA.js} +2 -2
- package/dist/assets/{api-Bi6hCcwG.js → api-C4MLg5Rs.js} +126 -49
- package/dist/assets/api-C4MLg5Rs.js.map +1 -0
- package/dist/assets/{apiKit-DzXHZojD.js → apiKit-BbNaxZGZ.js} +87 -25
- package/dist/assets/apiKit-BbNaxZGZ.js.map +1 -0
- package/dist/assets/{apps-DIQbzG08.js → apps-BluQgEhv.js} +5 -5
- package/dist/assets/{apps-DIQbzG08.js.map → apps-BluQgEhv.js.map} +1 -1
- package/dist/assets/{apps-0Ks6KjqS.js → apps-BtGFth7o.js} +1 -1
- package/dist/assets/{arkade-zozCldAE.js → arkade-DdZx4b_I.js} +2 -2
- package/dist/assets/{arkade-zozCldAE.js.map → arkade-DdZx4b_I.js.map} +1 -1
- package/dist/assets/{backup-BL49Kt-T.js → backup-DyDsW7sC.js} +7 -7
- package/dist/assets/{backup-BL49Kt-T.js.map → backup-DyDsW7sC.js.map} +1 -1
- package/dist/assets/{backup-BvIFcZM7.js → backup-I1n7ccz7.js} +1 -1
- package/dist/assets/{buttons-CAW5v5EE.js → buttons-Do7dCku6.js} +6 -6
- package/dist/assets/{buttons-CAW5v5EE.js.map → buttons-Do7dCku6.js.map} +1 -1
- package/dist/assets/buttons-DpjwXePb.js +2 -0
- package/dist/assets/{client-CyApKBEw.js → client-CWsjRiH8.js} +3 -3
- package/dist/assets/{client-CyApKBEw.js.map → client-CWsjRiH8.js.map} +1 -1
- package/dist/assets/{codec-DqFxxB_q.js → codec-DPaXhuYc.js} +2 -2
- package/dist/assets/{codec-DqFxxB_q.js.map → codec-DPaXhuYc.js.map} +1 -1
- package/dist/assets/{envelope-CMUgz31I.js → envelope-5Gu9yGk_.js} +2 -2
- package/dist/assets/{envelope-CMUgz31I.js.map → envelope-5Gu9yGk_.js.map} +1 -1
- package/dist/assets/{errors-R4S2SAEM.js → errors-Dt-ZnyOX.js} +3 -1
- package/dist/assets/errors-Dt-ZnyOX.js.map +1 -0
- package/dist/assets/{fixedHosts-C2hdCfzK.js → fixedHosts-PR1BcfKX.js} +7 -8
- package/dist/assets/fixedHosts-PR1BcfKX.js.map +1 -0
- package/dist/assets/{groupFiles-BAQIt_bJ.js → groupFiles-BuToTMUk.js} +307 -69
- package/dist/assets/groupFiles-BuToTMUk.js.map +1 -0
- package/dist/assets/{host-CaRlDMTd.js → host-fkQYBvKH.js} +322 -72
- package/dist/assets/host-fkQYBvKH.js.map +1 -0
- package/dist/assets/{hyperdhtRelay-BxADl3SG.js → hyperdhtRelay-DDCak5PY.js} +28 -20
- package/dist/assets/hyperdhtRelay-DDCak5PY.js.map +1 -0
- package/dist/assets/{irohWeb-D2sh6EWp.js → irohWeb-B4_swKx0.js} +112 -34
- package/dist/assets/{irohWeb-D2sh6EWp.js.map → irohWeb-B4_swKx0.js.map} +1 -1
- package/dist/assets/{main-Bc4Ow56Z.js → main-ClYsttvY.js} +98 -51
- package/dist/assets/main-ClYsttvY.js.map +1 -0
- package/dist/assets/{mainline-DWh4Ccri.js → mainline-Hsk2SZ1B.js} +66 -6
- package/dist/assets/mainline-Hsk2SZ1B.js.map +1 -0
- package/dist/assets/{networkReason-DT_D_Wpc.js → networkReason-C9Hr-hO7.js} +4 -4
- package/dist/assets/{networkReason-DT_D_Wpc.js.map → networkReason-C9Hr-hO7.js.map} +1 -1
- package/dist/assets/{nwc-DoSEhUKb.js → nwc-BbK6qNxS.js} +3 -3
- package/dist/assets/{nwc-DoSEhUKb.js.map → nwc-BbK6qNxS.js.map} +1 -1
- package/dist/assets/{nwcProvider-CGWqUjpB.js → nwcProvider-D_tt2X3Z.js} +2 -2
- package/dist/assets/{nwcProvider-CGWqUjpB.js.map → nwcProvider-D_tt2X3Z.js.map} +1 -1
- package/dist/assets/{ownDid-CbGjRLBn.js → ownDid-DkK_jem4.js} +2 -2
- package/dist/assets/{ownDid-CbGjRLBn.js.map → ownDid-DkK_jem4.js.map} +1 -1
- package/dist/assets/{profiles-DgIfvBeN.js → profiles-aV9vaK0B.js} +17 -8
- package/dist/assets/profiles-aV9vaK0B.js.map +1 -0
- package/dist/assets/{registry-C5cn80Rw.js → registry-C9T6tYCO.js} +1 -1
- package/dist/assets/{registry-BSyxGjN6.js → registry-CEjnubep.js} +57 -17
- package/dist/assets/registry-CEjnubep.js.map +1 -0
- package/dist/assets/{resolve-D-9YRFhl.js → resolve-BBOrN13E.js} +27 -6
- package/dist/assets/resolve-BBOrN13E.js.map +1 -0
- package/dist/assets/{restoredRows-CRYwIx3g.js → restoredRows-YhlbokEE.js} +4 -2
- package/dist/assets/restoredRows-YhlbokEE.js.map +1 -0
- package/dist/assets/{secretGuard-CSVNxXVW.js → secretGuard-B7Hj0Kvz.js} +2 -2
- package/dist/assets/{secretGuard-CSVNxXVW.js.map → secretGuard-B7Hj0Kvz.js.map} +1 -1
- package/dist/assets/secretGuard-DUr6bgKc.js +2 -0
- package/dist/assets/{server-BufntkX8.js → server-BJ3T-kx3.js} +1051 -389
- package/dist/assets/server-BJ3T-kx3.js.map +1 -0
- package/dist/assets/{src-CCt5s4DK.js → src-BIdfHB7t.js} +667 -134
- package/dist/assets/src-BIdfHB7t.js.map +1 -0
- package/dist/assets/{sshForges-D8CPaIbR.js → sshForges-CRg-NGld.js} +2 -2
- package/dist/assets/{sshForges-D8CPaIbR.js.map → sshForges-CRg-NGld.js.map} +1 -1
- package/dist/assets/{translate-Cb-6hMhD.js → translate-b0X61WMI.js} +3 -3
- package/dist/assets/{translate-Cb-6hMhD.js.map → translate-b0X61WMI.js.map} +1 -1
- package/dist/assets/{usdt-ds461mzA.js → usdt-6CQdfye1.js} +7 -4
- package/dist/assets/usdt-6CQdfye1.js.map +1 -0
- package/dist/assets/waitNotice-Ce3YCinu.js +101 -0
- package/dist/assets/waitNotice-Ce3YCinu.js.map +1 -0
- package/dist/assets/{words-B1ylON2h.js → words-Dk6o6wz4.js} +4 -4
- package/dist/assets/words-Dk6o6wz4.js.map +1 -0
- package/dist/ghostly.mjs +1 -1
- package/package.json +1 -1
- package/dist/assets/api-Bi6hCcwG.js.map +0 -1
- package/dist/assets/apiKit-DzXHZojD.js.map +0 -1
- package/dist/assets/buttons-oJI5mHSL.js +0 -2
- package/dist/assets/errors-R4S2SAEM.js.map +0 -1
- package/dist/assets/fixedHosts-C2hdCfzK.js.map +0 -1
- package/dist/assets/groupFiles-BAQIt_bJ.js.map +0 -1
- package/dist/assets/host-CaRlDMTd.js.map +0 -1
- package/dist/assets/hyperdhtRelay-BxADl3SG.js.map +0 -1
- package/dist/assets/main-Bc4Ow56Z.js.map +0 -1
- package/dist/assets/mainline-DWh4Ccri.js.map +0 -1
- package/dist/assets/profiles-DgIfvBeN.js.map +0 -1
- package/dist/assets/registry-BSyxGjN6.js.map +0 -1
- package/dist/assets/resolve-D-9YRFhl.js.map +0 -1
- package/dist/assets/restoredRows-CRYwIx3g.js.map +0 -1
- package/dist/assets/secretGuard-Q2BKq0q0.js +0 -2
- package/dist/assets/server-BufntkX8.js.map +0 -1
- package/dist/assets/src-CCt5s4DK.js.map +0 -1
- package/dist/assets/usdt-ds461mzA.js.map +0 -1
- package/dist/assets/waitNotice-B8D8WhbE.js +0 -45
- package/dist/assets/waitNotice-B8D8WhbE.js.map +0 -1
- package/dist/assets/words-B1ylON2h.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { $ as SSHSIG_NAMESPACE, At as didJwsAlg, Bt as parseDidSignaturePaste, Cn as
|
|
2
|
-
import { c as boundedIdentityFetch, i as registeredIdentityProviders, s as reserveAdapterIds, t as ownDid, u as testBuild } from "./ownDid-
|
|
3
|
-
import { a as verifiedAtprotoHandle, c as assertDomainRecord, d as chosenResolver, f as resolverById, i as resolveAtprotoHandle, l as assertNip05, r as resolveAtprotoDid, s as DomainCheckError, t as assertPublicServer, u as assertPublicHost } from "./resolve-
|
|
4
|
-
import { a as PUBKY_RELAYS, c as isConfigured, d as providerForIssuer, i as validForgeLogin, l as issuerFor, n as SSH_FORGE_LABEL, o as audiences, r as checkSshForge, s as clientIdFor, t as SSH_FORGE_HOST, u as oidcProviders } from "./sshForges-
|
|
1
|
+
import { $ as SSHSIG_NAMESPACE, At as didJwsAlg, Bt as parseDidSignaturePaste, Bu as RELAY_PAYLOAD_MAX_BYTES, Cn as pubkyProofFile, Ct as DID_DOCUMENT_MAX_BYTES, Dt as checkDidJws, En as pubkyHomeserverOf, Et as DidError, Ft as didWebFileUrl, Ht as staticDidDocument, It as didWebHost, Lt as normalizeDid, Mt as didWebDocumentUrl, Nt as didWebFile, Ot as checkDidSignature, Pt as didWebFileNames, Rt as parseDid, Sn as pubkyProofCapability, St as verifyAtprotoRecordProof, Tn as homeserverWebEndpoint, Ut as strictBase64Url, Uu as openRelayPayload, Vt as signingKeys, Wt as DidDhtError, Yt as resolveDidDht, _n as PUBKY_PROOF_MAX_BYTES, _t as isAtprotoDid, ad as toBase64Url, at as verifySshSignature, bn as newPubkyProofFolder, bt as shortAtprotoDid, ca as dnsProofName, cd as utf8Encode, ct as decodeAnyBitcoinAddress, dt as ATPROTO_PROOF_COLLECTION, et as SshSigError, ft as ATPROTO_PROOF_SCOPE, gt as checkAtprotoProofRecord, ht as atprotoProofRkey, id as randomBytes, it as sshSignCommand, ji as IdentityCheckUnavailable, jt as didSignedMessages, kt as didGhostlyServiceEntry, la as domainTxtRecord, lt as ATPROTO_DECLARED_SCOPE, ma as normalizeDomain, mt as atprotoProofRecord, nd as fromBase64Url, nt as parseSshSignature, ot as verifyBitcoinMessage, sd as utf8Decode, st as BitcoinAddressError, tt as parseSshPublicKey, ua as domainWellKnownFile, ut as ATPROTO_FULL_SCOPE, vn as isPubkyKey, vt as normalizeAtprotoHandle, wn as pubkyProofPath, wt as DID_FILE_MAX_BYTES, xn as normalizePubkyKey, xt as AtprotoProofError, ya as wellKnownUrl, yn as isPubkyProofFolder, zt as parseDidDocument } from "./src-BIdfHB7t.js";
|
|
2
|
+
import { c as boundedIdentityFetch, i as registeredIdentityProviders, s as reserveAdapterIds, t as ownDid, u as testBuild } from "./ownDid-DkK_jem4.js";
|
|
3
|
+
import { a as verifiedAtprotoHandle, c as assertDomainRecord, d as chosenResolver, f as resolverById, i as resolveAtprotoHandle, l as assertNip05, p as pkarrRelays, r as resolveAtprotoDid, s as DomainCheckError, t as assertPublicServer, u as assertPublicHost } from "./resolve-BBOrN13E.js";
|
|
4
|
+
import { a as PUBKY_RELAYS, c as isConfigured, d as providerForIssuer, i as validForgeLogin, l as issuerFor, n as SSH_FORGE_LABEL, o as audiences, r as checkSshForge, s as clientIdFor, t as SSH_FORGE_HOST, u as oidcProviders } from "./sshForges-CRg-NGld.js";
|
|
5
5
|
import { ed25519 } from "@noble/curves/ed25519.js";
|
|
6
6
|
import { sha256 } from "@noble/hashes/sha2.js";
|
|
7
7
|
import { schnorr } from "@noble/curves/secp256k1.js";
|
|
@@ -761,11 +761,32 @@ function allowedAlgorithm(packet, signing) {
|
|
|
761
761
|
brainpoolP384r1: "brainpoolP384r1",
|
|
762
762
|
brainpoolP512r1: "brainpoolP512r1"
|
|
763
763
|
};
|
|
764
|
-
if ((algorithm === "rsaEncryptSign" || algorithm === "rsaSign" && signing) && bits && bits >= 2048) return `RSA ${bits}`;
|
|
764
|
+
if ((algorithm === "rsaEncryptSign" || algorithm === "rsaSign" && signing) && bits && bits >= 2048 && bits <= RSA_MAX_BITS) return `RSA ${bits}`;
|
|
765
765
|
if (algorithm === "ed25519" || algorithm === "eddsaLegacy" && curve === "ed25519Legacy") return "Ed25519";
|
|
766
766
|
if (algorithm === "ed448") return "Ed448";
|
|
767
767
|
if (algorithm === "ecdsa" && curve && names[curve]) return `ECDSA ${names[curve]}`;
|
|
768
|
-
throw new PgpProofError(`This key uses ${algorithm.startsWith("rsa") ? `RSA ${bits ?? "?"}` : curve ? `${algorithm} ${curve}` : algorithm}, which Ghostly does not accept. Use Ed25519, ECDSA (P-256, P-384, P-521, brainpool) or RSA with
|
|
768
|
+
throw new PgpProofError(`This key uses ${algorithm.startsWith("rsa") ? `RSA ${bits ?? "?"}` : curve ? `${algorithm} ${curve}` : algorithm}, which Ghostly does not accept. Use Ed25519, ECDSA (P-256, P-384, P-521, brainpool) or RSA with 2048 to ${RSA_MAX_BITS} bits.`);
|
|
769
|
+
}
|
|
770
|
+
var RSA_MAX_BITS = 8192;
|
|
771
|
+
/** GnuPG and OpenPGP.js make RSA keys with 65537 (17 bits). The same limit as SSH keys (core sshsig). */
|
|
772
|
+
var RSA_MAX_EXPONENT_BITS = 64;
|
|
773
|
+
var bitLength = (bytes) => {
|
|
774
|
+
const i = bytes.findIndex((b) => b !== 0);
|
|
775
|
+
return i < 0 ? 0 : (bytes.length - i - 1) * 8 + 32 - Math.clz32(bytes[i]);
|
|
776
|
+
};
|
|
777
|
+
/**
|
|
778
|
+
* Every RSA key in a key, primary and subkeys, sized before any signature on it is verified.
|
|
779
|
+
* Where WebCrypto refuses a key (Chromium: an exponent over 33 bits), OpenPGP.js verifies in
|
|
780
|
+
* JavaScript, one modular squaring per bit of the exponent, blocking the thread.
|
|
781
|
+
*/
|
|
782
|
+
function assertRsaSizes(key) {
|
|
783
|
+
for (const packet of [key.keyPacket, ...key.subkeys.map((s) => s.keyPacket)]) {
|
|
784
|
+
if (!packet.getAlgorithmInfo().algorithm.startsWith("rsa")) continue;
|
|
785
|
+
const { n, e } = packet.publicParams;
|
|
786
|
+
const bits = n ? bitLength(n) : 0, exponentBits = e ? bitLength(e) : 0;
|
|
787
|
+
if (bits > RSA_MAX_BITS) throw new PgpProofError(`This key uses RSA ${bits}, which Ghostly does not accept. Use Ed25519, ECDSA (P-256, P-384, P-521, brainpool) or RSA with 2048 to ${RSA_MAX_BITS} bits.`);
|
|
788
|
+
if (exponentBits > RSA_MAX_EXPONENT_BITS) throw new PgpProofError(`This key uses RSA with a ${exponentBits}-bit public exponent, which Ghostly does not accept. Use a key made by GnuPG (exponent 65537).`);
|
|
789
|
+
}
|
|
769
790
|
}
|
|
770
791
|
var ALLOWED_HASHES = /* @__PURE__ */ new Set([
|
|
771
792
|
8,
|
|
@@ -870,6 +891,7 @@ async function readOneKey(pgp, input) {
|
|
|
870
891
|
if (key.isPrivate()) throw new PgpProofError("This is a PRIVATE key. Ghostly only needs your public key (gpg --armor --export).");
|
|
871
892
|
const version = key.keyPacket.version;
|
|
872
893
|
if (version !== 4 && version !== 6) throw new PgpProofError(`OpenPGP v${version} keys are not accepted; use a v4 (RFC 4880) or v6 (RFC 9580) key.`);
|
|
894
|
+
assertRsaSizes(key);
|
|
873
895
|
return key;
|
|
874
896
|
}
|
|
875
897
|
/** Valid, unrevoked, self-certified user IDs at `at`. */
|
|
@@ -1132,6 +1154,20 @@ async function keyserverVerifiedEmails(keyserverArmored, fingerprint, options =
|
|
|
1132
1154
|
return [...new Set(emails.filter((e) => !!e).map((e) => e.toLowerCase()))];
|
|
1133
1155
|
}
|
|
1134
1156
|
//#endregion
|
|
1157
|
+
//#region ../browser/src/proofs/displaySource.ts
|
|
1158
|
+
/**
|
|
1159
|
+
* Where a proof's name came from (`display.source`), in the fixed words the providers write it in. The app says these
|
|
1160
|
+
* in its own language (`displaySourceOf` reads them back, from new proofs and stored ones alike); any other source is
|
|
1161
|
+
* shown as written.
|
|
1162
|
+
*/
|
|
1163
|
+
/** The user ID is its holder's own words: shown with that caveat, never as a checked name. */
|
|
1164
|
+
var OPENPGP_USER_ID_SOURCE = "User ID on the key, written by its holder: not proof that the name or email is theirs";
|
|
1165
|
+
var OPENPGP_KEYSERVER_SOURCE = "Email confirmed to keys.openpgp.org by its owner: the keyserver's check, not Ghostly's";
|
|
1166
|
+
/** A sign-in provider's ID token: who signed it, and whether it says the email is checked. */
|
|
1167
|
+
function oidcDisplaySource(provider, email) {
|
|
1168
|
+
return `Signed by ${provider}${email === "verified" ? `; email verified by ${provider}` : email === "unverified" ? `; email not verified by ${provider}` : ""}`;
|
|
1169
|
+
}
|
|
1170
|
+
//#endregion
|
|
1135
1171
|
//#region ../browser/src/proofs/providers/openpgp.ts
|
|
1136
1172
|
/**
|
|
1137
1173
|
* OpenPGP keys, signed with the person's own gpg — a YubiKey or another OpenPGP card works unchanged,
|
|
@@ -1144,9 +1180,6 @@ function normalizeFingerprint(input) {
|
|
|
1144
1180
|
if (/^[A-F0-9]{8}$|^[A-F0-9]{16}$/.test(value)) throw new PgpProofError("Use the full fingerprint, not a key ID: gpg --fingerprint shows it.");
|
|
1145
1181
|
throw new PgpProofError("Enter your key's fingerprint: 40 hex characters (gpg --fingerprint).");
|
|
1146
1182
|
}
|
|
1147
|
-
/** The user ID is its holder's own words: shown with that caveat, never as a checked name. */
|
|
1148
|
-
var USER_ID_SOURCE = "User ID on the key, written by its holder: not proof that the name or email is theirs";
|
|
1149
|
-
var KEYSERVER_SOURCE = "Email confirmed to keys.openpgp.org by its owner: the keyserver's check, not Ghostly's";
|
|
1150
1183
|
function steps(statement, exportKey) {
|
|
1151
1184
|
assertSignableStatement(statement.text);
|
|
1152
1185
|
if (statement.text.includes("'")) throw new PgpProofError("Statement is not signable as plain text");
|
|
@@ -1253,7 +1286,7 @@ var openpgp = {
|
|
|
1253
1286
|
...verified.expiresAt !== null && verified.expiresAt < binding.expiresAt ? { expiresAt: verified.expiresAt } : {},
|
|
1254
1287
|
...userId ? { display: {
|
|
1255
1288
|
name: userId,
|
|
1256
|
-
source:
|
|
1289
|
+
source: OPENPGP_USER_ID_SOURCE,
|
|
1257
1290
|
fetchedAt: ctx.now
|
|
1258
1291
|
} } : {}
|
|
1259
1292
|
};
|
|
@@ -1267,7 +1300,7 @@ var openpgp = {
|
|
|
1267
1300
|
return {
|
|
1268
1301
|
name: emails[0],
|
|
1269
1302
|
url: `${KEYSERVER}/search?q=${fpr}`,
|
|
1270
|
-
source:
|
|
1303
|
+
source: OPENPGP_KEYSERVER_SOURCE,
|
|
1271
1304
|
fetchedAt: found.fetchedAt
|
|
1272
1305
|
};
|
|
1273
1306
|
}
|
|
@@ -1948,7 +1981,7 @@ function createOidcIdentityProvider(options = {}) {
|
|
|
1948
1981
|
...name ? { name } : {},
|
|
1949
1982
|
...url ? { url } : {},
|
|
1950
1983
|
fetchedAt: id.issuedAt,
|
|
1951
|
-
source:
|
|
1984
|
+
source: oidcDisplaySource(provider.name, id.email ? id.emailVerified ? "verified" : "unverified" : void 0)
|
|
1952
1985
|
} } : {}
|
|
1953
1986
|
};
|
|
1954
1987
|
}
|
|
@@ -2022,7 +2055,10 @@ async function resolve(did, method, options) {
|
|
|
2022
2055
|
}
|
|
2023
2056
|
const found = await (options.dht ?? resolveDidDht)(did, {
|
|
2024
2057
|
fetch: options.fetch,
|
|
2025
|
-
signal: options.signal
|
|
2058
|
+
signal: options.signal,
|
|
2059
|
+
relays: pkarrRelays()
|
|
2060
|
+
}).catch((e) => {
|
|
2061
|
+
throw e instanceof DidDhtError && e.code === "unreachable" ? new IdentityCheckUnavailable(e.message) : e;
|
|
2026
2062
|
});
|
|
2027
2063
|
if (found.metadata.deactivated) throw new DidError("This DID is deactivated: its owner retired it");
|
|
2028
2064
|
return {
|
|
@@ -2311,7 +2347,7 @@ var did = {
|
|
|
2311
2347
|
maxDays: 365
|
|
2312
2348
|
},
|
|
2313
2349
|
recheck: { afterSeconds: 86400 },
|
|
2314
|
-
privacy: "did:key and did:jwk: nothing, checked on this device. did:web: the contact's app asks its DNS-over-HTTPS resolver for your domain and downloads your did.json, so your web server sees the contact's IP address. did:dht:
|
|
2350
|
+
privacy: "did:key and did:jwk: nothing, checked on this device. did:web: the contact's app asks its DNS-over-HTTPS resolver for your domain and downloads your did.json, so your web server sees the contact's IP address. did:dht: one of the contact's Pkarr relays (their Network settings) learns which DID was looked up.",
|
|
2315
2351
|
signers: [
|
|
2316
2352
|
signer,
|
|
2317
2353
|
fileSigner,
|
|
@@ -2831,10 +2867,12 @@ var atproto = createAtprotoIdentityProvider();
|
|
|
2831
2867
|
*/
|
|
2832
2868
|
/**
|
|
2833
2869
|
* The newest DNS packet the relays hold for `key`, its signature checked against `key`. Every relay is asked; one
|
|
2834
|
-
* that is down, answers garbage or holds an older packet does not count. Throws when none has a valid one
|
|
2870
|
+
* that is down, answers garbage or holds an older packet does not count. Throws when none has a valid one: as
|
|
2871
|
+
* IdentityCheckUnavailable when none answered (not reached, or an error status), since that says nothing of the key.
|
|
2835
2872
|
*/
|
|
2836
2873
|
async function pubkyRecords(key, fetch, signal, relays = PUBKY_RELAYS) {
|
|
2837
2874
|
const failed = [];
|
|
2875
|
+
let answered = false;
|
|
2838
2876
|
const newest = (await Promise.all(relays.map(async (relay) => {
|
|
2839
2877
|
let r;
|
|
2840
2878
|
try {
|
|
@@ -2846,13 +2884,15 @@ async function pubkyRecords(key, fetch, signal, relays = PUBKY_RELAYS) {
|
|
|
2846
2884
|
failed.push(e);
|
|
2847
2885
|
return;
|
|
2848
2886
|
}
|
|
2887
|
+
if (r.status === 200 || r.status === 404) answered = true;
|
|
2849
2888
|
try {
|
|
2850
2889
|
return r.status === 200 ? openRelayPayload(key, r.bytes) : void 0;
|
|
2851
2890
|
} catch {
|
|
2852
2891
|
return;
|
|
2853
2892
|
}
|
|
2854
2893
|
}))).filter((a) => !!a).sort((a, b) => b.seq > a.seq ? 1 : b.seq < a.seq ? -1 : 0)[0];
|
|
2855
|
-
if (!newest && failed.length === relays.length && failed[0] instanceof
|
|
2894
|
+
if (!newest && failed.length === relays.length && (failed[0] instanceof IdentityCheckUnavailable || /too large/i.test(String(failed[0])))) throw failed[0];
|
|
2895
|
+
if (!newest && !answered) throw new IdentityCheckUnavailable("No relay answered");
|
|
2856
2896
|
if (!newest) throw new NoPkarrRecords("This Pubky key has no records on the Pkarr relays");
|
|
2857
2897
|
return newest.dnsPacket;
|
|
2858
2898
|
}
|
|
@@ -3567,4 +3607,4 @@ function identityProvider(id, providers = identityProviders()) {
|
|
|
3567
3607
|
//#endregion
|
|
3568
3608
|
export { identityProvider as n, identityProviders as r, IDENTITY_PROVIDERS as t };
|
|
3569
3609
|
|
|
3570
|
-
//# sourceMappingURL=registry-
|
|
3610
|
+
//# sourceMappingURL=registry-CEjnubep.js.map
|