| 167 | } |
| 168 | |
| 169 | getSign(method, apiPath, data = {}) { |
| 170 | const upperMethod = method.toUpperCase(); |
| 171 | const timestamp = Math.floor(Date.now() / 1000); |
| 172 | const query = upperMethod === "GET" ? this.queryString(data) : ""; |
| 173 | const body = upperMethod === "GET" ? "" : JSON.stringify(data || {}); |
| 174 | const raw = `${upperMethod}&/api/${apiPath}&${query}&${body}&appid=1002×tamp=${timestamp}`; |
| 175 | const signature = crypto.createHmac("sha256", SIGN_SECRET).update(raw).digest("base64"); |
| 176 | return `IQOO-HMAC-SHA256 appid=1002,timestamp=${timestamp},signature=${signature}`; |
| 177 | } |
| 178 | |
| 179 | headers(method, apiPath, data, extra = {}) { |
| 180 | return { |