Closed mymindstorm closed 4 years ago
Thanks for reporting this! That's what the bug report should look like. 🎁 There are actually two issues here:
Published v1.7.0, updated the usage example, now your code works in webpack and node.js versions.
Thanks for the quick fix!
cab936d confirmed fixed.
31bbf70 does not fix, still getting e.allocate is not a function
with the second bad code sample.
Fixed that one too (it passed in node, but not in browser).
Hi,
I've been using the example webpack code, and I'm having some trouble getting verify to work.
Broken code
```js const argon2 = require('argon2-browser'); argon2 .hash({ pass: 'p@ssw0rd', salt: 'somesalt' }) .then(hash => { console.log(hash); argon2 .verify({ pass: 'p@ssw0rd', encoded: hash.encoded }) .then(() => console.log('Hash correct')) .catch(e => console.log(e)); }); ```The above code generates a hash correctly, but it never fulfills or rejects the
argon2.verify
promise.Working code
```js argon2 .verify({ pass: 'p@ssw0rd', encoded: '$argon2d$v=19$m=1024,t=1,p=1$c29tZXNhbHQ$JGOjI98eRw4ahgg28250Fz2BKEFl48Xm' }) .then(() => console.log('Hash correct')) .catch(e => console.log(e)); ```I then manually copied the string into another promise, which works fine and reaches
'Hash correct'
.Additionally, I found that if you try to do more than one thing at once, it will have problems allocating memory.
More bad code
```js const argon2 = require('argon2-browser'); argon2 .hash({ pass: 'p@ssw0rd', salt: 'somesalt' }) .then(hash => { console.log(hash); }); argon2 .hash({ pass: 'p@ssw0rd', salt: 'somesalt' }) .then(hash => { console.log(hash); }); ```This will fail with
Not sure if I'm just doing something wrong. I'm hoping that you could point me in the right direction.