@certen.io/sdk 0.14.1 → 0.16.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/CHANGELOG.md +44 -0
- package/README.md +20 -0
- package/dist/agent/core.d.ts +7 -0
- package/dist/agent/core.d.ts.map +1 -0
- package/dist/agent/core.js +7 -0
- package/dist/agent/core.js.map +1 -0
- package/dist/agent/mandate.d.ts +141 -0
- package/dist/agent/mandate.d.ts.map +1 -0
- package/dist/agent/mandate.js +158 -0
- package/dist/agent/mandate.js.map +1 -0
- package/dist/agent-enrollment.d.ts +83 -0
- package/dist/agent-enrollment.d.ts.map +1 -0
- package/dist/agent-enrollment.js +102 -0
- package/dist/agent-enrollment.js.map +1 -0
- package/dist/core/bytes.d.ts +38 -0
- package/dist/core/bytes.d.ts.map +1 -0
- package/dist/core/bytes.js +161 -0
- package/dist/core/bytes.js.map +1 -0
- package/dist/core/grant-profile.d.ts +133 -0
- package/dist/core/grant-profile.d.ts.map +1 -0
- package/dist/core/grant-profile.js +323 -0
- package/dist/core/grant-profile.js.map +1 -0
- package/dist/core/hashes.d.ts +59 -0
- package/dist/core/hashes.d.ts.map +1 -0
- package/dist/core/hashes.js +128 -0
- package/dist/core/hashes.js.map +1 -0
- package/dist/core/jcs.d.ts +29 -0
- package/dist/core/jcs.d.ts.map +1 -0
- package/dist/core/jcs.js +371 -0
- package/dist/core/jcs.js.map +1 -0
- package/dist/core/registry-profile.d.ts +47 -0
- package/dist/core/registry-profile.d.ts.map +1 -0
- package/dist/core/registry-profile.js +119 -0
- package/dist/core/registry-profile.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/principal-entries.d.ts +112 -0
- package/dist/principal-entries.d.ts.map +1 -0
- package/dist/principal-entries.js +237 -0
- package/dist/principal-entries.js.map +1 -0
- package/dist/principal-intervention.d.ts +175 -0
- package/dist/principal-intervention.d.ts.map +1 -0
- package/dist/principal-intervention.js +247 -0
- package/dist/principal-intervention.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/dist/core/jcs.js
ADDED
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strict JSON parsing and RFC 8785 (JCS) canonicalization. Written for this package from RFC 8259 and RFC 8785 and
|
|
3
|
+
* judged by the DAX-2 vectors; it shares no code with docs/core/vectors/lib (GR-06: a third implementation).
|
|
4
|
+
*
|
|
5
|
+
* Parsing refuses what has no single meaning: a duplicate member name, a lone surrogate, trailing data, anything that
|
|
6
|
+
* is not JSON (NaN, a leading zero, a trailing comma). Canonicalization emits members sorted by UTF-16 code units, the
|
|
7
|
+
* ECMAScript form of numbers and the minimal string escapes, and refuses values JSON cannot carry.
|
|
8
|
+
*/
|
|
9
|
+
import { CoreError, hasLoneSurrogate, isPlainObject } from './bytes.js';
|
|
10
|
+
export const MAX_DEPTH = 128;
|
|
11
|
+
const BS = String.fromCharCode(92);
|
|
12
|
+
const DQ = String.fromCharCode(34);
|
|
13
|
+
const isDigit = (c) => c !== undefined && c >= '0' && c <= '9';
|
|
14
|
+
const isHexDigit = (c) => (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
|
|
15
|
+
class Parser {
|
|
16
|
+
s;
|
|
17
|
+
integersOnly;
|
|
18
|
+
maxDepth;
|
|
19
|
+
i = 0;
|
|
20
|
+
constructor(s, integersOnly, maxDepth) {
|
|
21
|
+
this.s = s;
|
|
22
|
+
this.integersOnly = integersOnly;
|
|
23
|
+
this.maxDepth = maxDepth;
|
|
24
|
+
}
|
|
25
|
+
parseTop() {
|
|
26
|
+
const v = this.value(0);
|
|
27
|
+
this.ws();
|
|
28
|
+
if (this.i < this.s.length)
|
|
29
|
+
throw new CoreError('json_trailing_data');
|
|
30
|
+
return v;
|
|
31
|
+
}
|
|
32
|
+
ws() {
|
|
33
|
+
while (this.i < this.s.length) {
|
|
34
|
+
const c = this.s.charCodeAt(this.i);
|
|
35
|
+
if (c === 32 || c === 9 || c === 10 || c === 13)
|
|
36
|
+
this.i++;
|
|
37
|
+
else
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
value(depth) {
|
|
42
|
+
if (depth > this.maxDepth)
|
|
43
|
+
throw new CoreError('json_too_deep');
|
|
44
|
+
this.ws();
|
|
45
|
+
if (this.i >= this.s.length)
|
|
46
|
+
throw new CoreError('json_unexpected_end');
|
|
47
|
+
const c = this.s[this.i];
|
|
48
|
+
if (c === '{')
|
|
49
|
+
return this.object(depth);
|
|
50
|
+
if (c === '[')
|
|
51
|
+
return this.array(depth);
|
|
52
|
+
if (c === DQ)
|
|
53
|
+
return this.string();
|
|
54
|
+
if (c === '-' || isDigit(c))
|
|
55
|
+
return this.number();
|
|
56
|
+
if (this.s.startsWith('true', this.i)) {
|
|
57
|
+
this.i += 4;
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
if (this.s.startsWith('false', this.i)) {
|
|
61
|
+
this.i += 5;
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
if (this.s.startsWith('null', this.i)) {
|
|
65
|
+
this.i += 4;
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
throw new CoreError('json_unexpected_token');
|
|
69
|
+
}
|
|
70
|
+
object(depth) {
|
|
71
|
+
this.i++;
|
|
72
|
+
const out = {};
|
|
73
|
+
const seen = new Set();
|
|
74
|
+
this.ws();
|
|
75
|
+
if (this.s[this.i] === '}') {
|
|
76
|
+
this.i++;
|
|
77
|
+
return out;
|
|
78
|
+
}
|
|
79
|
+
for (;;) {
|
|
80
|
+
this.ws();
|
|
81
|
+
if (this.i >= this.s.length)
|
|
82
|
+
throw new CoreError('json_unexpected_end');
|
|
83
|
+
if (this.s[this.i] !== DQ)
|
|
84
|
+
throw new CoreError('json_expected_member_name');
|
|
85
|
+
const key = this.string();
|
|
86
|
+
if (seen.has(key))
|
|
87
|
+
throw new CoreError('duplicate_key');
|
|
88
|
+
seen.add(key);
|
|
89
|
+
this.ws();
|
|
90
|
+
if (this.i >= this.s.length)
|
|
91
|
+
throw new CoreError('json_unexpected_end');
|
|
92
|
+
if (this.s[this.i] !== ':')
|
|
93
|
+
throw new CoreError('json_expected_colon');
|
|
94
|
+
this.i++;
|
|
95
|
+
const v = this.value(depth + 1);
|
|
96
|
+
// defineProperty keeps a member named __proto__ as plain data
|
|
97
|
+
Object.defineProperty(out, key, { value: v, enumerable: true, writable: true, configurable: true });
|
|
98
|
+
this.ws();
|
|
99
|
+
if (this.i >= this.s.length)
|
|
100
|
+
throw new CoreError('json_unexpected_end');
|
|
101
|
+
const c = this.s[this.i];
|
|
102
|
+
if (c === ',') {
|
|
103
|
+
this.i++;
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
if (c === '}') {
|
|
107
|
+
this.i++;
|
|
108
|
+
return out;
|
|
109
|
+
}
|
|
110
|
+
throw new CoreError('json_expected_comma_or_end');
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
array(depth) {
|
|
114
|
+
this.i++;
|
|
115
|
+
const out = [];
|
|
116
|
+
this.ws();
|
|
117
|
+
if (this.s[this.i] === ']') {
|
|
118
|
+
this.i++;
|
|
119
|
+
return out;
|
|
120
|
+
}
|
|
121
|
+
for (;;) {
|
|
122
|
+
out.push(this.value(depth + 1));
|
|
123
|
+
this.ws();
|
|
124
|
+
if (this.i >= this.s.length)
|
|
125
|
+
throw new CoreError('json_unexpected_end');
|
|
126
|
+
const c = this.s[this.i];
|
|
127
|
+
if (c === ',') {
|
|
128
|
+
this.i++;
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
if (c === ']') {
|
|
132
|
+
this.i++;
|
|
133
|
+
return out;
|
|
134
|
+
}
|
|
135
|
+
throw new CoreError('json_expected_comma_or_end');
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
hex4() {
|
|
139
|
+
const h = this.s.slice(this.i, this.i + 4);
|
|
140
|
+
if (h.length < 4 || ![...h].every(isHexDigit))
|
|
141
|
+
throw new CoreError('json_bad_escape');
|
|
142
|
+
this.i += 4;
|
|
143
|
+
return parseInt(h, 16);
|
|
144
|
+
}
|
|
145
|
+
string() {
|
|
146
|
+
this.i++;
|
|
147
|
+
let out = '';
|
|
148
|
+
for (;;) {
|
|
149
|
+
if (this.i >= this.s.length)
|
|
150
|
+
throw new CoreError('json_unterminated_string');
|
|
151
|
+
const code = this.s.charCodeAt(this.i);
|
|
152
|
+
if (code === 34) {
|
|
153
|
+
this.i++;
|
|
154
|
+
return out;
|
|
155
|
+
}
|
|
156
|
+
if (code < 0x20)
|
|
157
|
+
throw new CoreError('json_control_character');
|
|
158
|
+
if (code === 92) {
|
|
159
|
+
this.i++;
|
|
160
|
+
if (this.i >= this.s.length)
|
|
161
|
+
throw new CoreError('json_unterminated_string');
|
|
162
|
+
const e = this.s[this.i];
|
|
163
|
+
this.i++;
|
|
164
|
+
switch (e) {
|
|
165
|
+
case DQ:
|
|
166
|
+
out += DQ;
|
|
167
|
+
break;
|
|
168
|
+
case BS:
|
|
169
|
+
out += BS;
|
|
170
|
+
break;
|
|
171
|
+
case '/':
|
|
172
|
+
out += '/';
|
|
173
|
+
break;
|
|
174
|
+
case 'b':
|
|
175
|
+
out += String.fromCharCode(8);
|
|
176
|
+
break;
|
|
177
|
+
case 'f':
|
|
178
|
+
out += String.fromCharCode(12);
|
|
179
|
+
break;
|
|
180
|
+
case 'n':
|
|
181
|
+
out += String.fromCharCode(10);
|
|
182
|
+
break;
|
|
183
|
+
case 'r':
|
|
184
|
+
out += String.fromCharCode(13);
|
|
185
|
+
break;
|
|
186
|
+
case 't':
|
|
187
|
+
out += String.fromCharCode(9);
|
|
188
|
+
break;
|
|
189
|
+
case 'u': {
|
|
190
|
+
const u = this.hex4();
|
|
191
|
+
if (u >= 0xd800 && u <= 0xdbff) {
|
|
192
|
+
if (this.s[this.i] === BS && this.s[this.i + 1] === 'u') {
|
|
193
|
+
this.i += 2;
|
|
194
|
+
const low = this.hex4();
|
|
195
|
+
if (low < 0xdc00 || low > 0xdfff)
|
|
196
|
+
throw new CoreError('lone_surrogate');
|
|
197
|
+
out += String.fromCharCode(u, low);
|
|
198
|
+
}
|
|
199
|
+
else
|
|
200
|
+
throw new CoreError('lone_surrogate');
|
|
201
|
+
}
|
|
202
|
+
else if (u >= 0xdc00 && u <= 0xdfff)
|
|
203
|
+
throw new CoreError('lone_surrogate');
|
|
204
|
+
else
|
|
205
|
+
out += String.fromCharCode(u);
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
default:
|
|
209
|
+
throw new CoreError('json_bad_escape');
|
|
210
|
+
}
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
if (code >= 0xd800 && code <= 0xdbff) {
|
|
214
|
+
const n = this.i + 1 < this.s.length ? this.s.charCodeAt(this.i + 1) : 0;
|
|
215
|
+
if (n >= 0xdc00 && n <= 0xdfff) {
|
|
216
|
+
out += this.s[this.i] + this.s[this.i + 1];
|
|
217
|
+
this.i += 2;
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
throw new CoreError('lone_surrogate');
|
|
221
|
+
}
|
|
222
|
+
if (code >= 0xdc00 && code <= 0xdfff)
|
|
223
|
+
throw new CoreError('lone_surrogate');
|
|
224
|
+
out += this.s[this.i];
|
|
225
|
+
this.i++;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
number() {
|
|
229
|
+
const start = this.i;
|
|
230
|
+
if (this.s[this.i] === '-')
|
|
231
|
+
this.i++;
|
|
232
|
+
if (!isDigit(this.s[this.i]))
|
|
233
|
+
throw new CoreError('json_bad_number');
|
|
234
|
+
if (this.s[this.i] === '0')
|
|
235
|
+
this.i++;
|
|
236
|
+
else
|
|
237
|
+
while (isDigit(this.s[this.i]))
|
|
238
|
+
this.i++;
|
|
239
|
+
let integerLiteral = true;
|
|
240
|
+
if (this.s[this.i] === '.') {
|
|
241
|
+
integerLiteral = false;
|
|
242
|
+
this.i++;
|
|
243
|
+
if (!isDigit(this.s[this.i]))
|
|
244
|
+
throw new CoreError('json_bad_number');
|
|
245
|
+
while (isDigit(this.s[this.i]))
|
|
246
|
+
this.i++;
|
|
247
|
+
}
|
|
248
|
+
if (this.s[this.i] === 'e' || this.s[this.i] === 'E') {
|
|
249
|
+
integerLiteral = false;
|
|
250
|
+
this.i++;
|
|
251
|
+
if (this.s[this.i] === '+' || this.s[this.i] === '-')
|
|
252
|
+
this.i++;
|
|
253
|
+
if (!isDigit(this.s[this.i]))
|
|
254
|
+
throw new CoreError('json_bad_number');
|
|
255
|
+
while (isDigit(this.s[this.i]))
|
|
256
|
+
this.i++;
|
|
257
|
+
}
|
|
258
|
+
const token = this.s.slice(start, this.i);
|
|
259
|
+
if (this.integersOnly) {
|
|
260
|
+
if (integerLiteral) {
|
|
261
|
+
if (token === '-0')
|
|
262
|
+
throw new CoreError('number_spelling');
|
|
263
|
+
const mag = BigInt(token.startsWith('-') ? token.slice(1) : token);
|
|
264
|
+
if (mag > 9007199254740991n)
|
|
265
|
+
throw new CoreError('number_not_safe_integer');
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
// an integer-valued number written with a fraction or an exponent (1.0, 4e0) is a spelling problem (GR-45);
|
|
269
|
+
// a real fraction or a value beyond 2^53-1 is not a safe integer (GR-03)
|
|
270
|
+
const v = Number(token);
|
|
271
|
+
if (Number.isFinite(v) && Number.isInteger(v) && Math.abs(v) <= Number.MAX_SAFE_INTEGER)
|
|
272
|
+
throw new CoreError('number_spelling');
|
|
273
|
+
throw new CoreError('number_not_safe_integer');
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return Number(token);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
/** Parses JSON text strictly; throws CoreError with a stable code. */
|
|
280
|
+
export function parseJson(text, opts = {}) {
|
|
281
|
+
if (typeof text !== 'string')
|
|
282
|
+
throw new CoreError('json_not_text');
|
|
283
|
+
return new Parser(text, opts.integersOnly === true, opts.maxDepth ?? MAX_DEPTH).parseTop();
|
|
284
|
+
}
|
|
285
|
+
function escapeString(s) {
|
|
286
|
+
if (hasLoneSurrogate(s))
|
|
287
|
+
throw new CoreError('lone_surrogate');
|
|
288
|
+
let out = DQ;
|
|
289
|
+
for (let i = 0; i < s.length; i++) {
|
|
290
|
+
const c = s.charCodeAt(i);
|
|
291
|
+
if (c === 34)
|
|
292
|
+
out += BS + DQ;
|
|
293
|
+
else if (c === 92)
|
|
294
|
+
out += BS + BS;
|
|
295
|
+
else if (c === 8)
|
|
296
|
+
out += BS + 'b';
|
|
297
|
+
else if (c === 9)
|
|
298
|
+
out += BS + 't';
|
|
299
|
+
else if (c === 10)
|
|
300
|
+
out += BS + 'n';
|
|
301
|
+
else if (c === 12)
|
|
302
|
+
out += BS + 'f';
|
|
303
|
+
else if (c === 13)
|
|
304
|
+
out += BS + 'r';
|
|
305
|
+
else if (c < 0x20)
|
|
306
|
+
out += BS + 'u' + c.toString(16).padStart(4, '0');
|
|
307
|
+
else
|
|
308
|
+
out += s[i];
|
|
309
|
+
}
|
|
310
|
+
return out + DQ;
|
|
311
|
+
}
|
|
312
|
+
function canon(v, depth) {
|
|
313
|
+
if (depth > MAX_DEPTH)
|
|
314
|
+
throw new CoreError('json_too_deep');
|
|
315
|
+
if (v === null)
|
|
316
|
+
return 'null';
|
|
317
|
+
switch (typeof v) {
|
|
318
|
+
case 'boolean':
|
|
319
|
+
return v ? 'true' : 'false';
|
|
320
|
+
case 'number':
|
|
321
|
+
if (!Number.isFinite(v))
|
|
322
|
+
throw new CoreError('number_not_finite');
|
|
323
|
+
return String(v);
|
|
324
|
+
case 'string':
|
|
325
|
+
return escapeString(v);
|
|
326
|
+
case 'undefined':
|
|
327
|
+
throw new CoreError('undefined_value');
|
|
328
|
+
case 'object':
|
|
329
|
+
break;
|
|
330
|
+
default:
|
|
331
|
+
throw new CoreError('unsupported_type', typeof v);
|
|
332
|
+
}
|
|
333
|
+
if (Array.isArray(v)) {
|
|
334
|
+
const parts = [];
|
|
335
|
+
for (let i = 0; i < v.length; i++) {
|
|
336
|
+
if (!(i in v))
|
|
337
|
+
throw new CoreError('unsupported_type', 'sparse array');
|
|
338
|
+
parts.push(canon(v[i], depth + 1));
|
|
339
|
+
}
|
|
340
|
+
return '[' + parts.join(',') + ']';
|
|
341
|
+
}
|
|
342
|
+
if (!isPlainObject(v))
|
|
343
|
+
throw new CoreError('unsupported_type', 'object');
|
|
344
|
+
if (Object.getOwnPropertySymbols(v).length > 0)
|
|
345
|
+
throw new CoreError('unsupported_type', 'symbol key');
|
|
346
|
+
const keys = Object.keys(v).sort();
|
|
347
|
+
const parts = [];
|
|
348
|
+
for (const k of keys) {
|
|
349
|
+
const d = Object.getOwnPropertyDescriptor(v, k);
|
|
350
|
+
if (d === undefined || !('value' in d))
|
|
351
|
+
throw new CoreError('unsupported_type', 'accessor');
|
|
352
|
+
parts.push(escapeString(k) + ':' + canon(d.value, depth + 1));
|
|
353
|
+
}
|
|
354
|
+
return '{' + parts.join(',') + '}';
|
|
355
|
+
}
|
|
356
|
+
/** RFC 8785 text of an in-memory JSON value; throws CoreError for a value JSON cannot carry. */
|
|
357
|
+
export function canonicalize(value) {
|
|
358
|
+
return canon(value, 0);
|
|
359
|
+
}
|
|
360
|
+
/** Parse then canonicalize, with a named refusal instead of a throw. */
|
|
361
|
+
export function canonicalizeText(text) {
|
|
362
|
+
try {
|
|
363
|
+
return { ok: true, canonical: canonicalize(parseJson(text)) };
|
|
364
|
+
}
|
|
365
|
+
catch (e) {
|
|
366
|
+
if (e instanceof CoreError)
|
|
367
|
+
return { ok: false, reason: e.code };
|
|
368
|
+
throw e;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
//# sourceMappingURL=jcs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jcs.js","sourceRoot":"","sources":["../../src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ubjectType } from './grant-profile.js';
|
|
2
|
+
/** certen.subject/v1: the single record (kept: two v1 rows for one ADI are ambiguous). certen.subject/v2: a version lineage (GR-29, GR-49 to GR-52). */
|
|
3
|
+
export declare const REGISTRATION_SCHEMA_V1 = "certen.subject/v1";
|
|
4
|
+
export declare const REGISTRATION_SCHEMA = "certen.subject/v2";
|
|
5
|
+
export declare const REGISTRATION_LIMITS: {
|
|
6
|
+
textBytes: number;
|
|
7
|
+
submitters: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const SUBJECT_STATUSES: readonly ["active", "suspended", "retired"];
|
|
10
|
+
export type SubjectStatus = (typeof SUBJECT_STATUSES)[number];
|
|
11
|
+
export interface Registration {
|
|
12
|
+
schema: 'certen.subject/v1' | 'certen.subject/v2';
|
|
13
|
+
adi: string;
|
|
14
|
+
/** present in certen.subject/v2 only */
|
|
15
|
+
version?: number;
|
|
16
|
+
/** present in certen.subject/v2 only: null for version 1, else the hash of the previous version */
|
|
17
|
+
priorHash?: string | null;
|
|
18
|
+
type: SubjectType;
|
|
19
|
+
principal: {
|
|
20
|
+
adi: string;
|
|
21
|
+
keyBook: string;
|
|
22
|
+
};
|
|
23
|
+
responsibleSeat: string;
|
|
24
|
+
submitters: string[];
|
|
25
|
+
status: SubjectStatus;
|
|
26
|
+
registeredAt: number;
|
|
27
|
+
}
|
|
28
|
+
export type RegistrationValidation = {
|
|
29
|
+
ok: true;
|
|
30
|
+
registration: Registration;
|
|
31
|
+
} | {
|
|
32
|
+
ok: false;
|
|
33
|
+
reason: string;
|
|
34
|
+
detail?: string;
|
|
35
|
+
};
|
|
36
|
+
export declare function validateRegistration(value: unknown): RegistrationValidation;
|
|
37
|
+
export declare function canonicalRegistration(value: unknown): string;
|
|
38
|
+
export declare function parseRegistrationTextUnhashed(text: string): {
|
|
39
|
+
ok: true;
|
|
40
|
+
registration: Registration;
|
|
41
|
+
canonical: string;
|
|
42
|
+
} | {
|
|
43
|
+
ok: false;
|
|
44
|
+
reason: string;
|
|
45
|
+
detail?: string;
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=registry-profile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry-profile.d.ts","sourceRoot":"","sources":["../../src/core/registry-profile.ts"],"names":[],"mappings":"AAKA,OAAO,EAAqC,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGzF,wJAAwJ;AACxJ,eAAO,MAAM,sBAAsB,sBAAsB,CAAC;AAC1D,eAAO,MAAM,mBAAmB,sBAAsB,CAAC;AACvD,eAAO,MAAM,mBAAmB;;;CAAsC,CAAC;AACvE,eAAO,MAAM,gBAAgB,6CAA8C,CAAC;AAC5E,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,mBAAmB,GAAG,mBAAmB,CAAC;IAClD,GAAG,EAAE,MAAM,CAAC;IACZ,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mGAAmG;IACnG,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,aAAa,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,sBAAsB,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,YAAY,EAAE,YAAY,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAkD/H,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,sBAAsB,CAW3E;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAI5D;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,YAAY,EAAE,YAAY,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAYxK"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The subject registration (GRANT.md section 8, certen.subject/v1): the closed object, its strict validation and its
|
|
3
|
+
* canonical text. The registration hash lives in hashes.ts; resolution (the sr vectors) lives in registry.ts.
|
|
4
|
+
*/
|
|
5
|
+
import { CoreError, HASH_RE, isPlainObject, utf8Length } from './bytes.js';
|
|
6
|
+
import { isAccUrl, isAdiUrl, SUBJECT_TYPES } from './grant-profile.js';
|
|
7
|
+
import { canonicalize, parseJson } from './jcs.js';
|
|
8
|
+
/** certen.subject/v1: the single record (kept: two v1 rows for one ADI are ambiguous). certen.subject/v2: a version lineage (GR-29, GR-49 to GR-52). */
|
|
9
|
+
export const REGISTRATION_SCHEMA_V1 = 'certen.subject/v1';
|
|
10
|
+
export const REGISTRATION_SCHEMA = 'certen.subject/v2';
|
|
11
|
+
export const REGISTRATION_LIMITS = { textBytes: 8192, submitters: 32 };
|
|
12
|
+
export const SUBJECT_STATUSES = ['active', 'suspended', 'retired'];
|
|
13
|
+
const SEAT_RE = /^seat:[a-z0-9][a-z0-9._-]{0,62}$/;
|
|
14
|
+
class Refusal extends Error {
|
|
15
|
+
reason;
|
|
16
|
+
detail;
|
|
17
|
+
constructor(reason, detail) {
|
|
18
|
+
super(reason);
|
|
19
|
+
this.reason = reason;
|
|
20
|
+
this.detail = detail;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const fail = (reason, path) => {
|
|
24
|
+
throw new Refusal(reason, path);
|
|
25
|
+
};
|
|
26
|
+
function obj(v, path, keys) {
|
|
27
|
+
if (!isPlainObject(v))
|
|
28
|
+
return fail('registration_field_invalid', path);
|
|
29
|
+
const have = Object.keys(v);
|
|
30
|
+
for (const k of have)
|
|
31
|
+
if (!keys.includes(k))
|
|
32
|
+
fail('registration_unknown_field', path + '.' + k);
|
|
33
|
+
for (const k of keys)
|
|
34
|
+
if (!have.includes(k))
|
|
35
|
+
fail('registration_missing_field', path + '.' + k);
|
|
36
|
+
return v;
|
|
37
|
+
}
|
|
38
|
+
const KEYS_V1 = ['schema', 'adi', 'type', 'principal', 'responsibleSeat', 'submitters', 'status', 'registeredAt'];
|
|
39
|
+
const KEYS_V2 = [...KEYS_V1, 'version', 'priorHash'];
|
|
40
|
+
function validate(v) {
|
|
41
|
+
if (!isPlainObject(v))
|
|
42
|
+
return fail('registration_field_invalid', '$');
|
|
43
|
+
const schema = v['schema'];
|
|
44
|
+
if (schema !== REGISTRATION_SCHEMA_V1 && schema !== REGISTRATION_SCHEMA)
|
|
45
|
+
return fail('registration_field_invalid', '$.schema');
|
|
46
|
+
const r = obj(v, '$', schema === REGISTRATION_SCHEMA ? KEYS_V2 : KEYS_V1);
|
|
47
|
+
if (!isAdiUrl(r['adi']))
|
|
48
|
+
fail('registration_field_invalid', '$.adi');
|
|
49
|
+
if (typeof r['type'] !== 'string' || !SUBJECT_TYPES.includes(r['type']))
|
|
50
|
+
fail('registration_field_invalid', '$.type');
|
|
51
|
+
const p = obj(r['principal'], '$.principal', ['adi', 'keyBook']);
|
|
52
|
+
if (!isAdiUrl(p['adi']))
|
|
53
|
+
fail('registration_field_invalid', '$.principal.adi');
|
|
54
|
+
const book = p['keyBook'];
|
|
55
|
+
if (!isAccUrl(book) || !book.startsWith(p['adi'] + '/'))
|
|
56
|
+
fail('registration_field_invalid', '$.principal.keyBook');
|
|
57
|
+
if (typeof r['responsibleSeat'] !== 'string' || !SEAT_RE.test(r['responsibleSeat']))
|
|
58
|
+
fail('registration_field_invalid', '$.responsibleSeat');
|
|
59
|
+
const subs = r['submitters'];
|
|
60
|
+
if (Array.isArray(subs) && subs.length > REGISTRATION_LIMITS.submitters)
|
|
61
|
+
fail('registration_too_large', '$.submitters');
|
|
62
|
+
if (!Array.isArray(subs) || !subs.every(isAdiUrl) || new Set(subs).size !== subs.length)
|
|
63
|
+
fail('registration_field_invalid', '$.submitters');
|
|
64
|
+
if (typeof r['status'] !== 'string' || !SUBJECT_STATUSES.includes(r['status']))
|
|
65
|
+
fail('registration_field_invalid', '$.status');
|
|
66
|
+
const at = r['registeredAt'];
|
|
67
|
+
if (typeof at !== 'number' || !Number.isSafeInteger(at) || at < 0 || Object.is(at, -0))
|
|
68
|
+
fail('registration_field_invalid', '$.registeredAt');
|
|
69
|
+
if (schema === REGISTRATION_SCHEMA) {
|
|
70
|
+
const version = r['version'];
|
|
71
|
+
if (typeof version !== 'number' || !Number.isSafeInteger(version) || version < 1)
|
|
72
|
+
fail('registration_field_invalid', '$.version');
|
|
73
|
+
const prior = r['priorHash'];
|
|
74
|
+
if (prior !== null && (typeof prior !== 'string' || !HASH_RE.test(prior)))
|
|
75
|
+
fail('registration_field_invalid', '$.priorHash');
|
|
76
|
+
if ((version === 1) !== (prior === null))
|
|
77
|
+
fail('registration_lineage_invalid', '$.priorHash');
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
export function validateRegistration(value) {
|
|
81
|
+
try {
|
|
82
|
+
validate(value);
|
|
83
|
+
const canonicalText = canonicalize(value);
|
|
84
|
+
if (utf8Length(canonicalText) > REGISTRATION_LIMITS.textBytes)
|
|
85
|
+
fail('registration_too_large', '$');
|
|
86
|
+
return { ok: true, registration: parseJson(canonicalText, { integersOnly: true }) };
|
|
87
|
+
}
|
|
88
|
+
catch (e) {
|
|
89
|
+
if (e instanceof Refusal)
|
|
90
|
+
return { ok: false, reason: e.reason, detail: e.detail };
|
|
91
|
+
if (e instanceof CoreError)
|
|
92
|
+
return { ok: false, reason: 'registration_field_invalid', detail: e.code };
|
|
93
|
+
throw e;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
export function canonicalRegistration(value) {
|
|
97
|
+
const v = validateRegistration(value);
|
|
98
|
+
if (!v.ok)
|
|
99
|
+
throw new CoreError(v.reason, v.detail);
|
|
100
|
+
return canonicalize(v.registration);
|
|
101
|
+
}
|
|
102
|
+
export function parseRegistrationTextUnhashed(text) {
|
|
103
|
+
if (utf8Length(text) > REGISTRATION_LIMITS.textBytes)
|
|
104
|
+
return { ok: false, reason: 'registration_too_large' };
|
|
105
|
+
let value;
|
|
106
|
+
try {
|
|
107
|
+
value = parseJson(text, { integersOnly: true });
|
|
108
|
+
}
|
|
109
|
+
catch (e) {
|
|
110
|
+
if (e instanceof CoreError)
|
|
111
|
+
return { ok: false, reason: 'registration_' + e.code };
|
|
112
|
+
throw e;
|
|
113
|
+
}
|
|
114
|
+
const v = validateRegistration(value);
|
|
115
|
+
if (!v.ok)
|
|
116
|
+
return v;
|
|
117
|
+
return { ok: true, registration: v.registration, canonical: canonicalize(v.registration) };
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=registry-profile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry-profile.js","sourceRoot":"","sources":["../../src/core/registry-profile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAa,MAAM,YAAY,CAAC;AACtF,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAoB,MAAM,oBAAoB,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAEnD,wJAAwJ;AACxJ,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAC1D,MAAM,CAAC,MAAM,mBAAmB,GAAG,mBAAmB,CAAC;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, ProvisionParams } from './agent.js'
|
|
|
9
9
|
export { CertenSigningDataError, checkIntentSigning, checkCosigning, checkGovernanceSigning, inspectSigningData, legsFromIntent, toBaseUnits, SIGNING_DATA_MISMATCH, SIGNING_DATA_ABSENT, SIGNING_VERIFIER_UNAVAILABLE, SIGNING_EXPECTATION_UNAVAILABLE, } from './signing-check.js';
|
|
10
10
|
export type { SigningSummary, ExpectedLeg, ExpectedOperation, Expectation } from './signing-check.js';
|
|
11
11
|
export type { BeforeSign } from './resources/execute.js';
|
|
12
|
+
export { agentEnrollmentState, agentAuthorityOperation, agentBookDisableOperation, isUnderAdi } from './agent-enrollment.js';
|
|
13
|
+
export { buildPrincipalEntry, canonicalJson, coreVerdict, PRINCIPAL_ENTRY_REFUSED_BY_CORE, entryHash, entryTag, envelopeDigestHex, issueGrant, issueMandate, registerAgent, taggedPreimage, writePrincipalEntry, ENTRY_TAGS, PRINCIPAL_ACCOUNTS, PRINCIPAL_ENTRY_MALFORMED, PRINCIPAL_ENTRY_NOT_PRINCIPALS, PRINCIPAL_PAGE_INVALID, PRINCIPAL_WRITE_UNSIGNED } from './principal-entries.js';
|
|
14
|
+
export type { PrincipalEntry, PrincipalEntryKind, PrincipalSigner, PrincipalWriteResult } from './principal-entries.js';
|
|
15
|
+
export { agentKeyRemoval, cancelByRejectVote, openRejectVote, replaceAgent, revocationOf, revokeAgentKey, revokeGrant, revokeSeatRecord, EXPOSURE_WINDOW_STATEMENT, INTERVENTION_MALFORMED, SEAT_RECORD_ROUTE, SEAT_RECORD_STATEMENT } from './principal-intervention.js';
|
|
16
|
+
export type { CancelResult, InterventionAct, RejectVoteOpened, ReplaceResult, RevokeGrantResult, RevokeKeyResult, SeatRecord, SeatRecordAbsence, SeatRecordAbsenceCode, SeatRecordPart } from './principal-intervention.js';
|
|
17
|
+
export type { AgentEnrollmentFacts, AgentEnrollmentState, AgentEnrollmentStep, AgentEnrollmentVerdict, AuthorityEntry, SignedDocumentFacts } from './agent-enrollment.js';
|
|
12
18
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,cAAc,CAAC;AAI7B,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAIzE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACxD,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEjF,OAAO,EACL,sBAAsB,EAAE,kBAAkB,EAAE,cAAc,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,cAAc,EAAE,WAAW,EACnI,qBAAqB,EAAE,mBAAmB,EAAE,4BAA4B,EAAE,+BAA+B,GAC1G,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtG,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,cAAc,CAAC;AAI7B,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAIzE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACxD,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEjF,OAAO,EACL,sBAAsB,EAAE,kBAAkB,EAAE,cAAc,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,cAAc,EAAE,WAAW,EACnI,qBAAqB,EAAE,mBAAmB,EAAE,4BAA4B,EAAE,+BAA+B,GAC1G,MAAM,oBAAoB,CAAC;A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Agent, ed25519Signer } from './agent.js';
|
|
12
12
|
export { CertenSigningDataError, checkIntentSigning, checkCosigning, checkGovernanceSigning, inspectSigningData, legsFromIntent, toBaseUnits, SIGNING_DATA_MISMATCH, SIGNING_DATA_ABSENT, SIGNING_VERIFIER_UNAVAILABLE, SIGNING_EXPECTATION_UNAVAILABLE, } from './signing-check.js';
|
|
13
|
+
export { agentEnrollmentState, agentAuthorityOperation, agentBookDisableOperation, isUnderAdi } from './agent-enrollment.js';
|
|
14
|
+
export { buildPrincipalEntry, canonicalJson, coreVerdict, PRINCIPAL_ENTRY_REFUSED_BY_CORE, entryHash, entryTag, envelopeDigestHex, issueGrant, issueMandate, registerAgent, taggedPreimage, writePrincipalEntry, ENTRY_TAGS, PRINCIPAL_ACCOUNTS, PRINCIPAL_ENTRY_MALFORMED, PRINCIPAL_ENTRY_NOT_PRINCIPALS, PRINCIPAL_PAGE_INVALID, PRINCIPAL_WRITE_UNSIGNED } from './principal-entries.js';
|
|
15
|
+
export { agentKeyRemoval, cancelByRejectVote, openRejectVote, replaceAgent, revocationOf, revokeAgentKey, revokeGrant, revokeSeatRecord, EXPOSURE_WINDOW_STATEMENT, INTERVENTION_MALFORMED, SEAT_RECORD_ROUTE, SEAT_RECORD_STATEMENT } from './principal-intervention.js';
|
|
13
16
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,cAAc,CAAC;AAE7B,mIAAmI;AACnI,4CAA4C;AAC5C,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEzE,sIAAsI;AACtI,qCAAqC;AACrC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGxD,OAAO,EACL,sBAAsB,EAAE,kBAAkB,EAAE,cAAc,EAAE,sBAAsB,E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