diff --git a/js/models/core/Passphrase.js b/js/models/core/Passphrase.js index 3d5755e54..358b21682 100644 --- a/js/models/core/Passphrase.js +++ b/js/models/core/Passphrase.js @@ -1,15 +1,18 @@ 'use strict'; function Passphrase(config) { - config = config || {}; - this.salt = config.salt || 'mjuBtGybi/4='; - this.iterations = config.iterations || 1000; + config = config || {}; + this.salt = config.salt || 'mjuBtGybi/4='; + this.iterations = config.iterations || 1000; }; Passphrase.prototype.get = function(password) { var hash = CryptoJS.SHA256(CryptoJS.SHA256(password)); var salt = CryptoJS.enc.Base64.parse(this.salt); - var key512 = CryptoJS.PBKDF2(hash, salt, { keySize: 512/32, iterations: this.iterations }); + var key512 = CryptoJS.PBKDF2(hash, salt, { + keySize: 512 / 32, + iterations: this.iterations + }); return key512; }; @@ -21,12 +24,12 @@ Passphrase.prototype.getBase64 = function(password) { return keyBase64; }; -Passphrase.prototype.getBase64Async = function(password,cb) { +Passphrase.prototype.getBase64Async = function(password, cb) { var self = this; setTimeout(function() { var ret = self.getBase64(password); return cb(ret); - },10); + }, 10); }; diff --git a/test/test.Passphrase.js b/test/test.Passphrase.js new file mode 100644 index 000000000..6e2b58a02 --- /dev/null +++ b/test/test.Passphrase.js @@ -0,0 +1,21 @@ +'use strict'; + +var chai = chai || require('chai'); +var should = chai.should(); +var bitcore = bitcore || require('bitcore'); +var buffertools = bitcore.buffertools; +var copay = copay || require('../copay'); +var Passphrase = copay.Passphrase; + + + +describe('Passphrase model', function() { + + it('should create an instance', function () { + var p = new Passphrase(); + should.exist(p); + }); + +}); + +