@openid4vc/oauth2 0.9.1-alpha-20261030145614 → 0.9.1

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
@@ -2102,6 +2102,8 @@ export declare enum Oauth2ErrorCodes {
2102
2102
  UnknownCredentialConfiguration = "unknown_credential_configuration",
2103
2103
  UnknownCredentialIdentifier = "unknown_credential_identifier",
2104
2104
  InvalidTransactionId = "invalid_transaction_id",
2105
+ InvalidNotificationId = "invalid_notification_id",
2106
+ InvalidNotificationRequest = "invalid_notification_request",
2105
2107
  UnsupportedCredentialType = "unsupported_credential_type",
2106
2108
  UnsupportedCredentialFormat = "unsupported_credential_format",
2107
2109
  MissingInteractionType = "missing_interaction_type",
@@ -4308,5 +4310,5 @@ export declare function verifyResourceRequest(options: VerifyResourceRequestOpti
4308
4310
  authorizationServer: string;
4309
4311
  }>;
4310
4312
  //#endregion
4311
- export { type AccessTokenErrorResponse, type AccessTokenProfileJwtPayload, type AccessTokenResponse, type AuthorizationChallengeErrorResponse, type AuthorizationChallengeRequest, type AuthorizationChallengeResponse, type AuthorizationCodeGrantIdentifier, type AuthorizationRequest, type AuthorizationServerMetadata, type CalculateJwkThumbprintOptions, type CallbackContext, type ClientAttestationChallengeResponse, type ClientAttestationJwtHeader, type ClientAttestationJwtPayload, type ClientAttestationPopJwtHeader, type ClientAttestationPopJwtPayload, type ClientAuthenticationCallback, type ClientAuthenticationCallbackOptions, type ClientAuthenticationClientAttestationJwtDpopOptions, 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, type GetAuthorizationServerMetadataCallback, type GetJwksCallback, type HashCallback, type HttpMethod, 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, type Oauth2AuthorizationServerOptions, type Oauth2ClientOptions, type Oauth2ErrorOptions, type Oauth2ErrorResponse, type Oauth2ResourceServerOptions, type Oid4vcTsConfig, type ParseAuthorizationChallengeRequestOptions, type ParseAuthorizationChallengeRequestResult, type ParseAuthorizationRequestOptions, type ParseAuthorizationRequestResult, type ParsePushedAuthorizationRequestOptions, type ParsePushedAuthorizationRequestResult, type ParsedJarRequest, type ParsedJarRequestOptions, type PreAuthorizedCodeGrantIdentifier, type PushedAuthorizationRequestUriPrefix, type RefreshTokenGrantIdentifier, type RequestClientAttestationChallengeOptions, type RequestClientAttestationOptions, type RequestDpopOptions, type RequestLike, type ResourceRequestOptions, type ResourceRequestResponseNotOk, type ResourceRequestResponseOk, type RetrieveAuthorizationCodeAccessTokenOptions, type RetrieveClientCredentialsAccessTokenOptions, type RetrievePreAuthorizedCodeAccessTokenOptions, type ShouldRetryAuthorizationServerRequestWithClientAttestationChallengeOptions, type SignJwtCallback, type TokenIntrospectionResponse, type VerifiedClientAttestationJwt, type VerifiedJarRequest, type VerifyAccessTokenRequestReturn, type VerifyAuthorizationChallengeRequestOptions, type VerifyAuthorizationChallengeRequestReturn, type VerifyAuthorizationRequestOptions, type VerifyAuthorizationRequestReturn, type VerifyClientAttestationOptions, type VerifyDataIntegrityProofCallback, type VerifyJarRequestOptions, type VerifyJwtCallback, type VerifyPushedAuthorizationRequestOptions, type VerifyPushedAuthorizationRequestReturn, type VerifyResourceRequestOptions, type WwwAuthenticateHeaderChallenge, getGlobalConfig, setGlobalConfig };
4313
+ export { type AccessTokenErrorResponse, type AccessTokenProfileJwtPayload, type AccessTokenResponse, type AuthorizationChallengeErrorResponse, type AuthorizationChallengeRequest, type AuthorizationChallengeResponse, type AuthorizationCodeGrantIdentifier, type AuthorizationRequest, type AuthorizationServerMetadata, type CalculateJwkThumbprintOptions, type CallbackContext, type ClientAttestationChallengeResponse, type ClientAttestationJwtHeader, type ClientAttestationJwtPayload, type ClientAttestationPopJwtHeader, type ClientAttestationPopJwtPayload, type ClientAuthenticationCallback, type ClientAuthenticationCallbackOptions, type ClientAuthenticationClientAttestationJwtDpopOptions, 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, type GetAuthorizationServerMetadataCallback, type GetJwksCallback, type HashCallback, type HttpMethod, 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, type Oauth2AuthorizationServerOptions, type Oauth2ClientOptions, type Oauth2ErrorOptions, type Oauth2ErrorResponse, type Oauth2ResourceServerOptions, type Oid4vcTsConfig, type ParseAuthorizationChallengeRequestOptions, type ParseAuthorizationChallengeRequestResult, type ParseAuthorizationRequestOptions, type ParseAuthorizationRequestResult, type ParsePushedAuthorizationRequestOptions, type ParsePushedAuthorizationRequestResult, type ParsedJarRequest, type ParsedJarRequestOptions, type PreAuthorizedCodeGrantIdentifier, type PushedAuthorizationRequestUriPrefix, type RefreshTokenGrantIdentifier, type RequestClientAttestationChallengeOptions, type RequestClientAttestationOptions, type RequestDpopOptions, type RequestLike, type ResourceRequestOptions, type ResourceRequestResponseNotOk, type ResourceRequestResponseOk, type RetrieveAccessTokenReturn, type RetrieveAuthorizationCodeAccessTokenOptions, type RetrieveClientCredentialsAccessTokenOptions, type RetrievePreAuthorizedCodeAccessTokenOptions, type ShouldRetryAuthorizationServerRequestWithClientAttestationChallengeOptions, type SignJwtCallback, type TokenIntrospectionResponse, type VerifiedClientAttestationJwt, type VerifiedJarRequest, type VerifyAccessTokenRequestReturn, type VerifyAuthorizationChallengeRequestOptions, type VerifyAuthorizationChallengeRequestReturn, type VerifyAuthorizationRequestOptions, type VerifyAuthorizationRequestReturn, type VerifyClientAttestationOptions, type VerifyDataIntegrityProofCallback, type VerifyJarRequestOptions, type VerifyJwtCallback, type VerifyPushedAuthorizationRequestOptions, type VerifyPushedAuthorizationRequestReturn, type VerifyResourceRequestOptions, type WwwAuthenticateHeaderChallenge, getGlobalConfig, setGlobalConfig };
4312
4314
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -456,6 +456,8 @@ let Oauth2ErrorCodes = /* @__PURE__ */ function(Oauth2ErrorCodes) {
456
456
  Oauth2ErrorCodes["UnknownCredentialConfiguration"] = "unknown_credential_configuration";
457
457
  Oauth2ErrorCodes["UnknownCredentialIdentifier"] = "unknown_credential_identifier";
458
458
  Oauth2ErrorCodes["InvalidTransactionId"] = "invalid_transaction_id";
459
+ Oauth2ErrorCodes["InvalidNotificationId"] = "invalid_notification_id";
460
+ Oauth2ErrorCodes["InvalidNotificationRequest"] = "invalid_notification_request";
459
461
  Oauth2ErrorCodes["UnsupportedCredentialType"] = "unsupported_credential_type";
460
462
  Oauth2ErrorCodes["UnsupportedCredentialFormat"] = "unsupported_credential_format";
461
463
  Oauth2ErrorCodes["MissingInteractionType"] = "missing_interaction_type";
@@ -2929,6 +2931,7 @@ var Oauth2Client = class {
2929
2931
  callbacks: this.options.callbacks,
2930
2932
  codeVerifier: options.pkceCodeVerifier
2931
2933
  }) : void 0;
2934
+ let dpop = options.dpop;
2932
2935
  if (options.authorizationServerMetadata.authorization_challenge_endpoint) try {
2933
2936
  await this.sendAuthorizationChallengeRequest({
2934
2937
  authorizationServerMetadata: options.authorizationServerMetadata,
@@ -2937,22 +2940,23 @@ var Oauth2Client = class {
2937
2940
  redirectUri: options.redirectUri,
2938
2941
  scope: options.scope,
2939
2942
  resource: options.resource,
2940
- dpop: options.dpop,
2943
+ dpop,
2941
2944
  state: options.state
2942
2945
  });
2943
2946
  } catch (error) {
2944
2947
  if (!(error instanceof Oauth2ClientAuthorizationChallengeError && error.errorResponse.error === "redirect_to_web")) throw error;
2948
+ const dpopNonce = extractDpopNonceFromHeaders(error.response.headers);
2949
+ if (dpop && dpopNonce) dpop = {
2950
+ ...dpop,
2951
+ nonce: dpopNonce
2952
+ };
2945
2953
  if (error.errorResponse.request_uri) {
2946
2954
  const authorizationRequestUrl = `${options.authorizationServerMetadata.authorization_endpoint}?${objectToQueryParams({
2947
2955
  request_uri: error.errorResponse.request_uri,
2948
2956
  client_id: options.clientId
2949
2957
  }).toString()}`;
2950
- const dpopNonce = extractDpopNonceFromHeaders(error.response.headers);
2951
2958
  return {
2952
- dpop: options.dpop ? {
2953
- ...options.dpop,
2954
- nonce: dpopNonce ?? void 0
2955
- } : void 0,
2959
+ dpop,
2956
2960
  authorizationRequestUrl,
2957
2961
  pkce
2958
2962
  };
@@ -2966,7 +2970,7 @@ var Oauth2Client = class {
2966
2970
  scope: options.scope,
2967
2971
  pkceCodeVerifier: pkce?.codeVerifier,
2968
2972
  resource: options.resource,
2969
- dpop: options.dpop,
2973
+ dpop,
2970
2974
  state: options.state
2971
2975
  });
2972
2976
  }