passwordless-id / webauthn

Webauthn / passkeys helper library to make your life easier. Client side, server side and demo included.
https://webauthn.passwordless.id
MIT License
436 stars 51 forks source link

ReferenceError: crypto is not defined #42

Closed JuriHaataja closed 5 months ago

JuriHaataja commented 5 months ago

I'm running this library with Firebase Functions and for some reason it's unable to use the crypto library that should be built-in in Node v20.

More detailed logs:

ReferenceError: crypto is not defined
at parseCryptoKey (file:///workspace/node_modules/@passwordless-id/webauthn/dist/esm/server.js:92:5)
    at verifySignature (file:///workspace/node_modules/@passwordless-id/webauthn/dist/esm/server.js:107:27)
    at Module.verifyAuthentication (file:///workspace/node_modules/@passwordless-id/webauthn/dist/esm/server.js:31:36)
JuriHaataja commented 5 months ago

Update:

"engines": {
    "node": "20"
  },

For some reason my node version wasn't synced (it was using v18) with local changes when deployed to cloud.