@thurinlabs/identity-kit 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/embed.global.js +27 -0
- package/dist/embed.global.js.map +1 -1
- package/dist/index.cjs +36 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -258,7 +258,7 @@ The card talks directly to Ethereum and each proof platform — no intermediary,
|
|
|
258
258
|
|
|
259
259
|
| Provider | Proof Method |
|
|
260
260
|
|----------|-------------|
|
|
261
|
-
| GitHub | Public gist |
|
|
261
|
+
| GitHub | Public gist, or a repository description (the form an organisation can use) |
|
|
262
262
|
| DNS | TXT record |
|
|
263
263
|
| Farcaster | Public cast (requires Neynar API key) |
|
|
264
264
|
| Codeberg | Repository description |
|
package/dist/embed.global.js
CHANGED
|
@@ -31376,6 +31376,14 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
31376
31376
|
pattern: /^https:\/\/gist\.github\.com\/([^/]+)\/([a-f0-9]+)$/i,
|
|
31377
31377
|
parse: (m2) => ({ user: m2[1], gistId: m2[2] })
|
|
31378
31378
|
},
|
|
31379
|
+
{
|
|
31380
|
+
// A repository's description — the form an organisation can use, since
|
|
31381
|
+
// gists belong to user accounts only. Same shape as the Codeberg proof.
|
|
31382
|
+
provider: "github",
|
|
31383
|
+
label: "GitHub",
|
|
31384
|
+
pattern: /^https:\/\/github\.com\/([A-Za-z0-9-]+)\/([A-Za-z0-9._-]+)$/i,
|
|
31385
|
+
parse: (m2) => ({ user: m2[1], repo: m2[2] })
|
|
31386
|
+
},
|
|
31379
31387
|
{
|
|
31380
31388
|
provider: "dns",
|
|
31381
31389
|
label: "DNS",
|
|
@@ -31447,6 +31455,7 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
31447
31455
|
return text.toUpperCase().includes(fingerprint.toUpperCase());
|
|
31448
31456
|
}
|
|
31449
31457
|
async function verifyGitHub(proof, fingerprint) {
|
|
31458
|
+
if (proof.repo) return verifyGitHubRepo(proof, fingerprint);
|
|
31450
31459
|
try {
|
|
31451
31460
|
const resp = await fetch(`https://api.github.com/gists/${proof.gistId}`);
|
|
31452
31461
|
if (!resp.ok) return { verified: false, reason: `GitHub API returned ${resp.status}` };
|
|
@@ -31464,6 +31473,24 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
31464
31473
|
return { verified: false, reason: `GitHub fetch failed: ${err.message}` };
|
|
31465
31474
|
}
|
|
31466
31475
|
}
|
|
31476
|
+
async function verifyGitHubRepo(proof, fingerprint) {
|
|
31477
|
+
try {
|
|
31478
|
+
const resp = await fetch(
|
|
31479
|
+
`https://api.github.com/repos/${encodeURIComponent(proof.user)}/${encodeURIComponent(proof.repo)}`
|
|
31480
|
+
);
|
|
31481
|
+
if (!resp.ok) return { verified: false, reason: `GitHub API returned ${resp.status}` };
|
|
31482
|
+
const data = await resp.json();
|
|
31483
|
+
if (data.owner?.login?.toLowerCase() !== proof.user.toLowerCase()) {
|
|
31484
|
+
return { verified: false, reason: "Repository owner does not match claimed account" };
|
|
31485
|
+
}
|
|
31486
|
+
if (data.description && containsFingerprint(data.description, fingerprint)) {
|
|
31487
|
+
return { verified: true };
|
|
31488
|
+
}
|
|
31489
|
+
return { verified: false, reason: "Fingerprint token not found in repository description" };
|
|
31490
|
+
} catch (err) {
|
|
31491
|
+
return { verified: false, reason: `GitHub fetch failed: ${err.message}` };
|
|
31492
|
+
}
|
|
31493
|
+
}
|
|
31467
31494
|
async function verifyDNS(proof, fingerprint) {
|
|
31468
31495
|
try {
|
|
31469
31496
|
const resp = await fetch(
|