diff --git a/project.clj b/project.clj index a407735efa..1f1b0c77d2 100644 --- a/project.clj +++ b/project.clj @@ -10,7 +10,7 @@ [prismatic/schema "1.0.4"] ^{:voom {:repo "git@github.com:status-im/status-lib.git" :branch "master"}} - [status-im/protocol "0.1.1-20160630_104454-gd663db0"] + [status-im/protocol "0.1.1-20160630_153846-gbf92f5f"] [natal-shell "0.1.6"] [com.andrewmcveigh/cljs-time "0.4.0"]] :plugins [[lein-cljsbuild "1.1.1"] diff --git a/src/status_im/accounts/handlers.cljs b/src/status_im/accounts/handlers.cljs index e70b48e1d9..8ea9cf3e60 100644 --- a/src/status_im/accounts/handlers.cljs +++ b/src/status_im/accounts/handlers.cljs @@ -18,13 +18,14 @@ (defn account-created [result] (let [data (json->clj result) public-key (:pubkey data) - address (:address data)] + address (:address data) + account {:public-key public-key + :address address}] (log/debug "Created account: " result) (when (not (str/blank? public-key)) (do - (dispatch [:initialize-protocol public-key]) - (dispatch [:add-account {:address address - :public-key public-key}]))))) + (dispatch [:initialize-protocol account]) + (dispatch [:add-account account]))))) (register-handler :create-account (-> (fn [db [_ password]] diff --git a/src/status_im/handlers/server.cljs b/src/status_im/handlers/server.cljs index 5d9674c1d7..565f6f90c0 100644 --- a/src/status_im/handlers/server.cljs +++ b/src/status_im/handlers/server.cljs @@ -1,17 +1,20 @@ (ns status-im.handlers.server (:require [re-frame.core :refer [subscribe dispatch dispatch-sync]] - [status-im.utils.utils :refer [log on-error http-post]] + [status-im.utils.utils :refer [on-error http-post]] [status-im.utils.logging :as log])) (defn sign-up [db phone-number handler] - ;(user-data/save-phone-number phone-number) - (http-post "sign-up" {:phone-number phone-number - :whisper-identity (get-in db [:user-identity :public])} - (fn [body] - (log body) - (handler))) - db) + (let [{:keys [public-key address] :as account} (get-in db [:user-identity])] + ;(user-data/save-phone-number phone-number) + (log/debug "signing up with public-key" public-key "and phone " phone-number) + (http-post "sign-up" {:phone-number phone-number + :whisper-identity public-key + :address address} + (fn [body] + (log/debug body) + (handler))) + db)) (defn sign-up-confirm [confirmation-code handler] diff --git a/src/status_im/models/protocol.cljs b/src/status_im/models/protocol.cljs index abe2ad110f..441d433688 100644 --- a/src/status_im/models/protocol.cljs +++ b/src/status_im/models/protocol.cljs @@ -12,13 +12,11 @@ (assoc-in db db/protocol-initialized-path initialized?)) (defn update-identity [db identity] - (let [password (:identity-password db) - encrypted (password-encrypt password (to-edn-string identity))] - (s/put kv/kv-store :identity encrypted) + (let [identity-string (to-edn-string identity)] + (s/put kv/kv-store :identity identity-string) (assoc db :user-identity identity))) (defn stored-identity [db] - (let [encrypted (s/get kv/kv-store :identity) - password (:identity-password db)] - (when encrypted - (read-string (password-decrypt password encrypted))))) + (let [identity (s/get kv/kv-store :identity)] + (when identity + (read-string identity)))) diff --git a/src/status_im/profile/screen.cljs b/src/status_im/profile/screen.cljs index ffff2d2e47..09f2fc3d07 100644 --- a/src/status_im/profile/screen.cljs +++ b/src/status_im/profile/screen.cljs @@ -67,7 +67,7 @@ phone-number [:get :phone-number] email [:get :email] status [:get :status] - identity [:get-in [:user-identity :public]]] + identity [:get-in [:user-identity :public-key]]] [scroll-view {:style st/profile} [touchable-highlight {:style st/back-btn-touchable :on-press #(dispatch [:navigate-back])} diff --git a/src/status_im/protocol/handlers.cljs b/src/status_im/protocol/handlers.cljs index 14690d6f47..a5010bb56c 100644 --- a/src/status_im/protocol/handlers.cljs +++ b/src/status_im/protocol/handlers.cljs @@ -17,8 +17,8 @@ (register-handler :initialize-protocol (u/side-effect! - (fn [db [_ public-key]] - (init-protocol public-key (make-handler db))))) + (fn [db [_ account]] + (init-protocol account (make-handler db))))) (register-handler :protocol-initialized (fn [db [_ identity]]