@marinoscar/vault-contract 0.1.0-next.3 → 0.1.0-next.4
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/CHANGELOG.md +16 -0
- package/README.md +17 -5
- package/dist/cjs/agent/cards-identity.d.ts +456 -0
- package/dist/cjs/agent/cards-identity.js +272 -0
- package/dist/cjs/agent/contract-version.d.ts +58 -0
- package/dist/cjs/agent/contract-version.js +58 -0
- package/dist/cjs/agent/index.d.ts +196 -54
- package/dist/cjs/agent/index.js +176 -37
- package/dist/cjs/agent-testing/canary.d.ts +57 -0
- package/dist/cjs/agent-testing/canary.js +165 -0
- package/dist/cjs/agent-testing/fake-vault.d.ts +111 -0
- package/dist/cjs/agent-testing/fake-vault.js +707 -0
- package/dist/cjs/agent-testing/guard.d.ts +16 -0
- package/dist/cjs/agent-testing/guard.js +28 -0
- package/dist/cjs/agent-testing/index.d.ts +28 -0
- package/dist/cjs/agent-testing/index.js +43 -0
- package/dist/cjs/agent-testing/recorder.d.ts +70 -0
- package/dist/cjs/agent-testing/recorder.js +127 -0
- package/dist/cjs/agent-testing/reference-runtime.d.ts +8 -0
- package/dist/cjs/agent-testing/reference-runtime.js +112 -0
- package/dist/cjs/agent-testing/scenarios.d.ts +128 -0
- package/dist/cjs/agent-testing/scenarios.js +566 -0
- package/dist/cjs/agent-testing/seed.d.ts +84 -0
- package/dist/cjs/agent-testing/seed.js +89 -0
- package/dist/cjs/agent-testing/totp.d.ts +10 -0
- package/dist/cjs/agent-testing/totp.js +45 -0
- package/dist/cjs/errors/index.js +13 -1
- package/dist/cjs/media/index.d.ts +2 -2
- package/dist/cjs/secret-types/index.d.ts +4 -0
- package/dist/cjs/secret-types/index.js +29 -1
- package/dist/cjs/secrets/index.d.ts +13 -3
- package/dist/cjs/secrets/index.js +14 -3
- package/dist/esm/agent/cards-identity.d.ts +456 -0
- package/dist/esm/agent/cards-identity.js +266 -0
- package/dist/esm/agent/contract-version.d.ts +58 -0
- package/dist/esm/agent/contract-version.js +54 -0
- package/dist/esm/agent/index.d.ts +196 -54
- package/dist/esm/agent/index.js +160 -36
- package/dist/esm/agent-testing/canary.d.ts +57 -0
- package/dist/esm/agent-testing/canary.js +157 -0
- package/dist/esm/agent-testing/fake-vault.d.ts +111 -0
- package/dist/esm/agent-testing/fake-vault.js +704 -0
- package/dist/esm/agent-testing/guard.d.ts +16 -0
- package/dist/esm/agent-testing/guard.js +23 -0
- package/dist/esm/agent-testing/index.d.ts +28 -0
- package/dist/esm/agent-testing/index.js +27 -0
- package/dist/esm/agent-testing/recorder.d.ts +70 -0
- package/dist/esm/agent-testing/recorder.js +122 -0
- package/dist/esm/agent-testing/reference-runtime.d.ts +8 -0
- package/dist/esm/agent-testing/reference-runtime.js +109 -0
- package/dist/esm/agent-testing/scenarios.d.ts +128 -0
- package/dist/esm/agent-testing/scenarios.js +560 -0
- package/dist/esm/agent-testing/seed.d.ts +84 -0
- package/dist/esm/agent-testing/seed.js +85 -0
- package/dist/esm/agent-testing/totp.d.ts +10 -0
- package/dist/esm/agent-testing/totp.js +42 -0
- package/dist/esm/errors/index.js +13 -1
- package/dist/esm/media/index.d.ts +2 -2
- package/dist/esm/secret-types/index.d.ts +4 -0
- package/dist/esm/secret-types/index.js +28 -0
- package/dist/esm/secrets/index.d.ts +13 -3
- package/dist/esm/secrets/index.js +13 -2
- package/package.json +11 -1
|
@@ -10,26 +10,43 @@ import { z } from 'zod';
|
|
|
10
10
|
* is the API's; the error codes are in {@link AGENT_ERROR_CODES}. The path carries the version: an
|
|
11
11
|
* incompatible change is `/api/agent/v2`.
|
|
12
12
|
*
|
|
13
|
+
* Stability: **beta** (issue #196). Inside `/api/agent/v1` the route paths, the required request
|
|
14
|
+
* fields, the meaning of each error code, the scope names and the one-secret-field-per-response rule
|
|
15
|
+
* do not change. New optional request fields, new response fields, new error codes and scopes for
|
|
16
|
+
* new routes and stricter rate-limit defaults may arrive without a new version: ignore unknown
|
|
17
|
+
* response fields and unknown enum values, and never branch on `message`. Anything else is
|
|
18
|
+
* `/api/agent/v2`, and `v1` keeps working for two minor releases of the packages after `v2` ships.
|
|
19
|
+
* The tag becomes `stable` at 1.0. Changes are listed under "Changes" in
|
|
20
|
+
* `docs/agent-credential-api.md`; {@link AGENT_CONTRACT_VERSION} is the current version.
|
|
21
|
+
*
|
|
13
22
|
* @packageDocumentation
|
|
14
23
|
*/
|
|
15
|
-
/** The API's base path (the `agent` protected resource). @stability
|
|
24
|
+
/** The API's base path (the `agent` protected resource). @stability beta */
|
|
16
25
|
export declare const AGENT_API_BASE_PATH: "/api/agent/v1";
|
|
17
26
|
/**
|
|
18
27
|
* The OAuth scope ids of the agent resource (permanent: clients persist them). The platform's scope
|
|
19
28
|
* id pattern rules out dots, so they are `vault:items_*`.
|
|
20
29
|
*
|
|
21
|
-
* @stability
|
|
30
|
+
* @stability beta
|
|
22
31
|
*/
|
|
23
32
|
export declare const AGENT_SCOPES: {
|
|
24
33
|
readonly ITEMS_READ: "vault:items_read";
|
|
25
34
|
readonly ITEMS_FILL: "vault:items_fill";
|
|
26
35
|
readonly ITEMS_WRITE: "vault:items_write";
|
|
36
|
+
/** List the opened cards that have a live grant for a merchant (ADR-0003). */
|
|
37
|
+
readonly CARDS_READ: "vault:cards_read";
|
|
38
|
+
/** Fill one field of a granted card, and ask the owner for a grant. */
|
|
39
|
+
readonly CARDS_FILL: "vault:cards_fill";
|
|
40
|
+
/** List the opened identity items and the labels of their fields. */
|
|
41
|
+
readonly IDENTITY_READ: "vault:identity_read";
|
|
42
|
+
/** Fill one field of an opened identity item. */
|
|
43
|
+
readonly IDENTITY_FILL: "vault:identity_fill";
|
|
27
44
|
};
|
|
28
45
|
/**
|
|
29
46
|
* Error codes of the agent API, as they appear in `{ code }`. They are also in
|
|
30
47
|
* `VAULT_ERROR_CODES` (`@marinoscar/vault-contract/errors`) with their statuses.
|
|
31
48
|
*
|
|
32
|
-
* @stability
|
|
49
|
+
* @stability beta
|
|
33
50
|
*/
|
|
34
51
|
export declare const AGENT_ERROR_CODES: {
|
|
35
52
|
/** 403: the `origin` is not exactly one of the credential's origins. */
|
|
@@ -42,13 +59,35 @@ export declare const AGENT_ERROR_CODES: {
|
|
|
42
59
|
readonly RATE_LIMITED: "RATE_LIMITED";
|
|
43
60
|
/** 403: `GET /api/agent-activity` was called with an OAuth access token; an agent cannot read its own trail. */
|
|
44
61
|
readonly AGENT_ACTIVITY_FORBIDDEN: "AGENT_ACTIVITY_FORBIDDEN";
|
|
62
|
+
/** 403: the deployment's `agentAccess.cards.enabled` switch is off (ADR-0003). */
|
|
63
|
+
readonly CARD_ACCESS_DISABLED: "CARD_ACCESS_DISABLED";
|
|
64
|
+
/** 403: the deployment's `agentAccess.identity.enabled` switch is off (ADR-0003). */
|
|
65
|
+
readonly IDENTITY_ACCESS_DISABLED: "IDENTITY_ACCESS_DISABLED";
|
|
66
|
+
/** 403: `securityCode` was asked for under a grant that does not include it. */
|
|
67
|
+
readonly SECURITY_CODE_NOT_GRANTED: "SECURITY_CODE_NOT_GRANTED";
|
|
68
|
+
/** 403: the amount is above the grant's maximum. */
|
|
69
|
+
readonly CARD_AMOUNT_EXCEEDED: "CARD_AMOUNT_EXCEEDED";
|
|
70
|
+
/** 403: the currency is not the grant's. */
|
|
71
|
+
readonly CARD_CURRENCY_MISMATCH: "CARD_CURRENCY_MISMATCH";
|
|
72
|
+
/** 403: the grant's period limit (releases or total amount per day or month) was reached. */
|
|
73
|
+
readonly CARD_PERIOD_LIMIT_REACHED: "CARD_PERIOD_LIMIT_REACHED";
|
|
74
|
+
/** 403: the deployment's per-card daily cap of releases was reached. */
|
|
75
|
+
readonly CARD_DAILY_CAP_REACHED: "CARD_DAILY_CAP_REACHED";
|
|
76
|
+
/** 403: the card's grant for this merchant has expired. */
|
|
77
|
+
readonly CARD_GRANT_EXPIRED: "CARD_GRANT_EXPIRED";
|
|
78
|
+
/** 409: the card already has a live grant for this merchant site. */
|
|
79
|
+
readonly CARD_GRANT_EXISTS: "CARD_GRANT_EXISTS";
|
|
80
|
+
/** 409: the grant request was already approved or declined. */
|
|
81
|
+
readonly CARD_GRANT_REQUEST_NOT_PENDING: "CARD_GRANT_REQUEST_NOT_PENDING";
|
|
82
|
+
/** 403: the route changes what agents may do and needs the owner's browser session, never a token. */
|
|
83
|
+
readonly OWNER_SESSION_REQUIRED: "OWNER_SESSION_REQUIRED";
|
|
45
84
|
};
|
|
46
|
-
/** @stability
|
|
85
|
+
/** @stability beta */
|
|
47
86
|
export type AgentErrorCode = (typeof AGENT_ERROR_CODES)[keyof typeof AGENT_ERROR_CODES];
|
|
48
87
|
/**
|
|
49
88
|
* Why the agent is asking: stored in the audit row of fill, totp, create and rotate.
|
|
50
89
|
*
|
|
51
|
-
* @stability
|
|
90
|
+
* @stability beta
|
|
52
91
|
*/
|
|
53
92
|
export declare const agentPurposeSchema: z.ZodEnum<{
|
|
54
93
|
login: "login";
|
|
@@ -56,24 +95,24 @@ export declare const agentPurposeSchema: z.ZodEnum<{
|
|
|
56
95
|
password_change: "password_change";
|
|
57
96
|
mfa: "mfa";
|
|
58
97
|
}>;
|
|
59
|
-
/** @stability
|
|
98
|
+
/** @stability beta */
|
|
60
99
|
export type AgentPurpose = z.infer<typeof agentPurposeSchema>;
|
|
61
|
-
/** The one field a fill call returns. @stability
|
|
100
|
+
/** The one field a fill call returns. @stability beta */
|
|
62
101
|
export declare const agentFillFieldSchema: z.ZodEnum<{
|
|
63
102
|
username: "username";
|
|
64
103
|
password: "password";
|
|
65
104
|
}>;
|
|
66
|
-
/** @stability
|
|
105
|
+
/** @stability beta */
|
|
67
106
|
export type AgentFillField = z.infer<typeof agentFillFieldSchema>;
|
|
68
|
-
/** An origin as the agent sees it: a URL or bare host, normalized by the API. @stability
|
|
107
|
+
/** An origin as the agent sees it: a URL or bare host, normalized by the API. @stability beta */
|
|
69
108
|
export declare const agentOriginSchema: z.ZodString;
|
|
70
|
-
/** Query of `GET /api/agent/v1/credentials`. @stability
|
|
109
|
+
/** Query of `GET /api/agent/v1/credentials`. @stability beta */
|
|
71
110
|
export declare const agentLookupQuerySchema: z.ZodObject<{
|
|
72
111
|
origin: z.ZodString;
|
|
73
112
|
}, z.core.$strip>;
|
|
74
|
-
/** @stability
|
|
113
|
+
/** @stability beta */
|
|
75
114
|
export type AgentLookupQuery = z.infer<typeof agentLookupQuerySchema>;
|
|
76
|
-
/** One credential found for an origin. Never carries a sensitive value. @stability
|
|
115
|
+
/** One credential found for an origin. Never carries a sensitive value. @stability beta */
|
|
77
116
|
export declare const agentCredentialSummarySchema: z.ZodObject<{
|
|
78
117
|
id: z.ZodString;
|
|
79
118
|
name: z.ZodString;
|
|
@@ -86,9 +125,9 @@ export declare const agentCredentialSummarySchema: z.ZodObject<{
|
|
|
86
125
|
hasTotp: z.ZodBoolean;
|
|
87
126
|
updatedAt: z.ZodString;
|
|
88
127
|
}, z.core.$strip>;
|
|
89
|
-
/** @stability
|
|
128
|
+
/** @stability beta */
|
|
90
129
|
export type AgentCredentialSummary = z.infer<typeof agentCredentialSummarySchema>;
|
|
91
|
-
/** Response of `GET /api/agent/v1/credentials`. Exact matches first. @stability
|
|
130
|
+
/** Response of `GET /api/agent/v1/credentials`. Exact matches first. @stability beta */
|
|
92
131
|
export declare const agentLookupResponseSchema: z.ZodObject<{
|
|
93
132
|
data: z.ZodArray<z.ZodObject<{
|
|
94
133
|
id: z.ZodString;
|
|
@@ -103,7 +142,7 @@ export declare const agentLookupResponseSchema: z.ZodObject<{
|
|
|
103
142
|
updatedAt: z.ZodString;
|
|
104
143
|
}, z.core.$strip>>;
|
|
105
144
|
}, z.core.$strip>;
|
|
106
|
-
/** Body of `POST /api/agent/v1/credentials/:id/fill`. @stability
|
|
145
|
+
/** Body of `POST /api/agent/v1/credentials/:id/fill`. @stability beta */
|
|
107
146
|
export declare const agentFillRequestSchema: z.ZodObject<{
|
|
108
147
|
field: z.ZodEnum<{
|
|
109
148
|
username: "username";
|
|
@@ -117,15 +156,15 @@ export declare const agentFillRequestSchema: z.ZodObject<{
|
|
|
117
156
|
mfa: "mfa";
|
|
118
157
|
}>;
|
|
119
158
|
}, z.core.$strip>;
|
|
120
|
-
/** @stability
|
|
159
|
+
/** @stability beta */
|
|
121
160
|
export type AgentFillRequest = z.infer<typeof agentFillRequestSchema>;
|
|
122
|
-
/** Response of the fill route: one value. Type it, never show it to a model. @stability
|
|
161
|
+
/** Response of the fill route: one value. Type it, never show it to a model. @stability beta */
|
|
123
162
|
export declare const agentFillResponseSchema: z.ZodObject<{
|
|
124
163
|
data: z.ZodObject<{
|
|
125
164
|
value: z.ZodString;
|
|
126
165
|
}, z.core.$strip>;
|
|
127
166
|
}, z.core.$strip>;
|
|
128
|
-
/** Body of `POST /api/agent/v1/credentials/:id/totp`. @stability
|
|
167
|
+
/** Body of `POST /api/agent/v1/credentials/:id/totp`. @stability beta */
|
|
129
168
|
export declare const agentTotpRequestSchema: z.ZodObject<{
|
|
130
169
|
origin: z.ZodString;
|
|
131
170
|
purpose: z.ZodEnum<{
|
|
@@ -135,35 +174,35 @@ export declare const agentTotpRequestSchema: z.ZodObject<{
|
|
|
135
174
|
mfa: "mfa";
|
|
136
175
|
}>;
|
|
137
176
|
}, z.core.$strip>;
|
|
138
|
-
/** @stability
|
|
177
|
+
/** @stability beta */
|
|
139
178
|
export type AgentTotpRequest = z.infer<typeof agentTotpRequestSchema>;
|
|
140
|
-
/** Response of the totp route. `expiresAt` is an ISO timestamp. @stability
|
|
179
|
+
/** Response of the totp route. `expiresAt` is an ISO timestamp. @stability beta */
|
|
141
180
|
export declare const agentTotpResponseSchema: z.ZodObject<{
|
|
142
181
|
data: z.ZodObject<{
|
|
143
182
|
code: z.ZodString;
|
|
144
183
|
expiresAt: z.ZodString;
|
|
145
184
|
}, z.core.$strip>;
|
|
146
185
|
}, z.core.$strip>;
|
|
147
|
-
/** Smallest and largest generated password length. @stability
|
|
186
|
+
/** Smallest and largest generated password length. @stability beta */
|
|
148
187
|
export declare const AGENT_GENERATED_PASSWORD_MIN_LENGTH = 12;
|
|
149
|
-
/** @stability
|
|
188
|
+
/** @stability beta */
|
|
150
189
|
export declare const AGENT_GENERATED_PASSWORD_MAX_LENGTH = 128;
|
|
151
|
-
/** Length of a generated password when `generate.length` is omitted. @stability
|
|
190
|
+
/** Length of a generated password when `generate.length` is omitted. @stability beta */
|
|
152
191
|
export declare const AGENT_GENERATED_PASSWORD_DEFAULT_LENGTH = 24;
|
|
153
192
|
/**
|
|
154
193
|
* Ask Vault to generate the password: `length` 12 to 128 (default 24), `symbols` (default true).
|
|
155
194
|
* The result has at least one lower-case letter, upper-case letter and digit, and one symbol when
|
|
156
195
|
* `symbols` is on.
|
|
157
196
|
*
|
|
158
|
-
* @stability
|
|
197
|
+
* @stability beta
|
|
159
198
|
*/
|
|
160
199
|
export declare const agentGeneratePasswordSchema: z.ZodObject<{
|
|
161
200
|
length: z.ZodDefault<z.ZodNumber>;
|
|
162
201
|
symbols: z.ZodDefault<z.ZodBoolean>;
|
|
163
202
|
}, z.core.$strip>;
|
|
164
|
-
/** @stability
|
|
203
|
+
/** @stability beta */
|
|
165
204
|
export type AgentGeneratePassword = z.infer<typeof agentGeneratePasswordSchema>;
|
|
166
|
-
/** Body of `POST /api/agent/v1/credentials`: exactly one of `password` and `generate`. @stability
|
|
205
|
+
/** Body of `POST /api/agent/v1/credentials`: exactly one of `password` and `generate`. @stability beta */
|
|
167
206
|
export declare const agentCreateCredentialRequestSchema: z.ZodObject<{
|
|
168
207
|
name: z.ZodString;
|
|
169
208
|
username: z.ZodString;
|
|
@@ -181,13 +220,13 @@ export declare const agentCreateCredentialRequestSchema: z.ZodObject<{
|
|
|
181
220
|
mfa: "mfa";
|
|
182
221
|
}>;
|
|
183
222
|
}, z.core.$strip>;
|
|
184
|
-
/** @stability
|
|
223
|
+
/** @stability beta */
|
|
185
224
|
export type AgentCreateCredentialRequest = z.infer<typeof agentCreateCredentialRequestSchema>;
|
|
186
225
|
/**
|
|
187
226
|
* Response of the create route. `generatedPassword` is present only when `generate` was sent, and
|
|
188
227
|
* only in this response: Vault never returns it again.
|
|
189
228
|
*
|
|
190
|
-
* @stability
|
|
229
|
+
* @stability beta
|
|
191
230
|
*/
|
|
192
231
|
export declare const agentCreateCredentialResponseSchema: z.ZodObject<{
|
|
193
232
|
data: z.ZodObject<{
|
|
@@ -198,7 +237,7 @@ export declare const agentCreateCredentialResponseSchema: z.ZodObject<{
|
|
|
198
237
|
generatedPassword: z.ZodOptional<z.ZodString>;
|
|
199
238
|
}, z.core.$strip>;
|
|
200
239
|
}, z.core.$strip>;
|
|
201
|
-
/** Body of `POST /api/agent/v1/credentials/:id/password`: exactly one of `password` and `generate`. @stability
|
|
240
|
+
/** Body of `POST /api/agent/v1/credentials/:id/password`: exactly one of `password` and `generate`. @stability beta */
|
|
202
241
|
export declare const agentRotatePasswordRequestSchema: z.ZodObject<{
|
|
203
242
|
origin: z.ZodString;
|
|
204
243
|
password: z.ZodOptional<z.ZodString>;
|
|
@@ -213,9 +252,9 @@ export declare const agentRotatePasswordRequestSchema: z.ZodObject<{
|
|
|
213
252
|
mfa: "mfa";
|
|
214
253
|
}>;
|
|
215
254
|
}, z.core.$strip>;
|
|
216
|
-
/** @stability
|
|
255
|
+
/** @stability beta */
|
|
217
256
|
export type AgentRotatePasswordRequest = z.infer<typeof agentRotatePasswordRequestSchema>;
|
|
218
|
-
/** Response of the rotate route: the new version number, and the generated value once. @stability
|
|
257
|
+
/** Response of the rotate route: the new version number, and the generated value once. @stability beta */
|
|
219
258
|
export declare const agentRotatePasswordResponseSchema: z.ZodObject<{
|
|
220
259
|
data: z.ZodObject<{
|
|
221
260
|
id: z.ZodString;
|
|
@@ -223,19 +262,31 @@ export declare const agentRotatePasswordResponseSchema: z.ZodObject<{
|
|
|
223
262
|
generatedPassword: z.ZodOptional<z.ZodString>;
|
|
224
263
|
}, z.core.$strip>;
|
|
225
264
|
}, z.core.$strip>;
|
|
226
|
-
/**
|
|
265
|
+
/**
|
|
266
|
+
* Response of `GET /api/agent/v1/whoami`. `contract` (since contract 1.2) is the contract version
|
|
267
|
+
* and the features this Vault offers now; it is absent on an older Vault, so treat a missing block
|
|
268
|
+
* as version `1.0` with `logins` and `totp`.
|
|
269
|
+
*
|
|
270
|
+
* @stability beta
|
|
271
|
+
*/
|
|
227
272
|
export declare const agentWhoamiResponseSchema: z.ZodObject<{
|
|
228
273
|
data: z.ZodObject<{
|
|
229
274
|
userId: z.ZodString;
|
|
230
275
|
scopes: z.ZodArray<z.ZodString>;
|
|
231
276
|
clientId: z.ZodNullable<z.ZodString>;
|
|
277
|
+
contract: z.ZodOptional<z.ZodObject<{
|
|
278
|
+
version: z.ZodString;
|
|
279
|
+
features: z.ZodArray<z.ZodString>;
|
|
280
|
+
}, z.core.$strip>>;
|
|
232
281
|
}, z.core.$strip>;
|
|
233
282
|
}, z.core.$strip>;
|
|
283
|
+
/** @stability beta */
|
|
284
|
+
export type AgentWhoamiResponse = z.infer<typeof agentWhoamiResponseSchema>;
|
|
234
285
|
/**
|
|
235
286
|
* The audit actions the agent API writes (`audit_events.action`), one per route. The `result` of
|
|
236
287
|
* the row's meta is `ok` or `denied:<reason>`.
|
|
237
288
|
*
|
|
238
|
-
* @stability
|
|
289
|
+
* @stability beta
|
|
239
290
|
*/
|
|
240
291
|
export declare const AGENT_AUDIT_ACTIONS: {
|
|
241
292
|
readonly LOOKUP: "agent.credential.lookup";
|
|
@@ -243,15 +294,46 @@ export declare const AGENT_AUDIT_ACTIONS: {
|
|
|
243
294
|
readonly TOTP: "agent.credential.totp";
|
|
244
295
|
readonly CREATE: "agent.credential.create";
|
|
245
296
|
readonly ROTATE: "agent.credential.rotate";
|
|
297
|
+
readonly CARD_LOOKUP: "agent.card.lookup";
|
|
298
|
+
readonly CARD_FILL: "agent.card.fill";
|
|
299
|
+
readonly CARD_GRANT_REQUEST: "agent.card.grant_request";
|
|
300
|
+
readonly IDENTITY_LOOKUP: "agent.identity.lookup";
|
|
301
|
+
readonly IDENTITY_FILL: "agent.identity.fill";
|
|
246
302
|
};
|
|
247
|
-
/** @stability
|
|
303
|
+
/** @stability beta */
|
|
248
304
|
export type AgentAuditAction = (typeof AGENT_AUDIT_ACTIONS)[keyof typeof AGENT_AUDIT_ACTIONS];
|
|
305
|
+
/**
|
|
306
|
+
* The card part of the `agentAccess` settings (ADR-0003): the card kill switch (default off), the
|
|
307
|
+
* `card_fill` bucket's per-minute limit and the per-card daily cap of releases (`number` fills).
|
|
308
|
+
*
|
|
309
|
+
* @stability beta
|
|
310
|
+
*/
|
|
311
|
+
export declare const agentCardAccessSettingsSchema: z.ZodObject<{
|
|
312
|
+
enabled: z.ZodBoolean;
|
|
313
|
+
fillPerMinute: z.ZodNumber;
|
|
314
|
+
releasesPerCardPerDay: z.ZodNumber;
|
|
315
|
+
}, z.core.$strip>;
|
|
316
|
+
/** @stability beta */
|
|
317
|
+
export type AgentCardAccessSettings = z.infer<typeof agentCardAccessSettingsSchema>;
|
|
318
|
+
/**
|
|
319
|
+
* The identity part of the `agentAccess` settings (ADR-0003): the identity kill switch (default off)
|
|
320
|
+
* and the `identity_fill` bucket's per-minute limit.
|
|
321
|
+
*
|
|
322
|
+
* @stability beta
|
|
323
|
+
*/
|
|
324
|
+
export declare const agentIdentityAccessSettingsSchema: z.ZodObject<{
|
|
325
|
+
enabled: z.ZodBoolean;
|
|
326
|
+
fillPerMinute: z.ZodNumber;
|
|
327
|
+
}, z.core.$strip>;
|
|
328
|
+
/** @stability beta */
|
|
329
|
+
export type AgentIdentityAccessSettings = z.infer<typeof agentIdentityAccessSettingsSchema>;
|
|
249
330
|
/**
|
|
250
331
|
* The `agentAccess` system settings namespace: the kill switch and the per-minute limits of the
|
|
251
332
|
* agent API. `enabled` defaults to `false`: until an administrator switches it on, every agent
|
|
252
333
|
* route answers `403 AGENT_ACCESS_DISABLED`. Each limit counts per token (or OAuth grant) and user.
|
|
334
|
+
* `cards` and `identity` are separate switches (default off) for card and identity release.
|
|
253
335
|
*
|
|
254
|
-
* @stability
|
|
336
|
+
* @stability beta
|
|
255
337
|
*/
|
|
256
338
|
export declare const agentAccessSettingsSchema: z.ZodObject<{
|
|
257
339
|
enabled: z.ZodBoolean;
|
|
@@ -259,76 +341,122 @@ export declare const agentAccessSettingsSchema: z.ZodObject<{
|
|
|
259
341
|
fillPerMinute: z.ZodNumber;
|
|
260
342
|
totpPerMinute: z.ZodNumber;
|
|
261
343
|
writePerMinute: z.ZodNumber;
|
|
344
|
+
cards: z.ZodObject<{
|
|
345
|
+
enabled: z.ZodBoolean;
|
|
346
|
+
fillPerMinute: z.ZodNumber;
|
|
347
|
+
releasesPerCardPerDay: z.ZodNumber;
|
|
348
|
+
}, z.core.$strip>;
|
|
349
|
+
identity: z.ZodObject<{
|
|
350
|
+
enabled: z.ZodBoolean;
|
|
351
|
+
fillPerMinute: z.ZodNumber;
|
|
352
|
+
}, z.core.$strip>;
|
|
262
353
|
}, z.core.$strip>;
|
|
263
|
-
/** @stability
|
|
354
|
+
/** @stability beta */
|
|
264
355
|
export type AgentAccessSettings = z.infer<typeof agentAccessSettingsSchema>;
|
|
265
|
-
/**
|
|
356
|
+
/**
|
|
357
|
+
* Defaults of {@link agentAccessSettingsSchema}: off, lookup 60, fill 30, totp 10, write 10 per
|
|
358
|
+
* minute; cards off, 10 card fills per minute, 5 releases per card per day; identity off, 20
|
|
359
|
+
* identity fills per minute.
|
|
360
|
+
*
|
|
361
|
+
* @stability beta
|
|
362
|
+
*/
|
|
266
363
|
export declare const AGENT_ACCESS_SETTINGS_DEFAULTS: AgentAccessSettings;
|
|
267
|
-
/**
|
|
364
|
+
/**
|
|
365
|
+
* A stored (possibly older, partial) `agentAccess` value merged over the defaults, nested blocks
|
|
366
|
+
* included. A row written before ADR-0003 has no `cards` or `identity`: both stay off.
|
|
367
|
+
*
|
|
368
|
+
* @stability beta
|
|
369
|
+
*/
|
|
370
|
+
export declare function resolveAgentAccessSettings(stored: unknown): AgentAccessSettings;
|
|
371
|
+
/** The path of the owner's agent activity list (session or PAT, never an OAuth token). @stability beta */
|
|
268
372
|
export declare const AGENT_ACTIVITY_PATH: "/api/agent-activity";
|
|
269
|
-
/** The audit action of the per-secret agent access toggle (`secret.agent_access.update`). @stability
|
|
373
|
+
/** The audit action of the per-secret agent access toggle (`secret.agent_access.update`). @stability beta */
|
|
270
374
|
export declare const AGENT_ACCESS_TOGGLE_AUDIT_ACTION: "secret.agent_access.update";
|
|
271
|
-
/**
|
|
375
|
+
/**
|
|
376
|
+
* The actions an activity item carries: the agent routes (logins, cards, identity), the owner's
|
|
377
|
+
* toggle and the owner's grant decisions (`card_grant`: created, revoked, approved, declined).
|
|
378
|
+
*
|
|
379
|
+
* @stability beta
|
|
380
|
+
*/
|
|
272
381
|
export declare const agentActivityActionSchema: z.ZodEnum<{
|
|
382
|
+
totp: "totp";
|
|
273
383
|
lookup: "lookup";
|
|
274
384
|
fill: "fill";
|
|
275
|
-
totp: "totp";
|
|
276
385
|
create: "create";
|
|
277
386
|
rotate: "rotate";
|
|
278
387
|
agent_access: "agent_access";
|
|
388
|
+
card_lookup: "card_lookup";
|
|
389
|
+
card_fill: "card_fill";
|
|
390
|
+
card_grant_request: "card_grant_request";
|
|
391
|
+
identity_lookup: "identity_lookup";
|
|
392
|
+
identity_fill: "identity_fill";
|
|
393
|
+
card_grant: "card_grant";
|
|
279
394
|
}>;
|
|
280
|
-
/** @stability
|
|
395
|
+
/** @stability beta */
|
|
281
396
|
export type AgentActivityAction = z.infer<typeof agentActivityActionSchema>;
|
|
282
|
-
/** The kind of credential a call authenticated with. @stability
|
|
397
|
+
/** The kind of credential a call authenticated with. @stability beta */
|
|
283
398
|
export declare const agentActivityCredentialKindSchema: z.ZodEnum<{
|
|
284
399
|
oauth: "oauth";
|
|
285
400
|
pat: "pat";
|
|
286
401
|
session: "session";
|
|
402
|
+
embedded: "embedded";
|
|
287
403
|
}>;
|
|
288
|
-
/** @stability
|
|
404
|
+
/** @stability beta */
|
|
289
405
|
export type AgentActivityCredentialKind = z.infer<typeof agentActivityCredentialKindSchema>;
|
|
290
|
-
/** The largest `pageSize` of the activity list. @stability
|
|
406
|
+
/** The largest `pageSize` of the activity list. @stability beta */
|
|
291
407
|
export declare const AGENT_ACTIVITY_MAX_PAGE_SIZE = 100;
|
|
292
408
|
/**
|
|
293
409
|
* Query of `GET /api/agent-activity`. `action` is one of {@link agentActivityActionSchema};
|
|
294
410
|
* `from` and `to` are ISO 8601 instants (inclusive); `clientId` is the OAuth client's id as on its grants (`OAuthGrant.clientId`, not the public client_id string).
|
|
295
411
|
*
|
|
296
|
-
* @stability
|
|
412
|
+
* @stability beta
|
|
297
413
|
*/
|
|
298
414
|
export declare const agentActivityQuerySchema: z.ZodObject<{
|
|
299
415
|
page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
300
416
|
pageSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
301
417
|
action: z.ZodOptional<z.ZodEnum<{
|
|
418
|
+
totp: "totp";
|
|
302
419
|
lookup: "lookup";
|
|
303
420
|
fill: "fill";
|
|
304
|
-
totp: "totp";
|
|
305
421
|
create: "create";
|
|
306
422
|
rotate: "rotate";
|
|
307
423
|
agent_access: "agent_access";
|
|
424
|
+
card_lookup: "card_lookup";
|
|
425
|
+
card_fill: "card_fill";
|
|
426
|
+
card_grant_request: "card_grant_request";
|
|
427
|
+
identity_lookup: "identity_lookup";
|
|
428
|
+
identity_fill: "identity_fill";
|
|
429
|
+
card_grant: "card_grant";
|
|
308
430
|
}>>;
|
|
309
431
|
secretId: z.ZodOptional<z.ZodString>;
|
|
310
432
|
clientId: z.ZodOptional<z.ZodString>;
|
|
311
433
|
from: z.ZodOptional<z.ZodString>;
|
|
312
434
|
to: z.ZodOptional<z.ZodString>;
|
|
313
435
|
}, z.core.$strip>;
|
|
314
|
-
/** @stability
|
|
436
|
+
/** @stability beta */
|
|
315
437
|
export type AgentActivityQuery = z.infer<typeof agentActivityQuerySchema>;
|
|
316
438
|
/**
|
|
317
439
|
* One event of the owner's agent trail. Never carries a value, a code, a seed or a password.
|
|
318
440
|
* `reason` is present on a denial (`origin_mismatch`, `rate_limited`, `not_found`, ...).
|
|
319
441
|
*
|
|
320
|
-
* @stability
|
|
442
|
+
* @stability beta
|
|
321
443
|
*/
|
|
322
444
|
export declare const agentActivityItemSchema: z.ZodObject<{
|
|
323
445
|
id: z.ZodString;
|
|
324
446
|
at: z.ZodString;
|
|
325
447
|
action: z.ZodEnum<{
|
|
448
|
+
totp: "totp";
|
|
326
449
|
lookup: "lookup";
|
|
327
450
|
fill: "fill";
|
|
328
|
-
totp: "totp";
|
|
329
451
|
create: "create";
|
|
330
452
|
rotate: "rotate";
|
|
331
453
|
agent_access: "agent_access";
|
|
454
|
+
card_lookup: "card_lookup";
|
|
455
|
+
card_fill: "card_fill";
|
|
456
|
+
card_grant_request: "card_grant_request";
|
|
457
|
+
identity_lookup: "identity_lookup";
|
|
458
|
+
identity_fill: "identity_fill";
|
|
459
|
+
card_grant: "card_grant";
|
|
332
460
|
}>;
|
|
333
461
|
result: z.ZodEnum<{
|
|
334
462
|
ok: "ok";
|
|
@@ -344,24 +472,33 @@ export declare const agentActivityItemSchema: z.ZodObject<{
|
|
|
344
472
|
oauth: "oauth";
|
|
345
473
|
pat: "pat";
|
|
346
474
|
session: "session";
|
|
475
|
+
embedded: "embedded";
|
|
347
476
|
}>>;
|
|
348
477
|
clientId: z.ZodNullable<z.ZodString>;
|
|
349
478
|
clientName: z.ZodNullable<z.ZodString>;
|
|
479
|
+
amount: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
480
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
350
481
|
}, z.core.$strip>;
|
|
351
|
-
/** @stability
|
|
482
|
+
/** @stability beta */
|
|
352
483
|
export type AgentActivityItem = z.infer<typeof agentActivityItemSchema>;
|
|
353
|
-
/** Response of `GET /api/agent-activity`. @stability
|
|
484
|
+
/** Response of `GET /api/agent-activity`. @stability beta */
|
|
354
485
|
export declare const agentActivityResponseSchema: z.ZodObject<{
|
|
355
486
|
data: z.ZodArray<z.ZodObject<{
|
|
356
487
|
id: z.ZodString;
|
|
357
488
|
at: z.ZodString;
|
|
358
489
|
action: z.ZodEnum<{
|
|
490
|
+
totp: "totp";
|
|
359
491
|
lookup: "lookup";
|
|
360
492
|
fill: "fill";
|
|
361
|
-
totp: "totp";
|
|
362
493
|
create: "create";
|
|
363
494
|
rotate: "rotate";
|
|
364
495
|
agent_access: "agent_access";
|
|
496
|
+
card_lookup: "card_lookup";
|
|
497
|
+
card_fill: "card_fill";
|
|
498
|
+
card_grant_request: "card_grant_request";
|
|
499
|
+
identity_lookup: "identity_lookup";
|
|
500
|
+
identity_fill: "identity_fill";
|
|
501
|
+
card_grant: "card_grant";
|
|
365
502
|
}>;
|
|
366
503
|
result: z.ZodEnum<{
|
|
367
504
|
ok: "ok";
|
|
@@ -377,9 +514,12 @@ export declare const agentActivityResponseSchema: z.ZodObject<{
|
|
|
377
514
|
oauth: "oauth";
|
|
378
515
|
pat: "pat";
|
|
379
516
|
session: "session";
|
|
517
|
+
embedded: "embedded";
|
|
380
518
|
}>>;
|
|
381
519
|
clientId: z.ZodNullable<z.ZodString>;
|
|
382
520
|
clientName: z.ZodNullable<z.ZodString>;
|
|
521
|
+
amount: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
522
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
383
523
|
}, z.core.$strip>>;
|
|
384
524
|
meta: z.ZodObject<{
|
|
385
525
|
page: z.ZodNumber;
|
|
@@ -387,5 +527,7 @@ export declare const agentActivityResponseSchema: z.ZodObject<{
|
|
|
387
527
|
total: z.ZodNumber;
|
|
388
528
|
}, z.core.$strip>;
|
|
389
529
|
}, z.core.$strip>;
|
|
390
|
-
/** @stability
|
|
530
|
+
/** @stability beta */
|
|
391
531
|
export type AgentActivityResponse = z.infer<typeof agentActivityResponseSchema>;
|
|
532
|
+
export * from './cards-identity.js';
|
|
533
|
+
export * from './contract-version.js';
|