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

Function mapH5Sign

wxapp/txdt.js:153–179  ·  view source on GitHub ↗
(apiPath, user)

Source from the content-addressed store, hash-verified

151}
152
153function mapH5Sign(apiPath, user) {
154 const reqId = uuid();
155 const reqTime = Date.now();
156 const normalizedPath = apiPath.split("?")[0];
157 const signBase = `mapinst=0&mapnonce=0&reqid=${reqId}&reqtime=${reqTime}`;
158 const defaultSign = md5(`${signBase}${normalizedPath}0${TMAP_SECRET}`);
159 const headers = {
160 "tmap-reqid": reqId,
161 "tmap-reqtime": reqTime,
162 "tmap-userid": Number(user.user_id) || Number(user.userId) || 0,
163 "tmap-login-ssid": user.session_id || user.sessionId || 0,
164 "tmap-imei": 0,
165 "tmap-qimei": 0,
166 "tmap-qimei36": 0,
167 "tmap-nonce": 0,
168 "tmap-install-id": 0,
169 "tmap-sign": 0,
170 "tmap-default-sign": defaultSign,
171 "tmap-app-version": 0,
172 "tmap-channel": 0,
173 "tmap-engine": "web",
174 "tmap-mini-login-ssid": user.map_session_id || user.mapSessionId || "",
175 "tmap-app-id": user.appId || APP.appid,
176 };
177 if (user.openid || user.openId) headers["tmap-openid"] = user.openid || user.openId;
178 return headers;
179}
180
181function checkinHeader(user) {
182 const requestId = uuid();

Callers 1

mapApiMethod · 0.85

Calls 2

uuidFunction · 0.70
md5Function · 0.70

Tested by

no test coverage detected