// Secret information is only existent on the device and Ruuvi Network
// but is not a part of the payload.
const secret = deviceId + deviceAddr;
// Signature body consists of the secret, random nonce, timestamp and message body
// These need to match the corresponding headers sent to Ruuvi network:
const nonce = 'RANDOMLY GENERATED STRING';
const timestamp = Date.now();
const signatureBody = secret + nonce + timestamp + messageBody;
// Signature can then be calculated using the 'crypto' library. The finalized
// signature will be passed in the header:
const crypto = require('crypto');
const signature = crypto.createHmac('sha256', secret)