@thurinlabs/identity-kit 1.3.7 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
4
 
@@ -62,473 +62,17 @@
62
62
 
63
63
 
64
64
 
65
- var _chunkOIE72R6Jcjs = require('./chunk-OIE72R6J.cjs');
66
65
 
67
- // src/provider.tsx
68
- var _react = require('react');
69
- var _wagmi = require('wagmi');
70
- var _chains = require('wagmi/chains');
71
- var _reactquery = require('@tanstack/react-query');
72
66
 
73
- // src/context.ts
74
67
 
75
- var defaultConfig = {
76
- baseUrl: "https://thurin.id",
77
- network: "mainnet"
78
- };
79
- var IdentityKitContext = _react.createContext.call(void 0, defaultConfig);
80
- function useIdentityKitConfig() {
81
- return _react.useContext.call(void 0, IdentityKitContext);
82
- }
83
68
 
84
- // src/provider.tsx
85
- var _jsxruntime = require('react/jsx-runtime');
86
- var defaultQueryClient = new (0, _reactquery.QueryClient)({
87
- defaultOptions: {
88
- queries: {
89
- staleTime: 6e4,
90
- retry: 1
91
- }
92
- }
93
- });
94
- function createDefaultWagmiConfig(rpcUrl, network) {
95
- const url = rpcUrl || _chunkOIE72R6Jcjs.getRegistry.call(void 0, network).defaultRpcUrl;
96
- if (network === "sepolia") return _wagmi.createConfig.call(void 0, { chains: [_chains.sepolia], transports: { [_chains.sepolia.id]: _wagmi.http.call(void 0, url) } });
97
- if (network === "local") return _wagmi.createConfig.call(void 0, { chains: [_chains.foundry], transports: { [_chains.foundry.id]: _wagmi.http.call(void 0, url) } });
98
- return _wagmi.createConfig.call(void 0, { chains: [_chains.mainnet], transports: { [_chains.mainnet.id]: _wagmi.http.call(void 0, url) } });
99
- }
100
- function WagmiDetector({ children, rpcUrl, network }) {
101
- let hasWagmi = false;
102
- try {
103
- _wagmi.useConfig.call(void 0, );
104
- hasWagmi = true;
105
- } catch (e) {
106
- }
107
- const wagmiConfig = _react.useMemo.call(void 0, () => createDefaultWagmiConfig(rpcUrl, network), [rpcUrl, network]);
108
- if (hasWagmi) {
109
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children });
110
- }
111
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _wagmi.WagmiProvider, { config: wagmiConfig, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactquery.QueryClientProvider, { client: defaultQueryClient, children }) });
112
- }
113
- function IdentityKitProvider({
114
- children,
115
- rpcUrl,
116
- neynarApiKey,
117
- farcasterHub,
118
- baseUrl = "https://thurin.id",
119
- network = "mainnet",
120
- registryAddress
121
- }) {
122
- const config = _react.useMemo.call(void 0,
123
- () => ({ rpcUrl, neynarApiKey, farcasterHub, baseUrl, network, registryAddress }),
124
- [rpcUrl, neynarApiKey, farcasterHub, baseUrl, network, registryAddress]
125
- );
126
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, IdentityKitContext.Provider, { value: config, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WagmiDetector, { rpcUrl, network, children }) });
127
- }
128
69
 
