EOSIO / eosjs-keygen

Javascript keys generator for EOS
71 stars 42 forks source link

Possible Unresolved promise in deriveKeys #3

Closed chris-allnutt closed 6 years ago

chris-allnutt commented 6 years ago

Executing the following code will hang

const deriveAccountKeys = async (accountName) => {
    const masterKeys = await Keygen.generateMasterKeys()
    const eosioKeystore = Keystore("eosio")
    eosioKeystore.deriveKeys({ parent: <use a valid key here> })
}

When I remove deriveKeys it properly exits or if I call process.exit().

Oddly enough I can still print out the keys it generates

const pubKeys = eosioKeystore.getKeys("active").map(key => key.pubkey)
console.log(pubKeys)
jcalfee commented 6 years ago
> s = async function(accountName) {
... masterKeys = await Keygen.generateMasterKeys()
...     eosioKeystore = Keystore("eosio")
... eosioKeystore.deriveKeys({ parent: masterKeys.privateKeys.owner })
... }
> s().then(r=>console.log(r))
Promise {
  <pending>,
  domain: 
   Domain {
     domain: null,
     _events: { error: [Function: debugDomainError] },
     _eventsCount: 1,
     _maxListeners: undefined,
     members: [] } }
> undefined

Can't reproduce in node.. undefined prints indicating that the function completed.. Try using masterKeys.privateKeys.owner in the parent.

chris-allnutt commented 6 years ago

Must be something higher up in my code. Thanks for the response.