| 47 | } |
| 48 | |
| 49 | function makeSign(params) { |
| 50 | const text = Object.keys(params) |
| 51 | .sort() |
| 52 | .filter((key) => params[key] !== null && params[key] !== undefined && params[key] !== "") |
| 53 | .map((key) => `${key}=${params[key]}`) |
| 54 | .join("&"); |
| 55 | |
| 56 | const cipher = crypto.createCipheriv("aes-128-ecb", SIGN_KEY, null); |
| 57 | cipher.setAutoPadding(true); |
| 58 | return Buffer.concat([ |
| 59 | cipher.update(Buffer.from(`"${text}"`, "utf8")), |
| 60 | cipher.final(), |
| 61 | ]).toString("base64").replace(/=/g, ""); |
| 62 | } |
| 63 | |
| 64 | function mask(value = "") { |
| 65 | value = String(value); |