129
- // src/components/ThurinCard/ThurinCard.tsx
130
-
131
-
132
- // src/hooks/useThurinIdentity.ts
133
-
134
- var _ens = require('viem/ens');
135
-
136
- // src/hooks/useAttestations.ts
137
-
138
-
139
- var _viem = require('viem');
140
- function useAttestations(address) {
141
- const config = useIdentityKitConfig();
142
- const registry = _chunkOIE72R6Jcjs.getRegistry.call(void 0, config.network, config.registryAddress);
143
- const chain = _chunkOIE72R6Jcjs.chainFor.call(void 0, config.network);
144
- const owner = address;
145
- const { data: rows, isLoading: rowsLoading, isFetched: rowsFetched, error: rowsError, refetch: refetchRows } = _wagmi.useReadContract.call(void 0, {
146
- address: registry.address,
147
- abi: _chunkOIE72R6Jcjs.REGISTRY_ABI,
148
- functionName: "attestationsOf",
149
- args: owner ? [owner] : void 0,
150
- chainId: chain.id,
151
- query: { enabled: !!owner }
152
- });
153
- const count = _nullishCoalesce(_optionalChain([rows, 'optionalAccess', _2 => _2.length]), () => ( 0));
154
- const contracts = owner && rows ? rows.map((_, i) => ({
155
- address: registry.address,
156
- abi: _chunkOIE72R6Jcjs.REGISTRY_ABI,
157
- functionName: "getPayload",
158
- args: [owner, BigInt(i)],
159
- chainId: chain.id
160
- })) : [];
161
- const { data: payloads, isLoading: payloadsLoading, error: payloadsError, refetch: refetchPayloads } = _wagmi.useReadContracts.call(void 0, {
162
- contracts,
163
- query: { enabled: contracts.length > 0 }
164
- });
165
- const payloadsReady = count === 0 || payloads !== void 0 && payloads.length === count;
166
- const { data: claims, isLoading: verifyLoading } = _reactquery.useQuery.call(void 0, {
167
- queryKey: ["attestations", config.network, registry.address, address, count, payloadsReady],
168
- queryFn: async () => {
169
- if (!rows || !address) return [];
170
- const results = [];
171
- for (let i = 0; i < rows.length; i++) {
172
- const row = rows[i];
173
- const payload = _optionalChain([payloads, 'optionalAccess', _3 => _3[i]]);
174
- let pgpSignature = null;
175
- let pgpPublicKey = null;
176
- if (payload && payload.status === "success") {
177
- const [sigHex, keyHex] = payload.result;
178
- pgpSignature = _viem.hexToString.call(void 0, sigHex);
179
- pgpPublicKey = _viem.hexToString.call(void 0, keyHex);
180
- }
181
- const fingerprint = _chunkOIE72R6Jcjs.bytesToFingerprint.call(void 0, row.fingerprint);
182
- const verification = pgpPublicKey && pgpSignature ? await _chunkOIE72R6Jcjs.verifyAttestation.call(void 0, { pgpPublicKey, pgpSignature, fingerprint, ethAddress: address }) : null;
183
- const revokedAt = Number(row.revokedAt);
184
- results.push({
185
- index: i,
186
- fingerprint,
187
- createdAt: Number(row.createdAt),
188
- revoked: revokedAt !== 0,
189
- revokedAt: revokedAt === 0 ? null : revokedAt,
190
- messageVersion: Number(row.messageVersion),
191
- pgpSignature,
192
- pgpPublicKey,
193
- verification
194
- });
195
- }
196
- return results;
197
- },
198
- enabled: !!rows && payloadsReady,
199
- staleTime: 3e5
200
- });
201
- const isLoading = rowsLoading || !!owner && !rowsFetched || payloadsLoading || verifyLoading || !!owner && rows !== void 0 && !payloadsReady;
202
- const activeClaims = (claims || []).filter((c) => !c.revoked);
203
- const verifiedClaims = activeClaims.filter((c) => _optionalChain([c, 'access', _4 => _4.verification, 'optionalAccess', _5 => _5.verified]));
204
- const currentFingerprint = verifiedClaims.length > 0 ? verifiedClaims[verifiedClaims.length - 1].fingerprint : null;
205
- return {
206
- claims: claims || [],
207
- totalClaims: count,
208
- activeClaims: activeClaims.length,
209
- currentFingerprint,
210
- isLoading,
211
- /** A registry read failed (the RPC may be down; useThurinIdentity finds out which). */
212
- error: _nullishCoalesce(_nullishCoalesce(rowsError, () => ( payloadsError)), () => ( null)),
213
- refetch: () => {
214
- if (owner) {
215
- refetchRows();
216
- if (contracts.length > 0) refetchPayloads();
217
- }
218
- }
219
- };
220
- }
221
-
222
- // src/hooks/useEFPGraph.ts
223
-
224
- function useEFPGraph(address) {
225
- const { data, isLoading } = _reactquery.useQuery.call(void 0, {
226
- queryKey: ["efp-graph", address],
227
- queryFn: () => _chunkOIE72R6Jcjs.fetchEFPGraph.call(void 0, address),
228
- enabled: !!address,
229
- staleTime: 3e5
230
- });
231
- return {
232
- efp: _nullishCoalesce(data, () => ( null)),
233
- isLoading
234
- };
235
- }
236
-
237
- // src/hooks/usePGPProofs.ts
238
-
239
- function usePGPProofs(fingerprint, armoredKey) {
240
- const config = useIdentityKitConfig();
241
- const { data } = _reactquery.useQuery.call(void 0, {
242
- // The key is large; key the query on its length + fingerprint, which
243
- // changes whenever a different attestation's key is supplied.
244
- queryKey: ["pgp-proofs", fingerprint, _nullishCoalesce(_optionalChain([armoredKey, 'optionalAccess', _6 => _6.length]), () => ( 0))],
245
- queryFn: async () => {
246
- if (!fingerprint || !armoredKey) return { keyInfo: null, proofs: [] };
247
- const keyInfo = await _chunkOIE72R6Jcjs.parsePgpKey.call(void 0, armoredKey);
248
- if (!keyInfo) return { keyInfo: null, proofs: [] };
249
- const identified = keyInfo.notations.map((n) => _chunkOIE72R6Jcjs.identifyProof.call(void 0, n)).filter((p) => p !== null && p.provider !== "unknown");
250
- const proofs = await Promise.all(
251
- identified.map(async (proof) => {
252
- const result = await _chunkOIE72R6Jcjs.verifyProof.call(void 0, proof, fingerprint, { neynarApiKey: config.neynarApiKey, farcasterHub: config.farcasterHub });
253
- return {
254
- provider: proof.provider,
255
- label: proof.label,
256
- url: proof.url,
257
- displayUrl: _chunkOIE72R6Jcjs.displayUrl.call(void 0, proof),
258
- href: _chunkOIE72R6Jcjs.proofHref.call(void 0, proof),
259
- secondaryHref: _chunkOIE72R6Jcjs.proofSecondaryHref.call(void 0, proof),
260
- status: result.verified ? "verified" : "unverified",
261
- reason: result.reason
262
- };
263
- })
264
- );
265
- const byAccount = /* @__PURE__ */ new Map();
266
- for (const p of proofs) {
267
- const key = `${p.provider}:${p.displayUrl}`;
268
- const prev = byAccount.get(key);
269
- if (!prev || p.status === "verified" && prev.status !== "verified") {
270
- byAccount.set(key, p);
271
- }
272
- }
273
- return { keyInfo, proofs: [...byAccount.values()] };
274
- },
275
- enabled: !!fingerprint && !!armoredKey,
276
- staleTime: 3e5
277
- });
278
- return {
279
- keyInfo: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _7 => _7.keyInfo]), () => ( null)),
280
- proofs: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _8 => _8.proofs]), () => ( [])),
281
- // Report loading whenever a fingerprint is set but its proofs haven't
282
- // resolved yet. Using react-query's own isLoading leaves a gap while the
283
- // query is enabling (fingerprint just became known), during which the card
284
- // would briefly paint without proof badges and then pop them in.
285
- isLoading: !!fingerprint && !!armoredKey && data === void 0
286
- };
287
- }
288
-
289
- // src/hooks/useSafeAvatar.ts
290
-
291
-
292
- function useSafeAvatar(name, chainId) {
293
- const { data: raw } = _wagmi.useEnsText.call(void 0, { name, key: "avatar", chainId, query: { enabled: !!name } });
294
- const direct = _chunkOIE72R6Jcjs.avatarUrl.call(void 0, raw);
295
- const nft = direct ? null : _chunkOIE72R6Jcjs.parseNftAvatar.call(void 0, raw);
296
- const { data: tokenUri } = _wagmi.useReadContract.call(void 0, {
297
- address: _optionalChain([nft, 'optionalAccess', _9 => _9.contract]),
298
- abi: _chunkOIE72R6Jcjs.NFT_AVATAR_ABI,
299
- functionName: _optionalChain([nft, 'optionalAccess', _10 => _10.standard]) === "erc1155" ? "uri" : "tokenURI",
300
- args: nft ? [nft.tokenId] : void 0,
301
- chainId,
302
- query: { enabled: !!nft && nft.chainId === chainId }
303
- });
304
- const { data: image } = _reactquery.useQuery.call(void 0, {
305
- queryKey: ["thurin-nft-avatar", tokenUri, _optionalChain([nft, 'optionalAccess', _11 => _11.tokenId, 'access', _12 => _12.toString, 'call', _13 => _13()])],
306
- queryFn: () => _chunkOIE72R6Jcjs.nftAvatarImage.call(void 0, tokenUri, nft.tokenId).catch(() => null),
307
- enabled: typeof tokenUri === "string" && !!nft
308
- });
309
- return _nullishCoalesce(_nullishCoalesce(direct, () => ( image)), () => ( null));
310
- }
311
-
312
- // src/hooks/useThurinIdentity.ts
313
- function isAddress(value) {
314
- return /^0x[0-9a-fA-F]{40}$/.test(value);
315
- }
316
- function safeNormalize(name) {
317
- try {
318
- return _ens.normalize.call(void 0, name);
319
- } catch (e2) {
320
- return void 0;
321
- }
322
- }
323
- function useThurinIdentity(ensOrAddress) {
324
- const chain = _chunkOIE72R6Jcjs.chainFor.call(void 0, useIdentityKitConfig().network);
325
- const isAddr = ensOrAddress ? isAddress(ensOrAddress) : false;
326
- const ensInput = ensOrAddress && !isAddr ? safeNormalize(ensOrAddress) : void 0;
327
- const { data: resolvedAddress, error: ensError, isFetched: ensFetched, refetch: refetchEns } = _wagmi.useEnsAddress.call(void 0, {
328
- name: ensInput,
329
- chainId: chain.id,
330
- query: { enabled: !!ensInput }
331
- });
332
- const address = isAddr ? ensOrAddress : _nullishCoalesce(resolvedAddress, () => ( null));
333
- const { data: ensName } = _wagmi.useEnsName.call(void 0, {
334
- address,
335
- chainId: chain.id,
336
- query: { enabled: !!address }
337
- });
338
- const displayName = ensInput || ensName || null;
339
- const ensAvatar = useSafeAvatar(displayName ? safeNormalize(displayName) : void 0, chain.id);
340
- const {
341
- claims,
342
- totalClaims,
343
- activeClaims,
344
- currentFingerprint,
345
- isLoading: claimsLoading,
346
- error: claimsError,
347
- refetch: refetchClaims
348
- } = useAttestations(address);
349
- const currentClaim = [...claims].reverse().find(
350
- (c) => !c.revoked && _optionalChain([c, 'access', _14 => _14.verification, 'optionalAccess', _15 => _15.verified]) && c.fingerprint === currentFingerprint
351
- );
352
- const {
353
- keyInfo: pgpKeyInfo,
354
- proofs,
355
- isLoading: proofsLoading
356
- } = usePGPProofs(currentFingerprint, _nullishCoalesce(_optionalChain([currentClaim, 'optionalAccess', _16 => _16.pgpPublicKey]), () => ( null)));
357
- const { efp, isLoading: efpLoading } = useEFPGraph(address);
358
- const lookup = { ensEmpty: !!ensInput && ensFetched && !resolvedAddress, ensFailed: !!ensError, claimsFailed: !!claimsError };
359
- const probeNeeded = _chunkOIE72R6Jcjs.needsRpcProbe.call(void 0, lookup);
360
- const probe = _wagmi.useBlockNumber.call(void 0, {
361
- chainId: chain.id,
362
- scopeKey: `thurin-rpc-probe:${_nullishCoalesce(ensOrAddress, () => ( ""))}`,
363
- query: { enabled: probeNeeded, retry: 0, staleTime: 0, gcTime: 0 }
364
- });
365
- const rpcAnswered = !probeNeeded || probe.isFetching ? void 0 : probe.isSuccess ? true : probe.isError ? false : void 0;
366
- const errorKind = _chunkOIE72R6Jcjs.identityErrorKind.call(void 0, { ...lookup, rpcAnswered });
367
- const probing = probeNeeded && rpcAnswered === void 0;
368
- const retry = () => {
369
- if (ensInput) refetchEns();
370
- refetchClaims();
371
- if (probeNeeded) probe.refetch();
372
- };
373
- return {
374
- address,
375
- ensName: displayName,
376
- ensAvatar,
377
- claims,
378
- totalClaims,
379
- activeClaims,
380
- currentFingerprint,
381
- pgpKeyInfo,
382
- proofs,
383
- efp,
384
- // "Not finished" counts as loading, including queries paused in a background tab: the card
385
- // must not render defaults (zeros) for an identity it hasn't looked up yet.
386
- isLoading: !!ensInput && !ensFetched || claimsLoading || proofsLoading || efpLoading || probing,
387
- error: errorKind ? new Error(_chunkOIE72R6Jcjs.IDENTITY_ERROR_TEXT[errorKind]) : null,
388
- errorKind,
389
- retry
390
- };
391
- }
392
-
393
- // src/components/ThurinCard/ThurinCard.tsx
394
-
395
- function ThurinLogo() {
396
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", { className: "thurin-card-avatar-placeholder", viewBox: "0 0 100 100", xmlns: "http://www.w3.org/2000/svg", children: [
397
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "circle", { cx: "50", cy: "50", r: "50", fill: "var(--thurin-surface-deep)" }),
398
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M25 80 Q25 25 50 25 Q75 25 75 50", fill: "none", stroke: "#7c9a3e", strokeWidth: "4", strokeLinecap: "round" }),
399
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M33 75 Q33 35 50 35 Q67 35 67 52", fill: "none", stroke: "#7c9a3e", strokeWidth: "4", strokeLinecap: "round" }),
400
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M41 70 Q41 45 50 45 Q59 45 59 55", fill: "none", stroke: "#c9a227", strokeWidth: "4", strokeLinecap: "round" }),
401
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M50 65 L50 53", fill: "none", stroke: "#c9a227", strokeWidth: "4", strokeLinecap: "round" })
402
- ] });
403
- }
404
- function Avatar({ src, alt }) {
405
- const [tries, setTries] = _react.useState.call(void 0, []);
406
- _react.useEffect.call(void 0, () => {
407
- setTries(src ? [src, ..._chunkOIE72R6Jcjs.avatarFallbacks.call(void 0, src)] : []);
408
- }, [src]);
409
- if (!tries.length) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThurinLogo, {});
410
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { className: "thurin-card-avatar", src: tries[0], alt, onError: () => setTries((t) => t.slice(1)) });
411
- }
412
- function ThurinCard({ ens, address, theme = "thurin" }) {
413
- const input = ens || address;
414
- const identity = useThurinIdentity(input);
415
- const config = useIdentityKitConfig();
416
- const profileUrl = identity.address ? `${config.baseUrl}/eth/${identity.address}` : ens ? `${config.baseUrl}/ens/${ens}` : null;
417
- if (identity.isLoading) {
418
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "thurin-card", "data-thurin-theme": theme, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "thurin-card-loading", children: "Loading identity..." }) });
419
- }
420
- const displayAddress = identity.address || null;
421
- if (identity.errorKind) {
422
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "thurin-card", "data-thurin-theme": theme, children: [
423
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "thurin-card-header", children: [
424
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThurinLogo, {}),
425
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "thurin-card-name", children: identity.ensName || ens || address }) })
426
- ] }),
427
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "thurin-card-error", role: "status", children: [
428
- _optionalChain([identity, 'access', _17 => _17.error, 'optionalAccess', _18 => _18.message]),
429
- identity.errorKind !== "not-found" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", className: "thurin-card-retry", onClick: identity.retry, children: "Try again" })
430
- ] }),
431
- profileUrl && identity.errorKind !== "not-found" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "a", { className: "thurin-card-link", href: profileUrl, target: "_blank", rel: "noopener noreferrer", children: "View on Thurin" })
432
- ] });
433
- }
434
- const verifiedProofs = identity.proofs.filter((p) => p.status === "verified").length;
435
- const hasVerifiedPgp = identity.claims.some((c) => _optionalChain([c, 'access', _19 => _19.verification, 'optionalAccess', _20 => _20.verified]) && !c.revoked);
436
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "thurin-card", "data-thurin-theme": theme, children: [
437
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "a", { className: "thurin-card-header", href: profileUrl || void 0, target: "_blank", rel: "noopener noreferrer", children: [
438
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Avatar, { src: identity.ensAvatar, alt: identity.ensName || "" }),
439
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
440
- identity.ensName && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "thurin-card-name", children: identity.ensName }),
441
- displayAddress && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "thurin-card-address", children: displayAddress })
442
- ] })
443
- ] }),
444
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "thurin-card-stats", children: [
445
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "thurin-card-stat", children: [
446
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "thurin-card-stat-value", children: identity.activeClaims }),
447
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "thurin-card-stat-label", children: "Attestations" })
448
- ] }),
449
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "thurin-card-stat", children: [
450
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "thurin-card-stat-value", children: verifiedProofs }),
451
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "thurin-card-stat-label", children: "Proofs" })
452
- ] }),
453
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "thurin-card-stat", children: [
454
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "thurin-card-stat-value", children: identity.efp ? identity.efp.followers : "\u2013" }),
455
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "thurin-card-stat-label", children: "Followers" })
456
- ] })
457
- ] }),
458
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "thurin-card-badges", children: [
459
- hasVerifiedPgp && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "thurin-card-badge thurin-card-badge--verified", children: "PGP Verified" }),
460
- _optionalChain([identity, 'access', _21 => _21.efp, 'optionalAccess', _22 => _22.hasEfp]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "thurin-card-badge thurin-card-badge--verified", children: "EFP" }),
461
- identity.proofs.map((p, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
462
- "span",
463
- {
464
- className: `thurin-card-badge thurin-card-badge--${p.status === "verified" ? "verified" : "unverified"}`,
465
- children: p.label
466
- },
467
- i
468
- ))
469
- ] }),
470
- profileUrl && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
471
- "a",
472
- {
473
- className: "thurin-card-link",
474
- href: profileUrl,
475
- target: "_blank",
476
- rel: "noopener noreferrer",
477
- children: "View on Thurin"
478
- }
479
- )
480
- ] });
481
- }
482
70
 
