Browse Source

chore(rtc,e2ee): clear comments

rcmerci 3 weeks ago
parent
commit
b3a737ca18
2 changed files with 0 additions and 49 deletions
  1. 0 38
      src/main/frontend/common/crypt.cljs
  2. 0 11
      src/main/frontend/worker/rtc/crypt.cljs

+ 0 - 38
src/main/frontend/common/crypt.cljs

@@ -344,41 +344,3 @@
     (fn [e]
       (log/error "decrypt-text-by-text-password" e)
       (ex-info "decrypt-text-by-text-password" {} e)))))
-
-(comment
-  (let [array-buffers-equal?
-        (fn [^js/ArrayBuffer buf1 ^js/ArrayBuffer buf2]
-          (if (not= (.-byteLength buf1) (.-byteLength buf2))
-            false
-            (let [arr1 (js/Uint8Array. buf1)
-                  arr2 (js/Uint8Array. buf2)]
-              (= (vec arr1) (vec arr2)))))]
-    (p/let [rsa-key-pair (<generate-rsa-key-pair)
-            aes-key (<generate-aes-key)
-            public-key (:publicKey rsa-key-pair)
-            private-key (:privateKey rsa-key-pair)
-            encrypted-aes-key (<encrypt-aes-key public-key aes-key)
-            decrypted-aes-key (<decrypt-aes-key private-key encrypted-aes-key)
-            password "my-secret-password"
-            encrypted-private-key (<encrypt-private-key password private-key)
-            decrypted-private-key (<decrypt-private-key password encrypted-private-key)
-            ;; Export keys to compare their raw values
-            exported-original-aes (.exportKey subtle "raw" aes-key)
-            exported-decrypted-aes (.exportKey subtle "raw" decrypted-aes-key)
-            exported-original-private (.exportKey subtle "pkcs8" private-key)
-            exported-decrypted-private (.exportKey subtle "pkcs8" decrypted-private-key)
-            ;; Test text encryption
-            original-text "This is a secret message."
-            encrypted-text-data (<encrypt-text aes-key original-text)
-            decrypted-text (<decrypt-text aes-key encrypted-text-data)]
-      (js/console.log "Original AES key:" aes-key)
-      (js/console.log "Decrypted AES key:" decrypted-aes-key)
-      (js/console.log "Original private key:" private-key)
-      (js/console.log "Decrypted private key:" decrypted-private-key)
-      (let [aes-match? (array-buffers-equal? exported-original-aes exported-decrypted-aes)
-            private-key-match? (array-buffers-equal? exported-original-private exported-decrypted-private)]
-        (js/console.log "AES keys match:" aes-match?)
-        (js/console.log "Private keys match:" private-key-match?))
-      (js/console.log "Original text:" original-text)
-      (js/console.log "Decrypted text:" decrypted-text)
-      (js/console.log "Texts match:" (= original-text decrypted-text)))))

+ 0 - 11
src/main/frontend/worker/rtc/crypt.cljs

@@ -42,22 +42,11 @@
   (assert (and k @store))
   (idb-keyval/set k value @store))
 
-(comment
-  (defn- <remove-item!
-    [k]
-    (idb-keyval/del k @store)))
-
 (defn- graph-encrypted-aes-key-idb-key
   [repo]
   (assert (some? repo))
   (str "rtc-encrypted-aes-key###" repo))
 
-(comment
-  (defn- user-rsa-key-pair-idb-key
-    [user-uuid]
-    (assert (some? user-uuid))
-    (str "user-rsa-key-pair###" user-uuid)))
-
 (defn- <import-public-key-transit-str
   "Return js/CryptoKey"
   [public-key-transit-str]