encrypt information

hello community!!!

I want to implement encryption in my URL before sending the FETCH;

I’m trying to add libraries(AesUtil.js) to Fuse unsuccessfully,

  <JavaScript File="js/AesUtil.js" ux:Global="AesUtil" />

var Observable = require('FuseJS/Observable');
var AesUtil = require('AesUtil');

but it does not recognize me methods

It shows me the following errer

ReferenceError: CryptoJS is not defined in Fuse.Reactive.JavaScript

It could support me, I 'm adding bad the library?

Do you have a testcase you can send over? You need to remember to do module.exports = somecryptObj in youy AesUtil.js file maybe?

It’s either you haven’t load the required dependency (CryptoJS) properly, or your library (AesUtil.js) or the CryptoJS depend on Web Crypto API which is not supported by fusetools.

Alternatively you can use another cryptography library such as libsodium.js, but you still need to implement the random bytes function which is depend on Web Crypto API originally.

thanks for your answers.

Hello Sahal Zain. thank for your suggestion; I am taking up the theme, take borrow your code jejeje

 result.value = 'test'
 window.crypto = {};
 window.crypto.getRandomValues = require('cryptopoly');

    var wrappers = require('libsodium-wrappers');
    var publicKey = 'ROTdAnYLeTFkxMSnEuV1aVw88rnoqxadWixz1xHqtRg=';
    var secretKey = 'ROTdAnYLeTFkxMSnEuV1aVw88rnoqxadWixz1xHqtRg=';
    var outputFormat = 'base64';

 function encrypt(){
    var cipher = wrappers.crypto_box_seal(result.value,wrappers.from_base64(publicKey),outputFormat);
    result.value = cipher;

 function descrypt(){

    var respuesta = wrappers.crypto_box_seal_open(result.value,wrappers.from_base64(publicKey),wrappers.from_base64(secretKey),outputFormat);
    resulDese.value = respuesta;
  console.log("resulDese.value== "+resulDese.value);

I could not decrypt the message; I throw error

ERROR: Name: ScriptError Error message: Uncaught Error File name: libsodium-wrappers.js Line number: 299 Source line: throw new Error(err); JS stack trace: Error at _free_and_throw_error (libsodium-wrappers.js:299:23) at Object.crypto_box_seal_open (libsodium-wrappers.js:1627:3) at descrypt (MainView.ux:23:34)

you could help me.

I was trying to encrypt some data as well using JSEncrypt but no luck yet. Does anyone got something that works?