(data, config = {})
| 148 | } |
| 149 | |
| 150 | function makeSignature(data, config = {}) { |
| 151 | const key = config.key || ""; |
| 152 | const ss = config.ss || ""; |
| 153 | if (!key || !ss) return {}; |
| 154 | const date = new Date().toUTCString(); |
| 155 | const payload = `${key}${md5(canonicalJson(data))}${date}`; |
| 156 | return { |
| 157 | Date: date, |
| 158 | Signature: hmacSha256Hex(payload, ss), |
| 159 | }; |
| 160 | } |
| 161 | |
| 162 | function randomHex(bytes = 16) { |
| 163 | return crypto.randomBytes(bytes).toString("hex"); |
no test coverage detected