Skip to content

scrypt from node:crypto throws #1851

@HendrixString

Description

@HendrixString

Describe the bug

First of all, great platform.

and now for the bug.

executing the following snippet in stackblitz:

 import { scrypt, randomBytes } from 'node:crypto';

const salt = randomBytes(16).toString("hex");

scrypt(
  "password", salt, 64, {},
  (err, output) => {}
);

will throw

TypeError: y.run is not a function
    at Module.scrypt (node:internal/crypto/scrypt:83:1405)
    at eval (file:///home/projects/xoriwxqjmr.github/c.js:90:14)
    at _0x2e27db (https://xoriwxqjmrgithub-xcjm.w-staticblitz.com/blitz.2e03455b.js:31:820532)
    at _0x5a7544.run (https://xoriwxqjmrgithub-xcjm.w-staticblitz.com/blitz.2e03455b.js:31:821260)
    at _0x456550 (https://xoriwxqjmrgithub-xcjm.w-staticblitz.com/blitz.2e03455b.js:31:836322)
    at _0x1833df._evaluate (https://xoriwxqjmrgithub-xcjm.w-staticblitz.com/blitz.2e03455b.js:31:836673)
    at _0x1833df.evaluate (https://xoriwxqjmrgithub-xcjm.w-staticblitz.com/blitz.2e03455b.js:31:833029)
    at ModuleJob.run (node:internal/modules/esm/module_job:158:3371)
    at async ModuleLoader.import (node:internal/modules/esm/loader:157:5061)

Node.js v20.19.1

I wish it would work, I wanted to run my js backend, which has authentication and therefore
requires some crypto

Link to the blitz that caused the error

https://stackblitz.com/edit/stackblitz-starters-vcu96erk?file=index.js

Steps to reproduce

run node index.js

Expected behavior

Crypto function scrypt should return a hashed string

Parity with Local

Screenshots

No response

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Version: [e.g. 91.1]

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions