aboutsummaryrefslogtreecommitdiff
path: root/client-web/source
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-09-07 00:01:27 +0200
committermetamuffin <metamuffin@disroot.org>2023-09-07 00:01:27 +0200
commit6f644481f397af070e2b91b69846e375caafdbda (patch)
tree330bdaec6d7e2712e9694faeb7a2e11cc022daf3 /client-web/source
parentbf434555952b3788185a1a875955fa1acbf170b3 (diff)
downloadkeks-meet-6f644481f397af070e2b91b69846e375caafdbda.tar
keks-meet-6f644481f397af070e2b91b69846e375caafdbda.tar.bz2
keks-meet-6f644481f397af070e2b91b69846e375caafdbda.tar.zst
prepare for room watches
Diffstat (limited to 'client-web/source')
-rw-r--r--client-web/source/protocol/crypto.ts2
-rw-r--r--client-web/source/protocol/mod.ts4
2 files changed, 3 insertions, 3 deletions
diff --git a/client-web/source/protocol/crypto.ts b/client-web/source/protocol/crypto.ts
index c5de90f..6bd5407 100644
--- a/client-web/source/protocol/crypto.ts
+++ b/client-web/source/protocol/crypto.ts
@@ -31,7 +31,7 @@ export async function crypto_seeded_key(seed: string): Promise<CryptoKey> {
return key
}
-export async function crypt_hash(input: string): Promise<string> {
+export async function crypto_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-512" }, buf)
const hex = buf_to_hex(new Uint8Array(h))
diff --git a/client-web/source/protocol/mod.ts b/client-web/source/protocol/mod.ts
index 71c2b93..a7e1f63 100644
--- a/client-web/source/protocol/mod.ts
+++ b/client-web/source/protocol/mod.ts
@@ -5,7 +5,7 @@
*/
import { ClientboundPacket, RelayMessage, RelayMessageWrapper, ServerboundPacket } from "../../../common/packets.d.ts"
import { log } from "../logger.ts"
-import { crypto_encrypt, crypto_seeded_key, crypt_decrypt, crypt_hash } from "./crypto.ts"
+import { crypto_encrypt, crypto_seeded_key, crypt_decrypt, crypto_hash } from "./crypto.ts"
export class SignalingConnection {
room!: string
@@ -20,7 +20,7 @@ export class SignalingConnection {
constructor() { }
async connect(room: string): Promise<SignalingConnection> {
this.key = await crypto_seeded_key(room)
- this.signaling_id = await crypt_hash(room)
+ this.signaling_id = await crypto_hash(room)
log("ws", "connecting…")
const ws_url = new URL(`${window.location.protocol.endsWith("s:") ? "wss" : "ws"}://${window.location.host}/signaling/${encodeURIComponent(this.signaling_id)}`)
this.websocket = new WebSocket(ws_url)