@openid4vc/oauth2 0.5.0-alpha-20260202131209 → 0.5.0-alpha-20260202155954

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/dist/index.d.mts CHANGED
@@ -29,6 +29,8 @@ declare const zAuthorizationServerMetadata: z$1.ZodObject<{
29
29
  }>, z$1.ZodString]>>>;
30
30
  introspection_endpoint_auth_signing_alg_values_supported: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
31
31
  authorization_challenge_endpoint: z$1.ZodOptional<z$1.ZodURL>;
32
+ interactive_authorization_endpoint: z$1.ZodOptional<z$1.ZodURL>;
33
+ require_interactive_authorization_request: z$1.ZodOptional<z$1.ZodBoolean>;
32
34
  'pre-authorized_grant_anonymous_access_supported': z$1.ZodOptional<z$1.ZodBoolean>;
33
35
  client_attestation_pop_nonce_required: z$1.ZodOptional<z$1.ZodBoolean>;
34
36
  authorization_response_iss_parameter_supported: z$1.ZodOptional<z$1.ZodBoolean>;
@@ -465,6 +467,40 @@ interface RequestDpopOptions {
465
467
  */
466
468
  signer: JwtSignerJwk;
467
469
  }
470
+ declare function createDpopHeadersForRequest(options: CreateDpopJwtOptions): Promise<{
471
+ DPoP: string;
472
+ }>;
473
+ interface CreateDpopJwtOptions {
474
+ request: Omit<RequestLike, 'headers'>;
475
+ /**
476
+ * Dpop nonce value
477
+ */
478
+ nonce?: string;
479
+ /**
480
+ * Creation time of the JWT. If not provided the current date will be used
481
+ */
482
+ issuedAt?: Date;
483
+ /**
484
+ * Additional payload to include in the dpop jwt payload. Will be applied after
485
+ * any default claims that are included, so add claims with caution.
486
+ */
487
+ additionalPayload?: Record<string, unknown>;
488
+ /**
489
+ * The access token to which the dpop jwt should be bound. Required
490
+ * when the dpop will be sent along with an access token.
491
+ *
492
+ * If provided, the `hashCallback` parameter also needs to be provided
493
+ */
494
+ accessToken?: string;
495
+ /**
496
+ * Callback used for dpop
497
+ */
498
+ callbacks: Pick<CallbackContext, 'generateRandom' | 'hash' | 'signJwt'>;
499
+ /**
500
+ * The signer of the dpop jwt. Only jwk signer allowed.
501
+ */
502
+ signer: JwtSignerJwk;
503
+ }
468
504
  interface VerifyDpopJwtOptions {
469
505
  /**
470
506
  * The compact dpop jwt.
@@ -502,52 +538,7 @@ interface VerifyDpopJwtOptions {
502
538
  callbacks: Pick<CallbackContext, 'verifyJwt' | 'hash'>;
503
539
  now?: Date;
504
540
  }
505
- //#endregion
506
- //#region src/common/z-oauth2-error.d.ts
507
- declare enum Oauth2ErrorCodes {
508
- ServerError = "server_error",
509
- InvalidTarget = "invalid_target",
510
- InvalidRequest = "invalid_request",
511
- InvalidToken = "invalid_token",
512
- InsufficientScope = "insufficient_scope",
513
- InvalidGrant = "invalid_grant",
514
- InvalidClient = "invalid_client",
515
- UnauthorizedClient = "unauthorized_client",
516
- UnsupportedGrantType = "unsupported_grant_type",
517
- InvalidScope = "invalid_scope",
518
- InvalidDpopProof = "invalid_dpop_proof",
519
- UseDpopNonce = "use_dpop_nonce",
520
- RedirectToWeb = "redirect_to_web",
521
- InvalidSession = "invalid_session",
522
- InsufficientAuthorization = "insufficient_authorization",
523
- InvalidCredentialRequest = "invalid_credential_request",
524
- CredentialRequestDenied = "credential_request_denied",
525
- InvalidProof = "invalid_proof",
526
- InvalidNonce = "invalid_nonce",
527
- InvalidEncryptionParameters = "invalid_encryption_parameters",
528
- UnknownCredentialConfiguration = "unknown_credential_configuration",
529
- UnknownCredentialIdentifier = "unknown_credential_identifier",
530
- InvalidTransactionId = "invalid_transaction_id",
531
- UnsupportedCredentialType = "unsupported_credential_type",
532
- UnsupportedCredentialFormat = "unsupported_credential_format",
533
- InvalidRequestUri = "invalid_request_uri",
534
- InvalidRequestObject = "invalid_request_object",
535
- RequestNotSupported = "request_not_supported",
536
- RequestUriNotSupported = "request_uri_not_supported",
537
- VpFormatsNotSupported = "vp_formats_not_supported",
538
- AccessDenied = "access_denied",
539
- InvalidPresentationDefinitionUri = "invalid_presentation_definition_uri",
540
- InvalidPresentationDefinitionReference = "invalid_presentation_definition_reference",
541
- InvalidRequestUriMethod = "invalid_request_uri_method",
542
- InvalidTransactionData = "invalid_transaction_data",
543
- WalletUnavailable = "wallet_unavailable",
544
- }
545
- declare const zOauth2ErrorResponse: z$1.ZodObject<{
546
- error: z$1.ZodUnion<readonly [z$1.ZodEnum<typeof Oauth2ErrorCodes>, z$1.ZodString]>;
547
- error_description: z$1.ZodOptional<z$1.ZodString>;
548
- error_uri: z$1.ZodOptional<z$1.ZodString>;
549
- }, z$1.core.$loose>;
550
- type Oauth2ErrorResponse = z$1.infer<typeof zOauth2ErrorResponse>;
541
+ declare function extractDpopNonceFromHeaders(headers: FetchHeaders): string | null;
551
542
  //#endregion
552
543
  //#region src/access-token/z-access-token.d.ts
553
544
  declare const zAccessTokenRequest: z$1.ZodIntersection<z$1.ZodObject<{
@@ -1144,11 +1135,24 @@ declare enum PkceCodeChallengeMethod {
1144
1135
  Plain = "plain",
1145
1136
  S256 = "S256",
1146
1137
  }
1138
+ interface CreatePkceOptions {
1139
+ /**
1140
+ * Also allows string values so it can be directly passed from the
1141
+ * 'code_challenge_methods_supported' metadata parameter
1142
+ */
1143
+ allowedCodeChallengeMethods?: Array<string | PkceCodeChallengeMethod>;
1144
+ /**
1145
+ * Code verifier to use. If not provided a value will be generated.
1146
+ */
1147
+ codeVerifier?: string;
1148
+ callbacks: Pick<CallbackContext, 'hash' | 'generateRandom'>;
1149
+ }
1147
1150
  interface CreatePkceReturn {
1148
1151
  codeVerifier: string;
1149
1152
  codeChallenge: string;
1150
1153
  codeChallengeMethod: PkceCodeChallengeMethod;
1151
1154
  }
