@arcforges/api-client 1.0.0-ci.33.1 → 1.0.0-ci.330.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.
Files changed (100) hide show
  1. package/NOTICE +56 -4
  2. package/README.md +9 -2
  3. package/build-identity.json +270 -0
  4. package/contracts.binpb +0 -0
  5. package/dist/gen/http.d.ts +31 -0
  6. package/dist/gen/http.js +34 -0
  7. package/dist/index.d.ts +10 -1
  8. package/dist/index.js +20 -2
  9. package/dist/shapes/gen/AndroidUpdate.d.ts +41 -0
  10. package/dist/shapes/gen/AndroidUpdate.js +620 -0
  11. package/dist/shapes/gen/BrowserAuthChallenge.d.ts +35 -0
  12. package/dist/shapes/gen/BrowserAuthChallenge.js +531 -0
  13. package/dist/shapes/gen/BrowserBeginAuthenticationRequest.d.ts +28 -0
  14. package/dist/shapes/gen/BrowserBeginAuthenticationRequest.js +384 -0
  15. package/dist/shapes/gen/BrowserBeginRecoveryRequest.d.ts +22 -0
  16. package/dist/shapes/gen/BrowserBeginRecoveryRequest.js +370 -0
  17. package/dist/shapes/gen/BrowserBeginStepUpRequest.d.ts +20 -0
  18. package/dist/shapes/gen/BrowserBeginStepUpRequest.js +279 -0
  19. package/dist/shapes/gen/BrowserBootstrapResponse.d.ts +37 -0
  20. package/dist/shapes/gen/BrowserBootstrapResponse.js +534 -0
  21. package/dist/shapes/gen/BrowserCompleteAuthenticationRequest.d.ts +45 -0
  22. package/dist/shapes/gen/BrowserCompleteAuthenticationRequest.js +564 -0
  23. package/dist/shapes/gen/BrowserCompleteEnrollmentRequest.d.ts +90 -0
  24. package/dist/shapes/gen/BrowserCompleteEnrollmentRequest.js +1145 -0
  25. package/dist/shapes/gen/BrowserCompleteRecoveryRequest.d.ts +22 -0
  26. package/dist/shapes/gen/BrowserCompleteRecoveryRequest.js +733 -0
  27. package/dist/shapes/gen/BrowserCompleteStepUpRequest.d.ts +20 -0
  28. package/dist/shapes/gen/BrowserCompleteStepUpRequest.js +564 -0
  29. package/dist/shapes/gen/BrowserOidcCallbackFailure.d.ts +20 -0
  30. package/dist/shapes/gen/BrowserOidcCallbackFailure.js +200 -0
  31. package/dist/shapes/gen/BrowserOidcCallbackSuccess.d.ts +19 -0
  32. package/dist/shapes/gen/BrowserOidcCallbackSuccess.js +185 -0
  33. package/dist/shapes/gen/BrowserReceipt.d.ts +20 -0
  34. package/dist/shapes/gen/BrowserReceipt.js +285 -0
  35. package/dist/shapes/gen/BrowserSessionRoutes.d.ts +17 -0
  36. package/dist/shapes/gen/BrowserSessionRoutes.js +13 -0
  37. package/dist/shapes/gen/BrowserSessionView.d.ts +25 -0
  38. package/dist/shapes/gen/BrowserSessionView.js +388 -0
  39. package/dist/shapes/gen/BrowserStepUpEvidence.d.ts +19 -0
  40. package/dist/shapes/gen/BrowserStepUpEvidence.js +266 -0
  41. package/dist/shapes/gen/CatalogIndex.d.ts +49 -0
  42. package/dist/shapes/gen/CatalogIndex.js +703 -0
  43. package/dist/shapes/gen/CatalogRevocations.d.ts +46 -0
  44. package/dist/shapes/gen/CatalogRevocations.js +647 -0
  45. package/dist/shapes/gen/DeclarativePanel.d.ts +154 -0
  46. package/dist/shapes/gen/DeclarativePanel.js +2988 -0
  47. package/dist/shapes/gen/ExtensionManifest.d.ts +278 -0
  48. package/dist/shapes/gen/ExtensionManifest.js +3974 -0
  49. package/dist/shapes/gen/ExtensionWorkflow.d.ts +151 -0
  50. package/dist/shapes/gen/ExtensionWorkflow.js +2251 -0
  51. package/dist/shapes/gen/NativeAuthRoutes.d.ts +17 -0
  52. package/dist/shapes/gen/NativeAuthRoutes.js +5 -0
  53. package/dist/shapes/gen/NativeAuthorizeCallbackFailure.d.ts +19 -0
  54. package/dist/shapes/gen/NativeAuthorizeCallbackFailure.js +185 -0
  55. package/dist/shapes/gen/NativeAuthorizeCallbackSuccess.d.ts +19 -0
  56. package/dist/shapes/gen/NativeAuthorizeCallbackSuccess.js +185 -0
  57. package/dist/shapes/gen/NativeAuthorizeRequest.d.ts +24 -0
  58. package/dist/shapes/gen/NativeAuthorizeRequest.js +271 -0
  59. package/dist/shapes/gen/NativeTokenRequest.d.ts +23 -0
  60. package/dist/shapes/gen/NativeTokenRequest.js +258 -0
  61. package/dist/shapes/gen/NativeTokenResponse.d.ts +40 -0
  62. package/dist/shapes/gen/NativeTokenResponse.js +572 -0
  63. package/dist/shapes/gen/PackageInventory.d.ts +24 -0
  64. package/dist/shapes/gen/PackageInventory.js +327 -0
  65. package/dist/shapes/gen/PartReceipt.d.ts +21 -0
  66. package/dist/shapes/gen/PartReceipt.js +290 -0
  67. package/dist/shapes/gen/PolicyBody.d.ts +269 -0
  68. package/dist/shapes/gen/PolicyBody.js +4188 -0
  69. package/dist/shapes/gen/RealmDescriptor.d.ts +39 -0
  70. package/dist/shapes/gen/RealmDescriptor.js +627 -0
  71. package/package.json +14 -6
  72. package/sbom.cdx.json +9 -9
  73. package/schemas/public/http/v1/browser.schema.json +1300 -0
  74. package/schemas/public/http/v1/inventory.schema.json +49 -0
  75. package/schemas/public/http/v1/manifest.schema.json +1459 -0
  76. package/schemas/public/http/v1/native-auth.schema.json +341 -0
  77. package/schemas/public/http/v1/panel.schema.json +963 -0
  78. package/schemas/public/http/v1/policy-body.schema.json +1376 -0
  79. package/schemas/public/http/v1/schema.json +30 -0
  80. package/schemas/public/http/v1/signed-formats.schema.json +748 -0
  81. package/schemas/public/http/v1/workflow.schema.json +715 -0
  82. package/schemas/public/proto/arcforges/catalog/v1/catalog.proto +204 -0
  83. package/schemas/public/proto/arcforges/events/v1/events.proto +343 -0
  84. package/schemas/public/proto/arcforges/foundation/v1/foundation.proto +384 -0
  85. package/schemas/public/proto/arcforges/hello/v1/hello.proto +23 -0
  86. package/schemas/public/proto/arcforges/publicapi/v1/application.proto +297 -0
  87. package/schemas/public/proto/arcforges/publicapi/v1/chat.proto +1507 -0
  88. package/schemas/public/proto/arcforges/publicapi/v1/commerce.proto +542 -0
  89. package/schemas/public/proto/arcforges/publicapi/v1/connector.proto +172 -0
  90. package/schemas/public/proto/arcforges/publicapi/v1/content.proto +813 -0
  91. package/schemas/public/proto/arcforges/publicapi/v1/descriptors.proto +27 -0
  92. package/schemas/public/proto/arcforges/publicapi/v1/export.proto +112 -0
  93. package/schemas/public/proto/arcforges/publicapi/v1/identity.proto +1350 -0
  94. package/schemas/public/proto/arcforges/publicapi/v1/inprocess-values.proto +134 -0
  95. package/schemas/public/proto/arcforges/publicapi/v1/scope.proto +81 -0
  96. package/schemas/public/proto/arcforges/publicapi/v1/support.proto +242 -0
  97. package/schemas/public/proto/arcforges/publicapi/v1/sync.proto +459 -0
  98. package/schemas/public/proto/arcforges/publicapi/v1/transfer.proto +190 -0
  99. package/schemas/public/proto/arcforges/simulation/v1/simulation.proto +457 -0
  100. package/source.json +50 -11
@@ -0,0 +1,388 @@
1
+ export function isBrowserSessionView(value) { return check0(value); }
2
+ /** The schema's declared UTF-8 document bound in bytes. */
3
+ export const browserSessionViewJsonMaxBytes = 16384;
4
+ /** Parses one strict BrowserSessionView document; refusal kinds match the C# codec. */
5
+ export function tryParseBrowserSessionViewJson(input) {
6
+ const parsed = strictJson(input, 16384);
7
+ if (!parsed.ok)
8
+ return parsed;
9
+ return isBrowserSessionView(parsed.value) ? { ok: true, value: parsed.value } : { ok: false, failure: "invalid" };
10
+ }
11
+ /** Parses one strict BrowserSessionView document or throws an error carrying the refusal kind. */
12
+ export function parseBrowserSessionViewJson(input) {
13
+ const result = tryParseBrowserSessionViewJson(input);
14
+ if (!result.ok)
15
+ throw Object.assign(new Error(`BrowserSessionView JSON refused: ${result.failure}.`), { failure: result.failure });
16
+ return result.value;
17
+ }
18
+ /** Writes compact UTF-8 in schema property order and refuses output the schema rejects. */
19
+ export function serializeBrowserSessionViewJson(value) {
20
+ const bytes = new TextEncoder().encode(JSON.stringify(orderBrowserSessionView(value)));
21
+ const result = tryParseBrowserSessionViewJson(bytes);
22
+ if (!result.ok)
23
+ throw Object.assign(new Error(`BrowserSessionView JSON refused: ${result.failure}.`), { failure: result.failure });
24
+ return bytes;
25
+ }
26
+ function orderBrowserSessionView(value) {
27
+ const out = {};
28
+ out["sessionId"] = value["sessionId"];
29
+ out["expiresAt"] = value["expiresAt"];
30
+ if (value["idleExpiresAt"] !== undefined)
31
+ out["idleExpiresAt"] = value["idleExpiresAt"];
32
+ out["userId"] = value["userId"];
33
+ out["deviceId"] = value["deviceId"];
34
+ out["workspaceIds"] = value["workspaceIds"];
35
+ out["recoveryGeneration"] = value["recoveryGeneration"];
36
+ out["purpose"] = value["purpose"];
37
+ return out;
38
+ }
39
+ function check0(value) {
40
+ if (typeof value !== 'object' || value === null || Array.isArray(value))
41
+ return false;
42
+ const object = value;
43
+ for (const key of Object.keys(object)) {
44
+ switch (key) {
45
+ case "sessionId":
46
+ if (!check1(object[key]))
47
+ return false;
48
+ break;
49
+ case "expiresAt":
50
+ if (!check2(object[key]))
51
+ return false;
52
+ break;
53
+ case "idleExpiresAt":
54
+ if (!check3(object[key]))
55
+ return false;
56
+ break;
57
+ case "userId":
58
+ if (!check4(object[key]))
59
+ return false;
60
+ break;
61
+ case "deviceId":
62
+ if (!check5(object[key]))
63
+ return false;
64
+ break;
65
+ case "workspaceIds":
66
+ if (!check6(object[key]))
67
+ return false;
68
+ break;
69
+ case "recoveryGeneration":
70
+ if (!check8(object[key]))
71
+ return false;
72
+ break;
73
+ case "purpose":
74
+ if (!check9(object[key]))
75
+ return false;
76
+ break;
77
+ default: return false;
78
+ }
79
+ }
80
+ if (!Object.prototype.hasOwnProperty.call(object, "sessionId"))
81
+ return false;
82
+ if (!Object.prototype.hasOwnProperty.call(object, "expiresAt"))
83
+ return false;
84
+ if (!Object.prototype.hasOwnProperty.call(object, "userId"))
85
+ return false;
86
+ if (!Object.prototype.hasOwnProperty.call(object, "deviceId"))
87
+ return false;
88
+ if (!Object.prototype.hasOwnProperty.call(object, "workspaceIds"))
89
+ return false;
90
+ if (!Object.prototype.hasOwnProperty.call(object, "recoveryGeneration"))
91
+ return false;
92
+ if (!Object.prototype.hasOwnProperty.call(object, "purpose"))
93
+ return false;
94
+ return true;
95
+ }
96
+ function check1(value) {
97
+ if (typeof value !== 'string' || !validText(value))
98
+ return false;
99
+ if ([...value].length < 36)
100
+ return false;
101
+ if ([...value].length > 36)
102
+ return false;
103
+ if ((new RegExp("^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$", 'u')).exec(value)?.[0] !== value)
104
+ return false;
105
+ if (value === '00000000-0000-0000-0000-000000000000')
106
+ return false;
107
+ return true;
108
+ }
109
+ function check2(value) {
110
+ if (typeof value !== 'string' || !validText(value))
111
+ return false;
112
+ if ([...value].length < 20)
113
+ return false;
114
+ if ([...value].length > 30)
115
+ return false;
116
+ if ((new RegExp("^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,9})?Z$", 'u')).exec(value)?.[0] !== value)
117
+ return false;
118
+ return true;
119
+ }
120
+ function check3(value) {
121
+ if (typeof value !== 'string' || !validText(value))
122
+ return false;
123
+ if ([...value].length < 20)
124
+ return false;
125
+ if ([...value].length > 30)
126
+ return false;
127
+ if ((new RegExp("^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,9})?Z$", 'u')).exec(value)?.[0] !== value)
128
+ return false;
129
+ return true;
130
+ }
131
+ function check4(value) {
132
+ if (typeof value !== 'string' || !validText(value))
133
+ return false;
134
+ if ([...value].length < 36)
135
+ return false;
136
+ if ([...value].length > 36)
137
+ return false;
138
+ if ((new RegExp("^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$", 'u')).exec(value)?.[0] !== value)
139
+ return false;
140
+ if (value === '00000000-0000-0000-0000-000000000000')
141
+ return false;
142
+ return true;
143
+ }
144
+ function check5(value) {
145
+ if (typeof value !== 'string' || !validText(value))
146
+ return false;
147
+ if ([...value].length < 36)
148
+ return false;
149
+ if ([...value].length > 36)
150
+ return false;
151
+ if ((new RegExp("^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$", 'u')).exec(value)?.[0] !== value)
152
+ return false;
153
+ if (value === '00000000-0000-0000-0000-000000000000')
154
+ return false;
155
+ return true;
156
+ }
157
+ function check6(value) {
158
+ if (!Array.isArray(value))
159
+ return false;
160
+ if (value.length > 100)
161
+ return false;
162
+ if (!value.every(item => check7(item)))
163
+ return false;
164
+ return true;
165
+ }
166
+ function check7(value) {
167
+ if (typeof value !== 'string' || !validText(value))
168
+ return false;
169
+ if ([...value].length < 36)
170
+ return false;
171
+ if ([...value].length > 36)
172
+ return false;
173
+ if ((new RegExp("^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$", 'u')).exec(value)?.[0] !== value)
174
+ return false;
175
+ if (value === '00000000-0000-0000-0000-000000000000')
176
+ return false;
177
+ return true;
178
+ }
179
+ function check8(value) {
180
+ if (typeof value !== 'string' || !validText(value))
181
+ return false;
182
+ if ([...value].length < 1)
183
+ return false;
184
+ if ([...value].length > 20)
185
+ return false;
186
+ if ((new RegExp("^(0|[1-9][0-9]*)$", 'u')).exec(value)?.[0] !== value)
187
+ return false;
188
+ if (BigInt(value) > 18446744073709551615n)
189
+ return false;
190
+ return true;
191
+ }
192
+ function check9(value) {
193
+ if (typeof value !== 'string' || !validText(value))
194
+ return false;
195
+ if (value !== "authenticate" && value !== "enroll" && value !== "stepUp" && value !== "recover" && value !== "cancelDeletion")
196
+ return false;
197
+ return true;
198
+ }
199
+ /** Strict UTF-8 JSON: no BOM, comments, trailing commas or duplicate properties; depth <= 32; integer lexemes only. */
200
+ function strictJson(input, maxBytes) {
201
+ let text;
202
+ if (typeof input === "string") {
203
+ if (!validText(input))
204
+ return { ok: false, failure: "malformed" };
205
+ if (new TextEncoder().encode(input).byteLength > maxBytes)
206
+ return { ok: false, failure: "tooLarge" };
207
+ text = input;
208
+ }
209
+ else {
210
+ if (input.byteLength > maxBytes)
211
+ return { ok: false, failure: "tooLarge" };
212
+ try {
213
+ text = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(input);
214
+ }
215
+ catch {
216
+ return { ok: false, failure: "malformed" };
217
+ }
218
+ }
219
+ try {
220
+ return { ok: true, value: new StrictJsonReader(text).document() };
221
+ }
222
+ catch {
223
+ return { ok: false, failure: "malformed" };
224
+ }
225
+ }
226
+ class StrictJsonReader {
227
+ text;
228
+ index = 0;
229
+ constructor(text) {
230
+ this.text = text;
231
+ }
232
+ document() {
233
+ this.space();
234
+ const value = this.value(0);
235
+ this.space();
236
+ if (this.index !== this.text.length)
237
+ throw new SyntaxError("Trailing JSON content");
238
+ return value;
239
+ }
240
+ value(depth) {
241
+ switch (this.text[this.index]) {
242
+ case "{": return this.object(depth + 1);
243
+ case "[": return this.array(depth + 1);
244
+ case '"': return this.string();
245
+ case "t": return this.literal("true", true);
246
+ case "f": return this.literal("false", false);
247
+ case "n": return this.literal("null", null);
248
+ default: return this.number();
249
+ }
250
+ }
251
+ object(depth) {
252
+ if (depth > 32)
253
+ throw new SyntaxError("JSON depth exceeded");
254
+ this.index++;
255
+ const out = {};
256
+ const keys = new Set();
257
+ this.space();
258
+ if (this.text[this.index] === "}") {
259
+ this.index++;
260
+ return out;
261
+ }
262
+ for (;;) {
263
+ this.space();
264
+ if (this.text[this.index] !== '"')
265
+ throw new SyntaxError("Expected property name");
266
+ const key = this.string();
267
+ if (keys.has(key))
268
+ throw new SyntaxError("Duplicate JSON property");
269
+ keys.add(key);
270
+ this.space();
271
+ if (this.text[this.index++] !== ":")
272
+ throw new SyntaxError("Expected colon");
273
+ this.space();
274
+ // defineProperty keeps names such as __proto__ as ordinary own properties.
275
+ Object.defineProperty(out, key, { value: this.value(depth), enumerable: true, writable: true, configurable: true });
276
+ this.space();
277
+ const next = this.text[this.index++];
278
+ if (next === "}")
279
+ return out;
280
+ if (next !== ",")
281
+ throw new SyntaxError("Expected comma");
282
+ }
283
+ }
284
+ array(depth) {
285
+ if (depth > 32)
286
+ throw new SyntaxError("JSON depth exceeded");
287
+ this.index++;
288
+ const out = [];
289
+ this.space();
290
+ if (this.text[this.index] === "]") {
291
+ this.index++;
292
+ return out;
293
+ }
294
+ for (;;) {
295
+ this.space();
296
+ out.push(this.value(depth));
297
+ this.space();
298
+ const next = this.text[this.index++];
299
+ if (next === "]")
300
+ return out;
301
+ if (next !== ",")
302
+ throw new SyntaxError("Expected comma");
303
+ }
304
+ }
305
+ string() {
306
+ this.index++;
307
+ let out = "";
308
+ for (;;) {
309
+ const c = this.text[this.index++];
310
+ if (c === undefined)
311
+ throw new SyntaxError("Unterminated string");
312
+ if (c === '"')
313
+ break;
314
+ if (c < " ")
315
+ throw new SyntaxError("Unescaped control character");
316
+ if (c !== "\\") {
317
+ out += c;
318
+ continue;
319
+ }
320
+ const e = this.text[this.index++];
321
+ const simple = { '"': '"', "\\": "\\", "/": "/", b: "\b", f: "\f", n: "\n", r: "\r", t: "\t" };
322
+ if (e !== undefined && e in simple) {
323
+ out += simple[e];
324
+ continue;
325
+ }
326
+ if (e !== "u" || !/^[0-9a-fA-F]{4}$/.test(this.text.slice(this.index, this.index + 4)))
327
+ throw new SyntaxError("Invalid escape");
328
+ out += String.fromCharCode(parseInt(this.text.slice(this.index, this.index + 4), 16));
329
+ this.index += 4;
330
+ }
331
+ if (!validText(out))
332
+ throw new SyntaxError("Lone surrogate escape");
333
+ return out;
334
+ }
335
+ number() {
336
+ const match = /-?(?:0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?/y;
337
+ match.lastIndex = this.index;
338
+ const found = match.exec(this.text);
339
+ if (found === null)
340
+ throw new SyntaxError("Invalid JSON value");
341
+ this.index = match.lastIndex;
342
+ // Selected schemas have no fractional numbers; fraction/exponent lexemes never satisfy an integer.
343
+ return found[1] !== undefined || found[2] !== undefined ? Number.NaN : Number(found[0]);
344
+ }
345
+ literal(word, value) {
346
+ if (this.text.slice(this.index, this.index + word.length) !== word)
347
+ throw new SyntaxError("Invalid JSON literal");
348
+ this.index += word.length;
349
+ return value;
350
+ }
351
+ space() {
352
+ while (this.text[this.index] === " " || this.text[this.index] === "\t" || this.text[this.index] === "\n" || this.text[this.index] === "\r")
353
+ this.index++;
354
+ }
355
+ }
356
+ function validText(value) {
357
+ for (const scalar of value) {
358
+ const point = scalar.codePointAt(0);
359
+ if (point >= 0xd800 && point <= 0xdfff)
360
+ return false;
361
+ }
362
+ return true;
363
+ }
364
+ function inventoryRules(value) {
365
+ const files = value.files;
366
+ const seen = new Set();
367
+ let previous;
368
+ let total = 0n;
369
+ for (const file of files) {
370
+ const path = file.path;
371
+ const folded = path.toUpperCase();
372
+ if (path.length === 0 || folded === 'INVENTORY.JSON' || folded === 'SIGNATURE.JSON' || seen.has(folded) || (previous !== undefined && previous >= path))
373
+ return false;
374
+ for (const segment of path.split('/')) {
375
+ if (!/^[A-Za-z0-9_.-]+$/.test(segment) || segment === '.' || segment === '..' || segment.endsWith('.') || /^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(?:\.|$)/i.test(segment))
376
+ return false;
377
+ }
378
+ const size = BigInt(file.size);
379
+ if (size > 134217728n)
380
+ return false;
381
+ total += size;
382
+ if (total > 1073741824n)
383
+ return false;
384
+ seen.add(folded);
385
+ previous = path;
386
+ }
387
+ return files.some(file => file.path === 'manifest.json');
388
+ }
@@ -0,0 +1,19 @@
1
+ export interface BrowserStepUpEvidence {
2
+ operationClass: string;
3
+ expiresAt: string;
4
+ }
5
+ export declare function isBrowserStepUpEvidence(value: unknown): value is BrowserStepUpEvidence;
6
+ /** The schema's declared UTF-8 document bound in bytes. */
7
+ export declare const browserStepUpEvidenceJsonMaxBytes = 4096;
8
+ /** Parses one strict BrowserStepUpEvidence document; refusal kinds match the C# codec. */
9
+ export declare function tryParseBrowserStepUpEvidenceJson(input: Uint8Array | string): {
10
+ ok: true;
11
+ value: BrowserStepUpEvidence;
12
+ } | {
13
+ ok: false;
14
+ failure: "tooLarge" | "malformed" | "invalid";
15
+ };
16
+ /** Parses one strict BrowserStepUpEvidence document or throws an error carrying the refusal kind. */
17
+ export declare function parseBrowserStepUpEvidenceJson(input: Uint8Array | string): BrowserStepUpEvidence;
18
+ /** Writes compact UTF-8 in schema property order and refuses output the schema rejects. */
19
+ export declare function serializeBrowserStepUpEvidenceJson(value: BrowserStepUpEvidence): Uint8Array;
@@ -0,0 +1,266 @@
1
+ export function isBrowserStepUpEvidence(value) { return check0(value); }
2
+ /** The schema's declared UTF-8 document bound in bytes. */
3
+ export const browserStepUpEvidenceJsonMaxBytes = 4096;
4
+ /** Parses one strict BrowserStepUpEvidence document; refusal kinds match the C# codec. */
5
+ export function tryParseBrowserStepUpEvidenceJson(input) {
6
+ const parsed = strictJson(input, 4096);
7
+ if (!parsed.ok)
8
+ return parsed;
9
+ return isBrowserStepUpEvidence(parsed.value) ? { ok: true, value: parsed.value } : { ok: false, failure: "invalid" };
10
+ }
11
+ /** Parses one strict BrowserStepUpEvidence document or throws an error carrying the refusal kind. */
12
+ export function parseBrowserStepUpEvidenceJson(input) {
13
+ const result = tryParseBrowserStepUpEvidenceJson(input);
14
+ if (!result.ok)
15
+ throw Object.assign(new Error(`BrowserStepUpEvidence JSON refused: ${result.failure}.`), { failure: result.failure });
16
+ return result.value;
17
+ }
18
+ /** Writes compact UTF-8 in schema property order and refuses output the schema rejects. */
19
+ export function serializeBrowserStepUpEvidenceJson(value) {
20
+ const bytes = new TextEncoder().encode(JSON.stringify(orderBrowserStepUpEvidence(value)));
21
+ const result = tryParseBrowserStepUpEvidenceJson(bytes);
22
+ if (!result.ok)
23
+ throw Object.assign(new Error(`BrowserStepUpEvidence JSON refused: ${result.failure}.`), { failure: result.failure });
24
+ return bytes;
25
+ }
26
+ function orderBrowserStepUpEvidence(value) {
27
+ const out = {};
28
+ out["operationClass"] = value["operationClass"];
29
+ out["expiresAt"] = value["expiresAt"];
30
+ return out;
31
+ }
32
+ function check0(value) {
33
+ if (typeof value !== 'object' || value === null || Array.isArray(value))
34
+ return false;
35
+ const object = value;
36
+ for (const key of Object.keys(object)) {
37
+ switch (key) {
38
+ case "operationClass":
39
+ if (!check1(object[key]))
40
+ return false;
41
+ break;
42
+ case "expiresAt":
43
+ if (!check2(object[key]))
44
+ return false;
45
+ break;
46
+ default: return false;
47
+ }
48
+ }
49
+ if (!Object.prototype.hasOwnProperty.call(object, "operationClass"))
50
+ return false;
51
+ if (!Object.prototype.hasOwnProperty.call(object, "expiresAt"))
52
+ return false;
53
+ return true;
54
+ }
55
+ function check1(value) {
56
+ if (typeof value !== 'string' || !validText(value))
57
+ return false;
58
+ if ([...value].length < 1)
59
+ return false;
60
+ if ([...value].length > 128)
61
+ return false;
62
+ if ((new RegExp("^[A-Za-z0-9._:/-]{1,128}$", 'u')).exec(value)?.[0] !== value)
63
+ return false;
64
+ return true;
65
+ }
66
+ function check2(value) {
67
+ if (typeof value !== 'string' || !validText(value))
68
+ return false;
69
+ if ([...value].length < 20)
70
+ return false;
71
+ if ([...value].length > 30)
72
+ return false;
73
+ if ((new RegExp("^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,9})?Z$", 'u')).exec(value)?.[0] !== value)
74
+ return false;
75
+ return true;
76
+ }
77
+ /** Strict UTF-8 JSON: no BOM, comments, trailing commas or duplicate properties; depth <= 32; integer lexemes only. */
78
+ function strictJson(input, maxBytes) {
79
+ let text;
80
+ if (typeof input === "string") {
81
+ if (!validText(input))
82
+ return { ok: false, failure: "malformed" };
83
+ if (new TextEncoder().encode(input).byteLength > maxBytes)
84
+ return { ok: false, failure: "tooLarge" };
85
+ text = input;
86
+ }
87
+ else {
88
+ if (input.byteLength > maxBytes)
89
+ return { ok: false, failure: "tooLarge" };
90
+ try {
91
+ text = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(input);
92
+ }
93
+ catch {
94
+ return { ok: false, failure: "malformed" };
95
+ }
96
+ }
97
+ try {
98
+ return { ok: true, value: new StrictJsonReader(text).document() };
99
+ }
100
+ catch {
101
+ return { ok: false, failure: "malformed" };
102
+ }
103
+ }
104
+ class StrictJsonReader {
105
+ text;
106
+ index = 0;
107
+ constructor(text) {
108
+ this.text = text;
109
+ }
110
+ document() {
111
+ this.space();
112
+ const value = this.value(0);
113
+ this.space();
114
+ if (this.index !== this.text.length)
115
+ throw new SyntaxError("Trailing JSON content");
116
+ return value;
117
+ }
118
+ value(depth) {
119
+ switch (this.text[this.index]) {
120
+ case "{": return this.object(depth + 1);
121
+ case "[": return this.array(depth + 1);
122
+ case '"': return this.string();
123
+ case "t": return this.literal("true", true);
124
+ case "f": return this.literal("false", false);
125
+ case "n": return this.literal("null", null);
126
+ default: return this.number();
127
+ }
128
+ }
129
+ object(depth) {
130
+ if (depth > 32)
131
+ throw new SyntaxError("JSON depth exceeded");
132
+ this.index++;
133
+ const out = {};
134
+ const keys = new Set();
135
+ this.space();
136
+ if (this.text[this.index] === "}") {
137
+ this.index++;
138
+ return out;
139
+ }
140
+ for (;;) {
141
+ this.space();
142
+ if (this.text[this.index] !== '"')
143
+ throw new SyntaxError("Expected property name");
144
+ const key = this.string();
145
+ if (keys.has(key))
146
+ throw new SyntaxError("Duplicate JSON property");
147
+ keys.add(key);
148
+ this.space();
149
+ if (this.text[this.index++] !== ":")
150
+ throw new SyntaxError("Expected colon");
151
+ this.space();
152
+ // defineProperty keeps names such as __proto__ as ordinary own properties.
153
+ Object.defineProperty(out, key, { value: this.value(depth), enumerable: true, writable: true, configurable: true });
154
+ this.space();
155
+ const next = this.text[this.index++];
156
+ if (next === "}")
157
+ return out;
158
+ if (next !== ",")
159
+ throw new SyntaxError("Expected comma");
160
+ }
161
+ }
162
+ array(depth) {
163
+ if (depth > 32)
164
+ throw new SyntaxError("JSON depth exceeded");
165
+ this.index++;
166
+ const out = [];
167
+ this.space();
168
+ if (this.text[this.index] === "]") {
169
+ this.index++;
170
+ return out;
171
+ }
172
+ for (;;) {
173
+ this.space();
174
+ out.push(this.value(depth));
175
+ this.space();
176
+ const next = this.text[this.index++];
177
+ if (next === "]")
178
+ return out;
179
+ if (next !== ",")
180
+ throw new SyntaxError("Expected comma");
181
+ }
182
+ }
183
+ string() {
184
+ this.index++;
185
+ let out = "";
186
+ for (;;) {
187
+ const c = this.text[this.index++];
188
+ if (c === undefined)
189
+ throw new SyntaxError("Unterminated string");
190
+ if (c === '"')
191
+ break;
192
+ if (c < " ")
193
+ throw new SyntaxError("Unescaped control character");
194
+ if (c !== "\\") {
195
+ out += c;
196
+ continue;
197
+ }
198
+ const e = this.text[this.index++];
199
+ const simple = { '"': '"', "\\": "\\", "/": "/", b: "\b", f: "\f", n: "\n", r: "\r", t: "\t" };
200
+ if (e !== undefined && e in simple) {
201
+ out += simple[e];
202
+ continue;
203
+ }
204
+ if (e !== "u" || !/^[0-9a-fA-F]{4}$/.test(this.text.slice(this.index, this.index + 4)))
205
+ throw new SyntaxError("Invalid escape");
206
+ out += String.fromCharCode(parseInt(this.text.slice(this.index, this.index + 4), 16));
207
+ this.index += 4;
208
+ }
209
+ if (!validText(out))
210
+ throw new SyntaxError("Lone surrogate escape");
211
+ return out;
212
+ }
213
+ number() {
214
+ const match = /-?(?:0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?/y;
215
+ match.lastIndex = this.index;
216
+ const found = match.exec(this.text);
217
+ if (found === null)
218
+ throw new SyntaxError("Invalid JSON value");
219
+ this.index = match.lastIndex;
220
+ // Selected schemas have no fractional numbers; fraction/exponent lexemes never satisfy an integer.
221
+ return found[1] !== undefined || found[2] !== undefined ? Number.NaN : Number(found[0]);
222
+ }
223
+ literal(word, value) {
224
+ if (this.text.slice(this.index, this.index + word.length) !== word)
225
+ throw new SyntaxError("Invalid JSON literal");
226
+ this.index += word.length;
227
+ return value;
228
+ }
229
+ space() {
230
+ while (this.text[this.index] === " " || this.text[this.index] === "\t" || this.text[this.index] === "\n" || this.text[this.index] === "\r")
231
+ this.index++;
232
+ }
233
+ }
234
+ function validText(value) {
235
+ for (const scalar of value) {
236
+ const point = scalar.codePointAt(0);
237
+ if (point >= 0xd800 && point <= 0xdfff)
238
+ return false;
239
+ }
240
+ return true;
241
+ }
242
+ function inventoryRules(value) {
243
+ const files = value.files;
244
+ const seen = new Set();
245
+ let previous;
246
+ let total = 0n;
247
+ for (const file of files) {
248
+ const path = file.path;
249
+ const folded = path.toUpperCase();
250
+ if (path.length === 0 || folded === 'INVENTORY.JSON' || folded === 'SIGNATURE.JSON' || seen.has(folded) || (previous !== undefined && previous >= path))
251
+ return false;
252
+ for (const segment of path.split('/')) {
253
+ if (!/^[A-Za-z0-9_.-]+$/.test(segment) || segment === '.' || segment === '..' || segment.endsWith('.') || /^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(?:\.|$)/i.test(segment))
254
+ return false;
255
+ }
256
+ const size = BigInt(file.size);
257
+ if (size > 134217728n)
258
+ return false;
259
+ total += size;
260
+ if (total > 1073741824n)
261
+ return false;
262
+ seen.add(folded);
263
+ previous = path;
264
+ }
265
+ return files.some(file => file.path === 'manifest.json');
266
+ }