0

We want to encrypt the input file on client side using javascript in our aura component.

We are trying to use CryptoJS(https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js).

We have added this JS library as static resource and added in lightning component.

This library is working fine in Visualforce page. But in aura lightning component, we are getting error says "CryptoJS is not defined" when we call below method.

CryptoJS.AES.encrypt('123', '1234567887654321');

Same method is working fine in the VF page. Any idea why?

1 Answer 1

0

Use the file 'https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js' instead of only aes.js file. May be aes.js internally dowloads all dependencies when you are using inside VF Page and that's how it is working inside VF Page.

enter image description here

1
  • 1
    This worked. Thanks so much. Feb 21, 2022 at 11:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .