@agenticprimitives/verifiable-credentials 0.0.0-alpha.10
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/LICENSE +21 -0
- package/README.md +45 -0
- package/dist/canonical.d.ts +34 -0
- package/dist/canonical.d.ts.map +1 -0
- package/dist/canonical.js +146 -0
- package/dist/canonical.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/proof.d.ts +90 -0
- package/dist/proof.d.ts.map +1 -0
- package/dist/proof.js +127 -0
- package/dist/proof.js.map +1 -0
- package/dist/schema.d.ts +35 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +61 -0
- package/dist/schema.js.map +1 -0
- package/dist/situation.d.ts +48 -0
- package/dist/situation.d.ts.map +1 -0
- package/dist/situation.js +36 -0
- package/dist/situation.js.map +1 -0
- package/dist/types.d.ts +149 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +39 -0
- package/dist/types.js.map +1 -0
- package/dist/verifier.d.ts +90 -0
- package/dist/verifier.d.ts.map +1 -0
- package/dist/verifier.js +207 -0
- package/dist/verifier.js.map +1 -0
- package/package.json +58 -0
- package/spec.md +5 -0
package/dist/verifier.js
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Verifier — checks that a VC's proof is valid (findings VC-1 / VC-2, closed).
|
|
3
|
+
*
|
|
4
|
+
* `verifyCredential(vc, publicClient)` performs the ERC-1271 round-trip against
|
|
5
|
+
* the issuer SA on chain and FAILS CLOSED — `credentialHash` is mandatory, and
|
|
6
|
+
* the EIP-712 digest pins `verifyingContract` to the issuer SA + binds `chainId`,
|
|
7
|
+
* so an attacker can't substitute a different verifying domain. The structural
|
|
8
|
+
* helpers remain for callers that only need shape validation, but the authority
|
|
9
|
+
* check is `verifyCredential`; there is no fallback path (ADR-0013).
|
|
10
|
+
*
|
|
11
|
+
* Status-list resolution (StatusList2021): the verifier records whether a status
|
|
12
|
+
* entry was present + which list to fetch; the consumer fetches it (no silent
|
|
13
|
+
* fallback, ADR-0013).
|
|
14
|
+
*/
|
|
15
|
+
import { credentialHash, eip712Digest, isoToSeconds } from './proof.js';
|
|
16
|
+
/** Parse an `eip155:<chainId>:0x…40` CAIP-10 account id, or null. Both `vc.issuer` and the
|
|
17
|
+
* `verificationMethod` prefix use this form — the VC-2 domain-binding source of truth. */
|
|
18
|
+
export function parseEip155Caip10(ref) {
|
|
19
|
+
const m = /^eip155:(\d+):(0x[0-9a-fA-F]{40})$/.exec(ref);
|
|
20
|
+
if (!m)
|
|
21
|
+
return null;
|
|
22
|
+
return { chainId: Number(m[1]), address: m[2] };
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Structural verification — does NOT make a network call. Returns the
|
|
26
|
+
* expected digest + proof value the caller MUST forward to the issuer SA's
|
|
27
|
+
* `isValidSignatureNow` (or other ERC-1271-aware path).
|
|
28
|
+
*/
|
|
29
|
+
export function verifyCredentialStructural(vc) {
|
|
30
|
+
const issues = [];
|
|
31
|
+
if (!vc['@context'] || vc['@context'].length === 0) {
|
|
32
|
+
issues.push('missing @context');
|
|
33
|
+
}
|
|
34
|
+
if (!vc.type || vc.type[0] !== 'VerifiableCredential') {
|
|
35
|
+
issues.push('type[0] MUST be "VerifiableCredential"');
|
|
36
|
+
}
|
|
37
|
+
if (!vc.issuer)
|
|
38
|
+
issues.push('missing issuer');
|
|
39
|
+
if (!vc.validFrom)
|
|
40
|
+
issues.push('missing validFrom');
|
|
41
|
+
if (!vc.credentialSubject)
|
|
42
|
+
issues.push('missing credentialSubject');
|
|
43
|
+
const now = Math.floor(Date.now() / 1000);
|
|
44
|
+
// NEW-VC-2: enforce validFrom — a not-yet-active credential must NOT verify valid (the verifier
|
|
45
|
+
// previously gated only validUntil). NaN-safe: an unparseable validFrom fails closed.
|
|
46
|
+
if (vc.validFrom) {
|
|
47
|
+
const from = isoToSeconds(vc.validFrom);
|
|
48
|
+
if (!Number.isFinite(from)) {
|
|
49
|
+
issues.push(`validFrom is not a parseable date: ${vc.validFrom}`);
|
|
50
|
+
}
|
|
51
|
+
else if (from > now) {
|
|
52
|
+
issues.push(`credential not yet active (validFrom ${vc.validFrom})`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (vc.validUntil) {
|
|
56
|
+
const until = isoToSeconds(vc.validUntil);
|
|
57
|
+
if (!Number.isFinite(until)) {
|
|
58
|
+
issues.push(`validUntil is not a parseable date: ${vc.validUntil}`);
|
|
59
|
+
}
|
|
60
|
+
else if (until < now) {
|
|
61
|
+
issues.push(`credential expired at ${vc.validUntil}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (!vc.proof) {
|
|
65
|
+
return {
|
|
66
|
+
structural: false,
|
|
67
|
+
expectedDigest: null,
|
|
68
|
+
proofValue: null,
|
|
69
|
+
issuerCaip10: null,
|
|
70
|
+
statusListId: vc.credentialStatus?.statusListCredential ?? null,
|
|
71
|
+
issues: [...issues, 'missing proof'],
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if (vc.proof.type !== 'Eip712Signature2026') {
|
|
75
|
+
issues.push(`unsupported proof.type: ${vc.proof.type}`);
|
|
76
|
+
return {
|
|
77
|
+
structural: false,
|
|
78
|
+
expectedDigest: null,
|
|
79
|
+
proofValue: null,
|
|
80
|
+
issuerCaip10: null,
|
|
81
|
+
statusListId: vc.credentialStatus?.statusListCredential ?? null,
|
|
82
|
+
issues,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
const proof = vc.proof;
|
|
86
|
+
if (!proof.eip712Domain) {
|
|
87
|
+
issues.push('Eip712Signature2026 proof MUST carry eip712Domain (for cross-stack verification)');
|
|
88
|
+
return {
|
|
89
|
+
structural: false,
|
|
90
|
+
expectedDigest: null,
|
|
91
|
+
proofValue: null,
|
|
92
|
+
issuerCaip10: null,
|
|
93
|
+
statusListId: vc.credentialStatus?.statusListCredential ?? null,
|
|
94
|
+
issues,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
const bodyHash = credentialHash(vc);
|
|
98
|
+
// VC-1: `credentialHash` is MANDATORY — a forger must not be able to drop it to skip the
|
|
99
|
+
// body-integrity check. Missing OR mismatched is a structural failure.
|
|
100
|
+
if (!proof.credentialHash) {
|
|
101
|
+
issues.push('proof.credentialHash is required (binds the proof to the canonical credential body)');
|
|
102
|
+
}
|
|
103
|
+
else if (proof.credentialHash !== bodyHash) {
|
|
104
|
+
issues.push(`proof.credentialHash (${proof.credentialHash}) does not match canonical hash of credential body (${bodyHash})`);
|
|
105
|
+
}
|
|
106
|
+
// VC-2: the EIP-712 domain is attacker-supplied inside the proof. Bind it to the credential's
|
|
107
|
+
// declared `issuer` SA — the digest is meaningless if it can be computed against a contract /
|
|
108
|
+
// chain the attacker controls. `verifyingContract` MUST equal the issuer SA, `chainId` MUST equal
|
|
109
|
+
// the issuer's chain, and the `verificationMethod` address MUST resolve to the same SA.
|
|
110
|
+
const issuerAcct = parseEip155Caip10(vc.issuer);
|
|
111
|
+
if (!issuerAcct) {
|
|
112
|
+
issues.push(`vc.issuer is not a verifiable eip155 CAIP-10 account id: ${vc.issuer}`);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
if (proof.eip712Domain.verifyingContract.toLowerCase() !== issuerAcct.address.toLowerCase()) {
|
|
116
|
+
issues.push(`proof.eip712Domain.verifyingContract (${proof.eip712Domain.verifyingContract}) MUST equal the issuer SA (${issuerAcct.address})`);
|
|
117
|
+
}
|
|
118
|
+
if (proof.eip712Domain.chainId !== issuerAcct.chainId) {
|
|
119
|
+
issues.push(`proof.eip712Domain.chainId (${proof.eip712Domain.chainId}) MUST equal the issuer chainId (${issuerAcct.chainId})`);
|
|
120
|
+
}
|
|
121
|
+
const vmAcct = parseEip155Caip10(proof.verificationMethod.split('#')[0] ?? '');
|
|
122
|
+
if (!vmAcct || vmAcct.address.toLowerCase() !== issuerAcct.address.toLowerCase()) {
|
|
123
|
+
issues.push(`proof.verificationMethod (${proof.verificationMethod}) MUST resolve to the issuer SA (${issuerAcct.address})`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
const expectedDigest = eip712Digest({
|
|
127
|
+
credentialBodyHash: bodyHash,
|
|
128
|
+
issuer: vc.issuer,
|
|
129
|
+
validFrom: isoToSeconds(vc.validFrom),
|
|
130
|
+
validUntil: isoToSeconds(vc.validUntil),
|
|
131
|
+
proofPurpose: proof.proofPurpose,
|
|
132
|
+
chainId: proof.eip712Domain.chainId,
|
|
133
|
+
verifyingContract: proof.eip712Domain.verifyingContract,
|
|
134
|
+
});
|
|
135
|
+
const issuerCaip10 = parseCaip10IssuerFromVerificationMethod(proof.verificationMethod);
|
|
136
|
+
return {
|
|
137
|
+
structural: issues.length === 0,
|
|
138
|
+
expectedDigest,
|
|
139
|
+
proofValue: proof.proofValue,
|
|
140
|
+
issuerCaip10,
|
|
141
|
+
statusListId: vc.credentialStatus?.statusListCredential ?? null,
|
|
142
|
+
issues,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function parseCaip10IssuerFromVerificationMethod(method) {
|
|
146
|
+
// Format: `eip155:<chainId>:<address>#<keyName>`
|
|
147
|
+
const hashIdx = method.indexOf('#');
|
|
148
|
+
if (hashIdx === -1)
|
|
149
|
+
return null;
|
|
150
|
+
const ref = method.slice(0, hashIdx);
|
|
151
|
+
// Light sanity check
|
|
152
|
+
if (!/^eip155:\d+:0x[0-9a-fA-F]+$/.test(ref))
|
|
153
|
+
return null;
|
|
154
|
+
return ref;
|
|
155
|
+
}
|
|
156
|
+
export async function verifyCredential(vc, client, opts = {}) {
|
|
157
|
+
const structuralResult = verifyCredentialStructural(vc);
|
|
158
|
+
const issues = [...structuralResult.issues];
|
|
159
|
+
if (!structuralResult.structural || !structuralResult.expectedDigest || !structuralResult.proofValue) {
|
|
160
|
+
return { valid: false, structuralResult, issues };
|
|
161
|
+
}
|
|
162
|
+
const issuerAcct = parseEip155Caip10(vc.issuer);
|
|
163
|
+
if (!issuerAcct) {
|
|
164
|
+
issues.push('cannot resolve issuer SA for ERC-1271 verification');
|
|
165
|
+
return { valid: false, structuralResult, issues };
|
|
166
|
+
}
|
|
167
|
+
let ok;
|
|
168
|
+
try {
|
|
169
|
+
ok = await client.verifyHash({
|
|
170
|
+
address: issuerAcct.address,
|
|
171
|
+
hash: structuralResult.expectedDigest,
|
|
172
|
+
signature: structuralResult.proofValue,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
catch (e) {
|
|
176
|
+
issues.push(`ERC-1271 verification call failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
177
|
+
return { valid: false, structuralResult, issues };
|
|
178
|
+
}
|
|
179
|
+
if (!ok) {
|
|
180
|
+
issues.push('issuer ERC-1271 signature did not validate over the expected digest');
|
|
181
|
+
return { valid: false, structuralResult, issues };
|
|
182
|
+
}
|
|
183
|
+
// NEW-VC-1: a valid signature proves authorship, NOT current validity. If the VC declares a
|
|
184
|
+
// credentialStatus, confirm it is not revoked/suspended — fail closed when it can't be resolved.
|
|
185
|
+
if (vc.credentialStatus) {
|
|
186
|
+
if (opts.verifyStatus) {
|
|
187
|
+
let status;
|
|
188
|
+
try {
|
|
189
|
+
status = await opts.verifyStatus(vc.credentialStatus);
|
|
190
|
+
}
|
|
191
|
+
catch (e) {
|
|
192
|
+
issues.push(`credentialStatus resolution failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
193
|
+
return { valid: false, structuralResult, issues };
|
|
194
|
+
}
|
|
195
|
+
if (status.revoked) {
|
|
196
|
+
issues.push('credential is revoked/suspended per its credentialStatus');
|
|
197
|
+
return { valid: false, structuralResult, issues };
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
else if (!opts.allowUnresolvedStatus) {
|
|
201
|
+
issues.push('credentialStatus present but no status resolver injected — cannot confirm the credential is not revoked (fail-closed; pass allowUnresolvedStatus to override)');
|
|
202
|
+
return { valid: false, structuralResult, issues };
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return { valid: true, structuralResult, issues };
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=verifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifier.js","sourceRoot":"","sources":["../src/verifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAexE;2FAC2F;AAC3F,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC3C,MAAM,CAAC,GAAG,oCAAoC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzD,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACpB,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAkB,EAAE,CAAC;AACnE,CAAC;AAiBD;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAC,EAAwB;IACjE,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnD,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAClC,CAAC;IACD,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,sBAAsB,EAAE,CAAC;QACtD,MAAM,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC;IACxD,CAAC;IACD,IAAI,CAAC,EAAE,CAAC,MAAM;QAAE,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC9C,IAAI,CAAC,EAAE,CAAC,SAAS;QAAE,MAAM,CAAC,IAAI,CAAC,m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AC,IAAI,CAAC,uCAAuC,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;gBACjG,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,CAAC;YACpD,CAAC;YACD,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACnB,MAAM,CAAC,IAAI,CAAC,0DAA0D,CAAC,CAAC;gBACxE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,CAAC;YACpD,CAAC;QACH,CAAC;aAAM,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC;YACvC,MAAM,CAAC,IAAI,CACT,+JAA+J,CAChK,CAAC;YACF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,CAAC;QACpD,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,CAAC;AACnD,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agenticprimitives/verifiable-credentials",
|
|
3
|
+
"version": "0.0.0-alpha.10",
|
|
4
|
+
"description": "W3C Verifiable Credentials envelope + Eip712Signature2026 proof + DOLCE+DnS Situation bases + ontology-shape schema registration. Substrate for layers 12–15 credential types.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/agentictrustlabs/agenticprimitives.git",
|
|
9
|
+
"directory": "packages/verifiable-credentials"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/agentictrustlabs/agenticprimitives/tree/master/packages/verifiable-credentials",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/agentictrustlabs/agenticprimitives/issues"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"main": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"import": "./dist/index.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"LICENSE",
|
|
26
|
+
"dist",
|
|
27
|
+
"spec.md",
|
|
28
|
+
"README.md"
|
|
29
|
+
],
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"viem": "^2.52.2",
|
|
35
|
+
"@agenticprimitives/types": "1.0.0-alpha.13",
|
|
36
|
+
"@agenticprimitives/ontology": "1.0.0-alpha.13"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@noble/hashes": "^2.2.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"vitest": "^4.1.8",
|
|
43
|
+
"viem": "^2.52.2"
|
|
44
|
+
},
|
|
45
|
+
"keywords": [
|
|
46
|
+
"agentic",
|
|
47
|
+
"primitives",
|
|
48
|
+
"verifiable-credentials"
|
|
49
|
+
],
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "tsc -p tsconfig.build.json",
|
|
52
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
53
|
+
"test": "vitest run",
|
|
54
|
+
"test:unit": "vitest run test/unit --passWithNoTests",
|
|
55
|
+
"test:watch": "vitest",
|
|
56
|
+
"clean": "rm -rf dist"
|
|
57
|
+
}
|
|
58
|
+
}
|