From bc503c2a62dcf9aed6b8d90b68f0f27a7755ac01 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 11 May 2016 21:19:34 +0200 Subject: Update to standard 7. Goodbye snake_case, I used to love you --- server/helpers/peertubeCrypto.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'server/helpers/peertubeCrypto.js') diff --git a/server/helpers/peertubeCrypto.js b/server/helpers/peertubeCrypto.js index 3826ebaf6..46dff8d03 100644 --- a/server/helpers/peertubeCrypto.js +++ b/server/helpers/peertubeCrypto.js @@ -21,10 +21,10 @@ const peertubeCrypto = { sign: sign } -function checkSignature (public_key, raw_data, hex_signature) { - const crt = ursa.createPublicKey(public_key) - const is_valid = crt.hashAndVerify('sha256', new Buffer(raw_data).toString('hex'), hex_signature, 'hex') - return is_valid +function checkSignature (publicKey, rawData, hexSignature) { + const crt = ursa.createPublicKey(publicKey) + const isValid = crt.hashAndVerify('sha256', new Buffer(rawData).toString('hex'), hexSignature, 'hex') + return isValid } function createCertsIfNotExist (callback) { @@ -43,16 +43,16 @@ function decrypt (key, data, callback) { fs.readFile(getCertDir() + 'peertube.key.pem', function (err, file) { if (err) return callback(err) - const my_private_key = ursa.createPrivateKey(file) - const decrypted_key = my_private_key.decrypt(key, 'hex', 'utf8') - const decrypted_data = symetricDecrypt(data, decrypted_key) + const myPrivateKey = ursa.createPrivateKey(file) + const decryptedKey = myPrivateKey.decrypt(key, 'hex', 'utf8') + const decryptedData = symetricDecrypt(data, decryptedKey) - return callback(null, decrypted_data) + return callback(null, decryptedData) }) } -function encrypt (public_key, data, callback) { - const crt = ursa.createPublicKey(public_key) +function encrypt (publicKey, data, callback) { + const crt = ursa.createPublicKey(publicKey) symetricEncrypt(data, function (err, dataEncrypted) { if (err) return callback(err) -- cgit v1.2.3