diff options
Diffstat (limited to 'server/middlewares/secure.js')
-rw-r--r-- | server/middlewares/secure.js | 12 |
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 | ||
3 | var logger = require('../helpers/logger') | 3 | const logger = require('../helpers/logger') |
4 | var peertubeCrypto = require('../helpers/peertubeCrypto') | 4 | const peertubeCrypto = require('../helpers/peertubeCrypto') |
5 | var Pods = require('../models/pods') | 5 | const Pods = require('../models/pods') |
6 | 6 | ||
7 | var secureMiddleware = { | 7 | const secureMiddleware = { |
8 | decryptBody: decryptBody | 8 | decryptBody: decryptBody |
9 | } | 9 | } |
10 | 10 | ||
11 | function decryptBody (req, res, next) { | 11 | function 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) { |