@arcforges/api-client 1.0.0-ci.284.1 → 1.0.0-ci.287.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 (53) hide show
  1. package/NOTICE +5 -5
  2. package/build-identity.json +37 -17
  3. package/contracts.binpb +0 -0
  4. package/dist/gen/http.d.ts +21 -0
  5. package/dist/gen/http.js +21 -0
  6. package/dist/shapes/gen/BrowserAuthChallenge.d.ts +35 -0
  7. package/dist/shapes/gen/BrowserAuthChallenge.js +531 -0
  8. package/dist/shapes/gen/BrowserBeginAuthenticationRequest.d.ts +28 -0
  9. package/dist/shapes/gen/BrowserBeginAuthenticationRequest.js +384 -0
  10. package/dist/shapes/gen/BrowserBeginRecoveryRequest.d.ts +22 -0
  11. package/dist/shapes/gen/BrowserBeginRecoveryRequest.js +370 -0
  12. package/dist/shapes/gen/BrowserBeginStepUpRequest.d.ts +20 -0
  13. package/dist/shapes/gen/BrowserBeginStepUpRequest.js +279 -0
  14. package/dist/shapes/gen/BrowserBootstrapResponse.d.ts +37 -0
  15. package/dist/shapes/gen/BrowserBootstrapResponse.js +534 -0
  16. package/dist/shapes/gen/BrowserCompleteAuthenticationRequest.d.ts +45 -0
  17. package/dist/shapes/gen/BrowserCompleteAuthenticationRequest.js +564 -0
  18. package/dist/shapes/gen/BrowserCompleteEnrollmentRequest.d.ts +90 -0
  19. package/dist/shapes/gen/BrowserCompleteEnrollmentRequest.js +1145 -0
  20. package/dist/shapes/gen/BrowserCompleteRecoveryRequest.d.ts +22 -0
  21. package/dist/shapes/gen/BrowserCompleteRecoveryRequest.js +733 -0
  22. package/dist/shapes/gen/BrowserCompleteStepUpRequest.d.ts +20 -0
  23. package/dist/shapes/gen/BrowserCompleteStepUpRequest.js +564 -0
  24. package/dist/shapes/gen/BrowserOidcCallbackFailure.d.ts +20 -0
  25. package/dist/shapes/gen/BrowserOidcCallbackFailure.js +200 -0
  26. package/dist/shapes/gen/BrowserOidcCallbackSuccess.d.ts +19 -0
  27. package/dist/shapes/gen/BrowserOidcCallbackSuccess.js +185 -0
  28. package/dist/shapes/gen/BrowserReceipt.d.ts +20 -0
  29. package/dist/shapes/gen/BrowserReceipt.js +285 -0
  30. package/dist/shapes/gen/BrowserSessionRoutes.d.ts +17 -0
  31. package/dist/shapes/gen/BrowserSessionRoutes.js +13 -0
  32. package/dist/shapes/gen/BrowserSessionView.d.ts +25 -0
  33. package/dist/shapes/gen/BrowserSessionView.js +388 -0
  34. package/dist/shapes/gen/BrowserStepUpEvidence.d.ts +19 -0
  35. package/dist/shapes/gen/BrowserStepUpEvidence.js +266 -0
  36. package/dist/shapes/gen/NativeAuthRoutes.d.ts +17 -0
  37. package/dist/shapes/gen/NativeAuthRoutes.js +5 -0
  38. package/dist/shapes/gen/NativeAuthorizeCallbackFailure.d.ts +19 -0
  39. package/dist/shapes/gen/NativeAuthorizeCallbackFailure.js +185 -0
  40. package/dist/shapes/gen/NativeAuthorizeCallbackSuccess.d.ts +19 -0
  41. package/dist/shapes/gen/NativeAuthorizeCallbackSuccess.js +185 -0
  42. package/dist/shapes/gen/NativeAuthorizeRequest.d.ts +24 -0
  43. package/dist/shapes/gen/NativeAuthorizeRequest.js +271 -0
  44. package/dist/shapes/gen/NativeTokenRequest.d.ts +23 -0
  45. package/dist/shapes/gen/NativeTokenRequest.js +258 -0
  46. package/dist/shapes/gen/NativeTokenResponse.d.ts +40 -0
  47. package/dist/shapes/gen/NativeTokenResponse.js +572 -0
  48. package/package.json +2 -2
  49. package/sbom.cdx.json +9 -9
  50. package/schemas/public/http/v1/browser.schema.json +1300 -0
  51. package/schemas/public/http/v1/native-auth.schema.json +341 -0
  52. package/schemas/public/proto/arcforges/publicapi/v1/identity.proto +1350 -0
  53. package/source.json +6 -3
