@fabrika/iam-contract 0.9.0-dev.33 → 0.9.0-dev.34

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabrika/iam-contract",
3
- "version": "0.9.0-dev.33",
3
+ "version": "0.9.0-dev.34",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,6 +12,7 @@
12
12
  },
13
13
  "files": [
14
14
  "src",
15
+ "!src/**/__tests__/**",
15
16
  "types"
16
17
  ],
17
18
  "exports": {
@@ -22,11 +23,12 @@
22
23
  }
23
24
  },
24
25
  "scripts": {
25
- "typecheck": "tsrs --build tsconfig.lib.json"
26
+ "typecheck": "tsrs --build tsconfig.test.json",
27
+ "test": "bun test"
26
28
  },
27
29
  "dependencies": {
28
- "@fabrika/app": "0.9.0-dev.33",
29
- "@fabrika/auth-core": "0.9.0-dev.33",
30
- "@fabrika/proxy-core": "0.9.0-dev.33"
30
+ "@fabrika/app": "0.9.0-dev.34",
31
+ "@fabrika/auth-core": "0.9.0-dev.34",
32
+ "@fabrika/proxy-core": "0.9.0-dev.34"
31
33
  }
32
34
  }
package/src/oauth.ts CHANGED
@@ -1,9 +1,20 @@
1
- import { isCimdClientId, isOAuthResourceUri, parseOAuthScopes } from '@fabrika/auth-core'
1
+ import { isCimdClientId, isOAuthClientId, isOAuthResourceUri, parseOAuthScopes } from '@fabrika/auth-core'
2
2
  import type { KeyGrant } from '@fabrika/auth-core'
3
3
 
4
+ /**
5
+ * The kinds of managed client an installation registers. A label only: every kind gets the same authorization code
6
+ * flow with S256 PKCE, the same RFC 8707 resources and the same scope ceilings (ADR-0049).
7
+ */
8
+ export const OAUTH_CLIENT_PROVIDERS = ['claude', 'chatgpt', 'external'] as const
9
+ export type OAuthClientProvider = (typeof OAUTH_CLIENT_PROVIDERS)[number]
10
+
11
+ function isOAuthClientProvider(value: unknown): value is OAuthClientProvider {
12
+ return OAUTH_CLIENT_PROVIDERS.some((provider) => provider === value)
13
+ }
14
+
4
15
  /** Managed CIMD registrations only; public dynamic registration is not part of this contract. */
5
16
  export interface OAuthManagedClient {
6
- provider: 'chatgpt' | 'claude'
17
+ provider: OAuthClientProvider
7
18
  clientId: string
8
19
  redirectUris: string[]
9
20
  }
@@ -36,13 +47,28 @@ export type OAuthClientMetadataDocument =
36
47
  /** How a token or revocation request authenticates its client: no credential, or a JWT assertion. */
37
48
  export type OAuthClientCredential = { method: 'none' } | { method: 'private_key_jwt'; assertion: string }
38
49
 
50
+ export interface OAuthScopeGrant {
51
+ scope: string
52
+ permissions: KeyGrant[]
53
+ /**
54
+ * A scope dimension type. Such a scope is requested only as `<scope>:<value>`, and each of its scope-less permissions
55
+ * is narrowed to `{ type: parameter, value }`: `deploy:alpha` with parameter `app` holds its actions at app `alpha` only.
56
+ */
57
+ parameter?: string
58
+ }
59
+
39
60
  export interface OAuthResourceDto {
40
61
  app: string
41
62
  resource: string
42
63
  /** IAM resolves these app-owned grants; OAuth scope text alone never authorizes an action. */
43
- scopeGrants: { scope: string; permissions: KeyGrant[] }[]
64
+ scopeGrants: OAuthScopeGrant[]
44
65
  /** Used only when scope is omitted. No configured default means invalid_scope, never all scopes. */
45
66
  defaultScopes?: string[]
67
+ /**
68
+ * `cli`: served only to the installation's command-line client, through the device grant. Absent: served only to the
69
+ * operator's managed clients, through an authorization code. A token for one never comes from the other's flow.
70
+ */
71
+ client?: 'cli'
46
72
  }
47
73
 
48
74
  /** No access token, refresh token, hash, or authorization code appears in a grant DTO. */
