MCPcopy Create free account
hub / github.com/async-labs/async / verifySignature

Function verifySignature

api/server/api/index.ts:15–28  ·  view source on GitHub ↗
(signature)

Source from the content-addressed store, hash-verified

13}
14
15async function verifySignature(signature) {
16 if (process.env.ENCRYPTION_KEY.length < 32) {
17 throw new Error('Your encryption key must be 32 or more characters');
18 }
19
20 // check length at browser as well
21
22 const originalMessage = await CryptoJS.AES.decrypt(
23 signature,
24 process.env.ENCRYPTION_KEY,
25 ).toString(CryptoJS.enc.Utf8);
26
27 return originalMessage === 'api-server';
28}
29
30async function checkRequest(req, res, next) {
31 const signature = req.get('x-async-signature');

Callers 1

checkRequestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected