Hi,
You may use hmac as follow (hmacStr is deprecated):
var appsecret = "SECRET"
var text = "hello"
var mbKey = new MemoryBuffer();
mbKey.fromString(appsecret, "utf-8");
var mbSignature = new MemoryBuffer();
mbSignature.fromString(text, "utf-8");
var sig = mbSignature.hmac(mbKey, 'SHA1');
logInfo('text:', text);
logInfo('sig:', sig);
However, it's not the digest in hexadecimal format as in nodeJS:
To do get the hex hmac, you have to use an external library, like jshashes:
loadLibrary('vendor:jshashes_1.0.8');
var appsecret = "SECRET";
var text = "hello";
var SHA1 = new Hashes.SHA1;
logInfo('SHA1: ' + SHA1.hex_hmac(appsecret, text));
Follow this link to import a js library in adobe campaign.
Best
Florian