31 lines
772 B
JavaScript
31 lines
772 B
JavaScript
import LibGenerateTestUserSig from './lib-generate-test-usersig-es.min.js';
|
|
|
|
let SDKAPPID = 1600132918;
|
|
|
|
let SECRETKEY = 'd93e9195b247e42e1cd707e450b678a90115c93877df91b1f2649778ca442c37';
|
|
|
|
/**
|
|
* Expiration time for the signature, it is recommended not to set it too short.
|
|
* Time unit: seconds
|
|
* Default time: 7 x 24 x 60 x 60 = 604800 = 7 days
|
|
*/
|
|
const EXPIRETIME = 7 * 24 * 60 * 60;
|
|
|
|
function genTestUserSig({ userID, SDKAppID, SecretKey }) {
|
|
if (SDKAppID) SDKAPPID = SDKAppID;
|
|
if (SecretKey) SECRETKEY = SecretKey;
|
|
const generator = new LibGenerateTestUserSig(SDKAPPID, SECRETKEY, EXPIRETIME);
|
|
const userSig = generator.genTestUserSig(userID);
|
|
|
|
return {
|
|
SDKAppID: SDKAPPID,
|
|
userSig,
|
|
};
|
|
}
|
|
|
|
export {
|
|
genTestUserSig,
|
|
SDKAPPID,
|
|
SECRETKEY,
|
|
};
|