aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/secure.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/secure.js')
-rw-r--r--server/middlewares/secure.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/server/middlewares/secure.js b/server/middlewares/secure.js
index bfd28316a..9ecbf5df1 100644
--- a/server/middlewares/secure.js
+++ b/server/middlewares/secure.js
@@ -1,15 +1,15 @@
1'use strict' 1'use strict'
2 2
3var logger = require('../helpers/logger') 3const logger = require('../helpers/logger')
4var peertubeCrypto = require('../helpers/peertubeCrypto') 4const peertubeCrypto = require('../helpers/peertubeCrypto')
5var Pods = require('../models/pods') 5const Pods = require('../models/pods')
6 6
7var secureMiddleware = { 7const secureMiddleware = {
8 decryptBody: decryptBody 8 decryptBody: decryptBody
9} 9}
10 10
11function decryptBody (req, res, next) { 11function decryptBody (req, res, next) {
12 var url = req.body.signature.url 12 const url = req.body.signature.url
13 Pods.findByUrl(url, function (err, pod) { 13 Pods.findByUrl(url, function (err, pod) {
14 if (err) { 14 if (err) {
15 logger.error('Cannot get signed url in decryptBody.', { error: err }) 15 logger.error('Cannot get signed url in decryptBody.', { error: err })
@@ -23,7 +23,7 @@ function decryptBody (req, res, next) {
23 23
24 logger.debug('Decrypting body from %s.', url) 24 logger.debug('Decrypting body from %s.', url)
25 25
26 var signature_ok = peertubeCrypto.checkSignature(pod.publicKey, url, req.body.signature.signature) 26 const signature_ok = peertubeCrypto.checkSignature(pod.publicKey, url, req.body.signature.signature)
27 27
28 if (signature_ok === true) { 28 if (signature_ok === true) {
29 peertubeCrypto.decrypt(req.body.key, req.body.data, function (err, decrypted) { 29 peertubeCrypto.decrypt(req.body.key, req.body.data, function (err, decrypted) {