or download this
var nonce = 1516453770998;
var API_KEY = 'PUBLIC KEY'
...
var signature = API_KEY + "POST" + encodeURIComponent( 'https://www.cr
+yptopia.co.nz/api/GetBalance' ).toLowerCase() + nonce + requestConten
+tBase64String;
var hmacsignature = crypto.createHmac('sha256', new Buffer( API_SECRET
+, "base64" ) ).update( signature ).digest().toString('base64');
var header_value = "amx " + API_KEY + ":" + hmacsignature + ":" + nonc
+e;