auth70 / paseto-ts

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

globalThis.crypto causes ERR_INVALID_THIS in Node 19.4.0 #2

Closed JohnnyRacer closed 1 year ago

JohnnyRacer commented 1 year ago

Hello, I tried using this library to generate some PASETO tokens but ran into an issue where it would give the following error:

TypeError [ERR_INVALID_THIS]: Value of "this" must be of type Crypto

By passing the actual function from the crypto module solved my problem like so const token = await encrypt(encryptKey, {'hello' : 'world'},{getRandomValues : crypto.getRandomValues});.

miunau commented 1 year ago

Thanks for raising the issue. I've removed the usage in 6ba686f