12 lines
354 B
TypeScript
12 lines
354 B
TypeScript
import { createHash } from "node:crypto";
|
||
|
||
/** 官方签名:base64(sha256(AppId + Timestamp + Path + AppSecret)) */
|
||
export function generateOpenSignature(
|
||
appId: string,
|
||
timestamp: number,
|
||
path: string,
|
||
appSecret: string,
|
||
): string {
|
||
return createHash("sha256").update(`${appId}${timestamp}${path}${appSecret}`).digest("base64");
|
||
}
|