{"action":"created","comment":{"url":"https://api.github.com/repos/status-im/status-react/pulls/comments/147374088","pull_request_review_id":72461276,"id":147374088,"diff_hunk":"@@ -85,23 +87,33 @@\n (s/def :delivery/pending-message\n   (s/keys :req-un [:message/sig :message/to :shh/payload :payload/ack? ::id\n                    :message/requires-ack? :message/topic ::attempts ::was-sent?]\n-          :opt-un [:message/pubKey :message/symKeyID]))\n+          :opt-un [:message/pub-key :message/sym-key-password]))\n \n-(defn add-prepared-pending-message!\n-  [web3 {:keys [message-id to sym-key-id pub-key] :as pending-message}]\n-  {:pre [(valid? :delivery/pending-message pending-message)]}\n-  (debug :add-prepared-pending-message!)\n-  (let [message          (assoc\n-                           (select-keys pending-message [:sig :topic :payload])\n-                           :symKeyID sym-key-id\n-                           :pubKey pub-key)\n-        pending-message' (assoc pending-message :message message\n+(defn- do-add-pending-message!\n+  [web3 {:keys [message-id to pub-key sym-key-id] :as pending-message}]\n+  (let [message          (select-keys pending-message [:sig :topic :payload])\n+        message'         (if sym-key-id\n+                           (assoc message :symKeyId sym-key-id)\n+                           (assoc message :pubKey pub-key))\n+        pending-message' (assoc pending-message :message message'\n                                                 :id message-id)]\n     (swap! messages assoc-in [web3 message-id to] pending-message')\n     (when to\n       (swap! recipient->pending-message\n              update to set/union #{[web3 message-id to]}))))\n \n+(defn add-prepared-pending-message!\n+  [web3 {:keys [sym-key-password] :as pending-message}]\n+  {:pre [(valid? :delivery/pending-message pending-message)]}\n+  (debug :add-prepared-pending-message!)\n+  (if sym-key-password","path":"src/status_im/protocol/web3/delivery.cljs","position":89,"original_position":89,"commit_id":"8859260f08018e10fc032858d1c0555fe63870ca","original_commit_id":"8859260f08018e10fc032858d1c0555fe63870ca","user":{"login":"rasom","id":2364994,"avatar_url":"https://avatars2.githubusercontent.com/u/2364994?v=4","gravatar_id":"","url":"https://api.github.com/users/rasom","html_url":"https://github.com/rasom","followers_url":"https://api.github.com/users/rasom/followers","following_url":"https://api.github.com/users/rasom/following{/other_user}","gists_url":"https://api.github.com/users/rasom/gists{/gist_id}","starred_url":"https://api.github.com/users/rasom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rasom/subscriptions","organizations_url":"https://api.github.com/users/rasom/orgs","repos_url":"https://api.github.com/users/rasom/repos","events_url":"https://api.github.com/users/rasom/events{/privacy}","received_events_url":"https://api.github.com/users/rasom/received_events","type":"User","site_admin":false},"body":"`do-add-pending-message!` this call is sync always, `shh-keys/get-sym-key` makes async call to RPC, but this call is fast, it doesn't depend on blockchain state or anything related, so it will not be blocked because of some magic reason. ","created_at":"2017-10-27T10:19:34Z","updated_at":"2017-10-27T10:19:35Z","html_url":"https://github.com/status-im/status-react/pull/2309#discussion_r147374088","pull_request_url":"https://api.github.com/repos/status-im/status-react/pulls/2309","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/status-im/status-react/pulls/comments/147374088"},"html":{"href":"https://github.com/status-im/status-react/pull/2309#discussion_r147374088"},"pull_request":{"href":"https://api.github.com/repos/status-im/status-react/pulls/2309"}},"in_reply_to_id":147330485},"pull_request":{"url":"https://api.github.com/repos/status-im/status-react/pulls/2309","id":148989291,"html_url":"https://github.com/status-im/status-react/pull/2309","diff_url":"https://github.com/status-im/status-react/pull/2309.diff","patch_url":"https://github.com/status-im/status-react/pull/2309.patch","issue_url":"https://api.github.com/repos/status-im/status-react/issues/2309","number":2309,"state":"open","locked":false,"title":"fix pending messages with symmetric keys","user":{"login":"rasom","id":2364994,"avatar_url":"https://avatars2.githubusercontent.com/u/2364994?v=4","gravatar_id":"","url":"https://api.github.com/users/rasom","html_url":"https://github.com/rasom","followers_url":"https://api.github.com/users/rasom/followers","following_url":"https://api.github.com/users/rasom/following{/other_user}","gists_url":"https://api.github.com/users/rasom/gists{/gist_id}","starred_url":"https://api.github.com/users/rasom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rasom/subscriptions","organizations_url":"https://api.github.com/users/rasom/orgs","repos_url":"https://api.github.com/users/rasom/repos","events_url":"https://api.github.com/users/rasom/events{/privacy}","received_events_url":"https://api.github.com/users/rasom/received_events","type":"User","site_admin":false},"body":"Before this PR we stored `sym-key-id` in `pending-message`, but this id is valid only for the current session. That's why when we were trying to send stored pending message after application restart we got `Error: non-existent key ID ...` error. So now we store `sym-key-password` which is used for generation of `sym-key-id` fr each session. Just reminder, currently sym keys are used mostly as \"topics\" for messages, payload of such messages is additionally encrypted.  \r\n \r\nstatus: ready\r\n\r\n","created_at":"2017-10-26T16:50:35Z","updated_at":"2017-10-27T10:19:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"88702ee1ba3b34c84a49760cfee388b42847a7a0","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/status-im/status-react/pulls/2309/commits","review_comments_url":"https://api.github.com/repos/status-im/status-react/pulls/2309/comments","review_comment_url":"https://api.github.com/repos/status-im/status-react/pulls/comments{/number}","comments_url":"https://api.github.com/repos/status-im/status-react/issues/2309/comments","statuses_url":"https://api.github.com/repos/status-im/status-react/statuses/8859260f08018e10fc032858d1c0555fe63870ca","head":{"label":"status-im:bugfix/pending-messages-with-sym-key","ref":"bugfix/pending-messages-with-sym-key","sha":"8859260f08018e10fc032858d1c0555fe63870ca","user":{"login":"status-im","id":11767950,"avatar_url":"https://avatars1.githubusercontent.com/u/11767950?v=4","gravatar_id":"","url":"https://api.github.com/users/status-im","html_url":"https://github.com/status-im","followers_url":"https://api.github.com/users/status-im/followers","following_url":"https://api.github.com/users/status-im/following{/other_user}","gists_url":"https://api.github.com/users/status-im/gists{/gist_id}","starred_url":"https://api.github.com/users/status-im/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/status-im/subscriptions","organizations_url":"https://api.github.com/users/status-im/orgs","repos_url":"https://api.github.com/users/status-im/repos","events_url":"https://api.github.com/users/status-im/events{/privacy}","received_events_url":"https://api.github.com/users/status-im/received_events","type":"Organization","site_admin":false},"repo":{"id":52308441,"name":"status-react","full_name":"status-im/status-react","owner":{"login":"status-im","id":11767950,"avatar_url":"https://avatars1.githubusercontent.com/u/11767950?v=4","gravatar_id":"","url":"https://api.github.com/users/status-im","html_url":"https://github.com/status-im","followers_url":"https://api.github.com/users/status-im/followers","following_url":"https://api.github.com/users/status-im/following{/other_user}","gists_url":"https://api.github.com/users/status-im/gists{/gist_id}","starred_url":"https://api.github.com/users/status-im/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/status-im/subscriptions","organizations_url":"https://api.github.com/users/status-im/orgs","repos_url":"https://api.github.com/users/status-im/repos","events_url":"https://api.github.com/users/status-im/events{/privacy}","received_events_url":"https://api.github.com/users/status-im/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/status-im/status-react","description":"a free (libre) open source, mobile OS for Ethereum","fork":false,"url":"https://api.github.com/repos/status-im/status-react","forks_url":"https://api.github.com/repos/status-im/status-react/forks","keys_url":"https://api.github.com/repos/status-im/status-react/keys{/key_id}","collaborators_url":"https://api.github.com/repos/status-im/status-react/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/status-im/status-react/teams","hooks_url":"https://api.github.com/repos/status-im/status-react/hooks","issue_events_url":"https://api.github.com/repos/status-im/status-react/issues/events{/number}","events_url":"https://api.github.com/repos/status-im/status-react/events","assignees_url":"https://api.github.com/repos/status-im/status-react/assignees{/user}","branches_url":"https://api.github.com/repos/status-im/status-react/branches{/branch}","tags_url":"https://api.github.com/repos/status-im/status-react/tags","blobs_url":"https://api.github.com/repos/status-im/status-react/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/status-im/status-react/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/status-im/status-react/git/refs{/sha}","trees_url":"https://api.github.com/repos/status-im/status-react/git/trees{/sha}","statuses_url":"https://api.github.com/repos/status-im/status-react/statuses/{sha}","languages_url":"https://api.github.com/repos/status-im/status-react/languages","stargazers_url":"https://api.github.com/repos/status-im/status-react/stargazers","contributors_url":"https://api.github.com/repos/status-im/status-react/contributors","subscribers_url":"https://api.github.com/repos/status-im/status-react/subscribers","subscription_url":"https://api.github.com/repos/status-im/status-react/subscription","commits_url":"https://api.github.com/repos/status-im/status-react/commits{/sha}","git_commits_url":"https://api.github.com/repos/status-im/status-react/git/commits{/sha}","comments_url":"https://api.github.com/repos/status-im/status-react/comments{/number}","issue_comment_url":"https://api.github.com/repos/status-im/status-react/issues/comments{/number}","contents_url":"https://api.github.com/repos/status-im/status-react/contents/{+path}","compare_url":"https://api.github.com/repos/status-im/status-react/compare/{base}...{head}","merges_url":"https://api.github.com/repos/status-im/status-react/merges","archive_url":"https://api.github.com/repos/status-im/status-react/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/status-im/status-react/downloads","issues_url":"https://api.github.com/repos/status-im/status-react/issues{/number}","pulls_url":"https://api.github.com/repos/status-im/status-react/pulls{/number}","milestones_url":"https://api.github.com/repos/status-im/status-react/milestones{/number}","notifications_url":"https://api.github.com/repos/status-im/status-react/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/status-im/status-react/labels{/name}","releases_url":"https://api.github.com/repos/status-im/status-react/releases{/id}","deployments_url":"https://api.github.com/repos/status-im/status-react/deployments","created_at":"2016-02-22T21:48:48Z","updated_at":"2017-10-27T00:42:01Z","pushed_at":"2017-10-27T08:45:49Z","git_url":"git://github.com/status-im/status-react.git","ssh_url":"git@github.com:status-im/status-react.git","clone_url":"https://github.com/status-im/status-react.git","svn_url":"https://github.com/status-im/status-react","homepage":"https://status.im","size":72158,"stargazers_count":1436,"watchers_count":1436,"language":"Clojure","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":292,"mirror_url":null,"archived":false,"open_issues_count":353,"forks":292,"open_issues":353,"watchers":1436,"default_branch":"develop"}},"base":{"label":"status-im:develop","ref":"develop","sha":"7256ddafa994b600a040ae03d92f222604442064","user":{"login":"status-im","id":11767950,"avatar_url":"https://avatars1.githubusercontent.com/u/11767950?v=4","gravatar_id":"","url":"https://api.github.com/users/status-im","html_url":"https://github.com/status-im","followers_url":"https://api.github.com/users/status-im/followers","following_url":"https://api.github.com/users/status-im/following{/other_user}","gists_url":"https://api.github.com/users/status-im/gists{/gist_id}","starred_url":"https://api.github.com/users/status-im/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/status-im/subscriptions","organizations_url":"https://api.github.com/users/status-im/orgs","repos_url":"https://api.github.com/users/status-im/repos","events_url":"https://api.github.com/users/status-im/events{/privacy}","received_events_url":"https://api.github.com/users/status-im/received_events","type":"Organization","site_admin":false},"repo":{"id":52308441,"name":"status-react","full_name":"status-im/status-react","owner":{"login":"status-im","id":11767950,"avatar_url":"https://avatars1.githubusercontent.com/u/11767950?v=4","gravatar_id":"","url":"https://api.github.com/users/status-im","html_url":"https://github.com/status-im","followers_url":"https://api.github.com/users/status-im/followers","following_url":"https://api.github.com/users/status-im/following{/other_user}","gists_url":"https://api.github.com/users/status-im/gists{/gist_id}","starred_url":"https://api.github.com/users/status-im/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/status-im/subscriptions","organizations_url":"https://api.github.com/users/status-im/orgs","repos_url":"https://api.github.com/users/status-im/repos","events_url":"https://api.github.com/users/status-im/events{/privacy}","received_events_url":"https://api.github.com/users/status-im/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/status-im/status-react","description":"a free (libre) open source, mobile OS for Ethereum","fork":false,"url":"https://api.github.com/repos/status-im/status-react","forks_url":"https://api.github.com/repos/status-im/status-react/forks","keys_url":"https://api.github.com/repos/status-im/status-react/keys{/key_id}","collaborators_url":"https://api.github.com/repos/status-im/status-react/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/status-im/status-react/teams","hooks_url":"https://api.github.com/repos/status-im/status-react/hooks","issue_events_url":"https://api.github.com/repos/status-im/status-react/issues/events{/number}","events_url":"https://api.github.com/repos/status-im/status-react/events","assignees_url":"https://api.github.com/repos/status-im/status-react/assignees{/user}","branches_url":"https://api.github.com/repos/status-im/status-react/branches{/branch}","tags_url":"https://api.github.com/repos/status-im/status-react/tags","blobs_url":"https://api.github.com/repos/status-im/status-react/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/status-im/status-react/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/status-im/status-react/git/refs{/sha}","trees_url":"https://api.github.com/repos/status-im/status-react/git/trees{/sha}","statuses_url":"https://api.github.com/repos/status-im/status-react/statuses/{sha}","languages_url":"https://api.github.com/repos/status-im/status-react/languages","stargazers_url":"https://api.github.com/repos/status-im/status-react/stargazers","contributors_url":"https://api.github.com/repos/status-im/status-react/contributors","subscribers_url":"https://api.github.com/repos/status-im/status-react/subscribers","subscription_url":"https://api.github.com/repos/status-im/status-react/subscription","commits_url":"https://api.github.com/repos/status-im/status-react/commits{/sha}","git_commits_url":"https://api.github.com/repos/status-im/status-react/git/commits{/sha}","comments_url":"https://api.github.com/repos/status-im/status-react/comments{/number}","issue_comment_url":"https://api.github.com/repos/status-im/status-react/issues/comments{/number}","contents_url":"https://api.github.com/repos/status-im/status-react/contents/{+path}","compare_url":"https://api.github.com/repos/status-im/status-react/compare/{base}...{head}","merges_url":"https://api.github.com/repos/status-im/status-react/merges","archive_url":"https://api.github.com/repos/status-im/status-react/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/status-im/status-react/downloads","issues_url":"https://api.github.com/repos/status-im/status-react/issues{/number}","pulls_url":"https://api.github.com/repos/status-im/status-react/pulls{/number}","milestones_url":"https://api.github.com/repos/status-im/status-react/milestones{/number}","notifications_url":"https://api.github.com/repos/status-im/status-react/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/status-im/status-react/labels{/name}","releases_url":"https://api.github.com/repos/status-im/status-react/releases{/id}","deployments_url":"https://api.github.com/repos/status-im/status-react/deployments","created_at":"2016-02-22T21:48:48Z","updated_at":"2017-10-27T00:42:01Z","pushed_at":"2017-10-27T08:45:49Z","git_url":"git://github.com/status-im/status-react.git","ssh_url":"git@github.com:status-im/status-react.git","clone_url":"https://github.com/status-im/status-react.git","svn_url":"https://github.com/status-im/status-react","homepage":"https://status.im","size":72158,"stargazers_count":1436,"watchers_count":1436,"language":"Clojure","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":292,"mirror_url":null,"archived":false,"open_issues_count":353,"forks":292,"open_issues":353,"watchers":1436,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/status-im/status-react/pulls/2309"},"html":{"href":"https://github.com/status-im/status-react/pull/2309"},"issue":{"href":"https://api.github.com/repos/status-im/status-react/issues/2309"},"comments":{"href":"https://api.github.com/repos/status-im/status-react/issues/2309/comments"},"review_comments":{"href":"https://api.github.com/repos/status-im/status-react/pulls/2309/comments"},"review_comment":{"href":"https://api.github.com/repos/status-im/status-react/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/status-im/status-react/pulls/2309/commits"},"statuses":{"href":"https://api.github.com/repos/status-im/status-react/statuses/8859260f08018e10fc032858d1c0555fe63870ca"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"rasom"}}