browserify / crypto-browserify

partial implementation of node's `crypto` for the browser
MIT License
653 stars 199 forks source link

crypto.constants = undefined #193

Open futurelucas4502 opened 3 years ago

futurelucas4502 commented 3 years ago

When using crypto-browserify or just browserify to require crypto i want to use the following:

const encryptedData = crypto.publicEncrypt({
        key: `some public key`,
        padding: crypto.constants.RSA_PKCS1_OAEP_PADDING,
        oaepHash: "sha256",
    },
        Buffer.from(password) // We convert the data string to a buffer using `Buffer.from` so we can manipulate the data using publicEncrypt
    )

But crypto.constants = undefined so I'm not sure what to do?

This issue has also been mentioned on browserify here and was requested to be moved to this repo as well.

Erudition commented 2 years ago

https://github.com/crypto-browserify/crypto-browserify/blob/460a13b5bf1e4ea60dc995906ba0543f7933a32b/index.js#L81