11import * as crypto from "node:crypto" ;
22import * as dns from "node:dns" ;
3- import * as events from "node:events" ;
43import * as http from "node:http" ;
54import * as http2 from "node:http2" ;
65import * as https from "node:https" ;
7- import * as url from "node:url" ;
86
97import KeyGrip = require( "keygrip" ) ;
10- import * as Koa from "koa" ;
8+ import Koa = require ( "koa" ) ;
119
1210export { } ;
1311
@@ -18,7 +16,7 @@ export type FindAccount = (
1816 token ?: AuthorizationCode | AccessToken | DeviceCode | BackchannelAuthenticationRequest ,
1917) => CanBePromise < Account | undefined > ;
2018export type TokenFormat = "opaque" | "jwt" ;
21- export type FapiProfile = "1.0 ID2" | "1.0 Final" | "2.0" ;
19+ export type FapiProfile = "1.0 Final" | "2.0" ;
2220
2321export type TTLFunction < T > = ( ctx : KoaContextWithOIDC , token : T , client : Client ) => number ;
2422
@@ -49,7 +47,7 @@ export interface JWK {
4947}
5048
5149export interface JWKS {
52- keys : JWK [ ] ;
50+ keys : Array < JWK | ExternalSigningKey > ;
5351}
5452
5553export interface AllClientMetadata {
@@ -97,7 +95,6 @@ export interface AllClientMetadata {
9795 request_object_signing_alg ?: SigningAlgorithmWithNone | undefined ;
9896 request_object_encryption_alg ?: EncryptionAlgValues | undefined ;
9997 request_object_encryption_enc ?: EncryptionEncValues | undefined ;
100- request_uris ?: string [ ] | undefined ;
10198 id_token_encrypted_response_alg ?: EncryptionAlgValues | undefined ;
10299 id_token_encrypted_response_enc ?: EncryptionEncValues | undefined ;
103100 userinfo_encrypted_response_alg ?: EncryptionAlgValues | undefined ;
@@ -106,6 +103,7 @@ export interface AllClientMetadata {
106103 authorization_encrypted_response_alg ?: EncryptionAlgValues | undefined ;
107104 authorization_encrypted_response_enc ?: EncryptionEncValues | undefined ;
108105 tls_client_certificate_bound_access_tokens ?: boolean | undefined ;
106+ use_mtls_endpoint_aliases ?: boolean | undefined ;
109107
110108 require_signed_request_object ?: boolean | undefined ;
111109 require_pushed_authorization_requests ?: boolean | undefined ;
@@ -130,7 +128,6 @@ export type ResponseType =
130128 | "code token"
131129 | "code id_token token"
132130 | "none" ;
133- export type PKCEMethods = "S256" | "plain" ;
134131export type CIBADeliveryMode = "poll" | "ping" ;
135132export type SubjectTypes = "public" | "pairwise" ;
136133export type ClientAuthMethod =
@@ -608,7 +605,6 @@ declare class Client {
608605 responseModeAllowed ( type : string , responseType : ResponseType , fapiProfile : FapiProfile | undefined ) : boolean ;
609606 grantTypeAllowed ( type : string ) : boolean ;
610607 redirectUriAllowed ( redirectUri : string ) : boolean ;
611- requestUriAllowed ( requestUri : string ) : boolean ;
612608 postLogoutRedirectUriAllowed ( postLogoutRedirectUri : string ) : boolean ;
613609 includeSid ( ) : boolean ;
614610 compareClientSecret ( actual : string ) : CanBePromise < boolean > ;
@@ -664,7 +660,6 @@ declare class Client {
664660 readonly requestObjectSigningAlg ?: string | undefined ;
665661 readonly requestObjectEncryptionAlg ?: string | undefined ;
666662 readonly requestObjectEncryptionEnc ?: string | undefined ;
667- readonly requestUris ?: string [ ] | undefined ;
668663 readonly idTokenEncryptedResponseAlg ?: string | undefined ;
669664 readonly idTokenEncryptedResponseEnc ?: string | undefined ;
670665 readonly userinfoEncryptedResponseAlg ?: string | undefined ;
@@ -991,6 +986,8 @@ export interface Configuration {
991986
992987 discovery ?: UnknownObject | undefined ;
993988
989+ enableHttpPostMethods ?: boolean | undefined ;
990+
994991 extraParams ?: string [ ] | {
995992 [ param : string ] :
996993 | null
@@ -1122,11 +1119,14 @@ export interface Configuration {
11221119
11231120 requestObjects ?:
11241121 | {
1125- request ?: boolean | undefined ;
1126- requestUri ?: boolean | undefined ;
1127- requireUriRegistration ?: boolean | undefined ;
1122+ enabled ?: boolean | undefined ;
11281123 requireSignedRequestObject ?: boolean | undefined ;
1129- mode ?: "lax" | "strict" | undefined ;
1124+ assertJwtClaimsAndHeader ?: (
1125+ ctx : KoaContextWithOIDC ,
1126+ claims : Record < string , JsonValue > ,
1127+ header : Record < string , JsonValue > ,
1128+ client : Client ,
1129+ ) => CanBePromise < void > ;
11301130 }
11311131 | undefined ;
11321132
@@ -1266,14 +1266,35 @@ export interface Configuration {
12661266 | undefined ;
12671267 }
12681268 | undefined ;
1269+
1270+ richAuthorizationRequests ?: {
1271+ enabled ?: boolean | undefined ;
1272+ ack ?: string | undefined ;
1273+ /* experimental features are mostly explicit any */
1274+ [ key : string ] : any ;
1275+ } | undefined ;
1276+
1277+ rpMetadataChoices ?: {
1278+ enabled ?: boolean | undefined ;
1279+ ack ?: string | undefined ;
1280+ /* experimental features are mostly explicit any */
1281+ [ key : string ] : any ;
1282+ } | undefined ;
1283+
1284+ externalSigningSupport ?: {
1285+ enabled ?: boolean | undefined ;
1286+ ack ?: string | undefined ;
1287+ /* experimental features are mostly explicit any */
1288+ [ key : string ] : any ;
1289+ } | undefined ;
12691290 }
12701291 | undefined ;
12711292
12721293 extraTokenClaims ?:
12731294 | ( ( ctx : KoaContextWithOIDC , token : AccessToken | ClientCredentials ) => CanBePromise < UnknownObject | undefined > )
12741295 | undefined ;
12751296
1276- httpOptions ?: ( ( url : url . URL ) => HttpOptions ) | undefined ;
1297+ fetch ?: typeof fetch ;
12771298
12781299 expiresWithSession ?:
12791300 | ( ( ctx : KoaContextWithOIDC , token : AccessToken | AuthorizationCode | DeviceCode ) => CanBePromise < boolean > )
@@ -1295,7 +1316,6 @@ export interface Configuration {
12951316
12961317 pkce ?:
12971318 | {
1298- methods ?: PKCEMethods [ ] | undefined ;
12991319 required ?: ( ( ctx : KoaContextWithOIDC , client : Client ) => boolean ) | undefined ;
13001320 }
13011321 | undefined ;
@@ -1418,14 +1438,14 @@ export type AsymmetricSigningAlgorithm =
14181438 | "PS256"
14191439 | "PS384"
14201440 | "PS512"
1441+ | "Ed25519"
14211442 | "ES256"
1422- | "ES256K"
14231443 | "ES384"
14241444 | "ES512"
1425- | "EdDSA"
14261445 | "RS256"
14271446 | "RS384"
1428- | "RS512" ;
1447+ | "RS512"
1448+ | "EdDSA" ;
14291449export type SymmetricSigningAlgorithm = "HS256" | "HS384" | "HS512" ;
14301450export type SigningAlgorithm = AsymmetricSigningAlgorithm | SymmetricSigningAlgorithm ;
14311451export type SigningAlgorithmWithNone = AsymmetricSigningAlgorithm | SymmetricSigningAlgorithm ;
@@ -1475,15 +1495,17 @@ export interface InteractionResults {
14751495 [ key : string ] : unknown ;
14761496}
14771497
1478- export default class Provider extends events . EventEmitter {
1498+ export default class Provider extends Koa {
14791499 constructor ( issuer : string , configuration ?: Configuration ) ;
14801500
14811501 readonly issuer : string ;
1502+
1503+ /**
1504+ * @deprecated
1505+ */
14821506 readonly app : Koa ;
14831507
1484- proxy ?: Koa [ "proxy" ] | undefined ;
1485- listen : Koa [ "listen" ] ;
1486- callback : Koa [ "callback" ] ;
1508+ get ctx ( ) : KoaContextWithOIDC | undefined ;
14871509
14881510 backchannelResult (
14891511 request : BackchannelAuthenticationRequest | string ,
@@ -1516,10 +1538,8 @@ export default class Provider extends events.EventEmitter {
15161538 params ?: string | string [ ] | Set < string > ,
15171539 duplicates ?: string | string [ ] | Set < string > ,
15181540 ) : void ;
1519- use : Koa [ "use" ] ;
15201541
15211542 // tslint:disable:unified-signatures
1522- addListener ( event : string , listener : ( ...args : any [ ] ) => void ) : this;
15231543 addListener ( event : "access_token.destroyed" , listener : ( accessToken : AccessToken ) => void ) : this;
15241544 addListener ( event : "access_token.saved" , listener : ( accessToken : AccessToken ) => void ) : this;
15251545 addListener ( event : "access_token.issued" , listener : ( accessToken : AccessToken ) => void ) : this;
@@ -1644,7 +1664,6 @@ export default class Provider extends events.EventEmitter {
16441664 ) : this;
16451665 addListener ( event : "server_error" , listener : ( ctx : KoaContextWithOIDC , err : Error ) => void ) : this;
16461666
1647- on ( event : string , listener : ( ...args : any [ ] ) => void ) : this;
16481667 on ( event : "access_token.destroyed" , listener : ( accessToken : AccessToken ) => void ) : this;
16491668 on ( event : "access_token.saved" , listener : ( accessToken : AccessToken ) => void ) : this;
16501669 on ( event : "access_token.issued" , listener : ( accessToken : AccessToken ) => void ) : this;
@@ -1736,7 +1755,6 @@ export default class Provider extends events.EventEmitter {
17361755 on ( event : "revocation.error" , listener : ( ctx : KoaContextWithOIDC , err : errors . OIDCProviderError ) => void ) : this;
17371756 on ( event : "server_error" , listener : ( ctx : KoaContextWithOIDC , err : Error ) => void ) : this;
17381757
1739- once ( event : string , listener : ( ...args : any [ ] ) => void ) : this;
17401758 once ( event : "access_token.destroyed" , listener : ( accessToken : AccessToken ) => void ) : this;
17411759 once ( event : "access_token.saved" , listener : ( accessToken : AccessToken ) => void ) : this;
17421760 once ( event : "access_token.issued" , listener : ( accessToken : AccessToken ) => void ) : this;
@@ -1834,7 +1852,6 @@ export default class Provider extends events.EventEmitter {
18341852 once ( event : "revocation.error" , listener : ( ctx : KoaContextWithOIDC , err : errors . OIDCProviderError ) => void ) : this;
18351853 once ( event : "server_error" , listener : ( ctx : KoaContextWithOIDC , err : Error ) => void ) : this;
18361854
1837- prependListener ( event : string , listener : ( ...args : any [ ] ) => void ) : this;
18381855 prependListener ( event : "access_token.destroyed" , listener : ( accessToken : AccessToken ) => void ) : this;
18391856 prependListener ( event : "access_token.saved" , listener : ( accessToken : AccessToken ) => void ) : this;
18401857 prependListener ( event : "access_token.issued" , listener : ( accessToken : AccessToken ) => void ) : this;
@@ -1980,7 +1997,6 @@ export default class Provider extends events.EventEmitter {
19801997 ) : this;
19811998 prependListener ( event : "server_error" , listener : ( ctx : KoaContextWithOIDC , err : Error ) => void ) : this;
19821999
1983- prependOnceListener ( event : string , listener : ( ...args : any [ ] ) => void ) : this;
19842000 prependOnceListener ( event : "access_token.destroyed" , listener : ( accessToken : AccessToken ) => void ) : this;
19852001 prependOnceListener ( event : "access_token.saved" , listener : ( accessToken : AccessToken ) => void ) : this;
19862002 prependOnceListener ( event : "access_token.issued" , listener : ( accessToken : AccessToken ) => void ) : this;
@@ -2154,7 +2170,6 @@ export default class Provider extends events.EventEmitter {
21542170 readonly DeviceCode : typeof DeviceCode ;
21552171 readonly BackchannelAuthenticationRequest : typeof BackchannelAuthenticationRequest ;
21562172 readonly BaseToken : typeof BaseToken ;
2157- readonly Account : { findAccount : FindAccount } ;
21582173 readonly IdToken : typeof IdToken ;
21592174 readonly ReplayDetection : typeof ReplayDetection ;
21602175 readonly OIDCContext : typeof OIDCContext ;
@@ -2347,4 +2362,23 @@ export namespace errors {
23472362 }
23482363}
23492364
2365+ /* experimental features are mostly explicit any */
2366+ export class ExternalSigningKey {
2367+ get alg ( ) : string | undefined ;
2368+ get crv ( ) : string | undefined ;
2369+ get e ( ) : string | undefined ;
2370+ get key_ops ( ) : string [ ] | undefined ;
2371+ get kid ( ) : string | undefined ;
2372+ get kty ( ) : string ;
2373+ get n ( ) : string | undefined ;
2374+ get use ( ) : "sig" ;
2375+ get x ( ) : string | undefined ;
2376+ get x5c ( ) : string [ ] | undefined ;
2377+ get y ( ) : string | undefined ;
2378+
2379+ keyObject ( ) : Promise < crypto . KeyObject > | crypto . KeyObject ;
2380+
2381+ sign ( data : Uint8Array ) : Promise < Uint8Array > | Uint8Array ;
2382+ }
2383+
23502384export { Provider } ;
0 commit comments