Sign In

@ks-dbdev/template-db-automatic-plugin

Package Overview
Dependencies
Maintainers
3
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ks-dbdev/template-db-automatic-plugin - npm Package Compare versions

Comparing version
1.0.1
to
1.0.2
+1
-1
package.json
{
"name": "@ks-dbdev/template-db-automatic-plugin",
"version": "1.0.1",
"version": "1.0.2",
"type": "module",

@@ -5,0 +5,0 @@ "scripts": {

@@ -1,1 +0,1 @@

const apiBaseUrl = "https://ones-cache.wps.cn/oc/producer/data";
// 放置api相关函数/常量

@@ -1,17 +0,1 @@

const UTILS = {
createSign: (secret) => {
const timestamp = String(Math.round(Date.now()));
// 构造待签名字符串:"{timestamp}\n{secret}"
const stringToSign = `${timestamp}\n${secret}`;
// 创建 HMAC 对象,使用 SHA256 算法和密钥(注意密钥传入时为字符串即可)
const hmac = Crypto.createHmac('sha256', secret);
hmac.update(stringToSign);
const hmacCode = hmac.digest(); // 得到 Buffer
const sign = encodeURIComponent(hmacCode.toString('base64'));
return { sign, timestamp };
},
};
export default UTILS;