publish using pk in 1-to-1

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
This commit is contained in:
Andrea Maria Piana 2018-05-08 08:26:41 +02:00
parent b7ab49d305
commit 291932db08
No known key found for this signature in database
GPG Key ID: AA6CCA6DE0E06424
7 changed files with 17 additions and 7 deletions

1
.env
View File

@ -20,3 +20,4 @@ DEBUG_WEBVIEW=1
INSTABUG_SURVEYS=1
GROUP_CHATS_ENABLED=1
FORCE_SENT_RECEIVED_TRACKING=0
USE_SYM_KEY=0

View File

@ -20,3 +20,4 @@ DEBUG_WEBVIEW=1
INSTABUG_SURVEYS=0
GROUP_CHATS_ENABLED=1
FORCE_SENT_RECEIVED_TRACKING=0
USE_SYM_KEY=0

View File

@ -21,3 +21,4 @@ DEBUG_WEBVIEW=1
INSTABUG_SURVEYS=1
GROUP_CHATS_ENABLED=1
FORCE_SENT_RECEIVED_TRACKING=1
USE_SYM_KEY=0

View File

@ -21,3 +21,4 @@ DEBUG_WEBVIEW=0
INSTABUG_SURVEYS=1
GROUP_CHATS_ENABLED=0
FORCE_SENT_RECEIVED_TRACKING=0
USE_SYM_KEY=0

View File

@ -6,6 +6,7 @@
[status-im.transport.utils :as transport.utils]
[status-im.utils.config :as config]
[taoensso.timbre :as log]
[status-im.constants :as constants]
[status-im.utils.ethereum.core :as ethereum]
[status-im.utils.utils :as utils]
[status-im.i18n :as i18n]

View File

@ -91,13 +91,17 @@
(defrecord Message [content content-type message-type clock-value timestamp]
message/StatusMessage
(send [this chat-id cofx]
(send {:chat-id chat-id
:payload this
:success-event [:transport/set-message-envelope-hash
chat-id
(transport.utils/message-id this)
message-type]}
cofx))
(let [params {:chat-id chat-id
:payload this
:success-event [:transport/set-message-envelope-hash
chat-id
(transport.utils/message-id this)
message-type]}
group-chat (get-in cofx [:db :chats chat-id :group-chat])]
(if (or group-chat
config/use-sym-key)
(send params cofx)
(send-with-pubkey params cofx))))
(receive [this chat-id signature cofx]
{:dispatch [:chat-received-message/add (assoc (into {} this)
:message-id (transport.utils/message-id this)

View File

@ -41,5 +41,6 @@
(def pow-target (js/parseFloat (get-config :POW_TARGET "0.002")))
(def pow-time (js/parseInt (get-config :POW_TIME "1")))
(def use-sym-key (enabled? (get-config :USE_SYM_KEY 0)))
(def group-chats-enabled? (enabled? (get-config :GROUP_CHATS_ENABLED)))