@fabrika/iam-contract 0.9.0-dev.48 → 0.9.0-dev.49
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 +4 -4
- package/src/index.ts +23 -18
- package/src/passkeys.ts +23 -19
- package/types/src/index.d.ts +20 -14
- package/types/src/passkeys.d.ts +16 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabrika/iam-contract",
|
|
3
|
-
"version": "0.9.0-dev.
|
|
3
|
+
"version": "0.9.0-dev.49",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"test": "bun test"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@fabrika/app": "0.9.0-dev.
|
|
31
|
-
"@fabrika/auth-core": "0.9.0-dev.
|
|
32
|
-
"@fabrika/proxy-core": "0.9.0-dev.
|
|
30
|
+
"@fabrika/app": "0.9.0-dev.49",
|
|
31
|
+
"@fabrika/auth-core": "0.9.0-dev.49",
|
|
32
|
+
"@fabrika/proxy-core": "0.9.0-dev.49"
|
|
33
33
|
}
|
|
34
34
|
}
|
package/src/index.ts
CHANGED
|
@@ -36,13 +36,9 @@ import type {
|
|
|
36
36
|
} from './oauth-registry'
|
|
37
37
|
import type {
|
|
38
38
|
IssuePasskeyChallengeRequest,
|
|
39
|
-
PasskeyChallenge,
|
|
40
|
-
PasskeyCreationOptions,
|
|
41
39
|
PasskeyDto,
|
|
42
|
-
PasskeyRequestOptions,
|
|
43
40
|
PasskeyResetResponse,
|
|
44
|
-
|
|
45
|
-
RemovePasskeyRequest,
|
|
41
|
+
PasskeyStepUpChallenge,
|
|
46
42
|
VerifiedPasskeyAssertion,
|
|
47
43
|
VerifyPasskeyAssertionRequest,
|
|
48
44
|
} from './passkeys'
|
|
@@ -294,17 +290,27 @@ export const CREDENTIALS_MODES = ['off', 'person', 'refuse'] as const
|
|
|
294
290
|
|
|
295
291
|
export type CredentialsMode = (typeof CREDENTIALS_MODES)[number]
|
|
296
292
|
|
|
293
|
+
/**
|
|
294
|
+
* What an environment does with an agent's `write` grant (ADR-0090 §5), as Control mirrors its `agent-write` category:
|
|
295
|
+
* `open` serves it, `passkey` serves it when the approving person confirms with a passkey, `refuse` never serves it.
|
|
296
|
+
*/
|
|
297
|
+
export const AGENT_WRITE_GATES = ['open', 'passkey', 'refuse'] as const
|
|
298
|
+
|
|
299
|
+
export type AgentWriteGate = (typeof AGENT_WRITE_GATES)[number]
|
|
300
|
+
|
|
297
301
|
/**
|
|
298
302
|
* Control's mirror of an application environment's approval gates in IAM, set with the provisioning key (ADR-0083 §4,
|
|
299
|
-
* §8): whether its console grants wait (`required`),
|
|
300
|
-
* protection revision: IAM ignores one older than it holds, and answers what it holds. A
|
|
301
|
-
* (an older Control's) clears IAM's mode, which then reads as `person
|
|
303
|
+
* §8, ADR-0090 §5): whether its console grants wait (`required`), its `credentials` mode and its `agentWrite` gate.
|
|
304
|
+
* `revision` is the environment's protection revision: IAM ignores one older than it holds, and answers what it holds. A
|
|
305
|
+
* request without `credentials` (an older Control's) clears IAM's mode, which then reads as `person`; one without
|
|
306
|
+
* `agentWrite` clears that gate, which then reads as `refuse`.
|
|
302
307
|
*/
|
|
303
308
|
export interface SetGrantApprovalRequest {
|
|
304
309
|
app: string
|
|
305
310
|
required: boolean
|
|
306
311
|
revision: number
|
|
307
312
|
credentials?: CredentialsMode
|
|
313
|
+
agentWrite?: AgentWriteGate
|
|
308
314
|
}
|
|
309
315
|
|
|
310
316
|
// ── Apps (read-only; the live registry derived from the schema tables) ────────
|
|
@@ -1062,24 +1068,23 @@ export interface IamAdminRpcContract {
|
|
|
1062
1068
|
reset: RpcProcedure<PrincipalIdInput, SecondFactorDto>
|
|
1063
1069
|
}
|
|
1064
1070
|
/**
|
|
1065
|
-
* A person's passkeys.
|
|
1066
|
-
*
|
|
1067
|
-
*
|
|
1068
|
-
*
|
|
1069
|
-
*
|
|
1071
|
+
* A person's passkeys. A person registers and removes their own on IAM's account page (`ACCOUNT_PAGE_PATH`).
|
|
1072
|
+
* `challenge` and `verify` are the step-up seam, for a person in a signed-in session, never a `px_` key: a challenge
|
|
1073
|
+
* bound to an opaque string, which the person answers on IAM's page at its `url`, and its verification against the
|
|
1074
|
+
* same string. `listOf` and `reset` are an installation administrator's (`iam.admin`); the reset removes every
|
|
1075
|
+
* passkey and writes `iam.passkey.reset`.
|
|
1070
1076
|
*/
|
|
1071
1077
|
passkeys: {
|
|
1072
|
-
|
|
1073
|
-
registrationOptions: RpcProcedure<void, PasskeyChallenge<PasskeyCreationOptions>>
|
|
1074
|
-
register: RpcProcedure<RegisterPasskeyRequest, PasskeyDto>
|
|
1075
|
-
remove: RpcProcedure<RemovePasskeyRequest, OkResponse>
|
|
1076
|
-
challenge: RpcProcedure<IssuePasskeyChallengeRequest, PasskeyChallenge<PasskeyRequestOptions>>
|
|
1078
|
+
challenge: RpcProcedure<IssuePasskeyChallengeRequest, PasskeyStepUpChallenge>
|
|
1077
1079
|
verify: RpcProcedure<VerifyPasskeyAssertionRequest, VerifiedPasskeyAssertion>
|
|
1078
1080
|
listOf: RpcProcedure<PrincipalIdInput, ListResponse<PasskeyDto>>
|
|
1079
1081
|
reset: RpcProcedure<PrincipalIdInput, PasskeyResetResponse>
|
|
1080
1082
|
}
|
|
1081
1083
|
}
|
|
1082
1084
|
|
|
1085
|
+
/** The signed-in person's own page on IAM's origin: their connections and their passkeys. */
|
|
1086
|
+
export const ACCOUNT_PAGE_PATH = '/auth/account'
|
|
1087
|
+
|
|
1083
1088
|
/** Where a signed-in administrator enrols an authenticator app, on IAM's own origin. */
|
|
1084
1089
|
export const SECOND_FACTOR_ENROL_PATH = '/auth/second-factor/enrol'
|
|
1085
1090
|
|
package/src/passkeys.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
// A person's passkeys (WebAuthn), kept by IAM.
|
|
2
|
-
//
|
|
1
|
+
// A person's passkeys (WebAuthn), kept by IAM. Every ceremony runs on IAM's own pages, under IAM's host as the RP ID: the
|
|
2
|
+
// person registers and removes passkeys on IAM's account page, and a step-up another service asks for is answered on
|
|
3
|
+
// IAM's step-up page. Every binary value travels base64url-encoded, as in WebAuthn's JSON encodings.
|
|
3
4
|
|
|
4
5
|
/** How long a ceremony's challenge can be answered, in seconds. */
|
|
5
6
|
export const PASSKEY_CHALLENGE_TTL_SECONDS = 300
|
|
@@ -16,12 +17,18 @@ export const MAX_PASSKEYS_PER_PERSON = 20
|
|
|
16
17
|
/** The error `type` of `passkeys.challenge`'s refusal to a person with no passkey, so a caller tells it from other 409s. */
|
|
17
18
|
export const NO_PASSKEY_ERROR = 'no_passkey'
|
|
18
19
|
|
|
20
|
+
/**
|
|
21
|
+
* The prefix of the bindings IAM's own pages use. Another service never asks a step-up with one, and IAM's step-up page
|
|
22
|
+
* never answers one, so a check IAM asks for itself is answered only on the page that asked it.
|
|
23
|
+
*/
|
|
24
|
+
export const IAM_BINDING_PREFIX = 'iam:'
|
|
25
|
+
|
|
19
26
|
/** The binding of the assertion that registering another passkey takes, when the person already has one. */
|
|
20
|
-
export const PASSKEY_REGISTRATION_BINDING =
|
|
27
|
+
export const PASSKEY_REGISTRATION_BINDING = `${IAM_BINDING_PREFIX}passkeys.register`
|
|
21
28
|
|
|
22
29
|
/** The binding of the assertion that removing the passkey `passkeyId` takes. */
|
|
23
30
|
export function passkeyRemovalBinding(passkeyId: string): string {
|
|
24
|
-
return
|
|
31
|
+
return `${IAM_BINDING_PREFIX}passkeys.remove:${passkeyId}`
|
|
25
32
|
}
|
|
26
33
|
|
|
27
34
|
/** A passkey as its owner and an installation administrator see it. No key material. */
|
|
@@ -102,29 +109,26 @@ export interface PasskeyAssertion {
|
|
|
102
109
|
credential: PasskeyAssertionCredential
|
|
103
110
|
}
|
|
104
111
|
|
|
105
|
-
export interface RegisterPasskeyRequest {
|
|
106
|
-
challengeId: string
|
|
107
|
-
label: string
|
|
108
|
-
credential: PasskeyRegistrationCredential
|
|
109
|
-
/** Required when the person already has a passkey: an assertion bound to `PASSKEY_REGISTRATION_BINDING`. */
|
|
110
|
-
stepUp?: PasskeyAssertion
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export interface RemovePasskeyRequest {
|
|
114
|
-
passkeyId: string
|
|
115
|
-
/** An assertion by one of the person's passkeys, bound to `passkeyRemovalBinding(passkeyId)`. */
|
|
116
|
-
stepUp: PasskeyAssertion
|
|
117
|
-
}
|
|
118
|
-
|
|
119
112
|
export interface IssuePasskeyChallengeRequest {
|
|
120
113
|
/** What the assertion is for, compared verbatim at verification. Opaque to IAM. */
|
|
121
114
|
binding: string
|
|
122
115
|
}
|
|
123
116
|
|
|
117
|
+
/**
|
|
118
|
+
* A step-up challenge IAM issued to the person: they answer it on IAM's page at `url` before `expiresAt` (epoch
|
|
119
|
+
* seconds), and its issuer then verifies it by `challengeId`.
|
|
120
|
+
*/
|
|
121
|
+
export interface PasskeyStepUpChallenge {
|
|
122
|
+
challengeId: string
|
|
123
|
+
expiresAt: number
|
|
124
|
+
url: string
|
|
125
|
+
}
|
|
126
|
+
|
|
124
127
|
export interface VerifyPasskeyAssertionRequest {
|
|
125
128
|
/** The binding the challenge was issued with. */
|
|
126
129
|
binding: string
|
|
127
|
-
|
|
130
|
+
/** The challenge the person answered on IAM's step-up page. */
|
|
131
|
+
challengeId: string
|
|
128
132
|
}
|
|
129
133
|
|
|
130
134
|
/** A verified assertion: who answered, with which credential (its WebAuthn id, base64url), and when (epoch seconds). */
|
package/types/src/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { RpcProcedureContract } from '@fabrika/app';
|
|
|
2
2
|
import type { AppActionDef, AppDelegationDef, AppLinkMountDef, AppMemberItem, AppSchema, AppScopeDef, DimensionValue, Locale, PermissionEntry, PermissionSource, PrincipalAffiliation, PrincipalType, RoleDef, WorkloadKind } from '@fabrika/auth-core';
|
|
3
3
|
import type { InstallationBrand } from '@fabrika/proxy-core/brand';
|
|
4
4
|
import type { ExternalAppDto, ExternalAppInput, OAuthClientDto, OAuthClientInput, PutExternalAppRequest, PutOAuthClientRequest } from './oauth-registry';
|
|
5
|
-
import type { IssuePasskeyChallengeRequest,
|
|
5
|
+
import type { IssuePasskeyChallengeRequest, PasskeyDto, PasskeyResetResponse, PasskeyStepUpChallenge, VerifiedPasskeyAssertion, VerifyPasskeyAssertionRequest } from './passkeys';
|
|
6
6
|
import type { PasswordPolicyDto, SetPasswordPolicyRequest } from './password-policy';
|
|
7
7
|
import type { ProvisionRequestedApiKeyRequest, RequestedApiKey, RequestedApiKeyInput, RequestedApiKeyResponse } from './requested-keys';
|
|
8
8
|
import type { ScimSettingsDto, ScimTokenIssuedDto } from './scim';
|
|
@@ -229,17 +229,25 @@ export interface DecideGrantRequestInput {
|
|
|
229
229
|
/** An environment's `credentials` mode as IAM keeps it for its own key issuance to a machine caller (ADR-0083 §8). */
|
|
230
230
|
export declare const CREDENTIALS_MODES: readonly ["off", "person", "refuse"];
|
|
231
231
|
export type CredentialsMode = (typeof CREDENTIALS_MODES)[number];
|
|
232
|
+
/**
|
|
233
|
+
* What an environment does with an agent's `write` grant (ADR-0090 §5), as Control mirrors its `agent-write` category:
|
|
234
|
+
* `open` serves it, `passkey` serves it when the approving person confirms with a passkey, `refuse` never serves it.
|
|
235
|
+
*/
|
|
236
|
+
export declare const AGENT_WRITE_GATES: readonly ["open", "passkey", "refuse"];
|
|
237
|
+
export type AgentWriteGate = (typeof AGENT_WRITE_GATES)[number];
|
|
232
238
|
/**
|
|
233
239
|
* Control's mirror of an application environment's approval gates in IAM, set with the provisioning key (ADR-0083 §4,
|
|
234
|
-
* §8): whether its console grants wait (`required`),
|
|
235
|
-
* protection revision: IAM ignores one older than it holds, and answers what it holds. A
|
|
236
|
-
* (an older Control's) clears IAM's mode, which then reads as `person
|
|
240
|
+
* §8, ADR-0090 §5): whether its console grants wait (`required`), its `credentials` mode and its `agentWrite` gate.
|
|
241
|
+
* `revision` is the environment's protection revision: IAM ignores one older than it holds, and answers what it holds. A
|
|
242
|
+
* request without `credentials` (an older Control's) clears IAM's mode, which then reads as `person`; one without
|
|
243
|
+
* `agentWrite` clears that gate, which then reads as `refuse`.
|
|
237
244
|
*/
|
|
238
245
|
export interface SetGrantApprovalRequest {
|
|
239
246
|
app: string;
|
|
240
247
|
required: boolean;
|
|
241
248
|
revision: number;
|
|
242
249
|
credentials?: CredentialsMode;
|
|
250
|
+
agentWrite?: AgentWriteGate;
|
|
243
251
|
}
|
|
244
252
|
/** The set of app ids IAM knows about — the choices for a grant's `app`. */
|
|
245
253
|
export interface AppDto {
|
|
@@ -931,23 +939,21 @@ export interface IamAdminRpcContract {
|
|
|
931
939
|
reset: RpcProcedure<PrincipalIdInput, SecondFactorDto>;
|
|
932
940
|
};
|
|
933
941
|
/**
|
|
934
|
-
* A person's passkeys.
|
|
935
|
-
*
|
|
936
|
-
*
|
|
937
|
-
*
|
|
938
|
-
*
|
|
942
|
+
* A person's passkeys. A person registers and removes their own on IAM's account page (`ACCOUNT_PAGE_PATH`).
|
|
943
|
+
* `challenge` and `verify` are the step-up seam, for a person in a signed-in session, never a `px_` key: a challenge
|
|
944
|
+
* bound to an opaque string, which the person answers on IAM's page at its `url`, and its verification against the
|
|
945
|
+
* same string. `listOf` and `reset` are an installation administrator's (`iam.admin`); the reset removes every
|
|
946
|
+
* passkey and writes `iam.passkey.reset`.
|
|
939
947
|
*/
|
|
940
948
|
passkeys: {
|
|
941
|
-
|
|
942
|
-
registrationOptions: RpcProcedure<void, PasskeyChallenge<PasskeyCreationOptions>>;
|
|
943
|
-
register: RpcProcedure<RegisterPasskeyRequest, PasskeyDto>;
|
|
944
|
-
remove: RpcProcedure<RemovePasskeyRequest, OkResponse>;
|
|
945
|
-
challenge: RpcProcedure<IssuePasskeyChallengeRequest, PasskeyChallenge<PasskeyRequestOptions>>;
|
|
949
|
+
challenge: RpcProcedure<IssuePasskeyChallengeRequest, PasskeyStepUpChallenge>;
|
|
946
950
|
verify: RpcProcedure<VerifyPasskeyAssertionRequest, VerifiedPasskeyAssertion>;
|
|
947
951
|
listOf: RpcProcedure<PrincipalIdInput, ListResponse<PasskeyDto>>;
|
|
948
952
|
reset: RpcProcedure<PrincipalIdInput, PasskeyResetResponse>;
|
|
949
953
|
};
|
|
950
954
|
}
|
|
955
|
+
/** The signed-in person's own page on IAM's origin: their connections and their passkeys. */
|
|
956
|
+
export declare const ACCOUNT_PAGE_PATH = "/auth/account";
|
|
951
957
|
/** Where a signed-in administrator enrols an authenticator app, on IAM's own origin. */
|
|
952
958
|
export declare const SECOND_FACTOR_ENROL_PATH = "/auth/second-factor/enrol";
|
|
953
959
|
/** A person's second factor as an installation administrator sees it. */
|
package/types/src/passkeys.d.ts
CHANGED
|
@@ -8,6 +8,11 @@ export declare const MAX_PASSKEY_BINDING_LENGTH = 512;
|
|
|
8
8
|
export declare const MAX_PASSKEYS_PER_PERSON = 20;
|
|
9
9
|
/** The error `type` of `passkeys.challenge`'s refusal to a person with no passkey, so a caller tells it from other 409s. */
|
|
10
10
|
export declare const NO_PASSKEY_ERROR = "no_passkey";
|
|
11
|
+
/**
|
|
12
|
+
* The prefix of the bindings IAM's own pages use. Another service never asks a step-up with one, and IAM's step-up page
|
|
13
|
+
* never answers one, so a check IAM asks for itself is answered only on the page that asked it.
|
|
14
|
+
*/
|
|
15
|
+
export declare const IAM_BINDING_PREFIX = "iam:";
|
|
11
16
|
/** The binding of the assertion that registering another passkey takes, when the person already has one. */
|
|
12
17
|
export declare const PASSKEY_REGISTRATION_BINDING = "iam:passkeys.register";
|
|
13
18
|
/** The binding of the assertion that removing the passkey `passkeyId` takes. */
|
|
@@ -95,26 +100,24 @@ export interface PasskeyAssertion {
|
|
|
95
100
|
challengeId: string;
|
|
96
101
|
credential: PasskeyAssertionCredential;
|
|
97
102
|
}
|
|
98
|
-
export interface RegisterPasskeyRequest {
|
|
99
|
-
challengeId: string;
|
|
100
|
-
label: string;
|
|
101
|
-
credential: PasskeyRegistrationCredential;
|
|
102
|
-
/** Required when the person already has a passkey: an assertion bound to `PASSKEY_REGISTRATION_BINDING`. */
|
|
103
|
-
stepUp?: PasskeyAssertion;
|
|
104
|
-
}
|
|
105
|
-
export interface RemovePasskeyRequest {
|
|
106
|
-
passkeyId: string;
|
|
107
|
-
/** An assertion by one of the person's passkeys, bound to `passkeyRemovalBinding(passkeyId)`. */
|
|
108
|
-
stepUp: PasskeyAssertion;
|
|
109
|
-
}
|
|
110
103
|
export interface IssuePasskeyChallengeRequest {
|
|
111
104
|
/** What the assertion is for, compared verbatim at verification. Opaque to IAM. */
|
|
112
105
|
binding: string;
|
|
113
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* A step-up challenge IAM issued to the person: they answer it on IAM's page at `url` before `expiresAt` (epoch
|
|
109
|
+
* seconds), and its issuer then verifies it by `challengeId`.
|
|
110
|
+
*/
|
|
111
|
+
export interface PasskeyStepUpChallenge {
|
|
112
|
+
challengeId: string;
|
|
113
|
+
expiresAt: number;
|
|
114
|
+
url: string;
|
|
115
|
+
}
|
|
114
116
|
export interface VerifyPasskeyAssertionRequest {
|
|
115
117
|
/** The binding the challenge was issued with. */
|
|
116
118
|
binding: string;
|
|
117
|
-
|
|
119
|
+
/** The challenge the person answered on IAM's step-up page. */
|
|
120
|
+
challengeId: string;
|
|
118
121
|
}
|
|
119
122
|
/** A verified assertion: who answered, with which credential (its WebAuthn id, base64url), and when (epoch seconds). */
|
|
120
123
|
export interface VerifiedPasskeyAssertion {
|