Better structure and docs

This commit is contained in:
2026-08-17 08:28:03 +02:00
parent 2a8e3f41d7
commit 210f6668cd
5 changed files with 79 additions and 21 deletions
+28
View File
@@ -0,0 +1,28 @@
import EnclaveWebSocket from "./ws";
/**
* Manages a single connection to an Enclave server: channels, server
* metadata, and messages for that server.
*
* Wraps one `EnclaveWebSocket` instance and layers server-level concepts
* on top of the raw protocol (channels, messages, server meta) — it does
* not know about the handshake/key exchange itself, only the connection
* it's given.
*
* One `EnclaveServer` instance exists per connected server. It has no
* knowledge of other servers, DMs, or app-level UI state — that lives in
* `Enclave`, which owns and manages multiple `EnclaveServer` instances.
*/
export default class EnclaveServer {
public websocket: EnclaveWebSocket;
public constructor(
hostname: string,
clientSecretKey: Uint8Array,
clientPublicKey: Uint8Array,
) {
this.websocket = new EnclaveWebSocket(hostname);
this.websocket.clientSecretKey = clientSecretKey;
this.websocket.clientPublicKey = clientPublicKey;
this.websocket.init();
}
}