patch.patch 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112
  1. diff --git app/ionic.config.json app/ionic.config.json
  2. index d2e1d8f..1b487ce 100644
  3. --- app/ionic.config.json
  4. +++ app/ionic.config.json
  5. @@ -1,7 +1,9 @@
  6. {
  7. "name": "Hybric OSN",
  8. - "integrations": {
  9. - "cordova": {}
  10. + "integrations":
  11. + {
  12. + "cordova":
  13. + {}
  14. },
  15. - "type": "ionic-angular"
  16. -}
  17. \ No newline at end of file
  18. + "type": "angular"
  19. +}
  20. diff --git app/package-lock.json app/package-lock.json
  21. index e686dba..d53d9e7 100644
  22. --- app/package-lock.json
  23. +++ app/package-lock.json
  24. @@ -1,6 +1,6 @@
  25. {
  26. - "name": "HybridOSN",
  27. - "version": "0.5.1",
  28. + "name": "hybrid-osn",
  29. + "version": "1.0.0",
  30. "lockfileVersion": 1,
  31. "requires": true,
  32. "dependencies": {
  33. @@ -829,8 +829,7 @@
  34. "bn.js": {
  35. "version": "4.11.8",
  36. "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz",
  37. - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==",
  38. - "dev": true
  39. + "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA=="
  40. },
  41. "body": {
  42. "version": "5.1.0",
  43. @@ -2469,7 +2468,8 @@
  44. },
  45. "ansi-regex": {
  46. "version": "2.1.1",
  47. - "bundled": true
  48. + "bundled": true,
  49. + "optional": true
  50. },
  51. "aproba": {
  52. "version": "1.2.0",
  53. @@ -2487,11 +2487,13 @@
  54. },
  55. "balanced-match": {
  56. "version": "1.0.0",
  57. - "bundled": true
  58. + "bundled": true,
  59. + "optional": true
  60. },
  61. "brace-expansion": {
  62. "version": "1.1.11",
  63. "bundled": true,
  64. + "optional": true,
  65. "requires": {
  66. "balanced-match": "^1.0.0",
  67. "concat-map": "0.0.1"
  68. @@ -2504,15 +2506,18 @@
  69. },
  70. "code-point-at": {
  71. "version": "1.1.0",
  72. - "bundled": true
  73. + "bundled": true,
  74. + "optional": true
  75. },
  76. "concat-map": {
  77. "version": "0.0.1",
  78. - "bundled": true
  79. + "bundled": true,
  80. + "optional": true
  81. },
  82. "console-control-strings": {
  83. "version": "1.1.0",
  84. - "bundled": true
  85. + "bundled": true,
  86. + "optional": true
  87. },
  88. "core-util-is": {
  89. "version": "1.0.2",
  90. @@ -2615,7 +2620,8 @@
  91. },
  92. "inherits": {
  93. "version": "2.0.3",
  94. - "bundled": true
  95. + "bundled": true,
  96. + "optional": true
  97. },
  98. "ini": {
  99. "version": "1.3.5",
  100. @@ -2625,6 +2631,7 @@
  101. "is-fullwidth-code-point": {
  102. "version": "1.0.0",
  103. "bundled": true,
  104. + "optional": true,
  105. "requires": {
  106. "number-is-nan": "^1.0.0"
  107. }
  108. @@ -2637,17 +2644,20 @@
  109. "minimatch": {
  110. "version": "3.0.4",
  111. "bundled": true,
  112. + "optional": true,
  113. "requires": {
  114. "brace-expansion": "^1.1.7"
  115. }
  116. },
  117. "minimist": {
  118. "version": "0.0.8",
  119. - "bundled": true
  120. + "bundled": true,
  121. + "optional": true
  122. },
  123. "minipass": {
  124. "version": "2.2.4",
  125. "bundled": true,
  126. + "optional": true,
  127. "requires": {
  128. "safe-buffer": "^5.1.1",
  129. "yallist": "^3.0.0"
  130. @@ -2664,6 +2674,7 @@
  131. "mkdirp": {
  132. "version": "0.5.1",
  133. "bundled": true,
  134. + "optional": true,
  135. "requires": {
  136. "minimist": "0.0.8"
  137. }
  138. @@ -2736,7 +2747,8 @@
  139. },
  140. "number-is-nan": {
  141. "version": "1.0.1",
  142. - "bundled": true
  143. + "bundled": true,
  144. + "optional": true
  145. },
  146. "object-assign": {
  147. "version": "4.1.1",
  148. @@ -2746,6 +2758,7 @@
  149. "once": {
  150. "version": "1.4.0",
  151. "bundled": true,
  152. + "optional": true,
  153. "requires": {
  154. "wrappy": "1"
  155. }
  156. @@ -2821,7 +2834,8 @@
  157. },
  158. "safe-buffer": {
  159. "version": "5.1.1",
  160. - "bundled": true
  161. + "bundled": true,
  162. + "optional": true
  163. },
  164. "safer-buffer": {
  165. "version": "2.1.2",
  166. @@ -2851,6 +2865,7 @@
  167. "string-width": {
  168. "version": "1.0.2",
  169. "bundled": true,
  170. + "optional": true,
  171. "requires": {
  172. "code-point-at": "^1.0.0",
  173. "is-fullwidth-code-point": "^1.0.0",
  174. @@ -2868,6 +2883,7 @@
  175. "strip-ansi": {
  176. "version": "3.0.1",
  177. "bundled": true,
  178. + "optional": true,
  179. "requires": {
  180. "ansi-regex": "^2.0.0"
  181. }
  182. @@ -2906,11 +2922,13 @@
  183. },
  184. "wrappy": {
  185. "version": "1.0.2",
  186. - "bundled": true
  187. + "bundled": true,
  188. + "optional": true
  189. },
  190. "yallist": {
  191. "version": "3.0.2",
  192. - "bundled": true
  193. + "bundled": true,
  194. + "optional": true
  195. }
  196. }
  197. },
  198. @@ -3649,6 +3667,11 @@
  199. "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz",
  200. "integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps="
  201. },
  202. + "imurmurhash": {
  203. + "version": "0.1.4",
  204. + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
  205. + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o="
  206. + },
  207. "in-publish": {
  208. "version": "2.0.0",
  209. "resolved": "https://registry.npmjs.org/in-publish/-/in-publish-2.0.0.tgz",
  210. @@ -4367,8 +4390,7 @@
  211. "minimalistic-assert": {
  212. "version": "1.0.1",
  213. "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz",
  214. - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==",
  215. - "dev": true
  216. + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A=="
  217. },
  218. "minimalistic-crypto-utils": {
  219. "version": "1.0.1",
  220. @@ -4566,6 +4588,14 @@
  221. "vm-browserify": "0.0.4"
  222. }
  223. },
  224. + "node-localstorage": {
  225. + "version": "1.3.1",
  226. + "resolved": "https://registry.npmjs.org/node-localstorage/-/node-localstorage-1.3.1.tgz",
  227. + "integrity": "sha512-NMWCSWWc6JbHT5PyWlNT2i8r7PgGYXVntmKawY83k/M0UJScZ5jirb61TLnqKwd815DfBQu+lR3sRw08SPzIaQ==",
  228. + "requires": {
  229. + "write-file-atomic": "^1.1.4"
  230. + }
  231. + },
  232. "node-rsa": {
  233. "version": "1.0.2",
  234. "resolved": "https://registry.npmjs.org/node-rsa/-/node-rsa-1.0.2.tgz",
  235. @@ -4838,6 +4868,33 @@
  236. "wrappy": "1"
  237. }
  238. },
  239. + "openpgp": {
  240. + "version": "4.7.1",
  241. + "resolved": "https://registry.npmjs.org/openpgp/-/openpgp-4.7.1.tgz",
  242. + "integrity": "sha512-UX4AXpjxUiIHfReStsBvbAcL5XyIWSb3sh7uleGlKdg1VWK/4LOncNd+89fYur6fbjZXORVR6m6YELupeWT1Iw==",
  243. + "requires": {
  244. + "asn1.js": "^5.0.0",
  245. + "node-fetch": "^2.1.2",
  246. + "node-localstorage": "~1.3.0"
  247. + },
  248. + "dependencies": {
  249. + "asn1.js": {
  250. + "version": "5.2.0",
  251. + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.2.0.tgz",
  252. + "integrity": "sha512-Q7hnYGGNYbcmGrCPulXfkEw7oW7qjWeM4ZTALmgpuIcZLxyqqKYWxCZg2UBm8bklrnB4m2mGyJPWfoktdORD8A==",
  253. + "requires": {
  254. + "bn.js": "^4.0.0",
  255. + "inherits": "^2.0.1",
  256. + "minimalistic-assert": "^1.0.0"
  257. + }
  258. + },
  259. + "node-fetch": {
  260. + "version": "2.6.0",
  261. + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz",
  262. + "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA=="
  263. + }
  264. + }
  265. + },
  266. "optjs": {
  267. "version": "3.2.2",
  268. "resolved": "https://registry.npmjs.org/optjs/-/optjs-3.2.2.tgz",
  269. @@ -5009,9 +5066,9 @@
  270. "dev": true
  271. },
  272. "path-to-regexp": {
  273. - "version": "1.7.0",
  274. - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz",
  275. - "integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=",
  276. + "version": "1.8.0",
  277. + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz",
  278. + "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==",
  279. "requires": {
  280. "isarray": "0.0.1"
  281. },
  282. @@ -5774,6 +5831,11 @@
  283. "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
  284. "dev": true
  285. },
  286. + "slide": {
  287. + "version": "1.1.6",
  288. + "resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz",
  289. + "integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc="
  290. + },
  291. "snapdragon": {
  292. "version": "0.8.2",
  293. "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz",
  294. @@ -7405,6 +7467,16 @@
  295. "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
  296. "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
  297. },
  298. + "write-file-atomic": {
  299. + "version": "1.3.4",
  300. + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-1.3.4.tgz",
  301. + "integrity": "sha1-+Aek8LHZ6ROuekgRLmzDrxmRtF8=",
  302. + "requires": {
  303. + "graceful-fs": "^4.1.11",
  304. + "imurmurhash": "^0.1.4",
  305. + "slide": "^1.1.5"
  306. + }
  307. + },
  308. "ws": {
  309. "version": "3.3.2",
  310. "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.2.tgz",
  311. diff --git app/src/app/app.component.ts app/src/app/app.component.ts
  312. index d35471a..761f19e 100644
  313. --- app/src/app/app.component.ts
  314. +++ app/src/app/app.component.ts
  315. @@ -21,7 +21,7 @@ export class MyApp {
  316. nav: Nav;
  317. rootPage: any;
  318. - pages: Array<{ title: string; icon: string; component: any }>;
  319. + pages: Array < { title: string;icon: string;component: any } > ;
  320. user: any;
  321. constructor(
  322. @@ -53,17 +53,20 @@ export class MyApp {
  323. async initApp() {
  324. const isLoggedIn = await this.authProvider.isLoggedIn();
  325. -
  326. + console.log('isLoggedin var is:', isLoggedIn);
  327. + this.rootPage = LoginPage;
  328. if (isLoggedIn) {
  329. this.rootPage = HomePage;
  330. await this.setUser();
  331. } else {
  332. + console.log('redirecting to login page');
  333. this.rootPage = LoginPage;
  334. }
  335. }
  336. async setUser() {
  337. const userId = await this.storage.get("userId");
  338. + console.log('fetching user');
  339. this.user = await this.twitter.fetchUser(userId);
  340. }
  341. diff --git app/src/components/profile-header/profile-header.ts app/src/components/profile-header/profile-header.ts
  342. index e2ce94b..e29ffe0 100644
  343. --- app/src/components/profile-header/profile-header.ts
  344. +++ app/src/components/profile-header/profile-header.ts
  345. @@ -13,7 +13,24 @@ export class ProfileHeaderComponent {
  346. constructor(
  347. private twitter: TwitterApiProvider,
  348. private photoViewer: PhotoViewer
  349. - ) {}
  350. + ) {
  351. +
  352. + // if (typeof Worker !== 'undefined') {
  353. + // // Create a new
  354. + // const worker = new Worker('./profile-header.worker');
  355. + // let message = "fuckgi";
  356. + // worker.onmessage = (ev: MessageEvent) => {
  357. + // worker.terminate();
  358. + // };
  359. + // worker.postMessage(message);
  360. + // } else {
  361. + // console.log('webworkers are not supported');
  362. + // return;
  363. + // // Web Workers are not supported in this environment.
  364. + // // You should add a fallback so that your program still executes correctly.
  365. + // }
  366. +
  367. + }
  368. get banner() {
  369. if (this.user.profile_banner_url) {
  370. diff --git app/src/index.html app/src/index.html
  371. index c4b4376..64fb4d5 100644
  372. --- app/src/index.html
  373. +++ app/src/index.html
  374. @@ -1,51 +1,44 @@
  375. <!DOCTYPE html>
  376. <html lang="en" dir="ltr">
  377. +
  378. <head>
  379. <meta charset="UTF-8">
  380. <title>Ionic App</title>
  381. <meta name="viewport" content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
  382. <meta name="format-detection" content="telephone=no">
  383. <meta name="msapplication-tap-highlight" content="no">
  384. -
  385. <link rel="icon" type="image/x-icon" href="assets/icon/favicon.ico">
  386. <link rel="manifest" href="manifest.json">
  387. <meta name="theme-color" content="#4e8ef7">
  388. -
  389. <!-- add to homescreen for ios -->
  390. <meta name="apple-mobile-web-app-capable" content="yes">
  391. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  392. -
  393. <!-- cordova.js required for cordova apps (remove if not needed) -->
  394. <script src="cordova.js"></script>
  395. <script src="assets/scripts/openpgp.js"></script>
  396. <script src="assets/scripts/openpgp.worker.js"></script>
  397. -
  398. - <!-- un-comment this code to enable service worker
  399. - <script>
  400. - if ('serviceWorker' in navigator) {
  401. - navigator.serviceWorker.register('service-worker.js')
  402. - .then(() => console.log('service worker installed'))
  403. - .catch(err => console.error('Error', err));
  404. - }
  405. - </script>-->
  406. -
  407. + <!-- un-comment this code to enable service worker-->
  408. + <!-- <script>
  409. + if ('serviceWorker' in navigator) {
  410. + navigator.serviceWorker.register('service-worker.js')
  411. + .then(() => console.log('service worker installed'))
  412. + .catch(err => console.error('Error', err));
  413. + }
  414. +
  415. + </script> -->
  416. <link href="build/main.css" rel="stylesheet">
  417. -
  418. </head>
  419. -<body>
  420. +<body>
  421. <!-- Ionic's root component and where the app will load -->
  422. <ion-app></ion-app>
  423. -
  424. <!-- The polyfills js is generated during the build process -->
  425. <script src="build/polyfills.js"></script>
  426. -
  427. <!-- The vendor js is generated during the build process
  428. It contains all of the dependencies in node_modules -->
  429. <script src="build/vendor.js"></script>
  430. -
  431. <!-- The main bundle js is generated during the build process -->
  432. <script src="build/main.js"></script>
  433. -
  434. </body>
  435. +
  436. </html>
  437. diff --git app/src/pages/login/login.html app/src/pages/login/login.html
  438. index fb8f719..6da6d64 100644
  439. --- app/src/pages/login/login.html
  440. +++ app/src/pages/login/login.html
  441. @@ -10,4 +10,4 @@
  442. <button ion-button outline block (click)="login()">Login</button>
  443. <a href="#" (click)="showAbout()">Learn more</a>
  444. </div>
  445. -</ion-content>
  446. \ No newline at end of file
  447. +</ion-content>
  448. diff --git app/src/pages/login/login.ts app/src/pages/login/login.ts
  449. index 691edbc..fac836e 100644
  450. --- app/src/pages/login/login.ts
  451. +++ app/src/pages/login/login.ts
  452. @@ -35,8 +35,7 @@ export class LoginPage {
  453. login() {
  454. const alertText = {
  455. title: "Login failed",
  456. - subTitle:
  457. - "Somthing went wrong while trying to log you in. Please try again.",
  458. + subTitle: "Somthing went wrong while trying to log you in. Please try again.",
  459. buttons: ["OK"]
  460. };
  461. diff --git app/src/pages/settings/settings.html app/src/pages/settings/settings.html
  462. index 9e1eba0..8143601 100644
  463. --- app/src/pages/settings/settings.html
  464. +++ app/src/pages/settings/settings.html
  465. @@ -24,6 +24,8 @@
  466. generate
  467. a pair of keys. If you run the app on multiple devices, please enter everywhere the same pair of keys.</p>
  468. <button ion-button block (click)="generateKeys()">Generate keys</button>
  469. + <ion-label color="primary" stacked required>Enter Passphrase:</ion-label>
  470. + <ion-textarea [(ngModel)]="passphrase"></ion-textarea>
  471. <ion-label color="primary" stacked>Private Key:</ion-label>
  472. <ion-textarea [(ngModel)]="privateKey"></ion-textarea>
  473. <ion-label color="primary" stacked>Public Key:</ion-label>
  474. @@ -35,4 +37,4 @@
  475. </ion-card>
  476. <button ion-button block (click)="save()">Save settings</button>
  477. -</ion-content>
  478. \ No newline at end of file
  479. +</ion-content>
  480. diff --git app/src/pages/settings/settings.ts app/src/pages/settings/settings.ts
  481. index c2f6bfd..1d966e9 100644
  482. --- app/src/pages/settings/settings.ts
  483. +++ app/src/pages/settings/settings.ts
  484. @@ -17,6 +17,7 @@ export class SettingsPage {
  485. keywords: string;
  486. privateKey: string;
  487. publicKey: string;
  488. + passphrase: string;
  489. constructor(
  490. public navCtrl: NavController,
  491. @@ -33,6 +34,7 @@ export class SettingsPage {
  492. async loadValuesFromStorage() {
  493. this.privateKey = await this.storage.get("privateKey");
  494. this.publicKey = await this.storage.get("publicKey");
  495. + this.passphrase = await this.storage.get("passphrase");
  496. this.keywords = await this.storage.get("keywords");
  497. }
  498. @@ -63,7 +65,8 @@ export class SettingsPage {
  499. }
  500. private async startKeyGeneration() {
  501. - const keys = await this.cryptoUtils.generateRsaKeys();
  502. + // const keys = await this.cryptoUtils.generateRsaKeys();
  503. + const keys = await this.cryptoUtils.generateKeys(this.passphrase);
  504. this.publicKey = await this.cryptoUtils.extractPublicKey(keys);
  505. this.privateKey = await this.cryptoUtils.extractPrivateKey(keys);
  506. @@ -73,6 +76,7 @@ export class SettingsPage {
  507. this.storage.set("publicKey", this.publicKey);
  508. this.storage.set("privateKey", this.privateKey);
  509. this.storage.set("keywords", this.keywords ? this.keywords.trim() : "");
  510. + this.storage.set("passphrase", this.passphrase);
  511. this.showToast("Successfully saved!");
  512. }
  513. diff --git app/src/pages/write-tweet/write-tweet.ts app/src/pages/write-tweet/write-tweet.ts
  514. index f468d43..4b9c8f7 100644
  515. --- app/src/pages/write-tweet/write-tweet.ts
  516. +++ app/src/pages/write-tweet/write-tweet.ts
  517. @@ -35,9 +35,10 @@ export class WriteTweetPage {
  518. openpgp;
  519. privateKey;
  520. publicKey;
  521. - pk: any[]=[];
  522. - passp = 'super long and hard to guess secret' ;
  523. -
  524. + revocationCertificate;
  525. + pk: any[] = [];
  526. + passp = 'super long and hard to guess secret';
  527. +
  528. constructor(
  529. public navCtrl: NavController,
  530. @@ -64,100 +65,108 @@ export class WriteTweetPage {
  531. }
  532. - public async encryptDecryptFunction () {
  533. - await openpgp.initWorker({path:'assets/scripts/openpgp.worker.js'});
  534. - let a = await this.generateKeys();
  535. - console.log('a is:',a.publicKeyArmored);
  536. - let b = await this.generateKeys();
  537. - console.log('b is:',b.publicKeyArmored);
  538. - let c = await this.generateKeys();
  539. - this.privateKey =c.privateKeyArmored;
  540. + public async encryptDecryptFunction() {
  541. + await openpgp.initWorker({ path: 'assets/scripts/openpgp.worker.js' });
  542. + let a = await this.generateKeys();
  543. + console.log('a is:', a.publicKeyArmored);
  544. + let b = await this.generateKeys();
  545. + console.log('b is:', b.publicKeyArmored);
  546. + let c = await this.generateKeys();
  547. + this.privateKey = c.privateKeyArmored;
  548. this.publicKey = c.publicKeyArmored;
  549. -
  550. + await this.uploadPubKeytoServer(this.publicKey);
  551. + this.revocationCertificate = c.revocationCertificate;
  552. this.pk.push(a.publicKeyArmored);
  553. this.pk.push(b.publicKeyArmored);
  554. -// this.pk = [`----BEGIN PGP PUBLIC KEY BLOCK-----
  555. -// Version: OpenPGP.js v4.7.1
  556. -// Comment: https://openpgpjs.org
  557. -
  558. -// xjMEXfAn1xYJKwYBBAHaRw8BAQdAAMVNOABw8MBtrtYR8KC3tSro3wITyApT
  559. -// TVjKVCppD+DNG0pvbiBTbWl0aCA8am9uQGV4YW1wbGUuY29tPsJ3BBAWCgAf
  560. -// BQJd8CfXBgsJBwgDAgQVCAoCAxYCAQIZAQIbAwIeAQAKCRD+efBRXzuMsfA7
  561. -// AQCEgoToFzv2hT9BREdiQp531/AHSyoZWmWvSZSvmga40gD8C+zwbCySnkhQ
  562. -// pb4L0DCKtSDa7pLg2g0OcxJlbSZWHQ3OOARd8CfXEgorBgEEAZdVAQUBAQdA
  563. -// p4mVY17dPWf6VCBqW10Ybk5JgUO6FK0OsETWw3gG2zcDAQgHwmEEGBYIAAkF
  564. -// Al3wJ9cCGwwACgkQ/nnwUV87jLFHbAD9GyoL7dcTDGQoqtrhKozdgnzfugTb
  565. -// er0bwU15WNMjefkA/jEqK9YUNcRrFKIuac9PVibGgutL8ak7ukysw6iTcCsM
  566. -// =fmhE
  567. -// -----END PGP PUBLIC KEY BLOCK-----`,
  568. -// `-----BEGIN PGP PUBLIC KEY BLOCK-----
  569. -// Version: OpenPGP.js v4.7.1
  570. -// Comment: https://openpgpjs.org
  571. -
  572. -// xjMEXfAn1hYJKwYBBAHaRw8BAQdAsF1ivpd0HU8ogj02LDv6BTOxNMWGZaEc
  573. -// OyZBwqoYJPrNG0pvbiBTbWl0aCA8am9uQGV4YW1wbGUuY29tPsJ3BBAWCgAf
  574. -// BQJd8CfWBgsJBwgDAgQVCAoCAxYCAQIZAQIbAwIeAQAKCRDEruv77flRJ32B
  575. -// AP93GIBcUW2okROoZZhdPVeqjRD72Ft64imXpdZ0jx4ohgEA5Kv9vs2kV73q
  576. -// k6fcdf7qD/i5gMExU0+vV05c9VxBYwfOOARd8CfWEgorBgEEAZdVAQUBAQdA
  577. -// 1J7E03ZopUnsIeNzeiZvba6qxhhUbpmBZ1aN1HhWUlEDAQgHwmEEGBYIAAkF
  578. -// Al3wJ9YCGwwACgkQxK7r++35USdTqQD/ZEg8X5tMx75nQe4mGlyiRjmmtWLw
  579. -// n9bslTdjBIszs/EA/R1WIm6ji4Ru1dJWc3ISisz78xTM2H8U7fnP8yjFcWcD
  580. -// =hgnW
  581. -// -----END PGP PUBLIC KEY BLOCK-----`];
  582. - console.log('array of pub keys is :',this.pk);
  583. - this.pk = this.pk.map(async (key) => {
  584. + console.log('array of pub keys is :', this.pk);
  585. + this.pk = this.pk.map(async (key) => {
  586. return (await openpgp.key.readArmored(key)).keys[0]
  587. });
  588. - console.log('priv key: ',this.privateKey,'this.pubkey',this.pk);
  589. + console.log('priv key: ', this.privateKey, 'this.pubkey', this.pk);
  590. let encrypted;
  591. const privKeyObj = (await openpgp.key.readArmored(this.privateKey)).keys[0];
  592. - console.log('privKeyObj',privKeyObj);
  593. - const bla = await privKeyObj.decrypt(this.passp);
  594. -
  595. - // const options = {
  596. - // message: openpgp.message.fromText('Hello, World!'), // input as Message object
  597. - // publicKeys: (await openpgp.key.readArmored(this.publicKey)).keys, // for encryption
  598. - // privateKeys: [privKeyObj] // for signing (optional)
  599. - // }
  600. -
  601. + console.log('privKeyObj', privKeyObj);
  602. const options = {
  603. - message: openpgp.message.fromText('Hello, World!'), // input as Message object
  604. - publicKeys: await Promise.all(this.pk), // for encryption
  605. - privateKeys: [privKeyObj] // for signing (optional)
  606. + message: openpgp.message.fromText('Hello, World!'), // input as Message object
  607. + publicKeys: await Promise.all(this.pk), // for encryption
  608. + privateKeys: [privKeyObj] // for signing (optional)
  609. }
  610. const ciphertext = await openpgp.encrypt(options);
  611. - encrypted = ciphertext.data; // '-----BEGIN PGP MESSAGE ... END PGP MESSAGE-----'
  612. - console.log('encrypted is:',encrypted);
  613. -
  614. - let aprivKeyObj = (await openpgp.key.readArmored(a.privateKeyArmored)).keys[0];
  615. - await aprivKeyObj.decrypt(this.passp);
  616. + encrypted = ciphertext.data; // '-----BEGIN PGP MESSAGE ... END PGP MESSAGE-----'
  617. + console.log('encrypted is:', encrypted);
  618. +
  619. + let aprivKeyObj = (await openpgp.key.readArmored(a.privateKeyArmored)).keys[0];
  620. + await aprivKeyObj.decrypt(this.passp);
  621. const options2 = {
  622. - message: await openpgp.message.readArmored(encrypted), // parse armored message
  623. - privateKeys: [aprivKeyObj] // for decryption
  624. + message: await openpgp.message.readArmored(encrypted), // parse armored message
  625. + privateKeys: [aprivKeyObj] // for decryption
  626. }
  627. - console.log('options2 is: ',options2);
  628. + console.log('options2 is: ', options2);
  629. let plaintext = await openpgp.decrypt(options2);
  630. - console.log('decrypted text is:',plaintext,plaintext.data);
  631. + console.log('decrypted text is:', plaintext, plaintext.data);
  632. +
  633. + //lookup key
  634. + await this.lookupKeys();
  635. + await this.test();
  636. return plaintext.data // 'Hello, World!'
  637. }
  638. - public async generateKeys(){
  639. + public async test(){
  640. + console.log("----------------INSIDE TEST-----------------");
  641. + await this.revokeKey();
  642. + await this.lookupKeys();
  643. + }
  644. +
  645. + public async generateKeys() {
  646. let options = {
  647. - userIds: [{ name:'Jon Smith', email:'jon@example.com' }], // multiple user IDs
  648. - curve: "ed25519", // ECC curve name
  649. - passphrase: this.passp // protects the private key
  650. + userIds: [{ name: 'Rohit Gowda', email: 'rohit.s.gowda91@gmail.com' }], // multiple user IDs
  651. + curve: "ed25519", // ECC curve name
  652. + passphrase: this.passp // protects the private key
  653. };
  654. -
  655. - let a = await openpgp.generateKey(options);
  656. - return a;
  657. - // console.log('resolved a = ',a);
  658. - // this.privateKey =a.privateKeyArmored;
  659. - // this.publicKey = a.publicKeyArmored;
  660. - // this.encryptDecryptFunction();
  661. +
  662. + let a = await openpgp.generateKey(options);
  663. + return a;
  664. + }
  665. +
  666. + public async uploadPubKeytoServer(pubkey){
  667. + var hkp = new openpgp.HKP('https://pgp.mit.edu');
  668. + hkp.upload(pubkey).then(function() {
  669. + console.log("pubkey succesfully uploaded");
  670. + });
  671. + }
  672. +
  673. + public async lookupKeys(){
  674. + var hkp = new openpgp.HKP(); // Defaults to https://keyserver.ubuntu.com, or pass another keyserver URL as a string
  675. +
  676. + var options = {
  677. + query: 'rohit.s.gowda91@gmail.com'
  678. + };
  679. +
  680. + let armoredPubkey = await hkp.lookup(options);
  681. + let pubkey = await openpgp.key.readArmored(armoredPubkey);
  682. + console.log('Found public key:',pubkey);
  683. + }
  684. +
  685. + public async revokeKey(){
  686. + //using revocation certificate
  687. + var options = {
  688. + key: openpgp.key.readArmored(this.publicKey).keys[0],
  689. + revocationCertificate: this.revocationCertificate
  690. + };
  691. +
  692. + //alternatively revoke using private key
  693. + let options2 = {
  694. + key: openpgp.key.readArmored(this.privateKey).keys[0]
  695. + };
  696. +
  697. + openpgp.revokeKey(options2).then(function(key) {
  698. + var pubkey = key.publicKeyArmored; // '-----BEGIN PGP PUBLIC KEY BLOCK ... '
  699. + console.log("public key revoked");
  700. + });
  701. }
  702. @@ -171,7 +180,8 @@ export class WriteTweetPage {
  703. }
  704. private containsTriggerWord(triggerWords: string): ValidatorFn {
  705. - return (control: AbstractControl): { [key: string]: any } | null => {
  706. + return (control: AbstractControl): {
  707. + [key: string]: any } | null => {
  708. if (triggerWords) {
  709. const regexList = triggerWords
  710. .toLowerCase()
  711. @@ -179,9 +189,9 @@ export class WriteTweetPage {
  712. .join("|");
  713. const regex = new RegExp(regexList);
  714. const containsTriggerWord = regex.test(control.value.toLowerCase());
  715. - return containsTriggerWord
  716. - ? { containsTriggerWord: { value: control.value } }
  717. - : null;
  718. + return containsTriggerWord ?
  719. + { containsTriggerWord: { value: control.value } } :
  720. + null;
  721. } else {
  722. return null;
  723. }
  724. @@ -219,8 +229,7 @@ export class WriteTweetPage {
  725. this.alertCtrl
  726. .create({
  727. title: "Watch Out!",
  728. - message:
  729. - "Your tweet contains words you have previously defined to only share securely via P2P. Currently P2P mode is not selected.",
  730. + message: "Your tweet contains words you have previously defined to only share securely via P2P. Currently P2P mode is not selected.",
  731. buttons: ["OK"]
  732. })
  733. .present();
  734. @@ -238,12 +247,11 @@ export class WriteTweetPage {
  735. ) {
  736. loading.setContent("Publish private tweet...");
  737. await this.tweetPrivate();
  738. - } else {
  739. + } else {
  740. loading.dismiss();
  741. const alert = this.alertCtrl.create({
  742. title: "Oooops...",
  743. - message:
  744. - "Please verify that you have set a private and public key in the settings and that your latest public key was published."
  745. + message: "Please verify that you have set a private and public key in the settings and that your latest public key was published."
  746. });
  747. alert.present();
  748. return;
  749. @@ -319,7 +327,7 @@ export class WriteTweetPage {
  750. } catch (err) {
  751. console.error(
  752. "There is no user signed up to twitter with username: " +
  753. - mention.screenName
  754. + mention.screenName
  755. );
  756. }
  757. return mention;
  758. diff --git app/src/providers/crypto/crypto.ts app/src/providers/crypto/crypto.ts
  759. index 8714a1d..98a67e8 100644
  760. --- app/src/providers/crypto/crypto.ts
  761. +++ app/src/providers/crypto/crypto.ts
  762. @@ -2,6 +2,7 @@ import { Injectable } from "@angular/core";
  763. import { TwitterApiProvider } from "../twitter-api/twitter-api";
  764. import { P2pStorageIpfsProvider } from "../p2p-storage-ipfs/p2p-storage-ipfs";
  765. import { Storage } from "@ionic/storage";
  766. +import * as openpgp from 'openpgp';
  767. import NodeRSA from "node-rsa";
  768. declare var TextDecoder: any;
  769. declare var TextEncoder: any;
  770. @@ -10,6 +11,7 @@ export class CryptoProvider {
  771. ownUserId: string;
  772. IV_LENGTH = 12;
  773. HYBRID_OSN_AES_KEY = "Z1vxAULQnZdoWhJOvv+hWEvVpyUHzNjD/ichEE2c8i4=";
  774. + openpgp;
  775. constructor(
  776. private twitter: TwitterApiProvider,
  777. @@ -46,13 +48,19 @@ export class CryptoProvider {
  778. };
  779. }
  780. - // Ecnrypt key history
  781. - const encryptedPublicKeyHistory = await this.aesEncrypt(
  782. - JSON.stringify(publicKeyHistory)
  783. - );
  784. + //encrypt key history with openpgp with published public key
  785. + const options = {
  786. + message: openpgp.message.fromText(JSON.stringify(publicKeyHistory)), // input as Message object
  787. + publicKeys: (await openpgp.key.readArmored(key)).keys, // for encryption
  788. + }
  789. +
  790. + let encryptedPublicKeyHistory = await openpgp.encrypt(options);
  791. + let encrypted = await encryptedPublicKeyHistory.data // '-----BEGIN PGP MESSAGE ... END PGP MESSAGE-----'
  792. + console.log('encrypted public key history', encrypted);
  793. +
  794. // Publish updated key history...
  795. - const res = await this.ipfs.storePublicKey(encryptedPublicKeyHistory);
  796. + const res = await this.ipfs.storePublicKey(encrypted);
  797. // tweet ipfs link
  798. const tweetResponse = await this.twitter.tweet(
  799. @@ -85,9 +93,21 @@ export class CryptoProvider {
  800. // Fetch public key history
  801. if (link.length) {
  802. const encryptedKeyHistory = await this.ipfs.fetchJson(link);
  803. - // Decrypt key history
  804. - const keyHistory = await this.aesDecrypt(encryptedKeyHistory.toString());
  805. - return JSON.parse(keyHistory);
  806. +
  807. + let privateKey = await this.storage.get("privateKey");
  808. + const privKeyObj = (await openpgp.key.readArmored(privateKey)).keys[0];
  809. + console.log('privKeyObj', privKeyObj);
  810. + const options = {
  811. + message: await openpgp.message.readArmored(encryptedKeyHistory.toString()), // parse armored message
  812. + // publicKeys: (await openpgp.key.readArmored(pubkey)).keys, // for verification (optional)
  813. + privateKeys: [privKeyObj] // for decryption
  814. + }
  815. +
  816. + openpgp.decrypt(options).then(plaintext => {
  817. + console.log('decrypted key history: ', plaintext.data)
  818. + return plaintext.data // 'Hello, World!'
  819. + })
  820. +
  821. } else {
  822. return null;
  823. }
  824. @@ -123,8 +143,7 @@ export class CryptoProvider {
  825. * Generates a RSA key pair object
  826. */
  827. public async generateRsaKeys() {
  828. - return await crypto.subtle.generateKey(
  829. - {
  830. + return await crypto.subtle.generateKey({
  831. name: "RSA-OAEP",
  832. modulusLength: 1024,
  833. publicExponent: new Uint8Array([0x01, 0x00, 0x01]),
  834. @@ -135,36 +154,40 @@ export class CryptoProvider {
  835. );
  836. }
  837. + /**
  838. + * Generates an openPGP key pair object
  839. + */
  840. +
  841. + public async generateKeys(passp: string) {
  842. + let options = {
  843. + userIds: [{ name: 'Rohit Gowda', email: 'rohit.s.gowda91@gmail.com' }], // multiple user IDs
  844. + curve: "ed25519", // ECC curve name
  845. + passphrase: passp // protects the private key
  846. + };
  847. +
  848. + return await openpgp.generateKey(options);
  849. + }
  850. +
  851. /**
  852. * extracts the private key from the key object and transforms it to readable text
  853. * @param keys key object
  854. */
  855. - public async extractPrivateKey(keys): Promise<string> {
  856. - return btoa(
  857. - String.fromCharCode.apply(
  858. - null,
  859. - new Uint8Array(await crypto.subtle.exportKey("pkcs8", keys.privateKey))
  860. - )
  861. - );
  862. + public async extractPrivateKey(keys): Promise < string > {
  863. + return keys.privateKeyArmored;
  864. }
  865. /**
  866. * extracts the public key from the key object and transforms it to readable text
  867. * @param keys key object
  868. */
  869. - public async extractPublicKey(keys): Promise<string> {
  870. - return btoa(
  871. - String.fromCharCode.apply(
  872. - null,
  873. - new Uint8Array(await crypto.subtle.exportKey("spki", keys.publicKey))
  874. - )
  875. - );
  876. + public async extractPublicKey(keys): Promise < string > {
  877. + return keys.publicKeyArmored;
  878. }
  879. /**
  880. * checks if the latest published key is the same as the one saved in app settings
  881. */
  882. - public async isPublicKeyPublished(): Promise<boolean> {
  883. + public async isPublicKeyPublished(): Promise < boolean > {
  884. const publicKey = await this.storage.get("publicKey");
  885. const keyHistory = await this.getKeyHistory(this.ownUserId);
  886. @@ -179,7 +202,7 @@ export class CryptoProvider {
  887. /**
  888. * checks if a private key is already set
  889. */
  890. - public async isPrivateKeySet(): Promise<boolean> {
  891. + public async isPrivateKeySet(): Promise < boolean > {
  892. const privateKey = await this.storage.get("privateKey");
  893. return privateKey;
  894. }
  895. @@ -212,7 +235,7 @@ export class CryptoProvider {
  896. * Fetches the public key history for a given user id
  897. * @param userId user id
  898. */
  899. - public async fetchPublicKeyHistoryForUser(userId: string): Promise<object[]> {
  900. + public async fetchPublicKeyHistoryForUser(userId: string): Promise < object[] > {
  901. const keyHistory = await this.getKeyHistory(userId);
  902. return keyHistory["keys"].reverse();
  903. }
  904. diff --git app/src/providers/feed/feed.ts app/src/providers/feed/feed.ts
  905. index e87a22f..d4a3cc8 100644
  906. --- app/src/providers/feed/feed.ts
  907. +++ app/src/providers/feed/feed.ts
  908. @@ -28,20 +28,23 @@ export class FeedProvider {
  909. */
  910. public async loadUserTimeline(
  911. userId,
  912. - oldestPublicTweet?,
  913. - oldestPrivateTweet?
  914. + oldestPublicTweet ? ,
  915. + oldestPrivateTweet ?
  916. ) {
  917. + console.log('fetch usertimeline');
  918. const maxId = oldestPublicTweet ? oldestPublicTweet["id_str"] : undefined;
  919. // Fetch tweets from Twitter
  920. let tweets = await this.twitter.fetchUserTimeline(userId, maxId);
  921. + console.log('tweets are:',tweets);
  922. if (tweets.length === 0) return tweets;
  923. tweets = tweets.filter(tweet => tweet.id_str != maxId);
  924. // Determine start and end of time interval to look for private tweets
  925. - const intervalStart: Date = oldestPrivateTweet
  926. - ? new Date(oldestPrivateTweet["created_at"])
  927. - : new Date();
  928. + const intervalStart: Date = oldestPrivateTweet ?
  929. + new Date(oldestPrivateTweet["created_at"]) :
  930. + new Date();
  931. const intervalEnd: Date = this.getOldestTweetTimestamp(tweets);
  932. + console.log('intervalEnd',intervalEnd);
  933. // Fetch private tweet hashs from P2P DB for corresponding interval
  934. const privateTweetHashs: object[] = await this.gun.fetchPrivateTweetHashsForUserInInterval(
  935. @@ -68,16 +71,16 @@ export class FeedProvider {
  936. * @param oldestPublicTweet oldest public tweet
  937. * @param oldestPrivateTweet oldest private tweet
  938. */
  939. - public async loadHomeTimeline(oldestPublicTweet?, oldestPrivateTweet?) {
  940. + public async loadHomeTimeline(oldestPublicTweet ? , oldestPrivateTweet ? ) {
  941. // Fetch tweets from Twitter
  942. const maxId = oldestPublicTweet ? oldestPublicTweet["id_str"] : undefined;
  943. let tweets = await this.twitter.fetchHomeFeed(maxId);
  944. tweets = tweets.filter(tweet => tweet.id_str != maxId);
  945. // Determine start and end of time interval to look for private tweets
  946. - const intervalStart: Date = oldestPrivateTweet
  947. - ? new Date(oldestPrivateTweet["created_at"])
  948. - : new Date();
  949. + const intervalStart: Date = oldestPrivateTweet ?
  950. + new Date(oldestPrivateTweet["created_at"]) :
  951. + new Date();
  952. const intervalEnd: Date = this.getOldestTweetTimestamp(tweets);
  953. // Fetch user's friends
  954. @@ -89,7 +92,7 @@ export class FeedProvider {
  955. .concat([this.userId]);
  956. // Fetch ipfs hashs for period
  957. - const promises: Promise<object[]>[] = friendsAndUserIds.map(accountId => {
  958. + const promises: Promise < object[] > [] = friendsAndUserIds.map(accountId => {
  959. return this.gun.fetchPrivateTweetHashsForUserInInterval(
  960. accountId,
  961. intervalStart,
  962. @@ -169,12 +172,12 @@ export class FeedProvider {
  963. return "";
  964. }
  965. - private async addUserToTweet(tweet: object): Promise<object> {
  966. + private async addUserToTweet(tweet: object): Promise < object > {
  967. tweet["user"] = await this.twitter.fetchUser(tweet["user_id"]);
  968. return tweet;
  969. }
  970. - private async addQuotedStatusToTweet(tweet: object): Promise<object> {
  971. + private async addQuotedStatusToTweet(tweet: object): Promise < object > {
  972. if (!tweet["quoted_status_id"]) return tweet;
  973. const quoted_status = await this.twitter.fetchTweet(
  974. tweet["quoted_status_id"]
  975. @@ -183,13 +186,13 @@ export class FeedProvider {
  976. return tweet;
  977. }
  978. - private async addOriginalStatusToTweet(tweet: object): Promise<object> {
  979. + private async addOriginalStatusToTweet(tweet: object): Promise < object > {
  980. if (!tweet["in_reply_to_status_id"]) return tweet;
  981. const originalTweet = await this.twitter.fetchTweet(
  982. tweet["in_reply_to_status_id"]
  983. );
  984. tweet["in_reply_to_screen_name"] =
  985. - originalTweet["data"]["user"]["screen_name"];
  986. + originalTweet["data"]["user"]["screen_name"];
  987. return tweet;
  988. }
  989. diff --git app/src/providers/p2p-database-gun/p2p-database-gun.ts app/src/providers/p2p-database-gun/p2p-database-gun.ts
  990. index 213173e..8d80de1 100644
  991. --- app/src/providers/p2p-database-gun/p2p-database-gun.ts
  992. +++ app/src/providers/p2p-database-gun/p2p-database-gun.ts
  993. @@ -15,7 +15,7 @@ export class P2pDatabaseGunProvider {
  994. * Hashtags are stored without reference to the users to provide these information on an extra dashboard to twitter
  995. * @param hashtagEntity extracted hashtags
  996. */
  997. - public async publishHashtags(hashtagEntity): Promise<void> {
  998. + public async publishHashtags(hashtagEntity): Promise < void > {
  999. const timestamp = new Date().setHours(0, 0, 1, 0);
  1000. const hashtagsSeparated = hashtagEntity
  1001. .map(el => el.hashtag)
  1002. @@ -29,10 +29,10 @@ export class P2pDatabaseGunProvider {
  1003. .put({ hashtags: hashtagsSeparated });
  1004. this.gun
  1005. - .get(this.osnPrefix)
  1006. - .get("hashtags")
  1007. - .get(timestamp)
  1008. - .set(hashtags);
  1009. + .get(this.osnPrefix)
  1010. + .get("hashtags")
  1011. + .get(timestamp)
  1012. + .set(hashtags);
  1013. }
  1014. /**
  1015. @@ -63,7 +63,7 @@ export class P2pDatabaseGunProvider {
  1016. userId,
  1017. intervalStart,
  1018. intervalEnd
  1019. - ): Promise<object[]> {
  1020. + ): Promise < object[] > {
  1021. const privateTweets = await this.gun
  1022. .get(this.osnPrefix)
  1023. .get("tweets")
  1024. @@ -73,8 +73,8 @@ export class P2pDatabaseGunProvider {
  1025. if (privateTweets) {
  1026. const entries = await Promise.all(
  1027. Object.keys(privateTweets)
  1028. - .filter(key => key !== "_")
  1029. - .map(key => this.gun.get(key).then())
  1030. + .filter(key => key !== "_")
  1031. + .map(key => this.gun.get(key).then())
  1032. );
  1033. return entries
  1034. diff --git app/tsconfig.json app/tsconfig.json
  1035. index 5d53142..2ce1629 100644
  1036. --- app/tsconfig.json
  1037. +++ app/tsconfig.json
  1038. @@ -1,5 +1,6 @@
  1039. {
  1040. - "compilerOptions": {
  1041. + "compilerOptions":
  1042. + {
  1043. "allowSyntheticDefaultImports": true,
  1044. "declaration": false,
  1045. "emitDecoratorMetadata": true,
  1046. @@ -22,7 +23,8 @@
  1047. "src/**/__tests__/*.ts"
  1048. ],
  1049. "compileOnSave": false,
  1050. - "atom": {
  1051. + "atom":
  1052. + {
  1053. "rewriteTsconfig": false
  1054. }
  1055. }
  1056. diff --git app/tslint.json app/tslint.json
  1057. index dd8e8d8..9754821 100644
  1058. --- app/tslint.json
  1059. +++ app/tslint.json
  1060. @@ -1,5 +1,6 @@
  1061. {
  1062. - "rules": {
  1063. + "rules":
  1064. + {
  1065. "no-duplicate-variable": true,
  1066. "no-unused-variable": [
  1067. true