aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/secure.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-03-16 22:29:27 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-03-16 22:29:27 +0100
commitf0f5567b6918fc60c8cab15e13aec03a89a91dfb (patch)
tree99dfdb9fa8273c9cda1360fd3b6bfccc515bf8be /server/middlewares/secure.js
parent5101105ef91bfe478f97546b78b321882da2079c (diff)
downloadPeerTube-f0f5567b6918fc60c8cab15e13aec03a89a91dfb.tar.gz
PeerTube-f0f5567b6918fc60c8cab15e13aec03a89a91dfb.tar.zst
PeerTube-f0f5567b6918fc60c8cab15e13aec03a89a91dfb.zip
Use const/let now we use node 4.2
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) {