browserify / crypto-browserify

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

Error when try to use Diffie-Hellman properties #194

Open Raktim123 opened 4 years ago

Raktim123 commented 4 years ago

I want to use this library in my project to archive NodeJS crypto on browser.

I already downloaded the above package. In the given example it shows createHash. I want to use .createDiffieHellman etc. But, it rises error. Here is my code.

<!doctype html>
<html>
<script src='bundle.js'></script>
<body>
<h1>Welcome</h1>
</body>
<script>
      console.log(require('crypto').createDiffieHellman(139));
</script>
</html>

and I facing error says, Uncaught TypeError: require(...).createDiffieHellman is not a function in the browser console.

Even I tried to change the code on my computer _project/nodemodules/crypto-browserify/example/index.html and also tried to copy the repository from github, but result is same.

I can't understand what happen?

calvinmetcalf commented 4 years ago

how did you bundle it ?

Raktim123 commented 4 years ago

First off all I copied the bundle.js file on my project root folder and then just add <script src="bundle.js"></script> on my HTML file.

Raktim123 commented 4 years ago

I observe two things that there are maybe one spelling mistake in bundle.js (line 406) It's actually createDiffieHellman not createDeffieHellman and another is that only only createHash was exported from bundle.js if I call other it says message like 'it is not implemented yet'.

rawr51919 commented 3 years ago

200 should hopefully fix this issue by trimming down the error messages to only those unimplemented as per the readme.