@@ -0,0 +1,285 @@
1
+ export function isBrowserReceipt(value) { return check0(value); }
2
+ /** The schema's declared UTF-8 document bound in bytes. */
3
+ export const browserReceiptJsonMaxBytes = 4096;
4
+ /** Parses one strict BrowserReceipt document; refusal kinds match the C# codec. */
5
+ export function tryParseBrowserReceiptJson(input) {
6
+ const parsed = strictJson(input, 4096);
7
+ if (!parsed.ok)
8
+ return parsed;
9
+ return isBrowserReceipt(parsed.value) ? { ok: true, value: parsed.value } : { ok: false, failure: "invalid" };
10
+ }
11
+ /** Parses one strict BrowserReceipt document or throws an error carrying the refusal kind. */
12
+ export function parseBrowserReceiptJson(input) {
13
+ const result = tryParseBrowserReceiptJson(input);
14
+ if (!result.ok)
15
+ throw Object.assign(new Error(`BrowserReceipt 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 serializeBrowserReceiptJson(value) {
20
+ const bytes = new TextEncoder().encode(JSON.stringify(orderBrowserReceipt(value)));
21
+ const result = tryParseBrowserReceiptJson(bytes);
22
+ if (!result.ok)
23
+ throw Object.assign(new Error(`BrowserReceipt JSON refused: ${result.failure}.`), { failure: result.failure });
24
+ return bytes;
25
+ }
26
+ function orderBrowserReceipt(value) {
27
+ const out = {};
28
+ out["commandId"] = value["commandId"];
29
+ if (value["resultRevision"] !== undefined)
30
+ out["resultRevision"] = value["resultRevision"];
31
+ out["effect"] = value["effect"];
32
+ return out;
33
+ }
34
+ function check0(value) {
35
+ if (typeof value !== 'object' || value === null || Array.isArray(value))
36
+ return false;
37
+ const object = value;
38
+ for (const key of Object.keys(object)) {
39
+ switch (key) {
40
+ case "commandId":
41
+ if (!check1(object[key]))
42
+ return false;
43
+ break;
44
+ case "resultRevision":
45
+ if (!check2(object[key]))
46
+ return false;
47
+ break;
48
+ case "effect":
49
+ if (!check3(object[key]))
50
+ return false;
51
+ break;
52
+ default: return false;
53
+ }
54
+ }
55
+ if (!Object.prototype.hasOwnProperty.call(object, "commandId"))
56
+ return false;
57
+ if (!Object.prototype.hasOwnProperty.call(object, "effect"))
58
+ return false;
59
+ return true;
60
+ }
61
+ function check1(value) {
62
+ if (typeof value !== 'string' || !validText(value))
63
+ return false;
64
+ if ([...value].length < 36)
65
+ return false;
66
+ if ([...value].length > 36)
67
+ return false;
68
+ 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)
69
+ return false;
70
+ if (value === '00000000-0000-0000-0000-000000000000')
71
+ return false;
72
+ return true;
73
+ }
74
+ function check2(value) {
75
+ if (typeof value !== 'string' || !validText(value))
76
+ return false;
77
+ if ([...value].length < 1)
78
+ return false;
79
+ if ([...value].length > 19)
80
+ return false;
81
+ if ((new RegExp("^[1-9][0-9]*$", 'u')).exec(value)?.[0] !== value)
82
+ return false;
83
+ if (BigInt(value) < -9223372036854775808n || BigInt(value) > 9223372036854775807n)
84
+ return false;
85
+ if (BigInt(value) <= 0n)
86
+ return false;
87
+ return true;
88
+ }
89
+ function check3(value) {
90
+ if (typeof value !== 'string' || !validText(value))
91
+ return false;
92
+ if (value !== "didNotHappen" && value !== "happened" && value !== "unknown")
93
+ return false;
94
+ return true;
95
+ }
96
+ /** Strict UTF-8 JSON: no BOM, comments, trailing commas or duplicate properties; depth <= 32; integer lexemes only. */
97
+ function strictJson(input, maxBytes) {
98
+ let text;
99
+ if (typeof input === "string") {
100
+ if (!validText(input))
101
+ return { ok: false, failure: "malformed" };
102
+ if (new TextEncoder().encode(input).byteLength > maxBytes)
103
+ return { ok: false, failure: "tooLarge" };
104
+ text = input;
105
+ }
106
+ else {
107
+ if (input.byteLength > maxBytes)
108
+ return { ok: false, failure: "tooLarge" };
109
+ try {
110
+ text = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(input);
111
+ }
112
+ catch {
113
+ return { ok: false, failure: "malformed" };
114
+ }
115
+ }
116
+ try {
117
+ return { ok: true, value: new StrictJsonReader(text).document() };
118
+ }
119
+ catch {
120
+ return { ok: false, failure: "malformed" };
121
+ }
122
+ }
123
+ class StrictJsonReader {
124
+ text;
125
+ index = 0;
126
+ constructor(text) {
127
+ this.text = text;
128
+ }
129
+ document() {
130
+ this.space();
131
+ const value = this.value(0);
132
+ this.space();
133
+ if (this.index !== this.text.length)
134
+ throw new SyntaxError("Trailing JSON content");
135
+ return value;
136
+ }
137
+ value(depth) {
138
+ switch (this.text[this.index]) {
139
+ case "{": return this.object(depth + 1);
140
+ case "[": return this.array(depth + 1);
141
+ case '"': return this.string();
142
+ case "t": return this.literal("true", true);
143
+ case "f": return this.literal("false", false);
144
+ case "n": return this.literal("null", null);
145
+ default: return this.number();
146
+ }
147
+ }
148
+ object(depth) {
149
+ if (depth > 32)
150
+ throw new SyntaxError("JSON depth exceeded");
151
+ this.index++;
152
+ const out = {};
153
+ const keys = new Set();
154
+ this.space();
155
+ if (this.text[this.index] === "}") {
156
+ this.index++;
157
+ return out;
158
+ }
159
+ for (;;) {
160
+ this.space();
161
+ if (this.text[this.index] !== '"')
162
+ throw new SyntaxError("Expected property name");
163
+ const key = this.string();
164
+ if (keys.has(key))
165
+ throw new SyntaxError("Duplicate JSON property");
166
+ keys.add(key);
167
+ this.space();
168
+ if (this.text[this.index++] !== ":")
169
+ throw new SyntaxError("Expected colon");
170
+ this.space();
171
+ // defineProperty keeps names such as __proto__ as ordinary own properties.
172
+ Object.defineProperty(out, key, { value: this.value(depth), enumerable: true, writable: true, configurable: true });
173
+ this.space();
174
+ const next = this.text[this.index++];
175
+ if (next === "}")
176
+ return out;
177
+ if (next !== ",")
178
+ throw new SyntaxError("Expected comma");
179
+ }
180
+ }
181
+ array(depth) {
182
+ if (depth > 32)
183
+ throw new SyntaxError("JSON depth exceeded");
184
+ this.index++;
185
+ const out = [];
186
+ this.space();
187
+ if (this.text[this.index] === "]") {
188
+ this.index++;
189
+ return out;
190
+ }
191
+ for (;;) {
192
+ this.space();
193
+ out.push(this.value(depth));
194
+ this.space();
195
+ const next = this.text[this.index++];
196
+ if (next === "]")
197
+ return out;
198
+ if (next !== ",")
199
+ throw new SyntaxError("Expected comma");
200
+ }
201
+ }
202
+ string() {
203
+ this.index++;
204
+ let out = "";
205
+ for (;;) {
206
+ const c = this.text[this.index++];
207
+ if (c === undefined)
208
+ throw new SyntaxError("Unterminated string");
209
+ if (c === '"')
210
+ break;
211
+ if (c < " ")
212
+ throw new SyntaxError("Unescaped control character");
213
+ if (c !== "\\") {
214
+ out += c;
215
+ continue;
216
+ }
217
+ const e = this.text[this.index++];
218
+ const simple = { '"': '"', "\\": "\\", "/": "/", b: "\b", f: "\f", n: "\n", r: "\r", t: "\t" };
219
+ if (e !== undefined && e in simple) {
220
+ out += simple[e];
221
+ continue;
222
+ }
223
+ if (e !== "u" || !/^[0-9a-fA-F]{4}$/.test(this.text.slice(this.index, this.index + 4)))
224
+ throw new SyntaxError("Invalid escape");
225
+ out += String.fromCharCode(parseInt(this.text.slice(this.index, this.index + 4), 16));
226
+ this.index += 4;
227
+ }
228
+ if (!validText(out))
229
+ throw new SyntaxError("Lone surrogate escape");
230
+ return out;
231
+ }
232
+ number() {
233
+ const match = /-?(?:0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?/y;
234
+ match.lastIndex = this.index;
235
+ const found = match.exec(this.text);
236
+ if (found === null)
237
+ throw new SyntaxError("Invalid JSON value");
238
+ this.index = match.lastIndex;
239
+ // Selected schemas have no fractional numbers; fraction/exponent lexemes never satisfy an integer.
240
+ return found[1] !== undefined || found[2] !== undefined ? Number.NaN : Number(found[0]);
241
+ }
242
+ literal(word, value) {
243
+ if (this.text.slice(this.index, this.index + word.length) !== word)
244
+ throw new SyntaxError("Invalid JSON literal");
245
+ this.index += word.length;
246
+ return value;
247
+ }
248
+ space() {
249
+ while (this.text[this.index] === " " || this.text[this.index] === "\t" || this.text[this.index] === "\n" || this.text[this.index] === "\r")
250
+ this.index++;
251
+ }
252
+ }
253
+ function validText(value) {
254
+ for (const scalar of value) {
255
+ const point = scalar.codePointAt(0);
256
+ if (point >= 0xd800 && point <= 0xdfff)
257
+ return false;
258
+ }
259
+ return true;
260
+ }
261
+ function inventoryRules(value) {
262
+ const files = value.files;
263
+ const seen = new Set();
264
+ let previous;
265
+ let total = 0n;
266
+ for (const file of files) {
267
+ const path = file.path;
268
+ const folded = path.toUpperCase();
269
+ if (path.length === 0 || folded === 'INVENTORY.JSON' || folded === 'SIGNATURE.JSON' || seen.has(folded) || (previous !== undefined && previous >= path))
270
+ return false;
271
+ for (const segment of path.split('/')) {
272
+ if (!/^[A-Za-z0-9_.-]+$/.test(segment) || segment === '.' || segment === '..' || segment.endsWith('.') || /^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(?:\.|$)/i.test(segment))
273
+ return false;
274
+ }
275
+ const size = BigInt(file.size);
276
+ if (size > 134217728n)
277
+ return false;
278
+ total += size;
279
+ if (total > 1073741824n)
280
+ return false;
281
+ seen.add(folded);
282
+ previous = path;
283
+ }
284
+ return files.some(file => file.path === 'manifest.json');
285
+ }
@@ -0,0 +1,17 @@
1
+ /** One closed BrowserSession HTTP exception route. */
2
+ export interface BrowserSessionRoute {
3
+ readonly id: string;
4
+ readonly method: "GET" | "POST";
5
+ readonly path: string;
6
+ readonly credential: string;
7
+ readonly origin: string;
8
+ readonly csrf: string;
9
+ readonly setCookie: string;
10
+ readonly cache: string;
11
+ readonly requestWire: "none" | "json" | "form-urlencoded";
12
+ readonly requestRoots: readonly string[];
13
+ readonly responseWire: "none" | "json" | "form-urlencoded";
14
+ readonly responseRoots: readonly string[];
15
+ }
16
+ /** Closed routes of the BrowserSession bundle in schema order. */
17
+ export declare const browserSessionRoutes: readonly BrowserSessionRoute[];
@@ -0,0 +1,13 @@
1
+ /** Closed routes of the BrowserSession bundle in schema order. */
2
+ export const browserSessionRoutes = Object.freeze([
3
+ Object.freeze({ id: "browser.bootstrap", method: "GET", path: "/session/v1/bootstrap", credential: "anonymous-or-session-cookie", origin: "exact-configured", csrf: "issues-token", setCookie: "none", cache: "no-store", requestWire: "none", requestRoots: Object.freeze([]), responseWire: "json", responseRoots: Object.freeze(["BrowserBootstrapResponse"]) }),
4
+ Object.freeze({ id: "browser.beginAuthentication", method: "POST", path: "/session/v1/authentication/begin", credential: "preauth-flow", origin: "exact-configured", csrf: "required", setCookie: "none", cache: "no-store", requestWire: "json", requestRoots: Object.freeze(["BrowserBeginAuthenticationRequest"]), responseWire: "json", responseRoots: Object.freeze(["BrowserAuthChallenge"]) }),
5
+ Object.freeze({ id: "browser.completeAuthentication", method: "POST", path: "/session/v1/authentication/complete", credential: "preauth-flow", origin: "exact-configured", csrf: "required", setCookie: "session", cache: "no-store", requestWire: "json", requestRoots: Object.freeze(["BrowserCompleteAuthenticationRequest"]), responseWire: "json", responseRoots: Object.freeze(["BrowserSessionView"]) }),
6
+ Object.freeze({ id: "browser.completeEnrollment", method: "POST", path: "/session/v1/enrollment/complete", credential: "preauth-flow", origin: "exact-configured", csrf: "required", setCookie: "session", cache: "no-store", requestWire: "json", requestRoots: Object.freeze(["BrowserCompleteEnrollmentRequest"]), responseWire: "json", responseRoots: Object.freeze(["BrowserSessionView"]) }),
7
+ Object.freeze({ id: "browser.beginRecovery", method: "POST", path: "/session/v1/recovery/begin", credential: "preauth-flow", origin: "exact-configured", csrf: "required", setCookie: "none", cache: "no-store", requestWire: "json", requestRoots: Object.freeze(["BrowserBeginRecoveryRequest"]), responseWire: "json", responseRoots: Object.freeze(["BrowserAuthChallenge"]) }),
8
+ Object.freeze({ id: "browser.completeRecovery", method: "POST", path: "/session/v1/recovery/complete", credential: "preauth-flow", origin: "exact-configured", csrf: "required", setCookie: "none", cache: "no-store", requestWire: "json", requestRoots: Object.freeze(["BrowserCompleteRecoveryRequest"]), responseWire: "json", responseRoots: Object.freeze(["BrowserReceipt"]) }),
9
+ Object.freeze({ id: "browser.beginStepUp", method: "POST", path: "/session/v1/step-up/begin", credential: "session-cookie", origin: "exact-configured", csrf: "required", setCookie: "none", cache: "no-store", requestWire: "json", requestRoots: Object.freeze(["BrowserBeginStepUpRequest"]), responseWire: "json", responseRoots: Object.freeze(["BrowserAuthChallenge"]) }),
10
+ Object.freeze({ id: "browser.completeStepUp", method: "POST", path: "/session/v1/step-up/complete", credential: "session-cookie", origin: "exact-configured", csrf: "required", setCookie: "none", cache: "no-store", requestWire: "json", requestRoots: Object.freeze(["BrowserCompleteStepUpRequest"]), responseWire: "json", responseRoots: Object.freeze(["BrowserStepUpEvidence"]) }),
11
+ Object.freeze({ id: "browser.logout", method: "POST", path: "/session/v1/logout", credential: "session-cookie", origin: "exact-configured", csrf: "required", setCookie: "clear", cache: "no-store", requestWire: "none", requestRoots: Object.freeze([]), responseWire: "json", responseRoots: Object.freeze(["BrowserReceipt"]) }),
12
+ Object.freeze({ id: "browser.oidcCallback", method: "GET", path: "/session/v1/providers/{providerId}/callback", credential: "flow-cookie", origin: "none", csrf: "none", setCookie: "none", cache: "no-store", requestWire: "form-urlencoded", requestRoots: Object.freeze(["BrowserOidcCallbackSuccess", "BrowserOidcCallbackFailure"]), responseWire: "none", responseRoots: Object.freeze([]) }),
13
+ ]);
@@ -0,0 +1,25 @@
1
+ export interface BrowserSessionView {
2
+ sessionId: string;
3
+ expiresAt: string;
4
+ idleExpiresAt?: string;
5
+ userId: string;
6
+ deviceId: string;
7
+ workspaceIds: string[];
8
+ recoveryGeneration: string;
9
+ purpose: string;
10
+ }
11
+ export declare function isBrowserSessionView(value: unknown): value is BrowserSessionView;
12
+ /** The schema's declared UTF-8 document bound in bytes. */
13
+ export declare const browserSessionViewJsonMaxBytes = 16384;
14
+ /** Parses one strict BrowserSessionView document; refusal kinds match the C# codec. */
15
+ export declare function tryParseBrowserSessionViewJson(input: Uint8Array | string): {
16
+ ok: true;
17
+ value: BrowserSessionView;
18
+ } | {
19
+ ok: false;
20
+ failure: "tooLarge" | "malformed" | "invalid";
21
+ };
22
+ /** Parses one strict BrowserSessionView document or throws an error carrying the refusal kind. */
23
+ export declare function parseBrowserSessionViewJson(input: Uint8Array | string): BrowserSessionView;
24
+ /** Writes compact UTF-8 in schema property order and refuses output the schema rejects. */
25
+ export declare function serializeBrowserSessionViewJson(value: BrowserSessionView): Uint8Array;