brix / crypto-js

JavaScript library of crypto standards.
Other
15.71k stars 2.38k forks source link

How to use Crypto JS in chrome extension. #436

Open mai1x9 opened 1 year ago

mai1x9 commented 1 year ago

Hi, I am developing a chrome extension with crypto capabilities like aes256, sha256, and some assymetric encryption techniques. Is it possible to use crypto-js in chrome extension. If so can anyone please guide how to import the functions like SHA256 or AES?

vishva-mahadevan commented 1 year ago

Hi @mai1x9, you can make a use of browserify or webpack to bundle up all the node_modules.

mai1x9 commented 1 year ago

@Vishwamagdavan I have tried it, but how could I import from chrome extension. I tried,

import SHA256 from 'crypto-js'

and it throws some unknown error. (Surely jts not import error). There is no much information about unknown error.

I have downloaded the cryptojs.min.js from cdn which is already build with browserify or webpack.

We cannot use script tags in background.js in chrome extension.

Can you please help out how to import in chrome extension. for reference, https://stackoverflow.com/questions/32174323/can-i-include-cryptojs-files-in-my-chrome-extension

Do I need to build crypto js instead of using from cdn?

entronad commented 1 year ago

Maybe you could try CryptoES, it is originally written in ES6 module, and with same code with CryptoJS inside.