@fabrika/auth 0.9.0-dev.4 → 0.9.0-dev.6
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/package.json +3 -3
- package/src/app-schema.ts +7 -0
- package/src/index.ts +2 -2
- package/src/rpc-http.ts +65 -1
- package/types/src/app-schema.d.ts +53 -34
- package/types/src/index.d.ts +2 -2
- package/types/src/rpc-http.d.ts +21 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabrika/auth",
|
|
3
|
-
"version": "0.9.0-dev.
|
|
3
|
+
"version": "0.9.0-dev.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"zod": "^3.25.76",
|
|
31
|
-
"@fabrika/auth-core": "0.9.0-dev.
|
|
32
|
-
"@fabrika/jwks": "0.9.0-dev.
|
|
31
|
+
"@fabrika/auth-core": "0.9.0-dev.6",
|
|
32
|
+
"@fabrika/jwks": "0.9.0-dev.6",
|
|
33
33
|
"jose": "^5.9.0"
|
|
34
34
|
}
|
|
35
35
|
}
|
package/src/app-schema.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
LOCALES,
|
|
8
8
|
mailTemplateProblems,
|
|
9
9
|
type MessageKind,
|
|
10
|
+
terminalIdentifyProblem,
|
|
10
11
|
WORKLOAD_NAME,
|
|
11
12
|
} from '@fabrika/auth-core'
|
|
12
13
|
import { z } from 'zod'
|
|
@@ -230,6 +231,12 @@ const appSchemaShape = z.object({
|
|
|
230
231
|
.optional(),
|
|
231
232
|
members: z.object({ manage: z.string().min(1), list: z.string().min(1) }).optional(),
|
|
232
233
|
directory: z.literal('labels').optional(),
|
|
234
|
+
terminal: z.object({
|
|
235
|
+
identify: z.string().superRefine((value, ctx) => {
|
|
236
|
+
const problem = terminalIdentifyProblem(value)
|
|
237
|
+
if (problem !== null) ctx.addIssue({ code: 'custom', message: `the terminal's identification path ${problem}` })
|
|
238
|
+
}),
|
|
239
|
+
}).strict().optional(),
|
|
233
240
|
})
|
|
234
241
|
|
|
235
242
|
/** One message's templates by language, each refused with the same rule the contract build applies. */
|
package/src/index.ts
CHANGED
|
@@ -19,8 +19,8 @@ export type { AuthCarrier } from './types'
|
|
|
19
19
|
// The HTTP transport for the SAME `IamRpc` contract, for a runtime with no Cloudflare service binding
|
|
20
20
|
// (a long-running Bun/Node process). Drops into anywhere a binding goes — `createIam`, `IamClient`,
|
|
21
21
|
// `env.IAM` — because the contract is unchanged and only the transport differs.
|
|
22
|
-
export { DecodedIamMembership, HttpIamMembership, HttpIamRpc, IamTransportError } from './rpc-http'
|
|
23
|
-
export type { IamMembershipMethod } from './rpc-http'
|
|
22
|
+
export { DecodedIamMembership, DecodedIamTerminals, HttpIamMembership, HttpIamRpc, HttpIamTerminals, IamTransportError } from './rpc-http'
|
|
23
|
+
export type { IamMembershipMethod, IamTerminalMethod } from './rpc-http'
|
|
24
24
|
// The membership operations an application requests on its caller's behalf (scopes, members, share links).
|
|
25
25
|
export { createIamMembership, IamMembership } from './membership'
|
|
26
26
|
export type { IamMembershipEnv, MembershipRequestCaller } from './membership'
|
package/src/rpc-http.ts
CHANGED
|
@@ -44,9 +44,13 @@
|
|
|
44
44
|
import type {
|
|
45
45
|
ApproveDeviceAuthorizationInput,
|
|
46
46
|
ApproveDeviceAuthorizationResult,
|
|
47
|
+
AssertIdentityInput,
|
|
48
|
+
AssertIdentityResult,
|
|
47
49
|
AssignMemberInput,
|
|
48
50
|
AssignMemberResult,
|
|
49
51
|
AuditInput,
|
|
52
|
+
CancelIdentificationInput,
|
|
53
|
+
CancelIdentificationResult,
|
|
50
54
|
CreateScopeInput,
|
|
51
55
|
CreateScopeResult,
|
|
52
56
|
DenyDeviceAuthorizationResult,
|
|
@@ -54,8 +58,11 @@ import type {
|
|
|
54
58
|
FindMemberResult,
|
|
55
59
|
IamMembershipRpc,
|
|
56
60
|
IamRpc,
|
|
61
|
+
IamTerminalRpc,
|
|
57
62
|
InspectDeviceAuthorizationInput,
|
|
58
63
|
InspectDeviceAuthorizationResult,
|
|
64
|
+
InspectIdentificationInput,
|
|
65
|
+
InspectIdentificationResult,
|
|
59
66
|
IssueKeyInput,
|
|
60
67
|
IssueKeyResult,
|
|
61
68
|
IssueLinkInput,
|
|
@@ -82,6 +89,7 @@ import type {
|
|
|
82
89
|
RevokeLinkResult,
|
|
83
90
|
RevokeMemberInput,
|
|
84
91
|
RevokeMemberResult,
|
|
92
|
+
TerminalFailure,
|
|
85
93
|
} from '@fabrika/auth-core'
|
|
86
94
|
import {
|
|
87
95
|
parseApproveDeviceAuthorizationResult,
|
|
@@ -358,7 +366,7 @@ function transportEndpoint(options: HttpIamRpcOptions, prefix: string): Transpor
|
|
|
358
366
|
prefix,
|
|
359
367
|
key: options.key,
|
|
360
368
|
timeoutMs: options.timeoutMs ?? DEFAULT_TIMEOUT_MS,
|
|
361
|
-
fetch: options.fetch ?? globalThis.fetch,
|
|
369
|
+
fetch: options.fetch ?? globalThis.fetch.bind(globalThis),
|
|
362
370
|
}
|
|
363
371
|
}
|
|
364
372
|
|
|
@@ -469,6 +477,62 @@ export class HttpIamMembership extends DecodedIamMembership {
|
|
|
469
477
|
}
|
|
470
478
|
}
|
|
471
479
|
|
|
480
|
+
/** The identification operations, by name, as a transport carries them. */
|
|
481
|
+
export type IamTerminalMethod = keyof IamTerminalRpc
|
|
482
|
+
|
|
483
|
+
const inspectIdentificationSuccessSchema = z.object({
|
|
484
|
+
...okEnvelope,
|
|
485
|
+
terminal: z.object({ id: z.string().min(1), label: z.string().min(1) }),
|
|
486
|
+
expiresAt: z.number().finite(),
|
|
487
|
+
})
|
|
488
|
+
const assertIdentitySuccessSchema = z.object({ ...okEnvelope, completionUrl: z.string().url() })
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* `IamTerminalRpc` over any transport that answers each call with a JSON-shaped body: `HttpIamTerminals`, or a Workers
|
|
492
|
+
* binding to IAM's application entrypoint (ADR-0067). A body that breaks the contract is `IamTransportError`.
|
|
493
|
+
*/
|
|
494
|
+
export class DecodedIamTerminals implements IamTerminalRpc {
|
|
495
|
+
readonly #call: (method: IamTerminalMethod, input: unknown) => Promise<unknown>
|
|
496
|
+
|
|
497
|
+
constructor(call: (method: IamTerminalMethod, input: unknown) => Promise<unknown>) {
|
|
498
|
+
this.#call = call
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
async inspectIdentification(input: InspectIdentificationInput): Promise<InspectIdentificationResult> {
|
|
502
|
+
const body = await this.#call('inspectIdentification', input)
|
|
503
|
+
return readTerminalFailure(body) ?? decode(inspectIdentificationSuccessSchema, body, 'inspectIdentification')
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
async assertIdentity(input: AssertIdentityInput): Promise<AssertIdentityResult> {
|
|
507
|
+
const body = await this.#call('assertIdentity', input)
|
|
508
|
+
return readTerminalFailure(body) ?? decode(assertIdentitySuccessSchema, body, 'assertIdentity')
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
async cancelIdentification(input: CancelIdentificationInput): Promise<CancelIdentificationResult> {
|
|
512
|
+
const body = await this.#call('cancelIdentification', input)
|
|
513
|
+
return readTerminalFailure(body) ?? decode(revokedSuccessSchema, body, 'cancelIdentification')
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* `IamTerminalRpc` over IAM's membership transport, `POST {origin}/membership/<method>`, with the application's own
|
|
519
|
+
* membership transport key, which pins the asserting application.
|
|
520
|
+
*/
|
|
521
|
+
export class HttpIamTerminals extends DecodedIamTerminals {
|
|
522
|
+
constructor(options: HttpIamRpcOptions) {
|
|
523
|
+
const endpoint = transportEndpoint(options, '/membership/')
|
|
524
|
+
super((method, input) => callJson(endpoint, method, input))
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
const TERMINAL_REASONS = ['missing_token', 'invalid_token', 'not_allowed', 'not_found', 'invalid_principal'] as const
|
|
529
|
+
|
|
530
|
+
/** An identification refusal off the wire. An unknown reason degrades to `not_allowed`, never to an allow. */
|
|
531
|
+
function readTerminalFailure(body: unknown): TerminalFailure | null {
|
|
532
|
+
const reason = readFailure(body)
|
|
533
|
+
return reason === null ? null : { ok: false, reason: oneOf(reason, TERMINAL_REASONS, 'not_allowed') }
|
|
534
|
+
}
|
|
535
|
+
|
|
472
536
|
/** The five delegation-path failure reasons `issueKey` / `revokeKey` / `listPrincipals` share. */
|
|
473
537
|
const ISSUE_REASONS = ['missing_token', 'invalid_token', 'unknown_principal', 'disabled', 'not_allowed'] as const
|
|
474
538
|
|
|
@@ -25,23 +25,23 @@ export declare const appSchemaSchema: z.ZodEffects<z.ZodObject<{
|
|
|
25
25
|
lookups: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
26
26
|
}, "strip", z.ZodTypeAny, {
|
|
27
27
|
type: string;
|
|
28
|
-
in?: string | undefined;
|
|
29
28
|
members?: {
|
|
30
29
|
manage: string;
|
|
31
30
|
list: string;
|
|
32
31
|
} | undefined;
|
|
33
32
|
directory?: "labels" | undefined;
|
|
33
|
+
in?: string | undefined;
|
|
34
34
|
label?: string | undefined;
|
|
35
35
|
creator?: string | undefined;
|
|
36
36
|
lookups?: string[] | undefined;
|
|
37
37
|
}, {
|
|
38
38
|
type: string;
|
|
39
|
-
in?: string | undefined;
|
|
40
39
|
members?: {
|
|
41
40
|
manage: string;
|
|
42
41
|
list: string;
|
|
43
42
|
} | undefined;
|
|
44
43
|
directory?: "labels" | undefined;
|
|
44
|
+
in?: string | undefined;
|
|
45
45
|
label?: string | undefined;
|
|
46
46
|
creator?: string | undefined;
|
|
47
47
|
lookups?: string[] | undefined;
|
|
@@ -74,20 +74,20 @@ export declare const appSchemaSchema: z.ZodEffects<z.ZodObject<{
|
|
|
74
74
|
}, "strip", z.ZodTypeAny, {
|
|
75
75
|
name: string;
|
|
76
76
|
permissions: string[];
|
|
77
|
+
external?: true | undefined;
|
|
77
78
|
member?: {
|
|
78
79
|
scope: string;
|
|
79
80
|
assignableBy?: string[] | undefined;
|
|
80
81
|
} | undefined;
|
|
81
|
-
external?: true | undefined;
|
|
82
82
|
description?: string | undefined;
|
|
83
83
|
}, {
|
|
84
84
|
name: string;
|
|
85
85
|
permissions: string[];
|
|
86
|
+
external?: true | undefined;
|
|
86
87
|
member?: {
|
|
87
88
|
scope: string;
|
|
88
89
|
assignableBy?: string[] | undefined;
|
|
89
90
|
} | undefined;
|
|
90
|
-
external?: true | undefined;
|
|
91
91
|
description?: string | undefined;
|
|
92
92
|
}>>;
|
|
93
93
|
contract: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -114,11 +114,11 @@ export declare const appSchemaSchema: z.ZodEffects<z.ZodObject<{
|
|
|
114
114
|
}, "strip", z.ZodTypeAny, {
|
|
115
115
|
action: string;
|
|
116
116
|
dimension: string;
|
|
117
|
-
purpose: "
|
|
117
|
+
purpose: "members" | "creates";
|
|
118
118
|
}, {
|
|
119
119
|
action: string;
|
|
120
120
|
dimension: string;
|
|
121
|
-
purpose: "
|
|
121
|
+
purpose: "members" | "creates";
|
|
122
122
|
}>>>;
|
|
123
123
|
workloads: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
124
124
|
kind: z.ZodLiteral<"job">;
|
|
@@ -282,6 +282,13 @@ export declare const appSchemaSchema: z.ZodEffects<z.ZodObject<{
|
|
|
282
282
|
list: string;
|
|
283
283
|
}>>;
|
|
284
284
|
directory: z.ZodOptional<z.ZodLiteral<"labels">>;
|
|
285
|
+
terminal: z.ZodOptional<z.ZodObject<{
|
|
286
|
+
identify: z.ZodEffects<z.ZodString, string, string>;
|
|
287
|
+
}, "strict", z.ZodTypeAny, {
|
|
288
|
+
identify: string;
|
|
289
|
+
}, {
|
|
290
|
+
identify: string;
|
|
291
|
+
}>>;
|
|
285
292
|
}, "strip", z.ZodTypeAny, {
|
|
286
293
|
actions: {
|
|
287
294
|
action: string;
|
|
@@ -290,26 +297,33 @@ export declare const appSchemaSchema: z.ZodEffects<z.ZodObject<{
|
|
|
290
297
|
roles: Record<string, {
|
|
291
298
|
name: string;
|
|
292
299
|
permissions: string[];
|
|
300
|
+
external?: true | undefined;
|
|
293
301
|
member?: {
|
|
294
302
|
scope: string;
|
|
295
303
|
assignableBy?: string[] | undefined;
|
|
296
304
|
} | undefined;
|
|
297
|
-
external?: true | undefined;
|
|
298
305
|
description?: string | undefined;
|
|
299
306
|
}>;
|
|
300
307
|
scopes: {
|
|
301
308
|
type: string;
|
|
302
|
-
in?: string | undefined;
|
|
303
309
|
members?: {
|
|
304
310
|
manage: string;
|
|
305
311
|
list: string;
|
|
306
312
|
} | undefined;
|
|
307
313
|
directory?: "labels" | undefined;
|
|
314
|
+
in?: string | undefined;
|
|
308
315
|
label?: string | undefined;
|
|
309
316
|
creator?: string | undefined;
|
|
310
317
|
lookups?: string[] | undefined;
|
|
311
318
|
}[];
|
|
312
319
|
displayName?: string | undefined;
|
|
320
|
+
terminal?: {
|
|
321
|
+
identify: string;
|
|
322
|
+
} | undefined;
|
|
323
|
+
members?: {
|
|
324
|
+
manage: string;
|
|
325
|
+
list: string;
|
|
326
|
+
} | undefined;
|
|
313
327
|
locale?: "en" | "cs" | undefined;
|
|
314
328
|
mail?: {
|
|
315
329
|
invitation?: Partial<Record<"en" | "cs", {
|
|
@@ -328,10 +342,6 @@ export declare const appSchemaSchema: z.ZodEffects<z.ZodObject<{
|
|
|
328
342
|
html?: string | undefined;
|
|
329
343
|
}>> | undefined;
|
|
330
344
|
} | undefined;
|
|
331
|
-
members?: {
|
|
332
|
-
manage: string;
|
|
333
|
-
list: string;
|
|
334
|
-
} | undefined;
|
|
335
345
|
directory?: "labels" | undefined;
|
|
336
346
|
contract?: boolean | undefined;
|
|
337
347
|
links?: Record<string, {
|
|
@@ -343,7 +353,7 @@ export declare const appSchemaSchema: z.ZodEffects<z.ZodObject<{
|
|
|
343
353
|
delegations?: Record<string, {
|
|
344
354
|
action: string;
|
|
345
355
|
dimension: string;
|
|
346
|
-
purpose: "
|
|
356
|
+
purpose: "members" | "creates";
|
|
347
357
|
}> | undefined;
|
|
348
358
|
workloads?: ({
|
|
349
359
|
name: string;
|
|
@@ -371,26 +381,33 @@ export declare const appSchemaSchema: z.ZodEffects<z.ZodObject<{
|
|
|
371
381
|
roles: Record<string, {
|
|
372
382
|
name: string;
|
|
373
383
|
permissions: string[];
|
|
384
|
+
external?: true | undefined;
|
|
374
385
|
member?: {
|
|
375
386
|
scope: string;
|
|
376
387
|
assignableBy?: string[] | undefined;
|
|
377
388
|
} | undefined;
|
|
378
|
-
external?: true | undefined;
|
|
379
389
|
description?: string | undefined;
|
|
380
390
|
}>;
|
|
381
391
|
scopes: {
|
|
382
392
|
type: string;
|
|
383
|
-
in?: string | undefined;
|
|
384
393
|
members?: {
|
|
385
394
|
manage: string;
|
|
386
395
|
list: string;
|
|
387
396
|
} | undefined;
|
|
388
397
|
directory?: "labels" | undefined;
|
|
398
|
+
in?: string | undefined;
|
|
389
399
|
label?: string | undefined;
|
|
390
400
|
creator?: string | undefined;
|
|
391
401
|
lookups?: string[] | undefined;
|
|
392
402
|
}[];
|
|
393
403
|
displayName?: string | undefined;
|
|
404
|
+
terminal?: {
|
|
405
|
+
identify: string;
|
|
406
|
+
} | undefined;
|
|
407
|
+
members?: {
|
|
408
|
+
manage: string;
|
|
409
|
+
list: string;
|
|
410
|
+
} | undefined;
|
|
394
411
|
locale?: "en" | "cs" | undefined;
|
|
395
412
|
mail?: {
|
|
396
413
|
invitation?: Partial<Record<"en" | "cs", {
|
|
@@ -409,10 +426,6 @@ export declare const appSchemaSchema: z.ZodEffects<z.ZodObject<{
|
|
|
409
426
|
html?: string | undefined;
|
|
410
427
|
}>> | undefined;
|
|
411
428
|
} | undefined;
|
|
412
|
-
members?: {
|
|
413
|
-
manage: string;
|
|
414
|
-
list: string;
|
|
415
|
-
} | undefined;
|
|
416
429
|
directory?: "labels" | undefined;
|
|
417
430
|
contract?: boolean | undefined;
|
|
418
431
|
links?: Record<string, {
|
|
@@ -424,7 +437,7 @@ export declare const appSchemaSchema: z.ZodEffects<z.ZodObject<{
|
|
|
424
437
|
delegations?: Record<string, {
|
|
425
438
|
action: string;
|
|
426
439
|
dimension: string;
|
|
427
|
-
purpose: "
|
|
440
|
+
purpose: "members" | "creates";
|
|
428
441
|
}> | undefined;
|
|
429
442
|
workloads?: ({
|
|
430
443
|
name: string;
|
|
@@ -452,26 +465,33 @@ export declare const appSchemaSchema: z.ZodEffects<z.ZodObject<{
|
|
|
452
465
|
roles: Record<string, {
|
|
453
466
|
name: string;
|
|
454
467
|
permissions: string[];
|
|
468
|
+
external?: true | undefined;
|
|
455
469
|
member?: {
|
|
456
470
|
scope: string;
|
|
457
471
|
assignableBy?: string[] | undefined;
|
|
458
472
|
} | undefined;
|
|
459
|
-
external?: true | undefined;
|
|
460
473
|
description?: string | undefined;
|
|
461
474
|
}>;
|
|
462
475
|
scopes: {
|
|
463
476
|
type: string;
|
|
464
|
-
in?: string | undefined;
|
|
465
477
|
members?: {
|
|
466
478
|
manage: string;
|
|
467
479
|
list: string;
|
|
468
480
|
} | undefined;
|
|
469
481
|
directory?: "labels" | undefined;
|
|
482
|
+
in?: string | undefined;
|
|
470
483
|
label?: string | undefined;
|
|
471
484
|
creator?: string | undefined;
|
|
472
485
|
lookups?: string[] | undefined;
|
|
473
486
|
}[];
|
|
474
487
|
displayName?: string | undefined;
|
|
488
|
+
terminal?: {
|
|
489
|
+
identify: string;
|
|
490
|
+
} | undefined;
|
|
491
|
+
members?: {
|
|
492
|
+
manage: string;
|
|
493
|
+
list: string;
|
|
494
|
+
} | undefined;
|
|
475
495
|
locale?: "en" | "cs" | undefined;
|
|
476
496
|
mail?: {
|
|
477
497
|
invitation?: Partial<Record<"en" | "cs", {
|
|
@@ -490,10 +510,6 @@ export declare const appSchemaSchema: z.ZodEffects<z.ZodObject<{
|
|
|
490
510
|
html?: string | undefined;
|
|
491
511
|
}>> | undefined;
|
|
492
512
|
} | undefined;
|
|
493
|
-
members?: {
|
|
494
|
-
manage: string;
|
|
495
|
-
list: string;
|
|
496
|
-
} | undefined;
|
|
497
513
|
directory?: "labels" | undefined;
|
|
498
514
|
contract?: boolean | undefined;
|
|
499
515
|
links?: Record<string, {
|
|
@@ -505,7 +521,7 @@ export declare const appSchemaSchema: z.ZodEffects<z.ZodObject<{
|
|
|
505
521
|
delegations?: Record<string, {
|
|
506
522
|
action: string;
|
|
507
523
|
dimension: string;
|
|
508
|
-
purpose: "
|
|
524
|
+
purpose: "members" | "creates";
|
|
509
525
|
}> | undefined;
|
|
510
526
|
workloads?: ({
|
|
511
527
|
name: string;
|
|
@@ -533,26 +549,33 @@ export declare const appSchemaSchema: z.ZodEffects<z.ZodObject<{
|
|
|
533
549
|
roles: Record<string, {
|
|
534
550
|
name: string;
|
|
535
551
|
permissions: string[];
|
|
552
|
+
external?: true | undefined;
|
|
536
553
|
member?: {
|
|
537
554
|
scope: string;
|
|
538
555
|
assignableBy?: string[] | undefined;
|
|
539
556
|
} | undefined;
|
|
540
|
-
external?: true | undefined;
|
|
541
557
|
description?: string | undefined;
|
|
542
558
|
}>;
|
|
543
559
|
scopes: {
|
|
544
560
|
type: string;
|
|
545
|
-
in?: string | undefined;
|
|
546
561
|
members?: {
|
|
547
562
|
manage: string;
|
|
548
563
|
list: string;
|
|
549
564
|
} | undefined;
|
|
550
565
|
directory?: "labels" | undefined;
|
|
566
|
+
in?: string | undefined;
|
|
551
567
|
label?: string | undefined;
|
|
552
568
|
creator?: string | undefined;
|
|
553
569
|
lookups?: string[] | undefined;
|
|
554
570
|
}[];
|
|
555
571
|
displayName?: string | undefined;
|
|
572
|
+
terminal?: {
|
|
573
|
+
identify: string;
|
|
574
|
+
} | undefined;
|
|
575
|
+
members?: {
|
|
576
|
+
manage: string;
|
|
577
|
+
list: string;
|
|
578
|
+
} | undefined;
|
|
556
579
|
locale?: "en" | "cs" | undefined;
|
|
557
580
|
mail?: {
|
|
558
581
|
invitation?: Partial<Record<"en" | "cs", {
|
|
@@ -571,10 +594,6 @@ export declare const appSchemaSchema: z.ZodEffects<z.ZodObject<{
|
|
|
571
594
|
html?: string | undefined;
|
|
572
595
|
}>> | undefined;
|
|
573
596
|
} | undefined;
|
|
574
|
-
members?: {
|
|
575
|
-
manage: string;
|
|
576
|
-
list: string;
|
|
577
|
-
} | undefined;
|
|
578
597
|
directory?: "labels" | undefined;
|
|
579
598
|
contract?: boolean | undefined;
|
|
580
599
|
links?: Record<string, {
|
|
@@ -586,7 +605,7 @@ export declare const appSchemaSchema: z.ZodEffects<z.ZodObject<{
|
|
|
586
605
|
delegations?: Record<string, {
|
|
587
606
|
action: string;
|
|
588
607
|
dimension: string;
|
|
589
|
-
purpose: "
|
|
608
|
+
purpose: "members" | "creates";
|
|
590
609
|
}> | undefined;
|
|
591
610
|
workloads?: ({
|
|
592
611
|
name: string;
|
package/types/src/index.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ export type { HttpError } from './errors';
|
|
|
5
5
|
export { anonymousContext, createIam, Iam } from './iam';
|
|
6
6
|
export type { AuthFailure, AuthFailureReason, AuthResult, CreateIamOptions, IamEnv } from './iam';
|
|
7
7
|
export type { AuthCarrier } from './types';
|
|
8
|
-
export { DecodedIamMembership, HttpIamMembership, HttpIamRpc, IamTransportError } from './rpc-http';
|
|
9
|
-
export type { IamMembershipMethod } from './rpc-http';
|
|
8
|
+
export { DecodedIamMembership, DecodedIamTerminals, HttpIamMembership, HttpIamRpc, HttpIamTerminals, IamTransportError } from './rpc-http';
|
|
9
|
+
export type { IamMembershipMethod, IamTerminalMethod } from './rpc-http';
|
|
10
10
|
export { createIamMembership, IamMembership } from './membership';
|
|
11
11
|
export type { IamMembershipEnv, MembershipRequestCaller } from './membership';
|
|
12
12
|
export type { FetchLike, HttpIamRpcOptions } from './rpc-http';
|
package/types/src/rpc-http.d.ts
CHANGED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
* the deployment", exactly as a binding's unreachability does. Per-caller authorization still happens
|
|
41
41
|
* inside IAM, from the credential carried in the method's own input. It is never logged.
|
|
42
42
|
*/
|
|
43
|
-
import type { ApproveDeviceAuthorizationInput, ApproveDeviceAuthorizationResult, AssignMemberInput, AssignMemberResult, AuditInput, CreateScopeInput, CreateScopeResult, DenyDeviceAuthorizationResult, FindMemberInput, FindMemberResult, IamMembershipRpc, IamRpc, InspectDeviceAuthorizationInput, InspectDeviceAuthorizationResult, IssueKeyInput, IssueKeyResult, IssueLinkInput, IssueLinkResult, Jwks, ListAppMembersInput, ListAppMembersResult, ListMembersInput, ListMembersResult, ListOwnDeviceAuthorizationsInput, ListOwnDeviceAuthorizationsResult, ListPrincipalsInput, ListPrincipalsResult, MintFromKeyInput, MintFromKeyResult, MintTokenInput, MintTokenResult, RequestDelegationInput, RequestDelegationResult, RevokeKeyInput, RevokeKeyResult, RevokeLinkInput, RevokeLinkResult, RevokeMemberInput, RevokeMemberResult } from '@fabrika/auth-core';
|
|
43
|
+
import type { ApproveDeviceAuthorizationInput, ApproveDeviceAuthorizationResult, AssertIdentityInput, AssertIdentityResult, AssignMemberInput, AssignMemberResult, AuditInput, CancelIdentificationInput, CancelIdentificationResult, CreateScopeInput, CreateScopeResult, DenyDeviceAuthorizationResult, FindMemberInput, FindMemberResult, IamMembershipRpc, IamRpc, IamTerminalRpc, InspectDeviceAuthorizationInput, InspectDeviceAuthorizationResult, InspectIdentificationInput, InspectIdentificationResult, IssueKeyInput, IssueKeyResult, IssueLinkInput, IssueLinkResult, Jwks, ListAppMembersInput, ListAppMembersResult, ListMembersInput, ListMembersResult, ListOwnDeviceAuthorizationsInput, ListOwnDeviceAuthorizationsResult, ListPrincipalsInput, ListPrincipalsResult, MintFromKeyInput, MintFromKeyResult, MintTokenInput, MintTokenResult, RequestDelegationInput, RequestDelegationResult, RevokeKeyInput, RevokeKeyResult, RevokeLinkInput, RevokeLinkResult, RevokeMemberInput, RevokeMemberResult } from '@fabrika/auth-core';
|
|
44
44
|
/**
|
|
45
45
|
* Just the call shape this client uses. Narrower than `typeof fetch` on purpose: the global carries
|
|
46
46
|
* runtime-specific extras (Bun's `preconnect`) that a test double has no business implementing.
|
|
@@ -125,3 +125,23 @@ export declare class DecodedIamMembership implements IamMembershipRpc {
|
|
|
125
125
|
export declare class HttpIamMembership extends DecodedIamMembership {
|
|
126
126
|
constructor(options: HttpIamRpcOptions);
|
|
127
127
|
}
|
|
128
|
+
/** The identification operations, by name, as a transport carries them. */
|
|
129
|
+
export type IamTerminalMethod = keyof IamTerminalRpc;
|
|
130
|
+
/**
|
|
131
|
+
* `IamTerminalRpc` over any transport that answers each call with a JSON-shaped body: `HttpIamTerminals`, or a Workers
|
|
132
|
+
* binding to IAM's application entrypoint (ADR-0067). A body that breaks the contract is `IamTransportError`.
|
|
133
|
+
*/
|
|
134
|
+
export declare class DecodedIamTerminals implements IamTerminalRpc {
|
|
135
|
+
#private;
|
|
136
|
+
constructor(call: (method: IamTerminalMethod, input: unknown) => Promise<unknown>);
|
|
137
|
+
inspectIdentification(input: InspectIdentificationInput): Promise<InspectIdentificationResult>;
|
|
138
|
+
assertIdentity(input: AssertIdentityInput): Promise<AssertIdentityResult>;
|
|
139
|
+
cancelIdentification(input: CancelIdentificationInput): Promise<CancelIdentificationResult>;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* `IamTerminalRpc` over IAM's membership transport, `POST {origin}/membership/<method>`, with the application's own
|
|
143
|
+
* membership transport key, which pins the asserting application.
|
|
144
|
+
*/
|
|
145
|
+
export declare class HttpIamTerminals extends DecodedIamTerminals {
|
|
146
|
+
constructor(options: HttpIamRpcOptions);
|
|
147
|
+
}
|