From ea44f36f8cf761a8c7988d4b0e5ef2de71845efa Mon Sep 17 00:00:00 2001 From: Smith Date: Fri, 17 Jun 2022 04:11:48 +0200 Subject: [PATCH] Revert "simplify salt gen fn" This reverts commit 86c1c902937d70e999a3702713b3801cfd0bf87a. Reason: the change limits the salt charset to a single iteration thus defeating the point of creating a long string. --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 7ab2ef1..5cf4bd0 100644 --- a/index.html +++ b/index.html @@ -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));