@zanii/certify 0.0.0-stage → 0.6.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/LICENSE +159 -0
- package/README.md +144 -2
- package/dist/appliance-execution.d.ts +18 -0
- package/dist/appliance-execution.js +12 -0
- package/dist/appliance.d.ts +135 -0
- package/dist/appliance.js +253 -0
- package/dist/assurance-status.d.ts +58 -0
- package/dist/assurance-status.js +86 -0
- package/dist/audit-renewal.d.ts +39 -0
- package/dist/audit-renewal.js +62 -0
- package/dist/audit.d.ts +69 -0
- package/dist/audit.js +112 -0
- package/dist/beacon-client.d.ts +40 -0
- package/dist/beacon-client.js +151 -0
- package/dist/beacon.d.ts +84 -0
- package/dist/beacon.js +106 -0
- package/dist/bitstring-status.d.ts +56 -0
- package/dist/bitstring-status.js +135 -0
- package/dist/board.d.ts +218 -0
- package/dist/board.js +428 -0
- package/dist/bundle.d.ts +100 -0
- package/dist/bundle.js +122 -0
- package/dist/certificate.d.ts +161 -0
- package/dist/certificate.js +346 -0
- package/dist/cli-messages.json +148 -0
- package/dist/cli.d.ts +16 -0
- package/dist/cli.js +369 -0
- package/dist/current-issuer-vc.d.ts +20 -0
- package/dist/current-issuer-vc.js +60 -0
- package/dist/evidence-share.d.ts +89 -0
- package/dist/evidence-share.js +479 -0
- package/dist/federation.d.ts +103 -0
- package/dist/federation.js +240 -0
- package/dist/feed-snapshot.d.ts +97 -0
- package/dist/feed-snapshot.js +186 -0
- package/dist/fingerprint.d.ts +23 -0
- package/dist/fingerprint.js +48 -0
- package/dist/formats/status-v2.schema.json +31 -0
- package/dist/governance.d.ts +244 -0
- package/dist/governance.js +418 -0
- package/dist/identity.d.ts +79 -0
- package/dist/identity.js +146 -0
- package/dist/impartiality.d.ts +47 -0
- package/dist/impartiality.js +85 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.js +63 -0
- package/dist/issuer-authorization.d.ts +4 -0
- package/dist/issuer-authorization.js +52 -0
- package/dist/issuer-resolution.d.ts +25 -0
- package/dist/issuer-resolution.js +89 -0
- package/dist/licence-owner-entry.d.ts +20 -0
- package/dist/licence-owner-entry.js +33 -0
- package/dist/licence-owner.d.ts +67 -0
- package/dist/licence-owner.js +180 -0
- package/dist/licence.d.ts +174 -0
- package/dist/licence.js +400 -0
- package/dist/live-evidence.d.ts +135 -0
- package/dist/live-evidence.js +210 -0
- package/dist/nitro-roots.d.ts +3 -0
- package/dist/nitro-roots.js +20 -0
- package/dist/nitro-x509.d.ts +16 -0
- package/dist/nitro-x509.js +141 -0
- package/dist/nitro.d.ts +74 -0
- package/dist/nitro.js +329 -0
- package/dist/normalization.d.ts +8 -0
- package/dist/normalization.js +10 -0
- package/dist/pq.d.ts +32 -0
- package/dist/pq.js +69 -0
- package/dist/profile.d.ts +15 -0
- package/dist/profile.js +165 -0
- package/dist/register.d.ts +79 -0
- package/dist/register.js +134 -0
- package/dist/rotation.d.ts +49 -0
- package/dist/rotation.js +124 -0
- package/dist/royalty-reconciliation.d.ts +24 -0
- package/dist/royalty-reconciliation.js +88 -0
- package/dist/runtime-client.d.ts +40 -0
- package/dist/runtime-client.js +190 -0
- package/dist/runtime-gateway.d.ts +26 -0
- package/dist/runtime-gateway.js +169 -0
- package/dist/runtime-knowledge.d.ts +28 -0
- package/dist/runtime-knowledge.js +75 -0
- package/dist/runtime-nitro.d.ts +30 -0
- package/dist/runtime-nitro.js +57 -0
- package/dist/runtime.d.ts +226 -0
- package/dist/runtime.js +254 -0
- package/dist/sandbox-delegation.d.ts +38 -0
- package/dist/sandbox-delegation.js +61 -0
- package/dist/schema-dialect.d.ts +1 -0
- package/dist/schema-dialect.js +97 -0
- package/dist/schemas/clause-map.schema.json +52 -0
- package/dist/schemas/profile.schema.json +81 -0
- package/dist/schemas/scenarios.schema.json +573 -0
- package/dist/schemas/suite.schema.json +138 -0
- package/dist/schemas/trajectory.schema.json +1396 -0
- package/dist/scheme-authority.d.ts +5 -0
- package/dist/scheme-authority.js +15 -0
- package/dist/scheme-entry.d.ts +25 -0
- package/dist/scheme-entry.js +85 -0
- package/dist/scheme-history.d.ts +5 -0
- package/dist/scheme-history.js +87 -0
- package/dist/scheme-log.d.ts +98 -0
- package/dist/scheme-log.js +266 -0
- package/dist/scheme-merkle.d.ts +2 -0
- package/dist/scheme-merkle.js +20 -0
- package/dist/scheme-text.d.ts +25 -0
- package/dist/scheme-text.js +46 -0
- package/dist/scheme-timing.d.ts +16 -0
- package/dist/scheme-timing.js +22 -0
- package/dist/scheme-transition.d.ts +47 -0
- package/dist/scheme-transition.js +101 -0
- package/dist/scoring.d.ts +35 -0
- package/dist/scoring.js +50 -0
- package/dist/shared.d.ts +16 -0
- package/dist/shared.js +20 -0
- package/dist/signer.d.ts +18 -0
- package/dist/signer.js +49 -0
- package/dist/signing-identity.d.ts +1 -0
- package/dist/signing-identity.js +11 -0
- package/dist/status.d.ts +113 -0
- package/dist/status.js +204 -0
- package/dist/succession.d.ts +21 -0
- package/dist/succession.js +67 -0
- package/dist/suite.d.ts +261 -0
- package/dist/suite.js +458 -0
- package/dist/trajectory.d.ts +216 -0
- package/dist/trajectory.js +409 -0
- package/dist/transcript-provenance.d.ts +25 -0
- package/dist/transcript-provenance.js +37 -0
- package/dist/transport-key.d.ts +3 -0
- package/dist/transport-key.js +16 -0
- package/dist/vc.d.ts +29 -0
- package/dist/vc.js +96 -0
- package/dist/verification-bounds.d.ts +5 -0
- package/dist/verification-bounds.js +78 -0
- package/dist/verification-policy.d.ts +32 -0
- package/dist/verification-policy.js +85 -0
- package/dist/witness.d.ts +19 -0
- package/dist/witness.js +80 -0
- package/package.json +65 -4
- package/src/cli.ts +331 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// Fail closed before the legacy value walker: this is a bounded Certify dialect, not general JSON Schema.
|
|
2
|
+
import { isObj } from "./shared.js";
|
|
3
|
+
import { withinVerificationBudget } from "./verification-bounds.js";
|
|
4
|
+
const KEYWORDS = new Set("$schema $id title $defs $ref type const enum required properties additionalProperties items minItems maxItems uniqueItems minLength maxLength pattern minimum maximum anyOf".split(" "));
|
|
5
|
+
const TYPES = new Set(["object", "array", "string", "integer", "boolean"]);
|
|
6
|
+
const REF = /^#\/\$defs\/[A-Za-z][A-Za-z0-9_-]{0,127}$/;
|
|
7
|
+
export function schemaDialectErrors(schema) {
|
|
8
|
+
if (!withinVerificationBudget(schema, { maxBytes: 1_048_576, maxNodes: 50_000, maxDepth: 32 }))
|
|
9
|
+
return ["schema $: exceeds the dialect JSON budget"];
|
|
10
|
+
const out = [], active = new Set(), visited = new Set();
|
|
11
|
+
const root = isObj(schema) ? schema : {};
|
|
12
|
+
const walk = (s, path) => {
|
|
13
|
+
const error = (message) => out.push(`schema ${path}: ${message}`);
|
|
14
|
+
if (!isObj(s)) {
|
|
15
|
+
error("a schema must be an object");
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (active.has(s))
|
|
19
|
+
return;
|
|
20
|
+
if (visited.has(s))
|
|
21
|
+
return;
|
|
22
|
+
active.add(s);
|
|
23
|
+
for (const k of Object.keys(s).sort())
|
|
24
|
+
if (!KEYWORDS.has(k))
|
|
25
|
+
error(`unsupported keyword ${k}`);
|
|
26
|
+
if ("$schema" in s && s.$schema !== "https://json-schema.org/draft/2020-12/schema")
|
|
27
|
+
error("unsupported schema dialect");
|
|
28
|
+
for (const k of ["$id", "title"])
|
|
29
|
+
if (k in s && (typeof s[k] !== "string" || s[k].length > 2048))
|
|
30
|
+
error(`${k} must be a bounded string`);
|
|
31
|
+
if ("type" in s && (typeof s.type !== "string" || !TYPES.has(s.type)))
|
|
32
|
+
error("unsupported type");
|
|
33
|
+
for (const k of ["minLength", "maxLength", "minItems", "maxItems"])
|
|
34
|
+
if (k in s && !(Number.isSafeInteger(s[k]) && s[k] >= 0))
|
|
35
|
+
error(`${k} must be a nonnegative safe integer`);
|
|
36
|
+
for (const k of ["minimum", "maximum"])
|
|
37
|
+
if (k in s && !(typeof s[k] === "number" && Number.isFinite(s[k])))
|
|
38
|
+
error(`${k} must be finite`);
|
|
39
|
+
for (const k of ["additionalProperties", "uniqueItems"])
|
|
40
|
+
if (k in s && typeof s[k] !== "boolean")
|
|
41
|
+
error(`${k} must be boolean`);
|
|
42
|
+
if ("enum" in s && (!Array.isArray(s.enum) || s.enum.length < 1 || s.enum.length > 1000))
|
|
43
|
+
error("enum must contain 1 to 1000 values");
|
|
44
|
+
if ("required" in s && (!Array.isArray(s.required) || s.required.length > 1000 || !s.required.every((x) => typeof x === "string" && x.length <= 256) || new Set(s.required).size !== s.required.length))
|
|
45
|
+
error("required must contain distinct bounded names");
|
|
46
|
+
if ("pattern" in s) {
|
|
47
|
+
if (typeof s.pattern !== "string" || s.pattern.length > 512 || /[^\x00-\x7f]|\\[pPksS]|\(\?(?![:=!])|\\x(?![0-9a-fA-F]{2})|\\u(?![0-9a-fA-F]{4})/.test(s.pattern) || [...s.pattern.matchAll(/\\([A-Za-z0-9])/g)].some((m) => !"dDwWbBtnrfvux".includes(m[1])))
|
|
48
|
+
error("unsupported pattern syntax");
|
|
49
|
+
else
|
|
50
|
+
try {
|
|
51
|
+
new RegExp(s.pattern);
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
error("invalid pattern");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if ("$ref" in s) {
|
|
58
|
+
if (typeof s.$ref !== "string" || !REF.test(s.$ref) || !isObj(root.$defs) || !Object.hasOwn(root.$defs, s.$ref.slice(8)))
|
|
59
|
+
error("unresolved or unsupported reference");
|
|
60
|
+
else {
|
|
61
|
+
const chain = new Set([s]);
|
|
62
|
+
let next = root.$defs[s.$ref.slice(8)];
|
|
63
|
+
while (isObj(next) && typeof next.$ref === "string" && REF.test(next.$ref) && Object.hasOwn(root.$defs, next.$ref.slice(8))) {
|
|
64
|
+
if (chain.has(next) || chain.size > 32) {
|
|
65
|
+
error("non-consuming or excessive reference chain");
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
chain.add(next);
|
|
69
|
+
next = root.$defs[next.$ref.slice(8)];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (Object.keys(s).some((k) => !["$ref", "$defs", "$schema", "$id", "title"].includes(k)))
|
|
73
|
+
error("reference constraint siblings are unsupported");
|
|
74
|
+
}
|
|
75
|
+
for (const k of ["properties", "$defs"])
|
|
76
|
+
if (k in s) {
|
|
77
|
+
const map = s[k];
|
|
78
|
+
if (!isObj(map) || Object.keys(map).length > 1000 || Object.keys(map).some((name) => name.length > 256))
|
|
79
|
+
error(`${k} must contain bounded schema names`);
|
|
80
|
+
else
|
|
81
|
+
for (const [name, child] of Object.entries(map).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0))
|
|
82
|
+
walk(child, `${path}.${k}.${name}`);
|
|
83
|
+
}
|
|
84
|
+
if ("items" in s)
|
|
85
|
+
walk(s.items, `${path}.items`);
|
|
86
|
+
if ("anyOf" in s) {
|
|
87
|
+
if (!Array.isArray(s.anyOf) || s.anyOf.length < 1 || s.anyOf.length > 32)
|
|
88
|
+
error("anyOf must contain 1 to 32 schemas");
|
|
89
|
+
else
|
|
90
|
+
s.anyOf.forEach((child, i) => walk(child, `${path}.anyOf[${i}]`));
|
|
91
|
+
}
|
|
92
|
+
active.delete(s);
|
|
93
|
+
visited.add(s);
|
|
94
|
+
};
|
|
95
|
+
walk(schema, "$");
|
|
96
|
+
return [...new Set(out)].sort();
|
|
97
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://zanii.agency/certify/schemas/clause-map.schema.json",
|
|
4
|
+
"title": "Zanii Certify clause map (spec/profiles.md)",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["v", "type", "slug", "version", "title", "source", "clauses"],
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"properties": {
|
|
9
|
+
"v": { "const": 1 },
|
|
10
|
+
"type": { "const": "certify.clause-map" },
|
|
11
|
+
"slug": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]{0,63}$" },
|
|
12
|
+
"version": { "type": "integer", "minimum": 1 },
|
|
13
|
+
"title": { "$ref": "#/$defs/text" },
|
|
14
|
+
"source": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"required": ["publisher", "document", "url", "date"],
|
|
17
|
+
"additionalProperties": false,
|
|
18
|
+
"properties": {
|
|
19
|
+
"publisher": { "type": "string", "minLength": 1, "maxLength": 200 },
|
|
20
|
+
"document": { "type": "string", "minLength": 1, "maxLength": 500 },
|
|
21
|
+
"url": { "type": "string", "pattern": "^https://" },
|
|
22
|
+
"date": { "type": "string", "pattern": "^\\d{4}-\\d{2}(-\\d{2})?$" }
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"clauses": {
|
|
26
|
+
"type": "array",
|
|
27
|
+
"minItems": 1,
|
|
28
|
+
"items": {
|
|
29
|
+
"type": "object",
|
|
30
|
+
"required": ["id", "title", "ref", "interpretation"],
|
|
31
|
+
"additionalProperties": false,
|
|
32
|
+
"properties": {
|
|
33
|
+
"id": { "type": "string", "pattern": "^[A-Za-z0-9._-]{1,64}$" },
|
|
34
|
+
"title": { "$ref": "#/$defs/text" },
|
|
35
|
+
"ref": { "type": "string", "minLength": 1, "maxLength": 200 },
|
|
36
|
+
"interpretation": { "type": "boolean" }
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"$defs": {
|
|
42
|
+
"text": {
|
|
43
|
+
"type": "object",
|
|
44
|
+
"required": ["en", "ar"],
|
|
45
|
+
"additionalProperties": false,
|
|
46
|
+
"properties": {
|
|
47
|
+
"en": { "type": "string", "minLength": 1, "maxLength": 2000 },
|
|
48
|
+
"ar": { "type": "string", "minLength": 1, "maxLength": 2000 }
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://zanii.agency/certify/schemas/profile.schema.json",
|
|
4
|
+
"title": "Zanii Certify sector profile (spec/profiles.md)",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["v", "type", "slug", "version", "scheme", "title", "description", "levels", "clause_maps", "categories"],
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"properties": {
|
|
9
|
+
"v": { "const": 1 },
|
|
10
|
+
"type": { "const": "certify.profile" },
|
|
11
|
+
"slug": { "$ref": "#/$defs/slug" },
|
|
12
|
+
"version": { "type": "integer", "minimum": 1 },
|
|
13
|
+
"scheme": { "enum": ["zanii-certify/0.1", "zanii-certify/0.2", "zanii-certify/0.3", "zanii-certify/0.4"] },
|
|
14
|
+
"title": { "$ref": "#/$defs/text" },
|
|
15
|
+
"description": { "$ref": "#/$defs/text" },
|
|
16
|
+
"levels": {
|
|
17
|
+
"type": "array",
|
|
18
|
+
"minItems": 1,
|
|
19
|
+
"uniqueItems": true,
|
|
20
|
+
"items": { "enum": [1, 2, 3] }
|
|
21
|
+
},
|
|
22
|
+
"live_evidence": { "$ref": "#/$defs/live_evidence" },
|
|
23
|
+
"scenarios": { "type": "boolean" },
|
|
24
|
+
"clause_maps": {
|
|
25
|
+
"type": "array",
|
|
26
|
+
"uniqueItems": true,
|
|
27
|
+
"items": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]{0,63}/[1-9][0-9]*$" }
|
|
28
|
+
},
|
|
29
|
+
"categories": {
|
|
30
|
+
"type": "array",
|
|
31
|
+
"minItems": 1,
|
|
32
|
+
"items": { "$ref": "#/$defs/category" }
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"$defs": {
|
|
36
|
+
"live_evidence": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"additionalProperties": false,
|
|
39
|
+
"properties": {
|
|
40
|
+
"max_guard_block_ppm": { "type": "integer", "minimum": 0, "maximum": 1000000 },
|
|
41
|
+
"max_contradicted_claim_ppm": { "type": "integer", "minimum": 0, "maximum": 1000000 },
|
|
42
|
+
"max_budget_breaches": { "type": "integer", "minimum": 0, "maximum": 1000000 }
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"slug": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]{0,63}$" },
|
|
46
|
+
"text": {
|
|
47
|
+
"type": "object",
|
|
48
|
+
"required": ["en", "ar"],
|
|
49
|
+
"additionalProperties": false,
|
|
50
|
+
"properties": {
|
|
51
|
+
"en": { "type": "string", "minLength": 1, "maxLength": 2000 },
|
|
52
|
+
"ar": { "type": "string", "minLength": 1, "maxLength": 2000 }
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"category": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"required": ["id", "title", "description", "required_levels", "min_trials", "threshold_ppm", "ci_rule", "clauses"],
|
|
58
|
+
"additionalProperties": false,
|
|
59
|
+
"properties": {
|
|
60
|
+
"id": { "type": "string", "pattern": "^[a-z][a-z0-9_]{0,63}$" },
|
|
61
|
+
"title": { "$ref": "#/$defs/text" },
|
|
62
|
+
"description": { "$ref": "#/$defs/text" },
|
|
63
|
+
"required_levels": {
|
|
64
|
+
"type": "array",
|
|
65
|
+
"minItems": 1,
|
|
66
|
+
"uniqueItems": true,
|
|
67
|
+
"items": { "enum": [1, 2, 3] }
|
|
68
|
+
},
|
|
69
|
+
"min_trials": { "type": "integer", "minimum": 1, "maximum": 1000000 },
|
|
70
|
+
"threshold_ppm": { "type": "integer", "minimum": 0, "maximum": 1000000 },
|
|
71
|
+
"ci_rule": { "const": "wilson95-low" },
|
|
72
|
+
"execution": { "enum": ["single_turn", "trajectory"] },
|
|
73
|
+
"clauses": {
|
|
74
|
+
"type": "array",
|
|
75
|
+
"uniqueItems": true,
|
|
76
|
+
"items": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]{0,63}:[A-Za-z0-9._-]{1,64}$" }
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|