auth70 / paseto-ts

PASETO v4 (encrypt, decrypt, sign & verify) in TypeScript
MIT License
27 stars 7 forks source link

Crypto is not defined #1

Closed Extarys closed 1 year ago

Extarys commented 1 year ago

When using on node v16.17, simply importing the library and calling generateKeys generate the following:

[unhandledRejection] ReferenceError: crypto is not defined 
    at generateKeys (file://.../node_modules/paseto-ts/dist/v4/key.js:11:13)
miunau commented 1 year ago

Hi, thanks for raising the issue. I'd only tested with Node 19, but made some changes so that on Node < 19 you'll need to pass an implementation for getRandomValues. Please see the updated readme:

https://github.com/auth70/paseto-ts#note-on-node-versions-under-19