Update to use createVerify for Ed25519 signature verification
cgen-e03978f5078648b193e97a08881e07c4
This commit is contained in:
parent
2b0faed10a
commit
7097d90330
1 changed files with 3 additions and 6 deletions
|
|
@ -37,12 +37,9 @@ export function createServer() {
|
|||
|
||||
// Verify request signature
|
||||
try {
|
||||
const isValid = verify(
|
||||
"ed25519",
|
||||
Buffer.from(`${timestamp}${body}`),
|
||||
publicKey,
|
||||
Buffer.from(signature, "hex"),
|
||||
);
|
||||
const verifier = createVerify("ed25519");
|
||||
verifier.update(`${timestamp}${body}`);
|
||||
const isValid = verifier.verify(publicKey, Buffer.from(signature, "hex"));
|
||||
|
||||
if (!isValid) {
|
||||
return res.status(401).json({ error: "Invalid signature" });
|
||||
|
|
|
|||
Loading…
Reference in a new issue