sjudson / paseto.js

PASETO: Platform-Agnostic Security Tokens
MIT License
269 stars 16 forks source link

Unable to create symmetric key #32

Closed rustyconover closed 3 years ago

rustyconover commented 3 years ago

Using Node v15.8.0

(async function () {
    const encoder = new Paseto.V2();
    const encoder_key = await encoder.symmetric();
    console.log(encoder_key);
})().catch(e => {
    console.error(e);
});

encoder_key is always undefined. Could this be a problem with the crypto bindings on newer node versions?

Thanks.

Rusty

sjudson commented 3 years ago

No, this is a similar bug in the code to what was fixed here: https://github.com/sjudson/paseto.js/commit/e3060ccb7b9ce27cadf7d8cff8b5946b24244ba4

I'll have a fix up in a new release by tonight (EDT), thanks for the report.

sjudson commented 3 years ago

Will be slightly delayed, but should be up tomorrow.

sjudson commented 3 years ago

Fixed in: https://github.com/sjudson/paseto.js/commit/618da178daf5c0049d0e490212861b3debe637ac, which has been published to npm.

I also added a bunch of async/await tests, so hopefully this won't happen again. Let me know if you have any further problems.

rustyconover commented 3 years ago

Cool, I'll check it out.

rustyconover commented 3 years ago

Works great! Thanks for the fix.