@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/README.md +44 -359
- package/dist/{chunk-ROQWHCHP.js → chunk-AAJWERE2.js} +2275 -1005
- package/dist/chunk-DJGCYNJN.cjs +3377 -0
- package/dist/core.cjs +58 -3
- package/dist/core.d.cts +1615 -892
- package/dist/core.d.ts +1615 -892
- package/dist/core.js +79 -24
- package/dist/index.cjs +39 -459
- package/dist/index.d.cts +1 -83
- package/dist/index.d.ts +1 -83
- package/dist/index.js +79 -499
- package/package.json +5 -22
- package/dist/chunk-OIE72R6J.cjs +0 -2107
- package/dist/chunk-OIE72R6J.cjs.map +0 -1
- package/dist/chunk-ROQWHCHP.js.map +0 -1
- package/dist/core.cjs.map +0 -1
- package/dist/core.js.map +0 -1
- package/dist/embed.global.js +0 -32151
- package/dist/embed.global.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.css +0 -185
- package/dist/index.css.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/chunk-OIE72R6J.cjs
DELETED
|
@@ -1,2107 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } 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; }// src/core/abi.ts
|
|
2
|
-
var REGISTRY_ABI = [
|
|
3
|
-
{
|
|
4
|
-
"type": "function",
|
|
5
|
-
"name": "ATTEST_TYPEHASH",
|
|
6
|
-
"inputs": [],
|
|
7
|
-
"outputs": [
|
|
8
|
-
{
|
|
9
|
-
"name": "",
|
|
10
|
-
"type": "bytes32",
|
|
11
|
-
"internalType": "bytes32"
|
|
12
|
-
}
|
|
13
|
-
],
|
|
14
|
-
"stateMutability": "view"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"type": "function",
|
|
18
|
-
"name": "DOMAIN_SEPARATOR",
|
|
19
|
-
"inputs": [],
|
|
20
|
-
"outputs": [
|
|
21
|
-
{
|
|
22
|
-
"name": "",
|
|
23
|
-
"type": "bytes32",
|
|
24
|
-
"internalType": "bytes32"
|
|
25
|
-
}
|
|
26
|
-
],
|
|
27
|
-
"stateMutability": "view"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"type": "function",
|
|
31
|
-
"name": "EIP712_NAME",
|
|
32
|
-
"inputs": [],
|
|
33
|
-
"outputs": [
|
|
34
|
-
{
|
|
35
|
-
"name": "",
|
|
36
|
-
"type": "string",
|
|
37
|
-
"internalType": "string"
|
|
38
|
-
}
|
|
39
|
-
],
|
|
40
|
-
"stateMutability": "view"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"type": "function",
|
|
44
|
-
"name": "EIP712_VERSION",
|
|
45
|
-
"inputs": [],
|
|
46
|
-
"outputs": [
|
|
47
|
-
{
|
|
48
|
-
"name": "",
|
|
49
|
-
"type": "string",
|
|
50
|
-
"internalType": "string"
|
|
51
|
-
}
|
|
52
|
-
],
|
|
53
|
-
"stateMutability": "view"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"type": "function",
|
|
57
|
-
"name": "MAX_KEY_BYTES",
|
|
58
|
-
"inputs": [],
|
|
59
|
-
"outputs": [
|
|
60
|
-
{
|
|
61
|
-
"name": "",
|
|
62
|
-
"type": "uint256",
|
|
63
|
-
"internalType": "uint256"
|
|
64
|
-
}
|
|
65
|
-
],
|
|
66
|
-
"stateMutability": "view"
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
"type": "function",
|
|
70
|
-
"name": "MAX_RECORD_BYTES",
|
|
71
|
-
"inputs": [],
|
|
72
|
-
"outputs": [
|
|
73
|
-
{
|
|
74
|
-
"name": "",
|
|
75
|
-
"type": "uint256",
|
|
76
|
-
"internalType": "uint256"
|
|
77
|
-
}
|
|
78
|
-
],
|
|
79
|
-
"stateMutability": "view"
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
"type": "function",
|
|
83
|
-
"name": "MAX_SIG_BYTES",
|
|
84
|
-
"inputs": [],
|
|
85
|
-
"outputs": [
|
|
86
|
-
{
|
|
87
|
-
"name": "",
|
|
88
|
-
"type": "uint256",
|
|
89
|
-
"internalType": "uint256"
|
|
90
|
-
}
|
|
91
|
-
],
|
|
92
|
-
"stateMutability": "view"
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
"type": "function",
|
|
96
|
-
"name": "MESSAGE_VERSION",
|
|
97
|
-
"inputs": [],
|
|
98
|
-
"outputs": [
|
|
99
|
-
{
|
|
100
|
-
"name": "",
|
|
101
|
-
"type": "uint8",
|
|
102
|
-
"internalType": "uint8"
|
|
103
|
-
}
|
|
104
|
-
],
|
|
105
|
-
"stateMutability": "view"
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
"type": "function",
|
|
109
|
-
"name": "REATTEST_TYPEHASH",
|
|
110
|
-
"inputs": [],
|
|
111
|
-
"outputs": [
|
|
112
|
-
{
|
|
113
|
-
"name": "",
|
|
114
|
-
"type": "bytes32",
|
|
115
|
-
"internalType": "bytes32"
|
|
116
|
-
}
|
|
117
|
-
],
|
|
118
|
-
"stateMutability": "view"
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
"type": "function",
|
|
122
|
-
"name": "REVOKE_TYPEHASH",
|
|
123
|
-
"inputs": [],
|
|
124
|
-
"outputs": [
|
|
125
|
-
{
|
|
126
|
-
"name": "",
|
|
127
|
-
"type": "bytes32",
|
|
128
|
-
"internalType": "bytes32"
|
|
129
|
-
}
|
|
130
|
-
],
|
|
131
|
-
"stateMutability": "view"
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
"type": "function",
|
|
135
|
-
"name": "SET_RECORD_TYPEHASH",
|
|
136
|
-
"inputs": [],
|
|
137
|
-
"outputs": [
|
|
138
|
-
{
|
|
139
|
-
"name": "",
|
|
140
|
-
"type": "bytes32",
|
|
141
|
-
"internalType": "bytes32"
|
|
142
|
-
}
|
|
143
|
-
],
|
|
144
|
-
"stateMutability": "view"
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
"type": "function",
|
|
148
|
-
"name": "UPDATE_KEY_TYPEHASH",
|
|
149
|
-
"inputs": [],
|
|
150
|
-
"outputs": [
|
|
151
|
-
{
|
|
152
|
-
"name": "",
|
|
153
|
-
"type": "bytes32",
|
|
154
|
-
"internalType": "bytes32"
|
|
155
|
-
}
|
|
156
|
-
],
|
|
157
|
-
"stateMutability": "view"
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
"type": "function",
|
|
161
|
-
"name": "VERSION",
|
|
162
|
-
"inputs": [],
|
|
163
|
-
"outputs": [
|
|
164
|
-
{
|
|
165
|
-
"name": "",
|
|
166
|
-
"type": "uint8",
|
|
167
|
-
"internalType": "uint8"
|
|
168
|
-
}
|
|
169
|
-
],
|
|
170
|
-
"stateMutability": "view"
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
"type": "function",
|
|
174
|
-
"name": "addressesFor",
|
|
175
|
-
"inputs": [
|
|
176
|
-
{
|
|
177
|
-
"name": "fingerprintHash",
|
|
178
|
-
"type": "bytes32",
|
|
179
|
-
"internalType": "bytes32"
|
|
180
|
-
}
|
|
181
|
-
],
|
|
182
|
-
"outputs": [
|
|
183
|
-
{
|
|
184
|
-
"name": "",
|
|
185
|
-
"type": "address[]",
|
|
186
|
-
"internalType": "address[]"
|
|
187
|
-
}
|
|
188
|
-
],
|
|
189
|
-
"stateMutability": "view"
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
"type": "function",
|
|
193
|
-
"name": "addressesForCount",
|
|
194
|
-
"inputs": [
|
|
195
|
-
{
|
|
196
|
-
"name": "fingerprintHash",
|
|
197
|
-
"type": "bytes32",
|
|
198
|
-
"internalType": "bytes32"
|
|
199
|
-
}
|
|
200
|
-
],
|
|
201
|
-
"outputs": [
|
|
202
|
-
{
|
|
203
|
-
"name": "",
|
|
204
|
-
"type": "uint256",
|
|
205
|
-
"internalType": "uint256"
|
|
206
|
-
}
|
|
207
|
-
],
|
|
208
|
-
"stateMutability": "view"
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
"type": "function",
|
|
212
|
-
"name": "addressesForRange",
|
|
213
|
-
"inputs": [
|
|
214
|
-
{
|
|
215
|
-
"name": "fingerprintHash",
|
|
216
|
-
"type": "bytes32",
|
|
217
|
-
"internalType": "bytes32"
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
"name": "start",
|
|
221
|
-
"type": "uint256",
|
|
222
|
-
"internalType": "uint256"
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
"name": "count",
|
|
226
|
-
"type": "uint256",
|
|
227
|
-
"internalType": "uint256"
|
|
228
|
-
}
|
|
229
|
-
],
|
|
230
|
-
"outputs": [
|
|
231
|
-
{
|
|
232
|
-
"name": "out",
|
|
233
|
-
"type": "address[]",
|
|
234
|
-
"internalType": "address[]"
|
|
235
|
-
}
|
|
236
|
-
],
|
|
237
|
-
"stateMutability": "view"
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
"type": "function",
|
|
241
|
-
"name": "attest",
|
|
242
|
-
"inputs": [
|
|
243
|
-
{
|
|
244
|
-
"name": "fingerprint",
|
|
245
|
-
"type": "bytes",
|
|
246
|
-
"internalType": "bytes"
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
"name": "pgpSignature",
|
|
250
|
-
"type": "bytes",
|
|
251
|
-
"internalType": "bytes"
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
"name": "pgpPublicKey",
|
|
255
|
-
"type": "bytes",
|
|
256
|
-
"internalType": "bytes"
|
|
257
|
-
}
|
|
258
|
-
],
|
|
259
|
-
"outputs": [
|
|
260
|
-
{
|
|
261
|
-
"name": "index",
|
|
262
|
-
"type": "uint256",
|
|
263
|
-
"internalType": "uint256"
|
|
264
|
-
}
|
|
265
|
-
],
|
|
266
|
-
"stateMutability": "nonpayable"
|
|
267
|
-
},
|
|
268
|
-
{
|
|
269
|
-
"type": "function",
|
|
270
|
-
"name": "attestFor",
|
|
271
|
-
"inputs": [
|
|
272
|
-
{
|
|
273
|
-
"name": "owner",
|
|
274
|
-
"type": "address",
|
|
275
|
-
"internalType": "address"
|
|
276
|
-
},
|
|
277
|
-
{
|
|
278
|
-
"name": "fingerprint",
|
|
279
|
-
"type": "bytes",
|
|
280
|
-
"internalType": "bytes"
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
"name": "pgpSignature",
|
|
284
|
-
"type": "bytes",
|
|
285
|
-
"internalType": "bytes"
|
|
286
|
-
},
|
|
287
|
-
{
|
|
288
|
-
"name": "pgpPublicKey",
|
|
289
|
-
"type": "bytes",
|
|
290
|
-
"internalType": "bytes"
|
|
291
|
-
},
|
|
292
|
-
{
|
|
293
|
-
"name": "deadline",
|
|
294
|
-
"type": "uint256",
|
|
295
|
-
"internalType": "uint256"
|
|
296
|
-
},
|
|
297
|
-
{
|
|
298
|
-
"name": "signature",
|
|
299
|
-
"type": "bytes",
|
|
300
|
-
"internalType": "bytes"
|
|
301
|
-
}
|
|
302
|
-
],
|
|
303
|
-
"outputs": [
|
|
304
|
-
{
|
|
305
|
-
"name": "index",
|
|
306
|
-
"type": "uint256",
|
|
307
|
-
"internalType": "uint256"
|
|
308
|
-
}
|
|
309
|
-
],
|
|
310
|
-
"stateMutability": "nonpayable"
|
|
311
|
-
},
|
|
312
|
-
{
|
|
313
|
-
"type": "function",
|
|
314
|
-
"name": "attestationCount",
|
|
315
|
-
"inputs": [
|
|
316
|
-
{
|
|
317
|
-
"name": "owner",
|
|
318
|
-
"type": "address",
|
|
319
|
-
"internalType": "address"
|
|
320
|
-
}
|
|
321
|
-
],
|
|
322
|
-
"outputs": [
|
|
323
|
-
{
|
|
324
|
-
"name": "",
|
|
325
|
-
"type": "uint256",
|
|
326
|
-
"internalType": "uint256"
|
|
327
|
-
}
|
|
328
|
-
],
|
|
329
|
-
"stateMutability": "view"
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
"type": "function",
|
|
333
|
-
"name": "attestationsOf",
|
|
334
|
-
"inputs": [
|
|
335
|
-
{
|
|
336
|
-
"name": "owner",
|
|
337
|
-
"type": "address",
|
|
338
|
-
"internalType": "address"
|
|
339
|
-
}
|
|
340
|
-
],
|
|
341
|
-
"outputs": [
|
|
342
|
-
{
|
|
343
|
-
"name": "",
|
|
344
|
-
"type": "tuple[]",
|
|
345
|
-
"internalType": "struct PGPRegistry.Attestation[]",
|
|
346
|
-
"components": [
|
|
347
|
-
{
|
|
348
|
-
"name": "fingerprint",
|
|
349
|
-
"type": "bytes",
|
|
350
|
-
"internalType": "bytes"
|
|
351
|
-
},
|
|
352
|
-
{
|
|
353
|
-
"name": "createdAt",
|
|
354
|
-
"type": "uint64",
|
|
355
|
-
"internalType": "uint64"
|
|
356
|
-
},
|
|
357
|
-
{
|
|
358
|
-
"name": "revokedAt",
|
|
359
|
-
"type": "uint64",
|
|
360
|
-
"internalType": "uint64"
|
|
361
|
-
},
|
|
362
|
-
{
|
|
363
|
-
"name": "messageVersion",
|
|
364
|
-
"type": "uint8",
|
|
365
|
-
"internalType": "uint8"
|
|
366
|
-
},
|
|
367
|
-
{
|
|
368
|
-
"name": "keyPtr",
|
|
369
|
-
"type": "address",
|
|
370
|
-
"internalType": "address"
|
|
371
|
-
},
|
|
372
|
-
{
|
|
373
|
-
"name": "sigPtr",
|
|
374
|
-
"type": "address",
|
|
375
|
-
"internalType": "address"
|
|
376
|
-
}
|
|
377
|
-
]
|
|
378
|
-
}
|
|
379
|
-
],
|
|
380
|
-
"stateMutability": "view"
|
|
381
|
-
},
|
|
382
|
-
{
|
|
383
|
-
"type": "function",
|
|
384
|
-
"name": "attestationsOfRange",
|
|
385
|
-
"inputs": [
|
|
386
|
-
{
|
|
387
|
-
"name": "owner",
|
|
388
|
-
"type": "address",
|
|
389
|
-
"internalType": "address"
|
|
390
|
-
},
|
|
391
|
-
{
|
|
392
|
-
"name": "start",
|
|
393
|
-
"type": "uint256",
|
|
394
|
-
"internalType": "uint256"
|
|
395
|
-
},
|
|
396
|
-
{
|
|
397
|
-
"name": "count",
|
|
398
|
-
"type": "uint256",
|
|
399
|
-
"internalType": "uint256"
|
|
400
|
-
}
|
|
401
|
-
],
|
|
402
|
-
"outputs": [
|
|
403
|
-
{
|
|
404
|
-
"name": "out",
|
|
405
|
-
"type": "tuple[]",
|
|
406
|
-
"internalType": "struct PGPRegistry.Attestation[]",
|
|
407
|
-
"components": [
|
|
408
|
-
{
|
|
409
|
-
"name": "fingerprint",
|
|
410
|
-
"type": "bytes",
|
|
411
|
-
"internalType": "bytes"
|
|
412
|
-
},
|
|
413
|
-
{
|
|
414
|
-
"name": "createdAt",
|
|
415
|
-
"type": "uint64",
|
|
416
|
-
"internalType": "uint64"
|
|
417
|
-
},
|
|
418
|
-
{
|
|
419
|
-
"name": "revokedAt",
|
|
420
|
-
"type": "uint64",
|
|
421
|
-
"internalType": "uint64"
|
|
422
|
-
},
|
|
423
|
-
{
|
|
424
|
-
"name": "messageVersion",
|
|
425
|
-
"type": "uint8",
|
|
426
|
-
"internalType": "uint8"
|
|
427
|
-
},
|
|
428
|
-
{
|
|
429
|
-
"name": "keyPtr",
|
|
430
|
-
"type": "address",
|
|
431
|
-
"internalType": "address"
|
|
432
|
-
},
|
|
433
|
-
{
|
|
434
|
-
"name": "sigPtr",
|
|
435
|
-
"type": "address",
|
|
436
|
-
"internalType": "address"
|
|
437
|
-
}
|
|
438
|
-
]
|
|
439
|
-
}
|
|
440
|
-
],
|
|
441
|
-
"stateMutability": "view"
|
|
442
|
-
},
|
|
443
|
-
{
|
|
444
|
-
"type": "function",
|
|
445
|
-
"name": "cancelAuthorization",
|
|
446
|
-
"inputs": [],
|
|
447
|
-
"outputs": [],
|
|
448
|
-
"stateMutability": "nonpayable"
|
|
449
|
-
},
|
|
450
|
-
{
|
|
451
|
-
"type": "function",
|
|
452
|
-
"name": "current",
|
|
453
|
-
"inputs": [
|
|
454
|
-
{
|
|
455
|
-
"name": "owner",
|
|
456
|
-
"type": "address",
|
|
457
|
-
"internalType": "address"
|
|
458
|
-
}
|
|
459
|
-
],
|
|
460
|
-
"outputs": [
|
|
461
|
-
{
|
|
462
|
-
"name": "found",
|
|
463
|
-
"type": "bool",
|
|
464
|
-
"internalType": "bool"
|
|
465
|
-
},
|
|
466
|
-
{
|
|
467
|
-
"name": "index",
|
|
468
|
-
"type": "uint256",
|
|
469
|
-
"internalType": "uint256"
|
|
470
|
-
},
|
|
471
|
-
{
|
|
472
|
-
"name": "attestation",
|
|
473
|
-
"type": "tuple",
|
|
474
|
-
"internalType": "struct PGPRegistry.Attestation",
|
|
475
|
-
"components": [
|
|
476
|
-
{
|
|
477
|
-
"name": "fingerprint",
|
|
478
|
-
"type": "bytes",
|
|
479
|
-
"internalType": "bytes"
|
|
480
|
-
},
|
|
481
|
-
{
|
|
482
|
-
"name": "createdAt",
|
|
483
|
-
"type": "uint64",
|
|
484
|
-
"internalType": "uint64"
|
|
485
|
-
},
|
|
486
|
-
{
|
|
487
|
-
"name": "revokedAt",
|
|
488
|
-
"type": "uint64",
|
|
489
|
-
"internalType": "uint64"
|
|
490
|
-
},
|
|
491
|
-
{
|
|
492
|
-
"name": "messageVersion",
|
|
493
|
-
"type": "uint8",
|
|
494
|
-
"internalType": "uint8"
|
|
495
|
-
},
|
|
496
|
-
{
|
|
497
|
-
"name": "keyPtr",
|
|
498
|
-
"type": "address",
|
|
499
|
-
"internalType": "address"
|
|
500
|
-
},
|
|
501
|
-
{
|
|
502
|
-
"name": "sigPtr",
|
|
503
|
-
"type": "address",
|
|
504
|
-
"internalType": "address"
|
|
505
|
-
}
|
|
506
|
-
]
|
|
507
|
-
}
|
|
508
|
-
],
|
|
509
|
-
"stateMutability": "view"
|
|
510
|
-
},
|
|
511
|
-
{
|
|
512
|
-
"type": "function",
|
|
513
|
-
"name": "fingerprintsForKeyId",
|
|
514
|
-
"inputs": [
|
|
515
|
-
{
|
|
516
|
-
"name": "keyId",
|
|
517
|
-
"type": "bytes8",
|
|
518
|
-
"internalType": "bytes8"
|
|
519
|
-
}
|
|
520
|
-
],
|
|
521
|
-
"outputs": [
|
|
522
|
-
{
|
|
523
|
-
"name": "",
|
|
524
|
-
"type": "bytes[]",
|
|
525
|
-
"internalType": "bytes[]"
|
|
526
|
-
}
|
|
527
|
-
],
|
|
528
|
-
"stateMutability": "view"
|
|
529
|
-
},
|
|
530
|
-
{
|
|
531
|
-
"type": "function",
|
|
532
|
-
"name": "fingerprintsForKeyIdCount",
|
|
533
|
-
"inputs": [
|
|
534
|
-
{
|
|
535
|
-
"name": "keyId",
|
|
536
|
-
"type": "bytes8",
|
|
537
|
-
"internalType": "bytes8"
|
|
538
|
-
}
|
|
539
|
-
],
|
|
540
|
-
"outputs": [
|
|
541
|
-
{
|
|
542
|
-
"name": "",
|
|
543
|
-
"type": "uint256",
|
|
544
|
-
"internalType": "uint256"
|
|
545
|
-
}
|
|
546
|
-
],
|
|
547
|
-
"stateMutability": "view"
|
|
548
|
-
},
|
|
549
|
-
{
|
|
550
|
-
"type": "function",
|
|
551
|
-
"name": "fingerprintsForKeyIdRange",
|
|
552
|
-
"inputs": [
|
|
553
|
-
{
|
|
554
|
-
"name": "keyId",
|
|
555
|
-
"type": "bytes8",
|
|
556
|
-
"internalType": "bytes8"
|
|
557
|
-
},
|
|
558
|
-
{
|
|
559
|
-
"name": "start",
|
|
560
|
-
"type": "uint256",
|
|
561
|
-
"internalType": "uint256"
|
|
562
|
-
},
|
|
563
|
-
{
|
|
564
|
-
"name": "count",
|
|
565
|
-
"type": "uint256",
|
|
566
|
-
"internalType": "uint256"
|
|
567
|
-
}
|
|
568
|
-
],
|
|
569
|
-
"outputs": [
|
|
570
|
-
{
|
|
571
|
-
"name": "out",
|
|
572
|
-
"type": "bytes[]",
|
|
573
|
-
"internalType": "bytes[]"
|
|
574
|
-
}
|
|
575
|
-
],
|
|
576
|
-
"stateMutability": "view"
|
|
577
|
-
},
|
|
578
|
-
{
|
|
579
|
-
"type": "function",
|
|
580
|
-
"name": "getAttestation",
|
|
581
|
-
"inputs": [
|
|
582
|
-
{
|
|
583
|
-
"name": "owner",
|
|
584
|
-
"type": "address",
|
|
585
|
-
"internalType": "address"
|
|
586
|
-
},
|
|
587
|
-
{
|
|
588
|
-
"name": "index",
|
|
589
|
-
"type": "uint256",
|
|
590
|
-
"internalType": "uint256"
|
|
591
|
-
}
|
|
592
|
-
],
|
|
593
|
-
"outputs": [
|
|
594
|
-
{
|
|
595
|
-
"name": "",
|
|
596
|
-
"type": "tuple",
|
|
597
|
-
"internalType": "struct PGPRegistry.Attestation",
|
|
598
|
-
"components": [
|
|
599
|
-
{
|
|
600
|
-
"name": "fingerprint",
|
|
601
|
-
"type": "bytes",
|
|
602
|
-
"internalType": "bytes"
|
|
603
|
-
},
|
|
604
|
-
{
|
|
605
|
-
"name": "createdAt",
|
|
606
|
-
"type": "uint64",
|
|
607
|
-
"internalType": "uint64"
|
|
608
|
-
},
|
|
609
|
-
{
|
|
610
|
-
"name": "revokedAt",
|
|
611
|
-
"type": "uint64",
|
|
612
|
-
"internalType": "uint64"
|
|
613
|
-
},
|
|
614
|
-
{
|
|
615
|
-
"name": "messageVersion",
|
|
616
|
-
"type": "uint8",
|
|
617
|
-
"internalType": "uint8"
|
|
618
|
-
},
|
|
619
|
-
{
|
|
620
|
-
"name": "keyPtr",
|
|
621
|
-
"type": "address",
|
|
622
|
-
"internalType": "address"
|
|
623
|
-
},
|
|
624
|
-
{
|
|
625
|
-
"name": "sigPtr",
|
|
626
|
-
"type": "address",
|
|
627
|
-
"internalType": "address"
|
|
628
|
-
}
|
|
629
|
-
]
|
|
630
|
-
}
|
|
631
|
-
],
|
|
632
|
-
"stateMutability": "view"
|
|
633
|
-
},
|
|
634
|
-
{
|
|
635
|
-
"type": "function",
|
|
636
|
-
"name": "getPayload",
|
|
637
|
-
"inputs": [
|
|
638
|
-
{
|
|
639
|
-
"name": "owner",
|
|
640
|
-
"type": "address",
|
|
641
|
-
"internalType": "address"
|
|
642
|
-
},
|
|
643
|
-
{
|
|
644
|
-
"name": "index",
|
|
645
|
-
"type": "uint256",
|
|
646
|
-
"internalType": "uint256"
|
|
647
|
-
}
|
|
648
|
-
],
|
|
649
|
-
"outputs": [
|
|
650
|
-
{
|
|
651
|
-
"name": "pgpSignature",
|
|
652
|
-
"type": "bytes",
|
|
653
|
-
"internalType": "bytes"
|
|
654
|
-
},
|
|
655
|
-
{
|
|
656
|
-
"name": "pgpPublicKey",
|
|
657
|
-
"type": "bytes",
|
|
658
|
-
"internalType": "bytes"
|
|
659
|
-
}
|
|
660
|
-
],
|
|
661
|
-
"stateMutability": "view"
|
|
662
|
-
},
|
|
663
|
-
{
|
|
664
|
-
"type": "function",
|
|
665
|
-
"name": "nonces",
|
|
666
|
-
"inputs": [
|
|
667
|
-
{
|
|
668
|
-
"name": "",
|
|
669
|
-
"type": "address",
|
|
670
|
-
"internalType": "address"
|
|
671
|
-
}
|
|
672
|
-
],
|
|
673
|
-
"outputs": [
|
|
674
|
-
{
|
|
675
|
-
"name": "",
|
|
676
|
-
"type": "uint256",
|
|
677
|
-
"internalType": "uint256"
|
|
678
|
-
}
|
|
679
|
-
],
|
|
680
|
-
"stateMutability": "view"
|
|
681
|
-
},
|
|
682
|
-
{
|
|
683
|
-
"type": "function",
|
|
684
|
-
"name": "reattest",
|
|
685
|
-
"inputs": [
|
|
686
|
-
{
|
|
687
|
-
"name": "revokeIndex",
|
|
688
|
-
"type": "uint256",
|
|
689
|
-
"internalType": "uint256"
|
|
690
|
-
},
|
|
691
|
-
{
|
|
692
|
-
"name": "fingerprint",
|
|
693
|
-
"type": "bytes",
|
|
694
|
-
"internalType": "bytes"
|
|
695
|
-
},
|
|
696
|
-
{
|
|
697
|
-
"name": "pgpSignature",
|
|
698
|
-
"type": "bytes",
|
|
699
|
-
"internalType": "bytes"
|
|
700
|
-
},
|
|
701
|
-
{
|
|
702
|
-
"name": "pgpPublicKey",
|
|
703
|
-
"type": "bytes",
|
|
704
|
-
"internalType": "bytes"
|
|
705
|
-
}
|
|
706
|
-
],
|
|
707
|
-
"outputs": [
|
|
708
|
-
{
|
|
709
|
-
"name": "index",
|
|
710
|
-
"type": "uint256",
|
|
711
|
-
"internalType": "uint256"
|
|
712
|
-
}
|
|
713
|
-
],
|
|
714
|
-
"stateMutability": "nonpayable"
|
|
715
|
-
},
|
|
716
|
-
{
|
|
717
|
-
"type": "function",
|
|
718
|
-
"name": "reattestFor",
|
|
719
|
-
"inputs": [
|
|
720
|
-
{
|
|
721
|
-
"name": "owner",
|
|
722
|
-
"type": "address",
|
|
723
|
-
"internalType": "address"
|
|
724
|
-
},
|
|
725
|
-
{
|
|
726
|
-
"name": "revokeIndex",
|
|
727
|
-
"type": "uint256",
|
|
728
|
-
"internalType": "uint256"
|
|
729
|
-
},
|
|
730
|
-
{
|
|
731
|
-
"name": "fingerprint",
|
|
732
|
-
"type": "bytes",
|
|
733
|
-
"internalType": "bytes"
|
|
734
|
-
},
|
|
735
|
-
{
|
|
736
|
-
"name": "pgpSignature",
|
|
737
|
-
"type": "bytes",
|
|
738
|
-
"internalType": "bytes"
|
|
739
|
-
},
|
|
740
|
-
{
|
|
741
|
-
"name": "pgpPublicKey",
|
|
742
|
-
"type": "bytes",
|
|
743
|
-
"internalType": "bytes"
|
|
744
|
-
},
|
|
745
|
-
{
|
|
746
|
-
"name": "deadline",
|
|
747
|
-
"type": "uint256",
|
|
748
|
-
"internalType": "uint256"
|
|
749
|
-
},
|
|
750
|
-
{
|
|
751
|
-
"name": "signature",
|
|
752
|
-
"type": "bytes",
|
|
753
|
-
"internalType": "bytes"
|
|
754
|
-
}
|
|
755
|
-
],
|
|
756
|
-
"outputs": [
|
|
757
|
-
{
|
|
758
|
-
"name": "index",
|
|
759
|
-
"type": "uint256",
|
|
760
|
-
"internalType": "uint256"
|
|
761
|
-
}
|
|
762
|
-
],
|
|
763
|
-
"stateMutability": "nonpayable"
|
|
764
|
-
},
|
|
765
|
-
{
|
|
766
|
-
"type": "function",
|
|
767
|
-
"name": "record",
|
|
768
|
-
"inputs": [
|
|
769
|
-
{
|
|
770
|
-
"name": "owner",
|
|
771
|
-
"type": "address",
|
|
772
|
-
"internalType": "address"
|
|
773
|
-
},
|
|
774
|
-
{
|
|
775
|
-
"name": "index",
|
|
776
|
-
"type": "uint256",
|
|
777
|
-
"internalType": "uint256"
|
|
778
|
-
},
|
|
779
|
-
{
|
|
780
|
-
"name": "kind",
|
|
781
|
-
"type": "bytes32",
|
|
782
|
-
"internalType": "bytes32"
|
|
783
|
-
}
|
|
784
|
-
],
|
|
785
|
-
"outputs": [
|
|
786
|
-
{
|
|
787
|
-
"name": "",
|
|
788
|
-
"type": "bytes",
|
|
789
|
-
"internalType": "bytes"
|
|
790
|
-
}
|
|
791
|
-
],
|
|
792
|
-
"stateMutability": "view"
|
|
793
|
-
},
|
|
794
|
-
{
|
|
795
|
-
"type": "function",
|
|
796
|
-
"name": "revoke",
|
|
797
|
-
"inputs": [
|
|
798
|
-
{
|
|
799
|
-
"name": "index",
|
|
800
|
-
"type": "uint256",
|
|
801
|
-
"internalType": "uint256"
|
|
802
|
-
}
|
|
803
|
-
],
|
|
804
|
-
"outputs": [],
|
|
805
|
-
"stateMutability": "nonpayable"
|
|
806
|
-
},
|
|
807
|
-
{
|
|
808
|
-
"type": "function",
|
|
809
|
-
"name": "revokeFor",
|
|
810
|
-
"inputs": [
|
|
811
|
-
{
|
|
812
|
-
"name": "owner",
|
|
813
|
-
"type": "address",
|
|
814
|
-
"internalType": "address"
|
|
815
|
-
},
|
|
816
|
-
{
|
|
817
|
-
"name": "index",
|
|
818
|
-
"type": "uint256",
|
|
819
|
-
"internalType": "uint256"
|
|
820
|
-
},
|
|
821
|
-
{
|
|
822
|
-
"name": "deadline",
|
|
823
|
-
"type": "uint256",
|
|
824
|
-
"internalType": "uint256"
|
|
825
|
-
},
|
|
826
|
-
{
|
|
827
|
-
"name": "signature",
|
|
828
|
-
"type": "bytes",
|
|
829
|
-
"internalType": "bytes"
|
|
830
|
-
}
|
|
831
|
-
],
|
|
832
|
-
"outputs": [],
|
|
833
|
-
"stateMutability": "nonpayable"
|
|
834
|
-
},
|
|
835
|
-
{
|
|
836
|
-
"type": "function",
|
|
837
|
-
"name": "setRecord",
|
|
838
|
-
"inputs": [
|
|
839
|
-
{
|
|
840
|
-
"name": "index",
|
|
841
|
-
"type": "uint256",
|
|
842
|
-
"internalType": "uint256"
|
|
843
|
-
},
|
|
844
|
-
{
|
|
845
|
-
"name": "kind",
|
|
846
|
-
"type": "bytes32",
|
|
847
|
-
"internalType": "bytes32"
|
|
848
|
-
},
|
|
849
|
-
{
|
|
850
|
-
"name": "value",
|
|
851
|
-
"type": "bytes",
|
|
852
|
-
"internalType": "bytes"
|
|
853
|
-
}
|
|
854
|
-
],
|
|
855
|
-
"outputs": [],
|
|
856
|
-
"stateMutability": "nonpayable"
|
|
857
|
-
},
|
|
858
|
-
{
|
|
859
|
-
"type": "function",
|
|
860
|
-
"name": "setRecordFor",
|
|
861
|
-
"inputs": [
|
|
862
|
-
{
|
|
863
|
-
"name": "owner",
|
|
864
|
-
"type": "address",
|
|
865
|
-
"internalType": "address"
|
|
866
|
-
},
|
|
867
|
-
{
|
|
868
|
-
"name": "index",
|
|
869
|
-
"type": "uint256",
|
|
870
|
-
"internalType": "uint256"
|
|
871
|
-
},
|
|
872
|
-
{
|
|
873
|
-
"name": "kind",
|
|
874
|
-
"type": "bytes32",
|
|
875
|
-
"internalType": "bytes32"
|
|
876
|
-
},
|
|
877
|
-
{
|
|
878
|
-
"name": "value",
|
|
879
|
-
"type": "bytes",
|
|
880
|
-
"internalType": "bytes"
|
|
881
|
-
},
|
|
882
|
-
{
|
|
883
|
-
"name": "deadline",
|
|
884
|
-
"type": "uint256",
|
|
885
|
-
"internalType": "uint256"
|
|
886
|
-
},
|
|
887
|
-
{
|
|
888
|
-
"name": "signature",
|
|
889
|
-
"type": "bytes",
|
|
890
|
-
"internalType": "bytes"
|
|
891
|
-
}
|
|
892
|
-
],
|
|
893
|
-
"outputs": [],
|
|
894
|
-
"stateMutability": "nonpayable"
|
|
895
|
-
},
|
|
896
|
-
{
|
|
897
|
-
"type": "function",
|
|
898
|
-
"name": "updateKey",
|
|
899
|
-
"inputs": [
|
|
900
|
-
{
|
|
901
|
-
"name": "index",
|
|
902
|
-
"type": "uint256",
|
|
903
|
-
"internalType": "uint256"
|
|
904
|
-
},
|
|
905
|
-
{
|
|
906
|
-
"name": "pgpPublicKey",
|
|
907
|
-
"type": "bytes",
|
|
908
|
-
"internalType": "bytes"
|
|
909
|
-
}
|
|
910
|
-
],
|
|
911
|
-
"outputs": [],
|
|
912
|
-
"stateMutability": "nonpayable"
|
|
913
|
-
},
|
|
914
|
-
{
|
|
915
|
-
"type": "function",
|
|
916
|
-
"name": "updateKeyFor",
|
|
917
|
-
"inputs": [
|
|
918
|
-
{
|
|
919
|
-
"name": "owner",
|
|
920
|
-
"type": "address",
|
|
921
|
-
"internalType": "address"
|
|
922
|
-
},
|
|
923
|
-
{
|
|
924
|
-
"name": "index",
|
|
925
|
-
"type": "uint256",
|
|
926
|
-
"internalType": "uint256"
|
|
927
|
-
},
|
|
928
|
-
{
|
|
929
|
-
"name": "pgpPublicKey",
|
|
930
|
-
"type": "bytes",
|
|
931
|
-
"internalType": "bytes"
|
|
932
|
-
},
|
|
933
|
-
{
|
|
934
|
-
"name": "deadline",
|
|
935
|
-
"type": "uint256",
|
|
936
|
-
"internalType": "uint256"
|
|
937
|
-
},
|
|
938
|
-
{
|
|
939
|
-
"name": "signature",
|
|
940
|
-
"type": "bytes",
|
|
941
|
-
"internalType": "bytes"
|
|
942
|
-
}
|
|
943
|
-
],
|
|
944
|
-
"outputs": [],
|
|
945
|
-
"stateMutability": "nonpayable"
|
|
946
|
-
},
|
|
947
|
-
{
|
|
948
|
-
"type": "event",
|
|
949
|
-
"name": "Attested",
|
|
950
|
-
"inputs": [
|
|
951
|
-
{
|
|
952
|
-
"name": "owner",
|
|
953
|
-
"type": "address",
|
|
954
|
-
"indexed": true,
|
|
955
|
-
"internalType": "address"
|
|
956
|
-
},
|
|
957
|
-
{
|
|
958
|
-
"name": "fingerprintHash",
|
|
959
|
-
"type": "bytes32",
|
|
960
|
-
"indexed": true,
|
|
961
|
-
"internalType": "bytes32"
|
|
962
|
-
},
|
|
963
|
-
{
|
|
964
|
-
"name": "index",
|
|
965
|
-
"type": "uint256",
|
|
966
|
-
"indexed": true,
|
|
967
|
-
"internalType": "uint256"
|
|
968
|
-
},
|
|
969
|
-
{
|
|
970
|
-
"name": "fingerprint",
|
|
971
|
-
"type": "bytes",
|
|
972
|
-
"indexed": false,
|
|
973
|
-
"internalType": "bytes"
|
|
974
|
-
},
|
|
975
|
-
{
|
|
976
|
-
"name": "messageVersion",
|
|
977
|
-
"type": "uint8",
|
|
978
|
-
"indexed": false,
|
|
979
|
-
"internalType": "uint8"
|
|
980
|
-
},
|
|
981
|
-
{
|
|
982
|
-
"name": "keyPtr",
|
|
983
|
-
"type": "address",
|
|
984
|
-
"indexed": false,
|
|
985
|
-
"internalType": "address"
|
|
986
|
-
},
|
|
987
|
-
{
|
|
988
|
-
"name": "sigPtr",
|
|
989
|
-
"type": "address",
|
|
990
|
-
"indexed": false,
|
|
991
|
-
"internalType": "address"
|
|
992
|
-
},
|
|
993
|
-
{
|
|
994
|
-
"name": "submitter",
|
|
995
|
-
"type": "address",
|
|
996
|
-
"indexed": false,
|
|
997
|
-
"internalType": "address"
|
|
998
|
-
}
|
|
999
|
-
],
|
|
1000
|
-
"anonymous": false
|
|
1001
|
-
},
|
|
1002
|
-
{
|
|
1003
|
-
"type": "event",
|
|
1004
|
-
"name": "KeyUpdated",
|
|
1005
|
-
"inputs": [
|
|
1006
|
-
{
|
|
1007
|
-
"name": "owner",
|
|
1008
|
-
"type": "address",
|
|
1009
|
-
"indexed": true,
|
|
1010
|
-
"internalType": "address"
|
|
1011
|
-
},
|
|
1012
|
-
{
|
|
1013
|
-
"name": "fingerprintHash",
|
|
1014
|
-
"type": "bytes32",
|
|
1015
|
-
"indexed": true,
|
|
1016
|
-
"internalType": "bytes32"
|
|
1017
|
-
},
|
|
1018
|
-
{
|
|
1019
|
-
"name": "index",
|
|
1020
|
-
"type": "uint256",
|
|
1021
|
-
"indexed": true,
|
|
1022
|
-
"internalType": "uint256"
|
|
1023
|
-
},
|
|
1024
|
-
{
|
|
1025
|
-
"name": "oldKeyPtr",
|
|
1026
|
-
"type": "address",
|
|
1027
|
-
"indexed": false,
|
|
1028
|
-
"internalType": "address"
|
|
1029
|
-
},
|
|
1030
|
-
{
|
|
1031
|
-
"name": "newKeyPtr",
|
|
1032
|
-
"type": "address",
|
|
1033
|
-
"indexed": false,
|
|
1034
|
-
"internalType": "address"
|
|
1035
|
-
},
|
|
1036
|
-
{
|
|
1037
|
-
"name": "submitter",
|
|
1038
|
-
"type": "address",
|
|
1039
|
-
"indexed": false,
|
|
1040
|
-
"internalType": "address"
|
|
1041
|
-
}
|
|
1042
|
-
],
|
|
1043
|
-
"anonymous": false
|
|
1044
|
-
},
|
|
1045
|
-
{
|
|
1046
|
-
"type": "event",
|
|
1047
|
-
"name": "NonceUsed",
|
|
1048
|
-
"inputs": [
|
|
1049
|
-
{
|
|
1050
|
-
"name": "owner",
|
|
1051
|
-
"type": "address",
|
|
1052
|
-
"indexed": true,
|
|
1053
|
-
"internalType": "address"
|
|
1054
|
-
},
|
|
1055
|
-
{
|
|
1056
|
-
"name": "nonce",
|
|
1057
|
-
"type": "uint256",
|
|
1058
|
-
"indexed": false,
|
|
1059
|
-
"internalType": "uint256"
|
|
1060
|
-
}
|
|
1061
|
-
],
|
|
1062
|
-
"anonymous": false
|
|
1063
|
-
},
|
|
1064
|
-
{
|
|
1065
|
-
"type": "event",
|
|
1066
|
-
"name": "RecordSet",
|
|
1067
|
-
"inputs": [
|
|
1068
|
-
{
|
|
1069
|
-
"name": "owner",
|
|
1070
|
-
"type": "address",
|
|
1071
|
-
"indexed": true,
|
|
1072
|
-
"internalType": "address"
|
|
1073
|
-
},
|
|
1074
|
-
{
|
|
1075
|
-
"name": "index",
|
|
1076
|
-
"type": "uint256",
|
|
1077
|
-
"indexed": true,
|
|
1078
|
-
"internalType": "uint256"
|
|
1079
|
-
},
|
|
1080
|
-
{
|
|
1081
|
-
"name": "kind",
|
|
1082
|
-
"type": "bytes32",
|
|
1083
|
-
"indexed": true,
|
|
1084
|
-
"internalType": "bytes32"
|
|
1085
|
-
},
|
|
1086
|
-
{
|
|
1087
|
-
"name": "submitter",
|
|
1088
|
-
"type": "address",
|
|
1089
|
-
"indexed": false,
|
|
1090
|
-
"internalType": "address"
|
|
1091
|
-
}
|
|
1092
|
-
],
|
|
1093
|
-
"anonymous": false
|
|
1094
|
-
},
|
|
1095
|
-
{
|
|
1096
|
-
"type": "event",
|
|
1097
|
-
"name": "Revoked",
|
|
1098
|
-
"inputs": [
|
|
1099
|
-
{
|
|
1100
|
-
"name": "owner",
|
|
1101
|
-
"type": "address",
|
|
1102
|
-
"indexed": true,
|
|
1103
|
-
"internalType": "address"
|
|
1104
|
-
},
|
|
1105
|
-
{
|
|
1106
|
-
"name": "fingerprintHash",
|
|
1107
|
-
"type": "bytes32",
|
|
1108
|
-
"indexed": true,
|
|
1109
|
-
"internalType": "bytes32"
|
|
1110
|
-
},
|
|
1111
|
-
{
|
|
1112
|
-
"name": "index",
|
|
1113
|
-
"type": "uint256",
|
|
1114
|
-
"indexed": true,
|
|
1115
|
-
"internalType": "uint256"
|
|
1116
|
-
},
|
|
1117
|
-
{
|
|
1118
|
-
"name": "submitter",
|
|
1119
|
-
"type": "address",
|
|
1120
|
-
"indexed": false,
|
|
1121
|
-
"internalType": "address"
|
|
1122
|
-
}
|
|
1123
|
-
],
|
|
1124
|
-
"anonymous": false
|
|
1125
|
-
},
|
|
1126
|
-
{
|
|
1127
|
-
"type": "error",
|
|
1128
|
-
"name": "AlreadyRevoked",
|
|
1129
|
-
"inputs": []
|
|
1130
|
-
},
|
|
1131
|
-
{
|
|
1132
|
-
"type": "error",
|
|
1133
|
-
"name": "AuthorizationExpired",
|
|
1134
|
-
"inputs": []
|
|
1135
|
-
},
|
|
1136
|
-
{
|
|
1137
|
-
"type": "error",
|
|
1138
|
-
"name": "DeploymentFailed",
|
|
1139
|
-
"inputs": []
|
|
1140
|
-
},
|
|
1141
|
-
{
|
|
1142
|
-
"type": "error",
|
|
1143
|
-
"name": "DuplicateActiveFingerprint",
|
|
1144
|
-
"inputs": []
|
|
1145
|
-
},
|
|
1146
|
-
{
|
|
1147
|
-
"type": "error",
|
|
1148
|
-
"name": "EmptyPublicKey",
|
|
1149
|
-
"inputs": []
|
|
1150
|
-
},
|
|
1151
|
-
{
|
|
1152
|
-
"type": "error",
|
|
1153
|
-
"name": "EmptySignature",
|
|
1154
|
-
"inputs": []
|
|
1155
|
-
},
|
|
1156
|
-
{
|
|
1157
|
-
"type": "error",
|
|
1158
|
-
"name": "IndexOutOfBounds",
|
|
1159
|
-
"inputs": []
|
|
1160
|
-
},
|
|
1161
|
-
{
|
|
1162
|
-
"type": "error",
|
|
1163
|
-
"name": "InvalidAuthorization",
|
|
1164
|
-
"inputs": []
|
|
1165
|
-
},
|
|
1166
|
-
{
|
|
1167
|
-
"type": "error",
|
|
1168
|
-
"name": "InvalidFingerprintLength",
|
|
1169
|
-
"inputs": []
|
|
1170
|
-
},
|
|
1171
|
-
{
|
|
1172
|
-
"type": "error",
|
|
1173
|
-
"name": "InvalidPointer",
|
|
1174
|
-
"inputs": []
|
|
1175
|
-
},
|
|
1176
|
-
{
|
|
1177
|
-
"type": "error",
|
|
1178
|
-
"name": "PublicKeyTooLarge",
|
|
1179
|
-
"inputs": []
|
|
1180
|
-
},
|
|
1181
|
-
{
|
|
1182
|
-
"type": "error",
|
|
1183
|
-
"name": "RecordTooLarge",
|
|
1184
|
-
"inputs": []
|
|
1185
|
-
},
|
|
1186
|
-
{
|
|
1187
|
-
"type": "error",
|
|
1188
|
-
"name": "SignatureTooLarge",
|
|
1189
|
-
"inputs": []
|
|
1190
|
-
}
|
|
1191
|
-
];
|
|
1192
|
-
|
|
1193
|
-
// src/core/contract.ts
|
|
1194
|
-
var _chains = require('viem/chains');
|
|
1195
|
-
var REGISTRY_ADDRESS = "0x9302E02e2869e129aC8516fE5eFFd51EA3082c09";
|
|
1196
|
-
var NETWORKS = {
|
|
1197
|
-
mainnet: {
|
|
1198
|
-
chainId: 1,
|
|
1199
|
-
address: REGISTRY_ADDRESS,
|
|
1200
|
-
deployBlock: 25962908n,
|
|
1201
|
-
// 2026-09-12, tx 0xda4c3a19cae4e71ffb02559a048403f664d5a7967c19d42158c39600ec63bad8
|
|
1202
|
-
explorerUrl: "https://etherscan.io",
|
|
1203
|
-
defaultRpcUrl: "https://ethereum.publicnode.com"
|
|
1204
|
-
// same service as ethereum-rpc.publicnode.com; this hostname resolves on more networks
|
|
1205
|
-
},
|
|
1206
|
-
sepolia: {
|
|
1207
|
-
chainId: 11155111,
|
|
1208
|
-
address: REGISTRY_ADDRESS,
|
|
1209
|
-
deployBlock: 11683667n,
|
|
1210
|
-
// 2026-09-11, tx 0x3e40e8f5b9fbf82a4b8943561bcc9b964b2987de10640ac8ff3a1b4ef0725322
|
|
1211
|
-
explorerUrl: "https://sepolia.etherscan.io",
|
|
1212
|
-
defaultRpcUrl: "https://ethereum-sepolia.publicnode.com"
|
|
1213
|
-
},
|
|
1214
|
-
/** A local anvil instance (`anvil`, chain id 31337). Deploy with pgp-registry's Deploy script. */
|
|
1215
|
-
local: {
|
|
1216
|
-
chainId: 31337,
|
|
1217
|
-
address: REGISTRY_ADDRESS,
|
|
1218
|
-
deployBlock: 0n,
|
|
1219
|
-
explorerUrl: "",
|
|
1220
|
-
defaultRpcUrl: "http://127.0.0.1:8545"
|
|
1221
|
-
}
|
|
1222
|
-
};
|
|
1223
|
-
function isNetworkName(value) {
|
|
1224
|
-
return value === "mainnet" || value === "sepolia" || value === "local";
|
|
1225
|
-
}
|
|
1226
|
-
function getRegistry(network = "mainnet", addressOverride) {
|
|
1227
|
-
const r = NETWORKS[network];
|
|
1228
|
-
if (!r) throw new Error(`Unknown network: ${network}`);
|
|
1229
|
-
if (addressOverride && /^0x[0-9a-fA-F]{40}$/.test(addressOverride)) {
|
|
1230
|
-
return { ...r, address: addressOverride };
|
|
1231
|
-
}
|
|
1232
|
-
return r;
|
|
1233
|
-
}
|
|
1234
|
-
function chainFor(network = "mainnet") {
|
|
1235
|
-
if (network === "sepolia") return _chains.sepolia;
|
|
1236
|
-
if (network === "local") return _chains.foundry;
|
|
1237
|
-
return _chains.mainnet;
|
|
1238
|
-
}
|
|
1239
|
-
|
|
1240
|
-
// src/core/identityError.ts
|
|
1241
|
-
function needsRpcProbe(s) {
|
|
1242
|
-
return s.ensEmpty || s.ensFailed || s.claimsFailed;
|
|
1243
|
-
}
|
|
1244
|
-
function identityErrorKind(s) {
|
|
1245
|
-
if (!needsRpcProbe(s) || s.rpcAnswered === void 0) return null;
|
|
1246
|
-
if (!s.rpcAnswered) return "rpc";
|
|
1247
|
-
if (s.ensEmpty && !s.ensFailed) return "not-found";
|
|
1248
|
-
return "read";
|
|
1249
|
-
}
|
|
1250
|
-
var IDENTITY_ERROR_TEXT = {
|
|
1251
|
-
rpc: "Couldn't reach the RPC, so nothing here is known yet.",
|
|
1252
|
-
"not-found": "No address for this name.",
|
|
1253
|
-
read: "Couldn't read the registry."
|
|
1254
|
-
};
|
|
1255
|
-
|
|
1256
|
-
// src/core/fingerprint.ts
|
|
1257
|
-
var _viem = require('viem');
|
|
1258
|
-
var FINGERPRINT_HEX = /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/;
|
|
1259
|
-
function normalizeFingerprint(input) {
|
|
1260
|
-
const hex = input.replace(/^0x/i, "").replace(/\s+/g, "").toLowerCase();
|
|
1261
|
-
return FINGERPRINT_HEX.test(hex) ? hex : null;
|
|
1262
|
-
}
|
|
1263
|
-
function fingerprintToBytes(fingerprint) {
|
|
1264
|
-
const hex = normalizeFingerprint(fingerprint);
|
|
1265
|
-
if (!hex) throw new Error(`Invalid PGP fingerprint: ${fingerprint}`);
|
|
1266
|
-
return `0x${hex}`;
|
|
1267
|
-
}
|
|
1268
|
-
function bytesToFingerprint(bytes) {
|
|
1269
|
-
return bytes.replace(/^0x/i, "").toLowerCase();
|
|
1270
|
-
}
|
|
1271
|
-
function fingerprintHash(fingerprint) {
|
|
1272
|
-
return _viem.keccak256.call(void 0, fingerprintToBytes(fingerprint));
|
|
1273
|
-
}
|
|
1274
|
-
function keyIdOf(fingerprint) {
|
|
1275
|
-
const hex = normalizeFingerprint(fingerprint);
|
|
1276
|
-
if (!hex) throw new Error(`Invalid PGP fingerprint: ${fingerprint}`);
|
|
1277
|
-
return `0x${keyIdHex(hex)}`;
|
|
1278
|
-
}
|
|
1279
|
-
function keyIdHex(normalizedFingerprint) {
|
|
1280
|
-
return normalizedFingerprint.length === 64 ? normalizedFingerprint.slice(0, 16) : normalizedFingerprint.slice(-16);
|
|
1281
|
-
}
|
|
1282
|
-
function keyIdToBytes(keyId) {
|
|
1283
|
-
const hex = keyId.replace(/^0x/i, "").replace(/\s+/g, "").toLowerCase();
|
|
1284
|
-
return /^[0-9a-f]{16}$/.test(hex) ? `0x${hex}` : null;
|
|
1285
|
-
}
|
|
1286
|
-
|
|
1287
|
-
// src/core/pgp.ts
|
|
1288
|
-
function pgpConfig(openpgp) {
|
|
1289
|
-
const rejectCurves = new Set([..._nullishCoalesce(openpgp.config.rejectCurves, () => ( []))].filter((c) => c !== "secp256k1"));
|
|
1290
|
-
return { ...openpgp.config, rejectCurves };
|
|
1291
|
-
}
|
|
1292
|
-
function algorithmName(keyOrSubkey) {
|
|
1293
|
-
try {
|
|
1294
|
-
const info = keyOrSubkey.getAlgorithmInfo();
|
|
1295
|
-
const curve = (info.curve || "").toLowerCase();
|
|
1296
|
-
if (curve.startsWith("ed25519") || info.algorithm === "ed25519" || info.algorithm === "eddsaLegacy") return "Ed25519";
|
|
1297
|
-
if (curve.startsWith("curve25519") || info.algorithm === "x25519") return "Cv25519";
|
|
1298
|
-
if (curve.startsWith("ed448")) return "Ed448";
|
|
1299
|
-
if (curve.startsWith("curve448") || info.algorithm === "x448") return "X448";
|
|
1300
|
-
if (curve.startsWith("nistp") || curve.startsWith("p")) return `NIST P-${curve.replace(/\D/g, "")}`;
|
|
1301
|
-
if (curve.startsWith("secp")) return curve;
|
|
1302
|
-
if (curve.startsWith("brainpool")) return curve;
|
|
1303
|
-
if (info.algorithm.startsWith("rsa")) return info.bits ? `RSA ${info.bits}` : "RSA";
|
|
1304
|
-
if (info.algorithm.startsWith("dsa")) return info.bits ? `DSA ${info.bits}` : "DSA";
|
|
1305
|
-
if (info.algorithm.startsWith("elgamal")) return info.bits ? `ElGamal ${info.bits}` : "ElGamal";
|
|
1306
|
-
return info.curve || info.algorithm;
|
|
1307
|
-
} catch (e) {
|
|
1308
|
-
return String(_nullishCoalesce(_optionalChain([keyOrSubkey, 'access', _ => _.keyPacket, 'optionalAccess', _2 => _2.algorithm]), () => ( "unknown")));
|
|
1309
|
-
}
|
|
1310
|
-
}
|
|
1311
|
-
async function parsePgpKey(armoredKey) {
|
|
1312
|
-
try {
|
|
1313
|
-
const openpgp = await Promise.resolve().then(() => _interopRequireWildcard(require("openpgp")));
|
|
1314
|
-
const { readKey } = openpgp;
|
|
1315
|
-
const config = pgpConfig(openpgp);
|
|
1316
|
-
const key = await readKey({ armoredKey });
|
|
1317
|
-
const fingerprint = key.getFingerprint().toUpperCase();
|
|
1318
|
-
const algorithm = algorithmName(key);
|
|
1319
|
-
const created = _nullishCoalesce(_optionalChain([key, 'access', _3 => _3.keyPacket, 'access', _4 => _4.created, 'optionalAccess', _5 => _5.toISOString, 'call', _6 => _6()]), () => ( null));
|
|
1320
|
-
const expiration = await key.getExpirationTime();
|
|
1321
|
-
const expires = expiration && expiration !== Infinity ? new Date(expiration).toISOString() : null;
|
|
1322
|
-
const userIDs = [];
|
|
1323
|
-
const notations = [];
|
|
1324
|
-
const seen = /* @__PURE__ */ new Set();
|
|
1325
|
-
for (const user of key.users) {
|
|
1326
|
-
const certs = user.selfCertifications;
|
|
1327
|
-
if (!certs || certs.length === 0) continue;
|
|
1328
|
-
let userVerified = false;
|
|
1329
|
-
for (const cert of certs) {
|
|
1330
|
-
try {
|
|
1331
|
-
await cert.verify(
|
|
1332
|
-
key.keyPacket,
|
|
1333
|
-
cert.signatureType,
|
|
1334
|
-
{ userID: user.userID, key: key.keyPacket },
|
|
1335
|
-
void 0,
|
|
1336
|
-
// date: now
|
|
1337
|
-
void 0,
|
|
1338
|
-
// detached
|
|
1339
|
-
config
|
|
1340
|
-
);
|
|
1341
|
-
} catch (e2) {
|
|
1342
|
-
continue;
|
|
1343
|
-
}
|
|
1344
|
-
userVerified = true;
|
|
1345
|
-
if (cert.rawNotations) {
|
|
1346
|
-
for (const n of cert.rawNotations) {
|
|
1347
|
-
const name = typeof n.name === "string" ? n.name : new TextDecoder().decode(n.name);
|
|
1348
|
-
const value = n.value instanceof Uint8Array ? new TextDecoder().decode(n.value) : typeof n.value === "string" ? n.value : null;
|
|
1349
|
-
if (value) {
|
|
1350
|
-
if (!seen.has(value)) {
|
|
1351
|
-
seen.add(value);
|
|
1352
|
-
notations.push({ name, value });
|
|
1353
|
-
}
|
|
1354
|
-
}
|
|
1355
|
-
}
|
|
1356
|
-
}
|
|
1357
|
-
}
|
|
1358
|
-
if (userVerified) {
|
|
1359
|
-
const uid = _optionalChain([user, 'access', _7 => _7.userID, 'optionalAccess', _8 => _8.userID]);
|
|
1360
|
-
if (uid) userIDs.push(uid);
|
|
1361
|
-
}
|
|
1362
|
-
}
|
|
1363
|
-
const subkeys = key.subkeys.map((sk) => ({
|
|
1364
|
-
algorithm: algorithmName(sk),
|
|
1365
|
-
created: _nullishCoalesce(_optionalChain([sk, 'access', _9 => _9.keyPacket, 'access', _10 => _10.created, 'optionalAccess', _11 => _11.toISOString, 'call', _12 => _12()]), () => ( null)),
|
|
1366
|
-
fingerprint: sk.getFingerprint().toUpperCase()
|
|
1367
|
-
}));
|
|
1368
|
-
return { fingerprint, userIDs, algorithm, created, expires, notations, subkeys };
|
|
1369
|
-
} catch (e3) {
|
|
1370
|
-
return null;
|
|
1371
|
-
}
|
|
1372
|
-
}
|
|
1373
|
-
async function verifyClearsigned({ armoredKey, clearsigned }) {
|
|
1374
|
-
try {
|
|
1375
|
-
const openpgp = await Promise.resolve().then(() => _interopRequireWildcard(require("openpgp")));
|
|
1376
|
-
const { readKey, readCleartextMessage, LiteralDataPacket } = openpgp;
|
|
1377
|
-
const config = pgpConfig(openpgp);
|
|
1378
|
-
const publicKey = await readKey({ armoredKey });
|
|
1379
|
-
const message = await readCleartextMessage({ cleartextMessage: clearsigned });
|
|
1380
|
-
const msg = message;
|
|
1381
|
-
const now = /* @__PURE__ */ new Date();
|
|
1382
|
-
for (const sig of msg.signature.packets) {
|
|
1383
|
-
if (!publicKey.getKeys(sig.issuerKeyID).length) continue;
|
|
1384
|
-
const signingKey = await publicKey.getSigningKey(sig.issuerKeyID, now, void 0, config);
|
|
1385
|
-
const literal = new LiteralDataPacket();
|
|
1386
|
-
literal.setText(_nullishCoalesce(msg.text, () => ( message.getText().replace(/\r?\n/g, "\r\n"))));
|
|
1387
|
-
await sig.verify(signingKey.keyPacket, sig.signatureType, literal, now, true, config);
|
|
1388
|
-
return { verified: true, text: message.getText() };
|
|
1389
|
-
}
|
|
1390
|
-
return { verified: false, reason: "Message is not signed by this key", text: message.getText() };
|
|
1391
|
-
} catch (err) {
|
|
1392
|
-
return { verified: false, reason: err instanceof Error ? err.message : "Verification failed", text: "" };
|
|
1393
|
-
}
|
|
1394
|
-
}
|
|
1395
|
-
async function verifyAttestation({
|
|
1396
|
-
pgpPublicKey,
|
|
1397
|
-
pgpSignature,
|
|
1398
|
-
fingerprint,
|
|
1399
|
-
ethAddress
|
|
1400
|
-
}) {
|
|
1401
|
-
try {
|
|
1402
|
-
if (!pgpPublicKey || !pgpSignature) {
|
|
1403
|
-
return { verified: false, reason: "Missing PGP data" };
|
|
1404
|
-
}
|
|
1405
|
-
const openpgp = await Promise.resolve().then(() => _interopRequireWildcard(require("openpgp")));
|
|
1406
|
-
const { readKey } = openpgp;
|
|
1407
|
-
const publicKey = await readKey({ armoredKey: pgpPublicKey });
|
|
1408
|
-
const keyFingerprint = publicKey.getFingerprint().toUpperCase();
|
|
1409
|
-
if (keyFingerprint !== fingerprint.toUpperCase()) {
|
|
1410
|
-
return { verified: false, reason: "Key fingerprint mismatch" };
|
|
1411
|
-
}
|
|
1412
|
-
const v = await verifyClearsigned({ armoredKey: pgpPublicKey, clearsigned: pgpSignature });
|
|
1413
|
-
if (!v.verified) return { verified: false, reason: v.reason };
|
|
1414
|
-
const signedText = v.text;
|
|
1415
|
-
if (!signedText.toLowerCase().includes(ethAddress.toLowerCase())) {
|
|
1416
|
-
return { verified: false, reason: "Signed message does not contain ETH address" };
|
|
1417
|
-
}
|
|
1418
|
-
return { verified: true };
|
|
1419
|
-
} catch (e4) {
|
|
1420
|
-
return { verified: false, reason: "Signature verification failed" };
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
var EMAIL_UID = /@/;
|
|
1424
|
-
async function stripEmailUserIDs(armoredKey) {
|
|
1425
|
-
try {
|
|
1426
|
-
const { readKey } = await Promise.resolve().then(() => _interopRequireWildcard(require("openpgp")));
|
|
1427
|
-
const key = await readKey({ armoredKey });
|
|
1428
|
-
const kept = [];
|
|
1429
|
-
const removed = [];
|
|
1430
|
-
const users = key.users.filter((u) => {
|
|
1431
|
-
const uid = _optionalChain([u, 'access', _13 => _13.userID, 'optionalAccess', _14 => _14.userID]);
|
|
1432
|
-
if (!uid) return false;
|
|
1433
|
-
if (EMAIL_UID.test(uid)) {
|
|
1434
|
-
removed.push(uid);
|
|
1435
|
-
return false;
|
|
1436
|
-
}
|
|
1437
|
-
kept.push(uid);
|
|
1438
|
-
return true;
|
|
1439
|
-
});
|
|
1440
|
-
if (users.length === 0) return null;
|
|
1441
|
-
key.users = users;
|
|
1442
|
-
return { armored: key.armor(), kept, removed };
|
|
1443
|
-
} catch (e5) {
|
|
1444
|
-
return null;
|
|
1445
|
-
}
|
|
1446
|
-
}
|
|
1447
|
-
async function hasEmailUserID(armoredKey) {
|
|
1448
|
-
try {
|
|
1449
|
-
const { readKey } = await Promise.resolve().then(() => _interopRequireWildcard(require("openpgp")));
|
|
1450
|
-
const key = await readKey({ armoredKey });
|
|
1451
|
-
return key.users.some((u) => EMAIL_UID.test(_nullishCoalesce(_optionalChain([u, 'access', _15 => _15.userID, 'optionalAccess', _16 => _16.userID]), () => ( ""))));
|
|
1452
|
-
} catch (e6) {
|
|
1453
|
-
return false;
|
|
1454
|
-
}
|
|
1455
|
-
}
|
|
1456
|
-
|
|
1457
|
-
// src/core/efp.ts
|
|
1458
|
-
var EFP_API = "https://api.ethfollow.xyz/api/v1";
|
|
1459
|
-
async function fetchEFPGraph(address) {
|
|
1460
|
-
try {
|
|
1461
|
-
const [statsResp, listsResp] = await Promise.all([
|
|
1462
|
-
fetch(`${EFP_API}/users/${address}/stats`),
|
|
1463
|
-
fetch(`${EFP_API}/users/${address}/lists`)
|
|
1464
|
-
]);
|
|
1465
|
-
if (!statsResp.ok && !listsResp.ok) return null;
|
|
1466
|
-
const statsData = statsResp.ok ? await statsResp.json() : {};
|
|
1467
|
-
const listsData = listsResp.ok ? await listsResp.json() : {};
|
|
1468
|
-
const followers = parseInt(statsData.followers_count) || 0;
|
|
1469
|
-
const listId = listsData.primary_list;
|
|
1470
|
-
let following = 0;
|
|
1471
|
-
let top8 = [];
|
|
1472
|
-
if (listId) {
|
|
1473
|
-
const [followingResp, top8Resp] = await Promise.all([
|
|
1474
|
-
fetch(`${EFP_API}/lists/${listId}/following?limit=100`),
|
|
1475
|
-
fetch(`${EFP_API}/lists/${listId}/following?limit=8&tags=top8`)
|
|
1476
|
-
]);
|
|
1477
|
-
const followingData = followingResp.ok ? await followingResp.json() : { following: [] };
|
|
1478
|
-
const top8Data = top8Resp.ok ? await top8Resp.json() : { following: [] };
|
|
1479
|
-
following = (followingData.following || []).length;
|
|
1480
|
-
top8 = (top8Data.following || []).map((f) => f.data);
|
|
1481
|
-
}
|
|
1482
|
-
return { followers, following, top8, hasEfp: !!listId || followers > 0 };
|
|
1483
|
-
} catch (e7) {
|
|
1484
|
-
return null;
|
|
1485
|
-
}
|
|
1486
|
-
}
|
|
1487
|
-
|
|
1488
|
-
// src/core/proofs.ts
|
|
1489
|
-
var PROVIDERS = [
|
|
1490
|
-
{
|
|
1491
|
-
provider: "github",
|
|
1492
|
-
label: "GitHub",
|
|
1493
|
-
pattern: /^https:\/\/gist\.github\.com\/([^/]+)\/([a-f0-9]+)$/i,
|
|
1494
|
-
parse: (m) => ({ user: m[1], gistId: m[2] })
|
|
1495
|
-
},
|
|
1496
|
-
{
|
|
1497
|
-
// A repository's description — the form an organisation can use, since
|
|
1498
|
-
// gists belong to user accounts only. Same shape as the Codeberg proof.
|
|
1499
|
-
provider: "github",
|
|
1500
|
-
label: "GitHub",
|
|
1501
|
-
pattern: /^https:\/\/github\.com\/([A-Za-z0-9-]+)\/([A-Za-z0-9._-]+)$/i,
|
|
1502
|
-
parse: (m) => ({ user: m[1], repo: m[2] })
|
|
1503
|
-
},
|
|
1504
|
-
{
|
|
1505
|
-
provider: "dns",
|
|
1506
|
-
label: "DNS",
|
|
1507
|
-
// domain is restricted to a hostname (labels may include underscores for
|
|
1508
|
-
// records like _thurin.example.com); rejects slashes, userinfo, and spaces.
|
|
1509
|
-
pattern: /^dns:([a-z0-9._-]+)\?type=TXT$/i,
|
|
1510
|
-
parse: (m) => ({ domain: m[1] })
|
|
1511
|
-
},
|
|
1512
|
-
{
|
|
1513
|
-
provider: "farcaster",
|
|
1514
|
-
label: "Farcaster",
|
|
1515
|
-
pattern: /^https:\/\/farcaster\.xyz\/([^/]+)\/(0x[a-f0-9]+)$/i,
|
|
1516
|
-
parse: (m) => ({ user: m[1], castHash: m[2] })
|
|
1517
|
-
},
|
|
1518
|
-
{
|
|
1519
|
-
provider: "codeberg",
|
|
1520
|
-
label: "Codeberg",
|
|
1521
|
-
pattern: /^https:\/\/codeberg\.org\/([^/]+)\/([^/]+)$/i,
|
|
1522
|
-
parse: (m) => ({ user: m[1], repo: m[2] })
|
|
1523
|
-
},
|
|
1524
|
-
{
|
|
1525
|
-
provider: "mastodon",
|
|
1526
|
-
label: "Mastodon",
|
|
1527
|
-
// instance is restricted to a bare hostname (optional port) so a value
|
|
1528
|
-
// like "mastodon.social@evil.com" can't redirect the lookup elsewhere.
|
|
1529
|
-
pattern: /^https:\/\/([a-z0-9.-]+(?::\d+)?)\/@([^/@?#\s]+)$/i,
|
|
1530
|
-
parse: (m) => ({ instance: m[1], user: m[2] })
|
|
1531
|
-
}
|
|
1532
|
-
];
|
|
1533
|
-
function identifyProof(notation) {
|
|
1534
|
-
if (notation.name !== "proof@thurin.id") return null;
|
|
1535
|
-
for (const { provider, label, pattern, parse } of PROVIDERS) {
|
|
1536
|
-
const m = notation.value.match(pattern);
|
|
1537
|
-
if (m) {
|
|
1538
|
-
return { provider, label, url: notation.value, ...parse(m) };
|
|
1539
|
-
}
|
|
1540
|
-
}
|
|
1541
|
-
return { provider: "unknown", label: "Unknown", url: notation.value };
|
|
1542
|
-
}
|
|
1543
|
-
function displayUrl(proof) {
|
|
1544
|
-
if (proof.provider === "dns") return proof.domain;
|
|
1545
|
-
if (proof.provider === "github") return proof.user;
|
|
1546
|
-
if (proof.provider === "farcaster") return `@${proof.user}`;
|
|
1547
|
-
if (proof.provider === "codeberg") return proof.user;
|
|
1548
|
-
if (proof.provider === "mastodon") return `@${proof.user}@${proof.instance}`;
|
|
1549
|
-
return proof.url;
|
|
1550
|
-
}
|
|
1551
|
-
function proofHref(proof) {
|
|
1552
|
-
if (proof.provider === "dns") return `https://${proof.domain}`;
|
|
1553
|
-
if (proof.provider === "github") return `https://github.com/${proof.user}`;
|
|
1554
|
-
if (proof.provider === "farcaster") return `https://farcaster.xyz/${proof.user}`;
|
|
1555
|
-
if (proof.provider === "codeberg") return `https://codeberg.org/${proof.user}`;
|
|
1556
|
-
if (proof.provider === "mastodon") return `https://${proof.instance}/@${proof.user}`;
|
|
1557
|
-
if (proof.url.startsWith("http")) return proof.url;
|
|
1558
|
-
return null;
|
|
1559
|
-
}
|
|
1560
|
-
function proofSecondaryHref(proof) {
|
|
1561
|
-
if (proof.provider === "github") return proof.url;
|
|
1562
|
-
if (proof.provider === "farcaster") return proof.url;
|
|
1563
|
-
if (proof.provider === "codeberg") return proof.url;
|
|
1564
|
-
if (proof.provider === "mastodon") return proof.url;
|
|
1565
|
-
return null;
|
|
1566
|
-
}
|
|
1567
|
-
var FPR_TOKEN = "OPENPGP4FPR:";
|
|
1568
|
-
function containsFingerprint(text, fingerprint) {
|
|
1569
|
-
return text.toUpperCase().includes(FPR_TOKEN + fingerprint.toUpperCase());
|
|
1570
|
-
}
|
|
1571
|
-
function containsFingerprintUrl(text, fingerprint) {
|
|
1572
|
-
return text.toUpperCase().includes(fingerprint.toUpperCase());
|
|
1573
|
-
}
|
|
1574
|
-
async function verifyGitHub(proof, fingerprint) {
|
|
1575
|
-
if (proof.repo) return verifyGitHubRepo(proof, fingerprint);
|
|
1576
|
-
try {
|
|
1577
|
-
const resp = await fetch(`https://api.github.com/gists/${proof.gistId}`);
|
|
1578
|
-
if (!resp.ok) return { verified: false, reason: `GitHub API returned ${resp.status}` };
|
|
1579
|
-
const data = await resp.json();
|
|
1580
|
-
if (_optionalChain([data, 'access', _17 => _17.owner, 'optionalAccess', _18 => _18.login, 'optionalAccess', _19 => _19.toLowerCase, 'call', _20 => _20()]) !== proof.user.toLowerCase()) {
|
|
1581
|
-
return { verified: false, reason: "Gist owner does not match claimed user" };
|
|
1582
|
-
}
|
|
1583
|
-
for (const file of Object.values(data.files || {})) {
|
|
1584
|
-
if (file.content && containsFingerprint(file.content, fingerprint)) {
|
|
1585
|
-
return { verified: true };
|
|
1586
|
-
}
|
|
1587
|
-
}
|
|
1588
|
-
return { verified: false, reason: "Fingerprint token not found in gist" };
|
|
1589
|
-
} catch (err) {
|
|
1590
|
-
return { verified: false, reason: `GitHub fetch failed: ${err.message}` };
|
|
1591
|
-
}
|
|
1592
|
-
}
|
|
1593
|
-
async function verifyGitHubRepo(proof, fingerprint) {
|
|
1594
|
-
try {
|
|
1595
|
-
const resp = await fetch(
|
|
1596
|
-
`https://api.github.com/repos/${encodeURIComponent(proof.user)}/${encodeURIComponent(proof.repo)}`
|
|
1597
|
-
);
|
|
1598
|
-
if (!resp.ok) return { verified: false, reason: `GitHub API returned ${resp.status}` };
|
|
1599
|
-
const data = await resp.json();
|
|
1600
|
-
if (_optionalChain([data, 'access', _21 => _21.owner, 'optionalAccess', _22 => _22.login, 'optionalAccess', _23 => _23.toLowerCase, 'call', _24 => _24()]) !== proof.user.toLowerCase()) {
|
|
1601
|
-
return { verified: false, reason: "Repository owner does not match claimed account" };
|
|
1602
|
-
}
|
|
1603
|
-
if (data.description && containsFingerprint(data.description, fingerprint)) {
|
|
1604
|
-
return { verified: true };
|
|
1605
|
-
}
|
|
1606
|
-
return { verified: false, reason: "Fingerprint token not found in repository description" };
|
|
1607
|
-
} catch (err) {
|
|
1608
|
-
return { verified: false, reason: `GitHub fetch failed: ${err.message}` };
|
|
1609
|
-
}
|
|
1610
|
-
}
|
|
1611
|
-
async function verifyDNS(proof, fingerprint) {
|
|
1612
|
-
try {
|
|
1613
|
-
const resp = await fetch(
|
|
1614
|
-
`https://cloudflare-dns.com/dns-query?name=${encodeURIComponent(proof.domain)}&type=TXT`,
|
|
1615
|
-
{ headers: { Accept: "application/dns-json" } }
|
|
1616
|
-
);
|
|
1617
|
-
if (!resp.ok) return { verified: false, reason: `DNS query returned ${resp.status}` };
|
|
1618
|
-
const data = await resp.json();
|
|
1619
|
-
for (const answer of data.Answer || []) {
|
|
1620
|
-
if (answer.type !== 16) continue;
|
|
1621
|
-
if (answer.data && containsFingerprint(answer.data, fingerprint)) {
|
|
1622
|
-
return { verified: true };
|
|
1623
|
-
}
|
|
1624
|
-
}
|
|
1625
|
-
return { verified: false, reason: "Fingerprint token not found in TXT records" };
|
|
1626
|
-
} catch (err) {
|
|
1627
|
-
return { verified: false, reason: `DNS fetch failed: ${err.message}` };
|
|
1628
|
-
}
|
|
1629
|
-
}
|
|
1630
|
-
var FARCASTER_HUB = "https://haatz.quilibrium.com";
|
|
1631
|
-
var NEYNAR_HUB = "https://hub-api.neynar.com";
|
|
1632
|
-
function farcasterSource(opts) {
|
|
1633
|
-
if (opts.farcasterHub) return { base: opts.farcasterHub.replace(/\/+$/, ""), headers: {} };
|
|
1634
|
-
if (opts.neynarApiKey) return { base: NEYNAR_HUB, headers: { "x-api-key": opts.neynarApiKey } };
|
|
1635
|
-
return { base: FARCASTER_HUB, headers: {} };
|
|
1636
|
-
}
|
|
1637
|
-
async function verifyFarcaster(proof, fingerprint, opts = {}) {
|
|
1638
|
-
const { base, headers } = farcasterSource(opts);
|
|
1639
|
-
const host = base.replace(/^https?:\/\//, "");
|
|
1640
|
-
try {
|
|
1641
|
-
const nameResp = await fetch(`${base}/v1/userNameProofByName?name=${encodeURIComponent(proof.user)}`, { headers });
|
|
1642
|
-
if (nameResp.status === 404) return { verified: false, reason: `Could not resolve Farcaster user "${proof.user}"` };
|
|
1643
|
-
if (!nameResp.ok) return { verified: false, reason: `Couldn't check: the Farcaster node (${host}) returned ${nameResp.status}` };
|
|
1644
|
-
const fid = (await nameResp.json()).fid;
|
|
1645
|
-
if (!fid) return { verified: false, reason: `Could not resolve Farcaster user "${proof.user}"` };
|
|
1646
|
-
let pageToken = "";
|
|
1647
|
-
for (let page = 0; page < 5; page++) {
|
|
1648
|
-
const url = `${base}/v1/castsByFid?fid=${fid}&pageSize=100&reverse=true${pageToken ? `&pageToken=${pageToken}` : ""}`;
|
|
1649
|
-
const resp = await fetch(url, { headers });
|
|
1650
|
-
if (!resp.ok) return { verified: false, reason: `Couldn't check: the Farcaster node (${host}) returned ${resp.status}` };
|
|
1651
|
-
const data = await resp.json();
|
|
1652
|
-
for (const msg of data.messages || []) {
|
|
1653
|
-
if (msg.hash && msg.hash.startsWith(proof.castHash)) {
|
|
1654
|
-
const text = _optionalChain([msg, 'access', _25 => _25.data, 'optionalAccess', _26 => _26.castAddBody, 'optionalAccess', _27 => _27.text]) || "";
|
|
1655
|
-
if (containsFingerprint(text, fingerprint)) {
|
|
1656
|
-
return { verified: true };
|
|
1657
|
-
}
|
|
1658
|
-
}
|
|
1659
|
-
}
|
|
1660
|
-
if (!data.nextPageToken) break;
|
|
1661
|
-
pageToken = data.nextPageToken;
|
|
1662
|
-
}
|
|
1663
|
-
return { verified: false, reason: "Cast not found" };
|
|
1664
|
-
} catch (err) {
|
|
1665
|
-
return { verified: false, reason: `Couldn't check: the Farcaster node (${host}) didn't answer (${err.message})` };
|
|
1666
|
-
}
|
|
1667
|
-
}
|
|
1668
|
-
async function verifyCodeberg(proof, fingerprint) {
|
|
1669
|
-
try {
|
|
1670
|
-
const resp = await fetch(
|
|
1671
|
-
`https://codeberg.org/api/v1/repos/${encodeURIComponent(proof.user)}/${encodeURIComponent(proof.repo)}`
|
|
1672
|
-
);
|
|
1673
|
-
if (!resp.ok) return { verified: false, reason: `Codeberg API returned ${resp.status}` };
|
|
1674
|
-
const data = await resp.json();
|
|
1675
|
-
if (data.description && containsFingerprint(data.description, fingerprint)) {
|
|
1676
|
-
return { verified: true };
|
|
1677
|
-
}
|
|
1678
|
-
return { verified: false, reason: "Fingerprint token not found in repo description" };
|
|
1679
|
-
} catch (err) {
|
|
1680
|
-
return { verified: false, reason: `Codeberg fetch failed: ${err.message}` };
|
|
1681
|
-
}
|
|
1682
|
-
}
|
|
1683
|
-
async function verifyMastodon(proof, fingerprint) {
|
|
1684
|
-
try {
|
|
1685
|
-
if (!proof.instance || !/^[a-z0-9.-]+(?::\d+)?$/i.test(proof.instance)) {
|
|
1686
|
-
return { verified: false, reason: "Invalid Mastodon instance host" };
|
|
1687
|
-
}
|
|
1688
|
-
const resp = await fetch(
|
|
1689
|
-
`https://${proof.instance}/api/v1/accounts/lookup?acct=${encodeURIComponent(proof.user)}`
|
|
1690
|
-
);
|
|
1691
|
-
if (!resp.ok) return { verified: false, reason: `Mastodon API returned ${resp.status}` };
|
|
1692
|
-
const data = await resp.json();
|
|
1693
|
-
const keyId = keyIdHex(fingerprint.replace(/^0x/i, "").replace(/\s+/g, "").toLowerCase());
|
|
1694
|
-
for (const field of data.fields || []) {
|
|
1695
|
-
const text = field.value.replace(/<[^>]*>/g, "");
|
|
1696
|
-
if (containsFingerprintUrl(text, fingerprint) || containsFingerprintUrl(text, keyId)) {
|
|
1697
|
-
return { verified: true };
|
|
1698
|
-
}
|
|
1699
|
-
}
|
|
1700
|
-
if (data.note) {
|
|
1701
|
-
const text = data.note.replace(/<[^>]*>/g, "");
|
|
1702
|
-
if (containsFingerprintUrl(text, fingerprint) || containsFingerprintUrl(text, keyId)) {
|
|
1703
|
-
return { verified: true };
|
|
1704
|
-
}
|
|
1705
|
-
}
|
|
1706
|
-
return { verified: false, reason: "Fingerprint not found in profile fields or bio" };
|
|
1707
|
-
} catch (err) {
|
|
1708
|
-
return { verified: false, reason: `Mastodon fetch failed: ${err.message}` };
|
|
1709
|
-
}
|
|
1710
|
-
}
|
|
1711
|
-
var verifiers = {
|
|
1712
|
-
github: verifyGitHub,
|
|
1713
|
-
dns: verifyDNS,
|
|
1714
|
-
farcaster: verifyFarcaster,
|
|
1715
|
-
codeberg: verifyCodeberg,
|
|
1716
|
-
mastodon: verifyMastodon
|
|
1717
|
-
};
|
|
1718
|
-
async function verifyProof(proof, fingerprint, opts) {
|
|
1719
|
-
const fn = verifiers[proof.provider];
|
|
1720
|
-
if (!fn) return { verified: false, reason: "Unknown provider" };
|
|
1721
|
-
return fn(proof, fingerprint, typeof opts === "string" ? { neynarApiKey: opts } : _nullishCoalesce(opts, () => ( {})));
|
|
1722
|
-
}
|
|
1723
|
-
|
|
1724
|
-
// src/core/avatar.ts
|
|
1725
|
-
var IPFS_GATEWAYS = ["https://ipfs.filebase.io/ipfs/", "https://gateway.pinata.cloud/ipfs/"];
|
|
1726
|
-
var IPFS_GATEWAY = IPFS_GATEWAYS[0];
|
|
1727
|
-
var ARWEAVE_GATEWAY = "https://arweave.net/";
|
|
1728
|
-
function avatarUrl(uri) {
|
|
1729
|
-
if (typeof uri !== "string") return null;
|
|
1730
|
-
const u = uri.trim();
|
|
1731
|
-
if (/^data:image\/(png|jpe?g|gif|webp|avif|svg\+xml)[;,]/i.test(u)) return u;
|
|
1732
|
-
let m = u.match(/^ipfs:\/\/(?:ipfs\/)?([a-zA-Z0-9]{46,}(?:\/[^?#\s]*)?)$/);
|
|
1733
|
-
if (m) return IPFS_GATEWAY + m[1];
|
|
1734
|
-
m = u.match(/^ar:\/\/([a-zA-Z0-9_-]{43}(?:\/[^?#\s]*)?)$/);
|
|
1735
|
-
if (m) return ARWEAVE_GATEWAY + m[1];
|
|
1736
|
-
if (/^https:\/\/euc\.li\/[^?#\s]+$/.test(u)) return u;
|
|
1737
|
-
m = u.match(/^https:\/\/[^/]+\/ipfs\/([a-zA-Z0-9]{46,}(?:\/[^?#\s]*)?)$/);
|
|
1738
|
-
if (m) return IPFS_GATEWAY + m[1];
|
|
1739
|
-
return null;
|
|
1740
|
-
}
|
|
1741
|
-
function avatarFallbacks(url) {
|
|
1742
|
-
if (!url || !url.startsWith(IPFS_GATEWAYS[0])) return [];
|
|
1743
|
-
const path = url.slice(IPFS_GATEWAYS[0].length);
|
|
1744
|
-
return IPFS_GATEWAYS.slice(1).map((g) => g + path);
|
|
1745
|
-
}
|
|
1746
|
-
function parseNftAvatar(raw) {
|
|
1747
|
-
const m = typeof raw === "string" && raw.trim().match(/^eip155:(\d+)\/(erc721|erc1155):(0x[0-9a-fA-F]{40})\/(\d+)$/i);
|
|
1748
|
-
return m ? { chainId: Number(m[1]), standard: m[2].toLowerCase(), contract: m[3], tokenId: BigInt(m[4]) } : null;
|
|
1749
|
-
}
|
|
1750
|
-
var NFT_AVATAR_ABI = [
|
|
1751
|
-
{ type: "function", name: "tokenURI", stateMutability: "view", inputs: [{ type: "uint256" }], outputs: [{ type: "string" }] },
|
|
1752
|
-
{ type: "function", name: "uri", stateMutability: "view", inputs: [{ type: "uint256" }], outputs: [{ type: "string" }] }
|
|
1753
|
-
];
|
|
1754
|
-
async function nftAvatarImage(tokenUri, tokenId, fetchFn = fetch) {
|
|
1755
|
-
const uri = tokenUri.replace("{id}", tokenId.toString(16).padStart(64, "0"));
|
|
1756
|
-
let meta;
|
|
1757
|
-
const inline = uri.match(/^data:application\/json(;base64)?,([\s\S]*)$/);
|
|
1758
|
-
if (inline) meta = JSON.parse(inline[1] ? atob(inline[2]) : decodeURIComponent(inline[2]));
|
|
1759
|
-
else {
|
|
1760
|
-
const url = uri.startsWith("data:") ? null : avatarUrl(uri);
|
|
1761
|
-
if (!url) return null;
|
|
1762
|
-
for (const candidate of [url, ...avatarFallbacks(url)]) {
|
|
1763
|
-
try {
|
|
1764
|
-
const res = await fetchFn(candidate);
|
|
1765
|
-
if (res.ok) {
|
|
1766
|
-
meta = await res.json();
|
|
1767
|
-
break;
|
|
1768
|
-
}
|
|
1769
|
-
} catch (e8) {
|
|
1770
|
-
}
|
|
1771
|
-
}
|
|
1772
|
-
if (!meta) return null;
|
|
1773
|
-
}
|
|
1774
|
-
return avatarUrl(_nullishCoalesce(_optionalChain([meta, 'optionalAccess', _28 => _28.image]), () => ( _optionalChain([meta, 'optionalAccess', _29 => _29.image_url]))));
|
|
1775
|
-
}
|
|
1776
|
-
|
|
1777
|
-
// src/core/ensHint.ts
|
|
1778
|
-
var _ens = require('viem/ens');
|
|
1779
|
-
var ENS_HINT_KEY = "id.thurin";
|
|
1780
|
-
function ensHintFor(record, verifiedFingerprint) {
|
|
1781
|
-
const raw = _nullishCoalesce(_optionalChain([record, 'optionalAccess', _30 => _30.trim, 'call', _31 => _31()]), () => ( ""));
|
|
1782
|
-
const expected = verifiedFingerprint ? normalizeFingerprint(verifiedFingerprint) : null;
|
|
1783
|
-
if (!raw) return { key: ENS_HINT_KEY, state: "unset", record: null, fingerprint: null, expected };
|
|
1784
|
-
const fingerprint = normalizeFingerprint(raw);
|
|
1785
|
-
if (!fingerprint) return { key: ENS_HINT_KEY, state: "mismatch", record: raw, fingerprint: null, expected, reason: "The record is not a PGP fingerprint" };
|
|
1786
|
-
if (!expected) return { key: ENS_HINT_KEY, state: "mismatch", record: raw, fingerprint, expected, reason: "The address has no verified claim" };
|
|
1787
|
-
if (fingerprint === expected) return { key: ENS_HINT_KEY, state: "match", record: raw, fingerprint, expected };
|
|
1788
|
-
return { key: ENS_HINT_KEY, state: "mismatch", record: raw, fingerprint, expected, reason: "The record names a key this address has not claimed" };
|
|
1789
|
-
}
|
|
1790
|
-
function ensHintValue(fingerprint) {
|
|
1791
|
-
const fp = normalizeFingerprint(fingerprint);
|
|
1792
|
-
if (!fp) throw new Error(`Not a fingerprint: ${fingerprint}`);
|
|
1793
|
-
return fp.toUpperCase();
|
|
1794
|
-
}
|
|
1795
|
-
var ENS_TEXT_RESOLVER_ABI = [
|
|
1796
|
-
{ type: "function", name: "text", stateMutability: "view", inputs: [{ name: "node", type: "bytes32" }, { name: "key", type: "string" }], outputs: [{ name: "", type: "string" }] },
|
|
1797
|
-
{ type: "function", name: "setText", stateMutability: "nonpayable", inputs: [{ name: "node", type: "bytes32" }, { name: "key", type: "string" }, { name: "value", type: "string" }], outputs: [] }
|
|
1798
|
-
];
|
|
1799
|
-
function ensHintWrite(name, fingerprint) {
|
|
1800
|
-
const normalized = _ens.normalize.call(void 0, name);
|
|
1801
|
-
return {
|
|
1802
|
-
abi: ENS_TEXT_RESOLVER_ABI,
|
|
1803
|
-
functionName: "setText",
|
|
1804
|
-
args: [_ens.namehash.call(void 0, normalized), ENS_HINT_KEY, ensHintValue(fingerprint)],
|
|
1805
|
-
name: normalized
|
|
1806
|
-
};
|
|
1807
|
-
}
|
|
1808
|
-
async function fetchEnsHint(client, name, verifiedFingerprint) {
|
|
1809
|
-
const record = await client.getEnsText({ name: _ens.normalize.call(void 0, name), key: ENS_HINT_KEY });
|
|
1810
|
-
return ensHintFor(record, verifiedFingerprint);
|
|
1811
|
-
}
|
|
1812
|
-
|
|
1813
|
-
// src/core/authorization.ts
|
|
1814
|
-
|
|
1815
|
-
var EIP712_NAME = "Thurin PGPRegistry";
|
|
1816
|
-
var EIP712_VERSION = "2";
|
|
1817
|
-
function registryDomain(chainId, verifyingContract) {
|
|
1818
|
-
return { name: EIP712_NAME, version: EIP712_VERSION, chainId, verifyingContract };
|
|
1819
|
-
}
|
|
1820
|
-
var AUTHORIZATION_TYPES = {
|
|
1821
|
-
Attest: [
|
|
1822
|
-
{ name: "owner", type: "address" },
|
|
1823
|
-
{ name: "fingerprint", type: "bytes" },
|
|
1824
|
-
{ name: "pgpSignature", type: "bytes" },
|
|
1825
|
-
{ name: "pgpPublicKey", type: "bytes" },
|
|
1826
|
-
{ name: "nonce", type: "uint256" },
|
|
1827
|
-
{ name: "deadline", type: "uint256" }
|
|
1828
|
-
],
|
|
1829
|
-
Reattest: [
|
|
1830
|
-
{ name: "owner", type: "address" },
|
|
1831
|
-
{ name: "revokeIndex", type: "uint256" },
|
|
1832
|
-
{ name: "fingerprint", type: "bytes" },
|
|
1833
|
-
{ name: "pgpSignature", type: "bytes" },
|
|
1834
|
-
{ name: "pgpPublicKey", type: "bytes" },
|
|
1835
|
-
{ name: "nonce", type: "uint256" },
|
|
1836
|
-
{ name: "deadline", type: "uint256" }
|
|
1837
|
-
],
|
|
1838
|
-
UpdateKey: [
|
|
1839
|
-
{ name: "owner", type: "address" },
|
|
1840
|
-
{ name: "index", type: "uint256" },
|
|
1841
|
-
{ name: "pgpPublicKey", type: "bytes" },
|
|
1842
|
-
{ name: "nonce", type: "uint256" },
|
|
1843
|
-
{ name: "deadline", type: "uint256" }
|
|
1844
|
-
],
|
|
1845
|
-
Revoke: [
|
|
1846
|
-
{ name: "owner", type: "address" },
|
|
1847
|
-
{ name: "index", type: "uint256" },
|
|
1848
|
-
{ name: "nonce", type: "uint256" },
|
|
1849
|
-
{ name: "deadline", type: "uint256" }
|
|
1850
|
-
],
|
|
1851
|
-
SetRecord: [
|
|
1852
|
-
{ name: "owner", type: "address" },
|
|
1853
|
-
{ name: "index", type: "uint256" },
|
|
1854
|
-
{ name: "kind", type: "bytes32" },
|
|
1855
|
-
{ name: "value", type: "bytes" },
|
|
1856
|
-
{ name: "nonce", type: "uint256" },
|
|
1857
|
-
{ name: "deadline", type: "uint256" }
|
|
1858
|
-
]
|
|
1859
|
-
};
|
|
1860
|
-
function attestTypedData(chainId, registry, a) {
|
|
1861
|
-
return {
|
|
1862
|
-
domain: registryDomain(chainId, registry),
|
|
1863
|
-
types: { Attest: AUTHORIZATION_TYPES.Attest },
|
|
1864
|
-
primaryType: "Attest",
|
|
1865
|
-
message: {
|
|
1866
|
-
owner: a.owner,
|
|
1867
|
-
fingerprint: fingerprintToBytes(a.fingerprint),
|
|
1868
|
-
pgpSignature: _viem.stringToHex.call(void 0, a.pgpSignature),
|
|
1869
|
-
pgpPublicKey: _viem.stringToHex.call(void 0, a.pgpPublicKey),
|
|
1870
|
-
nonce: a.nonce,
|
|
1871
|
-
deadline: a.deadline
|
|
1872
|
-
}
|
|
1873
|
-
};
|
|
1874
|
-
}
|
|
1875
|
-
function reattestTypedData(chainId, registry, a) {
|
|
1876
|
-
const base = attestTypedData(chainId, registry, a);
|
|
1877
|
-
return {
|
|
1878
|
-
domain: base.domain,
|
|
1879
|
-
types: { Reattest: AUTHORIZATION_TYPES.Reattest },
|
|
1880
|
-
primaryType: "Reattest",
|
|
1881
|
-
message: { ...base.message, revokeIndex: a.revokeIndex }
|
|
1882
|
-
};
|
|
1883
|
-
}
|
|
1884
|
-
function updateKeyTypedData(chainId, registry, a) {
|
|
1885
|
-
return {
|
|
1886
|
-
domain: registryDomain(chainId, registry),
|
|
1887
|
-
types: { UpdateKey: AUTHORIZATION_TYPES.UpdateKey },
|
|
1888
|
-
primaryType: "UpdateKey",
|
|
1889
|
-
message: { owner: a.owner, index: a.index, pgpPublicKey: _viem.stringToHex.call(void 0, a.pgpPublicKey), nonce: a.nonce, deadline: a.deadline }
|
|
1890
|
-
};
|
|
1891
|
-
}
|
|
1892
|
-
function revokeTypedData(chainId, registry, a) {
|
|
1893
|
-
return {
|
|
1894
|
-
domain: registryDomain(chainId, registry),
|
|
1895
|
-
types: { Revoke: AUTHORIZATION_TYPES.Revoke },
|
|
1896
|
-
primaryType: "Revoke",
|
|
1897
|
-
message: { owner: a.owner, index: a.index, nonce: a.nonce, deadline: a.deadline }
|
|
1898
|
-
};
|
|
1899
|
-
}
|
|
1900
|
-
function setRecordTypedData(chainId, registry, a) {
|
|
1901
|
-
return {
|
|
1902
|
-
domain: registryDomain(chainId, registry),
|
|
1903
|
-
types: { SetRecord: AUTHORIZATION_TYPES.SetRecord },
|
|
1904
|
-
primaryType: "SetRecord",
|
|
1905
|
-
message: { owner: a.owner, index: a.index, kind: a.kind, value: a.value, nonce: a.nonce, deadline: a.deadline }
|
|
1906
|
-
};
|
|
1907
|
-
}
|
|
1908
|
-
function authorizationDigest(typedData) {
|
|
1909
|
-
return _viem.hashTypedData.call(void 0, typedData);
|
|
1910
|
-
}
|
|
1911
|
-
function recordKind(name) {
|
|
1912
|
-
return _viem.keccak256.call(void 0, _viem.stringToHex.call(void 0, name));
|
|
1913
|
-
}
|
|
1914
|
-
|
|
1915
|
-
// src/core/records.ts
|
|
1916
|
-
|
|
1917
|
-
var MAX_RECORD_BYTES = 1024;
|
|
1918
|
-
function kindName(input) {
|
|
1919
|
-
return input.includes(".") ? input : `thurin.${input}`;
|
|
1920
|
-
}
|
|
1921
|
-
var KNOWN_KINDS = [
|
|
1922
|
-
"thurin.railgun",
|
|
1923
|
-
"thurin.security",
|
|
1924
|
-
"thurin.successor",
|
|
1925
|
-
"thurin.affiliation",
|
|
1926
|
-
"thurin.canary",
|
|
1927
|
-
"thurin.private",
|
|
1928
|
-
"thurin.disclosure",
|
|
1929
|
-
"thurin.pointer"
|
|
1930
|
-
];
|
|
1931
|
-
var IDENTITY_KINDS = [
|
|
1932
|
-
"thurin.railgun",
|
|
1933
|
-
"thurin.security",
|
|
1934
|
-
"thurin.successor",
|
|
1935
|
-
"thurin.affiliation",
|
|
1936
|
-
"thurin.canary",
|
|
1937
|
-
"thurin.private",
|
|
1938
|
-
"thurin.disclosure"
|
|
1939
|
-
];
|
|
1940
|
-
function encodeRecord(value) {
|
|
1941
|
-
const bytes = new TextEncoder().encode(value).length;
|
|
1942
|
-
if (bytes > MAX_RECORD_BYTES) throw new Error(`Record is ${bytes} bytes; the registry accepts up to ${MAX_RECORD_BYTES}`);
|
|
1943
|
-
return _viem.stringToHex.call(void 0, value);
|
|
1944
|
-
}
|
|
1945
|
-
function decodeRecord(hex) {
|
|
1946
|
-
return hex === "0x" ? "" : _viem.hexToString.call(void 0, hex);
|
|
1947
|
-
}
|
|
1948
|
-
function parsePointer(text) {
|
|
1949
|
-
const p = JSON.parse(text);
|
|
1950
|
-
if (_optionalChain([p, 'optionalAccess', _32 => _32.v]) !== 1 || !Array.isArray(p.releases)) throw new Error("Not a v1 thurin.pointer record");
|
|
1951
|
-
return p;
|
|
1952
|
-
}
|
|
1953
|
-
function addPointer(existing, entry) {
|
|
1954
|
-
if (!/^[0-9a-f]{64}$/i.test(entry.sha256)) throw new Error("sha256 must be 64 hex characters");
|
|
1955
|
-
const releases = [entry, ...(_nullishCoalesce(_optionalChain([existing, 'optionalAccess', _33 => _33.releases]), () => ( []))).filter((r) => r.name !== entry.name)];
|
|
1956
|
-
const dropped = [];
|
|
1957
|
-
const record = { v: 1, releases };
|
|
1958
|
-
while (new TextEncoder().encode(JSON.stringify(record)).length > MAX_RECORD_BYTES && releases.length > 1) dropped.push(releases.pop());
|
|
1959
|
-
return { record, dropped };
|
|
1960
|
-
}
|
|
1961
|
-
function renderPointer(p) {
|
|
1962
|
-
return p.releases.map((r) => `${r.name.padEnd(22)} ${r.date} sha256 ${r.sha256}${r.url ? ` ${r.url}` : ""}`).join("\n");
|
|
1963
|
-
}
|
|
1964
|
-
var RAILGUN_ADDRESS = /^0zk1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{60,200}$/;
|
|
1965
|
-
var ISO_DATE = /\b(\d{4}-\d{2}-\d{2})\b/;
|
|
1966
|
-
async function parseRecord(kind, text, opts = {}) {
|
|
1967
|
-
const bytes = new TextEncoder().encode(text).length;
|
|
1968
|
-
const base = { kind, text, bytes };
|
|
1969
|
-
const invalid = (reason, data = { type: "text" }) => ({ ...base, valid: false, reason, data });
|
|
1970
|
-
const t = text.trim();
|
|
1971
|
-
switch (kind) {
|
|
1972
|
-
case "thurin.railgun": {
|
|
1973
|
-
if (!RAILGUN_ADDRESS.test(t)) return invalid("Not a 0zk address");
|
|
1974
|
-
return { ...base, valid: true, data: { type: "railgun", address: t } };
|
|
1975
|
-
}
|
|
1976
|
-
case "thurin.security": {
|
|
1977
|
-
if (!t) return invalid("Empty");
|
|
1978
|
-
const url = /^https?:\/\/\S+$/.test(t) ? t : null;
|
|
1979
|
-
return { ...base, valid: true, data: { type: "security", contact: t, url } };
|
|
1980
|
-
}
|
|
1981
|
-
case "thurin.successor": {
|
|
1982
|
-
const fp = normalizeFingerprint(t);
|
|
1983
|
-
if (!fp) return invalid("Not a PGP fingerprint");
|
|
1984
|
-
return { ...base, valid: true, data: { type: "successor", fingerprint: fp } };
|
|
1985
|
-
}
|
|
1986
|
-
case "thurin.affiliation": {
|
|
1987
|
-
try {
|
|
1988
|
-
const j = JSON.parse(t);
|
|
1989
|
-
if (_optionalChain([j, 'optionalAccess', _34 => _34.v]) !== 1 || typeof j.with !== "string" || !j.with) return invalid('Not a v1 affiliation: expected {"v":1,"with":"<address or name>"}');
|
|
1990
|
-
return { ...base, valid: true, data: { type: "affiliation", with: j.with, role: typeof j.role === "string" ? j.role : null } };
|
|
1991
|
-
} catch (e9) {
|
|
1992
|
-
return invalid("Not JSON");
|
|
1993
|
-
}
|
|
1994
|
-
}
|
|
1995
|
-
case "thurin.canary": {
|
|
1996
|
-
const date = _optionalChain([t, 'access', _35 => _35.match, 'call', _36 => _36(ISO_DATE), 'optionalAccess', _37 => _37[1]]);
|
|
1997
|
-
if (!date) return invalid("No date in the statement");
|
|
1998
|
-
const clearsigned = t.startsWith("-----BEGIN PGP SIGNED MESSAGE-----");
|
|
1999
|
-
let statement = clearsigned ? (_nullishCoalesce(t.split(/\r?\n\r?\n/)[1], () => ( ""))).split("-----BEGIN PGP SIGNATURE-----")[0].trim() : t;
|
|
2000
|
-
let verified = null, reason;
|
|
2001
|
-
if (clearsigned && opts.armoredKey) {
|
|
2002
|
-
const v = await verifyClearsigned({ armoredKey: opts.armoredKey, clearsigned: t });
|
|
2003
|
-
verified = v.verified;
|
|
2004
|
-
reason = v.reason;
|
|
2005
|
-
if (v.text) statement = v.text.trim();
|
|
2006
|
-
}
|
|
2007
|
-
return { ...base, valid: true, data: { type: "canary", date, statement, clearsigned, verified, ...reason ? { reason } : {} } };
|
|
2008
|
-
}
|
|
2009
|
-
case "thurin.private":
|
|
2010
|
-
case "thurin.disclosure": {
|
|
2011
|
-
if (!t.startsWith("-----BEGIN PGP MESSAGE-----")) return invalid("Not a PGP message");
|
|
2012
|
-
let recipients = null;
|
|
2013
|
-
try {
|
|
2014
|
-
const { readMessage } = await Promise.resolve().then(() => _interopRequireWildcard(require("openpgp")));
|
|
2015
|
-
recipients = (await readMessage({ armoredMessage: t })).getEncryptionKeyIDs().length;
|
|
2016
|
-
} catch (e10) {
|
|
2017
|
-
return invalid("PGP message does not parse");
|
|
2018
|
-
}
|
|
2019
|
-
return { ...base, valid: true, data: { type: "encrypted", recipients } };
|
|
2020
|
-
}
|
|
2021
|
-
case "thurin.pointer": {
|
|
2022
|
-
try {
|
|
2023
|
-
return { ...base, valid: true, data: { type: "pointer", releases: parsePointer(t).releases } };
|
|
2024
|
-
} catch (e11) {
|
|
2025
|
-
return invalid("Not a v1 pointer record");
|
|
2026
|
-
}
|
|
2027
|
-
}
|
|
2028
|
-
default:
|
|
2029
|
-
return { ...base, valid: true, data: { type: "text" } };
|
|
2030
|
-
}
|
|
2031
|
-
}
|
|
2032
|
-
async function fetchRecords(client, registry, abi, owner, index, kinds = IDENTITY_KINDS, opts = {}) {
|
|
2033
|
-
const out = [];
|
|
2034
|
-
for (const kind of kinds) {
|
|
2035
|
-
const hex = await client.readContract({ address: registry, abi, functionName: "record", args: [owner, BigInt(index), recordKind(kind)] });
|
|
2036
|
-
const text = decodeRecord(hex);
|
|
2037
|
-
if (text) out.push(await parseRecord(kind, text, opts));
|
|
2038
|
-
}
|
|
2039
|
-
return out;
|
|
2040
|
-
}
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
exports.REGISTRY_ABI = REGISTRY_ABI; exports.REGISTRY_ADDRESS = REGISTRY_ADDRESS; exports.NETWORKS = NETWORKS; exports.isNetworkName = isNetworkName; exports.getRegistry = getRegistry; exports.chainFor = chainFor; exports.needsRpcProbe = needsRpcProbe; exports.identityErrorKind = identityErrorKind; exports.IDENTITY_ERROR_TEXT = IDENTITY_ERROR_TEXT; exports.normalizeFingerprint = normalizeFingerprint; exports.fingerprintToBytes = fingerprintToBytes; exports.bytesToFingerprint = bytesToFingerprint; exports.fingerprintHash = fingerprintHash; exports.keyIdOf = keyIdOf; exports.keyIdToBytes = keyIdToBytes; exports.parsePgpKey = parsePgpKey; exports.verifyClearsigned = verifyClearsigned; exports.verifyAttestation = verifyAttestation; exports.stripEmailUserIDs = stripEmailUserIDs; exports.hasEmailUserID = hasEmailUserID; exports.fetchEFPGraph = fetchEFPGraph; exports.identifyProof = identifyProof; exports.displayUrl = displayUrl; exports.proofHref = proofHref; exports.proofSecondaryHref = proofSecondaryHref; exports.FARCASTER_HUB = FARCASTER_HUB; exports.verifyProof = verifyProof; exports.IPFS_GATEWAYS = IPFS_GATEWAYS; exports.IPFS_GATEWAY = IPFS_GATEWAY; exports.ARWEAVE_GATEWAY = ARWEAVE_GATEWAY; exports.avatarUrl = avatarUrl; exports.avatarFallbacks = avatarFallbacks; exports.parseNftAvatar = parseNftAvatar; exports.NFT_AVATAR_ABI = NFT_AVATAR_ABI; exports.nftAvatarImage = nftAvatarImage; exports.ENS_HINT_KEY = ENS_HINT_KEY; exports.ensHintFor = ensHintFor; exports.ensHintValue = ensHintValue; exports.ENS_TEXT_RESOLVER_ABI = ENS_TEXT_RESOLVER_ABI; exports.ensHintWrite = ensHintWrite; exports.fetchEnsHint = fetchEnsHint; exports.EIP712_NAME = EIP712_NAME; exports.EIP712_VERSION = EIP712_VERSION; exports.registryDomain = registryDomain; exports.AUTHORIZATION_TYPES = AUTHORIZATION_TYPES; exports.attestTypedData = attestTypedData; exports.reattestTypedData = reattestTypedData; exports.updateKeyTypedData = updateKeyTypedData; exports.revokeTypedData = revokeTypedData; exports.setRecordTypedData = setRecordTypedData; exports.authorizationDigest = authorizationDigest; exports.recordKind = recordKind; exports.MAX_RECORD_BYTES = MAX_RECORD_BYTES; exports.kindName = kindName; exports.KNOWN_KINDS = KNOWN_KINDS; exports.IDENTITY_KINDS = IDENTITY_KINDS; exports.encodeRecord = encodeRecord; exports.decodeRecord = decodeRecord; exports.parsePointer = parsePointer; exports.addPointer = addPointer; exports.renderPointer = renderPointer; exports.parseRecord = parseRecord; exports.fetchRecords = fetchRecords;
|
|
2107
|
-
//# sourceMappingURL=chunk-OIE72R6J.cjs.map
|