1155
+ declare function createPkce(options: CreatePkceOptions): Promise<CreatePkceReturn>;
1152
1156
  //#endregion
1153
1157
  //#region src/z-grant-type.d.ts
1154
1158
  declare const zPreAuthorizedCodeGrantIdentifier: z$1.ZodLiteral<"urn:ietf:params:oauth:grant-type:pre-authorized_code">;
@@ -1411,6 +1415,12 @@ declare const zTokenIntrospectionResponse: z$1.ZodObject<{
1411
1415
  type TokenIntrospectionResponse = z$1.infer<typeof zTokenIntrospectionResponse>;
1412
1416
  //#endregion
1413
1417
  //#region src/authorization-request/parse-authorization-request.d.ts
1418
+ interface ParseAuthorizationRequestOptions {
1419
+ request: RequestLike;
1420
+ authorizationRequest: {
1421
+ dpop_jkt?: string;
1422
+ };
1423
+ }
1414
1424
  interface ParseAuthorizationRequestResult {
1415
1425
  /**
1416
1426
  * The dpop params from the authorization request.
@@ -1436,6 +1446,12 @@ interface ParseAuthorizationRequestResult {
1436
1446
  clientAttestationPopJwt: string;
1437
1447
  };
1438
1448
  }
1449
+ /**
1450
+ * Parse an authorization request.
1451
+ *
1452
+ * @throws {Oauth2ServerErrorResponseError}
1453
+ */
1454
+ declare function parseAuthorizationRequest(options: ParseAuthorizationRequestOptions): ParseAuthorizationRequestResult;
1439
1455
  //#endregion
1440
1456
  //#region src/authorization-challenge/z-authorization-challenge.d.ts
1441
1457
  declare const zAuthorizationChallengeRequest: z$1.ZodObject<{
@@ -1483,7 +1499,7 @@ interface VerifyAuthorizationRequestDpop {
1483
1499
  */
1484
1500
  required?: boolean;
1485
1501
  /**
1486
- * The dpop jwt from the pushed authorization request.
1502
+ * The dpop jwt from the pushed or interactive authorization request.
1487
1503
  *
1488
1504
  * If dpop is required, at least one of `jwt` or `jwkThumbprint` MUST
1489
1505
  * be provided. If both are provided, the jwk thumbprints are matched
@@ -1555,6 +1571,7 @@ interface VerifyAuthorizationRequestOptions {
1555
1571
  now?: Date;
1556
1572
  callbacks: Pick<CallbackContext, 'hash' | 'verifyJwt'>;
1557
1573
  }
1574
+ declare function verifyAuthorizationRequest(options: VerifyAuthorizationRequestOptions): Promise<VerifyAuthorizationRequestReturn>;
1558
1575
  //#endregion
1559
1576
  //#region src/authorization-challenge/verify-authorization-challenge-request.d.ts
1560
1577
  type VerifyAuthorizationChallengeRequestReturn = VerifyAuthorizationRequestReturn;
@@ -1614,6 +1631,53 @@ interface CreateAuthorizationRequestUrlOptions {
1614
1631
  dpop?: RequestDpopOptions;
1615
1632
  }
1616
1633
  //#endregion
1634
+ //#region src/common/z-oauth2-error.d.ts
1635
+ declare enum Oauth2ErrorCodes {
1636
+ ServerError = "server_error",
1637
+ InvalidTarget = "invalid_target",
1638
+ InvalidRequest = "invalid_request",
1639
+ InvalidToken = "invalid_token",
1640
+ InsufficientScope = "insufficient_scope",
1641
+ InvalidGrant = "invalid_grant",
1642
+ InvalidClient = "invalid_client",
1643
+ UnauthorizedClient = "unauthorized_client",
1644
+ UnsupportedGrantType = "unsupported_grant_type",
1645
+ InvalidScope = "invalid_scope",
1646
+ InvalidDpopProof = "invalid_dpop_proof",
1647
+ UseDpopNonce = "use_dpop_nonce",
1648
+ RedirectToWeb = "redirect_to_web",
1649
+ InvalidSession = "invalid_session",
1650
+ InsufficientAuthorization = "insufficient_authorization",
1651
+ InvalidCredentialRequest = "invalid_credential_request",
1652
+ CredentialRequestDenied = "credential_request_denied",
1653
+ InvalidProof = "invalid_proof",
1654
+ InvalidNonce = "invalid_nonce",
1655
+ InvalidEncryptionParameters = "invalid_encryption_parameters",
1656
+ UnknownCredentialConfiguration = "unknown_credential_configuration",
1657
+ UnknownCredentialIdentifier = "unknown_credential_identifier",
1658
+ InvalidTransactionId = "invalid_transaction_id",
1659
+ UnsupportedCredentialType = "unsupported_credential_type",
1660
+ UnsupportedCredentialFormat = "unsupported_credential_format",
1661
+ MissingInteractionType = "missing_interaction_type",
1662
+ InvalidRequestUri = "invalid_request_uri",
1663
+ InvalidRequestObject = "invalid_request_object",
1664
+ RequestNotSupported = "request_not_supported",
1665
+ RequestUriNotSupported = "request_uri_not_supported",
1666
+ VpFormatsNotSupported = "vp_formats_not_supported",
1667
+ AccessDenied = "access_denied",
1668
+ InvalidPresentationDefinitionUri = "invalid_presentation_definition_uri",
1669
+ InvalidPresentationDefinitionReference = "invalid_presentation_definition_reference",
1670
+ InvalidRequestUriMethod = "invalid_request_uri_method",
1671
+ InvalidTransactionData = "invalid_transaction_data",
1672
+ WalletUnavailable = "wallet_unavailable",
1673
+ }
1674
+ declare const zOauth2ErrorResponse: z$1.ZodObject<{
1675
+ error: z$1.ZodUnion<readonly [z$1.ZodEnum<typeof Oauth2ErrorCodes>, z$1.ZodString]>;
1676
+ error_description: z$1.ZodOptional<z$1.ZodString>;
1677
+ error_uri: z$1.ZodOptional<z$1.ZodString>;
1678
+ }, z$1.core.$loose>;
1679
+ type Oauth2ErrorResponse = z$1.infer<typeof zOauth2ErrorResponse>;
1680
+ //#endregion
1617
1681
  //#region src/authorization-request/create-pushed-authorization-response.d.ts
1618
1682
  interface CreatePushedAuthorizationResponseOptions {
1619
1683
  /**
@@ -1791,6 +1855,7 @@ declare const zJarAuthorizationRequest: z.ZodObject<{
1791
1855
  type JarAuthorizationRequest = z.infer<typeof zJarAuthorizationRequest>;
1792
1856
  declare function validateJarRequestParams(options: {
1793
1857
  jarRequestParams: JarAuthorizationRequest;
1858
+ allowRequestUri?: boolean;
1794
1859
  }): JarAuthorizationRequest & ({
1795
1860
  request_uri: string;
1796
1861
  request?: never;
@@ -1798,6 +1863,7 @@ declare function validateJarRequestParams(options: {
1798
1863
  request: string;
1799
1864
  request_uri?: never;
1800
1865
  });
1866
+ declare function isJarAuthorizationRequest(request: JarAuthorizationRequest): request is JarAuthorizationRequest;
1801
1867
  //#endregion
1802
1868
  //#region src/jar/z-jar-request-object.d.ts
1803
1869
  declare const zJarRequestObjectPayload: z.ZodObject<{
@@ -1850,11 +1916,45 @@ declare const signedAuthorizationRequestJwtHeaderTyp: "oauth-authz-req+jwt";
1850
1916
  declare const jwtAuthorizationRequestJwtHeaderTyp: "jwt";
1851
1917
  //#endregion
1852
1918
  //#region src/jar/handle-jar-request/verify-jar-request.d.ts
1919
+ interface ParsedJarRequestOptions {
1920
+ jarRequestParams: JarAuthorizationRequest;
1921
+ callbacks: Pick<CallbackContext, 'fetch'>;
1922
+ }
1923
+ interface VerifyJarRequestOptions {
1924
+ jarRequestParams: {
1925
+ client_id?: string;
1926
+ };
1927
+ authorizationRequestJwt: string;
1928
+ callbacks: Pick<CallbackContext, 'verifyJwt'>;
1929
+ jwtSigner: JwtSigner;
1930
+ }
1931
+ interface ParsedJarRequest {
1932
+ authorizationRequestJwt: string;
1933
+ sendBy: 'value' | 'reference';
1934
+ }
1853
1935
  interface VerifiedJarRequest {
1854
1936
  authorizationRequestPayload: JarRequestObjectPayload;
1855
1937
  signer: JwtSignerWithJwk;
1856
1938
  jwt: ReturnType<typeof decodeJwt<undefined, typeof zJarRequestObjectPayload>>;
1857
1939
  }
1940
+ /**
1941
+ * Parse a JAR (JWT Secured Authorization Request) request by validating and optionally fetch from uri.
1942
+ *
1943
+ * @param options - The input parameters
1944
+ * @param options.jarRequestParams - The JAR authorization request parameters
1945
+ * @param options.callbacks - Context containing the relevant Jose crypto operations
1946
+ * @returns An object containing the transmission method ('value' or 'reference') and the JWT request object.
1947
+ */
1948
+ declare function parseJarRequest(options: ParsedJarRequestOptions): Promise<ParsedJarRequest>;
1949
+ /**
1950
+ * Verifies a JAR (JWT Secured Authorization Request) request by validating and verifying signatures.
1951
+ *
1952
+ * @param options - The input parameters
1953
+ * @param options.jarRequestParams - The JAR authorization request parameters
1954
+ * @param options.callbacks - Context containing the relevant Jose crypto operations
1955
+ * @returns The verified authorization request parameters and metadata
1956
+ */
1957
+ declare function verifyJarRequest(options: VerifyJarRequestOptions): Promise<VerifiedJarRequest>;
1858
1958
  //#endregion
1859
1959
  //#region src/authorization-request/verify-pushed-authorization-request.d.ts
1860
1960
  interface VerifyPushedAuthorizationRequestReturn extends VerifyAuthorizationRequestReturn {
@@ -2172,29 +2272,6 @@ declare class Oauth2Error extends Error {
2172
2272
  constructor(message?: string, options?: Oauth2ErrorOptions);
2173
2273
  }
2174
2274
  //#endregion
2175
- //#region src/error/Oauth2ClientErrorResponseError.d.ts
2176
- declare class Oauth2ClientErrorResponseError extends Oauth2Error {
2177
- readonly errorResponse: Oauth2ErrorResponse;
2178
- readonly response: FetchResponse;
2179
- constructor(message: string, errorResponse: Oauth2ErrorResponse, response: FetchResponse);
2180
- }
2181
- //#endregion
2182
- //#region src/error/Oauth2ClientAuthorizationChallengeError.d.ts
2183
- declare class Oauth2ClientAuthorizationChallengeError extends Oauth2ClientErrorResponseError {
2184
- readonly errorResponse: AuthorizationChallengeErrorResponse;
2185
- constructor(message: string, errorResponse: AuthorizationChallengeErrorResponse, response: FetchResponse);
2186
- }
2187
- //#endregion
2188
- //#region src/error/Oauth2JwtParseError.d.ts
2189
- declare class Oauth2JwtParseError extends Oauth2Error {
2190
- constructor(message?: string);
2191
- }
2192
- //#endregion
2193
- //#region src/error/Oauth2JwtVerificationError.d.ts
2194
- declare class Oauth2JwtVerificationError extends Oauth2Error {
2195
- constructor(message?: string, options?: Oauth2ErrorOptions);
2196
- }
2197
- //#endregion
2198
2275
  //#region src/error/Oauth2ResourceUnauthorizedError.d.ts
2199
2276
  interface WwwAuthenticateHeaderChallenge {
2200
2277
  scheme: SupportedAuthenticationScheme | (string & {});
@@ -2221,6 +2298,35 @@ declare class Oauth2ResourceUnauthorizedError extends Oauth2Error {
2221
2298
  toHeaderValue(): string;
2222
2299
  }
2223
2300
  //#endregion
2301
+ //#region src/dpop/dpop-retry.d.ts
2302
+ declare function authorizationServerRequestWithDpopRetry<T>(options: {
2303
+ dpop?: RequestDpopOptions;
2304
+ request: (dpop?: RequestDpopOptions) => Promise<T>;
2305
+ }): Promise<T>;
2306
+ //#endregion
2307
+ //#region src/error/Oauth2ClientErrorResponseError.d.ts
2308
+ declare class Oauth2ClientErrorResponseError extends Oauth2Error {
2309
+ readonly errorResponse: Oauth2ErrorResponse;
2310
+ readonly response: FetchResponse;
2311
+ constructor(message: string, errorResponse: Oauth2ErrorResponse, response: FetchResponse);
2312
+ }
2313
+ //#endregion
2314
+ //#region src/error/Oauth2ClientAuthorizationChallengeError.d.ts
2315
+ declare class Oauth2ClientAuthorizationChallengeError extends Oauth2ClientErrorResponseError {
2316
+ readonly errorResponse: AuthorizationChallengeErrorResponse;
2317
+ constructor(message: string, errorResponse: AuthorizationChallengeErrorResponse, response: FetchResponse);
2318
+ }
2319
+ //#endregion
2320
+ //#region src/error/Oauth2JwtParseError.d.ts
2321
+ declare class Oauth2JwtParseError extends Oauth2Error {
2322
+ constructor(message?: string);
2323
+ }
2324
+ //#endregion
2325
+ //#region src/error/Oauth2JwtVerificationError.d.ts
2326
+ declare class Oauth2JwtVerificationError extends Oauth2Error {
2327
+ constructor(message?: string, options?: Oauth2ErrorOptions);
2328
+ }
2329
+ //#endregion
2224
2330
  //#region src/error/Oauth2ServerErrorResponseError.d.ts
2225
2331
  interface Oauth2ServerErrorResponseErrorOptions extends Oauth2ErrorOptions {
2226
2332
  internalMessage?: string;
@@ -2627,6 +2733,8 @@ declare function getAuthorizationServerMetadataFromList(authorizationServersMeta
2627
2733
  introspection_endpoint_auth_methods_supported?: string[] | undefined;
2628
2734
  introspection_endpoint_auth_signing_alg_values_supported?: string[] | undefined;
2629
2735
  authorization_challenge_endpoint?: string | undefined;
2736
+ interactive_authorization_endpoint?: string | undefined;
2737
+ require_interactive_authorization_request?: boolean | undefined;
2630
2738
  'pre-authorized_grant_anonymous_access_supported'?: boolean | undefined;
2631
2739
  client_attestation_pop_nonce_required?: boolean | undefined;
2632
2740
  authorization_response_iss_parameter_supported?: boolean | undefined;
@@ -2833,6 +2941,8 @@ declare class Oauth2AuthorizationServer {
2833
2941
  introspection_endpoint_auth_methods_supported?: string[] | undefined;
2834
2942
  introspection_endpoint_auth_signing_alg_values_supported?: string[] | undefined;
2835
2943
  authorization_challenge_endpoint?: string | undefined;
2944
+ interactive_authorization_endpoint?: string | undefined;
2945
+ require_interactive_authorization_request?: boolean | undefined;
2836
2946
  'pre-authorized_grant_anonymous_access_supported'?: boolean | undefined;
2837
2947
  client_attestation_pop_nonce_required?: boolean | undefined;
2838
2948
  authorization_response_iss_parameter_supported?: boolean | undefined;
@@ -3215,54 +3325,6 @@ declare class Oauth2AuthorizationServer {
3215
3325
  }>;
3216
3326
  }
3217
3327
  //#endregion
3218
- //#region src/resource-request/make-resource-request.d.ts
3219
- interface ResourceRequestOptions {
3220
- /**
3221
- * DPoP options
3222
- */
3223
- dpop?: RequestDpopOptions & {
3224
- /**
3225
- * Whether to retry the request if the server responds with an error indicating
3226
- * the request should be retried with a server provided dpop nonce
3227
- *
3228
- * @default true
3229
- */
3230
- retryWithNonce?: boolean;
3231
- };
3232
- /**
3233
- * Callbacks
3234
- */
3235
- callbacks: Pick<CallbackContext, 'fetch' | 'generateRandom' | 'signJwt' | 'hash'>;
3236
- /**
3237
- * Access token
3238
- */
3239
- accessToken: string;
3240
- url: string;
3241
- requestOptions: FetchRequestInit;
3242
- }
3243
- interface ResourceRequestResponseBase {
3244
- ok: boolean;
3245
- response: FetchResponse;
3246
- /**
3247
- * If the response included a dpop nonce to be used in subsequent requests
3248
- */
3249
- dpop?: {
3250
- nonce: string;
3251
- };
3252
- }
3253
- interface ResourceRequestResponseOk extends ResourceRequestResponseBase {
3254
- ok: true;
3255
- }
3256
- interface ResourceRequestResponseNotOk extends ResourceRequestResponseBase {
3257
- ok: false;
3258
- /**
3259
- * If a WWW-Authenticate was included in the headers of the response
3260
- * they will be parsed and added here.
3261
- */
3262
- wwwAuthenticate?: WwwAuthenticateHeaderChallenge[];
3263
- }
3264
- declare function resourceRequest(options: ResourceRequestOptions): Promise<ResourceRequestResponseOk | ResourceRequestResponseNotOk>;
3265
- //#endregion
3266
3328
  //#region src/authorization-challenge/send-authorization-challenge.d.ts
3267
3329
  interface SendAuthorizationChallengeRequestOptions {
3268
3330
  /**
@@ -3315,6 +3377,54 @@ interface SendAuthorizationChallengeRequestOptions {
3315
3377
  dpop?: RequestDpopOptions;
3316
3378
  }
3317
3379
  //#endregion
3380
+ //#region src/resource-request/make-resource-request.d.ts
3381
+ interface ResourceRequestOptions {
3382
+ /**
3383
+ * DPoP options
3384
+ */
3385
+ dpop?: RequestDpopOptions & {
3386
+ /**
3387
+ * Whether to retry the request if the server responds with an error indicating
3388
+ * the request should be retried with a server provided dpop nonce
3389
+ *
3390
+ * @default true
3391
+ */
3392
+ retryWithNonce?: boolean;
3393
+ };
3394
+ /**
3395
+ * Callbacks
3396
+ */
3397
+ callbacks: Pick<CallbackContext, 'fetch' | 'generateRandom' | 'signJwt' | 'hash'>;
3398
+ /**
3399
+ * Access token
3400
+ */
3401
+ accessToken: string;
3402
+ url: string;
3403
+ requestOptions: FetchRequestInit;
3404
+ }
3405
+ interface ResourceRequestResponseBase {
3406
+ ok: boolean;
3407
+ response: FetchResponse;
3408
+ /**
3409
+ * If the response included a dpop nonce to be used in subsequent requests
3410
+ */
3411
+ dpop?: {
3412
+ nonce: string;
3413
+ };
3414
+ }
3415
+ interface ResourceRequestResponseOk extends ResourceRequestResponseBase {
3416
+ ok: true;
3417
+ }
3418
+ interface ResourceRequestResponseNotOk extends ResourceRequestResponseBase {
3419
+ ok: false;
3420
+ /**
3421
+ * If a WWW-Authenticate was included in the headers of the response
3422
+ * they will be parsed and added here.
3423
+ */
3424
+ wwwAuthenticate?: WwwAuthenticateHeaderChallenge[];
3425
+ }
3426
+ declare function resourceRequest(options: ResourceRequestOptions): Promise<ResourceRequestResponseOk | ResourceRequestResponseNotOk>;
3427
+ //#endregion
3318
3428
  //#region src/Oauth2Client.d.ts
3319
3429
  interface Oauth2ClientOptions {
3320
3430
  /**
@@ -3357,6 +3467,8 @@ declare class Oauth2Client {
3357
3467
  introspection_endpoint_auth_methods_supported?: string[] | undefined;
3358
3468
  introspection_endpoint_auth_signing_alg_values_supported?: string[] | undefined;
3359
3469
  authorization_challenge_endpoint?: string | undefined;
3470
+ interactive_authorization_endpoint?: string | undefined;
3471
+ require_interactive_authorization_request?: boolean | undefined;
3360
3472
  'pre-authorized_grant_anonymous_access_supported'?: boolean | undefined;
3361
3473
  client_attestation_pop_nonce_required?: boolean | undefined;
3362
3474
  authorization_response_iss_parameter_supported?: boolean | undefined;
@@ -3378,13 +3490,6 @@ declare class Oauth2Client {
3378
3490
  authorizationRequestUrl: string;
3379
3491
  pkce: CreatePkceReturn | undefined;
3380
3492
  dpop: RequestDpopOptions | undefined;
3381
- } | {
3382
- dpop: {
3383
- nonce: string | null;
3384
- signer: JwtSignerJwk;
3385
- } | undefined;
3386
- authorizationRequestUrl: string;
3387
- pkce: CreatePkceReturn | undefined;
3388
3493
  }>;
3389
3494
  sendAuthorizationChallengeRequest(options: Omit<SendAuthorizationChallengeRequestOptions, 'callbacks'>): Promise<{
3390
3495
  pkce: CreatePkceReturn | undefined;
@@ -3770,5 +3875,5 @@ declare function verifyResourceRequest(options: VerifyResourceRequestOptions): P
3770
3875
  authorizationServer: string;
3771
3876
  }>;
3772
3877
  //#endregion
3773
- export { type AccessTokenErrorResponse, type AccessTokenProfileJwtPayload, type AccessTokenResponse, type AuthorizationChallengeErrorResponse, type AuthorizationChallengeRequest, type AuthorizationChallengeResponse, type AuthorizationCodeGrantIdentifier, AuthorizationErrorResponse, AuthorizationResponse, type AuthorizationServerMetadata, type CalculateJwkThumbprintOptions, type CallbackContext, type ClientAttestationJwtHeader, type ClientAttestationJwtPayload, type ClientAttestationPopJwtHeader, type ClientAttestationPopJwtPayload, type ClientAuthenticationCallback, type ClientAuthenticationCallbackOptions, type ClientAuthenticationClientAttestationJwtOptions, type ClientAuthenticationClientSecretBasicOptions, type ClientAuthenticationClientSecretPostOptions, type ClientAuthenticationDynamicOptions, type ClientAuthenticationNoneOptions, type ClientCredentialsGrantIdentifier, type CreateAuthorizationRequestUrlOptions, type CreateClientAttestationJwtOptions, type CreateJarAuthorizationRequestOptions, type CreatePkceReturn, type CreatePushedAuthorizationErrorResponseOptions, type CreatePushedAuthorizationResponseOptions, type DecodeJwtHeaderResult, type DecodeJwtOptions, type DecodeJwtResult, type DecryptJweCallback, type DecryptJweCallbackOptions, type EncryptJweCallback, type GenerateRandomCallback, HashAlgorithm, type HashCallback, type HttpMethod, IdTokenJwtHeader, IdTokenJwtPayload, InvalidFetchResponseError, type JarAuthorizationRequest, type JarRequestObjectPayload, type JweEncryptor, type Jwk, type JwkSet, type JwtHeader, type JwtPayload, type JwtSigner, type JwtSignerCustom, type JwtSignerDid, type JwtSignerJwk, type JwtSignerWithJwk, type JwtSignerX5c, Oauth2AuthorizationServer, type Oauth2AuthorizationServerOptions, Oauth2Client, Oauth2ClientAuthorizationChallengeError, Oauth2ClientErrorResponseError, type Oauth2ClientOptions, Oauth2Error, Oauth2ErrorCodes, type Oauth2ErrorOptions, type Oauth2ErrorResponse, Oauth2JwtParseError, Oauth2JwtVerificationError, Oauth2ResourceServer, type Oauth2ResourceServerOptions, Oauth2ResourceUnauthorizedError, Oauth2ServerErrorResponseError, type Oid4vcTsConfig, type ParseAuthorizationChallengeRequestOptions, type ParseAuthorizationChallengeRequestResult, ParseAuthorizationResponseOptions, type ParsePushedAuthorizationRequestOptions, type ParsePushedAuthorizationRequestResult, PkceCodeChallengeMethod, type PreAuthorizedCodeGrantIdentifier, type PushedAuthorizationRequestUriPrefix, type RefreshTokenGrantIdentifier, type RequestClientAttestationOptions, type RequestDpopOptions, type RequestLike, type ResourceRequestOptions, type ResourceRequestResponseNotOk, type ResourceRequestResponseOk, type RetrieveAuthorizationCodeAccessTokenOptions, type RetrieveClientCredentialsAccessTokenOptions, type RetrievePreAuthorizedCodeAccessTokenOptions, type SignJwtCallback, SupportedAuthenticationScheme, SupportedClientAuthenticationMethod, type TokenIntrospectionResponse, type VerifiedClientAttestationJwt, type VerifyAccessTokenRequestReturn, type VerifyAuthorizationChallengeRequestOptions, type VerifyAuthorizationChallengeRequestReturn, VerifyAuthorizationResponseOptions, VerifyIdTokenJwtOptions, type VerifyJwtCallback, type VerifyPushedAuthorizationRequestOptions, type VerifyPushedAuthorizationRequestReturn, type VerifyResourceRequestOptions, type WwwAuthenticateHeaderChallenge, authorizationCodeGrantIdentifier, calculateJwkThumbprint, clientAuthenticationAnonymous, clientAuthenticationClientAttestationJwt, clientAuthenticationClientSecretBasic, clientAuthenticationClientSecretPost, clientAuthenticationDynamic, clientAuthenticationNone, clientCredentialsGrantIdentifier, createClientAttestationJwt, createJarAuthorizationRequest, decodeJwt, decodeJwtHeader, fetchAuthorizationServerMetadata, fetchJwks, fetchWellKnownMetadata, fullySpecifiedCoseAlgorithmArrayToJwaSignatureAlgorithmArray, fullySpecifiedCoseAlgorithmToJwaSignatureAlgorithm, getAuthorizationServerMetadataFromList, getGlobalConfig, isJwkInSet, jwaSignatureAlgorithmArrayToFullySpecifiedCoseAlgorithmArray, jwaSignatureAlgorithmToFullySpecifiedCoseAlgorithm, jwtAuthorizationRequestJwtHeaderTyp, jwtHeaderFromJwtSigner, jwtSignerFromJwt, parseAuthorizationResponseRedirectUrl, parsePushedAuthorizationRequestUriReferenceValue, preAuthorizedCodeGrantIdentifier, pushedAuthorizationRequestUriPrefix, refreshTokenGrantIdentifier, resourceRequest, setGlobalConfig, signedAuthorizationRequestJwtHeaderTyp, validateJarRequestParams, verifyAuthorizationResponse, verifyClientAttestationJwt, verifyIdTokenJwt, verifyJwt, verifyResourceRequest, zAlgValueNotNone, zAuthorizationCodeGrantIdentifier, zAuthorizationErrorResponse, zAuthorizationResponse, zAuthorizationResponseFromUriParams, zAuthorizationServerMetadata, zClientCredentialsGrantIdentifier, zCompactJwe, zCompactJwt, zIdTokenJwtHeader, zIdTokenJwtPayload, zJarAuthorizationRequest, zJarRequestObjectPayload, zJwk, zJwkSet, zJwtHeader, zJwtPayload, zOauth2ErrorResponse, zPreAuthorizedCodeGrantIdentifier, zPushedAuthorizationRequestUriPrefix, zRefreshTokenGrantIdentifier };
3878
+ export { type AccessTokenErrorResponse, type AccessTokenProfileJwtPayload, type AccessTokenResponse, type AuthorizationChallengeErrorResponse, type AuthorizationChallengeRequest, type AuthorizationChallengeResponse, type AuthorizationCodeGrantIdentifier, AuthorizationErrorResponse, type AuthorizationRequest, AuthorizationResponse, type AuthorizationServerMetadata, type CalculateJwkThumbprintOptions, type CallbackContext, type ClientAttestationJwtHeader, type ClientAttestationJwtPayload, type ClientAttestationPopJwtHeader, type ClientAttestationPopJwtPayload, type ClientAuthenticationCallback, type ClientAuthenticationCallbackOptions, type ClientAuthenticationClientAttestationJwtOptions, type ClientAuthenticationClientSecretBasicOptions, type ClientAuthenticationClientSecretPostOptions, type ClientAuthenticationDynamicOptions, type ClientAuthenticationNoneOptions, type ClientCredentialsGrantIdentifier, type CreateAuthorizationRequestUrlOptions, type CreateClientAttestationJwtOptions, type CreateJarAuthorizationRequestOptions, type CreatePkceReturn, type CreatePushedAuthorizationErrorResponseOptions, type CreatePushedAuthorizationResponseOptions, type DecodeJwtHeaderResult, type DecodeJwtOptions, type DecodeJwtResult, type DecryptJweCallback, type DecryptJweCallbackOptions, type EncryptJweCallback, type GenerateRandomCallback, HashAlgorithm, type HashCallback, type HttpMethod, IdTokenJwtHeader, IdTokenJwtPayload, InvalidFetchResponseError, type JarAuthorizationRequest, type JarRequestObjectPayload, type JweEncryptor, type Jwk, type JwkSet, type JwtHeader, type JwtPayload, type JwtSigner, type JwtSignerCustom, type JwtSignerDid, type JwtSignerJwk, type JwtSignerWithJwk, type JwtSignerX5c, Oauth2AuthorizationServer, type Oauth2AuthorizationServerOptions, Oauth2Client, Oauth2ClientAuthorizationChallengeError, Oauth2ClientErrorResponseError, type Oauth2ClientOptions, Oauth2Error, Oauth2ErrorCodes, type Oauth2ErrorOptions, type Oauth2ErrorResponse, Oauth2JwtParseError, Oauth2JwtVerificationError, Oauth2ResourceServer, type Oauth2ResourceServerOptions, Oauth2ResourceUnauthorizedError, Oauth2ServerErrorResponseError, type Oid4vcTsConfig, type ParseAuthorizationChallengeRequestOptions, type ParseAuthorizationChallengeRequestResult, type ParseAuthorizationRequestOptions, type ParseAuthorizationRequestResult, ParseAuthorizationResponseOptions, type ParsePushedAuthorizationRequestOptions, type ParsePushedAuthorizationRequestResult, type ParsedJarRequest, type ParsedJarRequestOptions, PkceCodeChallengeMethod, type PreAuthorizedCodeGrantIdentifier, type PushedAuthorizationRequestUriPrefix, type RefreshTokenGrantIdentifier, type RequestClientAttestationOptions, type RequestDpopOptions, type RequestLike, type ResourceRequestOptions, type ResourceRequestResponseNotOk, type ResourceRequestResponseOk, type RetrieveAuthorizationCodeAccessTokenOptions, type RetrieveClientCredentialsAccessTokenOptions, type RetrievePreAuthorizedCodeAccessTokenOptions, type SignJwtCallback, SupportedAuthenticationScheme, SupportedClientAuthenticationMethod, type TokenIntrospectionResponse, type VerifiedClientAttestationJwt, type VerifiedJarRequest, type VerifyAccessTokenRequestReturn, type VerifyAuthorizationChallengeRequestOptions, type VerifyAuthorizationChallengeRequestReturn, type VerifyAuthorizationRequestOptions, type VerifyAuthorizationRequestReturn, VerifyAuthorizationResponseOptions, VerifyIdTokenJwtOptions, type VerifyJarRequestOptions, type VerifyJwtCallback, type VerifyPushedAuthorizationRequestOptions, type VerifyPushedAuthorizationRequestReturn, type VerifyResourceRequestOptions, type WwwAuthenticateHeaderChallenge, authorizationCodeGrantIdentifier, authorizationServerRequestWithDpopRetry, calculateJwkThumbprint, clientAuthenticationAnonymous, clientAuthenticationClientAttestationJwt, clientAuthenticationClientSecretBasic, clientAuthenticationClientSecretPost, clientAuthenticationDynamic, clientAuthenticationNone, clientCredentialsGrantIdentifier, createClientAttestationJwt, createDpopHeadersForRequest, createJarAuthorizationRequest, createPkce, decodeJwt, decodeJwtHeader, extractDpopNonceFromHeaders, fetchAuthorizationServerMetadata, fetchJwks, fetchWellKnownMetadata, fullySpecifiedCoseAlgorithmArrayToJwaSignatureAlgorithmArray, fullySpecifiedCoseAlgorithmToJwaSignatureAlgorithm, getAuthorizationServerMetadataFromList, getGlobalConfig, isJarAuthorizationRequest, isJwkInSet, jwaSignatureAlgorithmArrayToFullySpecifiedCoseAlgorithmArray, jwaSignatureAlgorithmToFullySpecifiedCoseAlgorithm, jwtAuthorizationRequestJwtHeaderTyp, jwtHeaderFromJwtSigner, jwtSignerFromJwt, parseAuthorizationRequest, parseAuthorizationResponseRedirectUrl, parseJarRequest, parsePushedAuthorizationRequestUriReferenceValue, preAuthorizedCodeGrantIdentifier, pushedAuthorizationRequestUriPrefix, refreshTokenGrantIdentifier, resourceRequest, setGlobalConfig, signedAuthorizationRequestJwtHeaderTyp, validateJarRequestParams, verifyAuthorizationRequest, verifyAuthorizationResponse, verifyClientAttestationJwt, verifyIdTokenJwt, verifyJarRequest, verifyJwt, verifyResourceRequest, zAlgValueNotNone, zAuthorizationCodeGrantIdentifier, zAuthorizationErrorResponse, zAuthorizationRequest, zAuthorizationResponse, zAuthorizationResponseFromUriParams, zAuthorizationServerMetadata, zClientCredentialsGrantIdentifier, zCompactJwe, zCompactJwt, zIdTokenJwtHeader, zIdTokenJwtPayload, zJarAuthorizationRequest, zJarRequestObjectPayload, zJwk, zJwkSet, zJwtHeader, zJwtPayload, zOauth2ErrorResponse, zPreAuthorizedCodeGrantIdentifier, zPushedAuthorizationRequestUriPrefix, zRefreshTokenGrantIdentifier };
3774
3879
  //# sourceMappingURL=index.d.mts.map