add Passphrase test
This commit is contained in:
parent
06878fd41c
commit
13a9eebd9d
2 changed files with 30 additions and 6 deletions
|
|
@ -9,7 +9,10 @@ function Passphrase(config) {
|
||||||
Passphrase.prototype.get = function(password) {
|
Passphrase.prototype.get = function(password) {
|
||||||
var hash = CryptoJS.SHA256(CryptoJS.SHA256(password));
|
var hash = CryptoJS.SHA256(CryptoJS.SHA256(password));
|
||||||
var salt = CryptoJS.enc.Base64.parse(this.salt);
|
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;
|
return key512;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
21
test/test.Passphrase.js
Normal file
21
test/test.Passphrase.js
Normal file
|
|
@ -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);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue