Support Quorum Wallet seed
This commit is contained in:
parent
80f758413b
commit
6e1f951637
|
@ -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.
|
||||
|
||||
|
|
10
index.js
10
index.js
|
@ -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
|
||||
|
|
|
@ -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')
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue