@typekcz-nocobase-plugins/plugin-oidc-plus 1.0.3 → 1.0.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.
Files changed (77) hide show
  1. package/dist/client/index.js +1 -1
  2. package/dist/externalVersion.js +9 -9
  3. package/package.json +1 -1
  4. package/src/client/OIDCButton.tsx +70 -0
  5. package/src/client/Options.tsx +359 -0
  6. package/src/client/index.tsx +19 -0
  7. package/src/client/locale/index.ts +18 -0
  8. package/src/constants.ts +7 -0
  9. package/src/index.ts +2 -0
  10. package/src/locale/en-US.json +40 -0
  11. package/src/locale/es-ES.json +25 -0
  12. package/src/locale/fr-FR.json +21 -0
  13. package/src/locale/ko_KR.json +28 -0
  14. package/src/locale/pt-BR.json +21 -0
  15. package/src/locale/zh-CN.json +28 -0
  16. package/src/server/__tests__/oidc.test.ts +283 -0
  17. package/src/server/actions/getAuthUrl.ts +25 -0
  18. package/src/server/actions/redirect.ts +32 -0
  19. package/src/server/index.ts +1 -0
  20. package/src/server/oidc-auth.ts +169 -0
  21. package/src/server/plugin.ts +63 -0
  22. package/src/swagger/index.ts +157 -0
  23. package/dist/node_modules/nanoid/.devcontainer.json +0 -23
  24. package/dist/node_modules/nanoid/LICENSE +0 -20
  25. package/dist/node_modules/nanoid/async/index.browser.cjs +0 -69
  26. package/dist/node_modules/nanoid/async/index.browser.js +0 -69
  27. package/dist/node_modules/nanoid/async/index.cjs +0 -71
  28. package/dist/node_modules/nanoid/async/index.d.ts +0 -56
  29. package/dist/node_modules/nanoid/async/index.js +0 -71
  30. package/dist/node_modules/nanoid/async/index.native.js +0 -57
  31. package/dist/node_modules/nanoid/async/package.json +0 -12
  32. package/dist/node_modules/nanoid/bin/nanoid.cjs +0 -55
  33. package/dist/node_modules/nanoid/index.browser.cjs +0 -72
  34. package/dist/node_modules/nanoid/index.browser.js +0 -72
  35. package/dist/node_modules/nanoid/index.cjs +0 -1
  36. package/dist/node_modules/nanoid/index.d.cts +0 -91
  37. package/dist/node_modules/nanoid/index.d.ts +0 -91
  38. package/dist/node_modules/nanoid/index.js +0 -85
  39. package/dist/node_modules/nanoid/nanoid.js +0 -1
  40. package/dist/node_modules/nanoid/non-secure/index.cjs +0 -34
  41. package/dist/node_modules/nanoid/non-secure/index.d.ts +0 -33
  42. package/dist/node_modules/nanoid/non-secure/index.js +0 -34
  43. package/dist/node_modules/nanoid/non-secure/package.json +0 -6
  44. package/dist/node_modules/nanoid/package.json +0 -1
  45. package/dist/node_modules/nanoid/url-alphabet/index.cjs +0 -7
  46. package/dist/node_modules/nanoid/url-alphabet/index.js +0 -7
  47. package/dist/node_modules/nanoid/url-alphabet/package.json +0 -6
  48. package/dist/node_modules/openid-client/lib/client.js +0 -1884
  49. package/dist/node_modules/openid-client/lib/device_flow_handle.js +0 -125
  50. package/dist/node_modules/openid-client/lib/errors.js +0 -55
  51. package/dist/node_modules/openid-client/lib/helpers/assert.js +0 -24
  52. package/dist/node_modules/openid-client/lib/helpers/base64url.js +0 -13
  53. package/dist/node_modules/openid-client/lib/helpers/client.js +0 -208
  54. package/dist/node_modules/openid-client/lib/helpers/consts.js +0 -7
  55. package/dist/node_modules/openid-client/lib/helpers/decode_jwt.js +0 -27
  56. package/dist/node_modules/openid-client/lib/helpers/deep_clone.js +0 -1
  57. package/dist/node_modules/openid-client/lib/helpers/defaults.js +0 -27
  58. package/dist/node_modules/openid-client/lib/helpers/generators.js +0 -14
  59. package/dist/node_modules/openid-client/lib/helpers/is_key_object.js +0 -4
  60. package/dist/node_modules/openid-client/lib/helpers/is_plain_object.js +0 -1
  61. package/dist/node_modules/openid-client/lib/helpers/issuer.js +0 -111
  62. package/dist/node_modules/openid-client/lib/helpers/keystore.js +0 -298
  63. package/dist/node_modules/openid-client/lib/helpers/merge.js +0 -24
  64. package/dist/node_modules/openid-client/lib/helpers/pick.js +0 -9
  65. package/dist/node_modules/openid-client/lib/helpers/process_response.js +0 -71
  66. package/dist/node_modules/openid-client/lib/helpers/request.js +0 -200
  67. package/dist/node_modules/openid-client/lib/helpers/unix_timestamp.js +0 -1
  68. package/dist/node_modules/openid-client/lib/helpers/weak_cache.js +0 -1
  69. package/dist/node_modules/openid-client/lib/helpers/webfinger_normalize.js +0 -71
  70. package/dist/node_modules/openid-client/lib/helpers/www_authenticate_parser.js +0 -14
  71. package/dist/node_modules/openid-client/lib/index.js +0 -1
  72. package/dist/node_modules/openid-client/lib/issuer.js +0 -192
  73. package/dist/node_modules/openid-client/lib/issuer_registry.js +0 -3
  74. package/dist/node_modules/openid-client/lib/passport_strategy.js +0 -205
  75. package/dist/node_modules/openid-client/lib/token_set.js +0 -35
  76. package/dist/node_modules/openid-client/package.json +0 -1
  77. package/dist/node_modules/openid-client/types/index.d.ts +0 -623
