Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function begin(path, params, nonce){
- var signature = getMessageSignature(path, params, nonce);
- var headers = {
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'Apiauth-Key': config.key,
- 'Apiauth-Nonce': nonce,
- 'Apiauth-Signature': signature
- };
- return rawRequest(rUrl, headers, params, method, callback);
- function getMessageSignature(path, params, nonce) {
- var data_params = params;
- var postParameters = querystring.stringify(data_params);
- var check = {}
- var path = '/api' + path + '/';
- var message = nonce + config.key + path + postParameters;
- var auth_hash = crypto.createHmac("sha256", config.secret).update(message).digest('hex').toUpperCase();
- return auth_hash;
- }
- var options = {
- url: url + '/',
- headers: headers,
- form: params
- };
- request.post(options, function(err, res, body){
- ...
- ...
- })
- var form = req.form();
- form.append('file', image, {
- filename: 'myfile.png',
- enctype: 'multipart/form-data'
- });
- var image = new Buffer(binar_image, 'base64');
Add Comment
Please, Sign In to add comment