input-output-hk / js-cardano-wasm

various cardano javascript using wasm bindings
MIT License
31 stars 21 forks source link

Wallet.fromSeed not working #39

Closed gutenye closed 5 years ago

gutenye commented 5 years ago

Given

const seed = '0'.repeat(32).split('')
CardanoCrypto.Wallet.fromSeed(seed)

it returns false

NicolasDP commented 5 years ago

It seems to me that the returned value of this call is:

> '0'.repeat(32).split('')
(32) ["0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"]

However we are expecting an array of bytes, more like this:

> Array(32).fill(0)
(32) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
gutenye commented 5 years ago

@nicarq Thanks for quick reply. Tested with Array(32).fill(0), still returns false. My version is built from the master branch.

nicarq commented 5 years ago

@gutenye wrong Nicolas :)

gutenye commented 5 years ago

@NicolasDP Could you please take a look at it?

NicolasDP commented 5 years ago

I'll put that up on my task list

NicolasDP commented 5 years ago

thanks for reporting the issue, it was indeed a bug. The SEED_SIZE was not exported and was left undefined. We then always had an invalid Wallet's SEED. This is fixed in #40 . I'll merge the PR which will close this issue. However if you find the issue is not solved to satisfaction, we can always reopen.