hi all, does anyone have any working code with usi...
# suitescript
m
hi all, does anyone have any working code with using the module N/crypto? Trying to encrypt (AES) a string but all it seems to do is generate UNEXPECTED_ERRORS, code below
Copy code
require(['N/crypto', 'N/encode'], function(crypto, encode) {

  var skey = crypto.createSecretKey({
            encoding: encode.Encoding.HEX,
            guid: '6C2C14A9BF7A4C74988100E87BD65F03'
        });

  var cipher = crypto.createCipher({algorithm: crypto.EncryptionAlg.AES, key: skey, padding: crypto.Padding.NoPadding});

  cipher.update({input: 'password', inputEncoding: encode.Encoding.BASE_64 });
var cipherPayload = cipher.final({
    outputEncoding: encode.Encoding.BASE_64
  });

})