CR fixes
This commit is contained in:
parent
50e0221dd1
commit
94bfe116aa
@ -39,7 +39,8 @@ export default class Accounts {
|
||||
create (secret, password) {
|
||||
const privateKey = Buffer.from(secret.slice(2), 'hex');
|
||||
|
||||
return Account.fromPrivateKey(this.persist, privateKey, password)
|
||||
return Account
|
||||
.fromPrivateKey(this.persist, privateKey, password)
|
||||
.then((account) => {
|
||||
const { address } = account;
|
||||
|
||||
@ -87,7 +88,8 @@ export default class Accounts {
|
||||
return false;
|
||||
}
|
||||
|
||||
return account.isValidPassword(password)
|
||||
return account
|
||||
.isValidPassword(password)
|
||||
.then((isValid) => {
|
||||
if (!isValid) {
|
||||
return false;
|
||||
|
@ -22,7 +22,8 @@ export function createKeyObject (key, password) {
|
||||
}
|
||||
|
||||
export function decryptPrivateKey (keyObject, password) {
|
||||
return workerPool.getWorker()
|
||||
return workerPool
|
||||
.getWorker()
|
||||
.action('decryptPrivateKey', { keyObject, password })
|
||||
.then((privateKey) => {
|
||||
if (privateKey) {
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
import secp256k1 from 'secp256k1/js';
|
||||
import { keccak_256 as keccak256 } from 'js-sha3';
|
||||
import { bytesToHex } from '~/api/util/format';
|
||||
|
||||
const isWorker = typeof self !== 'undefined';
|
||||
|
||||
@ -107,10 +108,6 @@ const actions = {
|
||||
}
|
||||
};
|
||||
|
||||
function bytesToHex (bytes) {
|
||||
return '0x' + Array.from(bytes).map(n => ('0' + n.toString(16)).slice(-2)).join('');
|
||||
}
|
||||
|
||||
self.onmessage = function ({ data }) {
|
||||
const result = route(data);
|
||||
|
||||
|
@ -60,7 +60,8 @@ export default class LocalAccountsMiddleware extends Middleware {
|
||||
register('parity_changePassword', ([address, oldPassword, newPassword]) => {
|
||||
const account = accounts.get(address);
|
||||
|
||||
return account.decryptPrivateKey(oldPassword)
|
||||
return account
|
||||
.decryptPrivateKey(oldPassword)
|
||||
.then((privateKey) => {
|
||||
if (!privateKey) {
|
||||
return false;
|
||||
|
@ -17,7 +17,7 @@
|
||||
import { range } from 'lodash';
|
||||
|
||||
export function bytesToHex (bytes) {
|
||||
return '0x' + bytes.map((b) => ('0' + b.toString(16)).slice(-2)).join('');
|
||||
return '0x' + Buffer.from(bytes).toString('hex');
|
||||
}
|
||||
|
||||
export function cleanupValue (value, type) {
|
||||
|
@ -60,7 +60,6 @@ describe('modals/CreateAccount/NewAccount', () => {
|
||||
|
||||
it('resets the accounts', () => {
|
||||
expect(instance.state.accounts).to.be.null;
|
||||
// expect(Object.keys(instance.state.accounts).length).to.equal(7);
|
||||
});
|
||||
|
||||
it('resets the initial selected value', () => {
|
||||
|
Loading…
Reference in New Issue
Block a user