Added simple TOTP Two Factor Authentication

This commit is contained in:
Ponkhy
2021-09-09 21:10:31 +02:00
parent 2583dbe0e0
commit 403202d4d4
11 changed files with 447 additions and 15 deletions

View File

@@ -271,3 +271,13 @@ exports.getTotalClientInRoom = (io, roomName) => {
return 0;
}
}
exports.genSecret = () => {
let secret = "";
let chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
let charsLength = chars.length;
for ( let i = 0; i < 64; i++ ) {
secret += chars.charAt(Math.floor(Math.random() * charsLength));
}
return secret;
}