Coder Social home page Coder Social logo

Comments (7)

dagnelies avatar dagnelies commented on July 28, 2024

EDIT: removed useless misleading comment

from webauthn.

dagnelies avatar dagnelies commented on July 28, 2024

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?

from webauthn.

dagnelies avatar dagnelies commented on July 28, 2024

Perhaps it has also something to do with the bundling of your app... crypto should be a global.

from webauthn.

rkreienbuehl avatar rkreienbuehl commented on July 28, 2024

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.

from webauthn.

dagnelies avatar dagnelies commented on July 28, 2024

weird ...but I'm afraid I don't really know what's going on. Thanks for the workaround.

from webauthn.

xkid1 avatar xkid1 commented on July 28, 2024

crypto in node is not available in globals, used the module crypto.
import { webcrypto } from 'crypto';

from webauthn.

dagnelies avatar dagnelies commented on July 28, 2024

@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

from webauthn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.