login by password or totp

This commit is contained in:
Julian Krauser 2025-05-05 14:21:22 +02:00
parent 9cf2cf2d80
commit 63d97d0b83
2 changed files with 95 additions and 9 deletions

7
src/helpers/crypto.ts Normal file
View file

@ -0,0 +1,7 @@
export async function hashString(message = ""): Promise<string> {
const msgUint8 = new TextEncoder().encode(message);
const hashBuffer = await window.crypto.subtle.digest("SHA-256", msgUint8);
const hashArray = Array.from(new Uint8Array(hashBuffer));
const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
return hashHex;
}