@aicent/iqa 0.1.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 +201 -0
- package/README.md +246 -0
- package/bin/iqa.mjs +59 -0
- package/examples/quickstart.mjs +15 -0
- package/package.json +51 -0
- package/src/conformance.d.mts +29 -0
- package/src/conformance.mjs +181 -0
- package/src/iqa-uri.d.mts +42 -0
- package/src/iqa-uri.mjs +169 -0
- package/src/vectors.json +260 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2013-2019 Nikolay Kim and Andrew Svetlov
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
# @aicent/iqa
|
|
2
|
+
|
|
3
|
+
**IQA for JavaScript: `iqa://` subject-attestation addressing, `IQA_ROUTE`
|
|
4
|
+
derivation, action safety classes — and the published conformance vectors that
|
|
5
|
+
prove an implementation is right.**
|
|
6
|
+
|
|
7
|
+
[RFC-009 §10](https://iqa.org/RFC-009/) · §11 · v1.2.6 · zero dependencies · no build step
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Verify it in one command — no trust required
|
|
12
|
+
|
|
13
|
+
```console
|
|
14
|
+
$ npx @aicent/iqa
|
|
15
|
+
[PASS] all 32 checks passed
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
That is the point of this package. A specification is worth exactly what an
|
|
19
|
+
independent implementation can reproduce from it, so instead of asking you to
|
|
20
|
+
believe a table of numbers, the vectors ship inside the package and replay
|
|
21
|
+
locally — offline, no account, no network. `[PASS]` or it is not.
|
|
22
|
+
|
|
23
|
+
The vectors cover the `iqa://` grammar (RFC-009 §10.2), the **closed sets**
|
|
24
|
+
(`organ` and `action` — the deliberate difference from `rttp`, whose verb set
|
|
25
|
+
is open), the §11.3 action safety classes, the `IQA_ROUTE` derivation, **and**
|
|
26
|
+
the deterministic Ed25519 attestation envelope — replayed by both
|
|
27
|
+
implementations.
|
|
28
|
+
|
|
29
|
+
### The other half — Python, on PyPI
|
|
30
|
+
|
|
31
|
+
```console
|
|
32
|
+
$ pip install iqa
|
|
33
|
+
$ python -m iqa.selftest
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Published as **`@aicent/iqa`** — the bare `iqa` name is unregistered on npm but
|
|
37
|
+
blocked by its typosquatting protection, so the JavaScript side lives under
|
|
38
|
+
this project's organization, as `@aicent/rttp` already does. The Python
|
|
39
|
+
package keeps the bare name: **`iqa`** on PyPI. It ships a **byte-identical
|
|
40
|
+
copy** of this same vector set (three mirrors, one sha256) and replays it
|
|
41
|
+
offline, exactly as this one does: two registries, two languages, one
|
|
42
|
+
specification.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Install
|
|
47
|
+
|
|
48
|
+
```console
|
|
49
|
+
npm install @aicent/iqa
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Node 18+. No dependencies, no build step, no transitive tree to audit: the
|
|
53
|
+
published `src/` is exactly what runs.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Quickstart
|
|
58
|
+
|
|
59
|
+
```js
|
|
60
|
+
import { parse } from '@aicent/iqa';
|
|
61
|
+
|
|
62
|
+
const r = parse('iqa://3f9a1b2c.gateway.iqa');
|
|
63
|
+
|
|
64
|
+
r.subject // '3f9a1b2c' — 8-hex routing short form of the AID
|
|
65
|
+
r.organ // 'gateway' — closed set: forge | tss | gateway
|
|
66
|
+
r.action // null — omitted = standing read (§11.1)
|
|
67
|
+
r.action_safe // true — §11.3: omitted and verify are SAFE
|
|
68
|
+
r.canonical_uri // 'iqa://3f9a1b2c.gateway.iqa'
|
|
69
|
+
r.route_hex // '5c378581' <- pure computation, pinned by the vectors
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The same lines ship as a runnable file:
|
|
73
|
+
|
|
74
|
+
```console
|
|
75
|
+
$ node examples/quickstart.mjs
|
|
76
|
+
5c378581
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Its expected output is the route fingerprint the published conformance vectors
|
|
80
|
+
pin for that address, so the example can be **checked** rather than believed.
|
|
81
|
+
|
|
82
|
+
Addressing is **DNS-free** (RFC-009 §12 #9): the route fingerprint is derived
|
|
83
|
+
from the authority by SHA-256, so no registry, resolver or network is
|
|
84
|
+
involved. A URI either yields its fields or throws — there is no fallback, no
|
|
85
|
+
`iqas`, and no rewriting to `https`.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## The two closed sets — the deliberate difference from `rttp`
|
|
90
|
+
|
|
91
|
+
`rttp` accepts any well-formed action verb. **`iqa` does not.** RFC-009 §10.1
|
|
92
|
+
marks *both* segments "Closed set", and this package enforces exactly that:
|
|
93
|
+
|
|
94
|
+
```js
|
|
95
|
+
parse('iqa://3f9a1b2c.gateway.iqa/pulse') // throws — 'pulse' is an rttp verb
|
|
96
|
+
parse('iqa://3f9a1b2c.forgery.iqa') // throws — organ is forge|tss|gateway
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### The one rule that surprises people
|
|
100
|
+
|
|
101
|
+
**Malformed input is rejected, not normalised.** `iqa://…/AUDIT`,
|
|
102
|
+
`iqa://3F9A1B2C.…` and `IQA://…` all throw: the canonical form is lowercase
|
|
103
|
+
US-ASCII (RFC-009 §10.3), a case variant is not a spelling difference, and
|
|
104
|
+
nothing is ever accepted because a check could not be performed.
|
|
105
|
+
|
|
106
|
+
### One honest quirk of the grammar
|
|
107
|
+
|
|
108
|
+
The ABNF is an ordered choice (`hash-subject / name-subject`), so a lowercase
|
|
109
|
+
hex string of a **non-hash length** (9 digits, say) is a *name subject*, not
|
|
110
|
+
an error. The grammar is the grammar; vector #8 pins the behaviour so every
|
|
111
|
+
implementation agrees on it.
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Action safety classes (RFC-009 §11.3)
|
|
116
|
+
|
|
117
|
+
| `action` | Class | `action_safe` |
|
|
118
|
+
|:---|:---|:---|
|
|
119
|
+
| *(omitted)* | SAFE — standing read | `true` |
|
|
120
|
+
| `verify` | SAFE — read-only comparison | `true` |
|
|
121
|
+
| `audit` | NOT SAFE — can trigger Authority Ischemia | `false` |
|
|
122
|
+
| `attest` | NOT SAFE — state transition | `false` |
|
|
123
|
+
| `revoke` | NOT SAFE — state transition | `false` |
|
|
124
|
+
|
|
125
|
+
Per §11.2, dereferencing an `iqa` URI MUST NOT transition any subject's
|
|
126
|
+
standing. Tooling built on this package MUST gate the three NOT-SAFE verbs
|
|
127
|
+
behind an explicit user action — parsing one is not requesting one.
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## API — main entry
|
|
132
|
+
|
|
133
|
+
| Export | What it does |
|
|
134
|
+
|:---|:---|
|
|
135
|
+
| `parse(uri)` | Validate, canonicalise, classify, derive. Throws `IqaUriError`. |
|
|
136
|
+
| `deriveRoute(authority)` | `Uint8Array(4)` = `SHA-256(ASCII(authority))[0:4]`. |
|
|
137
|
+
| `deriveRouteHex(authority)` | The same, as 8 lowercase hex characters. |
|
|
138
|
+
| `isValidAction(value)` | §10.1 closed-set test. |
|
|
139
|
+
| `IqaUriError` | The only error type thrown. |
|
|
140
|
+
| `SCHEME`, `ORGANS`, `ACTIONS`, `STANDINGS`, `HASH_LENGTHS` | Constants. |
|
|
141
|
+
|
|
142
|
+
### The attestation envelope — `@aicent/iqa/conformance`
|
|
143
|
+
|
|
144
|
+
The deterministic Ed25519 envelope (SPEC/IQA-URI-ATTEST-v1.2.6 §5: domain
|
|
145
|
+
prefix `iqa-attest-v1`, `AID = SHA-256(pub)`, `ts`/`nonce` inside the
|
|
146
|
+
signature, 120-second freshness) is part of the shared vector set and is
|
|
147
|
+
replayed by this package's conformance run. `buildSigningInput` is exported
|
|
148
|
+
from `./conformance` for implementers of other languages.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## The conformance vectors
|
|
153
|
+
|
|
154
|
+
```js
|
|
155
|
+
import { loadVectors, runConformance } from '@aicent/iqa/conformance';
|
|
156
|
+
|
|
157
|
+
const { checked, failures, passed } = runConformance(loadVectors());
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Or from the command line:
|
|
161
|
+
|
|
162
|
+
```console
|
|
163
|
+
npx @aicent/iqa # replay the shipped vectors
|
|
164
|
+
npx @aicent/iqa --vectors ./new.json # replay a different vector set
|
|
165
|
+
npx @aicent/iqa --json # machine-readable output
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
In CI:
|
|
169
|
+
|
|
170
|
+
```yaml
|
|
171
|
+
- run: npx @aicent/iqa
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
| Group | Count | What it proves |
|
|
175
|
+
|:---|---:|:---|
|
|
176
|
+
| `positive_uris` | 8 | Accept, classify and derive — §10.3's own examples, the 256-bit form, the all-zero boundary, the name-subject fall-through |
|
|
177
|
+
| `negative_uris` | 18 | Reject — uppercase anywhere, `iqas://`, userinfo, port, query, fragment, wrong authority shape, closed-set violations on both segments |
|
|
178
|
+
| `action_safety` | 5 | §11.3 classes as data |
|
|
179
|
+
| `attest_envelope_vector` | 1 | Deterministic Ed25519 envelope, verified through `node:crypto` |
|
|
180
|
+
|
|
181
|
+
`vectors.json` is plain JSON and ships inside the package, also reachable as
|
|
182
|
+
the subpath export `@aicent/iqa/vectors.json`. Any language can read it; that
|
|
183
|
+
is what it is for.
|
|
184
|
+
|
|
185
|
+
### Why the checker lives in this package, and why that is still honest
|
|
186
|
+
|
|
187
|
+
`src/conformance.mjs` is written from RFC-009 §10 alone and **must never
|
|
188
|
+
import `src/iqa-uri.mjs`**. A conformance suite that reuses the code under
|
|
189
|
+
test only proves the code equals itself. The two files share no code — one is
|
|
190
|
+
a streaming charset scanner, the other a single full-match grammar check — so
|
|
191
|
+
the rule is checkable by reading them.
|
|
192
|
+
|
|
193
|
+
The vectors are **generated, not written**. `generated_by` in the JSON names
|
|
194
|
+
the generator, and the file says so itself: change the cases in the generator,
|
|
195
|
+
not the JSON. Hand-editing a conformance vector is how a specification quietly
|
|
196
|
+
starts agreeing with its own bugs.
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Scope — what this package is not
|
|
201
|
+
|
|
202
|
+
| | |
|
|
203
|
+
|:---|:---|
|
|
204
|
+
| ✅ **Validation / canonicalisation** | Real, and specified (RFC-009 §10.2 / §10.3). |
|
|
205
|
+
| ✅ **Closed-set enforcement** | Real, and specified (§10.1). |
|
|
206
|
+
| ✅ **IQA_ROUTE derivation** | Real (SPEC §3, decision D1). |
|
|
207
|
+
| ✅ **Action safety classes** | Real, and specified (§11.3). |
|
|
208
|
+
| ✅ **Conformance vectors + independent replay** | Published and generated. |
|
|
209
|
+
| ❌ **Dereferencing / resolver service** | Not here. The codec computes; *answering* a standing read is an Organ's job (RFC-009-C §3). |
|
|
210
|
+
| ❌ **Staking, tiers, vitality** | Operator economics and telemetry — RFC-009 narrative, no cryptographic object in this package. |
|
|
211
|
+
| ❌ **Post-quantum Lattice Guard** | RFC-009 §12 #11 schedules it for v1.4.0; no implementation exists. |
|
|
212
|
+
| ❌ **Revocation transport** | §11.3 defines the verb; executing it is not the codec's job. |
|
|
213
|
+
| ❌ **Confidentiality** | Signing is not encryption. |
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Naming
|
|
218
|
+
|
|
219
|
+
| Ecosystem | Name | Status |
|
|
220
|
+
|:---|:---|:---|
|
|
221
|
+
| crates.io | `iqa-org` | held by this project (Shipyard Rust crate) |
|
|
222
|
+
| PyPI | `iqa` | **published** — the Python reference implementation; `pip install iqa` |
|
|
223
|
+
| npm | **`@aicent/iqa`** | the bare `iqa` name is unregistered but **blocked by npm's typosquatting protection** (too similar to existing short names) — so this package is published under the organization this project controls, as `@aicent/rttp` already is. The package name itself is still just `iqa`. |
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## Specification status
|
|
228
|
+
|
|
229
|
+
* **`iqa` URI scheme** — submitted to IANA under RFC 7595, ticket **#1459963**,
|
|
230
|
+
Provisional, **under review**. It is **not yet registered** — as of
|
|
231
|
+
2026-09-18 the IANA "URI Schemes" registry contains no `iqa` entry. Please
|
|
232
|
+
describe it that way.
|
|
233
|
+
* **URI grammar** — RFC-009 §10.2 (frozen; this package adds no syntax).
|
|
234
|
+
* **Dereference safety** — RFC-009 §11 (closed sets and safety classes).
|
|
235
|
+
* **Attestation envelope** — `SPEC/IQA-URI-ATTEST-v1.2.6.md` §5, a **draft**:
|
|
236
|
+
the format is implemented and vector-tested, but it is not yet a numbered
|
|
237
|
+
RFC-009 section.
|
|
238
|
+
|
|
239
|
+
Where this package and the specification disagree, **the specification wins
|
|
240
|
+
and this package is wrong.** Please report it.
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## License
|
|
245
|
+
|
|
246
|
+
Apache-2.0. See `LICENSE`.
|
package/bin/iqa.mjs
ADDED
|
@@ -0,0 +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 §10/§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);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// The same three lines as the README quickstart — runnable, so the example can
|
|
2
|
+
// be CHECKED rather than believed. Its expected output is the route fingerprint
|
|
3
|
+
// the published conformance vectors pin for that address.
|
|
4
|
+
//
|
|
5
|
+
// node examples/quickstart.mjs
|
|
6
|
+
// 5c378581
|
|
7
|
+
|
|
8
|
+
import { parse } from '../src/iqa-uri.mjs';
|
|
9
|
+
|
|
10
|
+
const r = parse('iqa://3f9a1b2c.gateway.iqa');
|
|
11
|
+
|
|
12
|
+
console.log(r.subject); // '3f9a1b2c' (8-hex routing short form)
|
|
13
|
+
console.log(r.organ); // 'gateway' (closed set: forge|tss|gateway)
|
|
14
|
+
console.log(r.action); // null (omitted = standing read, SAFE)
|
|
15
|
+
console.log(r.route_hex); // '5c378581' <- pinned by the published vectors
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aicent/iqa",
|
|
3
|
+
"version": "0.1.0",
|
|
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.",
|
|
5
|
+
"author": "IQA.ORG Organization",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./src/iqa-uri.mjs",
|
|
9
|
+
"types": "./src/iqa-uri.d.mts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./src/iqa-uri.d.mts",
|
|
13
|
+
"default": "./src/iqa-uri.mjs"
|
|
14
|
+
},
|
|
15
|
+
"./conformance": {
|
|
16
|
+
"types": "./src/conformance.d.mts",
|
|
17
|
+
"default": "./src/conformance.mjs"
|
|
18
|
+
},
|
|
19
|
+
"./vectors.json": "./src/vectors.json"
|
|
20
|
+
},
|
|
21
|
+
"bin": {
|
|
22
|
+
"iqa": "bin/iqa.mjs"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"src/",
|
|
26
|
+
"bin/",
|
|
27
|
+
"examples/",
|
|
28
|
+
"LICENSE",
|
|
29
|
+
"README.md"
|
|
30
|
+
],
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=18"
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"iqa",
|
|
36
|
+
"attestation",
|
|
37
|
+
"identity",
|
|
38
|
+
"uri",
|
|
39
|
+
"conformance",
|
|
40
|
+
"ed25519",
|
|
41
|
+
"aicent"
|
|
42
|
+
],
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "git+https://github.com/Aicent-Stack/aicent-stack.git"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"test": "node --test",
|
|
49
|
+
"prepublishOnly": "node --test"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +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 §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;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
// IQA conformance replay — an INDEPENDENT implementation of RFC-009 §10.
|
|
2
|
+
//
|
|
3
|
+
// This file is written from RFC-009 §10/§11 alone and MUST NEVER import
|
|
4
|
+
// ./iqa-uri.mjs. A conformance suite that reuses the code under test only
|
|
5
|
+
// proves the code equals itself. The two files share no code, so the rule is
|
|
6
|
+
// checkable by reading them.
|
|
7
|
+
//
|
|
8
|
+
// They ship together for the same reason the Python wheel ships its self-test:
|
|
9
|
+
// so a stranger can verify an installed package offline, with no repository
|
|
10
|
+
// checkout. Zero dependencies — node:crypto and node:fs only.
|
|
11
|
+
|
|
12
|
+
import { createHash, createPublicKey, verify as cryptoVerify } from 'node:crypto';
|
|
13
|
+
import { readFileSync } from 'node:fs';
|
|
14
|
+
import { fileURLToPath } from 'node:url';
|
|
15
|
+
import { dirname, join } from 'node:path';
|
|
16
|
+
|
|
17
|
+
const DOMAIN = Buffer.from('iqa-attest-v1\n', 'utf8');
|
|
18
|
+
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
// Independent parse — single full-match grammar check, deliberately different
|
|
21
|
+
// in structure from the streaming charset scanner in iqa-uri.mjs.
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
|
|
24
|
+
// authority = subject "." organ "." root ; subject/organ/root over [a-z0-9-]
|
|
25
|
+
// (the "." split is done by the regex groups, so empty segments fail);
|
|
26
|
+
// path = "/" action at most once; every matched char is lowercase US-ASCII,
|
|
27
|
+
// so uppercase, '@', ':', '?', '#', whitespace and all foreign bytes fail.
|
|
28
|
+
const GRAMMAR = /^iqa:\/\/([a-z0-9-]+)\.([a-z0-9-]+)\.([a-z0-9-]+)(?:\/([a-z0-9-]+))?$/;
|
|
29
|
+
|
|
30
|
+
const ORGANS = ['forge', 'tss', 'gateway']; // §10.1 closed set
|
|
31
|
+
const ACTIONS = ['verify', 'audit', 'attest', 'revoke']; // §10.1 closed set
|
|
32
|
+
const HASH_LENGTHS = [8, 32, 64]; // §10.2 hash-subject
|
|
33
|
+
|
|
34
|
+
export function parseUri(uri) {
|
|
35
|
+
const m = GRAMMAR.exec(uri);
|
|
36
|
+
if (!m) {
|
|
37
|
+
throw new Error(`REJECT (grammar/full-match): ${JSON.stringify(uri)}`);
|
|
38
|
+
}
|
|
39
|
+
const [, subject, organ, root, action = null] = m;
|
|
40
|
+
|
|
41
|
+
if (!ORGANS.includes(organ)) {
|
|
42
|
+
throw new Error(`REJECT (organ closed set): ${JSON.stringify(uri)}`);
|
|
43
|
+
}
|
|
44
|
+
if (action !== null && !ACTIONS.includes(action)) {
|
|
45
|
+
throw new Error(`REJECT (action closed set): ${JSON.stringify(uri)}`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const isAllLowerHex = /^[0-9a-f]+$/.test(subject);
|
|
49
|
+
const subjectIsHash = isAllLowerHex && HASH_LENGTHS.includes(subject.length);
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
scheme: 'iqa',
|
|
53
|
+
subject,
|
|
54
|
+
subject_is_hash: subjectIsHash,
|
|
55
|
+
subject_hex: subjectIsHash ? subject : null,
|
|
56
|
+
organ,
|
|
57
|
+
root,
|
|
58
|
+
authority: `${subject}.${organ}.${root}`,
|
|
59
|
+
action,
|
|
60
|
+
action_omitted: action === null,
|
|
61
|
+
action_safe: action === null || action === 'verify', // §11.3
|
|
62
|
+
canonical_uri: 'iqa://' + `${subject}.${organ}.${root}` + (action ? '/' + action : ''),
|
|
63
|
+
route_hex: createHash('sha256').update(`${subject}.${organ}.${root}`, 'ascii')
|
|
64
|
+
.digest().subarray(0, 4).toString('hex'),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// ---------------------------------------------------------------------------
|
|
69
|
+
// Envelope — canonical JSON + Ed25519 over the domain-separated input.
|
|
70
|
+
// ---------------------------------------------------------------------------
|
|
71
|
+
|
|
72
|
+
function canonicalize(value) {
|
|
73
|
+
if (value === null || typeof value !== 'object') return JSON.stringify(value);
|
|
74
|
+
if (Array.isArray(value)) return '[' + value.map(canonicalize).join(',') + ']';
|
|
75
|
+
const keys = Object.keys(value).sort();
|
|
76
|
+
return '{' + keys.map((k) => JSON.stringify(k) + ':' + canonicalize(value[k])).join(',') + '}';
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function buildSigningInput(env) {
|
|
80
|
+
const body = canonicalize({
|
|
81
|
+
alg: 'ed25519',
|
|
82
|
+
aid: env.aid,
|
|
83
|
+
nonce: env.nonce,
|
|
84
|
+
payload: env.payload,
|
|
85
|
+
pub: env.pub,
|
|
86
|
+
ts: env.ts,
|
|
87
|
+
});
|
|
88
|
+
return Buffer.concat([DOMAIN, Buffer.from(body, 'utf8')]);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function verifyEnvelope(env) {
|
|
92
|
+
const input = buildSigningInput(env);
|
|
93
|
+
if (input.toString('hex') !== env.signing_input_hex) {
|
|
94
|
+
throw new Error('envelope :: signing input mismatch');
|
|
95
|
+
}
|
|
96
|
+
const aid = createHash('sha256').update(Buffer.from(env.pub, 'hex')).digest('hex');
|
|
97
|
+
if (aid !== env.aid) {
|
|
98
|
+
throw new Error('envelope :: aid != SHA-256(pub)');
|
|
99
|
+
}
|
|
100
|
+
// Wrap the raw 32-byte key in the fixed Ed25519 SPKI DER prefix.
|
|
101
|
+
const spki = Buffer.concat([
|
|
102
|
+
Buffer.from('302a300506032b6570032100', 'hex'),
|
|
103
|
+
Buffer.from(env.pub, 'hex'),
|
|
104
|
+
]);
|
|
105
|
+
const key = createPublicKey({ key: spki, format: 'der', type: 'spki' });
|
|
106
|
+
const ok = cryptoVerify(null, input, key, Buffer.from(env.sig, 'hex'));
|
|
107
|
+
if (!ok) throw new Error('envelope :: Ed25519 verification failed');
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// ---------------------------------------------------------------------------
|
|
111
|
+
// Runner
|
|
112
|
+
// ---------------------------------------------------------------------------
|
|
113
|
+
|
|
114
|
+
const DEFAULT_VECTORS_PATH = join(dirname(fileURLToPath(import.meta.url)), 'vectors.json');
|
|
115
|
+
|
|
116
|
+
export { DEFAULT_VECTORS_PATH };
|
|
117
|
+
|
|
118
|
+
export function loadVectors(path = DEFAULT_VECTORS_PATH) {
|
|
119
|
+
return JSON.parse(readFileSync(path, 'utf8'));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Replay a vector set → { checked, failures, passed }.
|
|
124
|
+
* The checker accepts any object with the documented groups, so a different
|
|
125
|
+
* vector set (e.g. a candidate next revision) can be replayed the same way.
|
|
126
|
+
*/
|
|
127
|
+
export function runConformance(vectors) {
|
|
128
|
+
const failures = [];
|
|
129
|
+
let checked = 0;
|
|
130
|
+
|
|
131
|
+
for (const c of vectors.positive_uris ?? []) {
|
|
132
|
+
checked += 1;
|
|
133
|
+
try {
|
|
134
|
+
const got = parseUri(c.uri);
|
|
135
|
+
for (const key of ['canonical_uri', 'subject_is_hash', 'organ', 'root',
|
|
136
|
+
'authority', 'action', 'action_omitted', 'action_safe', 'route_hex']) {
|
|
137
|
+
if (got[key] !== c[key]) {
|
|
138
|
+
failures.push(`${c.uri} :: ${key} ${JSON.stringify(c[key])} != ${JSON.stringify(got[key])}`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
} catch (err) {
|
|
142
|
+
failures.push(`${c.uri} :: expected ACCEPT but rejected (${err.message})`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
for (const c of vectors.negative_uris ?? []) {
|
|
147
|
+
checked += 1;
|
|
148
|
+
try {
|
|
149
|
+
parseUri(c.uri);
|
|
150
|
+
failures.push(`${c.uri} :: expected REJECT but parsed`);
|
|
151
|
+
} catch {
|
|
152
|
+
// required behaviour
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
for (const row of vectors.action_safety ?? []) {
|
|
157
|
+
checked += 1;
|
|
158
|
+
const uri = row.action === null
|
|
159
|
+
? 'iqa://3f9a1b2c.gateway.iqa'
|
|
160
|
+
: `iqa://3f9a1b2c.gateway.iqa/${row.action}`;
|
|
161
|
+
try {
|
|
162
|
+
const got = parseUri(uri).action_safe;
|
|
163
|
+
if (got !== row.safe) {
|
|
164
|
+
failures.push(`action_safety ${row.action} :: expected ${row.safe} got ${got}`);
|
|
165
|
+
}
|
|
166
|
+
} catch (err) {
|
|
167
|
+
failures.push(`action_safety ${row.action} :: expected ACCEPT but rejected (${err.message})`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (vectors.attest_envelope_vector) {
|
|
172
|
+
checked += 1;
|
|
173
|
+
try {
|
|
174
|
+
verifyEnvelope(vectors.attest_envelope_vector);
|
|
175
|
+
} catch (err) {
|
|
176
|
+
failures.push(err.message);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return { checked, failures, passed: checked - failures.length };
|
|
181
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* iqa — RFC-009 §10/§11 codec for JavaScript.
|
|
3
|
+
* Zero dependencies. Field names are snake_case on purpose: they match the
|
|
4
|
+
* published conformance vectors (and the Python implementation) field for field.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export declare const SCHEME: 'iqa';
|
|
8
|
+
export declare const ORGANS: readonly ['forge', 'tss', 'gateway'];
|
|
9
|
+
export declare const ACTIONS: readonly ['verify', 'audit', 'attest', 'revoke'];
|
|
10
|
+
export declare const STANDINGS: readonly ['ghost', 'probation', 'radiant', 'genesis'];
|
|
11
|
+
export declare const HASH_LENGTHS: readonly [8, 32, 64];
|
|
12
|
+
|
|
13
|
+
export declare class IqaUriError extends Error {}
|
|
14
|
+
|
|
15
|
+
/** True only for the closed four-verb set (RFC-009 §10.1). */
|
|
16
|
+
export declare function isValidAction(value: string): boolean;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* IQA_ROUTE = SHA-256(ASCII(canonical_authority))[0:4] (SPEC §3).
|
|
20
|
+
* The address fingerprint — not the subject hash (which hints the AID).
|
|
21
|
+
*/
|
|
22
|
+
export declare function deriveRoute(authority: string): Uint8Array;
|
|
23
|
+
export declare function deriveRouteHex(authority: string): string;
|
|
24
|
+
|
|
25
|
+
export interface ParsedUri {
|
|
26
|
+
scheme: 'iqa';
|
|
27
|
+
subject: string;
|
|
28
|
+
subject_is_hash: boolean;
|
|
29
|
+
subject_hex: string | null;
|
|
30
|
+
organ: string;
|
|
31
|
+
root: string;
|
|
32
|
+
authority: string;
|
|
33
|
+
action: string | null;
|
|
34
|
+
action_omitted: boolean;
|
|
35
|
+
/** RFC-009 §11.3 — true for omitted and `verify`, false for audit/attest/revoke. */
|
|
36
|
+
action_safe: boolean;
|
|
37
|
+
canonical_uri: string;
|
|
38
|
+
route_hex: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Validate, canonicalise and derive. Throws IqaUriError on any violation. */
|
|
42
|
+
export declare function parse(uri: string): ParsedUri;
|
package/src/iqa-uri.mjs
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
// iqa:// URI codec — validate, canonicalise, derive (RFC-009 §10/§11).
|
|
2
|
+
//
|
|
3
|
+
// Authority boundaries:
|
|
4
|
+
// Grammar ......... RFC-009 §10.2 ABNF (sole authority)
|
|
5
|
+
// Closed sets ..... §10.1 (organ and action are CLOSED sets)
|
|
6
|
+
// Case discipline . §10.3 (lowercase US-ASCII only) + §12 #8 (fail closed)
|
|
7
|
+
// Deref safety .... §11.3 (action safety classes)
|
|
8
|
+
// Route derivation SPEC/IQA-URI-ATTEST-v1.2.6.md §3 (IQA_ROUTE)
|
|
9
|
+
//
|
|
10
|
+
// Zero dependencies. Node 18+. No build step — the published src/ is what runs.
|
|
11
|
+
|
|
12
|
+
import { createHash } from 'node:crypto';
|
|
13
|
+
|
|
14
|
+
export const SCHEME = 'iqa';
|
|
15
|
+
|
|
16
|
+
/** RFC-009 §10.1 — organ is a CLOSED set (RFC-009-A/-B/-C). */
|
|
17
|
+
export const ORGANS = Object.freeze(['forge', 'tss', 'gateway']);
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* RFC-009 §10.1 — action is a CLOSED set. This is the deliberate difference
|
|
21
|
+
* from `rttp`, whose verb set is open: here anything outside the four verbs
|
|
22
|
+
* is rejected.
|
|
23
|
+
*/
|
|
24
|
+
export const ACTIONS = Object.freeze(['verify', 'audit', 'attest', 'revoke']);
|
|
25
|
+
|
|
26
|
+
/** RFC-009-C §3 — standings an Organ may render (closed set, lowercase). */
|
|
27
|
+
export const STANDINGS = Object.freeze(['ghost', 'probation', 'radiant', 'genesis']);
|
|
28
|
+
|
|
29
|
+
/** RFC-009 §10.2 — hash-subject lengths: routing short form / 128-bit / 256-bit. */
|
|
30
|
+
export const HASH_LENGTHS = Object.freeze([8, 32, 64]);
|
|
31
|
+
|
|
32
|
+
const SAFE = new Set([null, 'verify']); // §11.3: omitted = standing read; verify = read-only
|
|
33
|
+
const LOWHEX = new Set('0123456789abcdef');
|
|
34
|
+
const NAME_CHARS = new Set('abcdefghijklmnopqrstuvwxyz0123456789-');
|
|
35
|
+
const ALLOWED = new Set([...LOWHEX, ...NAME_CHARS, '.', '/']);
|
|
36
|
+
const FORBIDDEN = new Set(['@', ':', '?', '#', '[', ']']);
|
|
37
|
+
|
|
38
|
+
export class IqaUriError extends Error {
|
|
39
|
+
constructor(message) {
|
|
40
|
+
super(message);
|
|
41
|
+
this.name = 'IqaUriError';
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const fail = (uri, reason) => new IqaUriError(`${JSON.stringify(uri)}: ${reason}`);
|
|
46
|
+
|
|
47
|
+
/** §10.2 action test — true only for the closed four-verb set. */
|
|
48
|
+
export function isValidAction(value) {
|
|
49
|
+
return ACTIONS.includes(value);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* IQA_ROUTE = SHA-256(ASCII(canonical_authority))[0:4] (SPEC §3, decision D1).
|
|
54
|
+
*
|
|
55
|
+
* Pure computation, DNS-free (RFC-009 §12 #9). Mirrors the RTTP ROUTE_SHARD
|
|
56
|
+
* rule so both schemes of the same addressing family derive the same way.
|
|
57
|
+
* NOTE: this is the *address* fingerprint — NOT the subject hash, which is a
|
|
58
|
+
* routing hint for the *AID*. Different numbers about different things.
|
|
59
|
+
*/
|
|
60
|
+
export function deriveRoute(authority) {
|
|
61
|
+
if (!authority) throw new IqaUriError('deriveRoute: authority is empty');
|
|
62
|
+
return createHash('sha256').update(authority, 'ascii').digest().subarray(0, 4);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** The same four bytes, as 8 lowercase hex characters. */
|
|
66
|
+
export function deriveRouteHex(authority) {
|
|
67
|
+
return deriveRoute(authority).toString('hex');
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Validate, canonicalise and derive. Throws IqaUriError on any violation.
|
|
72
|
+
*
|
|
73
|
+
* Returned fields are snake_case ON PURPOSE so this output and the Python
|
|
74
|
+
* package's output compare directly against the published vectors — field
|
|
75
|
+
* for field, byte for byte.
|
|
76
|
+
*/
|
|
77
|
+
export function parse(uri) {
|
|
78
|
+
if (typeof uri !== 'string') throw fail(uri, 'input must be a string');
|
|
79
|
+
|
|
80
|
+
const prefix = SCHEME + '://';
|
|
81
|
+
if (!uri.startsWith(prefix)) {
|
|
82
|
+
throw fail(uri, `scheme must be exactly ${JSON.stringify(prefix)} - no other `
|
|
83
|
+
+ 'scheme, no case variant, no fallback (RFC-009 §10.3, §12 #8)');
|
|
84
|
+
}
|
|
85
|
+
const rest = uri.slice(prefix.length);
|
|
86
|
+
|
|
87
|
+
// Charset gate: lowercase US-ASCII only (§10.3). One scan rejects uppercase
|
|
88
|
+
// anywhere, userinfo '@', port ':', query '?', fragment '#', whitespace and
|
|
89
|
+
// every other foreign byte.
|
|
90
|
+
for (const ch of rest) {
|
|
91
|
+
if (!ALLOWED.has(ch)) {
|
|
92
|
+
if (FORBIDDEN.has(ch)) {
|
|
93
|
+
throw fail(uri, `${JSON.stringify(ch)} is not defined by the scheme (RFC-009 §10.3)`);
|
|
94
|
+
}
|
|
95
|
+
if (/\s/.test(ch)) {
|
|
96
|
+
throw fail(uri, 'whitespace is not allowed (RFC-009 §10.3 lowercase US-ASCII only)');
|
|
97
|
+
}
|
|
98
|
+
throw fail(uri, `character ${JSON.stringify(ch)} is outside the allowed set `
|
|
99
|
+
+ "(lowercase US-ASCII, digits, '-', '.', '/')");
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Path: at most one '/', and the action behind it must be non-empty.
|
|
104
|
+
let authority = rest;
|
|
105
|
+
let action = null;
|
|
106
|
+
const slash = rest.indexOf('/');
|
|
107
|
+
if (slash !== -1) {
|
|
108
|
+
authority = rest.slice(0, slash);
|
|
109
|
+
action = rest.slice(slash + 1);
|
|
110
|
+
if (action === '') {
|
|
111
|
+
throw fail(uri, "trailing '/' with empty action - action is a closed-set "
|
|
112
|
+
+ 'verb, not omissible by empty string (§10.2)');
|
|
113
|
+
}
|
|
114
|
+
if (action.includes('/')) {
|
|
115
|
+
throw fail(uri, "second path segment - path is a single '/<action>' (§10.2)");
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Authority: exactly three segments.
|
|
120
|
+
const segments = authority.split('.');
|
|
121
|
+
if (segments.length !== 3) {
|
|
122
|
+
throw fail(uri, `authority has ${segments.length} segment(s), must be `
|
|
123
|
+
+ '<subject>.<organ>.<root> (RFC-009 §10.2)');
|
|
124
|
+
}
|
|
125
|
+
const [subject, organ, root] = segments;
|
|
126
|
+
if (subject === '' || root === '') {
|
|
127
|
+
throw fail(uri, 'authority segments must be non-empty (RFC-009 §10.2)');
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Subject: hash form (8/32/64 lowercase hex) or name form. Ordered choice
|
|
131
|
+
// per the ABNF: all-lowerhex input is tried as hash-subject first; a
|
|
132
|
+
// lowercase-hex string of another length is therefore a NAME subject,
|
|
133
|
+
// exactly as the grammar says. Documented, not "fixed".
|
|
134
|
+
let subjectIsHash = false;
|
|
135
|
+
let subjectHex = null;
|
|
136
|
+
if ([...subject].every((c) => LOWHEX.has(c)) && HASH_LENGTHS.includes(subject.length)) {
|
|
137
|
+
subjectIsHash = true;
|
|
138
|
+
subjectHex = subject;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Organ — CLOSED set, case-sensitive (§10.1). 'Forge', 'forgery', '' all fail.
|
|
142
|
+
if (!ORGANS.includes(organ)) {
|
|
143
|
+
throw fail(uri, `organ ${JSON.stringify(organ)} is outside the closed set `
|
|
144
|
+
+ `[${ORGANS.join(', ')}] (RFC-009 §10.1/§10.3)`);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Action — CLOSED set (§10.1). The deliberate difference from rttp.
|
|
148
|
+
if (action !== null && !ACTIONS.includes(action)) {
|
|
149
|
+
throw fail(uri, `action ${JSON.stringify(action)} is outside the closed set `
|
|
150
|
+
+ `[${ACTIONS.join(', ')}] (RFC-009 §10.1)`);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const canonicalUri = SCHEME + '://' + authority + (action ? '/' + action : '');
|
|
154
|
+
|
|
155
|
+
return {
|
|
156
|
+
scheme: SCHEME,
|
|
157
|
+
subject,
|
|
158
|
+
subject_is_hash: subjectIsHash,
|
|
159
|
+
subject_hex: subjectHex,
|
|
160
|
+
organ,
|
|
161
|
+
root,
|
|
162
|
+
authority,
|
|
163
|
+
action,
|
|
164
|
+
action_omitted: action === null,
|
|
165
|
+
action_safe: SAFE.has(action), // §11.3
|
|
166
|
+
canonical_uri: canonicalUri,
|
|
167
|
+
route_hex: deriveRouteHex(authority), // SPEC §3
|
|
168
|
+
};
|
|
169
|
+
}
|
package/src/vectors.json
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
{
|
|
2
|
+
"spec": "IQA-URI-ATTEST-v1.2.6",
|
|
3
|
+
"applies_to": [
|
|
4
|
+
"RFC-009 §10",
|
|
5
|
+
"RFC-009 §11"
|
|
6
|
+
],
|
|
7
|
+
"generated_by": "SPEC/tools/iqa_conformance.py",
|
|
8
|
+
"note": "Generated file - do not edit by hand. Change the cases in iqa_conformance.py instead.",
|
|
9
|
+
"route_rule": "IQA_ROUTE = SHA-256(ASCII(canonical_authority))[0:4]",
|
|
10
|
+
"organ_closed_set": [
|
|
11
|
+
"forge",
|
|
12
|
+
"tss",
|
|
13
|
+
"gateway"
|
|
14
|
+
],
|
|
15
|
+
"action_closed_set": [
|
|
16
|
+
"verify",
|
|
17
|
+
"audit",
|
|
18
|
+
"attest",
|
|
19
|
+
"revoke"
|
|
20
|
+
],
|
|
21
|
+
"standings_closed_set": [
|
|
22
|
+
"ghost",
|
|
23
|
+
"probation",
|
|
24
|
+
"radiant",
|
|
25
|
+
"genesis"
|
|
26
|
+
],
|
|
27
|
+
"positive_uris": [
|
|
28
|
+
{
|
|
29
|
+
"uri": "iqa://3f9a1b2c.gateway.iqa",
|
|
30
|
+
"canonical_uri": "iqa://3f9a1b2c.gateway.iqa",
|
|
31
|
+
"subject": "3f9a1b2c",
|
|
32
|
+
"subject_is_hash": true,
|
|
33
|
+
"organ": "gateway",
|
|
34
|
+
"root": "iqa",
|
|
35
|
+
"authority": "3f9a1b2c.gateway.iqa",
|
|
36
|
+
"action": null,
|
|
37
|
+
"action_omitted": true,
|
|
38
|
+
"action_safe": true,
|
|
39
|
+
"route_hex": "5c378581",
|
|
40
|
+
"note": null
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"uri": "iqa://0000004149434e531c5b21d80403358b.forge.iqa",
|
|
44
|
+
"canonical_uri": "iqa://0000004149434e531c5b21d80403358b.forge.iqa",
|
|
45
|
+
"subject": "0000004149434e531c5b21d80403358b",
|
|
46
|
+
"subject_is_hash": true,
|
|
47
|
+
"organ": "forge",
|
|
48
|
+
"root": "iqa",
|
|
49
|
+
"authority": "0000004149434e531c5b21d80403358b.forge.iqa",
|
|
50
|
+
"action": null,
|
|
51
|
+
"action_omitted": true,
|
|
52
|
+
"action_safe": true,
|
|
53
|
+
"route_hex": "133a7fcd",
|
|
54
|
+
"note": null
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"uri": "iqa://3f9a1b2c.tss.iqa/audit",
|
|
58
|
+
"canonical_uri": "iqa://3f9a1b2c.tss.iqa/audit",
|
|
59
|
+
"subject": "3f9a1b2c",
|
|
60
|
+
"subject_is_hash": true,
|
|
61
|
+
"organ": "tss",
|
|
62
|
+
"root": "iqa",
|
|
63
|
+
"authority": "3f9a1b2c.tss.iqa",
|
|
64
|
+
"action": "audit",
|
|
65
|
+
"action_omitted": false,
|
|
66
|
+
"action_safe": false,
|
|
67
|
+
"route_hex": "1d60651a",
|
|
68
|
+
"note": null
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"uri": "iqa://master-authority.gateway.iqa/verify",
|
|
72
|
+
"canonical_uri": "iqa://master-authority.gateway.iqa/verify",
|
|
73
|
+
"subject": "master-authority",
|
|
74
|
+
"subject_is_hash": false,
|
|
75
|
+
"organ": "gateway",
|
|
76
|
+
"root": "iqa",
|
|
77
|
+
"authority": "master-authority.gateway.iqa",
|
|
78
|
+
"action": "verify",
|
|
79
|
+
"action_omitted": false,
|
|
80
|
+
"action_safe": true,
|
|
81
|
+
"route_hex": "510ef099",
|
|
82
|
+
"note": null
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"uri": "iqa://0000004149434e531c5b21d80403358ba794ef228ca5253994959ef6f3ff5678.tss.iqa/attest",
|
|
86
|
+
"canonical_uri": "iqa://0000004149434e531c5b21d80403358ba794ef228ca5253994959ef6f3ff5678.tss.iqa/attest",
|
|
87
|
+
"subject": "0000004149434e531c5b21d80403358ba794ef228ca5253994959ef6f3ff5678",
|
|
88
|
+
"subject_is_hash": true,
|
|
89
|
+
"organ": "tss",
|
|
90
|
+
"root": "iqa",
|
|
91
|
+
"authority": "0000004149434e531c5b21d80403358ba794ef228ca5253994959ef6f3ff5678.tss.iqa",
|
|
92
|
+
"action": "attest",
|
|
93
|
+
"action_omitted": false,
|
|
94
|
+
"action_safe": false,
|
|
95
|
+
"route_hex": "afd25fe8",
|
|
96
|
+
"note": null
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"uri": "iqa://0000000000000000.gateway.iqa",
|
|
100
|
+
"canonical_uri": "iqa://0000000000000000.gateway.iqa",
|
|
101
|
+
"subject": "0000000000000000",
|
|
102
|
+
"subject_is_hash": false,
|
|
103
|
+
"organ": "gateway",
|
|
104
|
+
"root": "iqa",
|
|
105
|
+
"authority": "0000000000000000.gateway.iqa",
|
|
106
|
+
"action": null,
|
|
107
|
+
"action_omitted": true,
|
|
108
|
+
"action_safe": true,
|
|
109
|
+
"route_hex": "6ddc5b56",
|
|
110
|
+
"note": null
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"uri": "iqa://a-b-c.forge.iqa/revoke",
|
|
114
|
+
"canonical_uri": "iqa://a-b-c.forge.iqa/revoke",
|
|
115
|
+
"subject": "a-b-c",
|
|
116
|
+
"subject_is_hash": false,
|
|
117
|
+
"organ": "forge",
|
|
118
|
+
"root": "iqa",
|
|
119
|
+
"authority": "a-b-c.forge.iqa",
|
|
120
|
+
"action": "revoke",
|
|
121
|
+
"action_omitted": false,
|
|
122
|
+
"action_safe": false,
|
|
123
|
+
"route_hex": "e14bcb62",
|
|
124
|
+
"note": null
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"uri": "iqa://3f9a1b2cd.gateway.iqa/verify",
|
|
128
|
+
"canonical_uri": "iqa://3f9a1b2cd.gateway.iqa/verify",
|
|
129
|
+
"subject": "3f9a1b2cd",
|
|
130
|
+
"subject_is_hash": false,
|
|
131
|
+
"organ": "gateway",
|
|
132
|
+
"root": "iqa",
|
|
133
|
+
"authority": "3f9a1b2cd.gateway.iqa",
|
|
134
|
+
"action": "verify",
|
|
135
|
+
"action_omitted": false,
|
|
136
|
+
"action_safe": true,
|
|
137
|
+
"route_hex": "acee0323",
|
|
138
|
+
"note": "note - 9 hex digits is not a hash length (8/32/64), so the subject parses as a name-subject per the ABNF ordered choice (RFC-009 §10.2)"
|
|
139
|
+
}
|
|
140
|
+
],
|
|
141
|
+
"negative_uris": [
|
|
142
|
+
{
|
|
143
|
+
"uri": "iqa://3f9a1b2c.gateway.iqa/AUDIT",
|
|
144
|
+
"reason": "uppercase action - lowercase only (RFC-009 §10.3)"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"uri": "iqa://3F9A1B2C.gateway.iqa/audit",
|
|
148
|
+
"reason": "uppercase hex subject - lowercase only (RFC-009 §10.3)"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"uri": "IQA://3f9a1b2c.gateway.iqa/audit",
|
|
152
|
+
"reason": "uppercase scheme prefix - canonical form is lowercase (RFC-009 §10.3)"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"uri": "iqas://3f9a1b2c.gateway.iqa/audit",
|
|
156
|
+
"reason": "no iqas variant exists and no fallback is defined - fail closed (RFC-009 §12 #8)"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"uri": "iqa://subject@iqa.org",
|
|
160
|
+
"reason": "userinfo is not defined (RFC-009 §10.3)"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"uri": "iqa://iqa.org/RFC-009/",
|
|
164
|
+
"reason": "no organ, second path segment - this is an https matter (RFC-009 §10.3)"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"uri": "iqa://3f9a1b2c.forgery.iqa",
|
|
168
|
+
"reason": "organ is a closed set (RFC-009 §10.1/§10.3)"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"uri": "iqa://3f9a1b2c.gateway.iqa/pulse",
|
|
172
|
+
"reason": "action is a closed set - 'pulse' is not one of the four verbs (RFC-009 §10.1)"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"uri": "iqa://3f9a1b2c.Gateway.iqa/verify",
|
|
176
|
+
"reason": "organ is case-sensitive within the closed set (RFC-009 §10.3)"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"uri": "iqa://3f9a1b2c.gateway.iqa/audit?x=1",
|
|
180
|
+
"reason": "query is not defined (RFC-009 §10.3)"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"uri": "iqa://3f9a1b2c.gateway.iqa/audit#f",
|
|
184
|
+
"reason": "fragment is not defined (RFC-009 §10.3)"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"uri": "iqa://3f9a1b2c.gateway.iqa:443/audit",
|
|
188
|
+
"reason": "port is not defined (RFC-009 §10.3)"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"uri": "iqa://3f9a1b2c.gateway.iqa/a/b",
|
|
192
|
+
"reason": "second path segment - path is a single '/<action>' (RFC-009 §10.2)"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"uri": "iqa://3f9a1b2c.gateway.iqa/",
|
|
196
|
+
"reason": "trailing '/' with empty action - the closed set has no empty verb (RFC-009 §10.2)"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"uri": "iqa://a.b",
|
|
200
|
+
"reason": "authority has two segments, must be <subject>.<organ>.<root> (RFC-009 §10.2)"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"uri": "iqa://a.b.c.d/audit",
|
|
204
|
+
"reason": "authority has four segments, must be <subject>.<organ>.<root> (RFC-009 §10.2)"
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"uri": "https://3f9a1b2c.gateway.iqa/audit",
|
|
208
|
+
"reason": "not an iqa scheme - there is no fallback (RFC-009 §10.3, §12 #8)"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"uri": "iqa://3f9a1b2c.gateway.iqa/audit ",
|
|
212
|
+
"reason": "trailing whitespace"
|
|
213
|
+
}
|
|
214
|
+
],
|
|
215
|
+
"action_safety": [
|
|
216
|
+
{
|
|
217
|
+
"action": null,
|
|
218
|
+
"safe": true,
|
|
219
|
+
"why": "omitted - standing read (RFC-009 §11.1/§11.3)"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"action": "verify",
|
|
223
|
+
"safe": true,
|
|
224
|
+
"why": "read-only comparison, no state written (RFC-009 §11.3)"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"action": "audit",
|
|
228
|
+
"safe": false,
|
|
229
|
+
"why": "a failing measurement triggers Authority Ischemia (RFC-009 §11.3/§11.4)"
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"action": "attest",
|
|
233
|
+
"safe": false,
|
|
234
|
+
"why": "state transition - Seal issuance (RFC-009 §11.3)"
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"action": "revoke",
|
|
238
|
+
"safe": false,
|
|
239
|
+
"why": "state transition - standing withdrawal (RFC-009 §11.3)"
|
|
240
|
+
}
|
|
241
|
+
],
|
|
242
|
+
"attest_envelope_vector": {
|
|
243
|
+
"v": 1,
|
|
244
|
+
"alg": "ed25519",
|
|
245
|
+
"aid": "3125ee20b2238281f70ca408192f82152647d365219184fa1fe22c08a42c035e",
|
|
246
|
+
"pub": "9c097c66ab4f82136ceddaef56854f740bf87da3eec42a249ba40bbb066f1e6a",
|
|
247
|
+
"ts": 1760000000,
|
|
248
|
+
"nonce": "0011223344556677",
|
|
249
|
+
"sig": "054b74c8dcd2b2128291ce433409983609d62c63a002138475d5e33bd21ea0b0c6243790db3d926ad6820cdf7e64f49cbd49a794a1b693cb60217a3382a5f007",
|
|
250
|
+
"payload": {
|
|
251
|
+
"subject_uri": "iqa://3f9a1b2c.gateway.iqa",
|
|
252
|
+
"organ": "gateway",
|
|
253
|
+
"standing": "radiant"
|
|
254
|
+
},
|
|
255
|
+
"seed_hex": "e722fed924c7f76b157faab674ea97bb7c3075f55ad7d3c6319418e22b86d611",
|
|
256
|
+
"signing_input_hex": "6971612d6174746573742d76310a7b22616964223a2233313235656532306232323338323831663730636134303831393266383231353236343764333635323139313834666131666532326330386134326330333565222c22616c67223a2265643235353139222c226e6f6e6365223a2230303131323233333434353536363737222c227061796c6f6164223a7b226f7267616e223a2267617465776179222c227374616e64696e67223a2272616469616e74222c227375626a6563745f757269223a226971613a2f2f33663961316232632e676174657761792e697161227d2c22707562223a2239633039376336366162346638323133366365646461656635363835346637343062663837646133656563343261323439626134306262623036366631653661222c227473223a313736303030303030307d",
|
|
257
|
+
"domain_prefix_hex": "6971612d6174746573742d76310a",
|
|
258
|
+
"expected": "verify MUST accept; aid MUST equal SHA-256(pub); signing input MUST reproduce byte for byte"
|
|
259
|
+
}
|
|
260
|
+
}
|