I'm trying to print the contents of my digest variable but not having any luck. The below is the code I have. I've read a few tutorials and can't see why it wouldn't work.
// Store Credentials
var userName = "username";
var sharedSecret = "secret";
// Build Header
var date = new Date();
var nonce = md5(Math.random());
var nonce_ts = date.toISOString().replace(/(\.\d\d\dZ)/ ,'Z');
var digest = (new Buffer(sha1(nonce + nonce_ts + sharedSecret)).toString('base64'));
alert(digest);
It was taken from nodeJS and I am trying to make it javascript.
Bufferandmd5aren't standard JSalert,md5,Bufferare not part of the JavaScript language specification, but are part of an API provided directly by the environment or by a foreign library.