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

Crypt or crypt is not defined hybrid-crypto.min.js #15

Closed
DreamUFO opened this issue Dec 11, 2018 · 5 comments
Closed

Crypt or crypt is not defined hybrid-crypto.min.js #15

DreamUFO opened this issue Dec 11, 2018 · 5 comments

Comments

@DreamUFO
Copy link

I use hybrid-crypto.min.js in local file,open in brower for testing.
when use new Crypt() or new crypt() ,both exception is 'Uncaught TypeError: (C)crypt is not a constructor'.
must use in webpack?
can anyone help?

@radleylewis
Copy link

Hi, I am also experiencing this issue. Any progress?

@liebig
Copy link

liebig commented Jul 4, 2019

Same problem here. Any news?

@pwFoo
Copy link

pwFoo commented Aug 4, 2019

@juhoen
Seems the minified file isn't refreshed? CHanges in lib are newer then the generated hybrid-crypto.min.js file?
Is there an updated / working version available?

@iLyxa3D
Copy link

iLyxa3D commented Aug 17, 2019

Found solution for React (web)

  1. index.html file:
<head>
<script type="text/javascript" src="hybrid-crypto.min.js"></script>
...
</head>
  1. somefile.js in React project:
const webKeyPrivate  = require('./keys/clientPrivate.json').value;
const serverKeyPublic = require('./keys/serverPublic.json').value;

let entropy = "random string here";
let crypt = new window.crypt({entropy: entropy});  //not new Crypt or window.Crypt

export default class SomeClass {

  function name (messageBody) {
    let signature = crypt.signature(webKeyPrivate, messageBody);
    let encryptedBody = crypt.encrypt(serverKeyPublic, messageBody, signature);

   ...action with encryptedBody 
  };
  ...
}

Maybe someone can recommend how it is safer to store keys in React one-page website project?

@juhoen
Copy link
Owner

juhoen commented Aug 21, 2019

I updated library recently and based on my testing with React project, everything works just fine. Also importing:

const { Crypt, RSA } = require('hybrid-crypto-js');

@juhoen juhoen closed this as completed Aug 21, 2019
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

6 participants