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:
Smith
2022-06-17 04:11:48 +02:00
parent bfe02043c1
commit ea44f36f8c

View File

@@ -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));