@@ -1,623 +0,0 @@
1
- /// <reference types="node" />
2
- // TypeScript Version: 3.6
3
-
4
- import * as http from 'http';
5
- import * as https from 'https';
6
- import * as http2 from 'http2';
7
-
8
- import { URL } from 'url';
9
- import * as jose from 'jose';
10
- import * as crypto from 'crypto';
11
- import { format } from 'util';
12
-
13
- export type HttpOptions = Partial<
14
- Pick<
15
- https.RequestOptions,
16
- | 'agent'
17
- | 'ca'
18
- | 'cert'
19
- | 'crl'
20
- | 'headers'
21
- | 'key'
22
- | 'lookup'
23
- | 'passphrase'
24
- | 'pfx'
25
- | 'timeout'
26
- >
27
- >;
28
- export type RetryFunction = (retry: number, error: Error) => number;
29
- export type CustomHttpOptionsProvider = (
30
- url: URL,
31
- options: Omit<https.RequestOptions, keyof URL>,
32
- ) => HttpOptions;
33
- export type TokenTypeHint = 'access_token' | 'refresh_token' | string;
34
- export type DPoPInput = crypto.KeyObject | Parameters<typeof crypto.createPrivateKey>[0];
35
-
36
- interface UnknownObject {
37
- [key: string]: unknown;
38
- }
39
-
40
- export const custom: {
41
- setHttpOptionsDefaults(params: HttpOptions): undefined;
42
- readonly http_options: unique symbol;
43
- readonly clock_tolerance: unique symbol;
44
- };
45
-
46
- export type ResponseType = 'code' | 'id_token' | 'code id_token' | 'none' | string;
47
- export type ClientAuthMethod =
48
- | 'client_secret_basic'
49
- | 'client_secret_post'
50
- | 'client_secret_jwt'
51
- | 'private_key_jwt'
52
- | 'tls_client_auth'
53
- | 'self_signed_tls_client_auth'
54
- | 'none';
55
-
56
- export interface ClientMetadata {
57
- // important
58
- client_id: string;
59
- id_token_signed_response_alg?: string;
60
- token_endpoint_auth_method?: ClientAuthMethod;
61
- client_secret?: string;
62
- redirect_uris?: string[];
63
- response_types?: ResponseType[];
64
- post_logout_redirect_uris?: string[];
65
- default_max_age?: number;
66
- require_auth_time?: boolean;
67
- tls_client_certificate_bound_access_tokens?: boolean;
68
- request_object_signing_alg?: string;
69
-
70
- // less important
71
- id_token_encrypted_response_alg?: string;
72
- id_token_encrypted_response_enc?: string;
73
- introspection_endpoint_auth_method?: ClientAuthMethod;
74
- introspection_endpoint_auth_signing_alg?: string;
75
- request_object_encryption_alg?: string;
76
- request_object_encryption_enc?: string;
77
- revocation_endpoint_auth_method?: ClientAuthMethod;
78
- revocation_endpoint_auth_signing_alg?: string;
79
- token_endpoint_auth_signing_alg?: string;
80
- userinfo_encrypted_response_alg?: string;
81
- userinfo_encrypted_response_enc?: string;
82
- userinfo_signed_response_alg?: string;
83
- authorization_encrypted_response_alg?: string;
84
- authorization_encrypted_response_enc?: string;
85
- authorization_signed_response_alg?: string;
86
-
87
- [key: string]: unknown;
88
- }
89
-
90
- export interface ClaimsParameterMember {
91
- essential?: boolean;
92
- value?: string;
93
- values?: string[];
94
-
95
- [key: string]: unknown;
96
- }
97
-
98
- export interface AuthorizationParameters {
99
- acr_values?: string;
100
- audience?: string;
101
- claims?:
102
- | string
103
- | {
104
- id_token?: {
105
- [key: string]: null | ClaimsParameterMember;
106
- };
107
- userinfo?: {
108
- [key: string]: null | ClaimsParameterMember;
109
- };
110
- };
111
- claims_locales?: string;
112
- client_id?: string;
113
- code_challenge_method?: string;
114
- code_challenge?: string;
115
- display?: string;
116
- id_token_hint?: string;
117
- login_hint?: string;
118
- max_age?: number;
119
- nonce?: string;
120
- prompt?: string;
121
- redirect_uri?: string;
122
- registration?: string;
123
- request_uri?: string;
124
- request?: string;
125
- resource?: string | string[];
126
- response_mode?: string;
127
- response_type?: string;
128
- scope?: string;
129
- state?: string;
130
- ui_locales?: string;
131
-
132
- [key: string]: unknown;
133
- }
134
-
135
- export interface EndSessionParameters {
136
- id_token_hint?: TokenSet | string;
137
- post_logout_redirect_uri?: string;
138
- state?: string;
139
- client_id?: string;
140
- logout_hint?: string;
141
-
142
- [key: string]: unknown;
143
- }
144
-
145
- export interface CallbackParamsType {
146
- access_token?: string;
147
- code?: string;
148
- error?: string;
149
- error_description?: string;
150
- error_uri?: string;
151
- expires_in?: string;
152
- id_token?: string;
153
- state?: string;
154
- token_type?: string;
155
- session_state?: string;
156
- response?: string;
157
-
158
- [key: string]: unknown;
159
- }
160
-
161
- export interface OAuthCallbackChecks {
162
- response_type?: string;
163
- state?: string;
164
- code_verifier?: string;
165
- jarm?: boolean;
166
- scope?: string; // TODO: remove in v6.x
167
- }
168
-
169
- export interface OpenIDCallbackChecks extends OAuthCallbackChecks {
170
- max_age?: number;
171
- nonce?: string;
172
- }
173
-
174
- export interface CallbackExtras {
175
- exchangeBody?: object;
176
- clientAssertionPayload?: object;
177
- DPoP?: DPoPInput;
178
- }
179
-
180
- export interface RefreshExtras {
181
- exchangeBody?: object;
182
- clientAssertionPayload?: object;
183
- DPoP?: DPoPInput;
184
- }
185
-
186
- export interface GrantBody {
187
- grant_type: string;
188
-
189
- [key: string]: unknown;
190
- }
191
-
192
- export interface GrantExtras {
193
- clientAssertionPayload?: object;
194
- DPoP?: DPoPInput;
195
- }
196
-
197
- export interface IntrospectExtras {
198
- introspectBody?: object;
199
- clientAssertionPayload?: object;
200
- }
201
-
202
- export interface RevokeExtras {
203
- revokeBody?: object;
204
- clientAssertionPayload?: object;
205
- }
206
-
207
- export interface RequestObjectPayload extends AuthorizationParameters {
208
- client_id?: string;
209
- iss?: string;
210
- aud?: string;
211
- iat?: number;
212
- exp?: number;
213
- jti?: string;
214
-
215
- [key: string]: unknown;
216
- }
217
-
218
- export interface RegisterOther {
219
- jwks?: { keys: jose.JWK[] };
220
- initialAccessToken?: string;
221
- }
222
-
223
- export interface DeviceAuthorizationParameters {
224
- client_id?: string;
225
- scope?: string;
226
-
227
- [key: string]: unknown;
228
- }
229
-
230
- export interface DeviceAuthorizationExtras {
231
- exchangeBody?: object;
232
- clientAssertionPayload?: object;
233
- DPoP?: DPoPInput;
234
- }
235
-
236
- export interface PushedAuthorizationRequestExtras {
237
- clientAssertionPayload?: object;
238
- }
239
-
240
- export type Address<ExtendedAddress extends {} = UnknownObject> = Override<
241
- {
242
- formatted?: string;
243
- street_address?: string;
244
- locality?: string;
245
- region?: string;
246
- postal_code?: string;
247
- country?: string;
248
- },
249
- ExtendedAddress
250
- >;
251
-
252
- export type UserinfoResponse<
253
- UserInfo extends {} = UnknownObject,
254
- ExtendedAddress extends {} = UnknownObject,
255
- > = Override<
256
- {
257
- sub: string;
258
- name?: string;
259
- given_name?: string;
260
- family_name?: string;
261
- middle_name?: string;
262
- nickname?: string;
263
- preferred_username?: string;
264
- profile?: string;
265
- picture?: string;
266
- website?: string;
267
- email?: string;
268
- email_verified?: boolean;
269
- gender?: string;
270
- birthdate?: string;
271
- zoneinfo?: string;
272
- locale?: string;
273
- phone_number?: string;
274
- updated_at?: number;
275
- address?: Address<ExtendedAddress>;
276
- },
277
- UserInfo
278
- >;
279
-
280
- export interface IntrospectionResponse {
281
- active: boolean;
282
- client_id?: string;
283
- exp?: number;
284
- iat?: number;
285
- sid?: string;
286
- iss?: string;
287
- jti?: string;
288
- username?: string;
289
- aud?: string | string[];
290
- scope: string;
291
- sub?: string;
292
- nbf?: number;
293
- token_type?: string;
294
- cnf?: {
295
- 'x5t#S256'?: string;
296
-
297
- [key: string]: unknown;
298
- };
299
-
300
- [key: string]: unknown;
301
- }
302
-
303
- export interface ClientOptions {
304
- additionalAuthorizedParties?: string | string[];
305
- }
306
-
307
- export type Client = InstanceType<Issuer['Client']>;
308
- declare class BaseClient {
309
- constructor(metadata: ClientMetadata, jwks?: { keys: jose.JWK[] }, options?: ClientOptions);
310
- [custom.http_options]: CustomHttpOptionsProvider;
311
- [custom.clock_tolerance]: number;
312
- metadata: ClientMetadata;
313
- issuer: Issuer<this>;
314
- static issuer: Issuer<BaseClient>;
315
-
316
- authorizationUrl(parameters?: AuthorizationParameters): string;
317
- endSessionUrl(parameters?: EndSessionParameters): string;
318
- callbackParams(
319
- input: string | http.IncomingMessage | http2.Http2ServerRequest,
320
- ): CallbackParamsType;
321
- callback(
322
- redirectUri: string | undefined,
323
- parameters: CallbackParamsType,
324
- checks?: OpenIDCallbackChecks,
325
- extras?: CallbackExtras,
326
- ): Promise<TokenSet>;
327
- oauthCallback(
328
- redirectUri: string | undefined,
329
- parameters: CallbackParamsType,
330
- checks?: OAuthCallbackChecks,
331
- extras?: CallbackExtras,
332
- ): Promise<TokenSet>;
333
- refresh(refreshToken: TokenSet | string, extras?: RefreshExtras): Promise<TokenSet>;
334
- userinfo<TUserInfo extends {} = UnknownObject, TAddress extends {} = UnknownObject>(
335
- accessToken: TokenSet | string,
336
- options?: {
337
- method?: 'GET' | 'POST';
338
- via?: 'header' | 'body';
339
- tokenType?: string;
340
- params?: object;
341
- DPoP?: DPoPInput;
342
- },
343
- ): Promise<UserinfoResponse<TUserInfo, TAddress>>;
344
- requestResource(
345
- resourceUrl: string | URL,
346
- accessToken: TokenSet | string,
347
- options?: {
348
- headers?: object;
349
- body?: string | Buffer;
350
- method?: 'GET' | 'POST' | 'PUT' | 'HEAD' | 'DELETE' | 'OPTIONS' | 'TRACE' | 'PATCH';
351
- tokenType?: string;
352
- DPoP?: DPoPInput;
353
- },
354
- ): Promise<{ body?: Buffer } & http.IncomingMessage>;
355
- grant(body: GrantBody, extras?: GrantExtras): Promise<TokenSet>;
356
- introspect(
357
- token: string,
358
- tokenTypeHint?: TokenTypeHint,
359
- extras?: IntrospectExtras,
360
- ): Promise<IntrospectionResponse>;
361
- revoke(token: string, tokenTypeHint?: TokenTypeHint, extras?: RevokeExtras): Promise<undefined>;
362
- requestObject(payload: RequestObjectPayload): Promise<string>;
363
- deviceAuthorization(
364
- parameters?: DeviceAuthorizationParameters,
365
- extras?: DeviceAuthorizationExtras,
366
- ): Promise<DeviceFlowHandle<BaseClient>>;
367
- pushedAuthorizationRequest(
368
- parameters?: AuthorizationParameters,
369
- extras?: PushedAuthorizationRequestExtras,
370
- ): Promise<{
371
- request_uri: string;
372
- expires_in: number;
373
- [key: string]: unknown;
374
- }>;
375
- static register(metadata: object, other?: RegisterOther & ClientOptions): Promise<BaseClient>;
376
- static fromUri(
377
- registrationClientUri: string,
378
- registrationAccessToken: string,
379
- jwks?: { keys: jose.JWK[] },
380
- clientOptions?: ClientOptions,
381
- ): Promise<BaseClient>;
382
- static [custom.http_options]: CustomHttpOptionsProvider;
383
-
384
- [key: string]: unknown;
385
- }
386
-
387
- interface DeviceFlowPollOptions {
388
- // @ts-ignore
389
- signal?: AbortSignal;
390
- }
391
-
392
- export class DeviceFlowHandle<TClient extends BaseClient = BaseClient> {
393
- poll(options?: DeviceFlowPollOptions): Promise<TokenSet>;
394
- abort(): void;
395
- expired(): boolean;
396
- expires_at: number;
397
- client: TClient;
398
- user_code: string;
399
- device_code: string;
400
- verification_uri: string;
401
- verification_uri_complete: string;
402
- expires_in: number;
403
- }
404
-
405
- export interface IssuerMetadata {
406
- issuer: string;
407
- authorization_endpoint?: string;
408
- token_endpoint?: string;
409
- jwks_uri?: string;
410
- userinfo_endpoint?: string;
411
- revocation_endpoint?: string;
412
- end_session_endpoint?: string;
413
- registration_endpoint?: string;
414
- token_endpoint_auth_methods_supported?: string[];
415
- token_endpoint_auth_signing_alg_values_supported?: string[];
416
- introspection_endpoint_auth_methods_supported?: string[];
417
- introspection_endpoint_auth_signing_alg_values_supported?: string[];
418
- revocation_endpoint_auth_methods_supported?: string[];
419
- revocation_endpoint_auth_signing_alg_values_supported?: string[];
420
- request_object_signing_alg_values_supported?: string[];
421
- mtls_endpoint_aliases?: MtlsEndpointAliases;
422
-
423
- [key: string]: unknown;
424
- }
425
-
426
- export interface MtlsEndpointAliases {
427
- token_endpoint?: string;
428
- userinfo_endpoint?: string;
429
- revocation_endpoint?: string;
430
- introspection_endpoint?: string;
431
- device_authorization_endpoint?: string;
432
- }
433
-
434
- export interface TypeOfGenericClient<TClient extends BaseClient = BaseClient> {
435
- new (metadata: ClientMetadata, jwks?: { keys: jose.JWK[] }, options?: ClientOptions): TClient;
436
- [custom.http_options]: CustomHttpOptionsProvider;
437
- [custom.clock_tolerance]: number;
438
- }
439
-
440
- export class Issuer<TClient extends BaseClient = BaseClient> {
441
- constructor(metadata: IssuerMetadata);
442
-
443
- Client: TypeOfGenericClient<TClient>;
444
-
445
- FAPI1Client: TypeOfGenericClient<TClient>;
446
- FAPI2Client: TypeOfGenericClient<TClient>;
447
-
448
- metadata: IssuerMetadata;
449
- [custom.http_options]: CustomHttpOptionsProvider;
450
- static discover(issuer: string): Promise<Issuer<BaseClient>>;
451
- static webfinger(input: string): Promise<Issuer<BaseClient>>;
452
- static [custom.http_options]: CustomHttpOptionsProvider;
453
- [key: string]: unknown;
454
- }
455
-
456
- export interface TokenSetParameters {
457
- access_token?: string;
458
- token_type?: string;
459
- id_token?: string;
460
- refresh_token?: string;
461
- scope?: string;
462
-
463
- expires_at?: number;
464
- session_state?: string;
465
-
466
- [key: string]: unknown;
467
- }
468
-
469
- export interface IdTokenClaims extends UserinfoResponse {
470
- acr?: string;
471
- amr?: string[];
472
- at_hash?: string;
473
- aud: string | string[];
474
- auth_time?: number;
475
- azp?: string;
476
- c_hash?: string;
477
- exp: number;
478
- iat: number;
479
- iss: string;
480
- nonce?: string;
481
- s_hash?: string;
482
- sub: string;
483
-
484
- [key: string]: unknown;
485
- }
486
-
487
- export class TokenSet implements TokenSetParameters {
488
- access_token?: string;
489
- token_type?: string;
490
- id_token?: string;
491
- refresh_token?: string;
492
- expires_in?: number;
493
- expires_at?: number;
494
- session_state?: string;
495
- scope?: string;
496
-
497
- constructor(input?: TokenSetParameters);
498
-
499
- expired(): boolean;
500
- claims(): IdTokenClaims;
501
-
502
- [key: string]: unknown;
503
- }
504
-
505
- export type StrategyVerifyCallbackUserInfo<
506
- TUser,
507
- TUserInfo extends {} = UnknownObject,
508
- TAddress extends {} = UnknownObject,
509
- > = (
510
- tokenset: TokenSet,
511
- userinfo: UserinfoResponse<TUserInfo, TAddress>,
512
- done: (err: any, user?: TUser) => void,
513
- ) => void;
514
- export type StrategyVerifyCallback<TUser> = (
515
- tokenset: TokenSet,
516
- done: (err: any, user?: TUser) => void,
517
- ) => void;
518
- export type StrategyVerifyCallbackReqUserInfo<
519
- TUser,
520
- TUserInfo extends {} = UnknownObject,
521
- TAddress extends {} = UnknownObject,
522
- > = (
523
- req: http.IncomingMessage,
524
- tokenset: TokenSet,
525
- userinfo: UserinfoResponse<TUserInfo, TAddress>,
526
- done: (err: any, user?: TUser) => void,
527
- ) => void;
528
- export type StrategyVerifyCallbackReq<TUser> = (
529
- req: http.IncomingMessage,
530
- tokenset: TokenSet,
531
- done: (err: any, user?: TUser) => void,
532
- ) => void;
533
-
534
- export interface StrategyOptions<TClient extends BaseClient = BaseClient> {
535
- client: TClient;
536
- params?: AuthorizationParameters;
537
- extras?: CallbackExtras;
538
- passReqToCallback?: boolean;
539
- usePKCE?: boolean | string;
540
- sessionKey?: string;
541
- }
542
-
543
- export class Strategy<TUser, TClient extends BaseClient = BaseClient> {
544
- constructor(
545
- options: StrategyOptions<TClient>,
546
- verify:
547
- | StrategyVerifyCallback<TUser>
548
- | StrategyVerifyCallbackUserInfo<TUser>
549
- | StrategyVerifyCallbackReq<TUser>
550
- | StrategyVerifyCallbackReqUserInfo<TUser>,
551
- );
552
-
553
- authenticate(req: any, options?: any): void;
554
- success(user: any, info?: any): void;
555
- fail(challenge: any, status: number): void;
556
- fail(status: number): void;
557
- redirect(url: string, status?: number): void;
558
- pass(): void;
559
- error(err: Error): void;
560
- }
561
-
562
- export namespace generators {
563
- function random(bytes?: number): string;
564
- function state(bytes?: number): string;
565
- function nonce(bytes?: number): string;
566
- function codeVerifier(bytes?: number): string;
567
- function codeChallenge(verifier: string): string;
568
- }
569
-
570
- export namespace errors {
571
- class OPError extends Error {
572
- error_description?: string;
573
- error?: string;
574
- error_uri?: string;
575
- state?: string;
576
- scope?: string;
577
- session_state?: string;
578
- response?: { body?: UnknownObject | Buffer } & http.IncomingMessage;
579
-
580
- constructor(
581
- params: {
582
- error: string;
583
- error_description?: string;
584
- error_uri?: string;
585
- state?: string;
586
- scope?: string;
587
- session_state?: string;
588
- },
589
- response?: { body?: UnknownObject | Buffer } & http.IncomingMessage,
590
- );
591
- }
592
-
593
- class RPError extends Error {
594
- jwt?: string;
595
- checks?: object;
596
- params?: object;
597
- body?: object;
598
- response?: { body?: UnknownObject | Buffer } & http.IncomingMessage;
599
- now?: number;
600
- tolerance?: number;
601
- nbf?: number;
602
- exp?: number;
603
- iat?: number;
604
- auth_time?: number;
605
-
606
- constructor(...args: Parameters<typeof format>);
607
- constructor(options: {
608
- message?: string;
609
- printf?: Parameters<typeof format>;
610
- response?: { body?: UnknownObject | Buffer } & http.IncomingMessage;
611
- [key: string]: unknown;
612
- });
613
- }
614
- }
615
-
616
- type KnownKeys<T> = {
617
- [K in keyof T]: string extends K ? never : number extends K ? never : K;
618
- } extends { [_ in keyof T]: infer U }
619
- ? {} extends U
620
- ? never
621
- : U
622
- : never;
623
- type Override<T1, T2> = Omit<T1, keyof Omit<T2, keyof KnownKeys<T2>>> & T2;