@tokensrc/codex 1.14.16 → 1.14.17
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/README.md +73 -1
- package/dist/client.d.ts +21 -1
- package/dist/client.js +198 -3
- package/dist/client.js.map +1 -1
- package/dist/command-directory.js +3 -2
- package/dist/command-directory.js.map +1 -1
- package/dist/commands.js +478 -12
- package/dist/commands.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/managed-credential-v3-envelope.d.ts +40 -1
- package/dist/managed-credential-v3-envelope.js +118 -1
- package/dist/managed-credential-v3-envelope.js.map +1 -1
- package/dist/managed-credential-v3-flow.js +105 -21
- package/dist/managed-credential-v3-flow.js.map +1 -1
- package/dist/profile.d.ts +2 -0
- package/dist/profile.js +26 -1
- package/dist/profile.js.map +1 -1
- package/dist/protocol.d.ts +1107 -0
- package/dist/protocol.js +494 -0
- package/dist/protocol.js.map +1 -1
- package/dist/request-bound-device-v6-flow.d.ts +42 -0
- package/dist/request-bound-device-v6-flow.js +403 -0
- package/dist/request-bound-device-v6-flow.js.map +1 -0
- package/dist/request-bound-device-v6-state.d.ts +397 -0
- package/dist/request-bound-device-v6-state.js +221 -0
- package/dist/request-bound-device-v6-state.js.map +1 -0
- package/dist/selection.d.ts +5 -0
- package/dist/selection.js +20 -2
- package/dist/selection.js.map +1 -1
- package/dist/token-pool-v4-upload-flow.js +5 -1
- package/dist/token-pool-v4-upload-flow.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { CodexV6FullCredentialDeliveryResponseSchema } from "./protocol.js";
|
|
3
|
+
export declare const CodexV6BindingStateSchema: z.ZodObject<{
|
|
4
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
5
|
+
tenantId: z.ZodString;
|
|
6
|
+
subject: z.ZodString;
|
|
7
|
+
requestId: z.ZodString;
|
|
8
|
+
bindingId: z.ZodString;
|
|
9
|
+
predecessorBindingId: z.ZodNullable<z.ZodString>;
|
|
10
|
+
installationId: z.ZodString;
|
|
11
|
+
managedAccountId: z.ZodString;
|
|
12
|
+
providerAccountId: z.ZodString;
|
|
13
|
+
poolEntryId: z.ZodString;
|
|
14
|
+
credentialLineageId: z.ZodString;
|
|
15
|
+
generationVersion: z.ZodNumber;
|
|
16
|
+
accountExpiresAt: z.ZodNullable<z.ZodString>;
|
|
17
|
+
localAssignmentId: z.ZodString;
|
|
18
|
+
source: z.ZodEnum<{
|
|
19
|
+
ACCOUNT_REPLACEMENT: "ACCOUNT_REPLACEMENT";
|
|
20
|
+
ADMIN_ADDED: "ADMIN_ADDED";
|
|
21
|
+
LEGACY_AUTO_MIGRATED: "LEGACY_AUTO_MIGRATED";
|
|
22
|
+
REQUEST_INITIAL: "REQUEST_INITIAL";
|
|
23
|
+
}>;
|
|
24
|
+
status: z.ZodEnum<{
|
|
25
|
+
ACTIVE: "ACTIVE";
|
|
26
|
+
NEEDS_REAUTH: "NEEDS_REAUTH";
|
|
27
|
+
RETIREMENT_PENDING: "RETIREMENT_PENDING";
|
|
28
|
+
}>;
|
|
29
|
+
updatedAt: z.ZodString;
|
|
30
|
+
}, z.core.$strict>;
|
|
31
|
+
export declare const CodexV6DeliveryJournalSchema: z.ZodObject<{
|
|
32
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
33
|
+
tenantId: z.ZodString;
|
|
34
|
+
subject: z.ZodString;
|
|
35
|
+
requestId: z.ZodString;
|
|
36
|
+
bindingId: z.ZodString;
|
|
37
|
+
installationId: z.ZodString;
|
|
38
|
+
expectedManagedAccountId: z.ZodString;
|
|
39
|
+
expectedProviderAccountId: z.ZodString;
|
|
40
|
+
expectedPoolEntryId: z.ZodString;
|
|
41
|
+
expectedCredentialLineageId: z.ZodString;
|
|
42
|
+
clientRequestId: z.ZodString;
|
|
43
|
+
idempotencyKey: z.ZodString;
|
|
44
|
+
ackIdempotencyKey: z.ZodString;
|
|
45
|
+
clientKey: z.ZodObject<{
|
|
46
|
+
version: z.ZodLiteral<1>;
|
|
47
|
+
algorithm: z.ZodLiteral<"X25519-HKDF-SHA256-AES-256-GCM">;
|
|
48
|
+
publicKey: z.ZodString;
|
|
49
|
+
}, z.core.$strict>;
|
|
50
|
+
privateKeyPkcs8: z.ZodString;
|
|
51
|
+
response: z.ZodNullable<z.ZodObject<{
|
|
52
|
+
schemaVersion: z.ZodLiteral<6>;
|
|
53
|
+
delivery: z.ZodObject<{
|
|
54
|
+
id: z.ZodString;
|
|
55
|
+
clientRequestId: z.ZodString;
|
|
56
|
+
requestId: z.ZodString;
|
|
57
|
+
bindingId: z.ZodString;
|
|
58
|
+
installationId: z.ZodString;
|
|
59
|
+
managedAccountId: z.ZodString;
|
|
60
|
+
providerAccountId: z.ZodString;
|
|
61
|
+
credentialLineageId: z.ZodString;
|
|
62
|
+
generationVersion: z.ZodNumber;
|
|
63
|
+
issuedAt: z.ZodString;
|
|
64
|
+
credentialExpiresAt: z.ZodString;
|
|
65
|
+
ackExpiresAt: z.ZodString;
|
|
66
|
+
ackedAt: z.ZodNullable<z.ZodString>;
|
|
67
|
+
status: z.ZodLiteral<"AWAITING_ACK">;
|
|
68
|
+
envelope: z.ZodObject<{
|
|
69
|
+
version: z.ZodLiteral<1>;
|
|
70
|
+
algorithm: z.ZodLiteral<"X25519-HKDF-SHA256-AES-256-GCM">;
|
|
71
|
+
ephemeralPublicKey: z.ZodString;
|
|
72
|
+
salt: z.ZodString;
|
|
73
|
+
nonce: z.ZodString;
|
|
74
|
+
ciphertext: z.ZodString;
|
|
75
|
+
authenticationTag: z.ZodString;
|
|
76
|
+
}, z.core.$strict>;
|
|
77
|
+
}, z.core.$strict>;
|
|
78
|
+
replayed: z.ZodBoolean;
|
|
79
|
+
}, z.core.$strict>>;
|
|
80
|
+
createdAt: z.ZodString;
|
|
81
|
+
updatedAt: z.ZodString;
|
|
82
|
+
}, z.core.$strict>;
|
|
83
|
+
export declare const CodexV6ReportJournalSchema: z.ZodObject<{
|
|
84
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
85
|
+
tenantId: z.ZodString;
|
|
86
|
+
subject: z.ZodString;
|
|
87
|
+
requestId: z.ZodString;
|
|
88
|
+
bindingId: z.ZodString;
|
|
89
|
+
installationId: z.ZodString;
|
|
90
|
+
credentialLineageId: z.ZodString;
|
|
91
|
+
clientRequestId: z.ZodString;
|
|
92
|
+
idempotencyKey: z.ZodString;
|
|
93
|
+
expectedGenerationVersion: z.ZodNumber;
|
|
94
|
+
rotationMode: z.ZodEnum<{
|
|
95
|
+
RETAINED: "RETAINED";
|
|
96
|
+
ROTATED: "ROTATED";
|
|
97
|
+
}>;
|
|
98
|
+
envelope: z.ZodObject<{
|
|
99
|
+
version: z.ZodLiteral<1>;
|
|
100
|
+
algorithm: z.ZodLiteral<"X25519-HKDF-SHA256-AES-256-GCM">;
|
|
101
|
+
keyId: z.ZodString;
|
|
102
|
+
ephemeralPublicKey: z.ZodString;
|
|
103
|
+
salt: z.ZodString;
|
|
104
|
+
nonce: z.ZodString;
|
|
105
|
+
ciphertext: z.ZodString;
|
|
106
|
+
authenticationTag: z.ZodString;
|
|
107
|
+
}, z.core.$strict>;
|
|
108
|
+
accessTokenHealth: z.ZodEnum<{
|
|
109
|
+
EXPIRED: "EXPIRED";
|
|
110
|
+
HEALTHY: "HEALTHY";
|
|
111
|
+
REJECTED: "REJECTED";
|
|
112
|
+
UNKNOWN: "UNKNOWN";
|
|
113
|
+
}>;
|
|
114
|
+
refreshTokenHealth: z.ZodEnum<{
|
|
115
|
+
HEALTHY: "HEALTHY";
|
|
116
|
+
REJECTED: "REJECTED";
|
|
117
|
+
UNKNOWN: "UNKNOWN";
|
|
118
|
+
}>;
|
|
119
|
+
observedAt: z.ZodString;
|
|
120
|
+
credentialExpiresAt: z.ZodString;
|
|
121
|
+
accessTokenDigest: z.ZodString;
|
|
122
|
+
refreshTokenDigest: z.ZodString;
|
|
123
|
+
idTokenDigest: z.ZodString;
|
|
124
|
+
createdAt: z.ZodString;
|
|
125
|
+
updatedAt: z.ZodString;
|
|
126
|
+
}, z.core.$strict>;
|
|
127
|
+
export type CodexV6BindingState = z.infer<typeof CodexV6BindingStateSchema>;
|
|
128
|
+
export type CodexV6DeliveryJournal = z.infer<typeof CodexV6DeliveryJournalSchema>;
|
|
129
|
+
export type CodexV6ReportJournal = z.infer<typeof CodexV6ReportJournalSchema>;
|
|
130
|
+
export declare function readCodexV6BindingState(env?: NodeJS.ProcessEnv): Promise<{
|
|
131
|
+
schemaVersion: 1;
|
|
132
|
+
tenantId: string;
|
|
133
|
+
subject: string;
|
|
134
|
+
requestId: string;
|
|
135
|
+
bindingId: string;
|
|
136
|
+
predecessorBindingId: string | null;
|
|
137
|
+
installationId: string;
|
|
138
|
+
managedAccountId: string;
|
|
139
|
+
providerAccountId: string;
|
|
140
|
+
poolEntryId: string;
|
|
141
|
+
credentialLineageId: string;
|
|
142
|
+
generationVersion: number;
|
|
143
|
+
accountExpiresAt: string | null;
|
|
144
|
+
localAssignmentId: string;
|
|
145
|
+
source: "ACCOUNT_REPLACEMENT" | "ADMIN_ADDED" | "LEGACY_AUTO_MIGRATED" | "REQUEST_INITIAL";
|
|
146
|
+
status: "ACTIVE" | "NEEDS_REAUTH" | "RETIREMENT_PENDING";
|
|
147
|
+
updatedAt: string;
|
|
148
|
+
} | undefined>;
|
|
149
|
+
export declare function writeCodexV6BindingState(value: CodexV6BindingState, env?: NodeJS.ProcessEnv): Promise<{
|
|
150
|
+
schemaVersion: 1;
|
|
151
|
+
tenantId: string;
|
|
152
|
+
subject: string;
|
|
153
|
+
requestId: string;
|
|
154
|
+
bindingId: string;
|
|
155
|
+
predecessorBindingId: string | null;
|
|
156
|
+
installationId: string;
|
|
157
|
+
managedAccountId: string;
|
|
158
|
+
providerAccountId: string;
|
|
159
|
+
poolEntryId: string;
|
|
160
|
+
credentialLineageId: string;
|
|
161
|
+
generationVersion: number;
|
|
162
|
+
accountExpiresAt: string | null;
|
|
163
|
+
localAssignmentId: string;
|
|
164
|
+
source: "ACCOUNT_REPLACEMENT" | "ADMIN_ADDED" | "LEGACY_AUTO_MIGRATED" | "REQUEST_INITIAL";
|
|
165
|
+
status: "ACTIVE" | "NEEDS_REAUTH" | "RETIREMENT_PENDING";
|
|
166
|
+
updatedAt: string;
|
|
167
|
+
}>;
|
|
168
|
+
export declare function clearCodexV6BindingState(expectedBindingId: string, env?: NodeJS.ProcessEnv): Promise<void>;
|
|
169
|
+
export declare function readCodexV6DeliveryJournal(env?: NodeJS.ProcessEnv): Promise<{
|
|
170
|
+
schemaVersion: 1;
|
|
171
|
+
tenantId: string;
|
|
172
|
+
subject: string;
|
|
173
|
+
requestId: string;
|
|
174
|
+
bindingId: string;
|
|
175
|
+
installationId: string;
|
|
176
|
+
expectedManagedAccountId: string;
|
|
177
|
+
expectedProviderAccountId: string;
|
|
178
|
+
expectedPoolEntryId: string;
|
|
179
|
+
expectedCredentialLineageId: string;
|
|
180
|
+
clientRequestId: string;
|
|
181
|
+
idempotencyKey: string;
|
|
182
|
+
ackIdempotencyKey: string;
|
|
183
|
+
clientKey: {
|
|
184
|
+
version: 1;
|
|
185
|
+
algorithm: "X25519-HKDF-SHA256-AES-256-GCM";
|
|
186
|
+
publicKey: string;
|
|
187
|
+
};
|
|
188
|
+
privateKeyPkcs8: string;
|
|
189
|
+
response: {
|
|
190
|
+
schemaVersion: 6;
|
|
191
|
+
delivery: {
|
|
192
|
+
id: string;
|
|
193
|
+
clientRequestId: string;
|
|
194
|
+
requestId: string;
|
|
195
|
+
bindingId: string;
|
|
196
|
+
installationId: string;
|
|
197
|
+
managedAccountId: string;
|
|
198
|
+
providerAccountId: string;
|
|
199
|
+
credentialLineageId: string;
|
|
200
|
+
generationVersion: number;
|
|
201
|
+
issuedAt: string;
|
|
202
|
+
credentialExpiresAt: string;
|
|
203
|
+
ackExpiresAt: string;
|
|
204
|
+
ackedAt: string | null;
|
|
205
|
+
status: "AWAITING_ACK";
|
|
206
|
+
envelope: {
|
|
207
|
+
version: 1;
|
|
208
|
+
algorithm: "X25519-HKDF-SHA256-AES-256-GCM";
|
|
209
|
+
ephemeralPublicKey: string;
|
|
210
|
+
salt: string;
|
|
211
|
+
nonce: string;
|
|
212
|
+
ciphertext: string;
|
|
213
|
+
authenticationTag: string;
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
replayed: boolean;
|
|
217
|
+
} | null;
|
|
218
|
+
createdAt: string;
|
|
219
|
+
updatedAt: string;
|
|
220
|
+
} | undefined>;
|
|
221
|
+
export declare function writeCodexV6DeliveryJournal(value: CodexV6DeliveryJournal, env?: NodeJS.ProcessEnv): Promise<{
|
|
222
|
+
schemaVersion: 1;
|
|
223
|
+
tenantId: string;
|
|
224
|
+
subject: string;
|
|
225
|
+
requestId: string;
|
|
226
|
+
bindingId: string;
|
|
227
|
+
installationId: string;
|
|
228
|
+
expectedManagedAccountId: string;
|
|
229
|
+
expectedProviderAccountId: string;
|
|
230
|
+
expectedPoolEntryId: string;
|
|
231
|
+
expectedCredentialLineageId: string;
|
|
232
|
+
clientRequestId: string;
|
|
233
|
+
idempotencyKey: string;
|
|
234
|
+
ackIdempotencyKey: string;
|
|
235
|
+
clientKey: {
|
|
236
|
+
version: 1;
|
|
237
|
+
algorithm: "X25519-HKDF-SHA256-AES-256-GCM";
|
|
238
|
+
publicKey: string;
|
|
239
|
+
};
|
|
240
|
+
privateKeyPkcs8: string;
|
|
241
|
+
response: {
|
|
242
|
+
schemaVersion: 6;
|
|
243
|
+
delivery: {
|
|
244
|
+
id: string;
|
|
245
|
+
clientRequestId: string;
|
|
246
|
+
requestId: string;
|
|
247
|
+
bindingId: string;
|
|
248
|
+
installationId: string;
|
|
249
|
+
managedAccountId: string;
|
|
250
|
+
providerAccountId: string;
|
|
251
|
+
credentialLineageId: string;
|
|
252
|
+
generationVersion: number;
|
|
253
|
+
issuedAt: string;
|
|
254
|
+
credentialExpiresAt: string;
|
|
255
|
+
ackExpiresAt: string;
|
|
256
|
+
ackedAt: string | null;
|
|
257
|
+
status: "AWAITING_ACK";
|
|
258
|
+
envelope: {
|
|
259
|
+
version: 1;
|
|
260
|
+
algorithm: "X25519-HKDF-SHA256-AES-256-GCM";
|
|
261
|
+
ephemeralPublicKey: string;
|
|
262
|
+
salt: string;
|
|
263
|
+
nonce: string;
|
|
264
|
+
ciphertext: string;
|
|
265
|
+
authenticationTag: string;
|
|
266
|
+
};
|
|
267
|
+
};
|
|
268
|
+
replayed: boolean;
|
|
269
|
+
} | null;
|
|
270
|
+
createdAt: string;
|
|
271
|
+
updatedAt: string;
|
|
272
|
+
}>;
|
|
273
|
+
export declare function updateCodexV6DeliveryJournalResponse(expected: CodexV6DeliveryJournal, response: z.infer<typeof CodexV6FullCredentialDeliveryResponseSchema>, now: number, env?: NodeJS.ProcessEnv): Promise<{
|
|
274
|
+
schemaVersion: 1;
|
|
275
|
+
tenantId: string;
|
|
276
|
+
subject: string;
|
|
277
|
+
requestId: string;
|
|
278
|
+
bindingId: string;
|
|
279
|
+
installationId: string;
|
|
280
|
+
expectedManagedAccountId: string;
|
|
281
|
+
expectedProviderAccountId: string;
|
|
282
|
+
expectedPoolEntryId: string;
|
|
283
|
+
expectedCredentialLineageId: string;
|
|
284
|
+
clientRequestId: string;
|
|
285
|
+
idempotencyKey: string;
|
|
286
|
+
ackIdempotencyKey: string;
|
|
287
|
+
clientKey: {
|
|
288
|
+
version: 1;
|
|
289
|
+
algorithm: "X25519-HKDF-SHA256-AES-256-GCM";
|
|
290
|
+
publicKey: string;
|
|
291
|
+
};
|
|
292
|
+
privateKeyPkcs8: string;
|
|
293
|
+
response: {
|
|
294
|
+
schemaVersion: 6;
|
|
295
|
+
delivery: {
|
|
296
|
+
id: string;
|
|
297
|
+
clientRequestId: string;
|
|
298
|
+
requestId: string;
|
|
299
|
+
bindingId: string;
|
|
300
|
+
installationId: string;
|
|
301
|
+
managedAccountId: string;
|
|
302
|
+
providerAccountId: string;
|
|
303
|
+
credentialLineageId: string;
|
|
304
|
+
generationVersion: number;
|
|
305
|
+
issuedAt: string;
|
|
306
|
+
credentialExpiresAt: string;
|
|
307
|
+
ackExpiresAt: string;
|
|
308
|
+
ackedAt: string | null;
|
|
309
|
+
status: "AWAITING_ACK";
|
|
310
|
+
envelope: {
|
|
311
|
+
version: 1;
|
|
312
|
+
algorithm: "X25519-HKDF-SHA256-AES-256-GCM";
|
|
313
|
+
ephemeralPublicKey: string;
|
|
314
|
+
salt: string;
|
|
315
|
+
nonce: string;
|
|
316
|
+
ciphertext: string;
|
|
317
|
+
authenticationTag: string;
|
|
318
|
+
};
|
|
319
|
+
};
|
|
320
|
+
replayed: boolean;
|
|
321
|
+
} | null;
|
|
322
|
+
createdAt: string;
|
|
323
|
+
updatedAt: string;
|
|
324
|
+
}>;
|
|
325
|
+
export declare function clearCodexV6DeliveryJournal(expected: Pick<CodexV6DeliveryJournal, "clientRequestId" | "idempotencyKey">, env?: NodeJS.ProcessEnv): Promise<void>;
|
|
326
|
+
export declare function openCodexV6DeliveryJournalKey(journal: CodexV6DeliveryJournal): KeyObject;
|
|
327
|
+
export declare function readCodexV6ReportJournal(env?: NodeJS.ProcessEnv): Promise<{
|
|
328
|
+
schemaVersion: 1;
|
|
329
|
+
tenantId: string;
|
|
330
|
+
subject: string;
|
|
331
|
+
requestId: string;
|
|
332
|
+
bindingId: string;
|
|
333
|
+
installationId: string;
|
|
334
|
+
credentialLineageId: string;
|
|
335
|
+
clientRequestId: string;
|
|
336
|
+
idempotencyKey: string;
|
|
337
|
+
expectedGenerationVersion: number;
|
|
338
|
+
rotationMode: "RETAINED" | "ROTATED";
|
|
339
|
+
envelope: {
|
|
340
|
+
version: 1;
|
|
341
|
+
algorithm: "X25519-HKDF-SHA256-AES-256-GCM";
|
|
342
|
+
keyId: string;
|
|
343
|
+
ephemeralPublicKey: string;
|
|
344
|
+
salt: string;
|
|
345
|
+
nonce: string;
|
|
346
|
+
ciphertext: string;
|
|
347
|
+
authenticationTag: string;
|
|
348
|
+
};
|
|
349
|
+
accessTokenHealth: "EXPIRED" | "HEALTHY" | "REJECTED" | "UNKNOWN";
|
|
350
|
+
refreshTokenHealth: "HEALTHY" | "REJECTED" | "UNKNOWN";
|
|
351
|
+
observedAt: string;
|
|
352
|
+
credentialExpiresAt: string;
|
|
353
|
+
accessTokenDigest: string;
|
|
354
|
+
refreshTokenDigest: string;
|
|
355
|
+
idTokenDigest: string;
|
|
356
|
+
createdAt: string;
|
|
357
|
+
updatedAt: string;
|
|
358
|
+
} | undefined>;
|
|
359
|
+
export declare function writeCodexV6ReportJournal(value: CodexV6ReportJournal, env?: NodeJS.ProcessEnv): Promise<{
|
|
360
|
+
schemaVersion: 1;
|
|
361
|
+
tenantId: string;
|
|
362
|
+
subject: string;
|
|
363
|
+
requestId: string;
|
|
364
|
+
bindingId: string;
|
|
365
|
+
installationId: string;
|
|
366
|
+
credentialLineageId: string;
|
|
367
|
+
clientRequestId: string;
|
|
368
|
+
idempotencyKey: string;
|
|
369
|
+
expectedGenerationVersion: number;
|
|
370
|
+
rotationMode: "RETAINED" | "ROTATED";
|
|
371
|
+
envelope: {
|
|
372
|
+
version: 1;
|
|
373
|
+
algorithm: "X25519-HKDF-SHA256-AES-256-GCM";
|
|
374
|
+
keyId: string;
|
|
375
|
+
ephemeralPublicKey: string;
|
|
376
|
+
salt: string;
|
|
377
|
+
nonce: string;
|
|
378
|
+
ciphertext: string;
|
|
379
|
+
authenticationTag: string;
|
|
380
|
+
};
|
|
381
|
+
accessTokenHealth: "EXPIRED" | "HEALTHY" | "REJECTED" | "UNKNOWN";
|
|
382
|
+
refreshTokenHealth: "HEALTHY" | "REJECTED" | "UNKNOWN";
|
|
383
|
+
observedAt: string;
|
|
384
|
+
credentialExpiresAt: string;
|
|
385
|
+
accessTokenDigest: string;
|
|
386
|
+
refreshTokenDigest: string;
|
|
387
|
+
idTokenDigest: string;
|
|
388
|
+
createdAt: string;
|
|
389
|
+
updatedAt: string;
|
|
390
|
+
}>;
|
|
391
|
+
export declare function clearCodexV6ReportJournal(expected: Pick<CodexV6ReportJournal, "clientRequestId" | "idempotencyKey">, env?: NodeJS.ProcessEnv): Promise<void>;
|
|
392
|
+
export declare function resetCodexV6LocalState(env?: NodeJS.ProcessEnv): Promise<{
|
|
393
|
+
clearedBinding: boolean;
|
|
394
|
+
clearedDelivery: boolean;
|
|
395
|
+
clearedReport: boolean;
|
|
396
|
+
}>;
|
|
397
|
+
import { type KeyObject } from "node:crypto";
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { CodexShortLivedDeliveryClientKeySchema, CodexV3AccessTokenHealthSchema, CodexV3CredentialEnvelopeSchema, CodexV3RefreshTokenHealthSchema, CodexV6FullCredentialDeliveryResponseSchema } from "./protocol.js";
|
|
5
|
+
import { readJsonIfExists, removePrivateFileDurably, withPrivateFileLock, writePrivateJson } from "./private-file.js";
|
|
6
|
+
const Id = z.string().min(1).max(512);
|
|
7
|
+
const Stable = z.string().min(8).max(255);
|
|
8
|
+
const Instant = z.string().datetime({ offset: true });
|
|
9
|
+
const InstallationId = z.string().min(16).max(200).regex(/^[A-Za-z0-9][A-Za-z0-9._:-]+$/u);
|
|
10
|
+
const Digest = z.string().length(64).regex(/^[0-9a-f]{64}$/u);
|
|
11
|
+
export const CodexV6BindingStateSchema = z.strictObject({
|
|
12
|
+
schemaVersion: z.literal(1),
|
|
13
|
+
tenantId: Id,
|
|
14
|
+
subject: Id,
|
|
15
|
+
requestId: Id,
|
|
16
|
+
bindingId: Id,
|
|
17
|
+
predecessorBindingId: Id.nullable(),
|
|
18
|
+
installationId: InstallationId,
|
|
19
|
+
managedAccountId: Id,
|
|
20
|
+
providerAccountId: Id,
|
|
21
|
+
poolEntryId: Id,
|
|
22
|
+
credentialLineageId: Id,
|
|
23
|
+
generationVersion: z.number().int().positive(),
|
|
24
|
+
accountExpiresAt: Instant.nullable(),
|
|
25
|
+
localAssignmentId: Id,
|
|
26
|
+
source: z.enum([
|
|
27
|
+
"REQUEST_INITIAL",
|
|
28
|
+
"ADMIN_ADDED",
|
|
29
|
+
"LEGACY_AUTO_MIGRATED",
|
|
30
|
+
"ACCOUNT_REPLACEMENT"
|
|
31
|
+
]),
|
|
32
|
+
status: z.enum(["ACTIVE", "NEEDS_REAUTH", "RETIREMENT_PENDING"]),
|
|
33
|
+
updatedAt: Instant
|
|
34
|
+
});
|
|
35
|
+
export const CodexV6DeliveryJournalSchema = z.strictObject({
|
|
36
|
+
schemaVersion: z.literal(1),
|
|
37
|
+
tenantId: Id,
|
|
38
|
+
subject: Id,
|
|
39
|
+
requestId: Id,
|
|
40
|
+
bindingId: Id,
|
|
41
|
+
installationId: InstallationId,
|
|
42
|
+
expectedManagedAccountId: Id,
|
|
43
|
+
expectedProviderAccountId: Id,
|
|
44
|
+
expectedPoolEntryId: Id,
|
|
45
|
+
expectedCredentialLineageId: Id,
|
|
46
|
+
clientRequestId: Stable,
|
|
47
|
+
idempotencyKey: Stable,
|
|
48
|
+
ackIdempotencyKey: Stable,
|
|
49
|
+
clientKey: CodexShortLivedDeliveryClientKeySchema,
|
|
50
|
+
privateKeyPkcs8: z.string().min(1).max(512).regex(/^[A-Za-z0-9_-]+$/u),
|
|
51
|
+
response: CodexV6FullCredentialDeliveryResponseSchema.nullable(),
|
|
52
|
+
createdAt: Instant,
|
|
53
|
+
updatedAt: Instant
|
|
54
|
+
});
|
|
55
|
+
export const CodexV6ReportJournalSchema = z.strictObject({
|
|
56
|
+
schemaVersion: z.literal(1),
|
|
57
|
+
tenantId: Id,
|
|
58
|
+
subject: Id,
|
|
59
|
+
requestId: Id,
|
|
60
|
+
bindingId: Id,
|
|
61
|
+
installationId: InstallationId,
|
|
62
|
+
credentialLineageId: Id,
|
|
63
|
+
clientRequestId: Stable,
|
|
64
|
+
idempotencyKey: Stable,
|
|
65
|
+
expectedGenerationVersion: z.number().int().positive(),
|
|
66
|
+
rotationMode: z.enum(["ROTATED", "RETAINED"]),
|
|
67
|
+
envelope: CodexV3CredentialEnvelopeSchema,
|
|
68
|
+
accessTokenHealth: CodexV3AccessTokenHealthSchema,
|
|
69
|
+
refreshTokenHealth: CodexV3RefreshTokenHealthSchema,
|
|
70
|
+
observedAt: Instant,
|
|
71
|
+
credentialExpiresAt: Instant,
|
|
72
|
+
accessTokenDigest: Digest,
|
|
73
|
+
refreshTokenDigest: Digest,
|
|
74
|
+
idTokenDigest: Digest,
|
|
75
|
+
createdAt: Instant,
|
|
76
|
+
updatedAt: Instant
|
|
77
|
+
});
|
|
78
|
+
function root(env) {
|
|
79
|
+
return env.CODEX_HOME?.trim() || join(homedir(), ".codex");
|
|
80
|
+
}
|
|
81
|
+
function statePath(env) {
|
|
82
|
+
return join(root(env), ".numa-request-device-v6.json");
|
|
83
|
+
}
|
|
84
|
+
function deliveryPath(env) {
|
|
85
|
+
return join(root(env), ".numa-request-device-delivery-v6.json");
|
|
86
|
+
}
|
|
87
|
+
function reportPath(env) {
|
|
88
|
+
return join(root(env), ".numa-request-device-report-v6.json");
|
|
89
|
+
}
|
|
90
|
+
async function readParsed(path, schema) {
|
|
91
|
+
const value = await readJsonIfExists(path);
|
|
92
|
+
return value === undefined ? undefined : schema.parse(value);
|
|
93
|
+
}
|
|
94
|
+
export function readCodexV6BindingState(env = process.env) {
|
|
95
|
+
return readParsed(statePath(env), CodexV6BindingStateSchema);
|
|
96
|
+
}
|
|
97
|
+
export async function writeCodexV6BindingState(value, env = process.env) {
|
|
98
|
+
const target = statePath(env);
|
|
99
|
+
return withPrivateFileLock(target, async () => {
|
|
100
|
+
const parsed = CodexV6BindingStateSchema.parse(value);
|
|
101
|
+
await writePrivateJson(target, parsed);
|
|
102
|
+
return parsed;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
export async function clearCodexV6BindingState(expectedBindingId, env = process.env) {
|
|
106
|
+
const target = statePath(env);
|
|
107
|
+
await withPrivateFileLock(target, async () => {
|
|
108
|
+
const current = await readParsed(target, CodexV6BindingStateSchema);
|
|
109
|
+
if (!current)
|
|
110
|
+
return;
|
|
111
|
+
if (current.bindingId !== expectedBindingId)
|
|
112
|
+
throw stateConflict();
|
|
113
|
+
await removePrivateFileDurably(target);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
export function readCodexV6DeliveryJournal(env = process.env) {
|
|
117
|
+
return readParsed(deliveryPath(env), CodexV6DeliveryJournalSchema);
|
|
118
|
+
}
|
|
119
|
+
export async function writeCodexV6DeliveryJournal(value, env = process.env) {
|
|
120
|
+
const target = deliveryPath(env);
|
|
121
|
+
return withPrivateFileLock(target, async () => {
|
|
122
|
+
const parsed = CodexV6DeliveryJournalSchema.parse(value);
|
|
123
|
+
const current = await readParsed(target, CodexV6DeliveryJournalSchema);
|
|
124
|
+
if (current && JSON.stringify(current) !== JSON.stringify(parsed))
|
|
125
|
+
throw stateConflict();
|
|
126
|
+
if (!current)
|
|
127
|
+
await writePrivateJson(target, parsed);
|
|
128
|
+
return current ?? parsed;
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
export async function updateCodexV6DeliveryJournalResponse(expected, response, now, env = process.env) {
|
|
132
|
+
const target = deliveryPath(env);
|
|
133
|
+
return withPrivateFileLock(target, async () => {
|
|
134
|
+
const current = await readParsed(target, CodexV6DeliveryJournalSchema);
|
|
135
|
+
if (!current || current.clientRequestId !== expected.clientRequestId
|
|
136
|
+
|| current.idempotencyKey !== expected.idempotencyKey)
|
|
137
|
+
throw stateConflict();
|
|
138
|
+
const updated = CodexV6DeliveryJournalSchema.parse({ ...current, response,
|
|
139
|
+
updatedAt: new Date(now).toISOString() });
|
|
140
|
+
await writePrivateJson(target, updated);
|
|
141
|
+
return updated;
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
export async function clearCodexV6DeliveryJournal(expected, env = process.env) {
|
|
145
|
+
const target = deliveryPath(env);
|
|
146
|
+
await withPrivateFileLock(target, async () => {
|
|
147
|
+
const current = await readParsed(target, CodexV6DeliveryJournalSchema);
|
|
148
|
+
if (!current)
|
|
149
|
+
return;
|
|
150
|
+
if (current.clientRequestId !== expected.clientRequestId
|
|
151
|
+
|| current.idempotencyKey !== expected.idempotencyKey)
|
|
152
|
+
throw stateConflict();
|
|
153
|
+
await removePrivateFileDurably(target);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
export function openCodexV6DeliveryJournalKey(journal) {
|
|
157
|
+
const encoded = Buffer.from(journal.privateKeyPkcs8, "base64url");
|
|
158
|
+
try {
|
|
159
|
+
if (encoded.toString("base64url") !== journal.privateKeyPkcs8)
|
|
160
|
+
throw stateConflict();
|
|
161
|
+
const key = createPrivateKey({ key: encoded, format: "der", type: "pkcs8" });
|
|
162
|
+
if (key.asymmetricKeyType !== "x25519")
|
|
163
|
+
throw stateConflict();
|
|
164
|
+
return key;
|
|
165
|
+
}
|
|
166
|
+
finally {
|
|
167
|
+
encoded.fill(0);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
export function readCodexV6ReportJournal(env = process.env) {
|
|
171
|
+
return readParsed(reportPath(env), CodexV6ReportJournalSchema);
|
|
172
|
+
}
|
|
173
|
+
export async function writeCodexV6ReportJournal(value, env = process.env) {
|
|
174
|
+
const target = reportPath(env);
|
|
175
|
+
return withPrivateFileLock(target, async () => {
|
|
176
|
+
const parsed = CodexV6ReportJournalSchema.parse(value);
|
|
177
|
+
const current = await readParsed(target, CodexV6ReportJournalSchema);
|
|
178
|
+
if (current && JSON.stringify(current) !== JSON.stringify(parsed))
|
|
179
|
+
throw stateConflict();
|
|
180
|
+
if (!current)
|
|
181
|
+
await writePrivateJson(target, parsed);
|
|
182
|
+
return current ?? parsed;
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
export async function clearCodexV6ReportJournal(expected, env = process.env) {
|
|
186
|
+
const target = reportPath(env);
|
|
187
|
+
await withPrivateFileLock(target, async () => {
|
|
188
|
+
const current = await readParsed(target, CodexV6ReportJournalSchema);
|
|
189
|
+
if (!current)
|
|
190
|
+
return;
|
|
191
|
+
if (current.clientRequestId !== expected.clientRequestId
|
|
192
|
+
|| current.idempotencyKey !== expected.idempotencyKey)
|
|
193
|
+
throw stateConflict();
|
|
194
|
+
await removePrivateFileDurably(target);
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
export async function resetCodexV6LocalState(env = process.env) {
|
|
198
|
+
const [binding, delivery, report] = await Promise.all([
|
|
199
|
+
readCodexV6BindingState(env),
|
|
200
|
+
readCodexV6DeliveryJournal(env),
|
|
201
|
+
readCodexV6ReportJournal(env)
|
|
202
|
+
]);
|
|
203
|
+
if (report)
|
|
204
|
+
await clearCodexV6ReportJournal(report, env);
|
|
205
|
+
if (delivery)
|
|
206
|
+
await clearCodexV6DeliveryJournal(delivery, env);
|
|
207
|
+
if (binding)
|
|
208
|
+
await clearCodexV6BindingState(binding.bindingId, env);
|
|
209
|
+
return {
|
|
210
|
+
clearedBinding: binding !== undefined,
|
|
211
|
+
clearedDelivery: delivery !== undefined,
|
|
212
|
+
clearedReport: report !== undefined
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
function stateConflict() {
|
|
216
|
+
return Object.assign(new Error("The Codex v6 request/device state changed unexpectedly."), {
|
|
217
|
+
code: "request_bound_device_v6_state_conflict"
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
import { createPrivateKey } from "node:crypto";
|
|
221
|
+
//# sourceMappingURL=request-bound-device-v6-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-bound-device-v6-state.js","sourceRoot":"","sources":["../src/request-bound-device-v6-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,sCAAsC,EAC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AC/E,MAAM,wBAAwB,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,GAAG,GAAsB,OAAO,CAAC,GAAG;IAEpC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACpD,uBAAuB,CAAC,GAAG,CAAC;QAC5B,0BAA0B,CAAC,GAAG,CAAC;QAC/B,wBAAwB,CAAC,GAAG,CAAC;KAC9B,CAAC,CAAC;IACH,IAAI,MAAM;QAAE,MAAM,yBAAyB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACzD,IAAI,QAAQ;QAAE,MAAM,2BAA2B,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAC/D,IAAI,OAAO;QAAE,MAAM,wBAAwB,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IACpE,OAAO;QACL,cAAc,EAAE,OAAO,KAAK,SAAS;QACrC,eAAe,EAAE,QAAQ,KAAK,SAAS;QACvC,aAAa,EAAE,MAAM,KAAK,SAAS;KACpC,CAAC;AACJ,CAAC;AAED,SAAS,aAAa;IACpB,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,yDAAyD,CAAC,EAAE;QACzF,IAAI,EAAE,wCAAwC;KAC/C,CAAC,CAAC;AACL,CAAC;AACD,OAAO,EAAE,gBAAgB,EAAkB,MAAM,aAAa,CAAC"}
|
package/dist/selection.d.ts
CHANGED
|
@@ -9,12 +9,17 @@ declare const CodexSelectionSchema: z.ZodObject<{
|
|
|
9
9
|
label: z.ZodString;
|
|
10
10
|
distributionMode: z.ZodOptional<z.ZodEnum<{
|
|
11
11
|
CLIENT_MANAGED_V4: "CLIENT_MANAGED_V4";
|
|
12
|
+
REQUEST_BOUND_DEVICE_V6: "REQUEST_BOUND_DEVICE_V6";
|
|
12
13
|
SCHEMA_V1: "SCHEMA_V1";
|
|
13
14
|
SERVER_MANAGED_SHORT_LIVED: "SERVER_MANAGED_SHORT_LIVED";
|
|
14
15
|
}>>;
|
|
15
16
|
assignmentId: z.ZodOptional<z.ZodString>;
|
|
16
17
|
managedAccountId: z.ZodOptional<z.ZodString>;
|
|
17
18
|
providerAccountId: z.ZodOptional<z.ZodString>;
|
|
19
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
20
|
+
bindingId: z.ZodOptional<z.ZodString>;
|
|
21
|
+
installationId: z.ZodOptional<z.ZodString>;
|
|
22
|
+
credentialLineageId: z.ZodOptional<z.ZodString>;
|
|
18
23
|
}, z.core.$strip>;
|
|
19
24
|
updatedAt: z.ZodString;
|
|
20
25
|
}, z.core.$strip>;
|
package/dist/selection.js
CHANGED
|
@@ -11,10 +11,19 @@ const CodexSelectionSchema = z.object({
|
|
|
11
11
|
id: z.string().min(1),
|
|
12
12
|
accountId: z.string().min(1).optional(),
|
|
13
13
|
label: z.string().min(1),
|
|
14
|
-
distributionMode: z.enum([
|
|
14
|
+
distributionMode: z.enum([
|
|
15
|
+
"SCHEMA_V1",
|
|
16
|
+
"SERVER_MANAGED_SHORT_LIVED",
|
|
17
|
+
"CLIENT_MANAGED_V4",
|
|
18
|
+
"REQUEST_BOUND_DEVICE_V6"
|
|
19
|
+
]).optional(),
|
|
15
20
|
assignmentId: z.string().min(1).optional(),
|
|
16
21
|
managedAccountId: z.string().min(1).optional(),
|
|
17
|
-
providerAccountId: z.string().min(1).optional()
|
|
22
|
+
providerAccountId: z.string().min(1).optional(),
|
|
23
|
+
requestId: z.string().min(1).optional(),
|
|
24
|
+
bindingId: z.string().min(1).optional(),
|
|
25
|
+
installationId: z.string().min(16).optional(),
|
|
26
|
+
credentialLineageId: z.string().min(1).optional()
|
|
18
27
|
}).superRefine((account, context) => {
|
|
19
28
|
if (account.distributionMode === "SERVER_MANAGED_SHORT_LIVED"
|
|
20
29
|
&& (!account.assignmentId || !account.managedAccountId)) {
|
|
@@ -30,6 +39,15 @@ const CodexSelectionSchema = z.object({
|
|
|
30
39
|
message: "A v4 token-pool selection requires the complete account identity."
|
|
31
40
|
});
|
|
32
41
|
}
|
|
42
|
+
if (account.distributionMode === "REQUEST_BOUND_DEVICE_V6"
|
|
43
|
+
&& (!account.requestId || !account.bindingId || !account.installationId
|
|
44
|
+
|| !account.credentialLineageId || !account.managedAccountId
|
|
45
|
+
|| !account.providerAccountId)) {
|
|
46
|
+
context.addIssue({
|
|
47
|
+
code: "custom",
|
|
48
|
+
message: "A v6 selection requires one complete request/device binding identity."
|
|
49
|
+
});
|
|
50
|
+
}
|
|
33
51
|
}),
|
|
34
52
|
updatedAt: z.string().datetime()
|
|
35
53
|
});
|