summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-09-06 23:29:57 +0200
committermetamuffin <metamuffin@disroot.org>2023-09-06 23:29:57 +0200
commitbf434555952b3788185a1a875955fa1acbf170b3 (patch)
tree40b7cbc33ffecc764fe514452972bc9871f9854c
parent604f2a2f61a631e2cd778707be6aa34b57048e42 (diff)
downloadkeks-meet-bf434555952b3788185a1a875955fa1acbf170b3.tar
keks-meet-bf434555952b3788185a1a875955fa1acbf170b3.tar.bz2
keks-meet-bf434555952b3788185a1a875955fa1acbf170b3.tar.zst
improve hash strength
-rw-r--r--client-web/source/index.ts2
-rw-r--r--client-web/source/protocol/crypto.ts11
2 files changed, 3 insertions, 10 deletions
diff --git a/client-web/source/index.ts b/client-web/source/index.ts
index a01f7a7..8ae7e8f 100644
--- a/client-web/source/index.ts
+++ b/client-web/source/index.ts
@@ -14,7 +14,7 @@ import { SignalingConnection } from "./protocol/mod.ts";
import { Room } from "./room.ts"
import { control_bar, info_br } from "./menu.ts";
-export const VERSION = "0.1.13"
+export const VERSION = "0.1.14"
export interface ClientConfig {
appearance?: {
diff --git a/client-web/source/protocol/crypto.ts b/client-web/source/protocol/crypto.ts
index 4a6efab..c5de90f 100644
--- a/client-web/source/protocol/crypto.ts
+++ b/client-web/source/protocol/crypto.ts
@@ -18,17 +18,10 @@ export async function crypto_seeded_key(seed: string): Promise<CryptoKey> {
false,
["deriveKey"]
)
- //? TODO is it possible to use a unique seed per session here?
- // const salt = window.crypto.getRandomValues(new Uint8Array(16));
const salt = base64_to_buf("thisisagoodsaltAAAAAAA==") // valid "unique" 16-byte base-64 string
log("crypto", "deriving key…")
const key = await window.crypto.subtle.deriveKey(
- {
- name: "PBKDF2",
- salt,
- iterations: 250000,
- hash: "SHA-256",
- },
+ { name: "PBKDF2", salt, iterations: 250000, hash: "SHA-256" },
seed_key,
{ name: "AES-GCM", length: 256 },
false,
@@ -40,7 +33,7 @@ export async function crypto_seeded_key(seed: string): Promise<CryptoKey> {
export async function crypt_hash(input: string): Promise<string> {
const buf = new TextEncoder().encode("also-a-very-good-salt" + input)
- const h = await window.crypto.subtle.digest({ name: "SHA-256" }, buf)
+ const h = await window.crypto.subtle.digest({ name: "SHA-512" }, buf)
const hex = buf_to_hex(new Uint8Array(h))
return hex
}