@thurinlabs/identity-kit 0.7.2 → 0.7.4
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/dist/embed.global.js +23 -9
- package/dist/embed.global.js.map +1 -1
- package/dist/index.cjs +23 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +23 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/embed.global.js
CHANGED
|
@@ -39380,9 +39380,8 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
39380
39380
|
const name = typeof n2.name === "string" ? n2.name : new TextDecoder().decode(n2.name);
|
|
39381
39381
|
const value = n2.value instanceof Uint8Array ? new TextDecoder().decode(n2.value) : typeof n2.value === "string" ? n2.value : null;
|
|
39382
39382
|
if (value) {
|
|
39383
|
-
|
|
39384
|
-
|
|
39385
|
-
seen.add(dedupeKey);
|
|
39383
|
+
if (!seen.has(value)) {
|
|
39384
|
+
seen.add(value);
|
|
39386
39385
|
notations.push({ name, value });
|
|
39387
39386
|
}
|
|
39388
39387
|
}
|
|
@@ -39493,11 +39492,13 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
39493
39492
|
queryFn: async () => {
|
|
39494
39493
|
if (!attestations || !address) return [];
|
|
39495
39494
|
const results = [];
|
|
39495
|
+
const logsByIndex = {};
|
|
39496
|
+
for (const l2 of eventData || []) logsByIndex[Number(l2.args.index)] = l2;
|
|
39496
39497
|
for (let i2 = 0; i2 < attestations.length; i2++) {
|
|
39497
39498
|
const att = attestations[i2];
|
|
39498
39499
|
if (att.status !== "success") continue;
|
|
39499
39500
|
const [fingerprint, createdAt, revoked] = att.result;
|
|
39500
|
-
const log =
|
|
39501
|
+
const log = logsByIndex[i2];
|
|
39501
39502
|
const pgpSignature = log?.args?.pgpSignature ?? null;
|
|
39502
39503
|
const pgpPublicKey = log?.args?.pgpPublicKey ?? null;
|
|
39503
39504
|
const txHash = log?.transactionHash ?? null;
|
|
@@ -39526,7 +39527,8 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
39526
39527
|
enabled: !!attestations && attestations.length > 0,
|
|
39527
39528
|
staleTime: 3e5
|
|
39528
39529
|
});
|
|
39529
|
-
const
|
|
39530
|
+
const eventLogsPending = !!address && attestationCount > 0 && eventData === void 0;
|
|
39531
|
+
const isLoading = countLoading || attestationsLoading || verifyLoading || eventLogsPending;
|
|
39530
39532
|
const activeClaims = (claims || []).filter((c2) => !c2.revoked);
|
|
39531
39533
|
const verifiedClaims = activeClaims.filter((c2) => c2.verification?.verified);
|
|
39532
39534
|
const currentFingerprint = verifiedClaims.length > 0 ? verifiedClaims[verifiedClaims.length - 1].fingerprint : null;
|
|
@@ -39795,7 +39797,7 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
39795
39797
|
// src/hooks/usePGPProofs.ts
|
|
39796
39798
|
function usePGPProofs(fingerprint) {
|
|
39797
39799
|
const config = useIdentityKitConfig();
|
|
39798
|
-
const { data
|
|
39800
|
+
const { data } = useQuery({
|
|
39799
39801
|
queryKey: ["pgp-proofs", fingerprint],
|
|
39800
39802
|
queryFn: async () => {
|
|
39801
39803
|
if (!fingerprint) return { keyInfo: null, proofs: [] };
|
|
@@ -39803,7 +39805,7 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
39803
39805
|
if (!armoredKey) return { keyInfo: null, proofs: [] };
|
|
39804
39806
|
const keyInfo = await parsePgpKey(armoredKey);
|
|
39805
39807
|
if (!keyInfo) return { keyInfo: null, proofs: [] };
|
|
39806
|
-
const identified = keyInfo.notations.map((n2) => identifyProof(n2)).filter((p2) => p2 !== null);
|
|
39808
|
+
const identified = keyInfo.notations.map((n2) => identifyProof(n2)).filter((p2) => p2 !== null && p2.provider !== "unknown");
|
|
39807
39809
|
const proofs = await Promise.all(
|
|
39808
39810
|
identified.map(async (proof) => {
|
|
39809
39811
|
const result = await verifyProof(proof, fingerprint, config.neynarApiKey);
|
|
@@ -39819,7 +39821,15 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
39819
39821
|
};
|
|
39820
39822
|
})
|
|
39821
39823
|
);
|
|
39822
|
-
|
|
39824
|
+
const byAccount = /* @__PURE__ */ new Map();
|
|
39825
|
+
for (const p2 of proofs) {
|
|
39826
|
+
const key = `${p2.provider}:${p2.displayUrl}`;
|
|
39827
|
+
const prev = byAccount.get(key);
|
|
39828
|
+
if (!prev || p2.status === "verified" && prev.status !== "verified") {
|
|
39829
|
+
byAccount.set(key, p2);
|
|
39830
|
+
}
|
|
39831
|
+
}
|
|
39832
|
+
return { keyInfo, proofs: [...byAccount.values()] };
|
|
39823
39833
|
},
|
|
39824
39834
|
enabled: !!fingerprint,
|
|
39825
39835
|
staleTime: 3e5
|
|
@@ -39827,7 +39837,11 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
39827
39837
|
return {
|
|
39828
39838
|
keyInfo: data?.keyInfo ?? null,
|
|
39829
39839
|
proofs: data?.proofs ?? [],
|
|
39830
|
-
|
|
39840
|
+
// Report loading whenever a fingerprint is set but its proofs haven't
|
|
39841
|
+
// resolved yet. Using react-query's own isLoading leaves a gap while the
|
|
39842
|
+
// query is enabling (fingerprint just became known), during which the card
|
|
39843
|
+
// would briefly paint without proof badges and then pop them in.
|
|
39844
|
+
isLoading: !!fingerprint && data === void 0
|
|
39831
39845
|
};
|
|
39832
39846
|
}
|
|
39833
39847
|
|