"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SignUtil = void 0;
const CryptoJS = require("crypto-js");
/**
 * 统一接口签名工具
 */
class SignUtil {
    static sign(data, appSecret) {
        const signStr = Object.keys(data)
            .sort()
            .filter((s) => {
            if (data[s] === undefined ||
                data[s] === null ||
                data[s] === "" ||
                typeof data[s] === "object" ||
                ["appId", "key"].includes(s)) {
                return false;
            }
            return true;
        })
            .map((k) => `${k}=${data[k]}`)
            .join("&") +
            "&" +
            appSecret;
        return CryptoJS.MD5(signStr).toString(CryptoJS.enc.Hex).toUpperCase();
    }
}
exports.SignUtil = SignUtil;
