@noeos/verification-engine 0.0.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.
Files changed (184) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE +201 -0
  3. package/NOTICE +11 -0
  4. package/README.md +7 -0
  5. package/dist/cjs/api/engine.js +271 -0
  6. package/dist/cjs/api/types.js +10 -0
  7. package/dist/cjs/chains/chain-builder.js +541 -0
  8. package/dist/cjs/chains/duplicate-detector.js +208 -0
  9. package/dist/cjs/chains/verify-chain.js +656 -0
  10. package/dist/cjs/contracts/generated.js +512 -0
  11. package/dist/cjs/contracts/schema-assets.js +6 -0
  12. package/dist/cjs/contracts/vector-assets.js +6 -0
  13. package/dist/cjs/domain/algorithm-id.js +5 -0
  14. package/dist/cjs/domain/byte-view.js +7 -0
  15. package/dist/cjs/domain/chain.js +3 -0
  16. package/dist/cjs/domain/diagnostic.js +6 -0
  17. package/dist/cjs/domain/digest.js +37 -0
  18. package/dist/cjs/domain/duplicate-policy.js +3 -0
  19. package/dist/cjs/domain/evidence.js +10 -0
  20. package/dist/cjs/domain/identifiers.js +52 -0
  21. package/dist/cjs/domain/json-value.js +3 -0
  22. package/dist/cjs/domain/limits.js +24 -0
  23. package/dist/cjs/domain/operation-result.js +19 -0
  24. package/dist/cjs/domain/position.js +16 -0
  25. package/dist/cjs/domain/protocol-version.js +5 -0
  26. package/dist/cjs/domain/rule.js +3 -0
  27. package/dist/cjs/domain/stream.js +3 -0
  28. package/dist/cjs/domain/version.js +16 -0
  29. package/dist/cjs/evidence/digest-evidence.js +22 -0
  30. package/dist/cjs/evidence/evidence-parser.js +288 -0
  31. package/dist/cjs/framing/frame-builders.js +124 -0
  32. package/dist/cjs/framing/frame-encoder.js +238 -0
  33. package/dist/cjs/framing/frame-parser.js +173 -0
  34. package/dist/cjs/framing/frame-types.js +3 -0
  35. package/dist/cjs/hashing/hash-adapter.js +90 -0
  36. package/dist/cjs/hashing/hash-frame.js +16 -0
  37. package/dist/cjs/index.js +16 -0
  38. package/dist/cjs/normalization/byte-sink.js +70 -0
  39. package/dist/cjs/normalization/jcs-profile.js +154 -0
  40. package/dist/cjs/normalization/normalize.js +56 -0
  41. package/dist/cjs/normalization/profile-registry.js +66 -0
  42. package/dist/cjs/normalization/profile.js +3 -0
  43. package/dist/cjs/normalization/raw-bytes-profile.js +27 -0
  44. package/dist/cjs/package.json +3 -0
  45. package/dist/cjs/profiles.js +9 -0
  46. package/dist/cjs/records/record-service.js +278 -0
  47. package/dist/cjs/rules/rule-set.js +211 -0
  48. package/dist/cjs/schemas.js +6 -0
  49. package/dist/cjs/validation/algorithm-validation.js +12 -0
  50. package/dist/cjs/validation/diagnostic-collector.js +159 -0
  51. package/dist/cjs/validation/digest-validation.js +48 -0
  52. package/dist/cjs/validation/identifier-validation.js +33 -0
  53. package/dist/cjs/validation/json-text-parser.js +297 -0
  54. package/dist/cjs/validation/json-value-validation.js +155 -0
  55. package/dist/cjs/validation/limit-validation.js +75 -0
  56. package/dist/cjs/validation/object-inspection.js +60 -0
  57. package/dist/cjs/validation/position-validation.js +13 -0
  58. package/dist/cjs/validation/result-helpers.js +9 -0
  59. package/dist/cjs/validation/utf8-validation.js +69 -0
  60. package/dist/cjs/validation/version-validation.js +31 -0
  61. package/dist/cjs/vectors.js +6 -0
  62. package/dist/esm/api/engine.js +266 -0
  63. package/dist/esm/api/types.js +4 -0
  64. package/dist/esm/chains/chain-builder.js +536 -0
  65. package/dist/esm/chains/duplicate-detector.js +204 -0
  66. package/dist/esm/chains/verify-chain.js +652 -0
  67. package/dist/esm/contracts/generated.js +509 -0
  68. package/dist/esm/contracts/schema-assets.js +2 -0
  69. package/dist/esm/contracts/vector-assets.js +2 -0
  70. package/dist/esm/domain/algorithm-id.js +2 -0
  71. package/dist/esm/domain/byte-view.js +4 -0
  72. package/dist/esm/domain/chain.js +2 -0
  73. package/dist/esm/domain/diagnostic.js +3 -0
  74. package/dist/esm/domain/digest.js +32 -0
  75. package/dist/esm/domain/duplicate-policy.js +2 -0
  76. package/dist/esm/domain/evidence.js +7 -0
  77. package/dist/esm/domain/identifiers.js +45 -0
  78. package/dist/esm/domain/json-value.js +2 -0
  79. package/dist/esm/domain/limits.js +21 -0
  80. package/dist/esm/domain/operation-result.js +15 -0
  81. package/dist/esm/domain/position.js +12 -0
  82. package/dist/esm/domain/protocol-version.js +2 -0
  83. package/dist/esm/domain/rule.js +2 -0
  84. package/dist/esm/domain/stream.js +2 -0
  85. package/dist/esm/domain/version.js +12 -0
  86. package/dist/esm/evidence/digest-evidence.js +19 -0
  87. package/dist/esm/evidence/evidence-parser.js +281 -0
  88. package/dist/esm/framing/frame-builders.js +114 -0
  89. package/dist/esm/framing/frame-encoder.js +234 -0
  90. package/dist/esm/framing/frame-parser.js +170 -0
  91. package/dist/esm/framing/frame-types.js +2 -0
  92. package/dist/esm/hashing/hash-adapter.js +84 -0
  93. package/dist/esm/hashing/hash-frame.js +12 -0
  94. package/dist/esm/index.js +5 -0
  95. package/dist/esm/normalization/byte-sink.js +66 -0
  96. package/dist/esm/normalization/jcs-profile.js +151 -0
  97. package/dist/esm/normalization/normalize.js +52 -0
  98. package/dist/esm/normalization/profile-registry.js +62 -0
  99. package/dist/esm/normalization/profile.js +2 -0
  100. package/dist/esm/normalization/raw-bytes-profile.js +24 -0
  101. package/dist/esm/profiles.js +6 -0
  102. package/dist/esm/records/record-service.js +270 -0
  103. package/dist/esm/rules/rule-set.js +206 -0
  104. package/dist/esm/schemas.js +2 -0
  105. package/dist/esm/validation/algorithm-validation.js +9 -0
  106. package/dist/esm/validation/diagnostic-collector.js +154 -0
  107. package/dist/esm/validation/digest-validation.js +43 -0
  108. package/dist/esm/validation/identifier-validation.js +27 -0
  109. package/dist/esm/validation/json-text-parser.js +294 -0
  110. package/dist/esm/validation/json-value-validation.js +152 -0
  111. package/dist/esm/validation/limit-validation.js +71 -0
  112. package/dist/esm/validation/object-inspection.js +54 -0
  113. package/dist/esm/validation/position-validation.js +10 -0
  114. package/dist/esm/validation/result-helpers.js +6 -0
  115. package/dist/esm/validation/utf8-validation.js +63 -0
  116. package/dist/esm/validation/version-validation.js +26 -0
  117. package/dist/esm/vectors.js +2 -0
  118. package/dist/types/api/engine.d.ts +8 -0
  119. package/dist/types/api/types.d.ts +124 -0
  120. package/dist/types/chains/chain-builder.d.ts +42 -0
  121. package/dist/types/chains/duplicate-detector.d.ts +18 -0
  122. package/dist/types/chains/verify-chain.d.ts +9 -0
  123. package/dist/types/contracts/generated.d.ts +442 -0
  124. package/dist/types/contracts/schema-assets.d.ts +2 -0
  125. package/dist/types/contracts/vector-assets.d.ts +2 -0
  126. package/dist/types/domain/algorithm-id.d.ts +4 -0
  127. package/dist/types/domain/byte-view.d.ts +1 -0
  128. package/dist/types/domain/chain.d.ts +43 -0
  129. package/dist/types/domain/diagnostic.d.ts +23 -0
  130. package/dist/types/domain/digest.d.ts +12 -0
  131. package/dist/types/domain/duplicate-policy.d.ts +26 -0
  132. package/dist/types/domain/evidence.d.ts +100 -0
  133. package/dist/types/domain/identifiers.d.ts +29 -0
  134. package/dist/types/domain/json-value.d.ts +6 -0
  135. package/dist/types/domain/limits.d.ts +13 -0
  136. package/dist/types/domain/operation-result.d.ts +12 -0
  137. package/dist/types/domain/position.d.ts +8 -0
  138. package/dist/types/domain/protocol-version.d.ts +2 -0
  139. package/dist/types/domain/rule.d.ts +34 -0
  140. package/dist/types/domain/stream.d.ts +5 -0
  141. package/dist/types/domain/version.d.ts +8 -0
  142. package/dist/types/evidence/digest-evidence.d.ts +4 -0
  143. package/dist/types/evidence/evidence-parser.d.ts +8 -0
  144. package/dist/types/framing/frame-builders.d.ts +40 -0
  145. package/dist/types/framing/frame-encoder.d.ts +6 -0
  146. package/dist/types/framing/frame-parser.d.ts +4 -0
  147. package/dist/types/framing/frame-types.d.ts +27 -0
  148. package/dist/types/hashing/hash-adapter.d.ts +12 -0
  149. package/dist/types/hashing/hash-frame.d.ts +6 -0
  150. package/dist/types/index.d.ts +8 -0
  151. package/dist/types/normalization/byte-sink.d.ts +19 -0
  152. package/dist/types/normalization/jcs-profile.d.ts +3 -0
  153. package/dist/types/normalization/normalize.d.ts +11 -0
  154. package/dist/types/normalization/profile-registry.d.ts +26 -0
  155. package/dist/types/normalization/profile.d.ts +22 -0
  156. package/dist/types/normalization/raw-bytes-profile.d.ts +2 -0
  157. package/dist/types/profiles.d.ts +8 -0
  158. package/dist/types/records/record-service.d.ts +38 -0
  159. package/dist/types/rules/rule-set.d.ts +13 -0
  160. package/dist/types/schemas.d.ts +2 -0
  161. package/dist/types/validation/algorithm-validation.d.ts +3 -0
  162. package/dist/types/validation/diagnostic-collector.d.ts +24 -0
  163. package/dist/types/validation/digest-validation.d.ts +6 -0
  164. package/dist/types/validation/identifier-validation.d.ts +6 -0
  165. package/dist/types/validation/json-text-parser.d.ts +4 -0
  166. package/dist/types/validation/json-value-validation.d.ts +4 -0
  167. package/dist/types/validation/limit-validation.d.ts +4 -0
  168. package/dist/types/validation/object-inspection.d.ts +11 -0
  169. package/dist/types/validation/position-validation.d.ts +3 -0
  170. package/dist/types/validation/result-helpers.d.ts +3 -0
  171. package/dist/types/validation/utf8-validation.d.ts +5 -0
  172. package/dist/types/validation/version-validation.d.ts +9 -0
  173. package/dist/types/vectors.d.ts +2 -0
  174. package/package.json +61 -0
  175. package/schemas/chain-summary.v1.schema.json +156 -0
  176. package/schemas/diagnostic.v1.schema.json +107 -0
  177. package/schemas/link-evidence.v1.schema.json +165 -0
  178. package/schemas/record-evidence.v1.schema.json +91 -0
  179. package/schemas/vector-set.v1.schema.json +52 -0
  180. package/vectors/evidence.json +26 -0
  181. package/vectors/framing.json +136 -0
  182. package/vectors/hashing.json +58 -0
  183. package/vectors/invalid.json +56 -0
  184. package/vectors/manifest.json +46 -0
@@ -0,0 +1,24 @@
1
+ import type { Diagnostic, DiagnosticCode, DiagnosticDetail, DiagnosticPhase, DiagnosticSeverity } from "../domain/diagnostic.js";
2
+ import type { Limits } from "../domain/limits.js";
3
+ export interface DiagnosticOptions {
4
+ readonly path?: string;
5
+ readonly recordId?: string;
6
+ readonly position?: number;
7
+ readonly details?: Readonly<Record<string, DiagnosticDetail>>;
8
+ readonly causeCode?: string;
9
+ /** Only RuleSet may override the catalog default for RULE_FAILED. */
10
+ readonly severity?: DiagnosticSeverity;
11
+ /** Stable namespaced key supplied by a trusted rule. */
12
+ readonly messageKey?: string;
13
+ }
14
+ export declare function createDiagnostic(code: DiagnosticCode, phase: DiagnosticPhase, options?: DiagnosticOptions): Diagnostic;
15
+ export declare class DiagnosticCollector {
16
+ private readonly limits;
17
+ private readonly entries;
18
+ private truncated;
19
+ constructor(limits: Limits);
20
+ add(diagnostic: Diagnostic): void;
21
+ addCode(code: DiagnosticCode, phase: DiagnosticPhase, options?: DiagnosticOptions): void;
22
+ hasErrors(): boolean;
23
+ finish(): readonly Diagnostic[];
24
+ }
@@ -0,0 +1,6 @@
1
+ import type { AlgorithmId } from "../domain/algorithm-id.js";
2
+ import { Digest } from "../domain/digest.js";
3
+ import type { OperationResult } from "../domain/operation-result.js";
4
+ export declare function digestLength(algorithm: AlgorithmId): number;
5
+ export declare function validateDigest(value: unknown, algorithm: unknown): OperationResult<Digest>;
6
+ export declare function equalDigest(left: Digest, right: Digest): boolean;
@@ -0,0 +1,6 @@
1
+ import type { ContextId, ProfileId, RecordId, SequenceId } from "../domain/identifiers.js";
2
+ import type { OperationResult } from "../domain/operation-result.js";
3
+ export declare function validateRecordId(value: unknown): OperationResult<RecordId>;
4
+ export declare function validateSequenceId(value: unknown): OperationResult<SequenceId>;
5
+ export declare function validateContextId(value: unknown): OperationResult<ContextId>;
6
+ export declare function validateProfileId(value: unknown): OperationResult<ProfileId>;
@@ -0,0 +1,4 @@
1
+ import type { JsonValue } from "../domain/json-value.js";
2
+ import type { Limits } from "../domain/limits.js";
3
+ import type { OperationResult } from "../domain/operation-result.js";
4
+ export declare function parseJsonText(input: unknown, limits: Limits): OperationResult<JsonValue>;
@@ -0,0 +1,4 @@
1
+ import type { JsonValue } from "../domain/json-value.js";
2
+ import type { Limits } from "../domain/limits.js";
3
+ import type { OperationResult } from "../domain/operation-result.js";
4
+ export declare function validateJsonValue(value: unknown, limits: Limits): OperationResult<JsonValue>;
@@ -0,0 +1,4 @@
1
+ import type { Limits } from "../domain/limits.js";
2
+ import type { OperationResult } from "../domain/operation-result.js";
3
+ export declare function validateLimits(value: unknown): OperationResult<Limits>;
4
+ export declare function validateLimitValue(value: number, maximum: number): OperationResult<number>;
@@ -0,0 +1,11 @@
1
+ export type DataProperty = readonly [name: string, value: unknown];
2
+ export type ExactPropertyValues = readonly unknown[];
3
+ interface DataPropertyDescriptor extends PropertyDescriptor {
4
+ readonly value: unknown;
5
+ }
6
+ export declare function inspectPlainObject(value: unknown): readonly DataProperty[] | undefined;
7
+ /** Internal fixed-shape inspection that preserves the no-getter/no-proxy boundary. */
8
+ export declare function inspectExactProperties(value: unknown, names: readonly string[]): ExactPropertyValues | undefined;
9
+ export declare function isDataPropertyDescriptor(descriptor: PropertyDescriptor): descriptor is DataPropertyDescriptor;
10
+ export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
11
+ export {};
@@ -0,0 +1,3 @@
1
+ import { Position } from "../domain/position.js";
2
+ import type { OperationResult } from "../domain/operation-result.js";
3
+ export declare function validatePosition(value: unknown): OperationResult<Position>;
@@ -0,0 +1,3 @@
1
+ import type { DiagnosticCode, DiagnosticPhase } from "../domain/diagnostic.js";
2
+ import type { OperationResult } from "../domain/operation-result.js";
3
+ export declare function failureWithCode<T>(code: DiagnosticCode, phase: DiagnosticPhase): OperationResult<T>;
@@ -0,0 +1,5 @@
1
+ import type { OperationResult } from "../domain/operation-result.js";
2
+ export declare function hasWellFormedUnicode(value: string): boolean;
3
+ export declare function utf8ByteLength(value: string): number | undefined;
4
+ export declare function encodeUtf8(value: unknown, maxBytes: number): OperationResult<Uint8Array>;
5
+ export declare function decodeUtf8(value: Uint8Array): OperationResult<string>;
@@ -0,0 +1,9 @@
1
+ import type { ProfileId } from "../domain/identifiers.js";
2
+ import type { ProfileVersion } from "../domain/version.js";
3
+ import type { OperationResult } from "../domain/operation-result.js";
4
+ export declare function validateProfileVersion(value: unknown): OperationResult<ProfileVersion>;
5
+ export declare function validateProtocolVersion(value: unknown): OperationResult<1>;
6
+ export declare function validateProfileReference(id: unknown, version: unknown): OperationResult<{
7
+ readonly id: ProfileId;
8
+ readonly version: ProfileVersion;
9
+ }>;
@@ -0,0 +1,2 @@
1
+ export { VECTOR_SET } from "./contracts/vector-assets.js";
2
+ export type { VectorCategory } from "./contracts/vector-assets.js";
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@noeos/verification-engine",
3
+ "version": "0.0.0",
4
+ "private": false,
5
+ "description": "Deterministic, offline-first verification engine for Noeos protocols.",
6
+ "license": "Apache-2.0",
7
+ "author": "Noeos contributors",
8
+ "type": "module",
9
+ "sideEffects": false,
10
+ "engines": {
11
+ "node": ">=22.14.0 <23 || >=24.0.0 <25"
12
+ },
13
+ "main": "./dist/cjs/index.js",
14
+ "module": "./dist/esm/index.js",
15
+ "types": "./dist/types/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/types/index.d.ts",
19
+ "import": "./dist/esm/index.js",
20
+ "require": "./dist/cjs/index.js"
21
+ },
22
+ "./schemas": {
23
+ "types": "./dist/types/schemas.d.ts",
24
+ "import": "./dist/esm/schemas.js",
25
+ "require": "./dist/cjs/schemas.js"
26
+ },
27
+ "./profiles": {
28
+ "types": "./dist/types/profiles.d.ts",
29
+ "import": "./dist/esm/profiles.js",
30
+ "require": "./dist/cjs/profiles.js"
31
+ },
32
+ "./vectors": {
33
+ "types": "./dist/types/vectors.d.ts",
34
+ "import": "./dist/esm/vectors.js",
35
+ "require": "./dist/cjs/vectors.js"
36
+ }
37
+ },
38
+ "files": [
39
+ "dist/",
40
+ "schemas/**/*.json",
41
+ "vectors/**/*.json",
42
+ "CHANGELOG.md",
43
+ "LICENSE",
44
+ "NOTICE",
45
+ "README.md"
46
+ ],
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "git+https://github.com/noeos/verification-engine.git",
50
+ "directory": "packages/engine"
51
+ },
52
+ "bugs": {
53
+ "url": "https://github.com/noeos/verification-engine/issues"
54
+ },
55
+ "homepage": "https://github.com/noeos/verification-engine#readme",
56
+ "publishConfig": {
57
+ "access": "public",
58
+ "provenance": true,
59
+ "registry": "https://registry.npmjs.org/"
60
+ }
61
+ }
@@ -0,0 +1,156 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:noeos:verification-engine:chain-summary:1",
4
+ "title": "Noeos Verification Engine Chain Summary Evidence v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "$schema",
9
+ "protocolVersion",
10
+ "contextId",
11
+ "sequenceId",
12
+ "profile",
13
+ "algorithm",
14
+ "count",
15
+ "boundaries",
16
+ "status",
17
+ "diagnostics"
18
+ ],
19
+ "properties": {
20
+ "$schema": { "const": "urn:noeos:verification-engine:chain-summary:1" },
21
+ "protocolVersion": { "const": 1 },
22
+ "contextId": { "$ref": "#/$defs/identifier" },
23
+ "sequenceId": { "$ref": "#/$defs/identifier" },
24
+ "profile": { "$ref": "#/$defs/profile" },
25
+ "algorithm": { "$ref": "#/$defs/algorithm" },
26
+ "count": { "$ref": "#/$defs/safeInteger" },
27
+ "firstPosition": { "$ref": "#/$defs/safeInteger" },
28
+ "lastPosition": { "$ref": "#/$defs/safeInteger" },
29
+ "firstLinkDigest": { "$ref": "#/$defs/digest" },
30
+ "finalLinkDigest": { "$ref": "#/$defs/digest" },
31
+ "boundaries": {
32
+ "type": "object",
33
+ "additionalProperties": false,
34
+ "required": ["start", "end"],
35
+ "properties": {
36
+ "start": { "enum": ["verified", "unverified", "not-applicable"] },
37
+ "end": { "enum": ["verified", "unverified", "not-applicable"] }
38
+ }
39
+ },
40
+ "status": { "enum": ["valid", "invalid", "indeterminate", "aborted"] },
41
+ "diagnostics": {
42
+ "type": "object",
43
+ "additionalProperties": false,
44
+ "required": ["errors", "warnings", "info", "truncated"],
45
+ "properties": {
46
+ "errors": { "$ref": "#/$defs/safeInteger" },
47
+ "warnings": { "$ref": "#/$defs/safeInteger" },
48
+ "info": { "$ref": "#/$defs/safeInteger" },
49
+ "truncated": { "type": "boolean" }
50
+ }
51
+ }
52
+ },
53
+ "allOf": [
54
+ {
55
+ "if": { "type": "object", "properties": { "count": { "const": 0 } } },
56
+ "then": {
57
+ "not": {
58
+ "anyOf": [
59
+ {
60
+ "type": "object",
61
+ "properties": { "firstPosition": true },
62
+ "required": ["firstPosition"]
63
+ },
64
+ {
65
+ "type": "object",
66
+ "properties": { "lastPosition": true },
67
+ "required": ["lastPosition"]
68
+ },
69
+ {
70
+ "type": "object",
71
+ "properties": { "firstLinkDigest": true },
72
+ "required": ["firstLinkDigest"]
73
+ },
74
+ {
75
+ "type": "object",
76
+ "properties": { "finalLinkDigest": true },
77
+ "required": ["finalLinkDigest"]
78
+ }
79
+ ]
80
+ }
81
+ },
82
+ "else": {
83
+ "type": "object",
84
+ "properties": {
85
+ "firstPosition": true,
86
+ "lastPosition": true,
87
+ "firstLinkDigest": true,
88
+ "finalLinkDigest": true
89
+ },
90
+ "required": ["firstPosition", "lastPosition", "firstLinkDigest", "finalLinkDigest"]
91
+ }
92
+ },
93
+ { "$ref": "#/$defs/digestLengths" }
94
+ ],
95
+ "$defs": {
96
+ "identifier": {
97
+ "type": "string",
98
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$",
99
+ "maxLength": 128
100
+ },
101
+ "profile": {
102
+ "type": "object",
103
+ "additionalProperties": false,
104
+ "required": ["id", "version"],
105
+ "properties": {
106
+ "id": {
107
+ "type": "string",
108
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$",
109
+ "maxLength": 128
110
+ },
111
+ "version": {
112
+ "type": "string",
113
+ "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:-[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$",
114
+ "maxLength": 256
115
+ }
116
+ }
117
+ },
118
+ "algorithm": { "enum": ["sha-256", "sha-384", "sha-512"] },
119
+ "safeInteger": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
120
+ "digest": { "type": "string", "pattern": "^[0-9a-f]+$", "maxLength": 128 },
121
+ "digestLengths": {
122
+ "allOf": [
123
+ {
124
+ "if": { "type": "object", "properties": { "algorithm": { "const": "sha-256" } } },
125
+ "then": {
126
+ "type": "object",
127
+ "properties": {
128
+ "firstLinkDigest": { "type": "string", "minLength": 64, "maxLength": 64 },
129
+ "finalLinkDigest": { "type": "string", "minLength": 64, "maxLength": 64 }
130
+ }
131
+ }
132
+ },
133
+ {
134
+ "if": { "type": "object", "properties": { "algorithm": { "const": "sha-384" } } },
135
+ "then": {
136
+ "type": "object",
137
+ "properties": {
138
+ "firstLinkDigest": { "type": "string", "minLength": 96, "maxLength": 96 },
139
+ "finalLinkDigest": { "type": "string", "minLength": 96, "maxLength": 96 }
140
+ }
141
+ }
142
+ },
143
+ {
144
+ "if": { "type": "object", "properties": { "algorithm": { "const": "sha-512" } } },
145
+ "then": {
146
+ "type": "object",
147
+ "properties": {
148
+ "firstLinkDigest": { "type": "string", "minLength": 128, "maxLength": 128 },
149
+ "finalLinkDigest": { "type": "string", "minLength": 128, "maxLength": 128 }
150
+ }
151
+ }
152
+ }
153
+ ]
154
+ }
155
+ }
156
+ }
@@ -0,0 +1,107 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:noeos:verification-engine:diagnostic:1",
4
+ "title": "Noeos Verification Engine Diagnostic v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["$schema", "code", "severity", "phase", "messageKey"],
8
+ "properties": {
9
+ "$schema": { "const": "urn:noeos:verification-engine:diagnostic:1" },
10
+ "code": {
11
+ "enum": [
12
+ "INPUT_REQUIRED",
13
+ "INPUT_TYPE_INVALID",
14
+ "INPUT_LIMIT_EXCEEDED",
15
+ "IDENTIFIER_INVALID",
16
+ "VERSION_INVALID",
17
+ "JSON_SYNTAX_INVALID",
18
+ "JSON_DUPLICATE_KEY",
19
+ "JSON_VALUE_UNSUPPORTED",
20
+ "JSON_NUMBER_UNSAFE",
21
+ "UTF8_INVALID",
22
+ "NDJSON_LINE_EMPTY",
23
+ "NDJSON_LINE_TOO_LARGE",
24
+ "PROFILE_UNKNOWN",
25
+ "PROFILE_VERSION_UNSUPPORTED",
26
+ "PROFILE_VERSION_CONFLICT",
27
+ "PROFILE_INPUT_KIND_MISMATCH",
28
+ "NORMALIZATION_FAILED",
29
+ "ALGORITHM_UNKNOWN",
30
+ "ALGORITHM_FORBIDDEN",
31
+ "ALGORITHM_VERIFY_ONLY",
32
+ "DIGEST_ENCODING_INVALID",
33
+ "DIGEST_LENGTH_INVALID",
34
+ "FRAME_MAGIC_INVALID",
35
+ "FRAME_VERSION_UNSUPPORTED",
36
+ "FRAME_KIND_UNKNOWN",
37
+ "FRAME_FIELD_UNKNOWN",
38
+ "FRAME_FIELD_MISSING",
39
+ "FRAME_FIELD_DUPLICATE",
40
+ "FRAME_FIELD_ORDER_INVALID",
41
+ "FRAME_FIELD_TYPE_INVALID",
42
+ "FRAME_LENGTH_INVALID",
43
+ "FRAME_TRAILING_DATA",
44
+ "EVIDENCE_SCHEMA_UNKNOWN",
45
+ "EVIDENCE_INVALID",
46
+ "CONTENT_DIGEST_MISMATCH",
47
+ "RECORD_DIGEST_MISMATCH",
48
+ "RECORD_ID_DUPLICATE",
49
+ "CONTENT_DUPLICATE",
50
+ "LINK_DIGEST_DUPLICATE",
51
+ "POSITION_MISMATCH",
52
+ "PREVIOUS_LINK_MISMATCH",
53
+ "LINK_DIGEST_MISMATCH",
54
+ "CHAIN_CONFIGURATION_MISMATCH",
55
+ "CHAIN_FORK",
56
+ "EXPECTED_COUNT_MISMATCH",
57
+ "FINAL_LINK_MISMATCH",
58
+ "BOUNDARY_UNVERIFIED",
59
+ "EMPTY_CHAIN_FORBIDDEN",
60
+ "RULE_FAILED",
61
+ "RULE_EXECUTION_FAILED",
62
+ "RULE_VERSION_CONFLICT",
63
+ "DIAGNOSTIC_LIMIT_REACHED",
64
+ "INPUT_STREAM_FAILED",
65
+ "OUTPUT_SINK_FAILED",
66
+ "OPERATION_ABORTED",
67
+ "RESOURCE_BUDGET_EXCEEDED",
68
+ "CONCURRENT_USE_FORBIDDEN",
69
+ "BUILDER_FINALIZED",
70
+ "BUILDER_FAILED",
71
+ "OBSERVER_FAILED",
72
+ "IO_READ_FAILED",
73
+ "IO_WRITE_FAILED",
74
+ "OUTPUT_EXISTS",
75
+ "INTERNAL_INVARIANT_BROKEN"
76
+ ]
77
+ },
78
+ "severity": { "enum": ["error", "warning", "info"] },
79
+ "phase": { "enum": ["input", "normalization", "record", "link", "chain", "output"] },
80
+ "messageKey": { "type": "string", "pattern": "^[a-z][a-z0-9.-]{0,127}$", "maxLength": 128 },
81
+ "path": {
82
+ "type": "string",
83
+ "maxLength": 512,
84
+ "pattern": "^(?:|/(?:[A-Za-z0-9._~-]|~[01])+(?:/(?:[A-Za-z0-9._~-]|~[01])+)*|[a-z][a-z0-9.-]{0,127})$"
85
+ },
86
+ "recordId": {
87
+ "type": "string",
88
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$",
89
+ "maxLength": 128
90
+ },
91
+ "position": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
92
+ "details": {
93
+ "type": "object",
94
+ "maxProperties": 32,
95
+ "propertyNames": { "type": "string", "pattern": "^[a-z][a-z0-9.-]{0,63}$" },
96
+ "additionalProperties": {
97
+ "anyOf": [
98
+ { "type": "string", "maxLength": 256 },
99
+ { "type": "number" },
100
+ { "type": "boolean" },
101
+ { "type": "null" }
102
+ ]
103
+ }
104
+ },
105
+ "causeCode": { "type": "string", "pattern": "^[A-Z][A-Z0-9_]{1,127}$", "maxLength": 128 }
106
+ }
107
+ }
@@ -0,0 +1,165 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:noeos:verification-engine:link-evidence:1",
4
+ "title": "Noeos Verification Engine Link Evidence v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "$schema",
9
+ "protocolVersion",
10
+ "contextId",
11
+ "sequenceId",
12
+ "position",
13
+ "recordId",
14
+ "profile",
15
+ "algorithm",
16
+ "normalizedByteLength",
17
+ "contentDigest",
18
+ "recordDigest",
19
+ "previous",
20
+ "linkDigest"
21
+ ],
22
+ "properties": {
23
+ "$schema": { "const": "urn:noeos:verification-engine:link-evidence:1" },
24
+ "protocolVersion": { "const": 1 },
25
+ "contextId": { "$ref": "#/$defs/identifier" },
26
+ "sequenceId": { "$ref": "#/$defs/identifier" },
27
+ "position": { "$ref": "#/$defs/safeInteger" },
28
+ "recordId": { "$ref": "#/$defs/identifier" },
29
+ "profile": { "$ref": "#/$defs/profile" },
30
+ "algorithm": { "$ref": "#/$defs/algorithm" },
31
+ "normalizedByteLength": { "$ref": "#/$defs/safeInteger" },
32
+ "contentDigest": { "$ref": "#/$defs/digest" },
33
+ "recordDigest": { "$ref": "#/$defs/digest" },
34
+ "previous": { "$ref": "#/$defs/previous" },
35
+ "linkDigest": { "$ref": "#/$defs/digest" }
36
+ },
37
+ "allOf": [
38
+ {
39
+ "if": { "type": "object", "properties": { "position": { "const": 0 } } },
40
+ "then": { "type": "object", "properties": { "previous": { "const": { "kind": "none" } } } },
41
+ "else": {
42
+ "type": "object",
43
+ "properties": { "previous": { "$ref": "#/$defs/previousDigest" } }
44
+ }
45
+ },
46
+ { "$ref": "#/$defs/digestLengths" }
47
+ ],
48
+ "$defs": {
49
+ "identifier": {
50
+ "type": "string",
51
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$",
52
+ "maxLength": 128
53
+ },
54
+ "profile": {
55
+ "type": "object",
56
+ "additionalProperties": false,
57
+ "required": ["id", "version"],
58
+ "properties": {
59
+ "id": {
60
+ "type": "string",
61
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$",
62
+ "maxLength": 128
63
+ },
64
+ "version": {
65
+ "type": "string",
66
+ "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:-[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$",
67
+ "maxLength": 256
68
+ }
69
+ }
70
+ },
71
+ "algorithm": { "enum": ["sha-256", "sha-384", "sha-512"] },
72
+ "safeInteger": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
73
+ "digest": { "type": "string", "pattern": "^[0-9a-f]+$", "maxLength": 128 },
74
+ "previous": {
75
+ "oneOf": [
76
+ {
77
+ "type": "object",
78
+ "additionalProperties": false,
79
+ "required": ["kind"],
80
+ "properties": { "kind": { "const": "none" } }
81
+ },
82
+ { "$ref": "#/$defs/previousDigest" }
83
+ ]
84
+ },
85
+ "previousDigest": {
86
+ "type": "object",
87
+ "additionalProperties": false,
88
+ "required": ["kind", "value"],
89
+ "properties": { "kind": { "const": "digest" }, "value": { "$ref": "#/$defs/digest" } }
90
+ },
91
+ "digestLengths": {
92
+ "allOf": [
93
+ {
94
+ "if": { "type": "object", "properties": { "algorithm": { "const": "sha-256" } } },
95
+ "then": {
96
+ "type": "object",
97
+ "properties": {
98
+ "contentDigest": { "type": "string", "minLength": 64, "maxLength": 64 },
99
+ "recordDigest": { "type": "string", "minLength": 64, "maxLength": 64 },
100
+ "linkDigest": { "type": "string", "minLength": 64, "maxLength": 64 },
101
+ "previous": {
102
+ "oneOf": [
103
+ { "const": { "kind": "none" } },
104
+ {
105
+ "type": "object",
106
+ "properties": {
107
+ "kind": { "const": "digest" },
108
+ "value": { "type": "string", "minLength": 64, "maxLength": 64 }
109
+ }
110
+ }
111
+ ]
112
+ }
113
+ }
114
+ }
115
+ },
116
+ {
117
+ "if": { "type": "object", "properties": { "algorithm": { "const": "sha-384" } } },
118
+ "then": {
119
+ "type": "object",
120
+ "properties": {
121
+ "contentDigest": { "type": "string", "minLength": 96, "maxLength": 96 },
122
+ "recordDigest": { "type": "string", "minLength": 96, "maxLength": 96 },
123
+ "linkDigest": { "type": "string", "minLength": 96, "maxLength": 96 },
124
+ "previous": {
125
+ "oneOf": [
126
+ { "const": { "kind": "none" } },
127
+ {
128
+ "type": "object",
129
+ "properties": {
130
+ "kind": { "const": "digest" },
131
+ "value": { "type": "string", "minLength": 96, "maxLength": 96 }
132
+ }
133
+ }
134
+ ]
135
+ }
136
+ }
137
+ }
138
+ },
139
+ {
140
+ "if": { "type": "object", "properties": { "algorithm": { "const": "sha-512" } } },
141
+ "then": {
142
+ "type": "object",
143
+ "properties": {
144
+ "contentDigest": { "type": "string", "minLength": 128, "maxLength": 128 },
145
+ "recordDigest": { "type": "string", "minLength": 128, "maxLength": 128 },
146
+ "linkDigest": { "type": "string", "minLength": 128, "maxLength": 128 },
147
+ "previous": {
148
+ "oneOf": [
149
+ { "const": { "kind": "none" } },
150
+ {
151
+ "type": "object",
152
+ "properties": {
153
+ "kind": { "const": "digest" },
154
+ "value": { "type": "string", "minLength": 128, "maxLength": 128 }
155
+ }
156
+ }
157
+ ]
158
+ }
159
+ }
160
+ }
161
+ }
162
+ ]
163
+ }
164
+ }
165
+ }