Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generateP256KeyPair does not work on NodeJS 18 #315

Open
BriungRi opened this issue Jul 26, 2024 · 1 comment
Open

generateP256KeyPair does not work on NodeJS 18 #315

BriungRi opened this issue Jul 26, 2024 · 1 comment

Comments

@BriungRi
Copy link

Get this error:

crypto.getRandomValues is not a function

Upgrading to NodeJS 20 fixes

@r-n-o
Copy link
Contributor

r-n-o commented Jul 26, 2024

@BriungRi that's strange, I see in the documentation that crypto.getRandomValues was added in v15:
image

Locally I also checked that v18 includes this function:

❯ node
Welcome to Node.js v18.18.2.
Type ".help" for more information.
> let r = new Uint8Array(32); crypto.getRandomValues(r)
Uint8Array(32) [
  235, 162, 160,  49,  17, 226,  23, 241,
  165,  58, 223, 196, 122, 246,  14,  17,
  196,  84,  47, 239,  92,  72, 135,  31,
    1,  91, 124, 162,  20,  99,  40,   3
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants