A script might require credentials used for logging into an account be encrypted. WPM API offers this functionality with the Utils library. This example below creates an nonce (one time value), a time stamp, and a user’s password, the result is a base64 string.
1. Copy and paste the following code snippet in the script
2. Both the nonce and password variables will require a value and should not be left blank
var c = openHttpClient();
var nonce = ""; // Assign a value to the nonce varaible
var timestamp = new Date(); // Declare a time object
timestamp = timestamp.getTime(); // Assigned the current time to variable timestamp
var password = ""; // Supply a value for this password value
var tx = beginTransaction();
var step = beginStep("Homepage");
var password_hash = base64(sha1_hash(nonce + timestamp + password); // perform the base64 encoding to create a SHA1 encryption
endStep();
endTransaction();
3. Select the Validate button to save current script