javascript - Printing out hashed values? -


i trying print out int applied sha256 hash to, getting [object object] in server logs.

any ideas how print / view object?

meteor.methods({ twiliotest:function () {  console.log("twilio test called!");      // time 2fa code     var d = new date();     var seconds = d.gettime() / 1000;     seconds = parseint(seconds);      // large random int     var largeint = math.floor(math.random() * (999999999 - 99999999999999999) + 99999999999999999);      console.log("seconds value: " + seconds);     console.log("largeint value: " + largeint);      // combine values     var combined = seconds + largeint;      console.log("combined value: " + combined);      // hash value     combined = meteor.call('generatehash',combined);     console.log("combined value hashed: " + combined);  },  generatehash: function(val){     check(val, match.any);     var hash = 0;      var crypto = npm.require('crypto');     var key = 'abc123';      hash = crypto.createhmac('sha256', key);      return hash; } }); 

meteor.call() not return value in way you're expecting; need check callback. use this:

meteor.call('generatehash', function(error, hash) {     if (error) {         console.log(error);     } else {         console.log(hash);     } }); 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -