-
Notifications
You must be signed in to change notification settings - Fork 283
/
utils.js
25 lines (24 loc) · 786 Bytes
/
utils.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class Utils {
static getRandomInt(a, b) {
const min = Math.min(a, b);
const max = Math.max(a, b);
const diff = max - min + 1;
return min + Math.floor(Math.random() * Math.floor(diff));
}
static generateVerifyFp() {
return 'verify_5b161567bda98b6a50c0414d99909d4b'; // !!! NOT SURE IF EXPIRE
var e = Date.now();
var t = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(
""
),
e = t.length,
n = Date.now().toString(36),
r = [];
(r[8] = r[13] = r[18] = r[23] = "_"), (r[14] = "4");
for (var o = 0, i = void 0; o < 36; o++)
r[o] ||
((i = 0 | (Math.random() * e)), (r[o] = t[19 == o ? (3 & i) | 8 : i]));
return "verify_" + n + "_" + r.join("");
}
}
module.exports = Utils;