Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Cloud11PL committed Mar 4, 2024
1 parent 3bba0f1 commit 5f11b53
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/purple-colts-guess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@saleor/app-sdk": patch
---

WIP
6 changes: 5 additions & 1 deletion src/verify-jwt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ export const verifyJWT = async ({

const JWKS = jose.createRemoteJWKSet(new URL(getJwksUrlFromSaleorApiUrl(saleorApiUrl)));
debug("Trying to compare JWKS with token");
await jose.jwtVerify(token, JWKS);
await jose.jwtVerify(token, JWKS, {
crit: {
b64: true,
},
});
} catch (e) {
debug("Failure: %s", e);
debug("Will return with Bad Request");
Expand Down
6 changes: 6 additions & 0 deletions src/verify-signature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ export const verifySignatureFromApiUrl = async (
protected: header,
payload: rawBody,
signature: jwsSignature,
header: {
b64: true,
},
};

const remoteJwks = jose.createRemoteJWKSet(
Expand Down Expand Up @@ -52,6 +55,9 @@ export const verifySignatureWithJwks = async (jwks: string, signature: string, r
protected: header,
payload: rawBody,
signature: jwsSignature,
header: {
b64: true,
},
};

let localJwks: jose.FlattenedVerifyGetKey;
Expand Down

0 comments on commit 5f11b53

Please sign in to comment.