mirror of https://github.com/BTCPrivate/copay.git
securely store encryptation passwords
This commit is contained in:
parent
54f42f8278
commit
929c6ffa6d
|
@ -4,18 +4,20 @@ var imports = require('soop').imports();
|
||||||
//var buffertools = imports.buffertools || require('buffertools');
|
//var buffertools = imports.buffertools || require('buffertools');
|
||||||
var parent = imports.parent || require('./Plain');
|
var parent = imports.parent || require('./Plain');
|
||||||
|
|
||||||
|
var id = 0;
|
||||||
function Storage() {
|
function Storage() {
|
||||||
|
this.__uniqueid = ++id;
|
||||||
}
|
}
|
||||||
Storage.parent = parent;
|
Storage.parent = parent;
|
||||||
|
|
||||||
|
|
||||||
var passphrase = null;
|
var pps = {};
|
||||||
Storage.prototype._getPassphrase = function() {
|
Storage.prototype._getPassphrase = function() {
|
||||||
return passphrase;
|
return pps[this.__uniqueid];
|
||||||
}
|
}
|
||||||
|
|
||||||
Storage.prototype._setPassphrase = function(password) {
|
Storage.prototype._setPassphrase = function(password) {
|
||||||
passphrase = password;
|
pps[this.__uniqueid] = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
Storage.prototype._encrypt = function(data) {
|
Storage.prototype._encrypt = function(data) {
|
||||||
|
|
|
@ -16,7 +16,7 @@ if (typeof process === 'undefined' || !process.version) {
|
||||||
var s = new Encrypted();
|
var s = new Encrypted();
|
||||||
should.exist(s);
|
should.exist(s);
|
||||||
});
|
});
|
||||||
it.skip('should fail when encrypting without a password', function() {
|
it('should fail when encrypting without a password', function() {
|
||||||
var s = new Encrypted();
|
var s = new Encrypted();
|
||||||
(function(){s.set(wid, 'x', 1);}).should.throw();
|
(function(){s.set(wid, 'x', 1);}).should.throw();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue