@aikdna/kdna-core 0.5.0 → 0.7.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 CHANGED
@@ -8,7 +8,59 @@ Core library for loading, validating, linting, rendering, composing, and directl
8
8
  npm install @aikdna/kdna-core
9
9
  ```
10
10
 
11
- ## Usage
11
+ ## Preferred public API
12
+
13
+ Third-party adapters should start with the stable asset-first API. These
14
+ functions accept a `.kdna` file path, bytes, or an already opened asset and do
15
+ not require persistent extraction.
16
+
17
+ ```js
18
+ const {
19
+ inspectKDNA,
20
+ validateKDNA,
21
+ loadKDNA,
22
+ renderForAgent,
23
+ verifyAsset,
24
+ verifyDigest,
25
+ verifySignature,
26
+ matchDomain,
27
+ composeKDNA
28
+ } = require('@aikdna/kdna-core');
29
+
30
+ const info = await inspectKDNA('./writing.kdna');
31
+ const validation = await validateKDNA('./writing.kdna');
32
+ const loaded = await loadKDNA('./writing.kdna', { profile: 'compact' });
33
+ const promptContext = await renderForAgent('./writing.kdna');
34
+
35
+ await verifyAsset('./writing.kdna', {
36
+ asset_digest: info.asset_digest,
37
+ requireSignature: true
38
+ });
39
+ await verifyDigest('./writing.kdna', info.asset_digest);
40
+ await verifySignature('./writing.kdna');
41
+
42
+ const matches = await matchDomain('Review this writing draft', ['./writing.kdna']);
43
+ const composed = await composeKDNA(['./writing.kdna', './agent_safety.kdna'], {
44
+ input: 'Review this public release note for safety and writing quality'
45
+ });
46
+ ```
47
+
48
+ Stable entry points:
49
+
50
+ | Function | Purpose |
51
+ | --- | --- |
52
+ | `openKDNA()` | Open a `.kdna` file or bytes as an immutable asset. |
53
+ | `inspectKDNA()` | Return manifest, entries, access, quality, risk, and digests. |
54
+ | `validateKDNA()` | Run asset, lint, schema, and cross-file validation. |
55
+ | `loadKDNA()` | Load index/compact/scenario/full profiles directly from `.kdna`. |
56
+ | `renderForAgent()` | Render a loaded asset into agent prompt context. |
57
+ | `verifyAsset()` | Run full asset verification: digest, content digest, signature, and trust metadata. |
58
+ | `verifyDigest()` | Check whole-file `asset_digest`. |
59
+ | `verifySignature()` | Require Ed25519 signature verification. |
60
+ | `matchDomain()` | Rank candidate assets for a task string. |
61
+ | `composeKDNA()` | Compose multiple assets with attribution and conflict reporting. |
62
+
63
+ ## Lower-level usage
12
64
 
13
65
  ```js
14
66
  const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aikdna/kdna-core",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "KDNA core library — pure logic for loading, validating, linting, and rendering KDNA domain cognition packages. Zero Node.js dependencies.",
5
5
  "type": "commonjs",
6
6
  "main": "src/index.js",
@@ -32,7 +32,7 @@
32
32
  }
33
33
  },
34
34
  "scenes": {
35
- "description": "Deprecated since v1.0-rc. Use scenarios (canonical) instead. Kept for backward compatibility.",
35
+ "description": "Not part of KDNA v1.0. Use scenarios.",
36
36
  "type": "array",
37
37
  "items": {
38
38
  "type": "object",
@@ -42,7 +42,7 @@
42
42
  "name": { "type": "string" },
43
43
  "trigger_signal": {
44
44
  "type": "string",
45
- "description": "Deprecated since v1.0-rc. Use trigger_signals (array) instead. Kept for backward compatibility."
45
+ "description": "Not part of KDNA v1.0. Use trigger_signals."
46
46
  },
47
47
  "trigger_signals": {
48
48
  "type": "array",
@@ -1,14 +1,25 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://aikdna.com/schema/kdna-file.schema.json",
4
- "title": "KDNA Single-File Format",
5
- "description": "Schema for the .kdna single-file distribution format. Combines all KDNA domain files into one transportable file.",
4
+ "title": "KDNA Legacy Merged Single-File Format (Rejected)",
5
+ "description": "Legacy v0.x merged JSON/YAML single-file format. This format is not valid for KDNA v1.0-rc; conforming v1.0 tools MUST reject it and use the ZIP .kdna container with root mimetype and kdna.json.",
6
6
  "type": "object",
7
- "required": ["kdna_spec", "meta", "core", "patterns"],
7
+ "not": {},
8
+ "required": ["format", "format_version", "spec_version", "meta", "core", "patterns"],
8
9
  "properties": {
9
- "kdna_spec": {
10
+ "format": {
10
11
  "type": "string",
11
- "description": "KDNA spec version this file conforms to (e.g., '0.4')."
12
+ "const": "kdna",
13
+ "description": "KDNA format marker."
14
+ },
15
+ "format_version": {
16
+ "type": "string",
17
+ "const": "1.0",
18
+ "description": "KDNA single-file manifest format version."
19
+ },
20
+ "spec_version": {
21
+ "type": "string",
22
+ "description": "KDNA spec version this file conforms to."
12
23
  },
13
24
  "meta": {
14
25
  "type": "object",
@@ -23,7 +34,6 @@
23
34
  "updated": { "type": "string", "description": "ISO date of last update." },
24
35
  "purpose": { "type": "string", "description": "What judgment this domain improves." },
25
36
  "description": { "type": "string" },
26
- "language": { "type": "string" },
27
37
  "languages": { "type": "array", "items": { "type": "string" } }
28
38
  },
29
39
  "additionalProperties": true
@@ -0,0 +1,346 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://aikdna.com/schema/kdna-manifest-v1rc.json",
4
+ "title": "KDNA Domain Manifest (kdna.json)",
5
+ "description": "Canonical JSON Schema for the kdna.json manifest inside a .kdna asset internal domain tree or dev source workspace. This is the single source of truth: CLI, Registry, Studio, and compatible loaders MUST validate against this schema.",
6
+
7
+ "type": "object",
8
+ "required": [
9
+ "format",
10
+ "format_version",
11
+ "spec_version",
12
+ "name",
13
+ "version",
14
+ "judgment_version",
15
+ "description",
16
+ "author",
17
+ "license",
18
+ "status",
19
+ "quality_badge",
20
+ "access",
21
+ "languages",
22
+ "default_language"
23
+ ],
24
+ "properties": {
25
+
26
+ "format": {
27
+ "type": "string",
28
+ "const": "kdna",
29
+ "description": "KDNA container format marker."
30
+ },
31
+
32
+ "format_version": {
33
+ "type": "string",
34
+ "const": "1.0",
35
+ "description": "KDNA container manifest format version."
36
+ },
37
+
38
+ "spec_version": {
39
+ "type": "string",
40
+ "description": "KDNA SPEC version this asset conforms to. Required.",
41
+ "examples": ["1.0-rc"]
42
+ },
43
+
44
+ "name": {
45
+ "type": "string",
46
+ "pattern": "^@[a-z][a-z0-9-]*/[a-z][a-z0-9_]*$",
47
+ "description": "Scoped domain identifier. Format: @scope/name. scope matches the GitHub org. name uses snake_case.",
48
+ "examples": ["@aikdna/writing", "@aikdna/agent_safety"]
49
+ },
50
+
51
+ "version": {
52
+ "type": "string",
53
+ "description": "Semantic version (MAJOR.MINOR.PATCH) of the domain asset. Tracks packaging and metadata changes. Independent of judgment_version.",
54
+ "examples": ["0.7.2"]
55
+ },
56
+
57
+ "judgment_version": {
58
+ "type": "string",
59
+ "description": "Version of the domain's judgment content (axioms, ontology, misunderstandings). MUST be incremented when any judgment-relevant content changes. Uses YYYY.MM format or semver.",
60
+ "examples": ["2026.05"]
61
+ },
62
+
63
+ "domain_id": {
64
+ "type": "string",
65
+ "pattern": "^[a-z][a-z0-9_]*$",
66
+ "description": "Stable semantic domain slug generated by the Studio-compatible authoring pipeline."
67
+ },
68
+
69
+ "registry_name": {
70
+ "type": "string",
71
+ "pattern": "^@[a-z][a-z0-9-]*/[a-z][a-z0-9_]*$",
72
+ "description": "Scoped registry distribution name for this asset."
73
+ },
74
+
75
+ "asset_uid": {
76
+ "type": "string",
77
+ "description": "Unique identifier for this exported .kdna asset instance. uuidv7 is recommended."
78
+ },
79
+
80
+ "project_uid": {
81
+ "type": "string",
82
+ "description": "Stable identifier for the Studio project that produced this asset. uuidv7 is recommended."
83
+ },
84
+
85
+ "build_id": {
86
+ "type": "string",
87
+ "pattern": "^build_[A-Za-z0-9_.:-]+$",
88
+ "description": "Unique identifier for the Studio compile/export run."
89
+ },
90
+
91
+ "content_digest": {
92
+ "type": "string",
93
+ "pattern": "^sha256[-:][0-9a-f]{64}$",
94
+ "description": "Canonical SHA-256 digest of the internal content tree, excluding self-referential digest and signature fields."
95
+ },
96
+
97
+ "description": {
98
+ "type": "string",
99
+ "minLength": 20,
100
+ "description": "What judgment this domain improves. One sentence that answers: what does loading this domain change about how an agent thinks?"
101
+ },
102
+
103
+ "core_insight": {
104
+ "type": "string",
105
+ "minLength": 10,
106
+ "description": "Optional. The single most important cognitive shift this domain creates. Used for display in Compare Mode and registry previews."
107
+ },
108
+
109
+ "author": {
110
+ "type": "object",
111
+ "required": ["name", "id"],
112
+ "properties": {
113
+ "name": { "type": "string", "description": "Author display name." },
114
+ "id": { "type": "string", "description": "Author identifier (e.g., GitHub handle or email prefix)." },
115
+ "pubkey": {
116
+ "type": "string",
117
+ "pattern": "^ed25519:[0-9a-f]{64}$",
118
+ "description": "Ed25519 public key for signature verification. Required for signed domains."
119
+ },
120
+ "public_key_pem": {
121
+ "type": "string",
122
+ "description": "PEM-encoded Ed25519 public key used by verifiers."
123
+ }
124
+ }
125
+ },
126
+
127
+ "license": {
128
+ "type": "object",
129
+ "required": ["type"],
130
+ "properties": {
131
+ "type": {
132
+ "type": "string",
133
+ "description": "License identifier. CC-BY-4.0 for open domains, KCL-1.0 for commercial/pro domains.",
134
+ "examples": ["CC-BY-4.0", "KCL-1.0", "MIT"]
135
+ },
136
+ "url": {
137
+ "type": "string",
138
+ "format": "uri",
139
+ "description": "URL to the full license text."
140
+ }
141
+ }
142
+ },
143
+
144
+ "status": {
145
+ "type": "string",
146
+ "enum": ["draft", "experimental", "stable", "deprecated", "staging"],
147
+ "description": "Domain maturity level. draft = early work in progress. experimental = complete but not yet proven in practice. stable = structure frozen, content mature. deprecated = superseded by another domain. staging = non-public pre-release (for pro/commercial domains)."
148
+ },
149
+
150
+ "quality_badge": {
151
+ "type": "string",
152
+ "enum": ["untested", "tested", "validated", "expert_reviewed", "production_ready"],
153
+ "description": "Evidence level for judgment quality. untested = schema validation only. tested = >= 10 eval cases with manual verification. validated = >= 30 eval cases with automated scoring and raw outputs. expert_reviewed = validated evidence plus external domain expert review. production_ready = expert_reviewed evidence plus real-world deployment evidence."
154
+ },
155
+
156
+ "access": {
157
+ "type": "string",
158
+ "enum": ["open", "licensed", "runtime"],
159
+ "description": "Distribution mode. open = plaintext, freely available. licensed = encrypted, requires local license. runtime = not distributed, server-side API only."
160
+ },
161
+
162
+ "languages": {
163
+ "type": "array",
164
+ "items": { "type": "string" },
165
+ "description": "All languages this domain supports (ISO 639-1 codes).",
166
+ "examples": [["en", "zh-CN"]]
167
+ },
168
+
169
+ "default_language": {
170
+ "type": "string",
171
+ "description": "Default language for agent loading when none specified."
172
+ },
173
+
174
+ "i18n_level": {
175
+ "type": "string",
176
+ "enum": ["L0", "L1", "L2", "L3"],
177
+ "description": "Internationalization maturity. L0 = single language only. L1 = basic translation of axioms. L2 = full bilingual (en + zh-CN minimum). L3 = multi-language with locale-aware content."
178
+ },
179
+
180
+ "keywords": {
181
+ "type": "array",
182
+ "items": { "type": "string" },
183
+ "description": "Discovery keywords for search and categorization."
184
+ },
185
+
186
+ "file_count": {
187
+ "type": "integer",
188
+ "minimum": 2,
189
+ "maximum": 6,
190
+ "description": "Number of standard KDNA JSON entries in the asset internal tree or dev source workspace (excluding kdna.json). Minimum 2 (Core + Patterns). Maximum 6."
191
+ },
192
+
193
+ "risk_level": {
194
+ "type": "string",
195
+ "enum": ["R0", "R1", "R2", "R3"],
196
+ "description": "Risk level for the domain. R0 = low risk (writing style, aesthetics). R1 = medium-low (product decisions, management). R2 = medium (safety, finance, legal). R3 = high (security strategy, code execution). Determines load warnings and certification requirements."
197
+ },
198
+
199
+ "privacy_level": {
200
+ "type": "string",
201
+ "enum": ["public", "private", "sensitive", "regulated"],
202
+ "description": "Privacy classification. Proposed for v1.1; optional in v1.0."
203
+ },
204
+
205
+ "asset_type": {
206
+ "type": "string",
207
+ "enum": [
208
+ "domain_judgment",
209
+ "personal_judgment",
210
+ "organization_standard",
211
+ "team_policy",
212
+ "creator_style",
213
+ "risk_guard"
214
+ ],
215
+ "description": "Judgment asset category. Proposed for v1.1; optional in v1.0."
216
+ },
217
+
218
+ "fitness_for_purpose": {
219
+ "type": "object",
220
+ "description": "Applicability boundary for runtime policy and human review.",
221
+ "properties": {
222
+ "intended_use": { "type": "array", "items": { "type": "string" } },
223
+ "not_for": { "type": "array", "items": { "type": "string" } },
224
+ "requires_human_review_when": { "type": "array", "items": { "type": "string" } },
225
+ "known_failure_modes": { "type": "array", "items": { "type": "string" } }
226
+ },
227
+ "additionalProperties": false
228
+ },
229
+
230
+ "authoring": {
231
+ "type": "object",
232
+ "description": "Studio-compatible authoring provenance. Required for trusted quality claims.",
233
+ "required": ["created_by"],
234
+ "properties": {
235
+ "created_by": {
236
+ "type": "string",
237
+ "enum": [
238
+ "kdna-studio",
239
+ "kdna-studio-cli",
240
+ "kdna-studio-sdk",
241
+ "third-party-studio-compatible",
242
+ "manual-dev-source"
243
+ ]
244
+ },
245
+ "authoring_tool": { "type": "string" },
246
+ "authoring_tool_version": { "type": "string" },
247
+ "compiler": { "type": "string" },
248
+ "compiler_version": { "type": "string" },
249
+ "asset_uid": { "type": "string" },
250
+ "project_uid": { "type": "string" },
251
+ "build_id": {
252
+ "type": "string",
253
+ "pattern": "^build_[A-Za-z0-9_.:-]+$"
254
+ },
255
+ "domain_id": {
256
+ "type": "string",
257
+ "pattern": "^[a-z][a-z0-9_]*$"
258
+ },
259
+ "registry_name": {
260
+ "type": "string",
261
+ "pattern": "^@[a-z][a-z0-9-]*/[a-z][a-z0-9_]*$"
262
+ },
263
+ "content_digest": {
264
+ "type": "string",
265
+ "pattern": "^sha256[-:][0-9a-f]{64}$"
266
+ },
267
+ "studio_project_digest": {
268
+ "type": "string",
269
+ "pattern": "^sha256[-:][0-9a-f]{64}$"
270
+ },
271
+ "human_lock_required": { "type": "boolean" },
272
+ "human_lock_count": { "type": "integer", "minimum": 0 },
273
+ "ai_assisted": { "type": "boolean" },
274
+ "human_confirmed": { "type": "boolean" },
275
+ "compiled_at": { "type": "string", "format": "date-time" }
276
+ },
277
+ "additionalProperties": false
278
+ },
279
+
280
+ "signature": {
281
+ "type": "string",
282
+ "pattern": "^ed25519:[0-9a-f]{128}$",
283
+ "description": "Ed25519 signature over the canonical payload. Required for domains with quality_badge >= tested."
284
+ },
285
+
286
+ "created": {
287
+ "type": "string",
288
+ "format": "date",
289
+ "description": "ISO date of first creation."
290
+ },
291
+
292
+ "updated": {
293
+ "type": "string",
294
+ "format": "date",
295
+ "description": "ISO date of last modification."
296
+ },
297
+
298
+ "replaced_by": {
299
+ "type": "string",
300
+ "description": "Required when status is deprecated. The name of the successor domain."
301
+ }
302
+ },
303
+
304
+ "allOf": [
305
+ {
306
+ "if": { "properties": { "status": { "const": "deprecated" } } },
307
+ "then": { "required": ["replaced_by"] }
308
+ },
309
+ {
310
+ "if": {
311
+ "properties": {
312
+ "quality_badge": { "enum": ["tested", "validated", "expert_reviewed", "production_ready"] }
313
+ }
314
+ },
315
+ "then": {
316
+ "required": ["signature", "authoring"],
317
+ "properties": {
318
+ "author": { "required": ["pubkey"] },
319
+ "authoring": {
320
+ "required": [
321
+ "compiler",
322
+ "compiler_version",
323
+ "compiled_at",
324
+ "human_confirmed",
325
+ "human_lock_count"
326
+ ],
327
+ "properties": {
328
+ "created_by": {
329
+ "enum": [
330
+ "kdna-studio",
331
+ "kdna-studio-cli",
332
+ "kdna-studio-sdk",
333
+ "third-party-studio-compatible"
334
+ ]
335
+ },
336
+ "human_confirmed": { "const": true },
337
+ "human_lock_count": { "minimum": 1 }
338
+ }
339
+ }
340
+ }
341
+ }
342
+ }
343
+ ],
344
+
345
+ "additionalProperties": false
346
+ }
@@ -22,6 +22,7 @@ const STANDARD_ENTRIES = [
22
22
  ];
23
23
 
24
24
  const JSON_ENTRY_RE = /\.json$/i;
25
+ const KDNA_MEDIA_TYPE = 'application/vnd.aikdna.kdna+zip';
25
26
 
26
27
  function sha256Hex(buf) {
27
28
  return crypto.createHash('sha256').update(buf).digest('hex');
@@ -181,8 +182,10 @@ function buildContentDigest(asset) {
181
182
  if (entryName === '.DS_Store' || entryName === 'signature.json') continue;
182
183
  const entryBuf = asset.readEntry(entryName);
183
184
  let digestBuf = entryBuf;
184
- if (entryName === 'kdna.json') {
185
- digestBuf = Buffer.from(stableStringify(manifestForDigest(parseJson(entryBuf, entryName))));
185
+ if (JSON_ENTRY_RE.test(entryName)) {
186
+ const parsed = parseJson(entryBuf, entryName);
187
+ const value = entryName === 'kdna.json' ? manifestForDigest(parsed) : parsed;
188
+ digestBuf = Buffer.from(stableStringify(value));
186
189
  }
187
190
  parts.push(`${entryName}:${sha256Hex(digestBuf)}`);
188
191
  }
@@ -201,16 +204,20 @@ function manifestForSignature(manifest, { stripDigestFields = true } = {}) {
201
204
  return copy;
202
205
  }
203
206
 
207
+ function canonicalJsonEntry(entryName, entryBuf, options = {}) {
208
+ const parsed = parseJson(entryBuf, entryName);
209
+ const value = entryName === 'kdna.json' ? manifestForSignature(parsed, options) : parsed;
210
+ return Buffer.from(stableStringify(value));
211
+ }
212
+
204
213
  function buildSigningPayload(asset, options = {}) {
205
214
  const parts = [];
206
- for (const entryName of [...asset.entries.keys()].filter((name) => JSON_ENTRY_RE.test(name)).sort()) {
207
- if (entryName === 'signature.json') continue;
215
+ for (const entryName of [...asset.entries.keys()].sort()) {
216
+ if (entryName === '.DS_Store' || entryName === 'signature.json') continue;
208
217
  const entryBuf = asset.readEntry(entryName);
209
218
  let payloadBuf = entryBuf;
210
- if (entryName === 'kdna.json') {
211
- payloadBuf = Buffer.from(
212
- JSON.stringify(manifestForSignature(parseJson(entryBuf, entryName), options)),
213
- );
219
+ if (JSON_ENTRY_RE.test(entryName)) {
220
+ payloadBuf = canonicalJsonEntry(entryName, entryBuf, options);
214
221
  }
215
222
  parts.push(`${entryName}:${sha256Hex(payloadBuf)}`);
216
223
  }
@@ -240,15 +247,7 @@ function verifySignature(asset, manifest, errors, warnings) {
240
247
  try {
241
248
  const signature = Buffer.from(String(manifest.signature).replace(/^ed25519:/, ''), 'hex');
242
249
  const publicKey = crypto.createPublicKey(manifest.author.public_key_pem);
243
- let ok = crypto.verify(null, Buffer.from(buildSigningPayload(asset)), publicKey, signature);
244
- if (!ok) {
245
- ok = crypto.verify(
246
- null,
247
- Buffer.from(buildSigningPayload(asset, { stripDigestFields: false })),
248
- publicKey,
249
- signature,
250
- );
251
- }
250
+ const ok = crypto.verify(null, Buffer.from(buildSigningPayload(asset)), publicKey, signature);
252
251
  if (!ok) errors.push('Ed25519 signature invalid');
253
252
  return ok;
254
253
  } catch (e) {
@@ -257,6 +256,37 @@ function verifySignature(asset, manifest, errors, warnings) {
257
256
  }
258
257
  }
259
258
 
259
+ function verifyMediaType(asset, errors) {
260
+ if (!asset.entries.has('mimetype')) {
261
+ errors.push('required entry missing: mimetype');
262
+ return;
263
+ }
264
+ const value = asset.readEntry('mimetype').toString('utf8');
265
+ if (value !== KDNA_MEDIA_TYPE) {
266
+ errors.push(`mimetype: expected ${KDNA_MEDIA_TYPE}, got ${JSON.stringify(value)}`);
267
+ }
268
+ }
269
+
270
+ function validateManifestIdentity(manifest, errors, _warnings) {
271
+ if (manifest.kdna_spec) {
272
+ errors.push('kdna.json: kdna_spec is not allowed. Use spec_version.');
273
+ }
274
+ if (manifest.format && manifest.format !== 'kdna') {
275
+ errors.push(`kdna.json.format: invalid value "${manifest.format}". Expected "kdna".`);
276
+ }
277
+ if (manifest.format_version && manifest.format_version !== '1.0') {
278
+ errors.push(
279
+ `kdna.json.format_version: invalid value "${manifest.format_version}". Expected "1.0".`,
280
+ );
281
+ }
282
+ if (!manifest.spec_version) errors.push('kdna.json: missing required field "spec_version"');
283
+ if (!manifest.format) errors.push('kdna.json: missing required field "format"');
284
+ if (!manifest.format_version) errors.push('kdna.json: missing required field "format_version"');
285
+ if (manifest.language) {
286
+ errors.push('kdna.json: language is not allowed. Use default_language and languages.');
287
+ }
288
+ }
289
+
260
290
  function openAsset(input) {
261
291
  const { buffer, path } = normalizeInput(input);
262
292
  const entries = parseZipEntries(buffer);
@@ -307,6 +337,7 @@ function verifySync(asset, options = {}) {
307
337
  const entries = listEntries(asset);
308
338
 
309
339
  if (!asset.entries.has('kdna.json')) errors.push('required entry missing: kdna.json');
340
+ verifyMediaType(asset, errors);
310
341
  if (!asset.entries.has('KDNA_Core.json')) errors.push('required entry missing: KDNA_Core.json');
311
342
  if (!asset.entries.has('KDNA_Patterns.json')) {
312
343
  errors.push('required entry missing: KDNA_Patterns.json');
@@ -326,6 +357,7 @@ function verifySync(asset, options = {}) {
326
357
  if (asset.entries.has('kdna.json')) {
327
358
  try {
328
359
  manifest = readManifest(asset);
360
+ validateManifestIdentity(manifest, errors, warnings);
329
361
  const encrypted = encryptedEntries(manifest);
330
362
  if (encrypted.length) {
331
363
  warnings.push(`encrypted entries present: ${encrypted.join(', ')}`);
@@ -480,6 +512,7 @@ function createKdnaAssetReader() {
480
512
  const entries = [...asset.entries.keys()].sort();
481
513
 
482
514
  if (!asset.entries.has('kdna.json')) errors.push('required entry missing: kdna.json');
515
+ verifyMediaType(asset, errors);
483
516
  if (!asset.entries.has('KDNA_Core.json')) errors.push('required entry missing: KDNA_Core.json');
484
517
  if (!asset.entries.has('KDNA_Patterns.json')) {
485
518
  errors.push('required entry missing: KDNA_Patterns.json');
@@ -501,6 +534,7 @@ function createKdnaAssetReader() {
501
534
  if (asset.entries.has('kdna.json')) {
502
535
  try {
503
536
  manifest = parseJson(asset.readEntry('kdna.json'), 'kdna.json');
537
+ validateManifestIdentity(manifest, errors, warnings);
504
538
  const encrypted = encryptedEntries(manifest);
505
539
  if (encrypted.length) {
506
540
  warnings.push(`encrypted entries present: ${encrypted.join(', ')}`);