seanscal
seanscal

Reputation: 568

invalid directory Users/node_modules/crypto-browserify react native

I am trying to use a package I found on github (crypto-browserify) in my react native project, and used npm install --save crypto-browserify and then am importing it with var crypto = require('crypto-browserify');. I can't seem to get this to work, I keep getting the above error, although crypto-browserify is in my node modules folder of my project. Any help is much appreciated, I've been trying to solve this for hours!

Upvotes: 1

Views: 592

Answers (2)

Eyal Eizenberg
Eyal Eizenberg

Reputation: 4033

I had many issues trying to get crypto to work. Finally got it working using this package: crypto-js. Then in my file (this is how I encode to AES256):

var CryptoJS = require('crypto-js');
CryptoJS.AES.encrypt(rawStr, secret).toString()

Upvotes: 1

J. Mark Stevens
J. Mark Stevens

Reputation: 4945

From there example looks like you want var crypto = require('crypto').

Upvotes: 0

Related Questions