login by password or totp
This commit is contained in:
parent
9cf2cf2d80
commit
63d97d0b83
2 changed files with 95 additions and 9 deletions
7
src/helpers/crypto.ts
Normal file
7
src/helpers/crypto.ts
Normal 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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue