From e4cd4e77d010fff0e1cf2a4a05064caf82f194d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20W=C5=82adyka?= Date: Mon, 6 Feb 2023 18:06:54 +0100 Subject: [PATCH 1/2] delete legacy cljsjs/eccjs --- project.clj | 3 +-- src/district/encryption.cljs | 11 ++++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/project.clj b/project.clj index 48f7b4d..5b25652 100644 --- a/project.clj +++ b/project.clj @@ -3,8 +3,7 @@ :url "https://github.com/district0x/district-encryption" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} - :dependencies [[cljsjs/eccjs "0.3.1-0"] - [org.clojure/clojurescript "1.9.946"]] + :dependencies [[org.clojure/clojurescript "1.9.946"]] :npm {:dependencies [[eccjs "0.3.1"]]} diff --git a/src/district/encryption.cljs b/src/district/encryption.cljs index 9be36be..feea036 100644 --- a/src/district/encryption.cljs +++ b/src/district/encryption.cljs @@ -1,21 +1,18 @@ (ns district.encryption (:require - [cljsjs.eccjs :as eccjs] + ["eccjs" :as ecc] [goog.crypt.base64 :as base64])) -(when (and (exists? js/process) (= (str js/process) "[object process]")) ;; node environment - (set! js/ecc (js/require "eccjs"))) - (defn generate-keypair [] - (let [keypair (js->clj (.generate js/ecc (.-ENC_DEC js/ecc) 256))] + (let [keypair (js->clj (.generate ecc (.-ENC_DEC ecc) 256))] {:public-key (get keypair "enc") :private-key (get keypair "dec")})) (defn encrypt [public-key content] - (.encrypt js/ecc public-key content)) + (.encrypt ecc public-key content)) (defn decrypt [private-key content] - (.decrypt js/ecc private-key content)) + (.decrypt ecc private-key content)) (defn encode-base64 [s] (base64/encodeString s)) From f524128d2f324b298dc2c87ab8223bfb95a72c1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20W=C5=82adyka?= Date: Mon, 6 Feb 2023 18:07:21 +0100 Subject: [PATCH 2/2] bump ver --- project.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.clj b/project.clj index 5b25652..c22676f 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject district0x/district-encryption "1.0.2-SNAPSHOT" +(defproject district0x/district-encryption "1.0.3-SNAPSHOT" :description "Set of functions helpful for data encryption on blockchain based on public/private key" :url "https://github.com/district0x/district-encryption" :license {:name "Eclipse Public License"