cauthy-auth 0.23.0 → 0.24.0
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.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -700,7 +700,6 @@ async function verifyWebhook(request, options = {}) {
|
|
|
700
700
|
try {
|
|
701
701
|
const verified = await (0, import_jose3.jwtVerify)(signature, options.jwks ?? keysOf(issuer), {
|
|
702
702
|
algorithms: ["RS256"],
|
|
703
|
-
issuer,
|
|
704
703
|
audience,
|
|
705
704
|
typ: "cauthy-webhook+jwt",
|
|
706
705
|
requiredClaims: ["exp", "iat", "jti", "body_sha256"],
|
|
@@ -711,6 +710,9 @@ async function verifyWebhook(request, options = {}) {
|
|
|
711
710
|
} catch (err) {
|
|
712
711
|
throw new CauthyWebhookError(err instanceof Error ? err.message : "bad signature");
|
|
713
712
|
}
|
|
713
|
+
if (claims.iss !== issuer && claims.domain_iss !== issuer) {
|
|
714
|
+
throw new CauthyWebhookError('unexpected "iss" claim value');
|
|
715
|
+
}
|
|
714
716
|
const now = Math.floor((options.now ?? /* @__PURE__ */ new Date()).getTime() / 1e3);
|
|
715
717
|
if (typeof claims.iat !== "number" || claims.iat > now + 30) throw new CauthyWebhookError("signed in the future");
|
|
716
718
|
const digest = new Uint8Array(await crypto.subtle.digest("SHA-256", raw));
|