1 Star 0 Fork 20

来勇/weixin

forked from 张政/weixin 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
1.html 2.11 KB
一键复制 编辑 原始数据 按行查看 历史
张政 提交于 2023-08-21 10:28 . 'third_commit'
<script src="crypto.js"></script>
<script src="moment.js"></script>
<script>
var t = {default:CryptoJS}
var r = {default:moment}
// console.log(moment())
var xx = encryptionData({
method: "POST",
url: "/front-manager/api/customer/editBaseInfo/token",
body: "{\"channel\":\"h5\",\"nickname\":\"Sunlonglong1\"}",
ak: "00670fb03584fbf44dd6b136e534f495",
sk: "0d65f24dbe2bc1ede3c3ceeb96ef71bb"
})
console.log(xx)
function encryptionData() {
var e = arguments.length > 0
&& void 0 !== arguments[0] ? arguments[0] : {},
t = e.ak,
r = e.sk,
i = e.method,
o = e.url,
d = e.body,
s = n(),
c = a({
method: i,
url: o,
ak: t,
sk: r,
date: s
}),
l = u(d, r),
m = {
"X-HMAC-SIGNATURE": c,
"X-HMAC-ACCESS-KEY": t,
"X-HMAC-ALGORITHM": "hmac-sha256",
"X-HMAC-DIGEST": l,
"X-HMAC-Date": s
};
return m
};
console.log(moment())
function n() {
// var e = 0,
// t = wx.getStorageSync("serverBetweenTime");
// t && (e = new Number(t));
var n = (new Date).getTime() + 25000;
return (0, r.default)(n).utc().format("ddd, DD MMM YYYY HH:mm:ss [GMT]")
//return "Fri, 18 Aug 2023 06:24:46 GMT";
// return "Fri, 18 Aug 2023 07:25:45 GMT";
}
function a() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
r = e.method,
n = e.url,
a = e.ak,
u = e.sk,
i = e.date,
o = r + "\n" + n + "\n\n" + a + "\n" + i + "\n",
d = t.default.HmacSHA256(o, u);
return d = t.default.enc.Base64.stringify(d)
}
function u(e, r) {
var n = t.default.HmacSHA256(e, r);
console.log(t.default.enc.Base64.stringify(n));
return n = t.default.enc.Base64.stringify(n)
}
</script>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lai-yong-2023/weixin.git
[email protected]:lai-yong-2023/weixin.git
lai-yong-2023
weixin
weixin
master

搜索帮助