1
2
3
4
5
6
7
8
9
10
11
12
13
| import cryptoJs from 'crypto-js';
|
| const ApiSignPrivateKey = 'X07uIM2cHK5IJhDi4ppoxQglYE21gq3E';
|
| export function getTimestampInSeconds() {
| var date = new Date();
| var timestampInSeconds = Math.floor(date.getTime() / 1000);
| return timestampInSeconds;
| }
|
| export function generateApiSign(token: string, userId: string, timestampInSeconds: number) {
| return cryptoJs.MD5(`${token}-${userId}-${timestampInSeconds}-${ApiSignPrivateKey}`).toString();
| }
|
|