antelle / argon2-browser

Argon2 library compiled for browser runtime
https://antelle.net/argon2-browser
MIT License
367 stars 79 forks source link

Async Await #33

Closed afrancht closed 4 years ago

afrancht commented 4 years ago

Instead of promises can we use the async await syntax with argon2-browser?

antelle commented 4 years ago

Hi! Indeed you can, it's a normal promise, without any hacks.

antelle commented 4 years ago
(async function() {
    const hash = await argon2.hash({ pass: 'p@ssw0rd', salt: 'somesalt' });
    console.log(hash.encoded);
})();