itizawa před 5 roky
rodič
revize
6a1ac2aae0
1 změnil soubory, kde provedl 9 přidání a 0 odebrání
  1. 9 0
      src/server/routes/apiv3/slack-bot.js

+ 9 - 0
src/server/routes/apiv3/slack-bot.js

@@ -33,6 +33,15 @@ module.exports = (crowi) => {
   }
 
   router.post('/', verificationRequestUrl, verificationAccessToken, async(req, res) => {
+  function verifyingIsSlackRequest(req, res, next) {
+    console.log(req.body);
+    const timestamp = req.headers['x-slack-request-timestamp'];
+    console.log(timestamp);
+    const sigBaseString = `v0:${timestamp}:${req.body}`;
+    console.log(sigBaseString);
+
+    return next();
+  }
 
     // Send response immediately to avoid opelation_timeout error
     // See https://api.slack.com/apis/connections/events-api#the-events-api__responding-to-events