panva / paseto

PASETO (Platform-Agnostic SEcurity TOkens) for Node.js with no dependencies
MIT License
428 stars 26 forks source link

Bug cannot read property 'subtle' of undefined #40

Closed Spectre98 closed 1 year ago

Spectre98 commented 1 year ago

What happened?

When I try to implement paseto V4 in expressjs it gives me this error

C:\laragon\www\scirpt\node_modules\paseto\lib\help\crypto_worker.js:10 webcrypto: { subtle }, ^

TypeError: Cannot read property 'subtle' of undefined at Object. (C:\laragon\www\scirpt\node_modules\paseto\lib\help\crypto_worker.js:10:16) at Module._compile (internal/modules/cjs/loader.js:1063:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) at Module.load (internal/modules/cjs/loader.js:928:32) at Function.Module._load (internal/modules/cjs/loader.js:769:14) at Module.require (internal/modules/cjs/loader.js:952:19) at require (internal/modules/cjs/helpers.js:88:18) at Object. (C:\laragon\www\scirpt\node_modules\paseto\lib\help\sign.js:1:18) at Module._compile (internal/modules/cjs/loader.js:1063:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)

Version

v3.1.2

Node.js Version

v16.17.0

Code to reproduce

const paseto = require('paseto')
const { V4 } = paseto

Required

panva commented 1 year ago

Node's crypto module has a webcrypto property in all v16.x releases. 🤷‍♂️

issue is somewhere in your environment