Closed rkreienbuehl closed 3 months ago
EDIT: removed useless misleading comment
no ...wait ...there is something more fishy ....your whole crypto modules is not defined ...that strange ...what does it do if you start node in the terminal and you simply enter "crypto" in the prompt? On mine, I get the Crypto object back, what about yours?
Perhaps it has also something to do with the bundling of your app... crypto
should be a global.
Thanks for your response. You are right, thats strange. As I read, since node 19 crypto should be globally available.
When I start node and enter crypto
I get Crypto {}
and when I type typeof crypto
I get 'undefined'
.
I got it working by using globalThis.crypto ??= require("node:crypto").webcrypto
as a workaround, maybe this is a problem with tsx which I am using for running in dev environment.
weird ...but I'm afraid I don't really know what's going on. Thanks for the workaround.
crypto in node is not available in globals, used the module crypto. import { webcrypto } from 'crypto';
@xkid1 I beg to differ: https://nodejs.org/docs/latest-v22.x/api/globals.html#crypto_1
Well, it's weird. Good thing @rkreienbuehl found a workaround.
globalThis.crypto ??= require("node:crypto").webcrypto
I have setup
@passwordless-id/webauthn
and want to use theserver
as described in the docs to verify the authentication withserver.verifyAuthentication(...)
. Sadly, I get the following error:Is there anything I missed?
I use
node
versionv20.10.0
and@passwordless-id/webauthn
versionv1.6.1
.