[WIP] Implement OTP versioning in DM and RoomChat #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.
Original prompt
RoomChat'teki OTP versiyonu sistemini DM'e de implemente et. OTP v0 ve v1'i. Default olarak otp_v1 kullan DM'de. Ayrıca Room Chat'te X karakterden büyük anahtarlardaki mesajı şeyini DM'e de implemente et.
RoomChat'e bu OTP versiyon sistemini eklediğimiz commit'in patch dosyası: Buradaki işleyişi analiz et, tasklar oluştur, sonrasında o taskları uygula. Kısaca, versiyonlama eklenecek logic layer'a. Frontend'e gelişmiş ayarlar eklenecek ve otp sürümü seçme eklenecek.
From 2f8da816fffa734075d6e9eaaa3cde4f512ecfbf Mon Sep 17 00:00:00 2001
From: EdgeTypE minefpsgelistirici@gmail.com
Date: Sat, 3 Jan 2026 10:50:32 +0300
Subject: [PATCH] Add OTP algorithm versioning and advanced settings
Introduces a modular OTP algorithm system with support for multiple versions (v0, v1), including a registry and type definitions. Adds advanced settings to room creation and join screens for selecting OTP encryption version. Updates RoomHistoryService, RoomListScreen, RoomChatScreen, enhancedWebSocketService, and roomOtpStore to track and use the selected OTP version per room, ensuring correct key transformation and encryption. Also adds UI for displaying and changing encryption type, and improves room management actions.
src/algorithms/index.ts | 90 +++++++++++++
src/algorithms/otp_v0/index.ts | 65 +++++++++
src/algorithms/otp_v1/index.ts | 157 ++++++++++++++++++++++
src/algorithms/types.ts | 40 ++++++
src/screens/rooms/CreateRoomScreen.tsx | 105 +++++++++++++++
src/screens/rooms/JoinRoomScreen.tsx | 105 +++++++++++++++
src/screens/rooms/RoomChatScreen.tsx | 20 ++-
src/screens/rooms/RoomListScreen.tsx | 162 +++++++++++++++++++++++
src/services/RoomHistoryService.ts | 2 +
src/services/enhancedWebSocketService.ts | 11 +-
src/stores/roomOtpStore.ts | 13 +-
11 files changed, 763 insertions(+), 7 deletions(-)
create mode 100644 src/algorithms/index.ts
create mode 100644 src/algorithms/otp_v0/index.ts
create mode 100644 src/algorithms/otp_v1/index.ts
create mode 100644 src/algorithms/types.ts
diff --git a/src/algorithms/index.ts b/src/algorithms/index.ts
new file mode 100644
index 0000000..6b5361a
--- /dev/null
+++ b/src/algorithms/index.ts
@@ -0,0 +1,90 @@
+// OTP Algorithm Registry
+// Central registry for all OTP algorithm versions
+
+import { OTPAlgorithm, OTPVersion, DEFAULT_OTP_VERSION, LATEST_OTP_VERSION, OTP_VERSION_LABELS, OTP_VERSION_DESCRIPTIONS } from './types';
+import otpV0Algorithm from './otp_v0';
+import otpV1Algorithm from './otp_v1';
+
+// Algorithm registry
+const algorithms: Map<OTPVersion, OTPAlgorithm> = new Map([
+]);
+/**
+export function getAlgorithm(version: OTPVersion): OTPAlgorithm {
+}
+/**
+export function getAvailableVersions(): OTPVersion[] {
+}
+/**
+export function isValidVersion(version: string): version is OTPVersion {
+}
+/**
+export function encryptWithVersion(
+): string {
+}
+/**
+export function decryptWithVersion(
+): string {
+}
+/**
+export function transformKeyWithVersion(
+): string {
+}
+// Re-export types and constants
+export {
+};
+// Export individual algorithms
+export { otpV0Algorithm, otpV1Algorithm };
diff --git a/src/algorithms/otp_v0/index.ts b/src/algorithms/otp_v0/index.ts
new file mode 100644
index 0000000..97f3588
--- /dev/null
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.