addByKeyStore requires password of length > 0
mattlockyer opened this issue · comments
using async addByKeyStore(keyStore: string, password: string): Promise<Account>
It's impossible to pass in a password of length == 0, even though this may be a popular option for test accounts or local environments.
Version:
"@harmony-js/core": "^0.1.32"
Code to reproduce:
const keystore = '...'
const delegator = await harmony.wallet.addByKeyStore(keystore, '')
Temp fix for line 107 of account.js (dist):
if (!password) {
throw new Error('you must provide password');
}
// guessing... !password evaluates to false for '' if coming from TypeScript?
// below I want to skip this throw...
if (false && !password) {
throw new Error('you must provide password');
}
Maybe I would provide another import method to put the keystore to account Map. Because initially, I only think that if we can not decrypt an keystore , we should not own the privateKey behind.
For your case. I will try fix the length problem. Hang in there
@mattlockyer
would you try this branch to see if the empty string encryption works for you