@olyzon/sdk 0.0.0-stage → 0.1.0-stg.2

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 (92) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +18 -2
  3. package/dist/client.d.ts +62 -0
  4. package/dist/client.js +104 -0
  5. package/dist/core/config.d.ts +153 -0
  6. package/dist/core/config.js +368 -0
  7. package/dist/core/contracts.d.ts +52 -0
  8. package/dist/core/contracts.js +12 -0
  9. package/dist/core/dpop.d.ts +39 -0
  10. package/dist/core/dpop.js +63 -0
  11. package/dist/core/errors.d.ts +34 -0
  12. package/dist/core/errors.js +43 -0
  13. package/dist/core/session.d.ts +82 -0
  14. package/dist/core/session.js +170 -0
  15. package/dist/core/transport.d.ts +38 -0
  16. package/dist/core/transport.js +84 -0
  17. package/dist/generated/index.d.ts +24 -0
  18. package/dist/generated/index.js +20 -0
  19. package/dist/generated/manifest.json +13 -0
  20. package/dist/generated/projects/client/client.gen.d.ts +2 -0
  21. package/dist/generated/projects/client/client.gen.js +216 -0
  22. package/dist/generated/projects/client/index.d.ts +10 -0
  23. package/dist/generated/projects/client/index.js +6 -0
  24. package/dist/generated/projects/client/types.gen.d.ts +120 -0
  25. package/dist/generated/projects/client/types.gen.js +2 -0
  26. package/dist/generated/projects/client/utils.gen.d.ts +37 -0
  27. package/dist/generated/projects/client/utils.gen.js +228 -0
  28. package/dist/generated/projects/client.gen.d.ts +12 -0
  29. package/dist/generated/projects/client.gen.js +3 -0
  30. package/dist/generated/projects/core/auth.gen.d.ts +25 -0
  31. package/dist/generated/projects/core/auth.gen.js +14 -0
  32. package/dist/generated/projects/core/bodySerializer.gen.d.ts +25 -0
  33. package/dist/generated/projects/core/bodySerializer.gen.js +57 -0
  34. package/dist/generated/projects/core/params.gen.d.ts +43 -0
  35. package/dist/generated/projects/core/params.gen.js +109 -0
  36. package/dist/generated/projects/core/pathSerializer.gen.d.ts +33 -0
  37. package/dist/generated/projects/core/pathSerializer.gen.js +106 -0
  38. package/dist/generated/projects/core/queryKeySerializer.gen.d.ts +18 -0
  39. package/dist/generated/projects/core/queryKeySerializer.gen.js +92 -0
  40. package/dist/generated/projects/core/serverSentEvents.gen.d.ts +71 -0
  41. package/dist/generated/projects/core/serverSentEvents.gen.js +132 -0
  42. package/dist/generated/projects/core/types.gen.d.ts +83 -0
  43. package/dist/generated/projects/core/types.gen.js +2 -0
  44. package/dist/generated/projects/core/utils.gen.d.ts +19 -0
  45. package/dist/generated/projects/core/utils.gen.js +87 -0
  46. package/dist/generated/projects/index.d.ts +2 -0
  47. package/dist/generated/projects/index.js +2 -0
  48. package/dist/generated/projects/sdk.gen.d.ts +47 -0
  49. package/dist/generated/projects/sdk.gen.js +55 -0
  50. package/dist/generated/projects/types.gen.d.ts +388 -0
  51. package/dist/generated/projects/types.gen.js +2 -0
  52. package/dist/generated/projects.d.ts +54 -0
  53. package/dist/generated/projects.js +58 -0
  54. package/dist/generated/specs/projects.json +872 -0
  55. package/dist/generated/specs/sts.json +942 -0
  56. package/dist/generated/sts/client/client.gen.d.ts +2 -0
  57. package/dist/generated/sts/client/client.gen.js +216 -0
  58. package/dist/generated/sts/client/index.d.ts +10 -0
  59. package/dist/generated/sts/client/index.js +6 -0
  60. package/dist/generated/sts/client/types.gen.d.ts +120 -0
  61. package/dist/generated/sts/client/types.gen.js +2 -0
  62. package/dist/generated/sts/client/utils.gen.d.ts +37 -0
  63. package/dist/generated/sts/client/utils.gen.js +228 -0
  64. package/dist/generated/sts/client.gen.d.ts +12 -0
  65. package/dist/generated/sts/client.gen.js +3 -0
  66. package/dist/generated/sts/core/auth.gen.d.ts +25 -0
  67. package/dist/generated/sts/core/auth.gen.js +14 -0
  68. package/dist/generated/sts/core/bodySerializer.gen.d.ts +25 -0
  69. package/dist/generated/sts/core/bodySerializer.gen.js +57 -0
  70. package/dist/generated/sts/core/params.gen.d.ts +43 -0
  71. package/dist/generated/sts/core/params.gen.js +109 -0
  72. package/dist/generated/sts/core/pathSerializer.gen.d.ts +33 -0
  73. package/dist/generated/sts/core/pathSerializer.gen.js +106 -0
  74. package/dist/generated/sts/core/queryKeySerializer.gen.d.ts +18 -0
  75. package/dist/generated/sts/core/queryKeySerializer.gen.js +92 -0
  76. package/dist/generated/sts/core/serverSentEvents.gen.d.ts +71 -0
  77. package/dist/generated/sts/core/serverSentEvents.gen.js +132 -0
  78. package/dist/generated/sts/core/types.gen.d.ts +83 -0
  79. package/dist/generated/sts/core/types.gen.js +2 -0
  80. package/dist/generated/sts/core/utils.gen.d.ts +19 -0
  81. package/dist/generated/sts/core/utils.gen.js +87 -0
  82. package/dist/generated/sts/index.d.ts +2 -0
  83. package/dist/generated/sts/index.js +2 -0
  84. package/dist/generated/sts/sdk.gen.d.ts +41 -0
  85. package/dist/generated/sts/sdk.gen.js +44 -0
  86. package/dist/generated/sts/types.gen.d.ts +445 -0
  87. package/dist/generated/sts/types.gen.js +2 -0
  88. package/dist/generated/sts.d.ts +44 -0
  89. package/dist/generated/sts.js +49 -0
  90. package/dist/index.d.ts +14 -0
  91. package/dist/index.js +13 -0
  92. package/package.json +43 -3
@@ -0,0 +1,942 @@
1
+ {
2
+ "openapi": "3.1.0",
3
+ "info": {
4
+ "title": "Olyzon STS",
5
+ "description": "The Olyzon security token service.",
6
+ "version": "d7e44df9023f"
7
+ },
8
+ "tags": [],
9
+ "paths": {
10
+ "/oauth/token": {
11
+ "post": {
12
+ "operationId": "exchangeToken",
13
+ "description": "Exchanges a Clerk credential for a session (RFC 8693), bound to the key of\nthe request's DPoP proof (`DPoP` header, RFC 9449, with the server's nonce\nand a signed body: added by the SDKs below the generated client). A\nperson's membership and role are read from Clerk at every exchange, and the\nworkspace must be served in this STS's region. A grant's actor exchanges\nthe grant, with its own session as `actor_token`, for a 5-minute session of\nthe grant's subject, for one service of its audience (spec §6.3).",
14
+ "parameters": [],
15
+ "responses": {
16
+ "200": {
17
+ "description": "The session issued.",
18
+ "headers": {
19
+ "DPoP-Nonce": {
20
+ "required": true,
21
+ "description": "The current DPoP nonce, for the next request's proof.",
22
+ "schema": {
23
+ "type": "string"
24
+ }
25
+ },
26
+ "Cache-Control": {
27
+ "required": true,
28
+ "schema": {
29
+ "type": "string",
30
+ "enum": [
31
+ "no-store"
32
+ ]
33
+ }
34
+ }
35
+ },
36
+ "content": {
37
+ "application/json": {
38
+ "schema": {
39
+ "$ref": "#/components/schemas/TokenResponse"
40
+ }
41
+ }
42
+ }
43
+ },
44
+ "400": {
45
+ "description": "The request does not match the operation's input: every invalid field is named.",
46
+ "headers": {
47
+ "DPoP-Nonce": {
48
+ "required": true,
49
+ "description": "The nonce to put in the retry's proof.",
50
+ "schema": {
51
+ "type": "string"
52
+ }
53
+ }
54
+ },
55
+ "content": {
56
+ "application/json": {
57
+ "schema": {
58
+ "anyOf": [
59
+ {
60
+ "$ref": "#/components/schemas/InvalidRequest"
61
+ },
62
+ {
63
+ "$ref": "#/components/schemas/TokenRefused"
64
+ },
65
+ {
66
+ "$ref": "#/components/schemas/UseDpopNonce"
67
+ },
68
+ {
69
+ "$ref": "#/components/schemas/InvalidTarget"
70
+ }
71
+ ]
72
+ }
73
+ }
74
+ }
75
+ },
76
+ "413": {
77
+ "description": "The body is over 64 KB.",
78
+ "content": {
79
+ "application/json": {
80
+ "schema": {
81
+ "$ref": "#/components/schemas/BodyTooLarge"
82
+ }
83
+ }
84
+ }
85
+ },
86
+ "500": {
87
+ "description": "Unexpected failure: logged by the service, answered without details.",
88
+ "content": {
89
+ "application/json": {
90
+ "schema": {
91
+ "$ref": "#/components/schemas/ServerError"
92
+ }
93
+ }
94
+ }
95
+ },
96
+ "503": {
97
+ "description": "Clerk cannot be reached: retry later.",
98
+ "content": {
99
+ "application/json": {
100
+ "schema": {
101
+ "$ref": "#/components/schemas/TemporarilyUnavailable"
102
+ }
103
+ }
104
+ }
105
+ }
106
+ },
107
+ "requestBody": {
108
+ "required": true,
109
+ "content": {
110
+ "application/x-www-form-urlencoded": {
111
+ "schema": {
112
+ "$ref": "#/components/schemas/TokenExchangeForm"
113
+ }
114
+ }
115
+ }
116
+ },
117
+ "security": [
118
+ {}
119
+ ]
120
+ }
121
+ },
122
+ "/v1/caller-identity": {
123
+ "get": {
124
+ "operationId": "getCallerIdentity",
125
+ "description": "The caller's own session: what `olyzon sts get-caller-identity` shows. Its\nname and email are left out. Every session may read itself.",
126
+ "parameters": [],
127
+ "responses": {
128
+ "200": {
129
+ "description": "The request has succeeded.",
130
+ "content": {
131
+ "application/json": {
132
+ "schema": {
133
+ "$ref": "#/components/schemas/CallerIdentity"
134
+ }
135
+ }
136
+ }
137
+ },
138
+ "401": {
139
+ "description": "Missing, invalid or expired session, or a proof that does not match this request.",
140
+ "headers": {
141
+ "WWW-Authenticate": {
142
+ "required": true,
143
+ "description": "`DPoP error=\"…\", algs=\"ES256\", error_description=\"…\"` (RFC 9449 §7.1).",
144
+ "schema": {
145
+ "type": "string"
146
+ }
147
+ }
148
+ },
149
+ "content": {
150
+ "application/json": {
151
+ "schema": {
152
+ "$ref": "#/components/schemas/Unauthorized"
153
+ }
154
+ }
155
+ }
156
+ },
157
+ "403": {
158
+ "description": "The session may not perform this action (Cedar).",
159
+ "content": {
160
+ "application/json": {
161
+ "schema": {
162
+ "$ref": "#/components/schemas/Forbidden"
163
+ }
164
+ }
165
+ }
166
+ },
167
+ "404": {
168
+ "description": "No such resource or route, or a resource the session's org cannot see.",
169
+ "content": {
170
+ "application/json": {
171
+ "schema": {
172
+ "$ref": "#/components/schemas/NotFound"
173
+ }
174
+ }
175
+ }
176
+ },
177
+ "500": {
178
+ "description": "Unexpected failure: logged by the service, answered without details.",
179
+ "content": {
180
+ "application/json": {
181
+ "schema": {
182
+ "$ref": "#/components/schemas/ServerError"
183
+ }
184
+ }
185
+ }
186
+ }
187
+ }
188
+ }
189
+ },
190
+ "/v1/grants": {
191
+ "post": {
192
+ "operationId": "createGrant",
193
+ "description": "Creates a grant from the caller to the service calling for them: only a registered service does,\nwith its caller's forwarded credentials (spec §6.1). The caller is the subject, the service (or\nthe agent it runs) the actor. A direct call is refused.",
194
+ "parameters": [],
195
+ "responses": {
196
+ "201": {
197
+ "description": "The request has succeeded and a new resource has been created as a result.",
198
+ "content": {
199
+ "application/json": {
200
+ "schema": {
201
+ "$ref": "#/components/schemas/Grant"
202
+ }
203
+ }
204
+ }
205
+ },
206
+ "400": {
207
+ "description": "The request does not match the operation's input: every invalid field is named.",
208
+ "content": {
209
+ "application/json": {
210
+ "schema": {
211
+ "$ref": "#/components/schemas/InvalidRequest"
212
+ }
213
+ }
214
+ }
215
+ },
216
+ "401": {
217
+ "description": "Missing, invalid or expired session, or a proof that does not match this request.",
218
+ "headers": {
219
+ "WWW-Authenticate": {
220
+ "required": true,
221
+ "description": "`DPoP error=\"…\", algs=\"ES256\", error_description=\"…\"` (RFC 9449 §7.1).",
222
+ "schema": {
223
+ "type": "string"
224
+ }
225
+ }
226
+ },
227
+ "content": {
228
+ "application/json": {
229
+ "schema": {
230
+ "$ref": "#/components/schemas/Unauthorized"
231
+ }
232
+ }
233
+ }
234
+ },
235
+ "403": {
236
+ "description": "The session may not perform this action (Cedar).",
237
+ "content": {
238
+ "application/json": {
239
+ "schema": {
240
+ "$ref": "#/components/schemas/Forbidden"
241
+ }
242
+ }
243
+ }
244
+ },
245
+ "404": {
246
+ "description": "No such resource or route, or a resource the session's org cannot see.",
247
+ "content": {
248
+ "application/json": {
249
+ "schema": {
250
+ "$ref": "#/components/schemas/NotFound"
251
+ }
252
+ }
253
+ }
254
+ },
255
+ "500": {
256
+ "description": "Unexpected failure: logged by the service, answered without details.",
257
+ "content": {
258
+ "application/json": {
259
+ "schema": {
260
+ "$ref": "#/components/schemas/ServerError"
261
+ }
262
+ }
263
+ }
264
+ }
265
+ },
266
+ "requestBody": {
267
+ "required": true,
268
+ "content": {
269
+ "application/json": {
270
+ "schema": {
271
+ "$ref": "#/components/schemas/NewGrant"
272
+ }
273
+ }
274
+ }
275
+ },
276
+ "x-olyzon-caller": "service"
277
+ }
278
+ },
279
+ "/v1/grants/{id}": {
280
+ "delete": {
281
+ "operationId": "revokeGrant",
282
+ "description": "Revokes a grant: its next exchange fails. Its subject may, directly or through any service, and\nso may its actor for anyone it acts for. Revoking a revoked grant changes nothing.",
283
+ "parameters": [
284
+ {
285
+ "name": "id",
286
+ "in": "path",
287
+ "required": true,
288
+ "schema": {
289
+ "$ref": "#/components/schemas/GrantId"
290
+ }
291
+ }
292
+ ],
293
+ "responses": {
294
+ "200": {
295
+ "description": "The request has succeeded.",
296
+ "content": {
297
+ "application/json": {
298
+ "schema": {
299
+ "$ref": "#/components/schemas/Grant"
300
+ }
301
+ }
302
+ }
303
+ },
304
+ "401": {
305
+ "description": "Missing, invalid or expired session, or a proof that does not match this request.",
306
+ "headers": {
307
+ "WWW-Authenticate": {
308
+ "required": true,
309
+ "description": "`DPoP error=\"…\", algs=\"ES256\", error_description=\"…\"` (RFC 9449 §7.1).",
310
+ "schema": {
311
+ "type": "string"
312
+ }
313
+ }
314
+ },
315
+ "content": {
316
+ "application/json": {
317
+ "schema": {
318
+ "$ref": "#/components/schemas/Unauthorized"
319
+ }
320
+ }
321
+ }
322
+ },
323
+ "403": {
324
+ "description": "The session may not perform this action (Cedar).",
325
+ "content": {
326
+ "application/json": {
327
+ "schema": {
328
+ "$ref": "#/components/schemas/Forbidden"
329
+ }
330
+ }
331
+ }
332
+ },
333
+ "404": {
334
+ "description": "No such resource or route, or a resource the session's org cannot see.",
335
+ "content": {
336
+ "application/json": {
337
+ "schema": {
338
+ "$ref": "#/components/schemas/NotFound"
339
+ }
340
+ }
341
+ }
342
+ },
343
+ "500": {
344
+ "description": "Unexpected failure: logged by the service, answered without details.",
345
+ "content": {
346
+ "application/json": {
347
+ "schema": {
348
+ "$ref": "#/components/schemas/ServerError"
349
+ }
350
+ }
351
+ }
352
+ }
353
+ }
354
+ }
355
+ }
356
+ },
357
+ "security": [
358
+ {
359
+ "DPoPAuth": []
360
+ }
361
+ ],
362
+ "components": {
363
+ "schemas": {
364
+ "BodyTooLarge": {
365
+ "type": "object",
366
+ "required": [
367
+ "error",
368
+ "error_description"
369
+ ],
370
+ "properties": {
371
+ "error": {
372
+ "type": "string",
373
+ "enum": [
374
+ "invalid_request"
375
+ ],
376
+ "description": "Machine-readable error code."
377
+ },
378
+ "error_description": {
379
+ "type": "string",
380
+ "description": "What went wrong, for people. Never contains internal details."
381
+ }
382
+ },
383
+ "description": "The body is over 64 KB."
384
+ },
385
+ "CallerIdentity": {
386
+ "type": "object",
387
+ "required": [
388
+ "sub",
389
+ "kind",
390
+ "org",
391
+ "org_name",
392
+ "role",
393
+ "azp",
394
+ "cred",
395
+ "sid",
396
+ "exp"
397
+ ],
398
+ "properties": {
399
+ "sub": {
400
+ "type": "string",
401
+ "description": "Clerk's ID of the person, the org API key or the machine.",
402
+ "examples": [
403
+ "user_2wJxA1bC3dE4fG5hI6jK7lM8nO"
404
+ ]
405
+ },
406
+ "kind": {
407
+ "type": "string",
408
+ "enum": [
409
+ "user",
410
+ "org",
411
+ "service"
412
+ ],
413
+ "description": "A person, an org (its API key) or a machine."
414
+ },
415
+ "org": {
416
+ "type": "string",
417
+ "description": "The workspace (Clerk org) the session acts in.",
418
+ "examples": [
419
+ "org_2wJx8Qm4vLkT9pZr3HcN6yBdE1s"
420
+ ]
421
+ },
422
+ "org_name": {
423
+ "type": "string",
424
+ "examples": [
425
+ "Acme"
426
+ ]
427
+ },
428
+ "role": {
429
+ "type": "string",
430
+ "description": "The person's role in the org, read at exchange, or the role named for a key or machine.",
431
+ "examples": [
432
+ "org:admin"
433
+ ]
434
+ },
435
+ "azp": {
436
+ "type": "string",
437
+ "description": "The client: `web`, `desktop`, `mobile`, an API key's ID, a machine's ID.",
438
+ "examples": [
439
+ "web"
440
+ ]
441
+ },
442
+ "cred": {
443
+ "type": "string",
444
+ "enum": [
445
+ "session",
446
+ "oauth",
447
+ "api_key",
448
+ "m2m",
449
+ "grant"
450
+ ],
451
+ "description": "The credential the session was exchanged for: a Clerk credential, or a grant."
452
+ },
453
+ "kn": {
454
+ "type": "string",
455
+ "description": "An API key's or machine's name, an OAuth client's ID."
456
+ },
457
+ "sid": {
458
+ "type": "string",
459
+ "description": "The session's ID.",
460
+ "examples": [
461
+ "sid_q3Vt0bRk7XwLm2NcY9pHfA"
462
+ ]
463
+ },
464
+ "exp": {
465
+ "type": "integer",
466
+ "format": "int64",
467
+ "description": "When the session expires, in seconds since the epoch.",
468
+ "examples": [
469
+ 1795856400
470
+ ]
471
+ }
472
+ },
473
+ "description": "The caller's session, as the STS issued it: who, in which workspace, until when."
474
+ },
475
+ "Forbidden": {
476
+ "type": "object",
477
+ "required": [
478
+ "error",
479
+ "error_description"
480
+ ],
481
+ "properties": {
482
+ "error": {
483
+ "type": "string",
484
+ "enum": [
485
+ "forbidden"
486
+ ],
487
+ "description": "Machine-readable error code."
488
+ },
489
+ "error_description": {
490
+ "type": "string",
491
+ "description": "What went wrong, for people. Never contains internal details."
492
+ }
493
+ },
494
+ "description": "The session may not perform this action (Cedar)."
495
+ },
496
+ "Grant": {
497
+ "type": "object",
498
+ "required": [
499
+ "id",
500
+ "org",
501
+ "subject",
502
+ "actor",
503
+ "actions",
504
+ "audience",
505
+ "expiresAt",
506
+ "createdAt"
507
+ ],
508
+ "properties": {
509
+ "id": {
510
+ "$ref": "#/components/schemas/GrantId",
511
+ "description": "`grt_` and a UUID. Not a credential on its own: only its actor can exchange it."
512
+ },
513
+ "org": {
514
+ "type": "string",
515
+ "description": "The workspace (Clerk org) it acts in: its subject's.",
516
+ "examples": [
517
+ "org_2wJx8Qm4vLkT9pZr3HcN6yBdE1s"
518
+ ]
519
+ },
520
+ "subject": {
521
+ "type": "string",
522
+ "description": "The person who gave it: the caller of the request that created it.",
523
+ "examples": [
524
+ "user_2wJxA1bC3dE4fG5hI6jK7lM8nO"
525
+ ]
526
+ },
527
+ "actor": {
528
+ "type": "string",
529
+ "description": "The service or agent allowed to exchange it, by registry name: the service that created it, or\nan agent that service runs.",
530
+ "examples": [
531
+ "reports"
532
+ ]
533
+ },
534
+ "actorRunBy": {
535
+ "type": "string",
536
+ "description": "When its actor is an agent: the service that runs it, which creates and revokes its grants."
537
+ },
538
+ "actions": {
539
+ "type": "array",
540
+ "items": {
541
+ "type": "string"
542
+ },
543
+ "description": "The Cedar actions its sessions may perform, qualified: `Olyzon::Reports::Action::\"refresh\"`.\nEach service still decides with its own policies; a grant only narrows them.",
544
+ "examples": [
545
+ [
546
+ "Olyzon::Reports::Action::\"refresh\""
547
+ ]
548
+ ]
549
+ },
550
+ "audience": {
551
+ "type": "array",
552
+ "items": {
553
+ "type": "string"
554
+ },
555
+ "description": "The services its sessions may call, by registry name: one exchange per service.",
556
+ "examples": [
557
+ [
558
+ "reports"
559
+ ]
560
+ ]
561
+ },
562
+ "bindJkt": {
563
+ "type": "string",
564
+ "description": "Set when only one key of its actor may exchange it: that key's JWK SHA-256 thumbprint (RFC 7638).",
565
+ "examples": [
566
+ "NzbLsXh8uDCcd-6MNwXF4W_7noWXFZAfHkxZsRGC9Xs"
567
+ ]
568
+ },
569
+ "expiresAt": {
570
+ "type": "string",
571
+ "format": "date-time",
572
+ "description": "At most 31 days after its creation.",
573
+ "examples": [
574
+ "2026-12-05T09:00:00Z"
575
+ ]
576
+ },
577
+ "revokedAt": {
578
+ "type": "string",
579
+ "format": "date-time",
580
+ "description": "Set once revoked: its next exchange fails."
581
+ },
582
+ "createdAt": {
583
+ "type": "string",
584
+ "format": "date-time",
585
+ "examples": [
586
+ "2026-11-28T09:00:00Z"
587
+ ]
588
+ }
589
+ },
590
+ "description": "A delegation from a person to a registered service (spec §6.2)."
591
+ },
592
+ "GrantId": {
593
+ "type": "string",
594
+ "description": "A grant's ID: `grt_` and a UUID.",
595
+ "examples": [
596
+ "grt_7f3c9a52-1d8e-4b6f-9c0a-3e5b2d4f6a18"
597
+ ]
598
+ },
599
+ "InvalidRequest": {
600
+ "type": "object",
601
+ "required": [
602
+ "error",
603
+ "error_description"
604
+ ],
605
+ "properties": {
606
+ "error": {
607
+ "type": "string",
608
+ "enum": [
609
+ "invalid_request"
610
+ ],
611
+ "description": "Machine-readable error code."
612
+ },
613
+ "error_description": {
614
+ "type": "string",
615
+ "description": "What went wrong, for people. Never contains internal details."
616
+ }
617
+ },
618
+ "description": "The request does not match the operation's input: every invalid field is named."
619
+ },
620
+ "InvalidTarget": {
621
+ "type": "object",
622
+ "required": [
623
+ "error",
624
+ "error_description"
625
+ ],
626
+ "properties": {
627
+ "error": {
628
+ "type": "string",
629
+ "enum": [
630
+ "invalid_target"
631
+ ],
632
+ "description": "Machine-readable error code."
633
+ },
634
+ "error_description": {
635
+ "type": "string",
636
+ "description": "What went wrong, for people. Never contains internal details."
637
+ },
638
+ "region": {
639
+ "type": "string",
640
+ "description": "The region whose STS serves the workspace; absent while it is provisioning."
641
+ }
642
+ },
643
+ "description": "The workspace is not served by this STS: another region's, or still provisioning."
644
+ },
645
+ "NewGrant": {
646
+ "type": "object",
647
+ "required": [
648
+ "actions",
649
+ "audience",
650
+ "expiresAt"
651
+ ],
652
+ "properties": {
653
+ "actor": {
654
+ "type": "string",
655
+ "minLength": 1,
656
+ "description": "An agent the calling service runs, by registry name: it exchanges the grant instead."
657
+ },
658
+ "actions": {
659
+ "type": "array",
660
+ "items": {
661
+ "type": "string"
662
+ },
663
+ "minItems": 1,
664
+ "maxItems": 20,
665
+ "examples": [
666
+ [
667
+ "Olyzon::Reports::Action::\"refresh\""
668
+ ]
669
+ ]
670
+ },
671
+ "audience": {
672
+ "type": "array",
673
+ "items": {
674
+ "type": "string"
675
+ },
676
+ "minItems": 1,
677
+ "maxItems": 10,
678
+ "examples": [
679
+ [
680
+ "reports"
681
+ ]
682
+ ]
683
+ },
684
+ "expiresAt": {
685
+ "type": "string",
686
+ "format": "date-time"
687
+ },
688
+ "bindJkt": {
689
+ "type": "string",
690
+ "pattern": "^[A-Za-z0-9_-]{43}$",
691
+ "description": "Only the actor's key with this JWK SHA-256 thumbprint (RFC 7638) may exchange it.",
692
+ "examples": [
693
+ "NzbLsXh8uDCcd-6MNwXF4W_7noWXFZAfHkxZsRGC9Xs"
694
+ ]
695
+ }
696
+ },
697
+ "description": "A grant to create. Its subject and org come from the forwarded credentials; its actor is the\ncalling service unless it names an agent it runs."
698
+ },
699
+ "NotFound": {
700
+ "type": "object",
701
+ "required": [
702
+ "error",
703
+ "error_description"
704
+ ],
705
+ "properties": {
706
+ "error": {
707
+ "type": "string",
708
+ "enum": [
709
+ "not_found"
710
+ ],
711
+ "description": "Machine-readable error code."
712
+ },
713
+ "error_description": {
714
+ "type": "string",
715
+ "description": "What went wrong, for people. Never contains internal details."
716
+ }
717
+ },
718
+ "description": "No such resource or route, or a resource the session's org cannot see."
719
+ },
720
+ "ServerError": {
721
+ "type": "object",
722
+ "required": [
723
+ "error",
724
+ "error_description"
725
+ ],
726
+ "properties": {
727
+ "error": {
728
+ "type": "string",
729
+ "enum": [
730
+ "server_error"
731
+ ],
732
+ "description": "Machine-readable error code."
733
+ },
734
+ "error_description": {
735
+ "type": "string",
736
+ "description": "What went wrong, for people. Never contains internal details."
737
+ }
738
+ },
739
+ "description": "Unexpected failure: logged by the service, answered without details."
740
+ },
741
+ "TemporarilyUnavailable": {
742
+ "type": "object",
743
+ "required": [
744
+ "error",
745
+ "error_description"
746
+ ],
747
+ "properties": {
748
+ "error": {
749
+ "type": "string",
750
+ "enum": [
751
+ "temporarily_unavailable"
752
+ ],
753
+ "description": "Machine-readable error code."
754
+ },
755
+ "error_description": {
756
+ "type": "string",
757
+ "description": "What went wrong, for people. Never contains internal details."
758
+ }
759
+ },
760
+ "description": "Clerk cannot be reached: retry later."
761
+ },
762
+ "TokenExchangeForm": {
763
+ "type": "object",
764
+ "required": [
765
+ "grant_type",
766
+ "subject_token",
767
+ "subject_token_type"
768
+ ],
769
+ "properties": {
770
+ "grant_type": {
771
+ "type": "string",
772
+ "description": "`urn:ietf:params:oauth:grant-type:token-exchange`, the only grant supported.",
773
+ "examples": [
774
+ "urn:ietf:params:oauth:grant-type:token-exchange"
775
+ ]
776
+ },
777
+ "subject_token": {
778
+ "type": "string",
779
+ "minLength": 1,
780
+ "description": "The Clerk credential (a session token, an API key, an M2M token `mt_…` or an OAuth access\ntoken), or a grant's ID."
781
+ },
782
+ "subject_token_type": {
783
+ "type": "string",
784
+ "description": "`urn:olyzon:token-type:clerk` for every Clerk credential, `urn:olyzon:token-type:grant` for a grant.",
785
+ "examples": [
786
+ "urn:olyzon:token-type:clerk"
787
+ ]
788
+ },
789
+ "actor_token": {
790
+ "type": "string",
791
+ "minLength": 1,
792
+ "description": "A grant only: its actor's own session, bound to the proof's key (spec §6.3)."
793
+ },
794
+ "actor_token_type": {
795
+ "type": "string",
796
+ "description": "A grant only: `urn:ietf:params:oauth:token-type:access_token`.",
797
+ "examples": [
798
+ "urn:ietf:params:oauth:token-type:access_token"
799
+ ]
800
+ },
801
+ "audience": {
802
+ "type": "string",
803
+ "minLength": 1,
804
+ "description": "A grant only: the one service the session is for, by registry name (RFC 8693 §2.1).",
805
+ "examples": [
806
+ "reports"
807
+ ]
808
+ },
809
+ "requested_token_type": {
810
+ "type": "string",
811
+ "description": "`urn:ietf:params:oauth:token-type:access_token` if given: the session is the only token issued.",
812
+ "examples": [
813
+ "urn:ietf:params:oauth:token-type:access_token"
814
+ ]
815
+ },
816
+ "org_id": {
817
+ "type": "string",
818
+ "minLength": 1,
819
+ "description": "The workspace (Clerk org) to act in: required, except with an org API key (its own org).",
820
+ "examples": [
821
+ "org_2wJx8Qm4vLkT9pZr3HcN6yBdE1s"
822
+ ]
823
+ },
824
+ "role": {
825
+ "type": "string",
826
+ "minLength": 1,
827
+ "description": "The role of an org API key's or an M2M token's session: 1–64 letters, digits or `: . _ -`."
828
+ }
829
+ },
830
+ "description": "A token exchange request (RFC 8693 §2.1): any other parameter is refused."
831
+ },
832
+ "TokenRefused": {
833
+ "type": "object",
834
+ "required": [
835
+ "error",
836
+ "error_description"
837
+ ],
838
+ "properties": {
839
+ "error": {
840
+ "type": "string",
841
+ "enum": [
842
+ "invalid_grant",
843
+ "unsupported_grant_type",
844
+ "unsupported_token_type",
845
+ "invalid_dpop_proof"
846
+ ],
847
+ "description": "Machine-readable error code."
848
+ },
849
+ "error_description": {
850
+ "type": "string",
851
+ "description": "What went wrong, for people. Never contains internal details."
852
+ }
853
+ },
854
+ "description": "A refused exchange: a credential Clerk refuses or a person who is not a\nmember (`invalid_grant`), another grant or subject token type, or a proof\nthat does not match the request."
855
+ },
856
+ "TokenResponse": {
857
+ "type": "object",
858
+ "required": [
859
+ "access_token",
860
+ "token_type",
861
+ "expires_in",
862
+ "issued_token_type"
863
+ ],
864
+ "properties": {
865
+ "access_token": {
866
+ "type": "string",
867
+ "description": "The session."
868
+ },
869
+ "token_type": {
870
+ "type": "string",
871
+ "enum": [
872
+ "DPoP"
873
+ ],
874
+ "description": "Every use needs a DPoP proof of the same key."
875
+ },
876
+ "expires_in": {
877
+ "type": "integer",
878
+ "format": "int32",
879
+ "description": "Its lifetime, in seconds: 15 minutes for a person, an hour for an org key or a machine, 5\nminutes for a grant's (never past the grant's expiry)."
880
+ },
881
+ "issued_token_type": {
882
+ "type": "string",
883
+ "enum": [
884
+ "urn:ietf:params:oauth:token-type:access_token"
885
+ ]
886
+ }
887
+ },
888
+ "description": "A session (RFC 8693 §2.2.1): a JWT signed by the STS, bound to the proof's key."
889
+ },
890
+ "Unauthorized": {
891
+ "type": "object",
892
+ "required": [
893
+ "error",
894
+ "error_description"
895
+ ],
896
+ "properties": {
897
+ "error": {
898
+ "type": "string",
899
+ "enum": [
900
+ "invalid_token",
901
+ "invalid_dpop_proof"
902
+ ],
903
+ "description": "Machine-readable error code."
904
+ },
905
+ "error_description": {
906
+ "type": "string",
907
+ "description": "What went wrong, for people. Never contains internal details."
908
+ }
909
+ },
910
+ "description": "Missing, invalid or expired session, or a proof that does not match this request."
911
+ },
912
+ "UseDpopNonce": {
913
+ "type": "object",
914
+ "required": [
915
+ "error",
916
+ "error_description"
917
+ ],
918
+ "properties": {
919
+ "error": {
920
+ "type": "string",
921
+ "enum": [
922
+ "use_dpop_nonce"
923
+ ],
924
+ "description": "Machine-readable error code."
925
+ },
926
+ "error_description": {
927
+ "type": "string",
928
+ "description": "What went wrong, for people. Never contains internal details."
929
+ }
930
+ },
931
+ "description": "The proof lacks the current nonce, or has an old one: retry once with `DPoP-Nonce` (RFC 9449 §8)."
932
+ }
933
+ },
934
+ "securitySchemes": {
935
+ "DPoPAuth": {
936
+ "type": "http",
937
+ "scheme": "DPoP",
938
+ "description": "Every call carries a session of the region's STS and a DPoP proof (RFC\n9449) made for that exact request with the session's key:\n\n- `Authorization: DPoP <session JWT>`\n- `DPoP: <proof JWT>`, signed ES256 by the key the session is bound to\n(`cnf.jkt`), with `htm` (method), `htu` (origin and path), `iat`, `jti`\n(used once), `ath` (hash of the session), and Olyzon's `htq` and `hbd`:\nbase64url SHA-256 of the raw query string and of the raw body bytes.\n\nA proof is valid for one request only, so it cannot be typed into a form:\nuse the Olyzon SDK, which signs each request below the generated client."
939
+ }
940
+ }
941
+ }
942
+ }