MCPcopy Index your code
hub / github.com/smallfawn/QLScriptPublic / getSign

Function getSign

wxapp/wb.js:68–86  ·  view source on GitHub ↗
(method, apiPath, params, timestamp)

Source from the content-addressed store, hash-verified

66}
67
68function getSign(method, apiPath, params, timestamp) {
69 let valueText = "";
70 const keys = Object.keys(params || {}).sort();
71 for (const key of keys) {
72 let value = params[key];
73 if (value === "" || value === null || value === undefined) continue;
74 if (typeof value !== "string") {
75 if (Object.prototype.toString.call(value) === "[object Object]") {
76 Object.keys(value).forEach((itemKey) => {
77 if (value[itemKey] === null) delete value[itemKey];
78 });
79 }
80 value = JSON.stringify(value);
81 }
82 valueText += value;
83 }
84 const paramSign = base64(valueText);
85 return md5(base64(`${method.toUpperCase()}${apiPath}${paramSign}${timestamp}`));
86}
87
88function formatMonth() {
89 const date = new Date();

Callers 2

getHeadersMethod · 0.85
encryptMethod · 0.85

Calls 4

base64Function · 0.85
callMethod · 0.80
forEachMethod · 0.80
md5Function · 0.70

Tested by

no test coverage detected