How to use the @alicloud/fc2.getSignature function in @alicloud/fc2

To help you get started, we’ve selected a few @alicloud/fc2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alibaba / funcraft / lib / local / http.js View on Github external
async function validateSignature(req, res, method) {
  const profile = await getProfile();

  const signature = FC.getSignature(profile.accessKeyId, profile.accessKeySecret, method, req.path, req.headers, req.queries);

  const clientSignature = req.headers['authorization'];

  if (signature !== clientSignature) {
    res.status(500);
    res.send(`Signature doesn't match, request signature is ${clientSignature}, but server signature is ${signature}`);
    return false;
  }

  return true;
}

@alicloud/fc2

Aliyun Function Compute API SDK2

MIT
Latest version published 1 year ago

Package Health Score

49 / 100
Full package analysis

Popular @alicloud/fc2 functions

Similar packages