parent
ea7c5b1665
commit
b8a0269357
|
@ -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"]
|
||||
|
|
|
@ -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]]
|
||||
|
|
|
@ -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]
|
||||
(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 (get-in db [:user-identity :public])}
|
||||
:whisper-identity public-key
|
||||
:address address}
|
||||
(fn [body]
|
||||
(log body)
|
||||
(log/debug body)
|
||||
(handler)))
|
||||
db)
|
||||
db))
|
||||
|
||||
(defn sign-up-confirm
|
||||
[confirmation-code handler]
|
||||
|
|
|
@ -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))))
|
||||
|
|
|
@ -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])}
|
||||
|
|
|
@ -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]]
|
||||
|
|
Loading…
Reference in New Issue