|
1 | 1 | import { z } from 'zod' |
| 2 | +import { apiKeyAccessSchema } from '@/lib/api/contracts/api-keys' |
2 | 3 | import { workspaceIdSchema } from '@/lib/api/contracts/primitives' |
3 | 4 | import { defineRouteContract } from '@/lib/api/contracts/types' |
4 | 5 |
|
@@ -29,9 +30,6 @@ const base64Url43 = (message: string) => z.string().regex(/^[A-Za-z0-9\-_]{43}$/ |
29 | 30 | export const cliAuthScopeSchema = z.enum(['copilot', 'platform']).default('copilot') |
30 | 31 | export type CliAuthScope = z.output<typeof cliAuthScopeSchema> |
31 | 32 |
|
32 | | -/** Access a minted platform key carries: full (`write`) or read-only (`read`). */ |
33 | | -const cliAuthKeyAccessSchema = z.enum(['read', 'write']) |
34 | | - |
35 | 33 | /** |
36 | 34 | * Bounds on a minted platform key's lifetime, in whole days. The same window |
37 | 35 | * every other key-creation surface allows: one day to one year. |
@@ -72,7 +70,7 @@ export const approveCliAuthBodySchema = z.object({ |
72 | 70 | * approves; recording it here, rather than reading it at poll time, is what |
73 | 71 | * keeps the unauthenticated poll from widening it. |
74 | 72 | */ |
75 | | - access: cliAuthKeyAccessSchema.optional().default('write'), |
| 73 | + access: apiKeyAccessSchema.optional().default('write'), |
76 | 74 | /** Platform scope only: days until the minted key expires. Absent means it never expires. */ |
77 | 75 | expiresInDays: cliAuthExpiresInDaysSchema.optional(), |
78 | 76 | }) |
@@ -132,7 +130,7 @@ export const pollCliAuthContract = defineRouteContract({ |
132 | 130 | * A terminal that asked for read-only must check this rather than |
133 | 131 | * assume it — a server that predates the field mints full access. |
134 | 132 | */ |
135 | | - access: cliAuthKeyAccessSchema.optional(), |
| 133 | + access: apiKeyAccessSchema.optional(), |
136 | 134 | /** Platform scope only: when the key expires, or null when it never does. */ |
137 | 135 | expiresAt: z.string().nullable().optional(), |
138 | 136 | }), |
|
0 commit comments