forked from fallenangel42/electron
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.js
More file actions
25 lines (22 loc) · 703 Bytes
/
Copy pathutils.js
File metadata and controls
25 lines (22 loc) · 703 Bytes
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
// generates the random token that only the driver of a session will
// possess and will be used to authenticate their requests
function generateToken() {
let text = '';
const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
for (let i = 0; i < 16; i++) {
text += possible.charAt(Math.floor(Math.random() * possible.length));
}
return text;
}
function generateAutomatedSessId() {
let text = 'AUTO';
const possible = '0123456789';
for (let i = 0; i < 6; i++) {
text += possible.charAt(Math.floor(Math.random() * possible.length));
}
return text;
}
module.exports = {
generateToken,
generateAutomatedSessId,
};