@lifeready/core 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (379) hide show
  1. package/bundles/lifeready-core.umd.js +15939 -0
  2. package/bundles/lifeready-core.umd.js.map +1 -0
  3. package/bundles/lifeready-core.umd.min.js +16 -0
  4. package/bundles/lifeready-core.umd.min.js.map +1 -0
  5. package/esm2015/lib/_common/ast.js +40 -0
  6. package/esm2015/lib/_common/deferred-promise.js +24 -0
  7. package/esm2015/lib/_common/exceptions.js +157 -0
  8. package/esm2015/lib/_common/queries.gql.js +190 -0
  9. package/esm2015/lib/_common/run-outside-angular.js +79 -0
  10. package/esm2015/lib/_common/types.js +1 -0
  11. package/esm2015/lib/_common/utils.js +44 -0
  12. package/esm2015/lib/api/contact-card.gql.js +79 -0
  13. package/esm2015/lib/api/contact-card.service.js +154 -0
  14. package/esm2015/lib/api/contact-card2.gql.js +60 -0
  15. package/esm2015/lib/api/contact-card2.service.js +103 -0
  16. package/esm2015/lib/api/file.service.js +74 -0
  17. package/esm2015/lib/api/item2.gql.js +110 -0
  18. package/esm2015/lib/api/item2.service.js +311 -0
  19. package/esm2015/lib/api/key-exchange.gql.js +188 -0
  20. package/esm2015/lib/api/key-exchange.service.js +442 -0
  21. package/esm2015/lib/api/key-exchange.types.js +18 -0
  22. package/esm2015/lib/api/key-exchange2.gql.js +171 -0
  23. package/esm2015/lib/api/key-exchange2.service.js +479 -0
  24. package/esm2015/lib/api/lock.gql.js +40 -0
  25. package/esm2015/lib/api/lock.service.js +64 -0
  26. package/esm2015/lib/api/lr-apollo.service.js +46 -0
  27. package/esm2015/lib/api/lr-graphql/index.js +6 -0
  28. package/esm2015/lib/api/lr-graphql/lr-graphql.service.js +155 -0
  29. package/esm2015/lib/api/lr-graphql/lr-merged-mutation.js +213 -0
  30. package/esm2015/lib/api/lr-graphql/lr-mutation-base.js +51 -0
  31. package/esm2015/lib/api/lr-graphql/lr-mutation.js +48 -0
  32. package/esm2015/lib/api/lr-graphql/lr.service.js +18 -0
  33. package/esm2015/lib/api/message.service.js +138 -0
  34. package/esm2015/lib/api/persist.service.js +181 -0
  35. package/esm2015/lib/api/query-processor/common-processors.service.js +93 -0
  36. package/esm2015/lib/api/query-processor/index.js +3 -0
  37. package/esm2015/lib/api/query-processor/query-processor.service.js +192 -0
  38. package/esm2015/lib/api/query-processor/tp-password-reset-processor.service.js +109 -0
  39. package/esm2015/lib/api/shared-contact-card.service.js +119 -0
  40. package/esm2015/lib/api/shared-contact-card2.gql.js +41 -0
  41. package/esm2015/lib/api/shared-contact-card2.service.js +117 -0
  42. package/esm2015/lib/api/time.service.js +146 -0
  43. package/esm2015/lib/api/types/graphql.types.js +7 -0
  44. package/esm2015/lib/api/types/index.js +3 -0
  45. package/esm2015/lib/api/types/lr-graphql.types.js +71 -0
  46. package/esm2015/lib/auth/auth.config.js +57 -0
  47. package/esm2015/lib/auth/auth.gql.js +48 -0
  48. package/esm2015/lib/auth/auth.types.js +27 -0
  49. package/esm2015/lib/auth/idle.service.js +168 -0
  50. package/esm2015/lib/auth/idle.types.js +7 -0
  51. package/esm2015/lib/auth/lbop.service.js +355 -0
  52. package/esm2015/lib/auth/life-ready-auth.service.js +500 -0
  53. package/esm2015/lib/auth/password.service.js +320 -0
  54. package/esm2015/lib/auth/register.service.js +172 -0
  55. package/esm2015/lib/auth/two-factor.service.js +74 -0
  56. package/esm2015/lib/category/category-meta.service.js +99 -0
  57. package/esm2015/lib/category/category.gql.js +406 -0
  58. package/esm2015/lib/category/category.service.js +390 -0
  59. package/esm2015/lib/category/category.types.js +29 -0
  60. package/esm2015/lib/cryptography/cryptography.types.js +11 -0
  61. package/esm2015/lib/cryptography/encryption.service.js +189 -0
  62. package/esm2015/lib/cryptography/key-factory.service.js +237 -0
  63. package/esm2015/lib/cryptography/key-graph.service.js +280 -0
  64. package/esm2015/lib/cryptography/key-meta.service.js +200 -0
  65. package/esm2015/lib/cryptography/key.service.js +124 -0
  66. package/esm2015/lib/cryptography/slip39.service.js +169 -0
  67. package/esm2015/lib/cryptography/web-crypto.service.js +29 -0
  68. package/esm2015/lib/life-ready.config.js +84 -0
  69. package/esm2015/lib/life-ready.module.js +74 -0
  70. package/esm2015/lib/plan/plan.gql.js +123 -0
  71. package/esm2015/lib/plan/plan.service.js +149 -0
  72. package/esm2015/lib/plan/plan.types.js +11 -0
  73. package/esm2015/lib/record/record-attachment.service.js +101 -0
  74. package/esm2015/lib/record/record.gql.js +179 -0
  75. package/esm2015/lib/record/record.service.js +206 -0
  76. package/esm2015/lib/record/record.types.js +15 -0
  77. package/esm2015/lib/record-type/record-type.service.js +75 -0
  78. package/esm2015/lib/record-type/record-type.types.js +28 -0
  79. package/esm2015/lib/scenario/approvals/scenario-approval.gql.js +105 -0
  80. package/esm2015/lib/scenario/approvals/scenario-approval.types.js +1 -0
  81. package/esm2015/lib/scenario/approvals/scenario-approver.service.js +300 -0
  82. package/esm2015/lib/scenario/claimants/scenario-claimant.gql.js +52 -0
  83. package/esm2015/lib/scenario/claimants/scenario-claimant.service.js +97 -0
  84. package/esm2015/lib/scenario/claimants/scenario-claimant.types.js +1 -0
  85. package/esm2015/lib/scenario/receivers/scenario-receiver.gql.js +150 -0
  86. package/esm2015/lib/scenario/receivers/scenario-receiver.service.js +229 -0
  87. package/esm2015/lib/scenario/receivers/scenario-receiver.types.js +1 -0
  88. package/esm2015/lib/scenario/scenario-setup.service.js +269 -0
  89. package/esm2015/lib/scenario/scenario.gql.js +368 -0
  90. package/esm2015/lib/scenario/scenario.service.js +611 -0
  91. package/esm2015/lib/scenario/scenario.types.js +64 -0
  92. package/esm2015/lib/search/search.gql.js +62 -0
  93. package/esm2015/lib/search/search.service.js +156 -0
  94. package/esm2015/lib/search/search.types.js +6 -0
  95. package/esm2015/lib/trusted-parties/tp-password-reset-request.service.js +112 -0
  96. package/esm2015/lib/trusted-parties/tp-password-reset-user.service.js +129 -0
  97. package/esm2015/lib/trusted-parties/tp-password-reset.constants.js +4 -0
  98. package/esm2015/lib/trusted-parties/tp-password-reset.gql.js +232 -0
  99. package/esm2015/lib/trusted-parties/tp-password-reset.service.js +299 -0
  100. package/esm2015/lib/trusted-parties/trusted-party.gql.js +148 -0
  101. package/esm2015/lib/trusted-parties/trusted-party.service.js +326 -0
  102. package/esm2015/lib/trusted-parties/trusted-party.types.js +41 -0
  103. package/esm2015/lib/trusted-parties/trusted-party2.gql.js +87 -0
  104. package/esm2015/lib/trusted-parties/trusted-party2.service.js +215 -0
  105. package/esm2015/lib/users/profile-details.service.js +214 -0
  106. package/esm2015/lib/users/profile.gql.js +97 -0
  107. package/esm2015/lib/users/profile.service.js +169 -0
  108. package/esm2015/lib/users/profile.types.js +34 -0
  109. package/esm2015/lib/users/user.gql.js +60 -0
  110. package/esm2015/lib/users/user.service.js +79 -0
  111. package/esm2015/lib/users/user.types.js +5 -0
  112. package/esm2015/lifeready-core.js +10 -0
  113. package/esm2015/public-api.js +81 -0
  114. package/fesm2015/lifeready-core.js +13314 -0
  115. package/fesm2015/lifeready-core.js.map +1 -0
  116. package/lib/_common/ast.d.ts +11 -0
  117. package/lib/_common/deferred-promise.d.ts +12 -0
  118. package/lib/_common/exceptions.d.ts +109 -0
  119. package/lib/_common/queries.gql.d.ts +10 -0
  120. package/lib/_common/run-outside-angular.d.ts +14 -0
  121. package/{src/lib/_common/types.ts → lib/_common/types.d.ts} +3 -6
  122. package/lib/_common/utils.d.ts +3 -0
  123. package/lib/api/contact-card.gql.d.ts +7 -0
  124. package/lib/api/contact-card.service.d.ts +52 -0
  125. package/lib/api/contact-card2.gql.d.ts +34 -0
  126. package/lib/api/contact-card2.service.d.ts +49 -0
  127. package/lib/api/file.service.d.ts +18 -0
  128. package/lib/api/item2.gql.d.ts +96 -0
  129. package/lib/api/item2.service.d.ts +177 -0
  130. package/lib/api/key-exchange.gql.d.ts +9 -0
  131. package/lib/api/key-exchange.service.d.ts +39 -0
  132. package/lib/api/key-exchange.types.d.ts +196 -0
  133. package/lib/api/key-exchange2.gql.d.ts +125 -0
  134. package/lib/api/key-exchange2.service.d.ts +187 -0
  135. package/lib/api/lock.gql.d.ts +27 -0
  136. package/lib/api/lock.service.d.ts +25 -0
  137. package/lib/api/lr-apollo.service.d.ts +15 -0
  138. package/lib/api/lr-graphql/lr-graphql.service.d.ts +60 -0
  139. package/lib/api/lr-graphql/lr-merged-mutation.d.ts +27 -0
  140. package/lib/api/lr-graphql/lr-mutation-base.d.ts +28 -0
  141. package/lib/api/lr-graphql/lr-mutation.d.ts +8 -0
  142. package/lib/api/lr-graphql/lr.service.d.ts +9 -0
  143. package/lib/api/message.service.d.ts +58 -0
  144. package/lib/api/persist.service.d.ts +31 -0
  145. package/lib/api/query-processor/common-processors.service.d.ts +36 -0
  146. package/lib/api/query-processor/query-processor.service.d.ts +18 -0
  147. package/lib/api/query-processor/tp-password-reset-processor.service.d.ts +15 -0
  148. package/lib/api/shared-contact-card.service.d.ts +33 -0
  149. package/lib/api/shared-contact-card2.gql.d.ts +36 -0
  150. package/lib/api/shared-contact-card2.service.d.ts +45 -0
  151. package/lib/api/time.service.d.ts +16 -0
  152. package/lib/api/types/graphql.types.d.ts +29 -0
  153. package/lib/api/types/lr-graphql.types.d.ts +385 -0
  154. package/lib/auth/auth.config.d.ts +5 -0
  155. package/lib/auth/auth.gql.d.ts +15 -0
  156. package/lib/auth/auth.types.d.ts +66 -0
  157. package/lib/auth/idle.service.d.ts +40 -0
  158. package/lib/auth/idle.types.d.ts +10 -0
  159. package/lib/auth/lbop.service.d.ts +91 -0
  160. package/lib/auth/life-ready-auth.service.d.ts +59 -0
  161. package/lib/auth/password.service.d.ts +78 -0
  162. package/lib/auth/register.service.d.ts +25 -0
  163. package/lib/auth/two-factor.service.d.ts +15 -0
  164. package/lib/category/category-meta.service.d.ts +23 -0
  165. package/lib/category/category.gql.d.ts +45 -0
  166. package/lib/category/category.service.d.ts +67 -0
  167. package/lib/category/category.types.d.ts +79 -0
  168. package/lib/cryptography/cryptography.types.d.ts +83 -0
  169. package/lib/cryptography/encryption.service.d.ts +41 -0
  170. package/lib/cryptography/key-factory.service.d.ts +38 -0
  171. package/lib/cryptography/key-graph.service.d.ts +33 -0
  172. package/lib/cryptography/key-meta.service.d.ts +44 -0
  173. package/lib/cryptography/key.service.d.ts +36 -0
  174. package/lib/cryptography/slip39.service.d.ts +43 -0
  175. package/lib/cryptography/web-crypto.service.d.ts +5 -0
  176. package/lib/life-ready.config.d.ts +14 -0
  177. package/lib/life-ready.module.d.ts +5 -0
  178. package/lib/plan/plan.gql.d.ts +11 -0
  179. package/lib/plan/plan.service.d.ts +33 -0
  180. package/lib/plan/plan.types.d.ts +31 -0
  181. package/lib/record/record-attachment.service.d.ts +16 -0
  182. package/lib/record/record.gql.d.ts +14 -0
  183. package/lib/record/record.service.d.ts +25 -0
  184. package/lib/record/record.types.d.ts +57 -0
  185. package/lib/record-type/record-type.service.d.ts +11 -0
  186. package/lib/record-type/record-type.types.d.ts +50 -0
  187. package/lib/scenario/approvals/scenario-approval.gql.d.ts +7 -0
  188. package/lib/scenario/approvals/scenario-approval.types.d.ts +63 -0
  189. package/lib/scenario/approvals/scenario-approver.service.d.ts +32 -0
  190. package/lib/scenario/claimants/scenario-claimant.gql.d.ts +5 -0
  191. package/lib/scenario/claimants/scenario-claimant.service.d.ts +17 -0
  192. package/lib/scenario/claimants/scenario-claimant.types.d.ts +18 -0
  193. package/lib/scenario/receivers/scenario-receiver.gql.d.ts +8 -0
  194. package/lib/scenario/receivers/scenario-receiver.service.d.ts +30 -0
  195. package/lib/scenario/receivers/scenario-receiver.types.d.ts +54 -0
  196. package/lib/scenario/scenario-setup.service.d.ts +22 -0
  197. package/lib/scenario/scenario.gql.d.ts +34 -0
  198. package/lib/scenario/scenario.service.d.ts +58 -0
  199. package/lib/scenario/scenario.types.d.ts +217 -0
  200. package/lib/search/search.gql.d.ts +1 -0
  201. package/lib/search/search.service.d.ts +25 -0
  202. package/lib/search/search.types.d.ts +20 -0
  203. package/lib/trusted-parties/tp-password-reset-request.service.d.ts +20 -0
  204. package/lib/trusted-parties/tp-password-reset-user.service.d.ts +35 -0
  205. package/lib/trusted-parties/tp-password-reset.constants.d.ts +3 -0
  206. package/lib/trusted-parties/tp-password-reset.gql.d.ts +218 -0
  207. package/lib/trusted-parties/tp-password-reset.service.d.ts +130 -0
  208. package/lib/trusted-parties/trusted-party.gql.d.ts +9 -0
  209. package/lib/trusted-parties/trusted-party.service.d.ts +44 -0
  210. package/lib/trusted-parties/trusted-party.types.d.ts +102 -0
  211. package/lib/trusted-parties/trusted-party2.gql.d.ts +79 -0
  212. package/lib/trusted-parties/trusted-party2.service.d.ts +114 -0
  213. package/lib/users/profile-details.service.d.ts +21 -0
  214. package/lib/users/profile.gql.d.ts +11 -0
  215. package/lib/users/profile.service.d.ts +35 -0
  216. package/lib/users/profile.types.d.ts +96 -0
  217. package/lib/users/user.gql.d.ts +9 -0
  218. package/lib/users/user.service.d.ts +12 -0
  219. package/lib/users/user.types.d.ts +23 -0
  220. package/lifeready-core.d.ts +9 -0
  221. package/lifeready-core.metadata.json +1 -0
  222. package/package.json +29 -21
  223. package/{src/public-api.ts → public-api.d.ts} +0 -19
  224. package/karma.conf.js +0 -32
  225. package/ng-package.json +0 -26
  226. package/src/lib/_common/ast.ts +0 -75
  227. package/src/lib/_common/deferred-promise.ts +0 -35
  228. package/src/lib/_common/exceptions.ts +0 -189
  229. package/src/lib/_common/queries.gql.ts +0 -200
  230. package/src/lib/_common/run-outside-angular.ts +0 -125
  231. package/src/lib/_common/tests.ts +0 -82
  232. package/src/lib/_common/utils.ts +0 -57
  233. package/src/lib/api/api-mutation.spec.ts +0 -547
  234. package/src/lib/api/api-query.spec.ts +0 -40
  235. package/src/lib/api/contact-card.gql.ts +0 -85
  236. package/src/lib/api/contact-card.service.spec.ts +0 -249
  237. package/src/lib/api/contact-card.service.ts +0 -228
  238. package/src/lib/api/contact-card2.gql.ts +0 -93
  239. package/src/lib/api/contact-card2.service.spec.ts +0 -297
  240. package/src/lib/api/contact-card2.service.ts +0 -139
  241. package/src/lib/api/file.service.spec.ts +0 -14
  242. package/src/lib/api/file.service.ts +0 -81
  243. package/src/lib/api/item2.gql.ts +0 -211
  244. package/src/lib/api/item2.service.spec.ts +0 -1043
  245. package/src/lib/api/item2.service.ts +0 -481
  246. package/src/lib/api/key-exchange.gql.ts +0 -196
  247. package/src/lib/api/key-exchange.service.spec.ts +0 -470
  248. package/src/lib/api/key-exchange.service.ts +0 -731
  249. package/src/lib/api/key-exchange.types.ts +0 -235
  250. package/src/lib/api/key-exchange2.gql.ts +0 -310
  251. package/src/lib/api/key-exchange2.service.spec.ts +0 -892
  252. package/src/lib/api/key-exchange2.service.ts +0 -875
  253. package/src/lib/api/lock.gql.ts +0 -67
  254. package/src/lib/api/lock.service.spec.ts +0 -549
  255. package/src/lib/api/lock.service.ts +0 -57
  256. package/src/lib/api/lr-apollo.service.spec.ts +0 -27
  257. package/src/lib/api/lr-apollo.service.ts +0 -43
  258. package/src/lib/api/lr-graphql/lr-graphql.service.ts +0 -313
  259. package/src/lib/api/lr-graphql/lr-merged-mutation.ts +0 -377
  260. package/src/lib/api/lr-graphql/lr-mutation-base.ts +0 -67
  261. package/src/lib/api/lr-graphql/lr-mutation.ts +0 -74
  262. package/src/lib/api/lr-graphql/lr.service.ts +0 -28
  263. package/src/lib/api/message.service.spec.ts +0 -20
  264. package/src/lib/api/message.service.ts +0 -210
  265. package/src/lib/api/persist.service.spec.ts +0 -209
  266. package/src/lib/api/persist.service.ts +0 -220
  267. package/src/lib/api/query-processor/common-processors.service.ts +0 -148
  268. package/src/lib/api/query-processor/query-processor.service.ts +0 -240
  269. package/src/lib/api/query-processor/tp-password-reset-processor.service.ts +0 -177
  270. package/src/lib/api/shared-contact-card.service.ts +0 -156
  271. package/src/lib/api/shared-contact-card2.gql.ts +0 -76
  272. package/src/lib/api/shared-contact-card2.service.ts +0 -154
  273. package/src/lib/api/time.service.spec.ts +0 -48
  274. package/src/lib/api/time.service.ts +0 -155
  275. package/src/lib/api/types/graphql.types.ts +0 -48
  276. package/src/lib/api/types/lr-graphql.types.ts +0 -467
  277. package/src/lib/auth/auth.config.ts +0 -83
  278. package/src/lib/auth/auth.gql.ts +0 -62
  279. package/src/lib/auth/auth.types.ts +0 -79
  280. package/src/lib/auth/idle.service.spec.ts +0 -119
  281. package/src/lib/auth/idle.service.ts +0 -208
  282. package/src/lib/auth/idle.types.ts +0 -11
  283. package/src/lib/auth/lbop.service.spec.ts +0 -56
  284. package/src/lib/auth/lbop.service.ts +0 -539
  285. package/src/lib/auth/life-ready-auth.service.spec.ts +0 -70
  286. package/src/lib/auth/life-ready-auth.service.ts +0 -454
  287. package/src/lib/auth/password.service.spec.ts +0 -51
  288. package/src/lib/auth/password.service.ts +0 -438
  289. package/src/lib/auth/register.service.spec.ts +0 -31
  290. package/src/lib/auth/register.service.ts +0 -181
  291. package/src/lib/auth/two-factor.service.spec.ts +0 -21
  292. package/src/lib/auth/two-factor.service.ts +0 -69
  293. package/src/lib/category/category-meta.service.spec.ts +0 -28
  294. package/src/lib/category/category-meta.service.ts +0 -125
  295. package/src/lib/category/category.gql.ts +0 -449
  296. package/src/lib/category/category.service.spec.ts +0 -26
  297. package/src/lib/category/category.service.ts +0 -498
  298. package/src/lib/category/category.types.ts +0 -89
  299. package/src/lib/cryptography/cryptography.types.ts +0 -108
  300. package/src/lib/cryptography/encryption.service.spec.ts +0 -125
  301. package/src/lib/cryptography/encryption.service.ts +0 -243
  302. package/src/lib/cryptography/key-factory.service.spec.ts +0 -15
  303. package/src/lib/cryptography/key-factory.service.ts +0 -303
  304. package/src/lib/cryptography/key-graph.service.spec.ts +0 -16
  305. package/src/lib/cryptography/key-graph.service.ts +0 -354
  306. package/src/lib/cryptography/key-meta.service.spec.ts +0 -40
  307. package/src/lib/cryptography/key-meta.service.ts +0 -254
  308. package/src/lib/cryptography/key.service.spec.ts +0 -16
  309. package/src/lib/cryptography/key.service.ts +0 -154
  310. package/src/lib/cryptography/slip39.service.spec.ts +0 -44
  311. package/src/lib/cryptography/slip39.service.ts +0 -204
  312. package/src/lib/cryptography/web-crypto.service.ts +0 -22
  313. package/src/lib/life-ready.config.ts +0 -127
  314. package/src/lib/life-ready.module.ts +0 -81
  315. package/src/lib/plan/plan.gql.ts +0 -133
  316. package/src/lib/plan/plan.service.spec.ts +0 -294
  317. package/src/lib/plan/plan.service.ts +0 -198
  318. package/src/lib/plan/plan.types.ts +0 -37
  319. package/src/lib/record/record-attachment.service.spec.ts +0 -31
  320. package/src/lib/record/record-attachment.service.ts +0 -101
  321. package/src/lib/record/record.gql.ts +0 -192
  322. package/src/lib/record/record.service.spec.ts +0 -598
  323. package/src/lib/record/record.service.ts +0 -236
  324. package/src/lib/record/record.types.ts +0 -86
  325. package/src/lib/record-type/record-type.service.spec.ts +0 -16
  326. package/src/lib/record-type/record-type.service.ts +0 -71
  327. package/src/lib/record-type/record-type.types.ts +0 -58
  328. package/src/lib/scenario/approvals/scenario-approval.gql.ts +0 -112
  329. package/src/lib/scenario/approvals/scenario-approval.types.ts +0 -85
  330. package/src/lib/scenario/approvals/scenario-approver.service.spec.ts +0 -16
  331. package/src/lib/scenario/approvals/scenario-approver.service.ts +0 -422
  332. package/src/lib/scenario/claimants/scenario-claimant.gql.ts +0 -56
  333. package/src/lib/scenario/claimants/scenario-claimant.service.spec.ts +0 -16
  334. package/src/lib/scenario/claimants/scenario-claimant.service.ts +0 -100
  335. package/src/lib/scenario/claimants/scenario-claimant.types.ts +0 -21
  336. package/src/lib/scenario/receivers/scenario-receiver.gql.ts +0 -157
  337. package/src/lib/scenario/receivers/scenario-receiver.service.spec.ts +0 -16
  338. package/src/lib/scenario/receivers/scenario-receiver.service.ts +0 -278
  339. package/src/lib/scenario/receivers/scenario-receiver.types.ts +0 -66
  340. package/src/lib/scenario/scenario-setup.service.spec.ts +0 -22
  341. package/src/lib/scenario/scenario-setup.service.ts +0 -369
  342. package/src/lib/scenario/scenario.gql.ts +0 -404
  343. package/src/lib/scenario/scenario.service.spec.ts +0 -1586
  344. package/src/lib/scenario/scenario.service.ts +0 -811
  345. package/src/lib/scenario/scenario.types.ts +0 -258
  346. package/src/lib/search/search.gql.ts +0 -62
  347. package/src/lib/search/search.service.spec.ts +0 -57
  348. package/src/lib/search/search.service.ts +0 -174
  349. package/src/lib/search/search.types.ts +0 -24
  350. package/src/lib/trusted-parties/tp-password-reset-request.service.ts +0 -140
  351. package/src/lib/trusted-parties/tp-password-reset-user.service.ts +0 -359
  352. package/src/lib/trusted-parties/tp-password-reset.gql.ts +0 -453
  353. package/src/lib/trusted-parties/tp-password-reset.service.spec.ts +0 -602
  354. package/src/lib/trusted-parties/tp-password-reset.service.ts +0 -482
  355. package/src/lib/trusted-parties/trusted-party.gql.ts +0 -159
  356. package/src/lib/trusted-parties/trusted-party.service.spec.ts +0 -1008
  357. package/src/lib/trusted-parties/trusted-party.service.ts +0 -394
  358. package/src/lib/trusted-parties/trusted-party.types.ts +0 -119
  359. package/src/lib/trusted-parties/trusted-party2.gql.ts +0 -165
  360. package/src/lib/trusted-parties/trusted-party2.service.spec.ts +0 -1782
  361. package/src/lib/trusted-parties/trusted-party2.service.ts +0 -272
  362. package/src/lib/users/profile-details.service.spec.ts +0 -45
  363. package/src/lib/users/profile-details.service.ts +0 -278
  364. package/src/lib/users/profile.gql.ts +0 -108
  365. package/src/lib/users/profile.service.spec.ts +0 -97
  366. package/src/lib/users/profile.service.ts +0 -224
  367. package/src/lib/users/profile.types.ts +0 -101
  368. package/src/lib/users/user.gql.ts +0 -69
  369. package/src/lib/users/user.service.spec.ts +0 -161
  370. package/src/lib/users/user.service.ts +0 -72
  371. package/src/lib/users/user.types.ts +0 -27
  372. package/src/test.ts +0 -21
  373. package/tsconfig.lib.json +0 -21
  374. package/tsconfig.lib.prod.json +0 -6
  375. package/tsconfig.spec.json +0 -10
  376. package/tslint.json +0 -17
  377. /package/{src/lib/api/lr-graphql/index.ts → lib/api/lr-graphql/index.d.ts} +0 -0
  378. /package/{src/lib/api/query-processor/index.ts → lib/api/query-processor/index.d.ts} +0 -0
  379. /package/{src/lib/api/types/index.ts → lib/api/types/index.d.ts} +0 -0
