Is it possible to sort JSON in rust language? If it is possible then how?
Like this one:
const headers = {
'checkout-account': '1234',
'checkout-algorithm': 'sha256',
'checkout-method': 'POST',
'checkout-nonce': '564635208570151',
'checkout-timestamp': '2018-07-06T10:01:31.904Z',
};
const calculateHmac = (body=false, params) => {
const hmacPayload = Object.keys(params)
.sort()
.map((key) => [key, params[key]].join(':'))
.concat(body ? JSON.stringify(body) : '')
.join('\n');
};
calculateHmac(false, headers);