@fabrika/iam-contract 0.9.0-dev.5 → 0.9.0-dev.50

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.
@@ -0,0 +1,131 @@
1
+ /** How long a ceremony's challenge can be answered, in seconds. */
2
+ export declare const PASSKEY_CHALLENGE_TTL_SECONDS = 300;
3
+ /** The longest label a person may give a passkey, in characters. */
4
+ export declare const MAX_PASSKEY_LABEL_LENGTH = 64;
5
+ /** The longest binding a challenge may carry. */
6
+ export declare const MAX_PASSKEY_BINDING_LENGTH = 512;
7
+ /** How many passkeys one person may keep. */
8
+ export declare const MAX_PASSKEYS_PER_PERSON = 20;
9
+ /** The error `type` of `passkeys.challenge`'s refusal to a person with no passkey, so a caller tells it from other 409s. */
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:";
16
+ /** The binding of the assertion that registering another passkey takes, when the person already has one. */
17
+ export declare const PASSKEY_REGISTRATION_BINDING = "iam:passkeys.register";
18
+ /** The binding of the assertion that removing the passkey `passkeyId` takes. */
19
+ export declare function passkeyRemovalBinding(passkeyId: string): string;
20
+ /** A passkey as its owner and an installation administrator see it. No key material. */
21
+ export interface PasskeyDto {
22
+ id: string;
23
+ label: string;
24
+ /** Epoch seconds. */
25
+ createdAt: number;
26
+ /** Epoch seconds of the last accepted assertion; null before the first. */
27
+ lastUsedAt: number | null;
28
+ }
29
+ export interface PasskeyCredentialDescriptor {
30
+ type: 'public-key';
31
+ /** The credential id, base64url. */
32
+ id: string;
33
+ transports?: string[];
34
+ }
35
+ /** `PublicKeyCredentialCreationOptions` in its JSON encoding: what `navigator.credentials.create` takes. */
36
+ export interface PasskeyCreationOptions {
37
+ rp: {
38
+ id: string;
39
+ name: string;
40
+ };
41
+ user: {
42
+ id: string;
43
+ name: string;
44
+ displayName: string;
45
+ };
46
+ challenge: string;
47
+ pubKeyCredParams: {
48
+ type: 'public-key';
49
+ alg: number;
50
+ }[];
51
+ timeout: number;
52
+ /** The person's passkeys, so an authenticator holding one of them does not register it again. */
53
+ excludeCredentials: PasskeyCredentialDescriptor[];
54
+ authenticatorSelection: {
55
+ residentKey: 'preferred';
56
+ userVerification: 'required';
57
+ };
58
+ attestation: 'none';
59
+ }
60
+ /** `PublicKeyCredentialRequestOptions` in its JSON encoding: what `navigator.credentials.get` takes. */
61
+ export interface PasskeyRequestOptions {
62
+ challenge: string;
63
+ rpId: string;
64
+ timeout: number;
65
+ /** The person's own passkeys; no other credential can answer. */
66
+ allowCredentials: PasskeyCredentialDescriptor[];
67
+ userVerification: 'required';
68
+ }
69
+ /** A challenge IAM issued, to be answered once before `expiresAt` (epoch seconds). */
70
+ export interface PasskeyChallenge<Options> {
71
+ challengeId: string;
72
+ expiresAt: number;
73
+ options: Options;
74
+ }
75
+ /** What `navigator.credentials.create` answered, in its JSON encoding. */
76
+ export interface PasskeyRegistrationCredential {
77
+ id: string;
78
+ rawId: string;
79
+ type: 'public-key';
80
+ response: {
81
+ clientDataJSON: string;
82
+ attestationObject: string;
83
+ transports?: string[];
84
+ };
85
+ }
86
+ /** What `navigator.credentials.get` answered, in its JSON encoding. */
87
+ export interface PasskeyAssertionCredential {
88
+ id: string;
89
+ rawId: string;
90
+ type: 'public-key';
91
+ response: {
92
+ clientDataJSON: string;
93
+ authenticatorData: string;
94
+ signature: string;
95
+ userHandle?: string;
96
+ };
97
+ }
98
+ /** An answered assertion challenge. */
99
+ export interface PasskeyAssertion {
100
+ challengeId: string;
101
+ credential: PasskeyAssertionCredential;
102
+ }
103
+ export interface IssuePasskeyChallengeRequest {
104
+ /** What the assertion is for, compared verbatim at verification. Opaque to IAM. */
105
+ binding: string;
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
+ }
116
+ export interface VerifyPasskeyAssertionRequest {
117
+ /** The binding the challenge was issued with. */
118
+ binding: string;
119
+ /** The challenge the person answered on IAM's step-up page. */
120
+ challengeId: string;
121
+ }
122
+ /** A verified assertion: who answered, with which credential (its WebAuthn id, base64url), and when (epoch seconds). */
123
+ export interface VerifiedPasskeyAssertion {
124
+ principalId: string;
125
+ credentialId: string;
126
+ at: number;
127
+ }
128
+ export interface PasskeyResetResponse {
129
+ /** How many passkeys the reset removed. */
130
+ removed: number;
131
+ }
@@ -7,7 +7,7 @@ export declare const PASSWORD_DEFAULT_MIN_LENGTH = 15;
7
7
  export declare const PASSWORD_MIN_LENGTH_FLOOR = 4;