483
- // src/hooks/useEnsHint.ts
484
71
 
485
72
 
486
- function safeNormalize2(name) {
487
- try {
488
- return _ens.normalize.call(void 0, name);
489
- } catch (e3) {
490
- return void 0;
491
- }
492
- }
493
- function useEnsHint(name, verifiedFingerprint) {
494
- const chain = _chunkOIE72R6Jcjs.chainFor.call(void 0, useIdentityKitConfig().network);
495
- const ensName = name ? safeNormalize2(name) : void 0;
496
- const { data, isLoading, refetch } = _wagmi.useEnsText.call(void 0, {
497
- name: ensName,
498
- key: _chunkOIE72R6Jcjs.ENS_HINT_KEY,
499
- chainId: chain.id,
500
- query: { enabled: !!ensName }
501
- });
502
- return { ..._chunkOIE72R6Jcjs.ensHintFor.call(void 0, _nullishCoalesce(data, () => ( null)), verifiedFingerprint), isLoading: !!ensName && isLoading, refetch: () => {
503
- void refetch();
504
- } };
505
- }
506
73
 
507
- // src/hooks/useRecords.ts
508
74
 
509
75
 
510
- function useRecords(address, index, kinds = _chunkOIE72R6Jcjs.IDENTITY_KINDS, armoredKey) {
511
- const config = useIdentityKitConfig();
512
- const registry = _chunkOIE72R6Jcjs.getRegistry.call(void 0, config.network, config.registryAddress);
513
- const chain = _chunkOIE72R6Jcjs.chainFor.call(void 0, config.network);
514
- const owner = address;
515
- const enabled = !!owner && index !== void 0 && index !== null;
516
- const contracts = enabled ? kinds.map((kind) => ({ address: registry.address, abi: _chunkOIE72R6Jcjs.REGISTRY_ABI, functionName: "record", args: [owner, BigInt(index), _chunkOIE72R6Jcjs.recordKind.call(void 0, kind)], chainId: chain.id })) : [];
517
- const { data: raw, isLoading: readLoading, refetch } = _wagmi.useReadContracts.call(void 0, { contracts, query: { enabled: contracts.length > 0 } });
518
- const texts = (_nullishCoalesce(raw, () => ( []))).map((r) => r.status === "success" ? _chunkOIE72R6Jcjs.decodeRecord.call(void 0, r.result) : "");
519
- const { data: records, isLoading: parseLoading } = _reactquery.useQuery.call(void 0, {
520
- queryKey: ["records", config.network, registry.address, address, index, kinds.join(","), texts.join(" "), _nullishCoalesce(armoredKey, () => ( ""))],
521
- queryFn: async () => {
522
- const out = [];
523
- for (let i = 0; i < kinds.length; i++) if (texts[i]) out.push(await _chunkOIE72R6Jcjs.parseRecord.call(void 0, kinds[i], texts[i], { armoredKey: _nullishCoalesce(armoredKey, () => ( void 0)) }));
524
- return out;
525
- },
526
- enabled: enabled && raw !== void 0
527
- });
528
- return { records: _nullishCoalesce(records, () => ( [])), isLoading: enabled && (readLoading || parseLoading), refetch: () => {
529
- void refetch();
530
- } };
531
- }
532
76
 
