SH256 hash

hi,i need to recreate this postmat rule in javascript rule

  • if (pm.globals.get("API_TOKEN_MODE")=="ENCRYPTED") {
        var token = pm.globals.get("API_TOKEN");
        var timestamp = pm.variables.replaceIn('{{$timestamp}}')+"000";
        var hash = CryptoJS.SHA256(token+timestamp).toString();
        pm.globals.set("API_KEY", hash+timestamp);
        console.log("Set variable API_KEY: " + pm.globals.get("API_KEY") + " (original token: " + token + " timestamp: " + timestamp + " sha256: " + hash + ")");
    };
    
any one know how can i use this CryptoJS.SHA256 function ? Tried to ho with:

var API_TOKEN = “abcdef”
var TIMESTAMP = new Date().getTime();
var hash = CryptoJS.SHA256(API_TOKEN+TIMESTAMP).toString()
var API_KEY = hash+TIMESTAMP

[e.automation.internal.RuleEngineImpl] - Failed to execute action: 1(Error: Failed to execute rule Tede: ReferenceError: "CryptoJS" is not defined: ReferenceError: "CryptoJS" is not defined

ok got it
var CryptoJS = require('crypto-js');

and
pi@raspberrypi:/etc/openhab/automation/js $ npm install crypto-js