MCPcopy Create free account
hub / github.com/smallfawn/QLScriptPublic / makeSignature

Function makeSignature

wxapp/wps.js:150–160  ·  view source on GitHub ↗
(data, config = {})

Source from the content-addressed store, hash-verified

148}
149
150function 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
162function randomHex(bytes = 16) {
163 return crypto.randomBytes(bytes).toString("hex");

Callers 1

wpsRequestFunction · 0.85

Calls 3

canonicalJsonFunction · 0.85
hmacSha256HexFunction · 0.85
md5Function · 0.70

Tested by

no test coverage detected