8
8
  /** The most code points a password may have, whatever the minimum. */
9
9
  export declare const PASSWORD_MAX_LENGTH = 256;
10
- /** Below this NIST asks for a second factor, which IAM does not have; the console says so. */
10
+ /** Below this NIST asks for a second factor, which IAM gives only an enrolled administrator; the console says so. */
11
11
  export declare const PASSWORD_SINGLE_FACTOR_FLOOR = 8;
12
12
  /** The password policy as IAM applies it now. */
13
13
  export interface PasswordPolicyDto {
@@ -0,0 +1,61 @@
1
+ /** The public keys a requested key may be encrypted to: P-256 or X25519, as a JWK without its private part. */
2
+ export type RecipientPublicKey = {
3
+ readonly kty: 'EC';
4
+ readonly crv: 'P-256';
5
+ readonly x: string;
6
+ readonly y: string;
7
+ } | {
8
+ readonly kty: 'OKP';
9
+ readonly crv: 'X25519';
10
+ readonly x: string;
11
+ };
12
+ export declare const RECIPIENT_CURVES: readonly ["P-256", "X25519"];
13
+ /** The JWE a requested key travels in: compact, key agreement `ECDH-ES` straight to the recipient, `A256GCM` content. */
14
+ export declare const REQUESTED_KEY_JWE: {
15
+ readonly alg: "ECDH-ES";
16
+ readonly enc: "A256GCM";
17
+ };
18
+ /**
19
+ * The RFC 7638 thumbprint of a recipient key (SHA-256, base64url): what the approval page shows and the agent prints
20
+ * beside the link, and the `kid` of the JWE IAM answers.
21
+ */
22
+ export declare function recipientKeyThumbprint(key: RecipientPublicKey): string;
23
+ /** Who asked for a requested key, as IAM records it beside the approver. */
24
+ export interface RequestedKeyApprovalRequest {
25
+ /** The Control approval request's id: the idempotency key of the issuance. At most 200 characters. */
26
+ id: string;
27
+ requester: {
28
+ id: string;
29
+ label: string;
30
+ clientId?: string;
31
+ };
32
+ }
33
+ /**
34
+ * `apiKeys.provisionRequested`: a service key a person approved in Control, issued by that person in a signed-in session.
35
+ * Its permissions are exact actions of `app`, in one scope value or global, and it expires at most 30 days ahead.
36
+ */
37
+ export interface ProvisionRequestedApiKeyRequest {
38
+ label: string;
39
+ app: string;
40
+ permissions: string[];
41
+ scopeType: string | null;
42
+ scopeValue: string | null;
43
+ /** Unix seconds; at most `MAX_KEY_LIFETIME_SECONDS` ahead. */
44
+ expiresAt: number;
45
+ recipient: RecipientPublicKey;
46
+ approvalRequest: RequestedKeyApprovalRequest;
47
+ }
48
+ /** A requested key as IAM answers it: its service principal, and the key encrypted to the recipient. */
49
+ export interface RequestedApiKey {
50
+ principalId: string;
51
+ /** The `px_` key, encrypted to the recipient (`REQUESTED_KEY_JWE`), whose thumbprint is the JWE's `kid`. */
52
+ jwe: string;
53
+ expiresAt: number;
54
+ }
55
+ export interface RequestedApiKeyInput {
56
+ approvalRequestId: string;
57
+ }
58
+ /** `apiKeys.requested`: the key an approval request issued, or null when it issued none. */
59
+ export interface RequestedApiKeyResponse {
60
+ key: RequestedApiKey | null;
61
+ }
@@ -0,0 +1,15 @@
1
+ /** The installation's SCIM provisioning as the console shows it. */
2
+ export interface ScimSettingsDto {
3
+ /** The tenant URL an identity provider is configured with: IAM's origin and `/scim/v2`. */
4
+ endpoint: string;
5
+ /** Whether a token exists; without one IAM refuses every SCIM request. */
6
+ configured: boolean;
7
+ /** When the current token was created, in epoch seconds; null without one. */
8
+ createdAt: number | null;
9
+ }
10
+ /** A token just created: the secret is in this answer and nowhere else, ever again. */
11
+ export interface ScimTokenIssuedDto extends ScimSettingsDto {
12
+ configured: true;
13
+ createdAt: number;
14
+ token: string;
15
+ }