chore: remove rage-wasm since we moved to use the native binding (#7446)

This commit is contained in:
Tienson Qin
2022-11-24 15:36:11 +08:00
committed by GitHub
parent 66e7a80fd0
commit dfd8052990
9 changed files with 3 additions and 49 deletions

View File

@@ -137,7 +137,7 @@
;; TODO: ugly, replace with ls-files and filter with ".map"
_ (p/all (map (fn [file]
(. fs removeSync (path/join static-dir "js" (str file ".map"))))
["main.js" "code-editor.js" "excalidraw.js" "age-encryption.js"]))]
["main.js" "code-editor.js" "excalidraw.js"]))]
(send-to-renderer
:notification

View File

@@ -4,7 +4,6 @@
[frontend.util :as util]
[promesa.core :as p]
[electron.ipc :as ipc]
[shadow.loader :as loader]
[frontend.mobile.util :as mobile-util]))
(defn encrypt-with-passphrase
@@ -22,10 +21,7 @@
:data)
:else
(p/let [lazy-encrypt-with-user-passphrase (resolve 'frontend.extensions.age-encryption/encrypt-with-user-passphrase)
content (utf8/encode content)
encrypted (@lazy-encrypt-with-user-passphrase passphrase content true)]
(utf8/decode encrypted))))
nil))
(defn decrypt-with-passphrase
[passphrase content]
@@ -42,8 +38,4 @@
:data)
:else
(p/let [_ (loader/load :age-encryption)
lazy-decrypt-with-user-passphrase (resolve 'frontend.extensions.age-encryption/decrypt-with-user-passphrase)
content (utf8/encode content)
decrypted (lazy-decrypt-with-user-passphrase passphrase content)]
(utf8/decode decrypted))))
nil))

View File

@@ -1,23 +0,0 @@
(ns frontend.extensions.age-encryption
(:require ["regenerator-runtime/runtime"] ;; required for async npm module
["@kanru/rage-wasm" :as rage]))
(defn keygen
[]
(rage/keygen))
(defn encrypt-with-x25519
[public-key content armor]
(rage/encrypt_with_x25519 public-key content armor))
(defn decrypt-with-x25519
[secret-key content]
(rage/decrypt_with_x25519 secret-key content))
(defn encrypt-with-user-passphrase
[passphrase content armor]
(rage/encrypt_with_user_passphrase passphrase content armor))
(defn decrypt-with-user-passphrase
[passphrase content]
(rage/decrypt_with_user_passphrase passphrase content))