{"action":"created","comment":{"url":"https://api.github.com/repos/meganz/sdk/pulls/comments/46327902","id":46327902,"diff_hunk":"@@ -107,52 +121,145 @@ int EdDSA::verify(const unsigned char* msg, unsigned long long msglen,\n                                   signedmsg, msglen + crypto_sign_BYTES, pubKey);\n     free(msgbuffer);\n     free(signedmsg);\n-    if (result) {\n-        return(1);\n-    } else {\n-        // crypto_sign_open() returns -1 on failure.\n-        return(0);\n-    }\n+\n+    // crypto_sign_open() returns 0 on success.\n+    return result ? 1 : 0;\n }\n \n \n-// Generates a new Ed25519 private key seed. The key seed is stored in the object.\n-int EdDSA::genKeySeed(unsigned char* privKey) {\n-    // Make space for a new key seed (if not present).\n-    if (!this->keySeed) {\n-        this->keySeed = (unsigned char*)malloc(crypto_sign_SEEDBYTES);\n-        if (this->keySeed == NULL) {\n+// Derives the Ed25519 private and public keys from the stored private key seed.\n+int EdDSA::genKeys()\n+{\n+    int check = 1;  // error code != 0","path":"src/crypto/sodium.cpp","position":172,"original_position":171,"commit_id":"9a83592f2d9dd6a1196cfe600cef0efbee531b90","original_commit_id":"4bf34168b936b0f7ed6c2c6fe103e926bb0dbae0","user":{"login":"pohutukawa","id":422922,"avatar_url":"https://avatars.githubusercontent.com/u/422922?v=3","gravatar_id":"","url":"https://api.github.com/users/pohutukawa","html_url":"https://github.com/pohutukawa","followers_url":"https://api.github.com/users/pohutukawa/followers","following_url":"https://api.github.com/users/pohutukawa/following{/other_user}","gists_url":"https://api.github.com/users/pohutukawa/gists{/gist_id}","starred_url":"https://api.github.com/users/pohutukawa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pohutukawa/subscriptions","organizations_url":"https://api.github.com/users/pohutukawa/orgs","repos_url":"https://api.github.com/users/pohutukawa/repos","events_url":"https://api.github.com/users/pohutukawa/events{/privacy}","received_events_url":"https://api.github.com/users/pohutukawa/received_events","type":"User","site_admin":false},"body":"All good.","created_at":"2015-12-01T19:43:01Z","updated_at":"2015-12-01T19:43:01Z","html_url":"https://github.com/meganz/sdk/pull/179#discussion_r46327902","pull_request_url":"https://api.github.com/repos/meganz/sdk/pulls/179","_links":{"self":{"href":"https://api.github.com/repos/meganz/sdk/pulls/comments/46327902"},"html":{"href":"https://github.com/meganz/sdk/pull/179#discussion_r46327902"},"pull_request":{"href":"https://api.github.com/repos/meganz/sdk/pulls/179"}}},"pull_request":{"url":"https://api.github.com/repos/meganz/sdk/pulls/179","id":50674461,"html_url":"https://github.com/meganz/sdk/pull/179","diff_url":"https://github.com/meganz/sdk/pull/179.diff","patch_url":"https://github.com/meganz/sdk/pull/179.patch","issue_url":"https://api.github.com/repos/meganz/sdk/issues/179","number":179,"state":"open","locked":false,"title":"Creation of chat keys","user":{"login":"sergiohs84","id":11694066,"avatar_url":"https://avatars.githubusercontent.com/u/11694066?v=3","gravatar_id":"","url":"https://api.github.com/users/sergiohs84","html_url":"https://github.com/sergiohs84","followers_url":"https://api.github.com/users/sergiohs84/followers","following_url":"https://api.github.com/users/sergiohs84/following{/other_user}","gists_url":"https://api.github.com/users/sergiohs84/gists{/gist_id}","starred_url":"https://api.github.com/users/sergiohs84/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sergiohs84/subscriptions","organizations_url":"https://api.github.com/users/sergiohs84/orgs","repos_url":"https://api.github.com/users/sergiohs84/repos","events_url":"https://api.github.com/users/sergiohs84/events{/privacy}","received_events_url":"https://api.github.com/users/sergiohs84/received_events","type":"User","site_admin":false},"body":"- After login, keys are requested. If not available, they are created and saved in MEGA.\r\n- A new class `ECDH` wraps the functionality of chat keys, as it does the `EdDSA` for signing keys.\r\n- The methods to `cipher()` and `ECDH::uncipher()` are a first approach, not tested yet.\r\n- (unrelated) Do not allow to set `*!lstint` or `*authring` from `MegaApi`","created_at":"2015-11-13T18:28:23Z","updated_at":"2015-12-01T19:43:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e38357de450e77731319976fa78e61e02761e1a7","assignee":{"login":"pohutukawa","id":422922,"avatar_url":"https://avatars.githubusercontent.com/u/422922?v=3","gravatar_id":"","url":"https://api.github.com/users/pohutukawa","html_url":"https://github.com/pohutukawa","followers_url":"https://api.github.com/users/pohutukawa/followers","following_url":"https://api.github.com/users/pohutukawa/following{/other_user}","gists_url":"https://api.github.com/users/pohutukawa/gists{/gist_id}","starred_url":"https://api.github.com/users/pohutukawa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pohutukawa/subscriptions","organizations_url":"https://api.github.com/users/pohutukawa/orgs","repos_url":"https://api.github.com/users/pohutukawa/repos","events_url":"https://api.github.com/users/pohutukawa/events{/privacy}","received_events_url":"https://api.github.com/users/pohutukawa/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/meganz/sdk/pulls/179/commits","review_comments_url":"https://api.github.com/repos/meganz/sdk/pulls/179/comments","review_comment_url":"https://api.github.com/repos/meganz/sdk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/meganz/sdk/issues/179/comments","statuses_url":"https://api.github.com/repos/meganz/sdk/statuses/9a83592f2d9dd6a1196cfe600cef0efbee531b90","head":{"label":"meganz:chat-keys","ref":"chat-keys","sha":"9a83592f2d9dd6a1196cfe600cef0efbee531b90","user":{"login":"meganz","id":4920706,"avatar_url":"https://avatars.githubusercontent.com/u/4920706?v=3","gravatar_id":"","url":"https://api.github.com/users/meganz","html_url":"https://github.com/meganz","followers_url":"https://api.github.com/users/meganz/followers","following_url":"https://api.github.com/users/meganz/following{/other_user}","gists_url":"https://api.github.com/users/meganz/gists{/gist_id}","starred_url":"https://api.github.com/users/meganz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meganz/subscriptions","organizations_url":"https://api.github.com/users/meganz/orgs","repos_url":"https://api.github.com/users/meganz/repos","events_url":"https://api.github.com/users/meganz/events{/privacy}","received_events_url":"https://api.github.com/users/meganz/received_events","type":"Organization","site_admin":false},"repo":{"id":14556029,"name":"sdk","full_name":"meganz/sdk","owner":{"login":"meganz","id":4920706,"avatar_url":"https://avatars.githubusercontent.com/u/4920706?v=3","gravatar_id":"","url":"https://api.github.com/users/meganz","html_url":"https://github.com/meganz","followers_url":"https://api.github.com/users/meganz/followers","following_url":"https://api.github.com/users/meganz/following{/other_user}","gists_url":"https://api.github.com/users/meganz/gists{/gist_id}","starred_url":"https://api.github.com/users/meganz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meganz/subscriptions","organizations_url":"https://api.github.com/users/meganz/orgs","repos_url":"https://api.github.com/users/meganz/repos","events_url":"https://api.github.com/users/meganz/events{/privacy}","received_events_url":"https://api.github.com/users/meganz/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/meganz/sdk","description":"MEGA C++ SDK","fork":false,"url":"https://api.github.com/repos/meganz/sdk","forks_url":"https://api.github.com/repos/meganz/sdk/forks","keys_url":"https://api.github.com/repos/meganz/sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/meganz/sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/meganz/sdk/teams","hooks_url":"https://api.github.com/repos/meganz/sdk/hooks","issue_events_url":"https://api.github.com/repos/meganz/sdk/issues/events{/number}","events_url":"https://api.github.com/repos/meganz/sdk/events","assignees_url":"https://api.github.com/repos/meganz/sdk/assignees{/user}","branches_url":"https://api.github.com/repos/meganz/sdk/branches{/branch}","tags_url":"https://api.github.com/repos/meganz/sdk/tags","blobs_url":"https://api.github.com/repos/meganz/sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/meganz/sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/meganz/sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/meganz/sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/meganz/sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/meganz/sdk/languages","stargazers_url":"https://api.github.com/repos/meganz/sdk/stargazers","contributors_url":"https://api.github.com/repos/meganz/sdk/contributors","subscribers_url":"https://api.github.com/repos/meganz/sdk/subscribers","subscription_url":"https://api.github.com/repos/meganz/sdk/subscription","commits_url":"https://api.github.com/repos/meganz/sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/meganz/sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/meganz/sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/meganz/sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/meganz/sdk/contents/{+path}","compare_url":"https://api.github.com/repos/meganz/sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/meganz/sdk/merges","archive_url":"https://api.github.com/repos/meganz/sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/meganz/sdk/downloads","issues_url":"https://api.github.com/repos/meganz/sdk/issues{/number}","pulls_url":"https://api.github.com/repos/meganz/sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/meganz/sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/meganz/sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/meganz/sdk/labels{/name}","releases_url":"https://api.github.com/repos/meganz/sdk/releases{/id}","created_at":"2013-11-20T12:33:53Z","updated_at":"2015-11-30T03:36:04Z","pushed_at":"2015-12-01T16:20:05Z","git_url":"git://github.com/meganz/sdk.git","ssh_url":"git@github.com:meganz/sdk.git","clone_url":"https://github.com/meganz/sdk.git","svn_url":"https://github.com/meganz/sdk","homepage":"","size":10993,"stargazers_count":168,"watchers_count":168,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":82,"mirror_url":null,"open_issues_count":13,"forks":82,"open_issues":13,"watchers":168,"default_branch":"master"}},"base":{"label":"meganz:master","ref":"master","sha":"b6271b98306234f628757545b1f369c162d30f0a","user":{"login":"meganz","id":4920706,"avatar_url":"https://avatars.githubusercontent.com/u/4920706?v=3","gravatar_id":"","url":"https://api.github.com/users/meganz","html_url":"https://github.com/meganz","followers_url":"https://api.github.com/users/meganz/followers","following_url":"https://api.github.com/users/meganz/following{/other_user}","gists_url":"https://api.github.com/users/meganz/gists{/gist_id}","starred_url":"https://api.github.com/users/meganz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meganz/subscriptions","organizations_url":"https://api.github.com/users/meganz/orgs","repos_url":"https://api.github.com/users/meganz/repos","events_url":"https://api.github.com/users/meganz/events{/privacy}","received_events_url":"https://api.github.com/users/meganz/received_events","type":"Organization","site_admin":false},"repo":{"id":14556029,"name":"sdk","full_name":"meganz/sdk","owner":{"login":"meganz","id":4920706,"avatar_url":"https://avatars.githubusercontent.com/u/4920706?v=3","gravatar_id":"","url":"https://api.github.com/users/meganz","html_url":"https://github.com/meganz","followers_url":"https://api.github.com/users/meganz/followers","following_url":"https://api.github.com/users/meganz/following{/other_user}","gists_url":"https://api.github.com/users/meganz/gists{/gist_id}","starred_url":"https://api.github.com/users/meganz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meganz/subscriptions","organizations_url":"https://api.github.com/users/meganz/orgs","repos_url":"https://api.github.com/users/meganz/repos","events_url":"https://api.github.com/users/meganz/events{/privacy}","received_events_url":"https://api.github.com/users/meganz/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/meganz/sdk","description":"MEGA C++ SDK","fork":false,"url":"https://api.github.com/repos/meganz/sdk","forks_url":"https://api.github.com/repos/meganz/sdk/forks","keys_url":"https://api.github.com/repos/meganz/sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/meganz/sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/meganz/sdk/teams","hooks_url":"https://api.github.com/repos/meganz/sdk/hooks","issue_events_url":"https://api.github.com/repos/meganz/sdk/issues/events{/number}","events_url":"https://api.github.com/repos/meganz/sdk/events","assignees_url":"https://api.github.com/repos/meganz/sdk/assignees{/user}","branches_url":"https://api.github.com/repos/meganz/sdk/branches{/branch}","tags_url":"https://api.github.com/repos/meganz/sdk/tags","blobs_url":"https://api.github.com/repos/meganz/sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/meganz/sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/meganz/sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/meganz/sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/meganz/sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/meganz/sdk/languages","stargazers_url":"https://api.github.com/repos/meganz/sdk/stargazers","contributors_url":"https://api.github.com/repos/meganz/sdk/contributors","subscribers_url":"https://api.github.com/repos/meganz/sdk/subscribers","subscription_url":"https://api.github.com/repos/meganz/sdk/subscription","commits_url":"https://api.github.com/repos/meganz/sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/meganz/sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/meganz/sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/meganz/sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/meganz/sdk/contents/{+path}","compare_url":"https://api.github.com/repos/meganz/sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/meganz/sdk/merges","archive_url":"https://api.github.com/repos/meganz/sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/meganz/sdk/downloads","issues_url":"https://api.github.com/repos/meganz/sdk/issues{/number}","pulls_url":"https://api.github.com/repos/meganz/sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/meganz/sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/meganz/sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/meganz/sdk/labels{/name}","releases_url":"https://api.github.com/repos/meganz/sdk/releases{/id}","created_at":"2013-11-20T12:33:53Z","updated_at":"2015-11-30T03:36:04Z","pushed_at":"2015-12-01T16:20:05Z","git_url":"git://github.com/meganz/sdk.git","ssh_url":"git@github.com:meganz/sdk.git","clone_url":"https://github.com/meganz/sdk.git","svn_url":"https://github.com/meganz/sdk","homepage":"","size":10993,"stargazers_count":168,"watchers_count":168,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":82,"mirror_url":null,"open_issues_count":13,"forks":82,"open_issues":13,"watchers":168,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/meganz/sdk/pulls/179"},"html":{"href":"https://github.com/meganz/sdk/pull/179"},"issue":{"href":"https://api.github.com/repos/meganz/sdk/issues/179"},"comments":{"href":"https://api.github.com/repos/meganz/sdk/issues/179/comments"},"review_comments":{"href":"https://api.github.com/repos/meganz/sdk/pulls/179/comments"},"review_comment":{"href":"https://api.github.com/repos/meganz/sdk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/meganz/sdk/pulls/179/commits"},"statuses":{"href":"https://api.github.com/repos/meganz/sdk/statuses/9a83592f2d9dd6a1196cfe600cef0efbee531b90"}}}}