@aicent/iqa 1.2.8 → 1.3.1

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/bin/iqa.mjs CHANGED
@@ -1,59 +1,59 @@
1
- #!/usr/bin/env node
2
- // iqa -- replay the published conformance vectors. [PASS] or it is not.
3
- //
4
- // npx @aicent/iqa # replay the shipped vectors
5
- // npx @aicent/iqa --vectors ./new.json # replay a different vector set
6
- // npx @aicent/iqa --json # machine-readable output
7
-
8
- import { runConformance, loadVectors, DEFAULT_VECTORS_PATH } from '../src/conformance.mjs';
9
-
10
- const args = process.argv.slice(2);
11
-
12
- let vectorsPath = DEFAULT_VECTORS_PATH;
13
- let json = false;
14
-
15
- for (let i = 0; i < args.length; i++) {
16
- if (args[i] === '--vectors') {
17
- vectorsPath = args[++i];
18
- if (!vectorsPath) {
19
- console.error('error: --vectors requires a path');
20
- process.exit(2);
21
- }
22
- } else if (args[i] === '--json') {
23
- json = true;
24
- } else if (args[i] === '--help' || args[i] === '-h') {
25
- console.log('@aicent/iqa -- replay the published conformance vectors (RFC-009 sec. 10/sec. 11)');
26
- console.log(' npx @aicent/iqa replay the shipped vectors');
27
- console.log(' npx @aicent/iqa --vectors ./new.json replay a different vector set');
28
- console.log(' npx @aicent/iqa --json machine-readable output');
29
- process.exit(0);
30
- } else {
31
- console.error(`error: unknown argument ${args[i]}`);
32
- process.exit(2);
33
- }
34
- }
35
-
36
- let vectors;
37
- try {
38
- vectors = loadVectors(vectorsPath);
39
- } catch (err) {
40
- console.error(`error: cannot load vectors (${err.message})`);
41
- process.exit(2);
42
- }
43
-
44
- const result = runConformance(vectors);
45
-
46
- if (json) {
47
- console.log(JSON.stringify({
48
- checked: result.checked,
49
- passed: result.passed,
50
- failures: result.failures,
51
- vectors: vectorsPath,
52
- }, null, 2));
53
- } else {
54
- console.log(`iqa conformance replay -- spec ${vectors.spec ?? '(unlabeled)'}`);
55
- for (const f of result.failures) console.log(`[FAIL] ${f}`);
56
- console.log(`[PASS] all ${result.checked} checks passed`);
57
- }
58
-
59
- process.exit(result.failures.length === 0 ? 0 : 1);
1
+ #!/usr/bin/env node
2
+ // iqa -- replay the published conformance vectors. [PASS] or it is not.
3
+ //
4
+ // npx @aicent/iqa # replay the shipped vectors
5
+ // npx @aicent/iqa --vectors ./new.json # replay a different vector set
6
+ // npx @aicent/iqa --json # machine-readable output
7
+
8
+ import { runConformance, loadVectors, DEFAULT_VECTORS_PATH } from '../src/conformance.mjs';
9
+
10
+ const args = process.argv.slice(2);
11
+
12
+ let vectorsPath = DEFAULT_VECTORS_PATH;
13
+ let json = false;
14
+
15
+ for (let i = 0; i < args.length; i++) {
16
+ if (args[i] === '--vectors') {
17
+ vectorsPath = args[++i];
18
+ if (!vectorsPath) {
19
+ console.error('error: --vectors requires a path');
20
+ process.exit(2);
21
+ }
22
+ } else if (args[i] === '--json') {
23
+ json = true;
24
+ } else if (args[i] === '--help' || args[i] === '-h') {
25
+ console.log('@aicent/iqa -- replay the published conformance vectors (AICENT-009 sec. 10/sec. 11)');
26
+ console.log(' npx @aicent/iqa replay the shipped vectors');
27
+ console.log(' npx @aicent/iqa --vectors ./new.json replay a different vector set');
28
+ console.log(' npx @aicent/iqa --json machine-readable output');
29
+ process.exit(0);
30
+ } else {
31
+ console.error(`error: unknown argument ${args[i]}`);
32
+ process.exit(2);
33
+ }
34
+ }
35
+
36
+ let vectors;
37
+ try {
38
+ vectors = loadVectors(vectorsPath);
39
+ } catch (err) {
40
+ console.error(`error: cannot load vectors (${err.message})`);
41
+ process.exit(2);
42
+ }
43
+
44
+ const result = runConformance(vectors);
45
+
46
+ if (json) {
47
+ console.log(JSON.stringify({
48
+ checked: result.checked,
49
+ passed: result.passed,
50
+ failures: result.failures,
51
+ vectors: vectorsPath,
52
+ }, null, 2));
53
+ } else {
54
+ console.log(`iqa conformance replay -- spec ${vectors.spec ?? '(unlabeled)'}`);
55
+ for (const f of result.failures) console.log(`[FAIL] ${f}`);
56
+ console.log(`[PASS] all ${result.checked} checks passed`);
57
+ }
58
+
59
+ process.exit(result.failures.length === 0 ? 0 : 1);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aicent/iqa",
3
- "version": "1.2.8",
4
- "description": "IQA for JavaScript: iqa:// subject-attestation addressing, IQA_ROUTE derivation, action safety classes -- and the published conformance vectors that prove an implementation is right.",
3
+ "version": "1.3.1",
4
+ "description": "IQA for JavaScript: iqa:// subject-attestation addressing, IQA_ROUTE derivation, action safety classes, the AE-128 fixed attestation envelope -- and the published conformance vectors that prove an implementation is right.",
5
5
  "author": "IQA.ORG Organization",
6
6
  "license": "Apache-2.0",
7
7
  "homepage": "https://iqa.org/",
@@ -13,6 +13,10 @@
13
13
  "types": "./src/iqa-uri.d.mts",
14
14
  "default": "./src/iqa-uri.mjs"
15
15
  },
16
+ "./envelope": {
17
+ "types": "./src/envelope.d.mts",
18
+ "default": "./src/envelope.mjs"
19
+ },
16
20
  "./conformance": {
17
21
  "types": "./src/conformance.d.mts",
18
22
  "default": "./src/conformance.mjs"
@@ -39,6 +43,9 @@
39
43
  "uri",
40
44
  "conformance",
41
45
  "ed25519",
46
+ "ae-128",
47
+ "envelope",
48
+ "hmac",
42
49
  "aicent"
43
50
  ],
44
51
  "repository": {
@@ -0,0 +1,112 @@
1
+ {
2
+ "schema": "iqa-ae128-vectors/1",
3
+ "spec": "ae128-draft-v0.3 sec. 2-6",
4
+ "generated_by": "SPEC/tools/ae128_vectors.py",
5
+ "generated_with": "python 3.14.2 on windows",
6
+ "how_to_reproduce": "change the cases in the generator, never the JSON",
7
+ "params": {
8
+ "authority": "f3b2a1c4.pillar.example",
9
+ "route_shard_hex": "557c8154d3780cb78cc5fa1bd72b331c",
10
+ "key_ascii": "PLSF-TEST-ORG-KEY-00012345678901",
11
+ "lease_expiry": 1798761600,
12
+ "standing": 2,
13
+ "organ_ascii": "ORG-TEST",
14
+ "nonce": 1
15
+ },
16
+ "positive_frame_hex": "4951414501010000000000006b36ec80557c8154d3780cb78cc5fa1bd72b331c4bd14b6ae7b00904986294a326a0f0255847184ff2c9185539d4863efb84596a4f52472d544553540000000000000001020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
17
+ "negative_frames": [
18
+ {
19
+ "name": "length 127 (truncated)",
20
+ "frame_hex": "4951414501010000000000006b36ec80557c8154d3780cb78cc5fa1bd72b331c4bd14b6ae7b00904986294a326a0f0255847184ff2c9185539d4863efb84596a4f52472d5445535400000000000000010200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
21
+ "reject_reason": "length"
22
+ },
23
+ {
24
+ "name": "length 129 (padded)",
25
+ "frame_hex": "4951414501010000000000006b36ec80557c8154d3780cb78cc5fa1bd72b331c4bd14b6ae7b00904986294a326a0f0255847184ff2c9185539d4863efb84596a4f52472d54455354000000000000000102000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
26
+ "reject_reason": "length"
27
+ },
28
+ {
29
+ "name": "pulse-frame magic 'RTTP'",
30
+ "frame_hex": "5254545001010000000000006b36ec80557c8154d3780cb78cc5fa1bd72b331c4bd14b6ae7b00904986294a326a0f0255847184ff2c9185539d4863efb84596a4f52472d544553540000000000000001020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
31
+ "reject_reason": "magic"
32
+ },
33
+ {
34
+ "name": "version 2",
35
+ "frame_hex": "4951414502010000000000006b36ec80557c8154d3780cb78cc5fa1bd72b331c4bd14b6ae7b00904986294a326a0f0255847184ff2c9185539d4863efb84596a4f52472d544553540000000000000001020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
36
+ "reject_reason": "version"
37
+ },
38
+ {
39
+ "name": "algorithm 0x00",
40
+ "frame_hex": "4951414501000000000000006b36ec80557c8154d3780cb78cc5fa1bd72b331c4bd14b6ae7b00904986294a326a0f0255847184ff2c9185539d4863efb84596a4f52472d544553540000000000000001020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
41
+ "reject_reason": "algorithm"
42
+ },
43
+ {
44
+ "name": "algorithm 0x02 (undefined)",
45
+ "frame_hex": "4951414501020000000000006b36ec80557c8154d3780cb78cc5fa1bd72b331c4bd14b6ae7b00904986294a326a0f0255847184ff2c9185539d4863efb84596a4f52472d544553540000000000000001020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
46
+ "reject_reason": "algorithm"
47
+ },
48
+ {
49
+ "name": "flags 0x0001 (unassigned bit)",
50
+ "frame_hex": "4951414501010100000000006b36ec80557c8154d3780cb78cc5fa1bd72b331c4bd14b6ae7b00904986294a326a0f0255847184ff2c9185539d4863efb84596a4f52472d544553540000000000000001020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
51
+ "reject_reason": "flags"
52
+ },
53
+ {
54
+ "name": "standing 0x04 (outside the closed set)",
55
+ "frame_hex": "4951414501010000000000006b36ec80557c8154d3780cb78cc5fa1bd72b331c4bd14b6ae7b00904986294a326a0f0255847184ff2c9185539d4863efb84596a4f52472d544553540000000000000001040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
56
+ "reject_reason": "standing"
57
+ },
58
+ {
59
+ "name": "reserved nonzero (byte 85)",
60
+ "frame_hex": "4951414501010000000000006b36ec80557c8154d3780cb78cc5fa1bd72b331c4bd14b6ae7b00904986294a326a0f0255847184ff2c9185539d4863efb84596a4f52472d544553540000000000000001020000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
61
+ "reject_reason": "reserved"
62
+ },
63
+ {
64
+ "name": "extension nonzero (byte 100)",
65
+ "frame_hex": "4951414501010000000000006b36ec80557c8154d3780cb78cc5fa1bd72b331c4bd14b6ae7b00904986294a326a0f0255847184ff2c9185539d4863efb84596a4f52472d544553540000000000000001020000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000",
66
+ "reject_reason": "extension"
67
+ },
68
+ {
69
+ "name": "organ tag non-ASCII (0xFF)",
70
+ "frame_hex": "4951414501010000000000006b36ec80557c8154d3780cb78cc5fa1bd72b331c4bd14b6ae7b00904986294a326a0f0255847184ff2c9185539d4863efb84596aff52472d544553540000000000000001020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
71
+ "reject_reason": "organ"
72
+ }
73
+ ],
74
+ "tampered_frames": [
75
+ {
76
+ "name": "one attestation bit flipped",
77
+ "frame_hex": "4951414501010000000000006b36ec80557c8154d3780cb78cc5fa1bd72b331c4ad14b6ae7b00904986294a326a0f0255847184ff2c9185539d4863efb84596a4f52472d544553540000000000000001020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
78
+ "verify_reason": "hmac"
79
+ },
80
+ {
81
+ "name": "organ tag altered (ORG-TESU)",
82
+ "frame_hex": "4951414501010000000000006b36ec80557c8154d3780cb78cc5fa1bd72b331c4bd14b6ae7b00904986294a326a0f0255847184ff2c9185539d4863efb84596a4f52472d544553550000000000000001020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
83
+ "verify_reason": "hmac"
84
+ },
85
+ {
86
+ "name": "nonce altered",
87
+ "frame_hex": "4951414501010000000000006b36ec80557c8154d3780cb78cc5fa1bd72b331c4bd14b6ae7b00904986294a326a0f0255847184ff2c9185539d4863efb84596a4f52472d544553540000000000000002020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
88
+ "verify_reason": "hmac"
89
+ },
90
+ {
91
+ "name": "standing flipped radiant -> genesis",
92
+ "frame_hex": "4951414501010000000000006b36ec80557c8154d3780cb78cc5fa1bd72b331c4bd14b6ae7b00904986294a326a0f0255847184ff2c9185539d4863efb84596a4f52472d544553540000000000000001030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
93
+ "verify_reason": "hmac"
94
+ },
95
+ {
96
+ "name": "lease_expiry altered",
97
+ "frame_hex": "4951414501010000000000006b36ec81557c8154d3780cb78cc5fa1bd72b331c4bd14b6ae7b00904986294a326a0f0255847184ff2c9185539d4863efb84596a4f52472d544553540000000000000001020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
98
+ "verify_reason": "hmac"
99
+ },
100
+ {
101
+ "name": "intent_shard swapped for another subject",
102
+ "frame_hex": "4951414501010000000000006b36ec80000102030405060708090a0b0c0d0e0f4bd14b6ae7b00904986294a326a0f0255847184ff2c9185539d4863efb84596a4f52472d544553540000000000000001020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
103
+ "verify_reason": "hmac"
104
+ },
105
+ {
106
+ "name": "attestation from a different key",
107
+ "frame_hex": "4951414501010000000000006b36ec80557c8154d3780cb78cc5fa1bd72b331c7dff5e97f9ff451e7989f47b670fe003964a26aced4df399a9f242541dcd93f84f52472d544553540000000000000001020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
108
+ "verify_reason": "hmac"
109
+ }
110
+ ],
111
+ "note": "Generated, not written: every frame is computed from the documented parameters and the documented mutations. A conforming implementation reproduces the positive frame byte for byte, rejects every negative frame at parse time, and fails verification on every tampered frame."
112
+ }
@@ -1,29 +1,29 @@
1
- /** Independent conformance replay for the published IQA vector set. */
2
-
3
- export interface ConformanceResult {
4
- checked: number;
5
- failures: string[];
6
- passed: number;
7
- }
8
-
9
- export interface ParsedForConformance {
10
- authority: string;
11
- action: string | null;
12
- shardHex: string;
13
- }
14
-
15
- /**
16
- * The independent RFC-009 sec. 10 implementation used by the checker.
17
- * `buildFrame`-style helpers do not exist here: IQA v1.2.6 has no frame --
18
- * the derivation chain is URI -> IQA_ROUTE (4 bytes).
19
- */
20
- export declare function parseUri(uri: string): ParsedForConformance;
21
-
22
- /** Replay a vector set. Accepts any object with the documented groups. */
23
- export declare function runConformance(vectors: object): ConformanceResult;
24
-
25
- /** Parse a vector set; defaults to the shipped one. */
26
- export declare function loadVectors(path?: string): Record<string, unknown>;
27
-
28
- /** Absolute path of the shipped vectors.json. */
29
- export declare const DEFAULT_VECTORS_PATH: string;
1
+ /** Independent conformance replay for the published IQA vector set. */
2
+
3
+ export interface ConformanceResult {
4
+ checked: number;
5
+ failures: string[];
6
+ passed: number;
7
+ }
8
+
9
+ export interface ParsedForConformance {
10
+ authority: string;
11
+ action: string | null;
12
+ shardHex: string;
13
+ }
14
+
15
+ /**
16
+ * The independent AICENT-009 sec. 10 implementation used by the checker.
17
+ * `buildFrame`-style helpers do not exist here: IQA v1.2.6 has no frame --
18
+ * the derivation chain is URI -> IQA_ROUTE (4 bytes).
19
+ */
20
+ export declare function parseUri(uri: string): ParsedForConformance;
21
+
22
+ /** Replay a vector set. Accepts any object with the documented groups. */
23
+ export declare function runConformance(vectors: object): ConformanceResult;
24
+
25
+ /** Parse a vector set; defaults to the shipped one. */
26
+ export declare function loadVectors(path?: string): Record<string, unknown>;
27
+
28
+ /** Absolute path of the shipped vectors.json. */
29
+ export declare const DEFAULT_VECTORS_PATH: string;