aboutsummaryrefslogtreecommitdiff
path: root/client-web/source/protocol/mod.ts
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2022-09-09 11:42:06 +0200
committermetamuffin <metamuffin@disroot.org>2022-09-09 11:42:06 +0200
commitb6d93e0f322901dfc1fee23f3d396a68e61e1b29 (patch)
tree01ba855cf41fb53f84cd6eb504c4f4ba0134fdfa /client-web/source/protocol/mod.ts
parentafed94bb4609bd796102c9184f13fa29c5f92a48 (diff)
downloadkeks-meet-b6d93e0f322901dfc1fee23f3d396a68e61e1b29.tar
keks-meet-b6d93e0f322901dfc1fee23f3d396a68e61e1b29.tar.bz2
keks-meet-b6d93e0f322901dfc1fee23f3d396a68e61e1b29.tar.zst
crypto stuff
Diffstat (limited to 'client-web/source/protocol/mod.ts')
-rw-r--r--client-web/source/protocol/mod.ts15
1 files changed, 13 insertions, 2 deletions
diff --git a/client-web/source/protocol/mod.ts b/client-web/source/protocol/mod.ts
index 76b1290..f86e96f 100644
--- a/client-web/source/protocol/mod.ts
+++ b/client-web/source/protocol/mod.ts
@@ -1,6 +1,17 @@
+import { crypto_seeded_key } from "./crypto.ts"
export class SignalingConnection {
- constructor(room: string) {
-
+ room!: string
+ websocket!: WebSocket
+ signaling_id!: string
+ key!: CryptoKey
+
+ constructor() { }
+ async connect(room: string): Promise<SignalingConnection> {
+ this.key = await crypto_seeded_key(room)
+ 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)
+ await new Promise(r => this.websocket!.onopen = r)
+ return this
}
}