@@ -76,9 +102,37 @@ export type OAuthAuthorizationParseResult =
76
102
  | { kind: 'invalid_scope'; coordinates: OAuthAuthorizationCoordinates; rawScope: string }
77
103
  | { kind: 'invalid_request' }
78
104
 
105
+ /** RFC 8628 §3.4: the grant type a device client polls the token endpoint with. */
106
+ export const OAUTH_DEVICE_CODE_GRANT_TYPE = 'urn:ietf:params:oauth:grant-type:device_code'
107
+
79
108
  export type OAuthTokenRequest =
80
109
  | { grant_type: 'authorization_code'; client_id: string; code: string; redirect_uri: string; code_verifier: string; resource: string }
81
110
  | { grant_type: 'refresh_token'; client_id: string; refresh_token: string; resource: string }
111
+ | { grant_type: typeof OAUTH_DEVICE_CODE_GRANT_TYPE; client_id: string; device_code: string; resource: string }
112
+
113
+ /** RFC 8628 §3.1, with every resource the grant is asked for (RFC 8707): each token names one of them. */
114
+ export interface OAuthDeviceAuthorizationRequest {
115
+ client_id: string
116
+ scope: string[]
117
+ resources: string[]
118
+ }
119
+
120
+ /** RFC 8628 §3.2. */
121
+ export interface OAuthDeviceAuthorizationResponse {
122
+ device_code: string
123
+ user_code: string
124
+ verification_uri: string
125
+ verification_uri_complete: string
126
+ expires_in: number
127
+ interval: number
128
+ }
129
+
130
+ /** The lifetimes a person picks between when approving a device: an hour, a day, a week. */
131
+ export const OAUTH_DEVICE_GRANT_LIFETIMES_SECONDS = [3600, 86_400, 604_800] as const
132
+ export type OAuthDeviceGrantLifetime = (typeof OAUTH_DEVICE_GRANT_LIFETIMES_SECONDS)[number]
133
+
134
+ /** How many resources one device grant may name. */
135
+ export const MAX_OAUTH_DEVICE_RESOURCES = 8
82
136
 