533
77
 
534
78
 
@@ -546,6 +90,7 @@ function useRecords(address, index, kinds = _chunkOIE72R6Jcjs.IDENTITY_KINDS, ar
546
90
 
547
91
 
548
92
 
93
+ var _chunkDJGCYNJNcjs = require('./chunk-DJGCYNJN.cjs');
549
94
 
550
95
 
551
96
 
@@ -602,5 +147,40 @@ function useRecords(address, index, kinds = _chunkOIE72R6Jcjs.IDENTITY_KINDS, ar
602
147
 
603
148
 
604
149
 
605
- exports.ARWEAVE_GATEWAY = _chunkOIE72R6Jcjs.ARWEAVE_GATEWAY; exports.AUTHORIZATION_TYPES = _chunkOIE72R6Jcjs.AUTHORIZATION_TYPES; exports.EIP712_NAME = _chunkOIE72R6Jcjs.EIP712_NAME; exports.EIP712_VERSION = _chunkOIE72R6Jcjs.EIP712_VERSION; exports.ENS_HINT_KEY = _chunkOIE72R6Jcjs.ENS_HINT_KEY; exports.ENS_TEXT_RESOLVER_ABI = _chunkOIE72R6Jcjs.ENS_TEXT_RESOLVER_ABI; exports.FARCASTER_HUB = _chunkOIE72R6Jcjs.FARCASTER_HUB; exports.IDENTITY_ERROR_TEXT = _chunkOIE72R6Jcjs.IDENTITY_ERROR_TEXT; exports.IDENTITY_KINDS = _chunkOIE72R6Jcjs.IDENTITY_KINDS; exports.IPFS_GATEWAY = _chunkOIE72R6Jcjs.IPFS_GATEWAY; exports.IPFS_GATEWAYS = _chunkOIE72R6Jcjs.IPFS_GATEWAYS; exports.IdentityKitProvider = IdentityKitProvider; exports.KNOWN_KINDS = _chunkOIE72R6Jcjs.KNOWN_KINDS; exports.MAX_RECORD_BYTES = _chunkOIE72R6Jcjs.MAX_RECORD_BYTES; exports.NETWORKS = _chunkOIE72R6Jcjs.NETWORKS; exports.NFT_AVATAR_ABI = _chunkOIE72R6Jcjs.NFT_AVATAR_ABI; exports.REGISTRY_ABI = _chunkOIE72R6Jcjs.REGISTRY_ABI; exports.REGISTRY_ADDRESS = _chunkOIE72R6Jcjs.REGISTRY_ADDRESS; exports.ThurinCard = ThurinCard; exports.addPointer = _chunkOIE72R6Jcjs.addPointer; exports.attestTypedData = _chunkOIE72R6Jcjs.attestTypedData; exports.authorizationDigest = _chunkOIE72R6Jcjs.authorizationDigest; exports.avatarFallbacks = _chunkOIE72R6Jcjs.avatarFallbacks; exports.avatarUrl = _chunkOIE72R6Jcjs.avatarUrl; exports.bytesToFingerprint = _chunkOIE72R6Jcjs.bytesToFingerprint; exports.chainFor = _chunkOIE72R6Jcjs.chainFor; exports.decodeRecord = _chunkOIE72R6Jcjs.decodeRecord; exports.displayUrl = _chunkOIE72R6Jcjs.displayUrl; exports.encodeRecord = _chunkOIE72R6Jcjs.encodeRecord; exports.ensHintFor = _chunkOIE72R6Jcjs.ensHintFor; exports.ensHintValue = _chunkOIE72R6Jcjs.ensHintValue; exports.ensHintWrite = _chunkOIE72R6Jcjs.ensHintWrite; exports.fetchEFPGraph = _chunkOIE72R6Jcjs.fetchEFPGraph; exports.fetchEnsHint = _chunkOIE72R6Jcjs.fetchEnsHint; exports.fetchRecords = _chunkOIE72R6Jcjs.fetchRecords; exports.fingerprintHash = _chunkOIE72R6Jcjs.fingerprintHash; exports.fingerprintToBytes = _chunkOIE72R6Jcjs.fingerprintToBytes; exports.getRegistry = _chunkOIE72R6Jcjs.getRegistry; exports.hasEmailUserID = _chunkOIE72R6Jcjs.hasEmailUserID; exports.identifyProof = _chunkOIE72R6Jcjs.identifyProof; exports.identityErrorKind = _chunkOIE72R6Jcjs.identityErrorKind; exports.isNetworkName = _chunkOIE72R6Jcjs.isNetworkName; exports.keyIdOf = _chunkOIE72R6Jcjs.keyIdOf; exports.keyIdToBytes = _chunkOIE72R6Jcjs.keyIdToBytes; exports.kindName = _chunkOIE72R6Jcjs.kindName; exports.needsRpcProbe = _chunkOIE72R6Jcjs.needsRpcProbe; exports.nftAvatarImage = _chunkOIE72R6Jcjs.nftAvatarImage; exports.normalizeFingerprint = _chunkOIE72R6Jcjs.normalizeFingerprint; exports.parseNftAvatar = _chunkOIE72R6Jcjs.parseNftAvatar; exports.parsePgpKey = _chunkOIE72R6Jcjs.parsePgpKey; exports.parsePointer = _chunkOIE72R6Jcjs.parsePointer; exports.parseRecord = _chunkOIE72R6Jcjs.parseRecord; exports.proofHref = _chunkOIE72R6Jcjs.proofHref; exports.proofSecondaryHref = _chunkOIE72R6Jcjs.proofSecondaryHref; exports.reattestTypedData = _chunkOIE72R6Jcjs.reattestTypedData; exports.recordKind = _chunkOIE72R6Jcjs.recordKind; exports.registryDomain = _chunkOIE72R6Jcjs.registryDomain; exports.renderPointer = _chunkOIE72R6Jcjs.renderPointer; exports.revokeTypedData = _chunkOIE72R6Jcjs.revokeTypedData; exports.setRecordTypedData = _chunkOIE72R6Jcjs.setRecordTypedData; exports.stripEmailUserIDs = _chunkOIE72R6Jcjs.stripEmailUserIDs; exports.updateKeyTypedData = _chunkOIE72R6Jcjs.updateKeyTypedData; exports.useAttestations = useAttestations; exports.useEFPGraph = useEFPGraph; exports.useEnsHint = useEnsHint; exports.usePGPProofs = usePGPProofs; exports.useRecords = useRecords; exports.useSafeAvatar = useSafeAvatar; exports.useThurinIdentity = useThurinIdentity; exports.verifyAttestation = _chunkOIE72R6Jcjs.verifyAttestation; exports.verifyClearsigned = _chunkOIE72R6Jcjs.verifyClearsigned; exports.verifyProof = _chunkOIE72R6Jcjs.verifyProof;
606
- //# sourceMappingURL=index.cjs.map
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+ exports.ARWEAVE_GATEWAY = _chunkDJGCYNJNcjs.ARWEAVE_GATEWAY; exports.AUTHORIZATION_TYPES = _chunkDJGCYNJNcjs.AUTHORIZATION_TYPES; exports.CLAIM_CHECK_LABEL = _chunkDJGCYNJNcjs.CLAIM_CHECK_LABEL; exports.CLAIM_LIMIT = _chunkDJGCYNJNcjs.CLAIM_LIMIT; exports.CONTRACT_ERROR_TEXT = _chunkDJGCYNJNcjs.CONTRACT_ERROR_TEXT; exports.EIP712_NAME = _chunkDJGCYNJNcjs.EIP712_NAME; exports.EIP712_VERSION = _chunkDJGCYNJNcjs.EIP712_VERSION; exports.ENS_HINT_KEY = _chunkDJGCYNJNcjs.ENS_HINT_KEY; exports.ENS_TEXT_RESOLVER_ABI = _chunkDJGCYNJNcjs.ENS_TEXT_RESOLVER_ABI; exports.FARCASTER_HUB = _chunkDJGCYNJNcjs.FARCASTER_HUB; exports.IPFS_GATEWAY = _chunkDJGCYNJNcjs.IPFS_GATEWAY; exports.IPFS_GATEWAYS = _chunkDJGCYNJNcjs.IPFS_GATEWAYS; exports.KNOWN_KINDS = _chunkDJGCYNJNcjs.KNOWN_KINDS; exports.MAX_KIND_BYTES = _chunkDJGCYNJNcjs.MAX_KIND_BYTES; exports.MAX_RECORD_BYTES = _chunkDJGCYNJNcjs.MAX_RECORD_BYTES; exports.NETWORKS = _chunkDJGCYNJNcjs.NETWORKS; exports.NFT_AVATAR_ABI = _chunkDJGCYNJNcjs.NFT_AVATAR_ABI; exports.OWNER_REVOKE_REASONS = _chunkDJGCYNJNcjs.OWNER_REVOKE_REASONS; exports.REGISTRY_ABI = _chunkDJGCYNJNcjs.REGISTRY_ABI; exports.REGISTRY_ADDRESS = _chunkDJGCYNJNcjs.REGISTRY_ADDRESS; exports.REVOKE_REASONS = _chunkDJGCYNJNcjs.REVOKE_REASONS; exports.addRelease = _chunkDJGCYNJNcjs.addRelease; exports.attestTypedData = _chunkDJGCYNJNcjs.attestTypedData; exports.authorizationDigest = _chunkDJGCYNJNcjs.authorizationDigest; exports.avatarFallbacks = _chunkDJGCYNJNcjs.avatarFallbacks; exports.avatarUrl = _chunkDJGCYNJNcjs.avatarUrl; exports.bytesToFingerprint = _chunkDJGCYNJNcjs.bytesToFingerprint; exports.chainFor = _chunkDJGCYNJNcjs.chainFor; exports.checkKindName = _chunkDJGCYNJNcjs.checkKindName; exports.checkRecordValue = _chunkDJGCYNJNcjs.checkRecordValue; exports.claimCheckText = _chunkDJGCYNJNcjs.claimCheckText; exports.claimFateText = _chunkDJGCYNJNcjs.claimFateText; exports.claimFates = _chunkDJGCYNJNcjs.claimFates; exports.claimSignature = _chunkDJGCYNJNcjs.claimSignature; exports.contractErrorName = _chunkDJGCYNJNcjs.contractErrorName; exports.contractErrorText = _chunkDJGCYNJNcjs.contractErrorText; exports.displayUrl = _chunkDJGCYNJNcjs.displayUrl; exports.encryptRefusalText = _chunkDJGCYNJNcjs.encryptRefusalText; exports.encryptTo = _chunkDJGCYNJNcjs.encryptTo; exports.encryptionKeyFor = _chunkDJGCYNJNcjs.encryptionKeyFor; exports.ensHintFor = _chunkDJGCYNJNcjs.ensHintFor; exports.ensHintValue = _chunkDJGCYNJNcjs.ensHintValue; exports.ensHintWrite = _chunkDJGCYNJNcjs.ensHintWrite; exports.expiresSoon = _chunkDJGCYNJNcjs.expiresSoon; exports.expiresSoonText = _chunkDJGCYNJNcjs.expiresSoonText; exports.fetchEnsHint = _chunkDJGCYNJNcjs.fetchEnsHint; exports.fetchRecords = _chunkDJGCYNJNcjs.fetchRecords; exports.findOwners = _chunkDJGCYNJNcjs.findOwners; exports.fingerprintHash = _chunkDJGCYNJNcjs.fingerprintHash; exports.fingerprintToBytes = _chunkDJGCYNJNcjs.fingerprintToBytes; exports.formatClaimDate = _chunkDJGCYNJNcjs.formatClaimDate; exports.getRegistry = _chunkDJGCYNJNcjs.getRegistry; exports.hasEmailUserID = _chunkDJGCYNJNcjs.hasEmailUserID; exports.identifyProof = _chunkDJGCYNJNcjs.identifyProof; exports.isNetworkName = _chunkDJGCYNJNcjs.isNetworkName; exports.keyChangedText = _chunkDJGCYNJNcjs.keyChangedText; exports.keyIdOf = _chunkDJGCYNJNcjs.keyIdOf; exports.keyIdToBytes = _chunkDJGCYNJNcjs.keyIdToBytes; exports.keyProblemText = _chunkDJGCYNJNcjs.keyProblemText; exports.keyStanding = _chunkDJGCYNJNcjs.keyStanding; exports.kindName = _chunkDJGCYNJNcjs.kindName; exports.leanKey = _chunkDJGCYNJNcjs.leanKey; exports.markCompromisedTypedData = _chunkDJGCYNJNcjs.markCompromisedTypedData; exports.nftAvatarImage = _chunkDJGCYNJNcjs.nftAvatarImage; exports.normalizeFingerprint = _chunkDJGCYNJNcjs.normalizeFingerprint; exports.pageRecords = _chunkDJGCYNJNcjs.pageRecords; exports.parseNftAvatar = _chunkDJGCYNJNcjs.parseNftAvatar; exports.parsePgpKey = _chunkDJGCYNJNcjs.parsePgpKey; exports.parseRecord = _chunkDJGCYNJNcjs.parseRecord; exports.parseReleases = _chunkDJGCYNJNcjs.parseReleases; exports.payloadText = _chunkDJGCYNJNcjs.payloadText; exports.pickRecords = _chunkDJGCYNJNcjs.pickRecords; exports.proofHref = _chunkDJGCYNJNcjs.proofHref; exports.proofSecondaryHref = _chunkDJGCYNJNcjs.proofSecondaryHref; exports.readClaims = _chunkDJGCYNJNcjs.readClaims; exports.reattestTypedData = _chunkDJGCYNJNcjs.reattestTypedData; exports.recordKind = _chunkDJGCYNJNcjs.recordKind; exports.registryDomain = _chunkDJGCYNJNcjs.registryDomain; exports.renderReleases = _chunkDJGCYNJNcjs.renderReleases; exports.revokeTypedData = _chunkDJGCYNJNcjs.revokeTypedData; exports.sameFingerprint = _chunkDJGCYNJNcjs.sameFingerprint; exports.setRecordTypedData = _chunkDJGCYNJNcjs.setRecordTypedData; exports.signatureEmail = _chunkDJGCYNJNcjs.signatureEmail; exports.sshKeys = _chunkDJGCYNJNcjs.sshKeys; exports.statementText = _chunkDJGCYNJNcjs.statementText; exports.stripEmailUserIDs = _chunkDJGCYNJNcjs.stripEmailUserIDs; exports.updateKeyTypedData = _chunkDJGCYNJNcjs.updateKeyTypedData; exports.verifyAttestation = _chunkDJGCYNJNcjs.verifyAttestation; exports.verifyClearsigned = _chunkDJGCYNJNcjs.verifyClearsigned; exports.verifyProof = _chunkDJGCYNJNcjs.verifyProof; exports.verifyStatementSignature = _chunkDJGCYNJNcjs.verifyStatementSignature;
package/dist/index.d.cts CHANGED
@@ -1,84 +1,2 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ReactNode } from 'react';
3
- import { IdentityKitConfig, Theme, ThurinIdentity, Attestation, EFPGraph, PGPKeyInfo, ProofResult, EnsHint, ParsedRecord } from './core.cjs';
4
- export { ARWEAVE_GATEWAY, AUTHORIZATION_TYPES, AttestAuthorization, AuthorizationAction, EIP712_NAME, EIP712_VERSION, ENS_HINT_KEY, ENS_TEXT_RESOLVER_ABI, EnsHintState, EnsTextReader, FARCASTER_HUB, IDENTITY_ERROR_TEXT, IDENTITY_KINDS, IPFS_GATEWAY, IPFS_GATEWAYS, IdentityErrorKind, IdentityLookupState, KNOWN_KINDS, KnownKind, MAX_RECORD_BYTES, NETWORKS, NFT_AVATAR_ABI, NetworkName, NftAvatar, Notation, PGPVerification, PointerEntry, PointerRecord, Proof, ProofOptions, REGISTRY_ABI, REGISTRY_ADDRESS, ReattestAuthorization, RecordData, RecordReader, RegistryDeployment, RevokeAuthorization, SetRecordAuthorization, StrippedKey, SubkeyInfo, UpdateKeyAuthorization, addPointer, attestTypedData, authorizationDigest, avatarFallbacks, avatarUrl, bytesToFingerprint, chainFor, decodeRecord, displayUrl, encodeRecord, ensHintFor, ensHintValue, ensHintWrite, fetchEFPGraph, fetchEnsHint, fetchRecords, fingerprintHash, fingerprintToBytes, getRegistry, hasEmailUserID, identifyProof, identityErrorKind, isNetworkName, keyIdOf, keyIdToBytes, kindName, needsRpcProbe, nftAvatarImage, normalizeFingerprint, parseNftAvatar, parsePgpKey, parsePointer, parseRecord, proofHref, proofSecondaryHref, reattestTypedData, recordKind, registryDomain, renderPointer, revokeTypedData, setRecordTypedData, stripEmailUserIDs, updateKeyTypedData, verifyAttestation, verifyClearsigned, verifyProof } from './core.cjs';
1
+ export { ARWEAVE_GATEWAY, AUTHORIZATION_TYPES, AttestAuthorization, Attestation, AuthorizationAction, CLAIM_CHECK_LABEL, CLAIM_LIMIT, CONTRACT_ERROR_TEXT, ClaimCheckKind, ClaimCheckText, ClaimFate, ClaimReader, EIP712_NAME, EIP712_VERSION, ENS_HINT_KEY, ENS_TEXT_RESOLVER_ABI, EncryptRefusal, EncryptionKey, EncryptionKeyResult, EnsHint, EnsHintState, EnsTextReader, FARCASTER_HUB, IPFS_GATEWAY, IPFS_GATEWAYS, KNOWN_KINDS, KeyStanding, KnownKind, LeanKey, MAX_KIND_BYTES, MAX_RECORD_BYTES, MarkCompromisedAuthorization, NETWORKS, NFT_AVATAR_ABI, NetworkName, NftAvatar, Notation, OWNER_REVOKE_REASONS, PGPKeyInfo, PGPVerification, ParsedRecord, PgpInput, Proof, ProofOptions, REGISTRY_ABI, REGISTRY_ADDRESS, REVOKE_REASONS, ReattestAuthorization, RecordData, RecordReader, RegistryDeployment, ReleaseEntry, ReleasesRecord, RevokeAuthorization, RevokeReason, SetRecordAuthorization, SshKey, StrippedKey, SubkeyInfo, UpdateKeyAuthorization, addRelease, attestTypedData, authorizationDigest, avatarFallbacks, avatarUrl, bytesToFingerprint, chainFor, checkKindName, checkRecordValue, claimCheckText, claimFateText, claimFates, claimSignature, contractErrorName, contractErrorText, displayUrl, encryptRefusalText, encryptTo, encryptionKeyFor, ensHintFor, ensHintValue, ensHintWrite, expiresSoon, expiresSoonText, fetchEnsHint, fetchRecords, findOwners, fingerprintHash, fingerprintToBytes, formatClaimDate, getRegistry, hasEmailUserID, identifyProof, isNetworkName, keyChangedText, keyIdOf, keyIdToBytes, keyProblemText, keyStanding, kindName, leanKey, markCompromisedTypedData, nftAvatarImage, normalizeFingerprint, pageRecords, parseNftAvatar, parsePgpKey, parseRecord, parseReleases, payloadText, pickRecords, proofHref, proofSecondaryHref, readClaims, reattestTypedData, recordKind, registryDomain, renderReleases, revokeTypedData, sameFingerprint, setRecordTypedData, signatureEmail, sshKeys, statementText, stripEmailUserIDs, updateKeyTypedData, verifyAttestation, verifyClearsigned, verifyProof, verifyStatementSignature } from './core.cjs';
5
2
  import 'viem';
6
-
7
- interface IdentityKitProviderProps extends IdentityKitConfig {
8
- children: ReactNode;
9
- }
10
- declare function IdentityKitProvider({ children, rpcUrl, neynarApiKey, farcasterHub, baseUrl, network, registryAddress, }: IdentityKitProviderProps): react_jsx_runtime.JSX.Element;
11
-
12
- interface ThurinCardProps {
13
- ens?: string;
14
- address?: string;
15
- theme?: Theme;
16
- }
17
- declare function ThurinCard({ ens, address, theme }: ThurinCardProps): react_jsx_runtime.JSX.Element;
18
-
19
- declare function useThurinIdentity(ensOrAddress: string | undefined | null): ThurinIdentity;
20
-
21
- /**
22
- * On-chain attestations for an address, read straight from the v2 registry:
23
- * `attestationsOf` for the history, `getPayload` for each stored signature + key.
24
- * No event logs, so any RPC works. Each claim is verified off-chain.
25
- */
26
- declare function useAttestations(address: string | undefined | null): {
27
- claims: Attestation[];
28
- totalClaims: number;
29
- activeClaims: number;
30
- currentFingerprint: string | null;
31
- isLoading: boolean;
32
- /** A registry read failed (the RPC may be down; useThurinIdentity finds out which). */
33
- error: Error | null;
34
- refetch: () => void;
35
- };
36
-
37
- declare function useEFPGraph(address: string | undefined | null): {
38
- efp: EFPGraph | null;
39
- isLoading: boolean;
40
- };
41
-
42
- /**
43
- * Proofs for an identity, read from the PGP key stored in its on-chain
44
- * attestation. No keyserver is consulted: keys.openpgp.org only serves user
45
- * IDs whose email is verified and drops non-email user IDs entirely, so it can
46
- * never carry the published (non-email) identity that holds the notations.
47
- *
48
- * @param fingerprint the attested fingerprint (proofs must name it)
49
- * @param armoredKey the attestation's `pgpPublicKey`
50
- */
51
- declare function usePGPProofs(fingerprint: string | undefined | null, armoredKey: string | undefined | null): {
52
- keyInfo: PGPKeyInfo | null;
53
- proofs: ProofResult[];
54
- isLoading: boolean;
55
- };
56
-
57
- /**
58
- * A name's `id.thurin` record against the fingerprint the registry verifies for its
59
- * address. `state` is `match`, `unset`, or `mismatch`; the last one is the signal worth
60
- * showing — a name advertising a key its address has not claimed.
61
- */
62
- declare function useEnsHint(name: string | undefined | null, verifiedFingerprint: string | null | undefined): EnsHint & {
63
- isLoading: boolean;
64
- refetch: () => void;
65
- };
66
-
67
- /**
68
- * The records on one claim, for the kinds given (default: the kinds an identity page shows),
69
- * read in one multicall and parsed. Kinds with no record are left out.
70
- */
71
- declare function useRecords(address: string | undefined | null, index: number | undefined | null, kinds?: readonly string[], armoredKey?: string | null): {
72
- records: ParsedRecord[];
73
- isLoading: boolean;
74
- refetch: () => void;
75
- };
76
-
77
- /**
78
- * The avatar to show for a normalized ENS name, or null. Reads the raw `avatar` record and
79
- * loads only what `avatarUrl` allows (see core/avatar.ts); wagmi's useEnsAvatar would fetch
80
- * whatever host the name's owner chose.
81
- */
82
- declare function useSafeAvatar(name: string | undefined, chainId: number): string | null;
83
-
84
- export { Attestation, EFPGraph, EnsHint, IdentityKitConfig, IdentityKitProvider, type IdentityKitProviderProps, PGPKeyInfo, ParsedRecord, ProofResult, Theme, ThurinCard, type ThurinCardProps, ThurinIdentity, useAttestations, useEFPGraph, useEnsHint, usePGPProofs, useRecords, useSafeAvatar, useThurinIdentity };