"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var mslib_1 = require("mslib");
var CryptoJS = require('crypto-js');
/**
 *
 * @date 2021-07-14 16:09:43
 * @author 陈招林
 */
var StcAccessTokenUtil = /** @class */ (function () {
    function StcAccessTokenUtil() {
    }
    StcAccessTokenUtil.prototype.getTtpUserInfo = function (accessToken) {
        var key = CryptoJS.enc.Utf8.parse('stc_pp3_12345678');
        var iv = CryptoJS.enc.Hex.parse('00000000');
        var options = {
            iv: iv,
            mode: CryptoJS.mode.CBC,
            padding: CryptoJS.pad.Pkcs7
        };
        accessToken = accessToken.replace(/=/g, "").replace(/\-/g, "+").replace(/_/g, "/"); // 转换为字符串
        console.log("999999:" + accessToken);
        var plainText = CryptoJS.AES.decrypt(accessToken, key, options).toString(CryptoJS.enc.Utf8);
        mslib_1.logger.info("AES解密出来的明文----%s", plainText);
        var accessTokenArray = plainText.split(":");
        mslib_1.logger.info("请求参数----%s", accessTokenArray);
        return { "appid": accessTokenArray[5], 'openid': accessTokenArray[4] };
    };
    return StcAccessTokenUtil;
}());
exports.StcAccessTokenUtil = StcAccessTokenUtil;
//# sourceMappingURL=StcAccessTokenUtil.js.map