Support Quorum Wallet seed

This commit is contained in:
Alex Beregszaszi 2016-03-08 21:44:42 +00:00
parent 80f758413b
commit 6e1f951637
3 changed files with 18 additions and 0 deletions

View File

@ -29,6 +29,7 @@ Constructors:
* `fromEtherCamp(passphrase)` - import a brain wallet used by Ether.Camp
* `fromEtherWallet(input, password)` - import a wallet generated by EtherWallet
* `fromKryptoKit(seed)` - import a wallet from a KryptoKit seed
* `fromQuorumWallet(passphrase, userid)` - import a brain wallet used by Quorum Wallet
For the V1, V3 and EthSale formats the input is a JSON serialized string. All these formats require a password.

View File

@ -418,4 +418,14 @@ Wallet.fromKryptoKit = function (entropy, password) {
return new Wallet(privKey)
}
Wallet.fromQuorumWallet = function (passphrase, userid) {
assert(passphrase.length >= 10)
assert(userid.length >= 10)
var seed = passphrase + userid
seed = crypto.pbkdf2Sync(seed, seed, 2000, 32, 'sha256');
return new Wallet(seed)
}
module.exports = Wallet

View File

@ -148,3 +148,10 @@ describe('.fromKryptoKit()', function () {
assert.equal(wallet.getAddressString(), '0x3c753e27834db67329d1ec1fab67970ec1e27112')
})
})
describe('.fromQuorumWallet()', function () {
it('should work', function () {
var wallet = Wallet.fromQuorumWallet('testtesttest', 'ethereumjs-wallet')
assert.equal(wallet.getAddressString(), '0x1b86ccc22e8f137f204a41a23033541242a48815')
})
})