Skip to content

Commit

Permalink
refactor: rename func
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Maldonado <[email protected]>
  • Loading branch information
md0x committed Dec 11, 2024
1 parent 33d61ff commit 5f174ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion api/_exclusivity/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const getRelayerFromSignature = async (
return ethers.utils.verifyMessage(message, signature);
};

export const isMessageFresh = (
export const isTimestampValid = (
timestamp: number,
maxAgeSeconds: number
): boolean => {
Expand Down
6 changes: 3 additions & 3 deletions api/relayer-config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { VercelResponse } from "@vercel/node";
import {
getRelayerFromSignature,
isMessageFresh,
isTimestampValid,
whiteListedRelayers,
} from "./_exclusivity/utils";
import { TypedVercelRequest } from "./_types";
Expand All @@ -15,7 +15,7 @@ const handleGetRequest = async (
const { signature, message } = request.query;

const { timestamp, ...restOfMessage } = JSON.parse(message);
if (!isMessageFresh(timestamp, MAX_MESSAGE_AGE_SECONDS)) {
if (!isTimestampValid(timestamp, MAX_MESSAGE_AGE_SECONDS)) {
return response.status(400).json({ message: "Message too old" });
}

Expand All @@ -39,7 +39,7 @@ const handlePostRequest = async (
const { signature, message } = request.body;

const { timestamp, ...restOfMessage } = message;
if (!isMessageFresh(timestamp, MAX_MESSAGE_AGE_SECONDS)) {
if (!isTimestampValid(timestamp, MAX_MESSAGE_AGE_SECONDS)) {
return response.status(400).json({ message: "Message too old" });
}

Expand Down

0 comments on commit 5f174ec

Please sign in to comment.