@aikdna/kdna-core 0.17.0 → 0.19.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/CHANGELOG.md +227 -64
- package/README.md +114 -77
- package/package.json +8 -2
- package/schema/agent-host-capabilities.schema.json +62 -0
- package/schema/agent-host-receipt.schema.json +371 -0
- package/schema/agent-host-request.schema.json +223 -0
- package/schema/{bundle-profile-v1.schema.json → bundle-profile.schema.json} +9 -5
- package/schema/checksums.schema.json +42 -3
- package/schema/consumption-plan.schema.json +428 -0
- package/schema/digest-evidence.schema.json +212 -0
- package/schema/{kdna-envelope-external-grant-v1.schema.json → external-grant-envelope.schema.json} +17 -4
- package/schema/{kdna-key-grant-v1.schema.json → external-key-grant.schema.json} +39 -7
- package/schema/judgment-trace.schema.json +1251 -0
- package/schema/load-plan.schema.json +7 -5
- package/schema/manifest.schema.json +70 -10
- package/schema/{payload-profile-v1.schema.json → payload-profile.schema.json} +30 -6
- package/schema/runtime-capsule.schema.json +116 -0
- package/src/asset-reader.js +106 -120
- package/src/{v1 → container}/index.js +566 -209
- package/src/container/index.mjs +20 -0
- package/src/container-dispatcher.js +10 -7
- package/src/crypto-profile.js +37 -107
- package/src/external-key-grant.js +41 -15
- package/src/index.js +11 -4
- package/src/index.mjs +143 -24
- package/src/loader-compatibility.js +59 -0
- package/src/loader.js +1 -1
- package/src/public-api.js +59 -163
- package/src/remote-runtime.d.ts +13 -0
- package/src/remote-runtime.js +27 -0
- package/src/remote-runtime.mjs +3 -0
- package/src/runtime-api.js +9 -10
- package/src/runtime-capsule.js +529 -0
- package/src/runtime-contract.js +1882 -0
- package/src/types.d.ts +1127 -136
- package/src/workpack-pure.js +1 -1
- package/src/lint-pure.js +0 -430
- package/src/v1/index.mjs +0 -20
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/aikdna/kdna/specs/consumption-plan.schema.json",
|
|
4
|
+
"title": "KDNA ConsumptionPlan",
|
|
5
|
+
"description": "Single-asset plan for Runtime Capsule delivery to an Agent Host.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [
|
|
8
|
+
"type",
|
|
9
|
+
"contract_version",
|
|
10
|
+
"plan_id",
|
|
11
|
+
"created_at",
|
|
12
|
+
"mode",
|
|
13
|
+
"task",
|
|
14
|
+
"asset_ref",
|
|
15
|
+
"projection_request",
|
|
16
|
+
"host_request",
|
|
17
|
+
"result_request",
|
|
18
|
+
"budget",
|
|
19
|
+
"constraints",
|
|
20
|
+
"trace_policy",
|
|
21
|
+
"integrity"
|
|
22
|
+
],
|
|
23
|
+
"additionalProperties": false,
|
|
24
|
+
"properties": {
|
|
25
|
+
"type": {
|
|
26
|
+
"const": "kdna.consumption-plan"
|
|
27
|
+
},
|
|
28
|
+
"plan_id": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"pattern": "^plan_[0-9a-f]{16}$"
|
|
31
|
+
},
|
|
32
|
+
"created_at": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"format": "date-time"
|
|
35
|
+
},
|
|
36
|
+
"mode": {
|
|
37
|
+
"const": "single"
|
|
38
|
+
},
|
|
39
|
+
"task": {
|
|
40
|
+
"$ref": "#/$defs/task"
|
|
41
|
+
},
|
|
42
|
+
"asset_ref": {
|
|
43
|
+
"$ref": "#/$defs/assetRef"
|
|
44
|
+
},
|
|
45
|
+
"projection_request": {
|
|
46
|
+
"$ref": "#/$defs/projectionRequest"
|
|
47
|
+
},
|
|
48
|
+
"host_request": {
|
|
49
|
+
"$ref": "#/$defs/hostRequest"
|
|
50
|
+
},
|
|
51
|
+
"result_request": {
|
|
52
|
+
"$ref": "#/$defs/resultRequest"
|
|
53
|
+
},
|
|
54
|
+
"budget": {
|
|
55
|
+
"$ref": "#/$defs/budget"
|
|
56
|
+
},
|
|
57
|
+
"constraints": {
|
|
58
|
+
"$ref": "#/$defs/constraints"
|
|
59
|
+
},
|
|
60
|
+
"trace_policy": {
|
|
61
|
+
"$ref": "#/$defs/tracePolicy"
|
|
62
|
+
},
|
|
63
|
+
"integrity": {
|
|
64
|
+
"$ref": "#/$defs/integrity"
|
|
65
|
+
},
|
|
66
|
+
"contract_version": {
|
|
67
|
+
"const": "0.1.0"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"$defs": {
|
|
71
|
+
"sha256": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"pattern": "^sha256:[0-9a-f]{64}$"
|
|
74
|
+
},
|
|
75
|
+
"semver": {
|
|
76
|
+
"type": "string",
|
|
77
|
+
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+([+-].+)?$"
|
|
78
|
+
},
|
|
79
|
+
"assetId": {
|
|
80
|
+
"type": "string",
|
|
81
|
+
"pattern": "^[a-zA-Z][a-zA-Z0-9_-]*(:[a-zA-Z0-9_.-]+)+$"
|
|
82
|
+
},
|
|
83
|
+
"task": {
|
|
84
|
+
"type": "object",
|
|
85
|
+
"required": ["summary", "task_family", "context"],
|
|
86
|
+
"additionalProperties": false,
|
|
87
|
+
"properties": {
|
|
88
|
+
"summary": {
|
|
89
|
+
"type": "string",
|
|
90
|
+
"minLength": 1,
|
|
91
|
+
"maxLength": 500
|
|
92
|
+
},
|
|
93
|
+
"task_family": {
|
|
94
|
+
"type": ["string", "null"],
|
|
95
|
+
"minLength": 1
|
|
96
|
+
},
|
|
97
|
+
"context": true
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"expectedDigest": {
|
|
101
|
+
"type": "object",
|
|
102
|
+
"required": ["value", "basis", "source", "comparison"],
|
|
103
|
+
"additionalProperties": false,
|
|
104
|
+
"properties": {
|
|
105
|
+
"value": {
|
|
106
|
+
"$ref": "#/$defs/sha256"
|
|
107
|
+
},
|
|
108
|
+
"basis": {
|
|
109
|
+
"type": "string"
|
|
110
|
+
},
|
|
111
|
+
"source": {
|
|
112
|
+
"enum": [
|
|
113
|
+
"caller",
|
|
114
|
+
"registry",
|
|
115
|
+
"install_receipt",
|
|
116
|
+
"lockfile",
|
|
117
|
+
"kdna.json.content_digest",
|
|
118
|
+
"checksums.json.entry_set_digest"
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
"comparison": {
|
|
122
|
+
"enum": ["matched", "not_compared"]
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"allOf": [
|
|
126
|
+
{
|
|
127
|
+
"if": {
|
|
128
|
+
"properties": {
|
|
129
|
+
"source": {
|
|
130
|
+
"const": "caller"
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"required": ["source"]
|
|
134
|
+
},
|
|
135
|
+
"then": {
|
|
136
|
+
"properties": {
|
|
137
|
+
"comparison": {
|
|
138
|
+
"const": "not_compared"
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"else": {
|
|
143
|
+
"properties": {
|
|
144
|
+
"comparison": {
|
|
145
|
+
"const": "matched"
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
},
|
|
152
|
+
"assetRef": {
|
|
153
|
+
"type": "object",
|
|
154
|
+
"required": [
|
|
155
|
+
"asset_id",
|
|
156
|
+
"asset_uid",
|
|
157
|
+
"version",
|
|
158
|
+
"judgment_version",
|
|
159
|
+
"access",
|
|
160
|
+
"expected_digests"
|
|
161
|
+
],
|
|
162
|
+
"additionalProperties": false,
|
|
163
|
+
"properties": {
|
|
164
|
+
"asset_id": {
|
|
165
|
+
"$ref": "#/$defs/assetId"
|
|
166
|
+
},
|
|
167
|
+
"asset_uid": {
|
|
168
|
+
"type": "string",
|
|
169
|
+
"format": "uri"
|
|
170
|
+
},
|
|
171
|
+
"version": {
|
|
172
|
+
"$ref": "#/$defs/semver"
|
|
173
|
+
},
|
|
174
|
+
"judgment_version": {
|
|
175
|
+
"$ref": "#/$defs/semver"
|
|
176
|
+
},
|
|
177
|
+
"access": {
|
|
178
|
+
"enum": ["public", "licensed", "remote"]
|
|
179
|
+
},
|
|
180
|
+
"expected_digests": {
|
|
181
|
+
"$ref": "#/$defs/expectedDigests"
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
"expectedDigests": {
|
|
186
|
+
"type": "object",
|
|
187
|
+
"required": ["asset", "content", "runtime_entry_set"],
|
|
188
|
+
"additionalProperties": false,
|
|
189
|
+
"properties": {
|
|
190
|
+
"asset": {
|
|
191
|
+
"oneOf": [
|
|
192
|
+
{
|
|
193
|
+
"allOf": [
|
|
194
|
+
{
|
|
195
|
+
"$ref": "#/$defs/expectedDigest"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"properties": {
|
|
199
|
+
"basis": {
|
|
200
|
+
"const": "kdna.digest-basis.container-bytes"
|
|
201
|
+
},
|
|
202
|
+
"source": {
|
|
203
|
+
"enum": ["caller", "registry", "install_receipt", "lockfile"]
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
]
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"type": "null"
|
|
211
|
+
}
|
|
212
|
+
]
|
|
213
|
+
},
|
|
214
|
+
"content": {
|
|
215
|
+
"oneOf": [
|
|
216
|
+
{
|
|
217
|
+
"allOf": [
|
|
218
|
+
{
|
|
219
|
+
"$ref": "#/$defs/expectedDigest"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"properties": {
|
|
223
|
+
"basis": {
|
|
224
|
+
"const": "kdna.digest-basis.content-tree"
|
|
225
|
+
},
|
|
226
|
+
"source": {
|
|
227
|
+
"enum": [
|
|
228
|
+
"caller",
|
|
229
|
+
"registry",
|
|
230
|
+
"install_receipt",
|
|
231
|
+
"lockfile",
|
|
232
|
+
"kdna.json.content_digest"
|
|
233
|
+
]
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
]
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"type": "null"
|
|
241
|
+
}
|
|
242
|
+
]
|
|
243
|
+
},
|
|
244
|
+
"runtime_entry_set": {
|
|
245
|
+
"oneOf": [
|
|
246
|
+
{
|
|
247
|
+
"allOf": [
|
|
248
|
+
{
|
|
249
|
+
"$ref": "#/$defs/expectedDigest"
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
"properties": {
|
|
253
|
+
"basis": {
|
|
254
|
+
"const": "kdna.digest-basis.runtime-entry-set"
|
|
255
|
+
},
|
|
256
|
+
"source": {
|
|
257
|
+
"enum": [
|
|
258
|
+
"caller",
|
|
259
|
+
"registry",
|
|
260
|
+
"install_receipt",
|
|
261
|
+
"lockfile",
|
|
262
|
+
"checksums.json.entry_set_digest"
|
|
263
|
+
]
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
]
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"type": "null"
|
|
271
|
+
}
|
|
272
|
+
]
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
"projectionRequest": {
|
|
277
|
+
"type": "object",
|
|
278
|
+
"required": [
|
|
279
|
+
"profile",
|
|
280
|
+
"accepted_capsule_versions",
|
|
281
|
+
"required_digest_profile",
|
|
282
|
+
"required_digest_profile_version",
|
|
283
|
+
"require_packaged_asset"
|
|
284
|
+
],
|
|
285
|
+
"additionalProperties": false,
|
|
286
|
+
"properties": {
|
|
287
|
+
"profile": {
|
|
288
|
+
"enum": ["index", "compact", "scenario", "full"]
|
|
289
|
+
},
|
|
290
|
+
"accepted_capsule_versions": {
|
|
291
|
+
"type": "array",
|
|
292
|
+
"prefixItems": [
|
|
293
|
+
{
|
|
294
|
+
"const": "0.1.0"
|
|
295
|
+
}
|
|
296
|
+
],
|
|
297
|
+
"minItems": 1,
|
|
298
|
+
"maxItems": 1
|
|
299
|
+
},
|
|
300
|
+
"required_digest_profile": {
|
|
301
|
+
"const": "kdna.digest-evidence"
|
|
302
|
+
},
|
|
303
|
+
"require_packaged_asset": {
|
|
304
|
+
"const": true
|
|
305
|
+
},
|
|
306
|
+
"required_digest_profile_version": {
|
|
307
|
+
"const": "0.1.0"
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
"hostRequest": {
|
|
312
|
+
"type": "object",
|
|
313
|
+
"required": ["accepted_protocols"],
|
|
314
|
+
"additionalProperties": false,
|
|
315
|
+
"properties": {
|
|
316
|
+
"accepted_protocols": {
|
|
317
|
+
"type": "array",
|
|
318
|
+
"prefixItems": [
|
|
319
|
+
{
|
|
320
|
+
"const": "kdna.agent-host"
|
|
321
|
+
}
|
|
322
|
+
],
|
|
323
|
+
"minItems": 1,
|
|
324
|
+
"maxItems": 1
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
"resultRequest": {
|
|
329
|
+
"type": "object",
|
|
330
|
+
"required": ["shape"],
|
|
331
|
+
"additionalProperties": false,
|
|
332
|
+
"properties": {
|
|
333
|
+
"shape": {
|
|
334
|
+
"const": "structured_judgment"
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
"budget": {
|
|
339
|
+
"type": "object",
|
|
340
|
+
"required": [
|
|
341
|
+
"max_projection_chars",
|
|
342
|
+
"max_task_chars",
|
|
343
|
+
"deadline_ms",
|
|
344
|
+
"max_tokens",
|
|
345
|
+
"max_model_calls"
|
|
346
|
+
],
|
|
347
|
+
"additionalProperties": false,
|
|
348
|
+
"properties": {
|
|
349
|
+
"max_projection_chars": {
|
|
350
|
+
"type": "integer",
|
|
351
|
+
"minimum": 0
|
|
352
|
+
},
|
|
353
|
+
"max_task_chars": {
|
|
354
|
+
"type": "integer",
|
|
355
|
+
"minimum": 0
|
|
356
|
+
},
|
|
357
|
+
"deadline_ms": {
|
|
358
|
+
"type": "integer",
|
|
359
|
+
"minimum": 1
|
|
360
|
+
},
|
|
361
|
+
"max_tokens": {
|
|
362
|
+
"oneOf": [
|
|
363
|
+
{
|
|
364
|
+
"type": "integer",
|
|
365
|
+
"minimum": 0
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
"type": "null"
|
|
369
|
+
}
|
|
370
|
+
]
|
|
371
|
+
},
|
|
372
|
+
"max_model_calls": {
|
|
373
|
+
"oneOf": [
|
|
374
|
+
{
|
|
375
|
+
"type": "integer",
|
|
376
|
+
"minimum": 0
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
"type": "null"
|
|
380
|
+
}
|
|
381
|
+
]
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
"constraints": {
|
|
386
|
+
"type": "object",
|
|
387
|
+
"required": ["enforce_before_host", "reject_on_exceed"],
|
|
388
|
+
"additionalProperties": false,
|
|
389
|
+
"properties": {
|
|
390
|
+
"enforce_before_host": {
|
|
391
|
+
"const": true
|
|
392
|
+
},
|
|
393
|
+
"reject_on_exceed": {
|
|
394
|
+
"const": true
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
"tracePolicy": {
|
|
399
|
+
"type": "object",
|
|
400
|
+
"required": ["emit", "storage"],
|
|
401
|
+
"additionalProperties": false,
|
|
402
|
+
"properties": {
|
|
403
|
+
"emit": {
|
|
404
|
+
"const": true
|
|
405
|
+
},
|
|
406
|
+
"storage": {
|
|
407
|
+
"enum": ["ephemeral", "session", "persistent"]
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
},
|
|
411
|
+
"integrity": {
|
|
412
|
+
"type": "object",
|
|
413
|
+
"required": ["profile", "profile_version", "plan_digest"],
|
|
414
|
+
"additionalProperties": false,
|
|
415
|
+
"properties": {
|
|
416
|
+
"profile": {
|
|
417
|
+
"const": "kdna.canonicalization.consumption-plan-jcs"
|
|
418
|
+
},
|
|
419
|
+
"plan_digest": {
|
|
420
|
+
"$ref": "#/$defs/sha256"
|
|
421
|
+
},
|
|
422
|
+
"profile_version": {
|
|
423
|
+
"const": "0.1.0"
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/aikdna/kdna/specs/digest-evidence.schema.json",
|
|
4
|
+
"title": "KDNA Digest Evidence",
|
|
5
|
+
"description": "Observed A/C/E digest values, their fixed bases, and factual comparison evidence.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["profile", "profile_version", "asset", "content", "runtime_entry_set"],
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"properties": {
|
|
10
|
+
"profile": {
|
|
11
|
+
"const": "kdna.digest-evidence"
|
|
12
|
+
},
|
|
13
|
+
"profile_version": {
|
|
14
|
+
"const": "0.1.0"
|
|
15
|
+
},
|
|
16
|
+
"asset": {
|
|
17
|
+
"allOf": [
|
|
18
|
+
{
|
|
19
|
+
"$ref": "#/$defs/digest"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"properties": {
|
|
23
|
+
"basis": {
|
|
24
|
+
"const": "kdna.digest-basis.container-bytes"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"content": {
|
|
31
|
+
"allOf": [
|
|
32
|
+
{
|
|
33
|
+
"$ref": "#/$defs/digest"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"properties": {
|
|
37
|
+
"basis": {
|
|
38
|
+
"const": "kdna.digest-basis.content-tree"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
"runtime_entry_set": {
|
|
45
|
+
"allOf": [
|
|
46
|
+
{
|
|
47
|
+
"$ref": "#/$defs/digest"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"properties": {
|
|
51
|
+
"basis": {
|
|
52
|
+
"const": "kdna.digest-basis.runtime-entry-set"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"$defs": {
|
|
60
|
+
"sha256": {
|
|
61
|
+
"type": "string",
|
|
62
|
+
"pattern": "^sha256:[0-9a-f]{64}$"
|
|
63
|
+
},
|
|
64
|
+
"comparisonSource": {
|
|
65
|
+
"enum": [
|
|
66
|
+
"caller",
|
|
67
|
+
"registry",
|
|
68
|
+
"install_receipt",
|
|
69
|
+
"lockfile",
|
|
70
|
+
"kdna.json.content_digest",
|
|
71
|
+
"kdna.json.authoring.content_digest",
|
|
72
|
+
"checksums.json.entry_set_digest"
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
"comparison": {
|
|
76
|
+
"type": "object",
|
|
77
|
+
"required": ["state", "against", "expected", "source"],
|
|
78
|
+
"additionalProperties": false,
|
|
79
|
+
"properties": {
|
|
80
|
+
"state": {
|
|
81
|
+
"enum": ["matched", "mismatched", "not_compared", "unavailable"]
|
|
82
|
+
},
|
|
83
|
+
"against": {
|
|
84
|
+
"type": ["string", "null"],
|
|
85
|
+
"enum": ["external_expected", "manifest_declaration", "checksum_declaration", null]
|
|
86
|
+
},
|
|
87
|
+
"expected": {
|
|
88
|
+
"oneOf": [
|
|
89
|
+
{
|
|
90
|
+
"$ref": "#/$defs/sha256"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"type": "null"
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
"source": {
|
|
98
|
+
"oneOf": [
|
|
99
|
+
{
|
|
100
|
+
"$ref": "#/$defs/comparisonSource"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"type": "null"
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"allOf": [
|
|
109
|
+
{
|
|
110
|
+
"if": {
|
|
111
|
+
"properties": {
|
|
112
|
+
"state": {
|
|
113
|
+
"enum": ["matched", "mismatched"]
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"required": ["state"]
|
|
117
|
+
},
|
|
118
|
+
"then": {
|
|
119
|
+
"properties": {
|
|
120
|
+
"against": {
|
|
121
|
+
"type": "string"
|
|
122
|
+
},
|
|
123
|
+
"expected": {
|
|
124
|
+
"$ref": "#/$defs/sha256"
|
|
125
|
+
},
|
|
126
|
+
"source": {
|
|
127
|
+
"$ref": "#/$defs/comparisonSource"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"if": {
|
|
134
|
+
"properties": {
|
|
135
|
+
"state": {
|
|
136
|
+
"enum": ["not_compared", "unavailable"]
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
"required": ["state"]
|
|
140
|
+
},
|
|
141
|
+
"then": {
|
|
142
|
+
"properties": {
|
|
143
|
+
"against": {
|
|
144
|
+
"type": "null"
|
|
145
|
+
},
|
|
146
|
+
"expected": {
|
|
147
|
+
"type": "null"
|
|
148
|
+
},
|
|
149
|
+
"source": {
|
|
150
|
+
"type": "null"
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
},
|
|
157
|
+
"digest": {
|
|
158
|
+
"type": "object",
|
|
159
|
+
"required": ["value", "basis", "comparison"],
|
|
160
|
+
"additionalProperties": false,
|
|
161
|
+
"properties": {
|
|
162
|
+
"value": {
|
|
163
|
+
"oneOf": [
|
|
164
|
+
{
|
|
165
|
+
"$ref": "#/$defs/sha256"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"type": "null"
|
|
169
|
+
}
|
|
170
|
+
]
|
|
171
|
+
},
|
|
172
|
+
"basis": {
|
|
173
|
+
"type": "string"
|
|
174
|
+
},
|
|
175
|
+
"comparison": {
|
|
176
|
+
"$ref": "#/$defs/comparison"
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"allOf": [
|
|
180
|
+
{
|
|
181
|
+
"if": {
|
|
182
|
+
"properties": {
|
|
183
|
+
"comparison": {
|
|
184
|
+
"properties": {
|
|
185
|
+
"state": {
|
|
186
|
+
"const": "unavailable"
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
"required": ["state"]
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
"required": ["comparison"]
|
|
193
|
+
},
|
|
194
|
+
"then": {
|
|
195
|
+
"properties": {
|
|
196
|
+
"value": {
|
|
197
|
+
"type": "null"
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
"else": {
|
|
202
|
+
"properties": {
|
|
203
|
+
"value": {
|
|
204
|
+
"$ref": "#/$defs/sha256"
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
]
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
package/schema/{kdna-envelope-external-grant-v1.schema.json → external-grant-envelope.schema.json}
RENAMED
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://kdna.ai/specs/
|
|
4
|
-
"title": "KDNA
|
|
3
|
+
"$id": "https://kdna.ai/specs/external-grant-envelope.schema.json",
|
|
4
|
+
"title": "KDNA External Grant Envelope",
|
|
5
5
|
"type": "object",
|
|
6
6
|
"additionalProperties": false,
|
|
7
|
-
"required": [
|
|
7
|
+
"required": [
|
|
8
|
+
"profile",
|
|
9
|
+
"contract_version",
|
|
10
|
+
"alg",
|
|
11
|
+
"cek_derivation",
|
|
12
|
+
"key_ref",
|
|
13
|
+
"issuer_key_id",
|
|
14
|
+
"entry_path",
|
|
15
|
+
"plaintext_digest",
|
|
16
|
+
"iv",
|
|
17
|
+
"tag",
|
|
18
|
+
"ciphertext"
|
|
19
|
+
],
|
|
8
20
|
"properties": {
|
|
9
|
-
"profile": { "const": "kdna
|
|
21
|
+
"profile": { "const": "kdna.envelope.external-grant" },
|
|
22
|
+
"contract_version": { "const": "0.1.0" },
|
|
10
23
|
"alg": { "const": "A256GCM" },
|
|
11
24
|
"cek_derivation": { "const": "HKDF-SHA256" },
|
|
12
25
|
"key_ref": { "type": "string", "minLength": 1, "maxLength": 256 },
|