@openid4vc/oauth2 0.3.0-alpha-20250304095426 → 0.3.0-alpha-20250315153009

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.mjs CHANGED
@@ -98,7 +98,9 @@ async function calculateJwkThumbprint(options) {
98
98
 
99
99
  // src/callbacks.ts
100
100
  var HashAlgorithm = /* @__PURE__ */ ((HashAlgorithm2) => {
101
- HashAlgorithm2["Sha256"] = "SHA-256";
101
+ HashAlgorithm2["Sha256"] = "sha-256";
102
+ HashAlgorithm2["Sha384"] = "sha-384";
103
+ HashAlgorithm2["Sha512"] = "sha-512";
102
104
  return HashAlgorithm2;
103
105
  })(HashAlgorithm || {});
104
106
 
@@ -132,13 +134,13 @@ async function isJwkInSet({
132
134
  callbacks
133
135
  }) {
134
136
  const jwkThumbprint = await calculateJwkThumbprint({
135
- hashAlgorithm: "SHA-256" /* Sha256 */,
137
+ hashAlgorithm: "sha-256" /* Sha256 */,
136
138
  hashCallback: callbacks.hash,
137
139
  jwk
138
140
  });
139
141
  for (const jwkFromSet of jwks) {
140
142
  const jwkFromSetThumbprint = await calculateJwkThumbprint({
141
- hashAlgorithm: "SHA-256" /* Sha256 */,
143
+ hashAlgorithm: "sha-256" /* Sha256 */,
142
144
  hashCallback: callbacks.hash,
143
145
  jwk: jwkFromSet
144
146
  });
@@ -829,7 +831,7 @@ async function createDpopHeadersForRequest(options) {
829
831
  async function createDpopJwt(options) {
830
832
  let ath = void 0;
831
833
  if (options.accessToken) {
832
- ath = encodeToBase64Url2(await options.callbacks.hash(decodeUtf8String2(options.accessToken), "SHA-256" /* Sha256 */));
834
+ ath = encodeToBase64Url2(await options.callbacks.hash(decodeUtf8String2(options.accessToken), "sha-256" /* Sha256 */));
833
835
  }
834
836
  const header = parseWithErrorHandling4(zDpopJwtHeader, {
835
837
  typ: "dpop+jwt",
@@ -883,7 +885,7 @@ async function verifyDpopJwt(options) {
883
885
  }
884
886
  if (options.accessToken) {
885
887
  const expectedAth = encodeToBase64Url2(
886
- await options.callbacks.hash(decodeUtf8String2(options.accessToken), "SHA-256" /* Sha256 */)
888
+ await options.callbacks.hash(decodeUtf8String2(options.accessToken), "sha-256" /* Sha256 */)
887
889
  );
888
890
  if (!payload.ath) {
889
891
  throw new Oauth2Error(`Dpop jwt does not have a ath value, but expected ath value '${expectedAth}'.`);
@@ -894,7 +896,7 @@ async function verifyDpopJwt(options) {
894
896
  }
895
897
  if (options.expectedJwkThumbprint) {
896
898
  const jwkThumprint = await calculateJwkThumbprint({
897
- hashAlgorithm: "SHA-256" /* Sha256 */,
899
+ hashAlgorithm: "sha-256" /* Sha256 */,
898
900
  hashCallback: options.callbacks.hash,
899
901
  jwk: header.jwk
900
902
  });
@@ -1358,7 +1360,7 @@ async function createAccessTokenJwt(options) {
1358
1360
  scope: options.scope,
1359
1361
  cnf: options.dpopJwk ? {
1360
1362
  jkt: await calculateJwkThumbprint({
1361
- hashAlgorithm: "SHA-256" /* Sha256 */,
1363
+ hashAlgorithm: "sha-256" /* Sha256 */,
1362
1364
  hashCallback: options.callbacks.hash,
1363
1365
  jwk: options.dpopJwk
1364
1366
  })
@@ -1557,7 +1559,7 @@ async function calculateCodeChallenge(options) {
1557
1559
  return options.codeVerifier;
1558
1560
  }
1559
1561
  if (options.codeChallengeMethod === "S256" /* S256 */) {
1560
- return encodeToBase64Url5(await options.hashCallback(decodeUtf8String4(options.codeVerifier), "SHA-256" /* Sha256 */));
1562
+ return encodeToBase64Url5(await options.hashCallback(decodeUtf8String4(options.codeVerifier), "sha-256" /* Sha256 */));
1561
1563
  }
1562
1564
  throw new Oauth2Error(`Unsupported code challenge method ${options.codeChallengeMethod}`);
1563
1565
  }
@@ -2392,7 +2394,7 @@ async function createAuthorizationRequestUrl(options) {
2392
2394
  } else {
2393
2395
  if (options.dpop) {
2394
2396
  authorizationRequest.dpop_jkt = await calculateJwkThumbprint({
2395
- hashAlgorithm: "SHA-256" /* Sha256 */,
2397
+ hashAlgorithm: "sha-256" /* Sha256 */,
2396
2398
  hashCallback: options.callbacks.hash,
2397
2399
  jwk: options.dpop.signer.publicJwk
2398
2400
  });