83
137
  export interface OAuthTokenResponse {
84
138
  access_token: string
@@ -99,9 +153,10 @@ export interface OAuthAuthorizationServerMetadata {
99
153
  authorization_endpoint: string
100
154
  token_endpoint: string
101
155
  revocation_endpoint: string
156
+ device_authorization_endpoint: string
102
157
  jwks_uri: string
103
158
  response_types_supported: ['code']
104
- grant_types_supported: ['authorization_code', 'refresh_token']
159
+ grant_types_supported: ['authorization_code', 'refresh_token', typeof OAUTH_DEVICE_CODE_GRANT_TYPE]
105
160
  code_challenge_methods_supported: ['S256']
106
161
  token_endpoint_auth_methods_supported: ['none', 'private_key_jwt']
107
162
  token_endpoint_auth_signing_alg_values_supported: OAuthClientAssertionAlgorithm[]
@@ -134,7 +189,7 @@ export function parseOAuthManagedClient(value: unknown): OAuthManagedClient | nu
134
189
  const provider = field(value, 'provider')
135
190
  const clientId = field(value, 'clientId')
136
191
  const uris = redirectUris(field(value, 'redirectUris'))
137
- return (provider === 'chatgpt' || provider === 'claude') && isCimdClientId(clientId) && uris !== null
192
+ return isOAuthClientProvider(provider) && isCimdClientId(clientId) && uris !== null
138
193
  ? { provider, clientId, redirectUris: uris }
139
194
  : null
140
195
  }
@@ -199,28 +254,54 @@ function parseClientGrantTypes(value: unknown): OAuthClientMetadataDocument['gra
199
254
  return grants.includes('authorization_code') ? grants : null
200
255
  }
201
256
 
257
+ const SCOPE_GRANT_KEYS = ['scope', 'permissions', 'parameter']
258
+ const PERMISSION_KEYS = ['action', 'scope']
259
+ const PERMISSION_SCOPE_KEYS = ['type', 'value']
260
+
261
+ function hasOnlyKeys(value: unknown, allowed: readonly string[]): boolean {
262
+ return typeof value === 'object' && value !== null && !Array.isArray(value) && Object.keys(value).every((key) => allowed.includes(key))
263
+ }
264
+
202
265
  export function parseOAuthResourceDto(value: unknown): OAuthResourceDto | null {
203
266
  const app = field(value, 'app')
204
267
  const resource = field(value, 'resource')
205
268
  const rawGrants = field(value, 'scopeGrants')
206
269
  const rawDefaultScopes = field(value, 'defaultScopes')
270
+ const client = field(value, 'client')
271
+ if (client !== undefined && client !== 'cli') return null
207
272
  if (
208
273
  !isNonemptyText(app) || app.includes('*') || !isOAuthResourceUri(resource) || !Array.isArray(rawGrants) || rawGrants.length === 0
209
274
  || rawGrants.length > 64
210
275
  ) return null
211
- const scopeGrants: OAuthResourceDto['scopeGrants'] = []
276
+ const scopeGrants: OAuthScopeGrant[] = []
212
277
  for (const entry of rawGrants) {
278
+ // An unknown key is refused: a misspelled `parameter` would otherwise leave the scope unnarrowed.
279
+ if (!hasOnlyKeys(entry, SCOPE_GRANT_KEYS)) return null
213
280
  const scope = field(entry, 'scope')
214
281
  const permissions = parseResourcePermissions(field(entry, 'permissions'))
215
- if (typeof scope !== 'string' || parseOAuthScopes([scope]) === null || permissions === null || scopeGrants.some((grant) => grant.scope === scope)) {
282
+ const parameter = field(entry, 'parameter')
283
+ if (
284
+ typeof scope !== 'string' || parseOAuthScopes([scope]) === null || scope.includes(SCOPE_PARAMETER_SEPARATOR) || permissions === null
285
+ || scopeGrants.some((grant) => grant.scope === scope)
286
+ ) {
216
287
  return null
217
288
  }
218
- scopeGrants.push({ scope, permissions })
289
+ if (parameter === undefined) {
290
+ scopeGrants.push({ scope, permissions })
291
+ continue
292
+ }
293
+ // A parameter narrows scope-less permissions only; a permission that names its own scope would ignore it.
294
+ if (!isScopeParameterText(parameter) || permissions.some((permission) => permission.scope != null)) return null
295
+ scopeGrants.push({ scope, permissions, parameter })
219
296
  }
220
- const dto: OAuthResourceDto = { app, resource, scopeGrants }
297
+ const dto: OAuthResourceDto = { app, resource, scopeGrants, ...(client === undefined ? {} : { client }) }
221
298
  if (rawDefaultScopes !== undefined) {
222
299
  const defaultScopes = parseOAuthScopes(rawDefaultScopes)
223
- if (defaultScopes === null || !defaultScopes.every((scope) => scopeGrants.some((grant) => grant.scope === scope))) return null
300
+ if (
301
+ defaultScopes === null || !defaultScopes.every((scope) => scopeGrants.some((grant) => grant.scope === scope && grant.parameter === undefined))
302
+ ) {
303
+ return null
304
+ }
224
305
  dto.defaultScopes = defaultScopes
225
306
  }
226
307
  return dto
@@ -232,23 +313,47 @@ function parseResourcePermissions(value: unknown): KeyGrant[] | null {
232
313
  for (const entry of value) {
233
314
  const action = field(entry, 'action')
234
315
  const rawScope = field(entry, 'scope')
235
- if (!isNonemptyText(action)) return null
316
+ if (!hasOnlyKeys(entry, PERMISSION_KEYS) || !isNonemptyText(action)) return null
236
317
  if (rawScope === undefined) permissions.push({ action })
237
318
  else if (rawScope === null) permissions.push({ action, scope: null })
238
319
  else {
239
320
  const type = field(rawScope, 'type')
240
321
  const scopeValue = field(rawScope, 'value')
241
- if (!isNonemptyText(type) || !isNonemptyText(scopeValue)) return null
322
+ if (!hasOnlyKeys(rawScope, PERMISSION_SCOPE_KEYS) || !isNonemptyText(type) || !isNonemptyText(scopeValue)) return null
242
323
  permissions.push({ action, scope: { type, value: scopeValue } })
243
324
  }
244
325
  }
245
326
  return permissions
246
327
  }
247
328
 
329
+ /** Separates a parameterized scope from its value: `deploy:alpha`. */
330
+ export const SCOPE_PARAMETER_SEPARATOR = ':'
331
+
332
+ /** A scope dimension type, or a value of one, as a scope token may carry it. */
333
+ function isScopeParameterText(value: unknown): value is string {
334
+ return typeof value === 'string' && value.length <= 100 && /^[A-Za-z0-9][A-Za-z0-9._@-]*$/.test(value)
335
+ }
336
+
337
+ /**
338
+ * The resource's grant a requested scope token selects and the narrowed permissions it holds, or null when the token
339
+ * selects none: an unknown scope, a parameterized scope without its value, a value on a scope that takes none.
340
+ */
341
+ export function resolveOAuthScopeToken(token: string, resource: OAuthResourceDto): KeyGrant[] | null {
342
+ const separator = token.indexOf(SCOPE_PARAMETER_SEPARATOR)
343
+ const name = separator === -1 ? token : token.slice(0, separator)
344
+ const grant = resource.scopeGrants.find((entry) => entry.scope === name)
345
+ if (grant === undefined) return null
346
+ const type = grant.parameter
347
+ if (type === undefined) return separator === -1 ? grant.permissions : null
348
+ const value = separator === -1 ? null : token.slice(separator + 1)
349
+ if (value === null || !isScopeParameterText(value)) return null
350
+ return grant.permissions.map((permission) => ({ action: permission.action, scope: { type, value } }))
351
+ }
352
+
248
353
  export function resolveOAuthAuthorizationScopes(scope: string | undefined, resource: OAuthResourceDto): string[] | null {
249
354
  const scopes = scope === undefined ? resource.defaultScopes : parseOAuthScopes(scope.split(' '))
250
355
  if (!scopes || scopes.length === 0) return null
251
- return scopes.every((entry) => resource.scopeGrants.some((grant) => grant.scope === entry))
356
+ return scopes.every((entry) => resolveOAuthScopeToken(entry, resource) !== null)
252
357
  ? [...scopes]
253
358
  : null
254
359
  }
@@ -291,7 +396,7 @@ export function parseOAuthTokenRequest(value: unknown): OAuthTokenRequest | null
291
396
  const clientId = field(value, 'client_id')
292
397
  const resource = field(value, 'resource')
293
398
  const grantType = field(value, 'grant_type')
294
- if (!isCimdClientId(clientId) || !isOAuthResourceUri(resource)) return null
399
+ if (!isOAuthClientId(clientId) || !isOAuthResourceUri(resource)) return null
295
400
  if (grantType === 'authorization_code') {
296
401
  const code = field(value, 'code')
297
402
  const redirectUri = field(value, 'redirect_uri')
@@ -305,9 +410,38 @@ export function parseOAuthTokenRequest(value: unknown): OAuthTokenRequest | null
305
410
  const refreshToken = field(value, 'refresh_token')
306
411
  return isNonemptyText(refreshToken) ? { grant_type: grantType, client_id: clientId, refresh_token: refreshToken, resource } : null
307
412
  }
413
+ if (grantType === OAUTH_DEVICE_CODE_GRANT_TYPE) {
414
+ const deviceCode = field(value, 'device_code')
415
+ return isNonemptyText(deviceCode) && deviceCode.length <= 256
416
+ ? { grant_type: grantType, client_id: clientId, device_code: deviceCode, resource }
417
+ : null
418
+ }
308
419
  return null
309
420
  }
310
421
 
422
+ /**
423
+ * A device authorization request: its client, at least one scope and one to `MAX_OAUTH_DEVICE_RESOURCES` distinct
424
+ * resources. `resource` is the one parameter that may repeat (RFC 8707 §2), so the caller collects it into a list.
425
+ */
426
+ export function parseOAuthDeviceAuthorizationRequest(
427
+ value: { fields: Record<string, string>; resources: string[] },
428
+ ): OAuthDeviceAuthorizationRequest | null {
429
+ const clientId = field(value.fields, 'client_id')
430
+ const scope = field(value.fields, 'scope')
431
+ if (!isOAuthClientId(clientId) || typeof scope !== 'string') return null
432
+ const scopes = parseOAuthScopes(scope.split(' '))
433
+ const resources = value.resources
434
+ if (
435
+ scopes === null || scopes.length === 0 || resources.length === 0 || resources.length > MAX_OAUTH_DEVICE_RESOURCES
436
+ || !resources.every(isOAuthResourceUri) || new Set(resources).size !== resources.length
437
+ ) return null
438
+ return { client_id: clientId, scope: scopes, resources: [...resources] }
439
+ }
440
+
441
+ export function isOAuthDeviceGrantLifetime(value: number): value is OAuthDeviceGrantLifetime {
442
+ return OAUTH_DEVICE_GRANT_LIFETIMES_SECONDS.some((lifetime) => lifetime === value)
443
+ }
444
+
311
445
  const MAX_CLIENT_ASSERTION_LENGTH = 16_384
312
446
 
313
447
  /**
@@ -327,7 +461,7 @@ export function parseOAuthRevocationRequest(value: unknown): OAuthRevocationRequ
327
461
  const token = field(value, 'token')
328
462
  const hint = field(value, 'token_type_hint')
329
463
  if (
330
- !isCimdClientId(clientId) || typeof token !== 'string' || token.length === 0 || token.length > 32768
464
+ !isOAuthClientId(clientId) || typeof token !== 'string' || token.length === 0 || token.length > 32768
331
465
  || (hint !== undefined && (typeof hint !== 'string' || hint.length > 200))
332
466
  ) return null
333
467
  const request: OAuthRevocationRequest = { client_id: clientId, token }
@@ -1,7 +1,13 @@
1
1
  import type { KeyGrant } from '@fabrika/auth-core';
2
+ /**
3
+ * The kinds of managed client an installation registers. A label only: every kind gets the same authorization code
4
+ * flow with S256 PKCE, the same RFC 8707 resources and the same scope ceilings (ADR-0049).
5
+ */
6
+ export declare const OAUTH_CLIENT_PROVIDERS: readonly ["claude", "chatgpt", "external"];
7
+ export type OAuthClientProvider = (typeof OAUTH_CLIENT_PROVIDERS)[number];
2
8
  /** Managed CIMD registrations only; public dynamic registration is not part of this contract. */
3
9
  export interface OAuthManagedClient {
4
- provider: 'chatgpt' | 'claude';
10
+ provider: OAuthClientProvider;
5
11
  clientId: string;
6
12
  redirectUris: string[];
7
13
  }
@@ -33,16 +39,27 @@ export type OAuthClientCredential = {
33
39
  method: 'private_key_jwt';
34
40
  assertion: string;
35
41
  };
42
+ export interface OAuthScopeGrant {
43
+ scope: string;
44
+ permissions: KeyGrant[];
45
+ /**
46
+ * A scope dimension type. Such a scope is requested only as `<scope>:<value>`, and each of its scope-less permissions
47
+ * is narrowed to `{ type: parameter, value }`: `deploy:alpha` with parameter `app` holds its actions at app `alpha` only.
48
+ */
49
+ parameter?: string;
50
+ }
36
51
  export interface OAuthResourceDto {
37
52
  app: string;
38
53
  resource: string;
39
54
  /** IAM resolves these app-owned grants; OAuth scope text alone never authorizes an action. */
40
- scopeGrants: {
41
- scope: string;
42
- permissions: KeyGrant[];
43
- }[];
55
+ scopeGrants: OAuthScopeGrant[];
44
56
  /** Used only when scope is omitted. No configured default means invalid_scope, never all scopes. */
45
57
  defaultScopes?: string[];
58
+ /**
59
+ * `cli`: served only to the installation's command-line client, through the device grant. Absent: served only to the
60
+ * operator's managed clients, through an authorization code. A token for one never comes from the other's flow.
61
+ */
62
+ client?: 'cli';
46
63
  }
47
64
  /** No access token, refresh token, hash, or authorization code appears in a grant DTO. */
48
65
  export interface OAuthGrantDto {
@@ -77,6 +94,8 @@ export type OAuthAuthorizationParseResult = {
77
94
  } | {
78
95
  kind: 'invalid_request';
79
96
  };
97
+ /** RFC 8628 §3.4: the grant type a device client polls the token endpoint with. */
98
+ export declare const OAUTH_DEVICE_CODE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
80
99
  export type OAuthTokenRequest = {
81
100
  grant_type: 'authorization_code';
82
101
  client_id: string;
@@ -89,7 +108,32 @@ export type OAuthTokenRequest = {
89
108
  client_id: string;
90
109
  refresh_token: string;
91
110
  resource: string;
111
+ } | {
112
+ grant_type: typeof OAUTH_DEVICE_CODE_GRANT_TYPE;
113
+ client_id: string;
114
+ device_code: string;
115
+ resource: string;
92
116
  };
117
+ /** RFC 8628 §3.1, with every resource the grant is asked for (RFC 8707): each token names one of them. */
118
+ export interface OAuthDeviceAuthorizationRequest {
119
+ client_id: string;
120
+ scope: string[];
121
+ resources: string[];
122
+ }
123
+ /** RFC 8628 §3.2. */
124
+ export interface OAuthDeviceAuthorizationResponse {
125
+ device_code: string;
126
+ user_code: string;
127
+ verification_uri: string;
128
+ verification_uri_complete: string;
129
+ expires_in: number;
130
+ interval: number;
131
+ }
132
+ /** The lifetimes a person picks between when approving a device: an hour, a day, a week. */
133
+ export declare const OAUTH_DEVICE_GRANT_LIFETIMES_SECONDS: readonly [3600, 86400, 604800];
134
+ export type OAuthDeviceGrantLifetime = (typeof OAUTH_DEVICE_GRANT_LIFETIMES_SECONDS)[number];
135
+ /** How many resources one device grant may name. */
136
+ export declare const MAX_OAUTH_DEVICE_RESOURCES = 8;
93
137
  export interface OAuthTokenResponse {
94
138
  access_token: string;
95
139
  token_type: 'Bearer';
@@ -107,9 +151,10 @@ export interface OAuthAuthorizationServerMetadata {
107
151
  authorization_endpoint: string;
108
152
  token_endpoint: string;
109
153
  revocation_endpoint: string;
154
+ device_authorization_endpoint: string;
110
155
  jwks_uri: string;
111
156
  response_types_supported: ['code'];
112
- grant_types_supported: ['authorization_code', 'refresh_token'];
157
+ grant_types_supported: ['authorization_code', 'refresh_token', typeof OAUTH_DEVICE_CODE_GRANT_TYPE];
113
158
  code_challenge_methods_supported: ['S256'];
114
159
  token_endpoint_auth_methods_supported: ['none', 'private_key_jwt'];
115
160
  token_endpoint_auth_signing_alg_values_supported: OAuthClientAssertionAlgorithm[];
@@ -123,10 +168,26 @@ export declare function parseOAuthManagedClient(value: unknown): OAuthManagedCli
123
168
  /** A fetched document cannot enlarge the managed registration's exact redirect allowlist. */
124
169
  export declare function parseOAuthClientMetadata(value: unknown, registration: OAuthManagedClient): OAuthClientMetadataDocument | null;
125
170
  export declare function parseOAuthResourceDto(value: unknown): OAuthResourceDto | null;
171
+ /** Separates a parameterized scope from its value: `deploy:alpha`. */
172
+ export declare const SCOPE_PARAMETER_SEPARATOR = ":";
173
+ /**
174
+ * The resource's grant a requested scope token selects and the narrowed permissions it holds, or null when the token
175
+ * selects none: an unknown scope, a parameterized scope without its value, a value on a scope that takes none.
176
+ */
177
+ export declare function resolveOAuthScopeToken(token: string, resource: OAuthResourceDto): KeyGrant[] | null;
126
178
  export declare function resolveOAuthAuthorizationScopes(scope: string | undefined, resource: OAuthResourceDto): string[] | null;
127
179
  export declare function parseOAuthAuthorizationAttempt(value: unknown): OAuthAuthorizationParseResult;
128
180
  export declare function parseOAuthAuthorizationRequest(value: unknown): OAuthAuthorizationRequest | null;
129
181
  export declare function parseOAuthTokenRequest(value: unknown): OAuthTokenRequest | null;
182
+ /**
183
+ * A device authorization request: its client, at least one scope and one to `MAX_OAUTH_DEVICE_RESOURCES` distinct
184
+ * resources. `resource` is the one parameter that may repeat (RFC 8707 §2), so the caller collects it into a list.
185
+ */
186
+ export declare function parseOAuthDeviceAuthorizationRequest(value: {
187
+ fields: Record<string, string>;
188
+ resources: string[];
189
+ }): OAuthDeviceAuthorizationRequest | null;
190
+ export declare function isOAuthDeviceGrantLifetime(value: number): value is OAuthDeviceGrantLifetime;
130
191
  /**
131
192
  * The client credential of a token or revocation request (RFC 7521 §4.2). Neither assertion field is no
132
193
  * credential; a half-present pair, another assertion type or an oversized assertion is null.