diff --git a/index.html b/index.html
index 39b1d15..69e80a5 100644
--- a/index.html
+++ b/index.html
@@ -104,7 +104,7 @@
-
diff --git a/static/chat.js b/static/chat.js
index f321cc1..ca81338 100644
--- a/static/chat.js
+++ b/static/chat.js
@@ -349,16 +349,20 @@ messageForm.addEventListener("submit", async (e) => {
const isVioletRoom = state.currentRoom.toLowerCase().endsWith(":violet");
if (isVioletRoom) {
- // AI Transit Encryption PM Flow
- const transitKeyB64 = await SexyChato.exportKeyBase64(state.cryptoKey);
- const encrypted = await SexyChato.encrypt(state.cryptoKey, text);
-
- socket.emit("pm_message", {
- room: state.currentRoom,
- ciphertext: encrypted.ciphertext,
- nonce: encrypted.nonce,
- transit_key: transitKeyB64
- });
+ if (!state.isRegistered || !state.cryptoKey) {
+ addMessage(state.currentRoom, { system: true, text: "You must be logged in to chat with Violet." });
+ } else {
+ // AI Transit Encryption PM Flow
+ const transitKeyB64 = await SexyChato.exportKeyBase64(state.cryptoKey);
+ const encrypted = await SexyChato.encrypt(state.cryptoKey, text);
+
+ socket.emit("pm_message", {
+ room: state.currentRoom,
+ ciphertext: encrypted.ciphertext,
+ nonce: encrypted.nonce,
+ transit_key: transitKeyB64
+ });
+ }
} else if (state.isRegistered && state.cryptoKey) {
// E2E PM Flow
const encrypted = await SexyChato.encrypt(state.cryptoKey, text);