Skip to content

Commit

Permalink
chore: renames key names
Browse files Browse the repository at this point in the history
  • Loading branch information
Ajeyakrishna-k committed Jan 10, 2024
1 parent 44edbf8 commit 949b5b3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/utils/verifyAuthToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export async function verifyCronJobsToken(authHeader: string, env: env) {
throw new Error(INVALID_TOKEN_FORMAT);
}
const authToken = parts[1];
const isValid = await jwt.verify(authToken, env.CRON_JOBS_PRIVATE_KEY, {
const isValid = await jwt.verify(authToken, env.CRON_JOBS_PUBLIC_KEY, {
algorithm: "RS256",
});
if (!isValid) {
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/utils/verifyToken.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe("verifyAuthToken", () => {

describe("verifyCronJobsToken", () => {
const authToken = "validToken";
const mockEnv = { CRON_JOBS_PRIVATE_KEY: "publicKey" };
const mockEnv = { CRON_JOBS_PUBLIC_KEY: "publicKey" };

afterEach(() => {
jest.clearAllMocks();
Expand All @@ -65,7 +65,7 @@ describe("verifyCronJobsToken", () => {
).resolves.not.toThrow();
expect(jwt.verify).toHaveBeenCalledWith(
authToken,
mockEnv.CRON_JOBS_PRIVATE_KEY,
mockEnv.CRON_JOBS_PUBLIC_KEY,
{ algorithm: "RS256" }
);
});
Expand Down

0 comments on commit 949b5b3

Please sign in to comment.