@@ -1,454 +0,0 @@
1
- import { Inject, Injectable, isDevMode } from '@angular/core';
2
- import { CognitoUser } from '@aws-amplify/auth';
3
- import { Hub } from '@aws-amplify/core';
4
- import { CognitoUserAttribute } from 'amazon-cognito-identity-js';
5
- import { Observable, ReplaySubject } from 'rxjs';
6
- import { PassIdpParams } from '../cryptography/cryptography.types';
7
- import { KeyGraphService } from '../cryptography/key-graph.service';
8
- import { KeyService } from '../cryptography/key.service';
9
- import { ProfileService } from '../users/profile.service';
10
- import { PasswordChangeStatus } from '../users/profile.types';
11
- import {
12
- LrConcurrentAccessException,
13
- LrBadRequestException,
14
- } from '../_common/exceptions';
15
- import {
16
- CognitoChallengeUser,
17
- CurrentUser,
18
- TpPasswordResetUser,
19
- LoginResult,
20
- RecoveryStatus,
21
- } from './auth.types';
22
- import { PasswordService } from './password.service';
23
- import { AuthClass } from '@aws-amplify/auth/lib-esm/Auth';
24
- import { TpPasswordResetUserQuery } from '../trusted-parties/tp-password-reset.gql';
25
- import { IdleService } from './idle.service';
26
- import { KeyFactoryService } from '../cryptography/key-factory.service';
27
- import { LrGraphQLService, LrMutation } from '../api/lr-graphql';
28
- import { TpPasswordResetUserNode } from '../api/types';
29
- import { TpPasswordResetProcessorService } from '../api/query-processor/tp-password-reset-processor.service';
30
- import { SetSessionEncryptionKeyMutation } from './auth.gql';
31
- import { PersistService } from '../api/persist.service';
32
- import { JWK } from 'node-jose';
33
- import { LifeReadyConfig, LR_CONFIG } from '../life-ready.config';
34
-
35
- export const initialiseAuth = (authService: LifeReadyAuthService) => {
36
- return () => authService.initialise();
37
- };
38
-
39
- @Injectable({
40
- providedIn: 'root',
41
- })
42
- export class LifeReadyAuthService {
43
- private hubSubject: ReplaySubject<any> = new ReplaySubject<any>(1);
44
- private currentUser: CurrentUser;
45
-
46
- constructor(
47
- @Inject(LR_CONFIG) private config: LifeReadyConfig,
48
- private auth: AuthClass,
49
- private keyFactory: KeyFactoryService,
50
- private keyService: KeyService,
51
- private profileService: ProfileService,
52
- private keyGraphService: KeyGraphService,
53
- private passwordService: PasswordService,
54
- private idleService: IdleService,
55
- private lrGraphQL: LrGraphQLService,
56
- private tpPasswordResetProcessorService: TpPasswordResetProcessorService,
57
- private persistService: PersistService
58
- ) {}
59
-
60
- public async initialise() {
61
- Hub.listen('auth', (data) => this.hubSubject.next(data.payload));
62
- }
63
-
64
- private async loginIdpImpl(
65
- emailOrPhone: string,
66
- password: string,
67
- passIdpParams: PassIdpParams,
68
- recoveryStatus: RecoveryStatus
69
- ): Promise<CognitoChallengeUser> {
70
- const passIdpResult = await this.keyFactory.derivePassIdp({
71
- password,
72
- ...passIdpParams,
73
- });
74
- // Use the derived password to signin with cognito
75
- const user = await this.auth.signIn(
76
- emailOrPhone,
77
- this.passwordService.getPassIdpString(passIdpResult.jwk)
78
- );
79
-
80
- user.recoveryStatus = recoveryStatus;
81
-
82
- return user;
83
- }
84
-
85
- private async loginIdp(
86
- emailOrPhone: string,
87
- password: string
88
- ): Promise<CognitoChallengeUser> {
89
- // Download the salt needed to derive the PassIdp
90
- const passIdpApiResult = await this.profileService.getPassIdpParams(
91
- emailOrPhone
92
- );
93
-
94
- if (
95
- passIdpApiResult.passwordChangeStatus === PasswordChangeStatus.InProgress
96
- ) {
97
- throw new LrConcurrentAccessException('A password change is in progress');
98
- }
99
-
100
- if (
101
- passIdpApiResult.passwordChangeStatus === PasswordChangeStatus.Recovery
102
- ) {
103
- console.log('In recovery mode.');
104
- // Let's say we don't know if the password is the new one or the old one. We just have to try both.
105
- try {
106
- const user = await this.loginIdpImpl(
107
- emailOrPhone,
108
- password,
109
- passIdpApiResult.newPassIdpParams,
110
- RecoveryStatus.NEW_PASSWORD
111
- );
112
- // New password worked. Let's set to the current password
113
-
114
- // --Potential Failure Point 1--
115
- // if changePasswordComplete() doesn't get called, then it should remain
116
-
117
- console.log('New password works!');
118
-
119
- return user;
120
- } catch (error) {
121
- // Just bubble up any other type of error.
122
- if (error.code !== 'NotAuthorizedException') {
123
- throw error;
124
- }
125
- // pass, try again assuming it's the old password
126
- }
127
-
128
- // Now assume it's the previous password. Any exception is allowed to bubble up.
129
- try {
130
- const user = await this.loginIdpImpl(
131
- emailOrPhone,
132
- password,
133
- passIdpApiResult.currentPassIdpParams,
134
- RecoveryStatus.OLD_PASSWORD
135
- );
136
- // Old password worked.
137
- console.log('Old password works!');
138
-
139
- return user;
140
- } catch (error) {
141
- // Just bubble up any other type of error.
142
- throw error.code === 'NotAuthorizedException'
143
- ? new LrBadRequestException(
144
- 'The password change request was interrupted, please try to login with both your new and old password'
145
- )
146
- : error;
147
- }
148
- }
149
-
150
- // Try against as the TP password reset account
151
- if (passIdpApiResult.tpPasswordReset) {
152
- try {
153
- // TP password reset is in process. We need to try the password against both
154
- // original account and the new reset account.
155
- const reset = passIdpApiResult.tpPasswordReset;
156
- const ret = await this.loginIdpImpl(
157
- reset.resetUsername,
158
- password,
159
- reset.passIdpParams,
160
- RecoveryStatus.NONE
161
- );
162
- ret.isTpPasswordResetUser = true;
163
-
164
- return ret;
165
- } catch (err) {
166
- // continue, try again as regular user.
167
- }
168
- }
169
-
170
- // Login as regular user
171
- return await this.loginIdpImpl(
172
- emailOrPhone,
173
- password,
174
- passIdpApiResult.currentPassIdpParams,
175
- RecoveryStatus.NONE
176
- );
177
- }
178
-
179
- protected async handleSessionEncryptionKey() {
180
- if (this.config.disableSessionEncryptionKey) {
181
- if (!isDevMode()) {
182
- const msg =
183
- 'You should not set disableSessionEncryptionKey=True in mode prod. It defaults to false.';
184
- console.error(msg);
185
- throw new Error(msg);
186
- } else {
187
- console.warn(
188
- 'You have set disableSessionEncryptionKey=True. Make sure not to do this in prod mode.'
189
- );
190
- }
191
- } else {
192
- // Set the session key to a new encryption key for this session
193
- const sessionEncryptionKey = await this.keyFactory.createKey();
194
- await this.lrGraphQL.lrMutate(
195
- new LrMutation({
196
- mutation: SetSessionEncryptionKeyMutation,
197
- variables: {
198
- input: {
199
- sessionEncryptionKey: JSON.stringify(
200
- sessionEncryptionKey.toJSON(true)
201
- ),
202
- },
203
- },
204
- }),
205
- {
206
- includeKeyGraph: false,
207
- }
208
- );
209
-
210
- this.persistService.setServerSessionEncryptionKey(sessionEncryptionKey);
211
- }
212
- }
213
-
214
- protected async handlePostAuth(cognitoUser: CognitoChallengeUser) {
215
- await this.handlePasswordRecovery(cognitoUser);
216
- await this.handleSessionEncryptionKey();
217
- }
218
-
219
- public async login(
220
- emailOrPhone: string,
221
- password: string
222
- ): Promise<LoginResult> {
223
- const cognitoUser = await this.loginIdp(emailOrPhone, password);
224
-
225
- // todo: Meet MFA challenges.
226
- if (['SMS_MFA', 'SOFTWARE_TOKEN_MFA'].includes(cognitoUser.challengeName)) {
227
- return { hasChallenge: true, challenge: cognitoUser };
228
- }
229
-
230
- await this.handlePostAuth(cognitoUser);
231
-
232
- if (cognitoUser.isTpPasswordResetUser) {
233
- // Assuming there is no MFA on the TP reset user.
234
- const resetUser = await this.loadResetUser(password);
235
- return { hasChallenge: false, resetUser };
236
- } else {
237
- const user = await this.loadUser(cognitoUser, password);
238
- await this.idleService.start(); // Run idleService whenever user is logged in.
239
- return { hasChallenge: false, user };
240
- }
241
- }
242
-
243
- // TODO <AZ> We need to handle the isTpPasswordResetUser=True case here after MFA as well.
244
- public async verifyLogin(
245
- challenge: CognitoChallengeUser,
246
- password: string,
247
- rememberMe: boolean,
248
- code: string
249
- ): Promise<CurrentUser> {
250
- await this.auth.confirmSignIn(challenge, code, challenge.challengeName);
251
-
252
- // TODO: this.auth.confirmSignIn() could return another challenge.
253
-
254
- const cognitoUser: CognitoUser = await this.auth.currentAuthenticatedUser();
255
-
256
- await this.handlePostAuth(challenge);
257
-
258
- const user = await this.loadUser(cognitoUser, password);
259
-
260
- if (rememberMe) {
261
- cognitoUser.setDeviceStatusRemembered({
262
- onSuccess: () => {},
263
- onFailure: (e) => console.error(e),
264
- });
265
- }
266
-
267
- return user;
268
- }
269
-
270
- async handlePasswordRecovery(user: CognitoChallengeUser) {
271
- if (user.recoveryStatus !== RecoveryStatus.NONE) {
272
- const jwtToken = user
273
- .getSignInUserSession()
274
- .getAccessToken()
275
- .getJwtToken();
276
- await this.passwordService.changePasswordComplete(
277
- jwtToken,
278
- user.recoveryStatus === RecoveryStatus.NEW_PASSWORD
279
- );
280
- }
281
- }
282
-
283
- async getUser(reload: boolean = false): Promise<CurrentUser> {
284
- if (!reload && this.currentUser) {
285
- return this.currentUser;
286
- }
287
- this.currentUser = await this.loadUser(
288
- await this.auth.currentAuthenticatedUser()
289
- );
290
- console.log('Starting idle service.');
291
- await this.idleService.start(); // Run idleService whenever user is logged in.
292
- return this.currentUser;
293
- }
294
-
295
- private mapTPVaultAccess(features?: any): boolean {
296
- const tpVaultFeature = features?.tpVault;
297
- return (
298
- tpVaultFeature?.length > 0 &&
299
- tpVaultFeature.some((feature) => feature.toUpperCase() === 'ACCESS')
300
- );
301
- }
302
-
303
- private async loadUser(
304
- cognitoUser: CognitoUser,
305
- password?: string
306
- ): Promise<CurrentUser> {
307
- const {
308
- currentUser,
309
- contactCard,
310
- userPlans,
311
- } = await this.profileService.getCurrentUser();
312
-
313
- if (currentUser.sessionEncryptionKey) {
314
- this.persistService.setServerSessionEncryptionKey(
315
- await JWK.asKey(currentUser.sessionEncryptionKey)
316
- );
317
- }
318
-
319
- const userAttributes = await this.auth.userAttributes(cognitoUser);
320
-
321
- if (password) {
322
- const passKey = (
323
- await this.keyFactory.derivePassKey({
324
- password,
325
- ...currentUser.currentUserKey.passKey.passKeyParams,
326
- })
327
- ).jwk;
328
-
329
- await this.idleService.persistMasterKey(
330
- await this.keyGraphService.unwrapWithPassKey(
331
- currentUser.currentUserKey.passKey.id,
332
- passKey,
333
- currentUser.currentUserKey.masterKey.id
334
- )
335
- );
336
- }
337
- await this.keyGraphService.populateKeys(currentUser.currentUserKey);
338
-
339
- return {
340
- id: currentUser.id,
341
- sub: this.getUserAttribute('sub', userAttributes),
342
- username: currentUser.username,
343
- currentUserKey: currentUser.currentUserKey,
344
- getAccessJwtToken: () =>
345
- cognitoUser.getSignInUserSession().getAccessToken().getJwtToken(),
346
- email: this.getUserAttribute('email', userAttributes),
347
- emailVerified:
348
- this.getUserAttribute('email_verified', userAttributes) === 'true',
349
- phone: this.getUserAttribute('phone_number', userAttributes),
350
- phoneVerified:
351
- this.getUserAttribute('phone_number_verified', userAttributes) ===
352
- 'true',
353
- contactCard: {
354
- ...(await this.profileService.decryptContactCard(contactCard)),
355
- },
356
- userDelete: currentUser.userDelete,
357
- userPlans,
358
- hasTPVaultAccess: this.mapTPVaultAccess(currentUser.features),
359
- features: currentUser.features,
360
- sessionEncryptionKey: currentUser.sessionEncryptionKey,
361
- };
362
- }
363
-
364
- public watchAuth(): Observable<any> {
365
- return this.hubSubject;
366
- }
367
-
368
- public async logout(): Promise<void> {
369
- this.currentUser = null;
370
- this.keyService.purgeKeys();
371
- this.keyGraphService.purgeKeys();
372
-
373
- await Promise.all([this.auth.signOut(), this.profileService.signOut()]);
374
- }
375
-
376
- private getUserAttribute(
377
- attributeName: string,
378
- userAttributes: CognitoUserAttribute[]
379
- ) {
380
- const userAttribute = userAttributes.find(
381
- (x) => x.getName() === attributeName
382
- );
383
-
384
- return userAttribute ? userAttribute.getValue() : null;
385
- }
386
-
387
- public async loadResetUser(password?: string): Promise<TpPasswordResetUser> {
388
- const { tpPasswordResetUser: resetUser } = await this.lrGraphQL.query({
389
- query: TpPasswordResetUserQuery,
390
- });
391
-
392
- if (resetUser.sessionEncryptionKey) {
393
- this.persistService.setServerSessionEncryptionKey(
394
- await JWK.asKey(resetUser.sessionEncryptionKey)
395
- );
396
- }
397
-
398
- // Update the keys
399
- if (password) {
400
- const passKey = (
401
- await this.keyFactory.derivePassKey({
402
- password,
403
- ...resetUser.passKey.passKeyParams,
404
- })
405
- ).jwk;
406
-
407
- await this.idleService.persistMasterKey(
408
- await this.keyGraphService.unwrapWithPassKey(
409
- resetUser.passKey.id,
410
- passKey,
411
- resetUser.masterKey.id
412
- )
413
- );
414
- }
415
-
416
- this.keyService.populateKeys({
417
- passKey: {
418
- id: resetUser.passKey.id,
419
- },
420
- masterKey: {
421
- id: resetUser.masterKey.id,
422
- },
423
- });
424
-
425
- const userAttributes = await this.auth.userAttributes(
426
- await this.auth.currentAuthenticatedUser()
427
- );
428
- const sub = this.getUserAttribute('sub', userAttributes);
429
-
430
- return {
431
- ...(await this.tpPasswordResetProcessorService.processTpPasswordResetUserNode(
432
- resetUser
433
- )),
434
- sub,
435
- };
436
- }
437
-
438
- public async refreshAccessToken() {
439
- const cognitoUser: CognitoUser = await this.auth.currentAuthenticatedUser();
440
- const refreshToken = cognitoUser.getSignInUserSession().getRefreshToken();
441
-
442
- return new Promise((resolve, reject) => {
443
- cognitoUser.refreshSession(refreshToken, (err, data) => {
444
- if (err) {
445
- console.error('Error refreshing token: ', err);
446
- reject(err);
447
- } else {
448
- console.log('Token refresh complete: ', data);
449
- resolve(0);
450
- }
451
- });
452
- });
453
- }
454
- }
@@ -1,51 +0,0 @@
1
- import { TestBed } from '@angular/core/testing';
2
- import {
3
- EncryptionService,
4
- KeyGraphService,
5
- KeyService,
6
- ProfileService,
7
- } from '../../public-api';
8
- import { KeyFactoryService } from '../cryptography/key-factory.service';
9
- import { lrConfigureTestingModule } from '../_common/tests';
10
- import { PasswordService } from './password.service';
11
-
12
- describe('PasswordService', () => {
13
- let service: PasswordService;
14
-
15
- beforeEach(async () => {
16
- lrConfigureTestingModule();
17
-
18
- service = TestBed.inject(PasswordService);
19
- });
20
-
21
- it('should be created', () => {
22
- expect(service).toBeTruthy();
23
- });
24
-
25
- it('should check quality of current password', async () => {
26
- const res = await service.checkPassword('123456');
27
- expect(res.passwordExposed).toBeGreaterThan(0);
28
- console.log(res);
29
- });
30
-
31
- it('should compute password strength', () => {
32
- const res = service.passwordStrength('123456789aBc');
33
- expect(res.years).toEqual(54000);
34
- expect(res.bits).toEqual(71);
35
-
36
- const res2 = service.passwordStrength('123456789aBC');
37
- expect(res2.years).toEqual(res.years);
38
- expect(res2.bits).toEqual(res.bits);
39
-
40
- const res3 = service.passwordStrength('*23456789aBC');
41
- expect(res3.years).toBeGreaterThan(res.years);
42
- expect(res3.bits).toBeGreaterThan(res.bits);
43
-
44
- const res4 = service.passwordStrength('');
45
- expect(res4.years).toEqual(0);
46
- expect(res4.bits).toEqual(0);
47
-
48
- const res5 = service.passwordStrength('abcdefgh');
49
- console.log('res5', res5);
50
- });
51
- });