@openid4vc/oauth2 0.3.0-alpha-20250811071720 → 0.3.0-alpha-20250811083900

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
@@ -21,11 +21,14 @@ declare enum Oauth2ErrorCodes {
21
21
  InsufficientAuthorization = "insufficient_authorization",
22
22
  InvalidCredentialRequest = "invalid_credential_request",
23
23
  CredentialRequestDenied = "credential_request_denied",
24
- UnsupportedCredentialType = "unsupported_credential_type",
25
- UnsupportedCredentialFormat = "unsupported_credential_format",
26
24
  InvalidProof = "invalid_proof",
27
25
  InvalidNonce = "invalid_nonce",
28
26
  InvalidEncryptionParameters = "invalid_encryption_parameters",
27
+ UnknownCredentialConfiguration = "unknown_credential_configuration",
28
+ UnknownCredentialIdentifier = "unknown_credential_identifier",
29
+ InvalidTransactionId = "invalid_transaction_id",
30
+ UnsupportedCredentialType = "unsupported_credential_type",
31
+ UnsupportedCredentialFormat = "unsupported_credential_format",
29
32
  InvalidRequestUri = "invalid_request_uri",
30
33
  InvalidRequestObject = "invalid_request_object",
31
34
  RequestNotSupported = "request_not_supported",
@@ -7488,14 +7491,14 @@ interface VerifyAuthorizationRequestDpop {
7488
7491
  * The dpop jwt from the pushed authorization request.
7489
7492
  *
7490
7493
  * If dpop is required, at least one of `jwt` or `jwkThumbprint` MUST
7491
- * be provided. If both are provided, the jwk thubmprints are matched
7494
+ * be provided. If both are provided, the jwk thumbprints are matched
7492
7495
  */
7493
7496
  jwt?: string;
7494
7497
  /**
7495
7498
  * The jwk thumbprint as provided in the `dpop_jkt` parameter.
7496
7499
  *
7497
7500
  * If dpop is required, at least one of `jwt` or `jwkThumbprint` MUST
7498
- * be provided. If both are provided, the jwk thubmprints are matched
7501
+ * be provided. If both are provided, the jwk thumbprints are matched
7499
7502
  */
7500
7503
  jwkThumbprint?: string;
7501
7504
  /**
@@ -7531,7 +7534,7 @@ interface VerifyAuthorizationRequestReturn {
7531
7534
  */
7532
7535
  jwkThumbprint: string;
7533
7536
  /**
7534
- * The JWK will be returend if a DPoP proof was provided in the header.
7537
+ * The JWK will be returned if a DPoP proof was provided in the header.
7535
7538
  */
7536
7539
  jwk?: Jwk;
7537
7540
  };
@@ -7623,10 +7626,10 @@ declare function getAuthorizationServerMetadataFromList(authorizationServersMeta
7623
7626
  /**
7624
7627
  * Fetch JWKs from a provided JWKs URI.
7625
7628
  *
7626
- * Returns validated metadata if successfull response
7629
+ * Returns validated metadata if successful response
7627
7630
  * Throws error otherwise
7628
7631
  *
7629
- * @throws {ValidationError} if successfull response but validation of response failed
7632
+ * @throws {ValidationError} if successful response but validation of response failed
7630
7633
  * @throws {InvalidFetchResponseError} if unsuccesful response
7631
7634
  */
7632
7635
  declare function fetchJwks(jwksUrl: string, fetch?: Fetch): Promise<JwkSet>;
@@ -7635,11 +7638,11 @@ declare function fetchJwks(jwksUrl: string, fetch?: Fetch): Promise<JwkSet>;
7635
7638
  * Fetch well known metadata and validate the response.
7636
7639
  *
7637
7640
  * Returns null if 404 is returned
7638
- * Returns validated metadata if successfull response
7641
+ * Returns validated metadata if successful response
7639
7642
  * Throws error otherwise
7640
7643
  *
7641
- * @throws {ValidationError} if successfull response but validation of response failed
7642
- * @throws {InvalidFetchResponseError} if no successfull or 404 response
7644
+ * @throws {ValidationError} if successful response but validation of response failed
7645
+ * @throws {InvalidFetchResponseError} if no successful or 404 response
7643
7646
  * @throws {Error} if parsing json from response fails
7644
7647
  */
7645
7648
  declare function fetchWellKnownMetadata<Schema extends BaseSchema>(wellKnownMetadataUrl: string, schema: Schema, fetch?: Fetch): Promise<z__default.infer<Schema> | null>;
@@ -8811,7 +8814,7 @@ interface ParseAccessTokenRequestOptions {
8811
8814
  request: RequestLike;
8812
8815
  /**
8813
8816
  * The access token request as a JSON object. Your server should decode the
8814
- * `x-www-url-form-urlencoded` body into an object (e.g. using `bodyParser.urlEncoed()` in express)
8817
+ * `x-www-url-form-urlencoded` body into an object (e.g. using `bodyParser.urlEncoded()` in express)
8815
8818
  */
8816
8819
  accessTokenRequest: Record<string, unknown>;
8817
8820
  }
package/dist/index.d.ts CHANGED
@@ -21,11 +21,14 @@ declare enum Oauth2ErrorCodes {
21
21
  InsufficientAuthorization = "insufficient_authorization",
22
22
  InvalidCredentialRequest = "invalid_credential_request",
23
23
  CredentialRequestDenied = "credential_request_denied",
24
- UnsupportedCredentialType = "unsupported_credential_type",
25
- UnsupportedCredentialFormat = "unsupported_credential_format",
26
24
  InvalidProof = "invalid_proof",
27
25
  InvalidNonce = "invalid_nonce",
28
26
  InvalidEncryptionParameters = "invalid_encryption_parameters",
27
+ UnknownCredentialConfiguration = "unknown_credential_configuration",
28
+ UnknownCredentialIdentifier = "unknown_credential_identifier",
29
+ InvalidTransactionId = "invalid_transaction_id",
30
+ UnsupportedCredentialType = "unsupported_credential_type",
31
+ UnsupportedCredentialFormat = "unsupported_credential_format",
29
32
  InvalidRequestUri = "invalid_request_uri",
30
33
  InvalidRequestObject = "invalid_request_object",
31
34
  RequestNotSupported = "request_not_supported",
@@ -7488,14 +7491,14 @@ interface VerifyAuthorizationRequestDpop {
7488
7491
  * The dpop jwt from the pushed authorization request.
7489
7492
  *
7490
7493
  * If dpop is required, at least one of `jwt` or `jwkThumbprint` MUST
7491
- * be provided. If both are provided, the jwk thubmprints are matched
7494
+ * be provided. If both are provided, the jwk thumbprints are matched
7492
7495
  */
7493
7496
  jwt?: string;
7494
7497
  /**
7495
7498
  * The jwk thumbprint as provided in the `dpop_jkt` parameter.
7496
7499
  *
7497
7500
  * If dpop is required, at least one of `jwt` or `jwkThumbprint` MUST
7498
- * be provided. If both are provided, the jwk thubmprints are matched
7501
+ * be provided. If both are provided, the jwk thumbprints are matched
7499
7502
  */
7500
7503
  jwkThumbprint?: string;
7501
7504
  /**
@@ -7531,7 +7534,7 @@ interface VerifyAuthorizationRequestReturn {
7531
7534
  */
7532
7535
  jwkThumbprint: string;
7533
7536
  /**
7534
- * The JWK will be returend if a DPoP proof was provided in the header.
7537
+ * The JWK will be returned if a DPoP proof was provided in the header.
7535
7538
  */
7536
7539
  jwk?: Jwk;
7537
7540
  };
@@ -7623,10 +7626,10 @@ declare function getAuthorizationServerMetadataFromList(authorizationServersMeta
7623
7626
  /**
7624
7627
  * Fetch JWKs from a provided JWKs URI.
7625
7628
  *
7626
- * Returns validated metadata if successfull response
7629
+ * Returns validated metadata if successful response
7627
7630
  * Throws error otherwise
7628
7631
  *
7629
- * @throws {ValidationError} if successfull response but validation of response failed
7632
+ * @throws {ValidationError} if successful response but validation of response failed
7630
7633
  * @throws {InvalidFetchResponseError} if unsuccesful response
7631
7634
  */
7632
7635
  declare function fetchJwks(jwksUrl: string, fetch?: Fetch): Promise<JwkSet>;
@@ -7635,11 +7638,11 @@ declare function fetchJwks(jwksUrl: string, fetch?: Fetch): Promise<JwkSet>;
7635
7638
  * Fetch well known metadata and validate the response.
7636
7639
  *
7637
7640
  * Returns null if 404 is returned
7638
- * Returns validated metadata if successfull response
7641
+ * Returns validated metadata if successful response
7639
7642
  * Throws error otherwise
7640
7643
  *
7641
- * @throws {ValidationError} if successfull response but validation of response failed
7642
- * @throws {InvalidFetchResponseError} if no successfull or 404 response
7644
+ * @throws {ValidationError} if successful response but validation of response failed
7645
+ * @throws {InvalidFetchResponseError} if no successful or 404 response
7643
7646
  * @throws {Error} if parsing json from response fails
7644
7647
  */
7645
7648
  declare function fetchWellKnownMetadata<Schema extends BaseSchema>(wellKnownMetadataUrl: string, schema: Schema, fetch?: Fetch): Promise<z__default.infer<Schema> | null>;
@@ -8811,7 +8814,7 @@ interface ParseAccessTokenRequestOptions {
8811
8814
  request: RequestLike;
8812
8815
  /**
8813
8816
  * The access token request as a JSON object. Your server should decode the
8814
- * `x-www-url-form-urlencoded` body into an object (e.g. using `bodyParser.urlEncoed()` in express)
8817
+ * `x-www-url-form-urlencoded` body into an object (e.g. using `bodyParser.urlEncoded()` in express)
8815
8818
  */
8816
8819
  accessTokenRequest: Record<string, unknown>;
8817
8820
  }
package/dist/index.js CHANGED
@@ -107,11 +107,14 @@ var Oauth2ErrorCodes = /* @__PURE__ */ ((Oauth2ErrorCodes2) => {
107
107
  Oauth2ErrorCodes2["InsufficientAuthorization"] = "insufficient_authorization";
108
108
  Oauth2ErrorCodes2["InvalidCredentialRequest"] = "invalid_credential_request";
109
109
  Oauth2ErrorCodes2["CredentialRequestDenied"] = "credential_request_denied";
110
- Oauth2ErrorCodes2["UnsupportedCredentialType"] = "unsupported_credential_type";
111
- Oauth2ErrorCodes2["UnsupportedCredentialFormat"] = "unsupported_credential_format";
112
110
  Oauth2ErrorCodes2["InvalidProof"] = "invalid_proof";
113
111
  Oauth2ErrorCodes2["InvalidNonce"] = "invalid_nonce";
114
112
  Oauth2ErrorCodes2["InvalidEncryptionParameters"] = "invalid_encryption_parameters";
113
+ Oauth2ErrorCodes2["UnknownCredentialConfiguration"] = "unknown_credential_configuration";
114
+ Oauth2ErrorCodes2["UnknownCredentialIdentifier"] = "unknown_credential_identifier";
115
+ Oauth2ErrorCodes2["InvalidTransactionId"] = "invalid_transaction_id";
116
+ Oauth2ErrorCodes2["UnsupportedCredentialType"] = "unsupported_credential_type";
117
+ Oauth2ErrorCodes2["UnsupportedCredentialFormat"] = "unsupported_credential_format";
115
118
  Oauth2ErrorCodes2["InvalidRequestUri"] = "invalid_request_uri";
116
119
  Oauth2ErrorCodes2["InvalidRequestObject"] = "invalid_request_object";
117
120
  Oauth2ErrorCodes2["RequestNotSupported"] = "request_not_supported";
@@ -506,7 +509,7 @@ var zCompactJwe = import_zod6.z.string().regex(/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*\
506
509
  message: "Not a valid compact jwe"
507
510
  });
508
511
 
509
- // src/client-attestation/clent-attestation.ts
512
+ // src/client-attestation/client-attestation.ts
510
513
  var import_utils8 = require("@openid4vc/utils");
511
514
 
512
515
  // src/common/jwt/verify-jwt.ts
@@ -693,7 +696,7 @@ async function createClientAttestationPopJwt(options) {
693
696
  return jwt;
694
697
  }
695
698
 
696
- // src/client-attestation/clent-attestation.ts
699
+ // src/client-attestation/client-attestation.ts
697
700
  async function verifyClientAttestationJwt(options) {
698
701
  const { header, payload } = decodeJwt({
699
702
  jwt: options.clientAttestationJwt,
@@ -959,7 +962,7 @@ async function fetchWellKnownMetadata(wellKnownMetadataUrl, schema, fetch) {
959
962
  }
960
963
  if (!response.ok) {
961
964
  throw new import_utils11.InvalidFetchResponseError(
962
- `Fetching well known metadata from '${wellKnownMetadataUrl}' resulted in an unsuccessfull response with status '${response.status}'.`,
965
+ `Fetching well known metadata from '${wellKnownMetadataUrl}' resulted in an unsuccessful response with status '${response.status}'.`,
963
966
  await response.clone().text(),
964
967
  response
965
968
  );
@@ -1089,7 +1092,7 @@ async function fetchJwks(jwksUrl, fetch) {
1089
1092
  const { result, response } = await fetcher(zJwkSet, [import_utils14.ContentType.JwkSet, import_utils14.ContentType.Json], jwksUrl);
1090
1093
  if (!response.ok) {
1091
1094
  throw new import_utils15.InvalidFetchResponseError(
1092
- `Fetching JWKs from jwks_uri '${jwksUrl}' resulted in an unsuccessfull response with status code '${response.status}'.`,
1095
+ `Fetching JWKs from jwks_uri '${jwksUrl}' resulted in an unsuccessful response with status code '${response.status}'.`,
1093
1096
  await response.clone().text(),
1094
1097
  response
1095
1098
  );
@@ -1878,7 +1881,7 @@ function parseAccessTokenRequest(options) {
1878
1881
  if (!parsedAccessTokenRequest.success) {
1879
1882
  throw new Oauth2ServerErrorResponseError({
1880
1883
  error: "invalid_request" /* InvalidRequest */,
1881
- error_description: `Error occured during validation of authorization request.
1884
+ error_description: `Error occurred during validation of authorization request.
1882
1885
  ${(0, import_utils29.formatZodError)(parsedAccessTokenRequest.error)}`
1883
1886
  });
1884
1887
  }
@@ -2116,7 +2119,7 @@ async function verifyAccessTokenRequestClientAttestation(options, authorizationS
2116
2119
  throw new Oauth2ServerErrorResponseError(
2117
2120
  {
2118
2121
  error: "invalid_request" /* InvalidRequest */,
2119
- error_description: "Expected the DPoP JWK thumbprint value to match the JWK thumbprint of the client attestation confirmation JWK. Ensrue both DPoP and client attestation use the same key."
2122
+ error_description: "Expected the DPoP JWK thumbprint value to match the JWK thumbprint of the client attestation confirmation JWK. Ensure both DPoP and client attestation use the same key."
2120
2123
  },
2121
2124
  {
2122
2125
  status: 401
@@ -2295,7 +2298,7 @@ function parseAuthorizationChallengeRequest(options) {
2295
2298
  if (!parsedAuthorizationChallengeRequest.success) {
2296
2299
  throw new Oauth2ServerErrorResponseError({
2297
2300
  error: "invalid_request" /* InvalidRequest */,
2298
- error_description: `Error occured during validation of authorization challenge request.
2301
+ error_description: `Error occurred during validation of authorization challenge request.
2299
2302
  ${(0, import_utils34.formatZodError)(parsedAuthorizationChallengeRequest.error)}`
2300
2303
  });
2301
2304
  }
@@ -2368,7 +2371,7 @@ async function verifyAuthorizationRequestClientAttestation(options, authorizatio
2368
2371
  throw new Oauth2ServerErrorResponseError(
2369
2372
  {
2370
2373
  error: "invalid_request" /* InvalidRequest */,
2371
- error_description: "Expected the DPoP JWK thumbprint value to match the JWK thumbprint of the client attestation confirmation JWK. Ensrue both DPoP and client attestation use the same key."
2374
+ error_description: "Expected the DPoP JWK thumbprint value to match the JWK thumbprint of the client attestation confirmation JWK. Ensure both DPoP and client attestation use the same key."
2372
2375
  },
2373
2376
  {
2374
2377
  status: 401