{"action":"created","comment":{"url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/pulls/comments/36435344","id":36435344,"diff_hunk":"@@ -112,6 +113,28 @@ ThaliReplicationManager.prototype.stop = function () {\n   });\n };\n \n+/**\n+* Returns the current device's id if available. If not, the provided callback\n+* function is saved and called when the id does become available.\n+* @param {Function} cb the callback which returns the current device's id.\n+*/\n+ThaliReplicationManager.prototype.getDeviceIdentity = function (cb) {\n+  if(currentDeviceIdentity) {\n+    cb(null, currentDeviceIdentity);\n+  } else {\n+    var cryptomanager = require('./thalicryptomanager');\n+    // get the device public-key-hash","path":"thali/thalireplicationmanager.js","position":null,"original_position":67,"commit_id":"9d917e15deeebffdf5e86405cb7dbf3189ad2022","original_commit_id":"fe52ed1cc48102a338cad41f60d4f612e94e36c2","user":{"login":"yaronyg","id":1480964,"avatar_url":"https://avatars.githubusercontent.com/u/1480964?v=3","gravatar_id":"","url":"https://api.github.com/users/yaronyg","html_url":"https://github.com/yaronyg","followers_url":"https://api.github.com/users/yaronyg/followers","following_url":"https://api.github.com/users/yaronyg/following{/other_user}","gists_url":"https://api.github.com/users/yaronyg/gists{/gist_id}","starred_url":"https://api.github.com/users/yaronyg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yaronyg/subscriptions","organizations_url":"https://api.github.com/users/yaronyg/orgs","repos_url":"https://api.github.com/users/yaronyg/repos","events_url":"https://api.github.com/users/yaronyg/events{/privacy}","received_events_url":"https://api.github.com/users/yaronyg/received_events","type":"User","site_admin":false},"body":":+1: ","created_at":"2015-08-06T16:30:24Z","updated_at":"2015-08-06T16:30:24Z","html_url":"https://github.com/thaliproject/Thali_CordovaPlugin/pull/41#discussion_r36435344","pull_request_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/pulls/41","_links":{"self":{"href":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/pulls/comments/36435344"},"html":{"href":"https://github.com/thaliproject/Thali_CordovaPlugin/pull/41#discussion_r36435344"},"pull_request":{"href":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/pulls/41"}}},"pull_request":{"url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/pulls/41","id":40512063,"html_url":"https://github.com/thaliproject/Thali_CordovaPlugin/pull/41","diff_url":"https://github.com/thaliproject/Thali_CordovaPlugin/pull/41.diff","patch_url":"https://github.com/thaliproject/Thali_CordovaPlugin/pull/41.patch","issue_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/issues/41","number":41,"state":"open","locked":false,"title":"Added a new file \"thalicryptomanager.js\" which has an API to obtain the","user":{"login":"srichal","id":11357884,"avatar_url":"https://avatars.githubusercontent.com/u/11357884?v=3","gravatar_id":"","url":"https://api.github.com/users/srichal","html_url":"https://github.com/srichal","followers_url":"https://api.github.com/users/srichal/followers","following_url":"https://api.github.com/users/srichal/following{/other_user}","gists_url":"https://api.github.com/users/srichal/gists{/gist_id}","starred_url":"https://api.github.com/users/srichal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srichal/subscriptions","organizations_url":"https://api.github.com/users/srichal/orgs","repos_url":"https://api.github.com/users/srichal/repos","events_url":"https://api.github.com/users/srichal/events{/privacy}","received_events_url":"https://api.github.com/users/srichal/received_events","type":"User","site_admin":false},"body":"public-key-hash value. Also added new functionality to the \"ThaliReplicationManager.prototype.start\" function where the public-key-hash is obtained for the device and it is added to the DB if needed.\n<a href='#crh-start'></a><a href='#crh-data-%7B%22processed%22%3A%20%5B%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35162586%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35162646%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35162748%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35163221%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35163357%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35228119%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35228278%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35281171%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35281316%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35281388%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35282904%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35284830%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35377318%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35377637%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35378189%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35378331%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35378404%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35378529%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35378731%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35379003%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35379157%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35379212%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35379283%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35726605%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35726635%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35726834%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35726870%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35726919%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35726998%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35882873%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35882982%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35883075%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35883156%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35883211%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35883387%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35883406%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35883495%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35883600%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35883661%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35883904%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35884036%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35884216%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35884302%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35884354%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35884408%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35884440%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36154300%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36154345%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36154705%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36202862%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36202957%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36203065%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36203092%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36204257%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36205733%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36205802%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36205941%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36205994%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36258790%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36259524%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36259535%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36259564%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36259572%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36259648%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36259665%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36365037%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36434831%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36434850%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36434940%22%2C%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36435270%22%5D%2C%20%22comments%22%3A%20%7B%22Pull%203a38f2bfffb4b26172d4c0ce9864a2ddd1d2c750%20thali/thalireplicationmanager.js%204%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35378731%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22Why%20is%20addressPrefix%20in%20the%20thalireplicationmanager%3F%20That%20is%20something%20that%20is%20specific%20to%20the%20postcardapp.%20It%20is%20not%20generic%20to%20Thali%20at%20all.%20It%20shouldn%27t%20be%20Thali_CordovaPlugin%2C%20it%20should%20be%20in%20postcardapp.%22%2C%20%22created_at%22%3A%20%222015-07-23T22%3A21%3A35Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%2C%20%7B%22body%22%3A%20%22Fixed%20as%20part%20of%20the%20redesign%20where%20the%20thalireplicationmanager%20does%20not%20add%20anything%20o%20the%20DB.%22%2C%20%22created_at%22%3A%20%222015-07-29T04%3A14%3A28Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/11357884%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/srichal%22%7D%7D%2C%20%7B%22body%22%3A%20%22%3A%2B1%3A%20%22%2C%20%22created_at%22%3A%20%222015-07-30T15%3A36%3A08Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20thali/thalireplicationmanager.js%3AL6-13%22%7D%2C%20%22Pull%20698ba1fa9d67efe22e5656685e995b25bc42fa05%20thali/thalicryptomanager.js%2035%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35162748%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22Same%20callback%20comment%20as%20above%20and%20again%20in%20line%2042%20and%20so%20on.%22%2C%20%22created_at%22%3A%20%222015-07-21T22%3A33%3A15Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%2C%20%7B%22body%22%3A%20%22Fixed.%22%2C%20%22created_at%22%3A%20%222015-07-23T00%3A50%3A04Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/11357884%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/srichal%22%7D%7D%2C%20%7B%22body%22%3A%20%22%3A%2B1%3A%20%22%2C%20%22created_at%22%3A%20%222015-07-30T15%3A26%3A58Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20thali/thalicryptomanager.js%3AL1-95%22%7D%2C%20%22Pull%203a38f2bfffb4b26172d4c0ce9864a2ddd1d2c750%20thali/thalireplicationmanager.js%2060%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35379212%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22There%20should%20be%202%2C%20not%203%20ds%20in%20Addr.%20Actually%20it%27s%20generally%20not%20recommended%20to%20use%20abbreviations.%20Now%20that%20we%20have%20auto-complete%20in%20our%20IDEs%20it%27s%20better%20to%20just%20use%20the%20full%20word%2C%20e.g.%20currentAddressFound.%22%2C%20%22created_at%22%3A%20%222015-07-23T22%3A27%3A45Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%2C%20%7B%22body%22%3A%20%22I%20am%20not%20using%20abbreviations%20anymore.%22%2C%20%22created_at%22%3A%20%222015-07-29T04%3A22%3A44Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/11357884%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/srichal%22%7D%7D%2C%20%7B%22body%22%3A%20%22%3A%2B1%3A%20%22%2C%20%22created_at%22%3A%20%222015-07-30T15%3A37%3A55Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20thali/thalireplicationmanager.js%3AL39-109%22%7D%2C%20%22Pull%203a38f2bfffb4b26172d4c0ce9864a2ddd1d2c750%20thali/thalireplicationmanager.js%2043%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35379003%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22This%20should%20not%20be%20here%20per%20my%20previous%20comment.%20I%20think%20it%20makes%20sense%20for%20the%20cryptomanager%20to%20be%20here.%20I%20think%20it%20makes%20sense%20for%20the%20cryptomanager%20to%20be%20part%20of%20start%20up%20%28after%20all%2C%20you%20can%27t%20do%20replication%20with%20an%20identity%29.%20I%20even%20think%20it%20makes%20sense%20for%20the%20cryptomanager%20to%20get%20the%20publickeyhash.%20But%20that%20is%20where%20it%20ends.%20That%20publickeyhash%20should%20be%20available%20as%20a%20property%20identifying%20the%20current%20device%20but%20that%27s%20it.%20It%20should%20be%20up%20to%20the%20postcardapp%20to%20then%20get%20that%20publickeyhash%20and%20use%20it%20for%20something.%5Cr%5Cn%5Cr%5CnPlease%20propose%20a%20design%20for%20how%20we%20can%20expose%20the%20publickeyhash%20all%20the%20way%20to%20the%20postcardapp%20in%20a%20manner%20that%20makes%20logical%20sense.%22%2C%20%22created_at%22%3A%20%222015-07-23T22%3A25%3A03Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%2C%20%7B%22body%22%3A%20%22Completed%20the%20redesign%20as%20proposed.%22%2C%20%22created_at%22%3A%20%222015-07-29T04%3A15%3A25Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/11357884%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/srichal%22%7D%7D%2C%20%7B%22body%22%3A%20%22%3A%2B1%3A%20%22%2C%20%22created_at%22%3A%20%222015-07-30T15%3A36%3A56Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20thali/thalireplicationmanager.js%3AL39-109%22%7D%2C%20%22Pull%203a38f2bfffb4b26172d4c0ce9864a2ddd1d2c750%20thali/thalireplicationmanager.js%2061%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35379157%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22Again%2C%20this%20is%20postcardapp%20specific.%20It%27s%20not%20generic%20to%20Thali.%20I%20do%20believe%20that%20eventually%20Thali%20should%20have%20a%20central%20address%20book%20store%20and%20when%20we%20work%20on%20ACLs%20and%20identity%20exchange%20we%20will%20add%20one.%20But%20for%20now%20the%20thali%20replication%20manager%20can%20only%20handle%20one%20DB%20at%20a%20time%20so%20we%20agreed%20to%20put%20the%20addressbook%20entries%20in%20it%20but%20that%20should%20be%20an%20app%20level%20%28e.g.%20postcardapp%29%20consideration%2C%20not%20a%20Thali_CordovaPlugin%20consideration.%22%2C%20%22created_at%22%3A%20%222015-07-23T22%3A27%3A03Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%2C%20%7B%22body%22%3A%20%22Fixed%20as%20part%20of%20the%20redesign.%22%2C%20%22created_at%22%3A%20%222015-07-29T04%3A21%3A23Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/11357884%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/srichal%22%7D%7D%2C%20%7B%22body%22%3A%20%22%3A%2B1%3A%20%22%2C%20%22created_at%22%3A%20%222015-07-30T15%3A37%3A31Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20thali/thalireplicationmanager.js%3AL39-109%22%7D%2C%20%22Pull%203a38f2bfffb4b26172d4c0ce9864a2ddd1d2c750%20thali/thalicryptomanager.js%2040%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35378331%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22Is%20this%20really%20necessary%20in%20the%20log%3F%20Please%20review%20your%20console.log%20statements%20and%20ask%20yourself%20%5C%22Will%20anyone%20benefit%20by%20adding%20all%20of%20this%20to%20the%20log%3F%5C%22%20The%20more%20stuff%20is%20in%20the%20log%20the%20harder%20it%20is%20to%20use%20for%20much%20of%20anything.%20We%20already%20have%20a%20work%20item%20to%20add%20some%20kind%20of%20log%20leveling%20but%20we%20aren%27t%20there%20yet.%22%2C%20%22created_at%22%3A%20%222015-07-23T22%3A16%3A50Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%2C%20%7B%22body%22%3A%20%22%3A%2B1%3A%20%22%2C%20%22created_at%22%3A%20%222015-07-30T15%3A31%3A22Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20thali/thalicryptomanager.js%3AL1-103%22%7D%2C%20%22Pull%20698ba1fa9d67efe22e5656685e995b25bc42fa05%20thali/thalicryptomanager.js%2092%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35163357%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22Why%20did%20you%20go%20through%20all%20the%20trouble%20to%20create%20a%20Buffer%20when%20you%20end%20up%20only%20using%20the%20value%20as%20a%20string%3F%20In%20fact%2C%20when%20would%20it%20ever%20be%20used%20as%20a%20buffer%3F%22%2C%20%22created_at%22%3A%20%222015-07-21T22%3A40%3A59Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%2C%20%7B%22body%22%3A%20%22Fixed%20by%20returning%20a%20string.%22%2C%20%22created_at%22%3A%20%222015-07-23T01%3A25%3A31Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/11357884%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/srichal%22%7D%7D%2C%20%7B%22body%22%3A%20%22%3A%2B1%3A%20%22%2C%20%22created_at%22%3A%20%222015-07-30T15%3A29%3A30Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20thali/thalicryptomanager.js%3AL1-95%22%7D%2C%20%22Pull%203a38f2bfffb4b26172d4c0ce9864a2ddd1d2c750%20thali/thalireplicationmanager.js%2015%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35378529%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22Where%20is%20the%20jsdoc%20for%20deviceName%3F%22%2C%20%22created_at%22%3A%20%222015-07-23T22%3A19%3A17Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%2C%20%7B%22body%22%3A%20%22The%20deviceName%20parameter%20is%20not%20being%20passed%20to%20the%20thalireplicationmanager%27s%20start%20function%20anymore.%20The%20device-name/device-identity%20is%20already%20available%20in%20the%20thalireplicationmanager.%22%2C%20%22created_at%22%3A%20%222015-07-29T04%3A26%3A26Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/11357884%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/srichal%22%7D%7D%2C%20%7B%22body%22%3A%20%22%3A%2B1%3A%20%22%2C%20%22created_at%22%3A%20%222015-07-30T15%3A34%3A26Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20thali/thalireplicationmanager.js%3AL39-109%22%7D%2C%20%22Pull%20fe52ed1cc48102a338cad41f60d4f612e94e36c2%20thali/thalireplicationmanager.js%204%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36202862%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22Why%20introduce%20currentDeviceIdentity%20if%20we%20already%20have%20_deviceName%3F%22%2C%20%22created_at%22%3A%20%222015-08-04T15%3A36%3A10Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%2C%20%7B%22body%22%3A%20%22Fixed.%22%2C%20%22created_at%22%3A%20%222015-08-05T00%3A42%3A02Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/11357884%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/srichal%22%7D%7D%2C%20%7B%22body%22%3A%20%22%3A%2B1%3A%20%22%2C%20%22created_at%22%3A%20%222015-08-06T16%3A26%3A13Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20thali/thalireplicationmanager.js%3AL7-15%22%7D%2C%20%22Pull%20698ba1fa9d67efe22e5656685e995b25bc42fa05%20thali/thalicryptomanager.js%2065%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35163221%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22I%20would%20restructure%20this%20code%20so%20there%20is%20one%20function%20that%20checks%20if%20the%20file%20exists%20and%20if%20not%20creates%20it%20and%20if%20so%20returns%20it.%20So%20in%20either%20case%20the%20function%20will%20return%20the%20file%20contents.%20Then%20I%20would%20have%20code%20that%20takes%20the%20returned%20value%20and%20gets%20the%20public%20key%20and%20generates%20the%20hash.%20that%20way%20we%20wouldn%27t%20have%20identical%20code%20in%20two%20places%20like%20we%20have%20in%2039-46%20and%2065-72%20and%20I%20think%20the%20code%20would%20be%20easier%20to%20read.%22%2C%20%22created_at%22%3A%20%222015-07-21T22%3A39%3A17Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%2C%20%7B%22body%22%3A%20%22Fixed%20as%20suggested.%22%2C%20%22created_at%22%3A%20%222015-07-23T02%3A13%3A04Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/11357884%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/srichal%22%7D%7D%2C%20%7B%22body%22%3A%20%22%3A%2B1%3A%20%22%2C%20%22created_at%22%3A%20%222015-07-30T15%3A27%3A41Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20thali/thalicryptomanager.js%3AL1-95%22%7D%2C%20%22Pull%20698ba1fa9d67efe22e5656685e995b25bc42fa05%20thali/thalicryptomanager.js%2025%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35162586%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22We%20should%20follow%20the%20usual%20node.js%20convention%20of%20returning%20an%20error%20in%20the%20first%20argument%20and%20success%20information%20in%20the%20second%20argument.%20So%20we%20should%20be%20returning%20an%20error%20string%20in%20the%20first%20argument%20here%20not%20null.%22%2C%20%22created_at%22%3A%20%222015-07-21T22%3A31%3A10Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%2C%20%7B%22body%22%3A%20%22Correct%2C%20it%20must%20be%20in%20the%20form%20of%20%60cb%28err%2C%20...args%29%60%20where%20the%20error%20is%20always%20first%20even%20if%20null/undefined%2C%20meaning%20%60cb%28%29%60%20is%20perfectly%20valid%20if%20there%20are%20no%20errors%20and%20no%20return%20value.%22%2C%20%22created_at%22%3A%20%222015-07-22T15%3A49%3A22Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/49051%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/mattpodwysocki%22%7D%7D%2C%20%7B%22body%22%3A%20%22Fixed%20as%20per%20comments.%22%2C%20%22created_at%22%3A%20%222015-07-23T00%3A44%3A48Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/11357884%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/srichal%22%7D%7D%2C%20%7B%22body%22%3A%20%22%3A%2B1%3A%20%22%2C%20%22created_at%22%3A%20%222015-07-30T15%3A25%3A26Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20thali/thalicryptomanager.js%3AL1-95%22%7D%2C%20%22Pull%20698ba1fa9d67efe22e5656685e995b25bc42fa05%20thali/thalicryptomanager.js%2027%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35162646%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22Typically%20just%20concatenating%20paths%20isn%27t%20safe%20across%20OS%27s.%20I%20think%20Node.js%20has%20a%20function%20somewhere%20in%20FS%20to%20handle%20safe%20file%20concatenation.%20Can%20you%20please%20find%20it%20and%20use%20it%3F%22%2C%20%22created_at%22%3A%20%222015-07-21T22%3A32%3A03Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%2C%20%7B%22body%22%3A%20%22Yes%2C%20use%20%60path.join%60%20https%3A//nodejs.org/api/path.html%23path_path_join_path1_path2%22%2C%20%22created_at%22%3A%20%222015-07-22T15%3A48%3A06Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/49051%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/mattpodwysocki%22%7D%7D%2C%20%7B%22body%22%3A%20%22Fixed%20as%20per%20comments.%22%2C%20%22created_at%22%3A%20%222015-07-23T00%3A48%3A33Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/11357884%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/srichal%22%7D%7D%2C%20%7B%22body%22%3A%20%22%3A%2B1%3A%20%22%2C%20%22created_at%22%3A%20%222015-07-30T15%3A26%3A18Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20thali/thalicryptomanager.js%3AL1-95%22%7D%2C%20%22Pull%20798cc92aa9292c2a0b542ef7a65abdfe897f3890%20thali/thalicryptomanager.js%2095%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35883211%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22/piblic/public%22%2C%20%22created_at%22%3A%20%222015-07-30T15%3A28%3A12Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%2C%20%7B%22body%22%3A%20%22fixed.%22%2C%20%22created_at%22%3A%20%222015-08-04T03%3A13%3A10Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/11357884%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/srichal%22%7D%7D%2C%20%7B%22body%22%3A%20%22%3A%2B1%3A%20%22%2C%20%22created_at%22%3A%20%222015-08-04T16%3A00%3A10Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20thali/thalicryptomanager.js%3AL1-105%22%7D%2C%20%22Pull%20798cc92aa9292c2a0b542ef7a65abdfe897f3890%20thali/thalicryptomanager.js%2093%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35883387%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22In%20general%20you%20don%27t%20need%20to%20document%20internal%20functions%20and%20you%20especially%20don%27t%20need%20to%20document%20such%20a%20short%20function.%20Typically%20headers%20like%20this%20are%20only%20needed%20on%20public%20functions%20or%20on%20functions%20that%20do%20something%20really%20confusing%20and%20so%20could%20benefit%20from%20extra%20explanation.%20Remember%2C%20comments%20rot.%20So%20we%20only%20want%20to%20use%20them%20when%20the%20value%20they%20bring%20is%20greater%20than%20the%20cost%20of%20maintaining%20them.%22%2C%20%22created_at%22%3A%20%222015-07-30T15%3A29%3A22Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%2C%20%7B%22body%22%3A%20%22Removed%20the%20documentation.%22%2C%20%22created_at%22%3A%20%222015-08-04T03%3A14%3A29Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/11357884%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/srichal%22%7D%7D%2C%20%7B%22body%22%3A%20%22%3A%2B1%3A%20%22%2C%20%22created_at%22%3A%20%222015-08-04T16%3A00%3A32Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20thali/thalicryptomanager.js%3AL1-105%22%7D%2C%20%22Pull%203a38f2bfffb4b26172d4c0ce9864a2ddd1d2c750%20thali/thalicryptomanager.js%2018%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35378189%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22This%20description%20is%20not%20correct.%20It%20would%20be%20better%20to%20use%20a%20correct%20description%20which%20is%20that%20this%20function%20looks%20for%20a%20pkcs12%20file%20in%20a%20known%20location%20and%20will%20create%20it%20if%20it%20doesn%27t%20exist%20and%20then%20extract%20the%20public%20key%20and%20return%20its%20SHA256%20hash.%22%2C%20%22created_at%22%3A%20%222015-07-23T22%3A15%3A24Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%2C%20%7B%22body%22%3A%20%22%3A%2B1%3A%20%22%2C%20%22created_at%22%3A%20%222015-07-30T15%3A30%3A44Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20thali/thalicryptomanager.js%3AL1-103%22%7D%2C%20%22Pull%203a38f2bfffb4b26172d4c0ce9864a2ddd1d2c750%20thali/thalicryptomanager.js%2019%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35378404%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22Why%20doesn%27t%20the%20JSDoc%20specify%20the%20callback%3F%20See%20http%3A//usejsdoc.org/tags-callback.html%22%2C%20%22created_at%22%3A%20%222015-07-23T22%3A17%3A57Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%2C%20%7B%22body%22%3A%20%22%3A%2B1%3A%20%22%2C%20%22created_at%22%3A%20%222015-07-30T15%3A33%3A26Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20thali/thalicryptomanager.js%3AL1-103%22%7D%2C%20%22Pull%20fe52ed1cc48102a338cad41f60d4f612e94e36c2%20thali/thalireplicationmanager.js%2066%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36203065%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22Why%20are%20you%20requiring%20this%20down%20here%20rather%20than%20at%20the%20top%20of%20the%20file%3F%22%2C%20%22created_at%22%3A%20%222015-08-04T15%3A37%3A47Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%2C%20%7B%22body%22%3A%20%22Moved%20the%20getDeviceIdentity%20function%20to%20the%20top%20of%20the%20file.%22%2C%20%22created_at%22%3A%20%222015-08-05T00%3A42%3A40Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/11357884%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/srichal%22%7D%7D%2C%20%7B%22body%22%3A%20%22I%20wasn%27t%20referring%20to%20the%20function%20definition.%20I%20was%20referring%20to%20your%20use%20of%20require%28%27./thalicryptomanager%27%29.%20Generally%20it%20is%20considered%20good%20practice%20to%20put%20require%20statements%20at%20the%20top%20of%20the%20file.%20See%20http%3A//justbuildsomething.com/node-js-best-practices/%232%20for%20an%20example%20why.%22%2C%20%22created_at%22%3A%20%222015-08-06T16%3A29%3A45Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20thali/thalireplicationmanager.js%3AL113-141%22%7D%2C%20%22Pull%20fe52ed1cc48102a338cad41f60d4f612e94e36c2%20thali/thalireplicationmanager.js%2067%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36203092%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22Please%20remove%20this%20comment.%20When%20the%20function%20is%20called%20%27getPublicKeyHash%27%20it%27s%20pretty%20clear%20what%27s%20going%20on.%22%2C%20%22created_at%22%3A%20%222015-08-04T15%3A38%3A08Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%2C%20%7B%22body%22%3A%20%22Done.%22%2C%20%22created_at%22%3A%20%222015-08-05T00%3A42%3A55Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/11357884%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/srichal%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20thali/thalireplicationmanager.js%3AL113-141%22%7D%2C%20%22Pull%20fe52ed1cc48102a338cad41f60d4f612e94e36c2%20thali/thalireplicationmanager.js%2068%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36205733%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22Assuming%20you%20make%20the%20change%20I%20talked%20about%20in%20the%20the%20crypto%20file%20to%20deal%20with%20the%20race%20condition%20we%20still%20have%20a%20problem%20with%20this%20code.%20Which%20is%20that%20if%20the%20function%20gets%20called%20twice%20when%20there%20is%20no%20existing%20PKCS12%20file%20then%20one%20of%20the%20two%20calls%20can%20end%20up%20with%20an%20error%20because%20the%20underlying%20write%20failed.%20That%20sort%20of%20thing%20shouldn%27t%20be%20visible%20%28or%20be%20a%20concern%29%20for%20someone%20calling%20getDeviceIdentity.%5Cr%5Cn%5Cr%5CnThe%20problem%20is%20that%20fixing%20this%20is%20tricky%20because%20it%27s%20possible%20that%20when%20the%20error%20is%20returned%20the%20PKCS12%20file%20may%20have%20been%20created%20but%20currentDeviceIdentity%20hasn%27t%20been%20set%20yet.%5Cr%5Cn%5Cr%5CnThere%20are%20several%20traditional%20ways%20to%20deal%20with%20this%20in%20Node.js%20land%20-%20%5Cr%5Cn%5Cr%5CnPromises%20-%20We%20could%20use%20promises%20to%20work%20around%20this%20by%20creating%20a%20promise%20to%20retrieve%20the%20public%20key%20from%20the%20file%20and%20then%20adding%20any%20cbs%20to%20a%20then%20on%20that%20promise.%20They%20will%20then%20automatically%20be%20run%20once%20the%20ID%20is%20returned.%20But%20I%20don%27t%20think%20it%27s%20worth%20adding%20the%20promises%20library%20%28we%20are%20using%20lie%29%20just%20to%20solve%20this%20one%20issue.%5Cr%5Cn%5Cr%5CnFlags%20-%20Another%20traditional%20approach%20is%20some%20kind%20of%20state%20flag.%20You%20set%20the%20flag%20initially%20to%20%27noDeviceIdentitySet%27%20and%20then%20when%20the%20first%20call%20is%20made%20to%20getDeviceIdentity%20this%20will%20cause%20you%20to%20set%20the%20flag%20to%20%27gettingDeviceKey%27%20and%20you%20will%20then%20make%20the%20call%20to%20getPublicKeyHash.%20Any%20calls%20to%20getDeviceIdentity%20while%20the%20flag%20is%20set%20to%20%27gettingDeviceKey%27%20will%20just%20have%20their%20cb%20added%20to%20a%20cb%20array.%20When%20getPublicKeyHash%20returns%20then%20you%20would%20set%20the%20flag%20to%20%27deviceKeyAvailable%27%20and%20you%20would%20call%20all%20the%20cbs%20in%20the%20arrays.%20Any%20future%20calls%20to%20getDeviceIdentity%20would%20just%20immediately%20return%20the%20value%20since%20the%20state%20is%20%27deviceKeyAvailable%27.%5Cr%5Cn%5Cr%5CnEvent%20Emitter%20-%20The%20third%20approach%20is%20to%20use%20an%20event%20emitter.%20This%20is%20a%20bit%20more%20complicated%20but%20basically%20you%20could%20attach%20the%20CBs%20as%20a%20listener%20to%20the%20event%20emitter%20and%20once%20the%20key%20is%20available%20then%20you%20would%20emit%20the%20event%20which%20would%20trigger%20the%20CBs.%20You%20would%20also%20need%20to%20check%20if%20the%20device%20identity%20is%20already%20available%20and%20skip%20the%20emitter%20all%20together%20in%20that%20case.%20Honestly%20I%20think%20this%20is%20more%20work%20than%20it%27s%20worth.%5Cr%5Cn%5Cr%5CnSo%20my%20suggestion%20would%20be%20the%20flag%20approach.%5Cr%5Cn%5Cr%5Cn%40mattpodwysocki%20-%20What%20do%20you%20think%20is%20the%20best%20way%20to%20handle%20this%20race%20condition%3F%20Or%20is%20there%20no%20race%20condition%20and%20I%27m%20just%20hallucinating%3F%22%2C%20%22created_at%22%3A%20%222015-08-04T15%3A58%3A38Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%2C%20%7B%22body%22%3A%20%22Fixed%20using%20flags.%22%2C%20%22created_at%22%3A%20%222015-08-05T22%3A59%3A56Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/11357884%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/srichal%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20thali/thalireplicationmanager.js%3AL113-141%22%7D%2C%20%22Pull%203a38f2bfffb4b26172d4c0ce9864a2ddd1d2c750%20thali/thalireplicationmanager.js%2070%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35379283%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22Please%20don%27t%20check%20into%20story%20main%20with%20a%20todo%20like%20this.%20Please%20add%20in%20the%20error%20handler%21%22%2C%20%22created_at%22%3A%20%222015-07-23T22%3A28%3A42Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%2C%20%7B%22body%22%3A%20%22This%20entire%20DB%20operation%20has%20been%20moved%20to%20the%20app.%20I%20also%20handled%20the%20DB%20operation%20error%20there.%22%2C%20%22created_at%22%3A%20%222015-07-29T04%3A24%3A05Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/11357884%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/srichal%22%7D%7D%2C%20%7B%22body%22%3A%20%22%3A%2B1%3A%20%22%2C%20%22created_at%22%3A%20%222015-07-30T15%3A38%3A14Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20thali/thalireplicationmanager.js%3AL39-109%22%7D%2C%20%22Pull%20fe52ed1cc48102a338cad41f60d4f612e94e36c2%20thali/thalicryptomanager.js%2092%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36204257%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22I%20believe%20this%20code%20suffers%20from%20a%20very%20nasty%20race%20condition%21%20Imagine%20that%20two%20people%20call%20getPKCS12Content%20at%20the%20same%20time%20%28this%20can%20easily%20happen%20if%20two%20calls%20to%20getDeviceIdentity%20are%20made%29%20and%20the%20PKCS12%20file%20doesn%27t%20exist%20yet.%20In%20that%20case%20both%20calls%20can%20get%20false%20on%20line%2070%20%28since%20exists%20is%20an%20async%20function%29%20and%20both%20calls%20can%20successfully%20get%20to%20line%2092%20and%20both%20will%20succeed%20on%20line%2092%20%28since%20writeFile%20is%20async%20and%20explicitly%20overwrites%20if%20the%20file%20already%20exists%29%20and%20so%20there%20will%20be%20two%20callbacks%20with%20two%20difference%20public%20keys%20for%20the%20same%20device%21%5Cr%5Cn%5Cr%5CnThankfully%20I%20think%20there%20is%20a%20pretty%20easy%20fix.%20If%20you%20pass%20in%20the%20%5C%22wx%5C%22%20flag%20to%20writeFile%20then%20it%20should%20fail%20if%20the%20file%20already%20exists.%20In%20that%20case%20exactly%20one%20of%20the%20two%20calls%20would%20succeed%20on%20the%20write%2C%20the%20other%20would%20get%20a%20file%20exists%20error.%22%2C%20%22created_at%22%3A%20%222015-08-04T15%3A47%3A04Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%2C%20%7B%22body%22%3A%20%22The%20fix%20will%20not%20work%20entirely...%20The%202nd%20call%20to%20writeFile%20will%20fail%20as%20you%20explained.%20But%20the%202nd%20guy%20who%20called%20getPKCS12Content%20will%20not%20get%20the%20content%20and%20thus%20will%20not%20get%20the%20public%20key%20hash.%5Cr%5Cn%5Cr%5CnThis%20is%20better%20than%20having%20two%20different%20public%20keys%20for%20the%20same%20device%20but%20the%202nd%20guy%20will%20have%20to%20retry%20by%20calling%20getPublicKeyHash%20again.%22%2C%20%22created_at%22%3A%20%222015-08-05T00%3A28%3A49Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/11357884%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/srichal%22%7D%7D%2C%20%7B%22body%22%3A%20%22Please%20ignore%20my%20above%20comment.%20You%20already%20mentioned%20the%20issue%20below.%22%2C%20%22created_at%22%3A%20%222015-08-05T00%3A44%3A25Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/11357884%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/srichal%22%7D%7D%2C%20%7B%22body%22%3A%20%22Fixed%20as%20suggested.%22%2C%20%22created_at%22%3A%20%222015-08-05T00%3A44%3A43Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/11357884%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/srichal%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20thali/thalicryptomanager.js%3AL1-111%22%7D%2C%20%22Pull%20fe52ed1cc48102a338cad41f60d4f612e94e36c2%20thali/thalireplicationmanager.js%2048%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36202957%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22Please%20remove%20the%20comment%20on%20line%2070%20and%2071.%20This%20is%20just%20the%20kind%20of%20comment%20that%20rots%20really%20quickly%20as%20soon%20as%20there%20is%20an%20edit.%20We%20have%20IDEs%20to%20handle%20matching%20squiggly%20braces.%22%2C%20%22created_at%22%3A%20%222015-08-04T15%3A36%3A52Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%2C%20%7B%22body%22%3A%20%22Fixed.%22%2C%20%22created_at%22%3A%20%222015-08-05T00%3A42%3A15Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/11357884%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/srichal%22%7D%7D%2C%20%7B%22body%22%3A%20%22%3A%2B1%3A%20%22%2C%20%22created_at%22%3A%20%222015-08-06T16%3A27%3A01Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20thali/thalireplicationmanager.js%3AL67-75%22%7D%2C%20%22Pull%209d917e15deeebffdf5e86405cb7dbf3189ad2022%20thali/thalireplicationmanager.js%2082%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r36434831%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22I%20apologize%20if%20I%27m%20missing%20something%20but%20I%20don%27t%20see%20a%20check%20anywhere%20here%20that%20this._deviceName%20is%20actually%20set.%20There%20seems%20to%20be%20an%20assumption%20that%20getDeviceIdentity%20will%20always%20be%20called%20before%20start.%20That%20seems%20like%20a%20dangerous%20assumption%20to%20make.%20If%20in%20fact%20we%20are%20making%20that%20assumption%20then%20I%20would%20suggest%20that%20code%20should%20be%20%27fail%20safe%27.%20That%20is%2C%20either%20start%20should%20fail%20if%20getDeviceIdentity%20hasn%27t%20been%20called%20or%20we%20should%20build%20getDeviceIdentity%20into%20start%20just%20to%20make%20sure.%20The%20later%20seems%20preferable.%5Cr%5Cn%5Cr%5CnSorry%20if%20I%20missed%20where%20deviceName%20was%20guaranteed%20to%20be%20set.%22%2C%20%22created_at%22%3A%20%222015-08-06T16%3A26%3A06Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20thali/thalireplicationmanager.js%3AL47-101%22%7D%2C%20%22Pull%203a38f2bfffb4b26172d4c0ce9864a2ddd1d2c750%20thali/thalicryptomanager.js%208%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/thaliproject/Thali_CordovaPlugin/pull/41%23discussion_r35377318%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22Please%20put%20in%20a%20comment%20specifying%20that%20we%20use%20a%20bogus%20password%20because%20using%20a%20password%20at%20all%20is%20bogus.%20Anyone%20who%20can%20get%20to%20the%20file%20can%20get%20to%20the%20app%20and%20thus%20can%20get%20the%20password.%20So%20we%20just%20include%20something%20because%20the%20API%20expects%20it.%20If%20and%20when%20mobile%20devices%20start%20having%20secure%20key%20stores%20that%20are%20tagged%20to%20app%20IDs%20then%20we%20can%20discuss%20using%20a%20real%20password.%22%2C%20%22created_at%22%3A%20%222015-07-23T22%3A05%3A11Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%2C%20%7B%22body%22%3A%20%22I%27ll%20go%20file%20an%20issue%20that%20we%20really%20should%20be%20using%20the%20key%20stores%20on%20both%20iOS%20and%20Android.%20But%20keep%20in%20mind%20that%20this%20only%20provides%20a%20nominal%20security%20benefit%20since%20no%20secure%20hardware%20is%20being%20used.%20Instead%20what%20it%20does%20it%20store%20the%20keys%20in%20an%20encrypted%20file%20based%20off%20the%20device%27s%20key.%20This%20does%20provide%20some%20%28tiny%29%20level%20of%20protection%20for%20unencrypted%20devices.%20For%20devices%20that%20encrypt%20their%20drives%20it%20provides%20no%20meaningful%20protection.%20As%20such%20I%20think%20adding%20in%20support%20for%20local%20keystores%20is%20low%20priority.%22%2C%20%22created_at%22%3A%20%222015-07-23T22%3A08%3A43Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%2C%20%7B%22body%22%3A%20%22I%20don%27t%20see%20a%20comment.%22%2C%20%22created_at%22%3A%20%222015-07-30T15%3A30%3A00Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%2C%20%7B%22body%22%3A%20%22The%20comment%20was%20added%20in%20a%20different%20place.%20Now%20moved%20it%20here.%22%2C%20%22created_at%22%3A%20%222015-08-04T03%3A25%3A13Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/11357884%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/srichal%22%7D%7D%2C%20%7B%22body%22%3A%20%22%3A%2B1%3A%20%22%2C%20%22created_at%22%3A%20%222015-08-04T15%3A59%3A06Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1480964%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/yaronyg%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20thali/thalicryptomanager.js%3AL1-103%22%7D%7D%7D'></a>\n<a href='https://www.codereviewhub.com/'><img src='http://www.codereviewhub.com/site/github-bar.png' height=40></a>\n- [ ] <a href='#crh-comment-Pull fe52ed1cc48102a338cad41f60d4f612e94e36c2 thali/thalireplicationmanager.js 66'></a> <img src='http://www.codereviewhub.com/site/github-remaining.png' height=16 width=60>&nbsp;<b><a href='https://github.com/thaliproject/Thali_CordovaPlugin/pull/41#discussion_r36203065'>File: thali/thalireplicationmanager.js:L113-141</a></b>\n- <a href='https://github.com/yaronyg'><img border=0 src='https://avatars.githubusercontent.com/u/1480964?v=3' height=16 width=16'></a> Why are you requiring this down here rather than at the top of the file?\n- <a href='https://github.com/srichal'><img border=0 src='https://avatars.githubusercontent.com/u/11357884?v=3' height=16 width=16'></a> Moved the getDeviceIdentity function to the top of the file.\n- <a href='https://github.com/yaronyg'><img border=0 src='https://avatars.githubusercontent.com/u/1480964?v=3' height=16 width=16'></a> I wasn't referring to the function definition. I was referring to your use of require('./thalicryptomanager'). Generally it is considered good practice to put require statements at the top of the file. See http://justbuildsomething.com/node-js-best-practices/#2 for an example why.\n- [ ] <a href='#crh-comment-Pull fe52ed1cc48102a338cad41f60d4f612e94e36c2 thali/thalireplicationmanager.js 67'></a> <img src='http://www.codereviewhub.com/site/github-remaining.png' height=16 width=60>&nbsp;<b><a href='https://github.com/thaliproject/Thali_CordovaPlugin/pull/41#discussion_r36203092'>File: thali/thalireplicationmanager.js:L113-141</a></b>\n- <a href='https://github.com/yaronyg'><img border=0 src='https://avatars.githubusercontent.com/u/1480964?v=3' height=16 width=16'></a> Please remove this comment. When the function is called 'getPublicKeyHash' it's pretty clear what's going on.\n- <a href='https://github.com/srichal'><img border=0 src='https://avatars.githubusercontent.com/u/11357884?v=3' height=16 width=16'></a> Done.\n- [ ] <a href='#crh-comment-Pull fe52ed1cc48102a338cad41f60d4f612e94e36c2 thali/thalicryptomanager.js 92'></a> <img src='http://www.codereviewhub.com/site/github-remaining.png' height=16 width=60>&nbsp;<b><a href='https://github.com/thaliproject/Thali_CordovaPlugin/pull/41#discussion_r36204257'>File: thali/thalicryptomanager.js:L1-111</a></b>\n- <a href='https://github.com/yaronyg'><img border=0 src='https://avatars.githubusercontent.com/u/1480964?v=3' height=16 width=16'></a> I believe this code suffers from a very nasty race condition! Imagine that two people call getPKCS12Content at the same time (this can easily happen if two calls to getDeviceIdentity are made) and the PKCS12 file doesn't exist yet. In that case both calls can get false on line 70 (since exists is an async function) and both calls can successfully get to line 92 and both will succeed on line 92 (since writeFile is async and explicitly overwrites if the file already exists) and so there will be two callbacks with two difference public keys for the same device!\nThankfully I think there is a pretty easy fix. If you pass in the \"wx\" flag to writeFile then it should fail if the file already exists. In that case exactly one of the two calls would succeed on the write, the other would get a file exists error.\n- <a href='https://github.com/srichal'><img border=0 src='https://avatars.githubusercontent.com/u/11357884?v=3' height=16 width=16'></a> The fix will not work entirely... The 2nd call to writeFile will fail as you explained. But the 2nd guy who called getPKCS12Content will not get the content and thus will not get the public key hash.\nThis is better than having two different public keys for the same device but the 2nd guy will have to retry by calling getPublicKeyHash again.\n- <a href='https://github.com/srichal'><img border=0 src='https://avatars.githubusercontent.com/u/11357884?v=3' height=16 width=16'></a> Please ignore my above comment. You already mentioned the issue below.\n- <a href='https://github.com/srichal'><img border=0 src='https://avatars.githubusercontent.com/u/11357884?v=3' height=16 width=16'></a> Fixed as suggested.\n- [ ] <a href='#crh-comment-Pull fe52ed1cc48102a338cad41f60d4f612e94e36c2 thali/thalireplicationmanager.js 68'></a> <img src='http://www.codereviewhub.com/site/github-remaining.png' height=16 width=60>&nbsp;<b><a href='https://github.com/thaliproject/Thali_CordovaPlugin/pull/41#discussion_r36205733'>File: thali/thalireplicationmanager.js:L113-141</a></b>\n- <a href='https://github.com/yaronyg'><img border=0 src='https://avatars.githubusercontent.com/u/1480964?v=3' height=16 width=16'></a> Assuming you make the change I talked about in the the crypto file to deal with the race condition we still have a problem with this code. Which is that if the function gets called twice when there is no existing PKCS12 file then one of the two calls can end up with an error because the underlying write failed. That sort of thing shouldn't be visible (or be a concern) for someone calling getDeviceIdentity.\nThe problem is that fixing this is tricky because it's possible that when the error is returned the PKCS12 file may have been created but currentDeviceIdentity hasn't been set yet.\nThere are several traditional ways to deal with this in Node.js land -\nPromises - We could use promises to work around this by creating a promise to retrieve the public key from the file and then adding any cbs to a then on that promise. They will then automatically be run once the ID is returned. But I don't think it's worth adding the promises library (we are using lie) just to solve this one issue.\nFlags - Another traditional approach is some kind of state flag. You set the flag initially to 'noDeviceIdentitySet' and then when the first call is made to getDeviceIdentity this will cause you to set the flag to 'gettingDeviceKey' and you will then make the call to getPublicKeyHash. Any calls to getDeviceIdentity while the flag is set to 'gettingDeviceKey' will just have their cb added to a cb array. When getPublicKeyHash returns then you would set the flag to 'deviceKeyAvailable' and you would call all the cbs in the arrays. Any future calls to getDeviceIdentity would just immediately return the value since the state is 'deviceKeyAvailable'.\nEvent Emitter - The third approach is to use an event emitter. This is a bit more complicated but basically you could attach the CBs as a listener to the event emitter and once the key is available then you would emit the event which would trigger the CBs. You would also need to check if the device identity is already available and skip the emitter all together in that case. Honestly I think this is more work than it's worth.\nSo my suggestion would be the flag approach.\n@mattpodwysocki - What do you think is the best way to handle this race condition? Or is there no race condition and I'm just hallucinating?\n- <a href='https://github.com/srichal'><img border=0 src='https://avatars.githubusercontent.com/u/11357884?v=3' height=16 width=16'></a> Fixed using flags.\n- [ ] <a href='#crh-comment-Pull 9d917e15deeebffdf5e86405cb7dbf3189ad2022 thali/thalireplicationmanager.js 82'></a> <img src='http://www.codereviewhub.com/site/github-remaining.png' height=16 width=60>&nbsp;<b><a href='https://github.com/thaliproject/Thali_CordovaPlugin/pull/41#discussion_r36434831'>File: thali/thalireplicationmanager.js:L47-101</a></b>\n- <a href='https://github.com/yaronyg'><img border=0 src='https://avatars.githubusercontent.com/u/1480964?v=3' height=16 width=16'></a> I apologize if I'm missing something but I don't see a check anywhere here that this._deviceName is actually set. There seems to be an assumption that getDeviceIdentity will always be called before start. That seems like a dangerous assumption to make. If in fact we are making that assumption then I would suggest that code should be 'fail safe'. That is, either start should fail if getDeviceIdentity hasn't been called or we should build getDeviceIdentity into start just to make sure. The later seems preferable.\nSorry if I missed where deviceName was guaranteed to be set.\n- [x] <a href='#crh-comment-Pull 698ba1fa9d67efe22e5656685e995b25bc42fa05 thali/thalicryptomanager.js 25'></a> <img src='http://www.codereviewhub.com/site/github-completed.png' height=16 width=60>&nbsp;<b><a href='https://github.com/thaliproject/Thali_CordovaPlugin/pull/41#discussion_r35162586'>File: thali/thalicryptomanager.js:L1-95</a></b>\n- <a href='https://github.com/yaronyg'><img border=0 src='https://avatars.githubusercontent.com/u/1480964?v=3' height=16 width=16'></a> We should follow the usual node.js convention of returning an error in the first argument and success information in the second argument. So we should be returning an error string in the first argument here not null.\n- <a href='https://github.com/mattpodwysocki'><img border=0 src='https://avatars.githubusercontent.com/u/49051?v=3' height=16 width=16'></a> Correct, it must be in the form of `cb(err, ...args)` where the error is always first even if null/undefined, meaning `cb()` is perfectly valid if there are no errors and no return value.\n- <a href='https://github.com/srichal'><img border=0 src='https://avatars.githubusercontent.com/u/11357884?v=3' height=16 width=16'></a> Fixed as per comments.\n- [x] <a href='#crh-comment-Pull 698ba1fa9d67efe22e5656685e995b25bc42fa05 thali/thalicryptomanager.js 27'></a> <img src='http://www.codereviewhub.com/site/github-completed.png' height=16 width=60>&nbsp;<b><a href='https://github.com/thaliproject/Thali_CordovaPlugin/pull/41#discussion_r35162646'>File: thali/thalicryptomanager.js:L1-95</a></b>\n- <a href='https://github.com/yaronyg'><img border=0 src='https://avatars.githubusercontent.com/u/1480964?v=3' height=16 width=16'></a> Typically just concatenating paths isn't safe across OS's. I think Node.js has a function somewhere in FS to handle safe file concatenation. Can you please find it and use it?\n- <a href='https://github.com/mattpodwysocki'><img border=0 src='https://avatars.githubusercontent.com/u/49051?v=3' height=16 width=16'></a> Yes, use `path.join` https://nodejs.org/api/path.html#path_path_join_path1_path2\n- <a href='https://github.com/srichal'><img border=0 src='https://avatars.githubusercontent.com/u/11357884?v=3' height=16 width=16'></a> Fixed as per comments.\n- [x] <a href='#crh-comment-Pull 698ba1fa9d67efe22e5656685e995b25bc42fa05 thali/thalicryptomanager.js 35'></a> <img src='http://www.codereviewhub.com/site/github-completed.png' height=16 width=60>&nbsp;<b><a href='https://github.com/thaliproject/Thali_CordovaPlugin/pull/41#discussion_r35162748'>File: thali/thalicryptomanager.js:L1-95</a></b>\n- <a href='https://github.com/yaronyg'><img border=0 src='https://avatars.githubusercontent.com/u/1480964?v=3' height=16 width=16'></a> Same callback comment as above and again in line 42 and so on.\n- <a href='https://github.com/srichal'><img border=0 src='https://avatars.githubusercontent.com/u/11357884?v=3' height=16 width=16'></a> Fixed.\n- [x] <a href='#crh-comment-Pull 698ba1fa9d67efe22e5656685e995b25bc42fa05 thali/thalicryptomanager.js 65'></a> <img src='http://www.codereviewhub.com/site/github-completed.png' height=16 width=60>&nbsp;<b><a href='https://github.com/thaliproject/Thali_CordovaPlugin/pull/41#discussion_r35163221'>File: thali/thalicryptomanager.js:L1-95</a></b>\n- <a href='https://github.com/yaronyg'><img border=0 src='https://avatars.githubusercontent.com/u/1480964?v=3' height=16 width=16'></a> I would restructure this code so there is one function that checks if the file exists and if not creates it and if so returns it. So in either case the function will return the file contents. Then I would have code that takes the returned value and gets the public key and generates the hash. that way we wouldn't have identical code in two places like we have in 39-46 and 65-72 and I think the code would be easier to read.\n- <a href='https://github.com/srichal'><img border=0 src='https://avatars.githubusercontent.com/u/11357884?v=3' height=16 width=16'></a> Fixed as suggested.\n- [x] <a href='#crh-comment-Pull 698ba1fa9d67efe22e5656685e995b25bc42fa05 thali/thalicryptomanager.js 92'></a> <img src='http://www.codereviewhub.com/site/github-completed.png' height=16 width=60>&nbsp;<b><a href='https://github.com/thaliproject/Thali_CordovaPlugin/pull/41#discussion_r35163357'>File: thali/thalicryptomanager.js:L1-95</a></b>\n- <a href='https://github.com/yaronyg'><img border=0 src='https://avatars.githubusercontent.com/u/1480964?v=3' height=16 width=16'></a> Why did you go through all the trouble to create a Buffer when you end up only using the value as a string? In fact, when would it ever be used as a buffer?\n- <a href='https://github.com/srichal'><img border=0 src='https://avatars.githubusercontent.com/u/11357884?v=3' height=16 width=16'></a> Fixed by returning a string.\n- [x] <a href='#crh-comment-Pull 3a38f2bfffb4b26172d4c0ce9864a2ddd1d2c750 thali/thalicryptomanager.js 8'></a> <img src='http://www.codereviewhub.com/site/github-completed.png' height=16 width=60>&nbsp;<b><a href='https://github.com/thaliproject/Thali_CordovaPlugin/pull/41#discussion_r35377318'>File: thali/thalicryptomanager.js:L1-103</a></b>\n- <a href='https://github.com/yaronyg'><img border=0 src='https://avatars.githubusercontent.com/u/1480964?v=3' height=16 width=16'></a> Please put in a comment specifying that we use a bogus password because using a password at all is bogus. Anyone who can get to the file can get to the app and thus can get the password. So we just include something because the API expects it. If and when mobile devices start having secure key stores that are tagged to app IDs then we can discuss using a real password.\n- <a href='https://github.com/yaronyg'><img border=0 src='https://avatars.githubusercontent.com/u/1480964?v=3' height=16 width=16'></a> I'll go file an issue that we really should be using the key stores on both iOS and Android. But keep in mind that this only provides a nominal security benefit since no secure hardware is being used. Instead what it does it store the keys in an encrypted file based off the device's key. This does provide some (tiny) level of protection for unencrypted devices. For devices that encrypt their drives it provides no meaningful protection. As such I think adding in support for local keystores is low priority.\n- <a href='https://github.com/yaronyg'><img border=0 src='https://avatars.githubusercontent.com/u/1480964?v=3' height=16 width=16'></a> I don't see a comment.\n- <a href='https://github.com/srichal'><img border=0 src='https://avatars.githubusercontent.com/u/11357884?v=3' height=16 width=16'></a> The comment was added in a different place. Now moved it here.\n- [x] <a href='#crh-comment-Pull 3a38f2bfffb4b26172d4c0ce9864a2ddd1d2c750 thali/thalicryptomanager.js 18'></a> <img src='http://www.codereviewhub.com/site/github-completed.png' height=16 width=60>&nbsp;<b><a href='https://github.com/thaliproject/Thali_CordovaPlugin/pull/41#discussion_r35378189'>File: thali/thalicryptomanager.js:L1-103</a></b>\n- <a href='https://github.com/yaronyg'><img border=0 src='https://avatars.githubusercontent.com/u/1480964?v=3' height=16 width=16'></a> This description is not correct. It would be better to use a correct description which is that this function looks for a pkcs12 file in a known location and will create it if it doesn't exist and then extract the public key and return its SHA256 hash.\n- [x] <a href='#crh-comment-Pull 3a38f2bfffb4b26172d4c0ce9864a2ddd1d2c750 thali/thalicryptomanager.js 40'></a> <img src='http://www.codereviewhub.com/site/github-completed.png' height=16 width=60>&nbsp;<b><a href='https://github.com/thaliproject/Thali_CordovaPlugin/pull/41#discussion_r35378331'>File: thali/thalicryptomanager.js:L1-103</a></b>\n- <a href='https://github.com/yaronyg'><img border=0 src='https://avatars.githubusercontent.com/u/1480964?v=3' height=16 width=16'></a> Is this really necessary in the log? Please review your console.log statements and ask yourself \"Will anyone benefit by adding all of this to the log?\" The more stuff is in the log the harder it is to use for much of anything. We already have a work item to add some kind of log leveling but we aren't there yet.\n- [x] <a href='#crh-comment-Pull 3a38f2bfffb4b26172d4c0ce9864a2ddd1d2c750 thali/thalicryptomanager.js 19'></a> <img src='http://www.codereviewhub.com/site/github-completed.png' height=16 width=60>&nbsp;<b><a href='https://github.com/thaliproject/Thali_CordovaPlugin/pull/41#discussion_r35378404'>File: thali/thalicryptomanager.js:L1-103</a></b>\n- <a href='https://github.com/yaronyg'><img border=0 src='https://avatars.githubusercontent.com/u/1480964?v=3' height=16 width=16'></a> Why doesn't the JSDoc specify the callback? See http://usejsdoc.org/tags-callback.html\n- [x] <a href='#crh-comment-Pull 3a38f2bfffb4b26172d4c0ce9864a2ddd1d2c750 thali/thalireplicationmanager.js 15'></a> <img src='http://www.codereviewhub.com/site/github-completed.png' height=16 width=60>&nbsp;<b><a href='https://github.com/thaliproject/Thali_CordovaPlugin/pull/41#discussion_r35378529'>File: thali/thalireplicationmanager.js:L39-109</a></b>\n- <a href='https://github.com/yaronyg'><img border=0 src='https://avatars.githubusercontent.com/u/1480964?v=3' height=16 width=16'></a> Where is the jsdoc for deviceName?\n- <a href='https://github.com/srichal'><img border=0 src='https://avatars.githubusercontent.com/u/11357884?v=3' height=16 width=16'></a> The deviceName parameter is not being passed to the thalireplicationmanager's start function anymore. The device-name/device-identity is already available in the thalireplicationmanager.\n- [x] <a href='#crh-comment-Pull 3a38f2bfffb4b26172d4c0ce9864a2ddd1d2c750 thali/thalireplicationmanager.js 4'></a> <img src='http://www.codereviewhub.com/site/github-completed.png' height=16 width=60>&nbsp;<b><a href='https://github.com/thaliproject/Thali_CordovaPlugin/pull/41#discussion_r35378731'>File: thali/thalireplicationmanager.js:L6-13</a></b>\n- <a href='https://github.com/yaronyg'><img border=0 src='https://avatars.githubusercontent.com/u/1480964?v=3' height=16 width=16'></a> Why is addressPrefix in the thalireplicationmanager? That is something that is specific to the postcardapp. It is not generic to Thali at all. It shouldn't be Thali_CordovaPlugin, it should be in postcardapp.\n- <a href='https://github.com/srichal'><img border=0 src='https://avatars.githubusercontent.com/u/11357884?v=3' height=16 width=16'></a> Fixed as part of the redesign where the thalireplicationmanager does not add anything o the DB.\n- [x] <a href='#crh-comment-Pull 3a38f2bfffb4b26172d4c0ce9864a2ddd1d2c750 thali/thalireplicationmanager.js 43'></a> <img src='http://www.codereviewhub.com/site/github-completed.png' height=16 width=60>&nbsp;<b><a href='https://github.com/thaliproject/Thali_CordovaPlugin/pull/41#discussion_r35379003'>File: thali/thalireplicationmanager.js:L39-109</a></b>\n- <a href='https://github.com/yaronyg'><img border=0 src='https://avatars.githubusercontent.com/u/1480964?v=3' height=16 width=16'></a> This should not be here per my previous comment. I think it makes sense for the cryptomanager to be here. I think it makes sense for the cryptomanager to be part of start up (after all, you can't do replication with an identity). I even think it makes sense for the cryptomanager to get the publickeyhash. But that is where it ends. That publickeyhash should be available as a property identifying the current device but that's it. It should be up to the postcardapp to then get that publickeyhash and use it for something.\nPlease propose a design for how we can expose the publickeyhash all the way to the postcardapp in a manner that makes logical sense.\n- <a href='https://github.com/srichal'><img border=0 src='https://avatars.githubusercontent.com/u/11357884?v=3' height=16 width=16'></a> Completed the redesign as proposed.\n- [x] <a href='#crh-comment-Pull 3a38f2bfffb4b26172d4c0ce9864a2ddd1d2c750 thali/thalireplicationmanager.js 61'></a> <img src='http://www.codereviewhub.com/site/github-completed.png' height=16 width=60>&nbsp;<b><a href='https://github.com/thaliproject/Thali_CordovaPlugin/pull/41#discussion_r35379157'>File: thali/thalireplicationmanager.js:L39-109</a></b>\n- <a href='https://github.com/yaronyg'><img border=0 src='https://avatars.githubusercontent.com/u/1480964?v=3' height=16 width=16'></a> Again, this is postcardapp specific. It's not generic to Thali. I do believe that eventually Thali should have a central address book store and when we work on ACLs and identity exchange we will add one. But for now the thali replication manager can only handle one DB at a time so we agreed to put the addressbook entries in it but that should be an app level (e.g. postcardapp) consideration, not a Thali_CordovaPlugin consideration.\n- <a href='https://github.com/srichal'><img border=0 src='https://avatars.githubusercontent.com/u/11357884?v=3' height=16 width=16'></a> Fixed as part of the redesign.\n- [x] <a href='#crh-comment-Pull 3a38f2bfffb4b26172d4c0ce9864a2ddd1d2c750 thali/thalireplicationmanager.js 60'></a> <img src='http://www.codereviewhub.com/site/github-completed.png' height=16 width=60>&nbsp;<b><a href='https://github.com/thaliproject/Thali_CordovaPlugin/pull/41#discussion_r35379212'>File: thali/thalireplicationmanager.js:L39-109</a></b>\n- <a href='https://github.com/yaronyg'><img border=0 src='https://avatars.githubusercontent.com/u/1480964?v=3' height=16 width=16'></a> There should be 2, not 3 ds in Addr. Actually it's generally not recommended to use abbreviations. Now that we have auto-complete in our IDEs it's better to just use the full word, e.g. currentAddressFound.\n- <a href='https://github.com/srichal'><img border=0 src='https://avatars.githubusercontent.com/u/11357884?v=3' height=16 width=16'></a> I am not using abbreviations anymore.\n- [x] <a href='#crh-comment-Pull 3a38f2bfffb4b26172d4c0ce9864a2ddd1d2c750 thali/thalireplicationmanager.js 70'></a> <img src='http://www.codereviewhub.com/site/github-completed.png' height=16 width=60>&nbsp;<b><a href='https://github.com/thaliproject/Thali_CordovaPlugin/pull/41#discussion_r35379283'>File: thali/thalireplicationmanager.js:L39-109</a></b>\n- <a href='https://github.com/yaronyg'><img border=0 src='https://avatars.githubusercontent.com/u/1480964?v=3' height=16 width=16'></a> Please don't check into story main with a todo like this. Please add in the error handler!\n- <a href='https://github.com/srichal'><img border=0 src='https://avatars.githubusercontent.com/u/11357884?v=3' height=16 width=16'></a> This entire DB operation has been moved to the app. I also handled the DB operation error there.\n- [x] <a href='#crh-comment-Pull 798cc92aa9292c2a0b542ef7a65abdfe897f3890 thali/thalicryptomanager.js 95'></a> <img src='http://www.codereviewhub.com/site/github-completed.png' height=16 width=60>&nbsp;<b><a href='https://github.com/thaliproject/Thali_CordovaPlugin/pull/41#discussion_r35883211'>File: thali/thalicryptomanager.js:L1-105</a></b>\n- <a href='https://github.com/yaronyg'><img border=0 src='https://avatars.githubusercontent.com/u/1480964?v=3' height=16 width=16'></a> /piblic/public\n- <a href='https://github.com/srichal'><img border=0 src='https://avatars.githubusercontent.com/u/11357884?v=3' height=16 width=16'></a> fixed.\n- [x] <a href='#crh-comment-Pull 798cc92aa9292c2a0b542ef7a65abdfe897f3890 thali/thalicryptomanager.js 93'></a> <img src='http://www.codereviewhub.com/site/github-completed.png' height=16 width=60>&nbsp;<b><a href='https://github.com/thaliproject/Thali_CordovaPlugin/pull/41#discussion_r35883387'>File: thali/thalicryptomanager.js:L1-105</a></b>\n- <a href='https://github.com/yaronyg'><img border=0 src='https://avatars.githubusercontent.com/u/1480964?v=3' height=16 width=16'></a> In general you don't need to document internal functions and you especially don't need to document such a short function. Typically headers like this are only needed on public functions or on functions that do something really confusing and so could benefit from extra explanation. Remember, comments rot. So we only want to use them when the value they bring is greater than the cost of maintaining them.\n- <a href='https://github.com/srichal'><img border=0 src='https://avatars.githubusercontent.com/u/11357884?v=3' height=16 width=16'></a> Removed the documentation.\n- [x] <a href='#crh-comment-Pull fe52ed1cc48102a338cad41f60d4f612e94e36c2 thali/thalireplicationmanager.js 4'></a> <img src='http://www.codereviewhub.com/site/github-completed.png' height=16 width=60>&nbsp;<b><a href='https://github.com/thaliproject/Thali_CordovaPlugin/pull/41#discussion_r36202862'>File: thali/thalireplicationmanager.js:L7-15</a></b>\n- <a href='https://github.com/yaronyg'><img border=0 src='https://avatars.githubusercontent.com/u/1480964?v=3' height=16 width=16'></a> Why introduce currentDeviceIdentity if we already have _deviceName?\n- <a href='https://github.com/srichal'><img border=0 src='https://avatars.githubusercontent.com/u/11357884?v=3' height=16 width=16'></a> Fixed.\n- [x] <a href='#crh-comment-Pull fe52ed1cc48102a338cad41f60d4f612e94e36c2 thali/thalireplicationmanager.js 48'></a> <img src='http://www.codereviewhub.com/site/github-completed.png' height=16 width=60>&nbsp;<b><a href='https://github.com/thaliproject/Thali_CordovaPlugin/pull/41#discussion_r36202957'>File: thali/thalireplicationmanager.js:L67-75</a></b>\n- <a href='https://github.com/yaronyg'><img border=0 src='https://avatars.githubusercontent.com/u/1480964?v=3' height=16 width=16'></a> Please remove the comment on line 70 and 71. This is just the kind of comment that rots really quickly as soon as there is an edit. We have IDEs to handle matching squiggly braces.\n- <a href='https://github.com/srichal'><img border=0 src='https://avatars.githubusercontent.com/u/11357884?v=3' height=16 width=16'></a> Fixed.\n\n\n<a href='https://www.codereviewhub.com/thaliproject/Thali_CordovaPlugin/pull/41?mark_as_completed=1'><img src='http://www.codereviewhub.com/site/github-mark-as-completed.png' height=26></a>&nbsp;<a href='https://www.codereviewhub.com/thaliproject/Thali_CordovaPlugin/pull/41?approve=1'><img src='http://www.codereviewhub.com/site/github-approve.png' height=26></a>&nbsp;<a href='https://github.com/thaliproject/Thali_CordovaPlugin/pull/41'><img src='http://www.codereviewhub.com/site/github-refresh.png' height=26></a>\n<a href='#crh-end'></a>","created_at":"2015-07-21T22:26:41Z","updated_at":"2015-08-06T16:30:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7b878d845e817c49c382628509a93815b101dd83","assignee":null,"milestone":{"url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/milestones/3","html_url":"https://github.com/thaliproject/Thali_CordovaPlugin/milestones/0.0%20-%20Bring%20in%20the%20public%20keys","labels_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/milestones/3/labels","id":1224751,"number":3,"title":"0.0 - Bring in the public keys","description":"","creator":{"login":"yaronyg","id":1480964,"avatar_url":"https://avatars.githubusercontent.com/u/1480964?v=3","gravatar_id":"","url":"https://api.github.com/users/yaronyg","html_url":"https://github.com/yaronyg","followers_url":"https://api.github.com/users/yaronyg/followers","following_url":"https://api.github.com/users/yaronyg/following{/other_user}","gists_url":"https://api.github.com/users/yaronyg/gists{/gist_id}","starred_url":"https://api.github.com/users/yaronyg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yaronyg/subscriptions","organizations_url":"https://api.github.com/users/yaronyg/orgs","repos_url":"https://api.github.com/users/yaronyg/repos","events_url":"https://api.github.com/users/yaronyg/events{/privacy}","received_events_url":"https://api.github.com/users/yaronyg/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":0,"state":"open","created_at":"2015-07-24T20:06:48Z","updated_at":"2015-07-27T17:48:48Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/pulls/41/commits","review_comments_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/pulls/41/comments","review_comment_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/issues/41/comments","statuses_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/statuses/9d917e15deeebffdf5e86405cb7dbf3189ad2022","head":{"label":"thaliproject:story_00_srichal","ref":"story_00_srichal","sha":"9d917e15deeebffdf5e86405cb7dbf3189ad2022","user":{"login":"thaliproject","id":7918300,"avatar_url":"https://avatars.githubusercontent.com/u/7918300?v=3","gravatar_id":"","url":"https://api.github.com/users/thaliproject","html_url":"https://github.com/thaliproject","followers_url":"https://api.github.com/users/thaliproject/followers","following_url":"https://api.github.com/users/thaliproject/following{/other_user}","gists_url":"https://api.github.com/users/thaliproject/gists{/gist_id}","starred_url":"https://api.github.com/users/thaliproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thaliproject/subscriptions","organizations_url":"https://api.github.com/users/thaliproject/orgs","repos_url":"https://api.github.com/users/thaliproject/repos","events_url":"https://api.github.com/users/thaliproject/events{/privacy}","received_events_url":"https://api.github.com/users/thaliproject/received_events","type":"Organization","site_admin":false},"repo":{"id":36732493,"name":"Thali_CordovaPlugin","full_name":"thaliproject/Thali_CordovaPlugin","owner":{"login":"thaliproject","id":7918300,"avatar_url":"https://avatars.githubusercontent.com/u/7918300?v=3","gravatar_id":"","url":"https://api.github.com/users/thaliproject","html_url":"https://github.com/thaliproject","followers_url":"https://api.github.com/users/thaliproject/followers","following_url":"https://api.github.com/users/thaliproject/following{/other_user}","gists_url":"https://api.github.com/users/thaliproject/gists{/gist_id}","starred_url":"https://api.github.com/users/thaliproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thaliproject/subscriptions","organizations_url":"https://api.github.com/users/thaliproject/orgs","repos_url":"https://api.github.com/users/thaliproject/repos","events_url":"https://api.github.com/users/thaliproject/events{/privacy}","received_events_url":"https://api.github.com/users/thaliproject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/thaliproject/Thali_CordovaPlugin","description":"Thali p2p plugin ","fork":false,"url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin","forks_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/forks","keys_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/teams","hooks_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/hooks","issue_events_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/issues/events{/number}","events_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/events","assignees_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/assignees{/user}","branches_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/branches{/branch}","tags_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/tags","blobs_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/statuses/{sha}","languages_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/languages","stargazers_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/stargazers","contributors_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/contributors","subscribers_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/subscribers","subscription_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/subscription","commits_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/contents/{+path}","compare_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/merges","archive_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/downloads","issues_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/issues{/number}","pulls_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/pulls{/number}","milestones_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/milestones{/number}","notifications_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/labels{/name}","releases_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/releases{/id}","created_at":"2015-06-02T12:45:51Z","updated_at":"2015-07-29T10:31:47Z","pushed_at":"2015-08-06T15:34:23Z","git_url":"git://github.com/thaliproject/Thali_CordovaPlugin.git","ssh_url":"git@github.com:thaliproject/Thali_CordovaPlugin.git","clone_url":"https://github.com/thaliproject/Thali_CordovaPlugin.git","svn_url":"https://github.com/thaliproject/Thali_CordovaPlugin","homepage":null,"size":1399,"stargazers_count":7,"watchers_count":7,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":31,"forks":1,"open_issues":31,"watchers":7,"default_branch":"master"}},"base":{"label":"thaliproject:story_00","ref":"story_00","sha":"6c74882f3e0f213686e0376099c09bb1f99e83a2","user":{"login":"thaliproject","id":7918300,"avatar_url":"https://avatars.githubusercontent.com/u/7918300?v=3","gravatar_id":"","url":"https://api.github.com/users/thaliproject","html_url":"https://github.com/thaliproject","followers_url":"https://api.github.com/users/thaliproject/followers","following_url":"https://api.github.com/users/thaliproject/following{/other_user}","gists_url":"https://api.github.com/users/thaliproject/gists{/gist_id}","starred_url":"https://api.github.com/users/thaliproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thaliproject/subscriptions","organizations_url":"https://api.github.com/users/thaliproject/orgs","repos_url":"https://api.github.com/users/thaliproject/repos","events_url":"https://api.github.com/users/thaliproject/events{/privacy}","received_events_url":"https://api.github.com/users/thaliproject/received_events","type":"Organization","site_admin":false},"repo":{"id":36732493,"name":"Thali_CordovaPlugin","full_name":"thaliproject/Thali_CordovaPlugin","owner":{"login":"thaliproject","id":7918300,"avatar_url":"https://avatars.githubusercontent.com/u/7918300?v=3","gravatar_id":"","url":"https://api.github.com/users/thaliproject","html_url":"https://github.com/thaliproject","followers_url":"https://api.github.com/users/thaliproject/followers","following_url":"https://api.github.com/users/thaliproject/following{/other_user}","gists_url":"https://api.github.com/users/thaliproject/gists{/gist_id}","starred_url":"https://api.github.com/users/thaliproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thaliproject/subscriptions","organizations_url":"https://api.github.com/users/thaliproject/orgs","repos_url":"https://api.github.com/users/thaliproject/repos","events_url":"https://api.github.com/users/thaliproject/events{/privacy}","received_events_url":"https://api.github.com/users/thaliproject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/thaliproject/Thali_CordovaPlugin","description":"Thali p2p plugin ","fork":false,"url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin","forks_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/forks","keys_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/teams","hooks_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/hooks","issue_events_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/issues/events{/number}","events_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/events","assignees_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/assignees{/user}","branches_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/branches{/branch}","tags_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/tags","blobs_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/statuses/{sha}","languages_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/languages","stargazers_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/stargazers","contributors_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/contributors","subscribers_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/subscribers","subscription_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/subscription","commits_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/contents/{+path}","compare_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/merges","archive_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/downloads","issues_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/issues{/number}","pulls_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/pulls{/number}","milestones_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/milestones{/number}","notifications_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/labels{/name}","releases_url":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/releases{/id}","created_at":"2015-06-02T12:45:51Z","updated_at":"2015-07-29T10:31:47Z","pushed_at":"2015-08-06T15:34:23Z","git_url":"git://github.com/thaliproject/Thali_CordovaPlugin.git","ssh_url":"git@github.com:thaliproject/Thali_CordovaPlugin.git","clone_url":"https://github.com/thaliproject/Thali_CordovaPlugin.git","svn_url":"https://github.com/thaliproject/Thali_CordovaPlugin","homepage":null,"size":1399,"stargazers_count":7,"watchers_count":7,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":31,"forks":1,"open_issues":31,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/pulls/41"},"html":{"href":"https://github.com/thaliproject/Thali_CordovaPlugin/pull/41"},"issue":{"href":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/issues/41"},"comments":{"href":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/issues/41/comments"},"review_comments":{"href":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/pulls/41/comments"},"review_comment":{"href":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/pulls/41/commits"},"statuses":{"href":"https://api.github.com/repos/thaliproject/Thali_CordovaPlugin/statuses/9d917e15deeebffdf5e86405cb7dbf3189ad2022"}}}}