Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decrypting a keystore fails on 1.2.9 (browser / React ) #3580

Closed
elmariachi111 opened this issue Jun 11, 2020 · 5 comments · Fixed by #3581
Closed

Decrypting a keystore fails on 1.2.9 (browser / React ) #3580

elmariachi111 opened this issue Jun 11, 2020 · 5 comments · Fixed by #3581
Labels
1.x 1.0 related issues Bug Addressing a bug Stale Has not received enough activity

Comments

@elmariachi111
Copy link
Contributor

1.2.9 broke web3.eth.accounts.wallet.decrypt (works fine in 1.2.8):

Expected behavior

in the browser (chromium) I can decrypt an encrypted wallet keystore structure.

Actual behavior

it shows me an the error TypeError: "list" argument must be an Array of Buffers

Steps to reproduce the behavior

call web3.eth.accounts.wallet.decrypt(jsonKeystore, password);

I've put a demo repo here:
https://github.com/cod1ng-earth/demo-web3-129-breaks-keystore-decryption

Environment

node 13 / 14 for building, chrome 83

Background

I debugged until the failing call that occurs on 1.2.9 on web3-eth-accounts, Line 384: 2f366c7#diff-7bb2a20126193b9ecfe4723f83429c49R384

The result of the newly introduced derivedKey = scrypt.syncScrypt seems to be related somehow, even though [derivedKey.slice(16, 32), ciphertext] is actually an array of two Uint8 arrays ([Uint8Array(16), Uint8Array(32)]). After having a look at the scrypt line (https://github.com/ricmoo/scrypt-js/blob/master/scrypt.js#L462) I'm absolutely not sure what could go wrong here, so I leave it up to you guys :(

Screenshot from 2020-06-11 16-52-01

@cgewecke cgewecke added 1.x 1.0 related issues Bug Addressing a bug labels Jun 12, 2020
@cgewecke cgewecke changed the title Decrypting a keystore fails on 1.2.9 (browser) Decrypting a keystore fails on 1.2.9 (browser / React ) Jun 12, 2020
cgewecke pushed a commit that referenced this issue Jun 12, 2020
…3581)

* (untested) potential fix for #3580

I haven't even executed this. Maybe it's... already working like that?!
dunno if ES6 spread ops already are allowed here?!

* added #3580 fix to changelog

* #3580 adds e2e test that covers the incompatible line
changed the Changelog to reflect relation to React
@lucille-bellepleure
Copy link

I have the same issue but with web3.eth.accounts.encrypt(privkey, passw);

cgewecke pushed a commit that referenced this issue Jun 27, 2020
…3581)

* (untested) potential fix for #3580

I haven't even executed this. Maybe it's... already working like that?!
dunno if ES6 spread ops already are allowed here?!

* added #3580 fix to changelog

* #3580 adds e2e test that covers the incompatible line
changed the Changelog to reflect relation to React
cgewecke pushed a commit that referenced this issue Jun 29, 2020
…3581)

* (untested) potential fix for #3580

I haven't even executed this. Maybe it's... already working like that?!
dunno if ES6 spread ops already are allowed here?!

* added #3580 fix to changelog

* #3580 adds e2e test that covers the incompatible line
changed the Changelog to reflect relation to React
@GregTheGreek
Copy link
Contributor

This just got merged in an hour ago @wendydv1989 @elmariachi111 If you'd like you can check the 1.x branch for the fix, otherwise hold tight for the next release!

@elmariachi111
Copy link
Contributor Author

yep, tested that with my demo repo and 1.x fixes the issue ❤️

@GregTheGreek
Copy link
Contributor

Awesome, will close this out once we cut a release :)

@ryanio ryanio mentioned this issue Jul 9, 2020
14 tasks
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.

@github-actions github-actions bot added the Stale Has not received enough activity label Jul 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x 1.0 related issues Bug Addressing a bug Stale Has not received enough activity
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants