mirror of
https://github.com/a-sync/game-server-watcher.git
synced 2026-07-28 16:32:37 -04:00
Revert "simplify salt gen fn"
This reverts commit 86c1c90293.
Reason: the change limits the salt charset to a single iteration thus defeating the point of creating a long string.
This commit is contained in:
@@ -769,7 +769,7 @@
|
||||
|
||||
async function generateBearerToken(secret) {
|
||||
const valid = String(Date.now() + 3600000 * 12); // Note: valid for 12 hours
|
||||
const salt = String(Math.random().toString(36).slice(2)).repeat(3);
|
||||
const salt = Array.from({ length: 3 }).map(() => Math.random().toString(36).slice(2)).join('');
|
||||
let hash;
|
||||
if (crypto.subtle) {
|
||||
const buff = await crypto.subtle.digest('SHA-512', new TextEncoder('utf-8').encode(salt + valid + secret));
|
||||
|
||||
Reference in New Issue
Block a user