@kya-os/contracts 1.8.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agentshield-api/index.js +0 -1
- package/dist/agentshield-api/schemas.d.ts +193 -187
- package/dist/agentshield-api/schemas.js +0 -1
- package/dist/agentshield-api/types.js +0 -1
- package/dist/compute.d.ts +47 -17
- package/dist/compute.js +23 -1
- package/dist/consent/index.d.ts +2 -3
- package/dist/consent/index.js +14 -3
- package/dist/handshake.d.ts +4 -3
- package/dist/handshake.js +4 -3
- package/dist/proof/index.d.ts +3 -4
- package/dist/proof/index.js +2 -2
- package/dist/proof.d.ts +98 -67
- package/dist/proof.js +29 -2
- package/dist/runtime/headers.d.ts +16 -12
- package/dist/runtime/headers.js +16 -12
- package/dist/verifier.d.ts +28 -17
- package/dist/verifier.js +20 -9
- package/package.json +2 -1
- package/parity-vectors/delegation-conformance.json +265 -0
- package/parity-vectors/did-key.json +134 -0
- package/parity-vectors/index.ts +253 -0
- package/parity-vectors/scope-matching.json +330 -0
- package/parity-vectors/vc-jwt.json +210 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"name": "VC-JWT verification test vectors",
|
|
4
|
+
"description": "Test vectors for VC-JWT parsing and verification parity between TypeScript and Rust",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"vectors": [
|
|
7
|
+
{
|
|
8
|
+
"id": "valid-jwt-parse",
|
|
9
|
+
"description": "Parse a valid JWT structure",
|
|
10
|
+
"input": {
|
|
11
|
+
"jwt": "eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJkaWQ6a2V5Ono2TWtoYVhnQlpEdm90RGtMNTI1N2ZhaXp0aUdpQzJRdEtMR3Bibm5FR3RhMmRvSyIsInN1YiI6ImRpZDprZXk6ejZNa2hhWGdCWkR2b3REa0w1MjU3ZmFpenRpR2lDMlF0S0xHcGJubkVHdGEyZG9LIiwiYXVkIjoidGVzdC1hdWRpZW5jZSIsImlhdCI6MTcwNDA2NzIwMH0.signature-placeholder"
|
|
12
|
+
},
|
|
13
|
+
"expected": {
|
|
14
|
+
"success": true,
|
|
15
|
+
"header": {
|
|
16
|
+
"alg": "EdDSA",
|
|
17
|
+
"typ": "JWT"
|
|
18
|
+
},
|
|
19
|
+
"payload": {
|
|
20
|
+
"iss": "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK",
|
|
21
|
+
"sub": "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK",
|
|
22
|
+
"aud": "test-audience"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"id": "valid-jwt-no-typ",
|
|
28
|
+
"description": "Parse JWT without typ header (allowed)",
|
|
29
|
+
"input": {
|
|
30
|
+
"jwt": "eyJhbGciOiJFZERTQSJ9.eyJpc3MiOiJkaWQ6a2V5Ono2TWtoYVhnQlpEdm90RGtMNTI1N2ZhaXp0aUdpQzJRdEtMR3Bibm5FR3RhMmRvSyJ9.signature"
|
|
31
|
+
},
|
|
32
|
+
"expected": {
|
|
33
|
+
"success": true,
|
|
34
|
+
"header": {
|
|
35
|
+
"alg": "EdDSA",
|
|
36
|
+
"typ": null
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"id": "valid-jwt-typ-lowercase",
|
|
42
|
+
"description": "Parse JWT with lowercase typ (allowed)",
|
|
43
|
+
"input": {
|
|
44
|
+
"jwt": "eyJhbGciOiJFZERTQSIsInR5cCI6Imp3dCJ9.eyJpc3MiOiJkaWQ6a2V5Ono2TWtoYVhnQlpEdm90RGtMNTI1N2ZhaXp0aUdpQzJRdEtMR3Bibm5FR3RhMmRvSyJ9.signature"
|
|
45
|
+
},
|
|
46
|
+
"expected": {
|
|
47
|
+
"success": true,
|
|
48
|
+
"header": {
|
|
49
|
+
"alg": "EdDSA",
|
|
50
|
+
"typ": "jwt"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"id": "invalid-wrong-algorithm",
|
|
56
|
+
"description": "Reject JWT with wrong algorithm",
|
|
57
|
+
"input": {
|
|
58
|
+
"jwt": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJkaWQ6a2V5Ono2TWsiLCJzdWIiOiJ0ZXN0In0.signature"
|
|
59
|
+
},
|
|
60
|
+
"expected": {
|
|
61
|
+
"success": false,
|
|
62
|
+
"errorType": "WrongAlgorithm",
|
|
63
|
+
"errorMessage": "Expected EdDSA, got RS256"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"id": "invalid-wrong-type",
|
|
68
|
+
"description": "Reject JWT with wrong type",
|
|
69
|
+
"input": {
|
|
70
|
+
"jwt": "eyJhbGciOiJFZERTQSIsInR5cCI6IkpXRSJ9.eyJpc3MiOiJkaWQ6a2V5Ono2TWsiLCJzdWIiOiJ0ZXN0In0.signature"
|
|
71
|
+
},
|
|
72
|
+
"expected": {
|
|
73
|
+
"success": false,
|
|
74
|
+
"errorType": "WrongType",
|
|
75
|
+
"errorMessage": "Expected JWT, got JWE"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"id": "invalid-malformed-not-three-parts",
|
|
80
|
+
"description": "Reject malformed JWT (not 3 parts)",
|
|
81
|
+
"input": {
|
|
82
|
+
"jwt": "header.payload"
|
|
83
|
+
},
|
|
84
|
+
"expected": {
|
|
85
|
+
"success": false,
|
|
86
|
+
"errorType": "InvalidFormat",
|
|
87
|
+
"errorMessage": "JWT must have 3 parts"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"id": "invalid-malformed-empty",
|
|
92
|
+
"description": "Reject empty JWT",
|
|
93
|
+
"input": {
|
|
94
|
+
"jwt": ""
|
|
95
|
+
},
|
|
96
|
+
"expected": {
|
|
97
|
+
"success": false,
|
|
98
|
+
"errorType": "InvalidFormat"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"id": "invalid-malformed-too-many-parts",
|
|
103
|
+
"description": "Reject JWT with too many parts",
|
|
104
|
+
"input": {
|
|
105
|
+
"jwt": "a.b.c.d"
|
|
106
|
+
},
|
|
107
|
+
"expected": {
|
|
108
|
+
"success": false,
|
|
109
|
+
"errorType": "InvalidFormat",
|
|
110
|
+
"errorMessage": "JWT must have 3 parts"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"id": "invalid-bad-base64-header",
|
|
115
|
+
"description": "Reject JWT with invalid base64 in header",
|
|
116
|
+
"input": {
|
|
117
|
+
"jwt": "not-valid-base64!!!.eyJpc3MiOiJ0ZXN0In0.signature"
|
|
118
|
+
},
|
|
119
|
+
"expected": {
|
|
120
|
+
"success": false,
|
|
121
|
+
"errorType": "InvalidBase64"
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"id": "invalid-bad-json-header",
|
|
126
|
+
"description": "Reject JWT with invalid JSON in header",
|
|
127
|
+
"input": {
|
|
128
|
+
"jwt": "bm90LWpzb24.eyJpc3MiOiJ0ZXN0In0.signature"
|
|
129
|
+
},
|
|
130
|
+
"expected": {
|
|
131
|
+
"success": false,
|
|
132
|
+
"errorType": "InvalidJson"
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"id": "valid-extract-issuer-string",
|
|
137
|
+
"description": "Extract issuer from JWT payload (string format)",
|
|
138
|
+
"input": {
|
|
139
|
+
"jwt": "eyJhbGciOiJFZERTQSJ9.eyJpc3MiOiJkaWQ6a2V5Ono2TWtoYVhnQlpEdm90RGtMNTI1N2ZhaXp0aUdpQzJRdEtMR3Bibm5FR3RhMmRvSyJ9.sig"
|
|
140
|
+
},
|
|
141
|
+
"expected": {
|
|
142
|
+
"success": true,
|
|
143
|
+
"issuer": "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK"
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"id": "valid-extract-issuer-object",
|
|
148
|
+
"description": "Extract issuer from JWT payload (object format with id)",
|
|
149
|
+
"input": {
|
|
150
|
+
"jwt": "eyJhbGciOiJFZERTQSJ9.eyJpc3MiOnsiaWQiOiJkaWQ6a2V5Ono2TWtoYVhnQlpEdm90RGtMNTI1N2ZhaXp0aUdpQzJRdEtMR3Bibm5FR3RhMmRvSyJ9fQ.sig"
|
|
151
|
+
},
|
|
152
|
+
"expected": {
|
|
153
|
+
"success": true,
|
|
154
|
+
"issuer": "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK"
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"id": "invalid-missing-issuer",
|
|
159
|
+
"description": "Reject JWT without issuer",
|
|
160
|
+
"input": {
|
|
161
|
+
"jwt": "eyJhbGciOiJFZERTQSJ9.eyJzdWIiOiJ0ZXN0In0.signature"
|
|
162
|
+
},
|
|
163
|
+
"expected": {
|
|
164
|
+
"success": false,
|
|
165
|
+
"errorType": "MissingIssuer"
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
],
|
|
169
|
+
"signatureVerificationVectors": [
|
|
170
|
+
{
|
|
171
|
+
"id": "verify-valid-signature",
|
|
172
|
+
"description": "Verify a JWT with valid Ed25519 signature",
|
|
173
|
+
"input": {
|
|
174
|
+
"jwt": "eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJkaWQ6a2V5Ono2TWtoYVhnQlpEdm90RGtMNTI1N2ZhaXp0aUdpQzJRdEtMR3Bibm5FR3RhMmRvSyIsInN1YiI6InRlc3QiLCJpYXQiOjE3MDQwNjcyMDB9.ACTUAL_SIGNATURE_NEEDED",
|
|
175
|
+
"publicKeyHex": "8520f0098930a754748b7ddcb43ef75a0dbf3a0d26381af4eba4a98eaa9b4e6a"
|
|
176
|
+
},
|
|
177
|
+
"expected": {
|
|
178
|
+
"success": true,
|
|
179
|
+
"verified": true
|
|
180
|
+
},
|
|
181
|
+
"note": "This vector requires generating a real signature for end-to-end testing"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"id": "verify-invalid-signature",
|
|
185
|
+
"description": "Reject JWT with invalid signature",
|
|
186
|
+
"input": {
|
|
187
|
+
"jwt": "eyJhbGciOiJFZERTQSJ9.eyJpc3MiOiJkaWQ6a2V5Ono2TWsiLCJzdWIiOiJ0ZXN0In0.aW52YWxpZC1zaWduYXR1cmU",
|
|
188
|
+
"publicKeyHex": "8520f0098930a754748b7ddcb43ef75a0dbf3a0d26381af4eba4a98eaa9b4e6a"
|
|
189
|
+
},
|
|
190
|
+
"expected": {
|
|
191
|
+
"success": false,
|
|
192
|
+
"verified": false,
|
|
193
|
+
"errorType": "InvalidSignature"
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"id": "verify-wrong-public-key",
|
|
198
|
+
"description": "Reject JWT verified with wrong public key",
|
|
199
|
+
"input": {
|
|
200
|
+
"jwt": "eyJhbGciOiJFZERTQSJ9.eyJpc3MiOiJkaWQ6a2V5Ono2TWsiLCJzdWIiOiJ0ZXN0In0.some-signature",
|
|
201
|
+
"publicKeyHex": "0000000000000000000000000000000000000000000000000000000000000000"
|
|
202
|
+
},
|
|
203
|
+
"expected": {
|
|
204
|
+
"success": false,
|
|
205
|
+
"verified": false,
|
|
206
|
+
"errorType": "InvalidSignature"
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
]
|
|
210
|
+
}
|