@julr/sesame 0.5.1 → 0.7.0
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/LICENSE.md +1 -1
- package/README.md +470 -64
- package/build/authorize_controller-sCZIjnc-.js +251 -0
- package/build/{client_info_controller-BucHGx4u.js → client_info_controller-B5A3tpbk.js} +11 -4
- package/build/commands/sesame_client.d.ts +20 -0
- package/build/commands/sesame_key.d.ts +12 -0
- package/build/commands/sesame_purge.d.ts +0 -2
- package/build/commands/sesame_purge.js +12 -3
- package/build/configure-t9q3KonY.js +31 -0
- package/build/configure.js +1 -24
- package/build/consent_controller-ChBboaSd.js +96 -0
- package/build/consent_retry-DMkfhmk9.js +41 -0
- package/build/{decorate-BKZEjPRg.js → decorate-RQD1h28J.js} +3 -9
- package/build/id_token_service-BtBUiL_n.js +54 -0
- package/build/index.d.ts +2 -8
- package/build/index.js +59 -10
- package/build/{introspect_controller-6bRt9sZt.js → introspect_controller-LVYGWhMj.js} +28 -10
- package/build/issue_authorization_code-Dr4-bbMp.js +39 -0
- package/build/jwks_controller-4HUVS_HC.js +22 -0
- package/build/{main-EbeMS5S9.js → main-Dx9kZv07.js} +35 -43
- package/build/{metadata_controller-DeaMRnUr.js → metadata_controller-hwfmxlF7.js} +81 -6
- package/build/oauth_error-CvxtZvjp.js +189 -0
- package/build/providers/sesame_provider.d.ts +1 -1
- package/build/providers/sesame_provider.js +17 -6
- package/build/{register_controller-sIJ1rxdM.js → register_controller-Cdk3c32j.js} +44 -8
- package/build/revoke_controller-Daz4Yqfs.js +48 -0
- package/build/services/main.js +3 -3
- package/build/sesame_manager-CeEmlzba.js +515 -0
- package/build/sesame_manager-DQxvsTEq.js +2 -0
- package/build/src/actions/authorize.d.ts +46 -0
- package/build/src/actions/exchange_authorization_code.d.ts +34 -0
- package/build/src/actions/exchange_client_credentials.d.ts +28 -0
- package/build/src/actions/exchange_refresh_token.d.ts +59 -0
- package/build/src/actions/issue_authorization_code.d.ts +26 -0
- package/build/src/controllers/authorize_controller.d.ts +18 -17
- package/build/src/controllers/consent_controller.d.ts +5 -0
- package/build/src/controllers/jwks_controller.d.ts +14 -0
- package/build/src/controllers/metadata_controller.d.ts +10 -3
- package/build/src/controllers/register_controller.d.ts +30 -30
- package/build/src/controllers/token_controller.d.ts +8 -5
- package/build/src/controllers/userinfo_controller.d.ts +14 -0
- package/build/src/guard/guard.d.ts +1 -1
- package/build/src/guard/lucid.d.ts +8 -0
- package/build/src/guard/lucid.js +46 -0
- package/build/src/guard/main.d.ts +2 -9
- package/build/src/guard/main.js +2 -6
- package/build/src/guard/types.d.ts +0 -9
- package/build/src/guard/user_provider.d.ts +9 -1
- package/build/src/middleware/any_scope_middleware.js +10 -1
- package/build/src/middleware/scope_middleware.js +10 -1
- package/build/src/models/oauth_authorization_code.d.ts +1 -0
- package/build/src/models/oauth_pending_authorization_request.d.ts +1 -0
- package/build/src/oauth_error.d.ts +74 -74
- package/build/src/routes.d.ts +3 -1
- package/build/src/services/client_service.d.ts +5 -2
- package/build/src/services/id_token_service.d.ts +30 -0
- package/build/src/services/key_service.d.ts +20 -0
- package/build/src/sesame_manager.d.ts +56 -4
- package/build/src/storage/consent_retry.d.ts +4 -0
- package/build/src/storage/drivers/kysely.d.ts +166 -0
- package/build/src/storage/drivers/kysely.js +480 -0
- package/build/src/storage/drivers/lucid.d.ts +162 -0
- package/build/src/storage/drivers/lucid.js +549 -0
- package/build/src/storage/migrations/kysely.d.ts +6 -0
- package/build/src/storage/types.d.ts +197 -0
- package/build/src/storage/types.js +1 -0
- package/build/src/stores.d.ts +21 -0
- package/build/src/types.d.ts +120 -0
- package/build/src/types.js +2 -0
- package/build/stubs/config/sesame.stub +4 -1
- package/build/stubs/config/sesame_kysely.stub +35 -0
- package/build/stubs/main.ts +5 -0
- package/build/stubs/migrations/create_oauth_authorization_codes_table.stub +1 -0
- package/build/stubs/migrations/create_oauth_pending_authorization_requests_table.stub +1 -0
- package/build/stubs/migrations/create_oauth_refresh_tokens_table.stub +1 -1
- package/build/stubs/migrations/kysely/create_oauth_tables.stub +151 -0
- package/build/taze.config.d.ts +2 -0
- package/build/token_controller-DRatCQNT.js +492 -0
- package/build/token_service-DDQ3Dxaj.js +59 -0
- package/build/types-DEtn2Zdb.js +75 -0
- package/build/userinfo_controller-YwN26wK-.js +37 -0
- package/build/vite.config.d.ts +2 -0
- package/package.json +55 -54
- package/build/authorize_controller-YUfAy-R2.js +0 -138
- package/build/client_service-WTNMqWzY.js +0 -65
- package/build/consent_controller-Dprwd1ed.js +0 -85
- package/build/oauth_access_token-bsoM5KeU.js +0 -18
- package/build/oauth_client-BIoY5jBR.js +0 -24
- package/build/oauth_error-CnJ3L8tf.js +0 -94
- package/build/revoke_controller-D6isoQCi.js +0 -41
- package/build/sesame_manager-Bu4MHqZV.js +0 -4
- package/build/sesame_manager-DwDZy5Vy.js +0 -167
- package/build/src/grants/authorization_code_grant.d.ts +0 -23
- package/build/src/grants/client_credentials_grant.d.ts +0 -23
- package/build/src/grants/refresh_token_grant.d.ts +0 -27
- package/build/token_controller-DzcrLMyS.js +0 -194
- package/build/token_service-fhoA4slP.js +0 -31
|
@@ -32,24 +32,24 @@ export declare const E_INVALID_REQUEST: {
|
|
|
32
32
|
code?: string;
|
|
33
33
|
status?: number;
|
|
34
34
|
}): {
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
message: string;
|
|
36
|
+
stack?: string;
|
|
37
|
+
cause?: unknown;
|
|
37
38
|
name: string;
|
|
38
39
|
help?: string;
|
|
39
40
|
code?: string;
|
|
40
41
|
status: number;
|
|
41
|
-
toString(): string;
|
|
42
42
|
get [Symbol.toStringTag](): string;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
toString(): string;
|
|
44
|
+
get oauthCode(): string;
|
|
45
|
+
handle(error: /*elided*/ any, ctx: HttpContext): void;
|
|
46
46
|
};
|
|
47
47
|
readonly status: number;
|
|
48
48
|
readonly code: string;
|
|
49
49
|
readonly message: string;
|
|
50
50
|
readonly oauthCode: string;
|
|
51
|
-
help?: string;
|
|
52
51
|
isError(error: unknown): error is Error;
|
|
52
|
+
help?: string;
|
|
53
53
|
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
54
54
|
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
55
55
|
stackTraceLimit: number;
|
|
@@ -72,23 +72,23 @@ export declare const E_INVALID_CLIENT: {
|
|
|
72
72
|
* @see https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-12#section-3.2.4
|
|
73
73
|
*/
|
|
74
74
|
handle(error: /*elided*/ any, ctx: HttpContext): void;
|
|
75
|
-
|
|
75
|
+
message: string;
|
|
76
|
+
stack?: string;
|
|
77
|
+
cause?: unknown;
|
|
76
78
|
name: string;
|
|
77
79
|
help?: string;
|
|
78
80
|
code?: string;
|
|
79
81
|
status: number;
|
|
80
|
-
toString(): string;
|
|
81
82
|
get [Symbol.toStringTag](): string;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
cause?: unknown;
|
|
83
|
+
toString(): string;
|
|
84
|
+
get oauthCode(): string;
|
|
85
85
|
};
|
|
86
86
|
readonly status: number;
|
|
87
87
|
readonly code: string;
|
|
88
88
|
readonly message: string;
|
|
89
89
|
readonly oauthCode: string;
|
|
90
|
-
help?: string;
|
|
91
90
|
isError(error: unknown): error is Error;
|
|
91
|
+
help?: string;
|
|
92
92
|
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
93
93
|
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
94
94
|
stackTraceLimit: number;
|
|
@@ -105,24 +105,24 @@ export declare const E_INVALID_GRANT: {
|
|
|
105
105
|
code?: string;
|
|
106
106
|
status?: number;
|
|
107
107
|
}): {
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
message: string;
|
|
109
|
+
stack?: string;
|
|
110
|
+
cause?: unknown;
|
|
110
111
|
name: string;
|
|
111
112
|
help?: string;
|
|
112
113
|
code?: string;
|
|
113
114
|
status: number;
|
|
114
|
-
toString(): string;
|
|
115
115
|
get [Symbol.toStringTag](): string;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
toString(): string;
|
|
117
|
+
get oauthCode(): string;
|
|
118
|
+
handle(error: /*elided*/ any, ctx: HttpContext): void;
|
|
119
119
|
};
|
|
120
120
|
readonly status: number;
|
|
121
121
|
readonly code: string;
|
|
122
122
|
readonly message: string;
|
|
123
123
|
readonly oauthCode: string;
|
|
124
|
-
help?: string;
|
|
125
124
|
isError(error: unknown): error is Error;
|
|
125
|
+
help?: string;
|
|
126
126
|
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
127
127
|
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
128
128
|
stackTraceLimit: number;
|
|
@@ -138,24 +138,24 @@ export declare const E_INVALID_SCOPE: {
|
|
|
138
138
|
code?: string;
|
|
139
139
|
status?: number;
|
|
140
140
|
}): {
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
message: string;
|
|
142
|
+
stack?: string;
|
|
143
|
+
cause?: unknown;
|
|
143
144
|
name: string;
|
|
144
145
|
help?: string;
|
|
145
146
|
code?: string;
|
|
146
147
|
status: number;
|
|
147
|
-
toString(): string;
|
|
148
148
|
get [Symbol.toStringTag](): string;
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
toString(): string;
|
|
150
|
+
get oauthCode(): string;
|
|
151
|
+
handle(error: /*elided*/ any, ctx: HttpContext): void;
|
|
152
152
|
};
|
|
153
153
|
readonly status: number;
|
|
154
154
|
readonly code: string;
|
|
155
155
|
readonly message: string;
|
|
156
156
|
readonly oauthCode: string;
|
|
157
|
-
help?: string;
|
|
158
157
|
isError(error: unknown): error is Error;
|
|
158
|
+
help?: string;
|
|
159
159
|
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
160
160
|
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
161
161
|
stackTraceLimit: number;
|
|
@@ -171,24 +171,24 @@ export declare const E_INVALID_TOKEN: {
|
|
|
171
171
|
code?: string;
|
|
172
172
|
status?: number;
|
|
173
173
|
}): {
|
|
174
|
-
get oauthCode(): string;
|
|
175
174
|
handle(error: /*elided*/ any, ctx: HttpContext): void;
|
|
175
|
+
message: string;
|
|
176
|
+
stack?: string;
|
|
177
|
+
cause?: unknown;
|
|
176
178
|
name: string;
|
|
177
179
|
help?: string;
|
|
178
180
|
code?: string;
|
|
179
181
|
status: number;
|
|
180
|
-
toString(): string;
|
|
181
182
|
get [Symbol.toStringTag](): string;
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
cause?: unknown;
|
|
183
|
+
toString(): string;
|
|
184
|
+
get oauthCode(): string;
|
|
185
185
|
};
|
|
186
186
|
readonly status: number;
|
|
187
187
|
readonly code: string;
|
|
188
188
|
readonly message: string;
|
|
189
189
|
readonly oauthCode: string;
|
|
190
|
-
help?: string;
|
|
191
190
|
isError(error: unknown): error is Error;
|
|
191
|
+
help?: string;
|
|
192
192
|
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
193
193
|
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
194
194
|
stackTraceLimit: number;
|
|
@@ -204,24 +204,24 @@ export declare const E_UNSUPPORTED_GRANT_TYPE: {
|
|
|
204
204
|
code?: string;
|
|
205
205
|
status?: number;
|
|
206
206
|
}): {
|
|
207
|
-
|
|
208
|
-
|
|
207
|
+
message: string;
|
|
208
|
+
stack?: string;
|
|
209
|
+
cause?: unknown;
|
|
209
210
|
name: string;
|
|
210
211
|
help?: string;
|
|
211
212
|
code?: string;
|
|
212
213
|
status: number;
|
|
213
|
-
toString(): string;
|
|
214
214
|
get [Symbol.toStringTag](): string;
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
215
|
+
toString(): string;
|
|
216
|
+
get oauthCode(): string;
|
|
217
|
+
handle(error: /*elided*/ any, ctx: HttpContext): void;
|
|
218
218
|
};
|
|
219
219
|
readonly status: number;
|
|
220
220
|
readonly code: string;
|
|
221
221
|
readonly message: string;
|
|
222
222
|
readonly oauthCode: string;
|
|
223
|
-
help?: string;
|
|
224
223
|
isError(error: unknown): error is Error;
|
|
224
|
+
help?: string;
|
|
225
225
|
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
226
226
|
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
227
227
|
stackTraceLimit: number;
|
|
@@ -237,24 +237,24 @@ export declare const E_UNSUPPORTED_RESPONSE_TYPE: {
|
|
|
237
237
|
code?: string;
|
|
238
238
|
status?: number;
|
|
239
239
|
}): {
|
|
240
|
-
|
|
241
|
-
|
|
240
|
+
message: string;
|
|
241
|
+
stack?: string;
|
|
242
|
+
cause?: unknown;
|
|
242
243
|
name: string;
|
|
243
244
|
help?: string;
|
|
244
245
|
code?: string;
|
|
245
246
|
status: number;
|
|
246
|
-
toString(): string;
|
|
247
247
|
get [Symbol.toStringTag](): string;
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
248
|
+
toString(): string;
|
|
249
|
+
get oauthCode(): string;
|
|
250
|
+
handle(error: /*elided*/ any, ctx: HttpContext): void;
|
|
251
251
|
};
|
|
252
252
|
readonly status: number;
|
|
253
253
|
readonly code: string;
|
|
254
254
|
readonly message: string;
|
|
255
255
|
readonly oauthCode: string;
|
|
256
|
-
help?: string;
|
|
257
256
|
isError(error: unknown): error is Error;
|
|
257
|
+
help?: string;
|
|
258
258
|
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
259
259
|
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
260
260
|
stackTraceLimit: number;
|
|
@@ -269,24 +269,24 @@ export declare const E_ACCESS_DENIED: {
|
|
|
269
269
|
code?: string;
|
|
270
270
|
status?: number;
|
|
271
271
|
}): {
|
|
272
|
-
|
|
273
|
-
|
|
272
|
+
message: string;
|
|
273
|
+
stack?: string;
|
|
274
|
+
cause?: unknown;
|
|
274
275
|
name: string;
|
|
275
276
|
help?: string;
|
|
276
277
|
code?: string;
|
|
277
278
|
status: number;
|
|
278
|
-
toString(): string;
|
|
279
279
|
get [Symbol.toStringTag](): string;
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
280
|
+
toString(): string;
|
|
281
|
+
get oauthCode(): string;
|
|
282
|
+
handle(error: /*elided*/ any, ctx: HttpContext): void;
|
|
283
283
|
};
|
|
284
284
|
readonly status: number;
|
|
285
285
|
readonly code: string;
|
|
286
286
|
readonly message: string;
|
|
287
287
|
readonly oauthCode: string;
|
|
288
|
-
help?: string;
|
|
289
288
|
isError(error: unknown): error is Error;
|
|
289
|
+
help?: string;
|
|
290
290
|
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
291
291
|
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
292
292
|
stackTraceLimit: number;
|
|
@@ -302,24 +302,24 @@ export declare const E_INVALID_CLIENT_METADATA: {
|
|
|
302
302
|
code?: string;
|
|
303
303
|
status?: number;
|
|
304
304
|
}): {
|
|
305
|
-
|
|
306
|
-
|
|
305
|
+
message: string;
|
|
306
|
+
stack?: string;
|
|
307
|
+
cause?: unknown;
|
|
307
308
|
name: string;
|
|
308
309
|
help?: string;
|
|
309
310
|
code?: string;
|
|
310
311
|
status: number;
|
|
311
|
-
toString(): string;
|
|
312
312
|
get [Symbol.toStringTag](): string;
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
313
|
+
toString(): string;
|
|
314
|
+
get oauthCode(): string;
|
|
315
|
+
handle(error: /*elided*/ any, ctx: HttpContext): void;
|
|
316
316
|
};
|
|
317
317
|
readonly status: number;
|
|
318
318
|
readonly code: string;
|
|
319
319
|
readonly message: string;
|
|
320
320
|
readonly oauthCode: string;
|
|
321
|
-
help?: string;
|
|
322
321
|
isError(error: unknown): error is Error;
|
|
322
|
+
help?: string;
|
|
323
323
|
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
324
324
|
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
325
325
|
stackTraceLimit: number;
|
|
@@ -335,24 +335,24 @@ export declare const E_SERVER_ERROR: {
|
|
|
335
335
|
code?: string;
|
|
336
336
|
status?: number;
|
|
337
337
|
}): {
|
|
338
|
-
|
|
339
|
-
|
|
338
|
+
message: string;
|
|
339
|
+
stack?: string;
|
|
340
|
+
cause?: unknown;
|
|
340
341
|
name: string;
|
|
341
342
|
help?: string;
|
|
342
343
|
code?: string;
|
|
343
344
|
status: number;
|
|
344
|
-
toString(): string;
|
|
345
345
|
get [Symbol.toStringTag](): string;
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
346
|
+
toString(): string;
|
|
347
|
+
get oauthCode(): string;
|
|
348
|
+
handle(error: /*elided*/ any, ctx: HttpContext): void;
|
|
349
349
|
};
|
|
350
350
|
readonly status: number;
|
|
351
351
|
readonly code: string;
|
|
352
352
|
readonly message: string;
|
|
353
353
|
readonly oauthCode: string;
|
|
354
|
-
help?: string;
|
|
355
354
|
isError(error: unknown): error is Error;
|
|
355
|
+
help?: string;
|
|
356
356
|
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
357
357
|
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
358
358
|
stackTraceLimit: number;
|
|
@@ -368,23 +368,23 @@ export declare const E_INSUFFICIENT_SCOPE: {
|
|
|
368
368
|
new (missingScopes: string[], message?: string): {
|
|
369
369
|
missingScopes: string[];
|
|
370
370
|
handle(error: /*elided*/ any, ctx: HttpContext): void;
|
|
371
|
-
|
|
371
|
+
message: string;
|
|
372
|
+
stack?: string;
|
|
373
|
+
cause?: unknown;
|
|
372
374
|
name: string;
|
|
373
375
|
help?: string;
|
|
374
376
|
code?: string;
|
|
375
377
|
status: number;
|
|
376
|
-
toString(): string;
|
|
377
378
|
get [Symbol.toStringTag](): string;
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
cause?: unknown;
|
|
379
|
+
toString(): string;
|
|
380
|
+
get oauthCode(): string;
|
|
381
381
|
};
|
|
382
382
|
readonly status: number;
|
|
383
383
|
readonly code: string;
|
|
384
384
|
readonly message: string;
|
|
385
385
|
readonly oauthCode: string;
|
|
386
|
-
help?: string;
|
|
387
386
|
isError(error: unknown): error is Error;
|
|
387
|
+
help?: string;
|
|
388
388
|
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
389
389
|
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
390
390
|
stackTraceLimit: number;
|
package/build/src/routes.d.ts
CHANGED
|
@@ -26,4 +26,6 @@ export declare function registerOAuthRoutes(router: Router): void;
|
|
|
26
26
|
* - `GET /.well-known/openid-configuration` — OpenID Connect discovery
|
|
27
27
|
* - `GET /.well-known/oauth-protected-resource` — Protected resource metadata (RFC 9728)
|
|
28
28
|
*/
|
|
29
|
-
export declare function registerWellKnownRoutes(router: Router
|
|
29
|
+
export declare function registerWellKnownRoutes(router: Router, options?: {
|
|
30
|
+
jwksPath?: string;
|
|
31
|
+
}): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SesameManager } from '../sesame_manager.ts';
|
|
2
|
+
import type { OAuthClientRecord } from '../storage/types.ts';
|
|
2
3
|
/**
|
|
3
4
|
* Extracted client credentials from a request.
|
|
4
5
|
*/
|
|
@@ -20,6 +21,8 @@ export interface ClientCredentials {
|
|
|
20
21
|
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-2.3
|
|
21
22
|
*/
|
|
22
23
|
export declare class ClientService {
|
|
24
|
+
#private;
|
|
25
|
+
constructor(manager?: SesameManager);
|
|
23
26
|
/**
|
|
24
27
|
* Parse an HTTP Basic Authorization header into client credentials.
|
|
25
28
|
* Follows RFC 6749 §2.3.1 — the client_id and client_secret are
|
|
@@ -47,7 +50,7 @@ export declare class ClientService {
|
|
|
47
50
|
authorizationHeader?: string;
|
|
48
51
|
bodyClientId?: string;
|
|
49
52
|
bodyClientSecret?: string;
|
|
50
|
-
}): Promise<
|
|
53
|
+
}): Promise<OAuthClientRecord>;
|
|
51
54
|
/**
|
|
52
55
|
* Validate that requested scopes are within the client's
|
|
53
56
|
* allowed scopes. Throws `E_INVALID_SCOPE` if any scope
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { SesameManager } from '../sesame_manager.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Builds and signs OIDC `id_token` JWTs.
|
|
4
|
+
*/
|
|
5
|
+
export declare class IdTokenService {
|
|
6
|
+
#private;
|
|
7
|
+
constructor(manager: SesameManager);
|
|
8
|
+
/**
|
|
9
|
+
* Compute `at_hash` — left half of SHA-256 hash of the access token, base64url-encoded.
|
|
10
|
+
* @see OIDC Core §3.1.3.6
|
|
11
|
+
*/
|
|
12
|
+
static computeAtHash(accessToken: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Filter out reserved claims that the server owns.
|
|
15
|
+
*/
|
|
16
|
+
static filterReservedClaims(claims: Record<string, unknown>): Record<string, unknown>;
|
|
17
|
+
/**
|
|
18
|
+
* Resolve user OIDC claims by calling `getOidcClaims` if present,
|
|
19
|
+
* then filtering out reserved protocol claims.
|
|
20
|
+
*/
|
|
21
|
+
static resolveUserClaims(user: unknown, scopes: string[]): Promise<Record<string, unknown>>;
|
|
22
|
+
sign(options: {
|
|
23
|
+
sub: string;
|
|
24
|
+
clientId: string;
|
|
25
|
+
scopes: string[];
|
|
26
|
+
accessToken: string;
|
|
27
|
+
user: unknown;
|
|
28
|
+
nonce?: string;
|
|
29
|
+
}): Promise<string>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type JWK } from 'jose';
|
|
2
|
+
/**
|
|
3
|
+
* Manages the RSA key pair used to sign ID tokens.
|
|
4
|
+
* Accepts a JWK from config, caches the imported private key
|
|
5
|
+
* and public JWK for JWKS export.
|
|
6
|
+
*/
|
|
7
|
+
export declare class KeyService {
|
|
8
|
+
#private;
|
|
9
|
+
constructor(jwk: JWK);
|
|
10
|
+
/**
|
|
11
|
+
* Compute a `kid` from public key components (SHA-256, base64url).
|
|
12
|
+
* Same approach as node-oidc-provider.
|
|
13
|
+
*/
|
|
14
|
+
static computeKid(jwk: JWK): string;
|
|
15
|
+
sign(payload: Record<string, unknown>): Promise<string>;
|
|
16
|
+
getPublicJwks(): {
|
|
17
|
+
keys: JWK[];
|
|
18
|
+
};
|
|
19
|
+
get kid(): string;
|
|
20
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Router } from '@adonisjs/core/http';
|
|
2
|
-
import { type ResolvedSesameConfig, type Scope } from './types.ts';
|
|
2
|
+
import { type CreateClientOptions, type CreateClientResult, type ResolvedSesameConfig, type Scope, type UpdateClientOptions } from './types.ts';
|
|
3
|
+
import { KeyService } from './services/key_service.ts';
|
|
4
|
+
import type { OAuthClientRecord, SesameStore } from './storage/types.ts';
|
|
3
5
|
export interface PurgeResult {
|
|
4
6
|
accessTokens: number;
|
|
5
7
|
refreshTokens: number;
|
|
@@ -14,14 +16,26 @@ export interface PurgeResult {
|
|
|
14
16
|
*/
|
|
15
17
|
export declare class SesameManager {
|
|
16
18
|
#private;
|
|
17
|
-
constructor(config: ResolvedSesameConfig, router: Router);
|
|
19
|
+
constructor(config: ResolvedSesameConfig, router: Router, store: SesameStore);
|
|
18
20
|
get config(): ResolvedSesameConfig;
|
|
21
|
+
get store(): SesameStore;
|
|
22
|
+
get keyService(): KeyService;
|
|
23
|
+
get isOidcEnabled(): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Load a user by ID using the configured user provider.
|
|
26
|
+
* Returns the original user model instance, or null if not found.
|
|
27
|
+
*/
|
|
28
|
+
findUserById(userId: string): Promise<unknown | null>;
|
|
19
29
|
/**
|
|
20
30
|
* Check if a scope is registered in the server configuration.
|
|
21
31
|
*
|
|
22
32
|
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-3.3
|
|
23
33
|
*/
|
|
24
34
|
hasScope(scope: Scope): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Check if the requested scope list uses any OIDC-specific scopes.
|
|
37
|
+
*/
|
|
38
|
+
usesOidcScopes(scopes: Scope[]): boolean;
|
|
25
39
|
/**
|
|
26
40
|
* Return the list of scopes that are not registered in the
|
|
27
41
|
* server configuration. When no scopes are configured, all
|
|
@@ -58,6 +72,36 @@ export declare class SesameManager {
|
|
|
58
72
|
expiredOnly?: boolean;
|
|
59
73
|
retentionHours?: number;
|
|
60
74
|
}): Promise<PurgeResult>;
|
|
75
|
+
/**
|
|
76
|
+
* Create a new OAuth client programmatically.
|
|
77
|
+
* Returns the client and the raw secret (only available at creation time).
|
|
78
|
+
*/
|
|
79
|
+
createClient(options: CreateClientOptions): Promise<CreateClientResult>;
|
|
80
|
+
/**
|
|
81
|
+
* Find a client by its public client_id.
|
|
82
|
+
*/
|
|
83
|
+
findClient(clientId: string): Promise<OAuthClientRecord | null>;
|
|
84
|
+
/**
|
|
85
|
+
* List all clients, optionally filtered by userId.
|
|
86
|
+
*/
|
|
87
|
+
listClients(options?: {
|
|
88
|
+
userId?: string;
|
|
89
|
+
}): Promise<OAuthClientRecord[]>;
|
|
90
|
+
/**
|
|
91
|
+
* Update an existing client by its public client_id.
|
|
92
|
+
* Returns the updated client, or null if not found.
|
|
93
|
+
*/
|
|
94
|
+
updateClient(clientId: string, options: UpdateClientOptions): Promise<OAuthClientRecord | null>;
|
|
95
|
+
/**
|
|
96
|
+
* Delete a client and all its associated tokens, codes, and consents.
|
|
97
|
+
* Returns true if the client was found and deleted.
|
|
98
|
+
*/
|
|
99
|
+
deleteClient(clientId: string): Promise<boolean>;
|
|
100
|
+
/**
|
|
101
|
+
* Rotate the secret of a confidential client.
|
|
102
|
+
* Returns the new raw secret, or null if the client is public or not found.
|
|
103
|
+
*/
|
|
104
|
+
rotateClientSecret(clientId: string): Promise<string | null>;
|
|
61
105
|
/**
|
|
62
106
|
* Register OAuth 2.1 endpoint routes (token, authorize, consent, etc.).
|
|
63
107
|
*
|
|
@@ -77,12 +121,20 @@ export declare class SesameManager {
|
|
|
77
121
|
*/
|
|
78
122
|
registerRoutes(): void;
|
|
79
123
|
/**
|
|
80
|
-
* Register
|
|
124
|
+
* Register discovery routes at the root level.
|
|
81
125
|
*
|
|
82
126
|
* Must be called outside any prefix group so endpoints
|
|
83
127
|
* remain at `/.well-known/...`.
|
|
84
128
|
*/
|
|
85
|
-
|
|
129
|
+
registerDiscoveryRoutes(options?: {
|
|
130
|
+
jwksPath?: string;
|
|
131
|
+
}): void;
|
|
132
|
+
/**
|
|
133
|
+
* @deprecated Use `registerDiscoveryRoutes()` instead.
|
|
134
|
+
*/
|
|
135
|
+
registerWellKnownRoutes(options?: {
|
|
136
|
+
jwksPath?: string;
|
|
137
|
+
}): void;
|
|
86
138
|
/**
|
|
87
139
|
* Register a `/.well-known/oauth-protected-resource` endpoint
|
|
88
140
|
* for a specific resource path (RFC 9728). Useful for MCP
|