@lifeready/core 5.0.9 → 5.0.11

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 (56) hide show
  1. package/bundles/lifeready-core.umd.js +1529 -737
  2. package/bundles/lifeready-core.umd.js.map +1 -1
  3. package/bundles/lifeready-core.umd.min.js +1 -1
  4. package/bundles/lifeready-core.umd.min.js.map +1 -1
  5. package/esm2015/lib/_common/key.js +28 -0
  6. package/esm2015/lib/_common/types.js +1 -1
  7. package/esm2015/lib/api/types/lr-graphql.types.js +1 -1
  8. package/esm2015/lib/auth/auth.types.js +1 -3
  9. package/esm2015/lib/auth/life-ready-auth.service.js +2 -2
  10. package/esm2015/lib/auth2/auth2.gql.private.js +78 -0
  11. package/esm2015/lib/auth2/auth2.service.js +596 -0
  12. package/esm2015/lib/auth2/auth2.types.js +21 -0
  13. package/esm2015/lib/contact-card/contact-card.service.js +3 -3
  14. package/esm2015/lib/contact-card/contact-card2.service.js +3 -3
  15. package/esm2015/lib/item2/item2.service.js +9 -9
  16. package/esm2015/lib/key/key-factory.service.js +1 -1
  17. package/esm2015/lib/key/key-graph.service.js +3 -3
  18. package/esm2015/lib/key/key-meta.service.js +2 -2
  19. package/esm2015/lib/key/key.service.js +7 -7
  20. package/esm2015/lib/key-exchange/key-exchange.service.js +24 -29
  21. package/esm2015/lib/key-exchange/key-exchange2.service.js +16 -17
  22. package/esm2015/lib/lbop/lbop.service.js +13 -14
  23. package/esm2015/lib/profile/profile.service.js +2 -2
  24. package/esm2015/lib/profile/profile.types.js +1 -1
  25. package/esm2015/lib/register/register.service.js +1 -1
  26. package/esm2015/lib/register/register.types.js +3 -0
  27. package/esm2015/lib/server-config/server-config.gql.js +1 -1
  28. package/esm2015/lib/shared-contact-card/shared-contact-card.service.js +3 -3
  29. package/esm2015/lib/shared-contact-card/shared-contact-card2.service.js +2 -2
  30. package/esm2015/lib/tp-assembly/tp-assembly.js +3 -3
  31. package/esm2015/lib/trusted-party/trusted-party2.service.js +4 -4
  32. package/esm2015/public-api.js +4 -1
  33. package/fesm2015/lifeready-core.js +885 -203
  34. package/fesm2015/lifeready-core.js.map +1 -1
  35. package/lib/_common/key.d.ts +14 -0
  36. package/lib/_common/types.d.ts +6 -0
  37. package/lib/api/types/lr-graphql.types.d.ts +1 -0
  38. package/lib/auth/auth.types.d.ts +0 -6
  39. package/lib/auth2/auth2.gql.private.d.ts +12 -0
  40. package/lib/auth2/auth2.service.d.ts +70 -0
  41. package/lib/auth2/auth2.types.d.ts +50 -0
  42. package/lib/item2/item2.service.d.ts +3 -3
  43. package/lib/key/key-factory.service.d.ts +1 -0
  44. package/lib/key/key-graph.service.d.ts +2 -3
  45. package/lib/key/key.service.d.ts +6 -6
  46. package/lib/key-exchange/key-exchange.service.d.ts +3 -5
  47. package/lib/lbop/lbop.service.d.ts +3 -3
  48. package/lib/profile/profile.types.d.ts +2 -2
  49. package/lib/register/register.service.d.ts +1 -1
  50. package/lib/register/register.types.d.ts +6 -0
  51. package/lib/server-config/server-config.gql.d.ts +1 -1
  52. package/lib/server-config/server-config.service.d.ts +1 -1
  53. package/lib/shared-contact-card/shared-contact-card.service.d.ts +2 -2
  54. package/lifeready-core.metadata.json +1 -1
  55. package/package.json +1 -1
  56. package/public-api.d.ts +3 -0
@@ -1117,22 +1117,22 @@ class KeyService {
1117
1117
  this.resetKeys();
1118
1118
  this.persistService.clear();
1119
1119
  }
1120
- populateKeys(keys) {
1120
+ setKeys(keys) {
1121
1121
  this.keys = keys;
1122
1122
  }
1123
- getCurrentPassKey() {
1123
+ get currentPassKey() {
1124
1124
  return this.keys.passKey;
1125
1125
  }
1126
- getCurrentMasterKey() {
1126
+ get currentMasterKey() {
1127
1127
  return this.keys.masterKey;
1128
1128
  }
1129
- getCurrentRootKey() {
1129
+ get currentRootKey() {
1130
1130
  return this.keys.rootKey;
1131
1131
  }
1132
- getCurrentPxk() {
1132
+ get currentPxk() {
1133
1133
  return this.keys.pxk;
1134
1134
  }
1135
- getCurrentSigPxk() {
1135
+ get currentSigPxk() {
1136
1136
  return this.keys.sigPxk;
1137
1137
  }
1138
1138
  expiresAfter(seconds) {
@@ -1230,7 +1230,7 @@ class KeyGraphService {
1230
1230
  }
1231
1231
  populateKeys(userKey) {
1232
1232
  return __awaiter(this, void 0, void 0, function* () {
1233
- this.keyService.populateKeys({
1233
+ this.keyService.setKeys({
1234
1234
  passKey: userKey.passKey,
1235
1235
  masterKey: yield this.keyService.loadMasterKey(userKey.masterKey.id),
1236
1236
  rootKey: yield this.unwrapKey(userKey.masterKey.id, userKey.rootKey.id),
@@ -1360,7 +1360,7 @@ class KeyGraphService {
1360
1360
  return key;
1361
1361
  }
1362
1362
  else {
1363
- return this.unwrapKey(this.keyService.getCurrentMasterKey().id, keyId);
1363
+ return this.unwrapKey(this.keyService.currentMasterKey.id, keyId);
1364
1364
  }
1365
1365
  });
1366
1366
  }
@@ -3014,8 +3014,6 @@ class CurrentUser {
3014
3014
  }
3015
3015
  class LoginResult {
3016
3016
  }
3017
- class RegisterResult {
3018
- }
3019
3017
  var RecoveryStatus;
3020
3018
  (function (RecoveryStatus) {
3021
3019
  RecoveryStatus["NONE"] = "none";
@@ -3757,7 +3755,7 @@ class KeyMetaService {
3757
3755
  }
3758
3756
  else {
3759
3757
  // Adding to root directory
3760
- const rootKey = this.keyService.getCurrentRootKey();
3758
+ const rootKey = this.keyService.currentRootKey;
3761
3759
  const wrappedKey = JSON.stringify(yield this.encryptionService.encrypt(rootKey.jwk, key.toJSON(true)));
3762
3760
  rootWrappingKey = {
3763
3761
  wrappingKeyId: rootKey.id,
@@ -4269,7 +4267,7 @@ class ProfileService {
4269
4267
  }
4270
4268
  prepareContactCardInput(contactCard) {
4271
4269
  return __awaiter(this, void 0, void 0, function* () {
4272
- const sigPxk = yield this.keyService.getCurrentSigPxk();
4270
+ const sigPxk = this.keyService.currentSigPxk;
4273
4271
  const publicDataSig = JSON.stringify(yield this.encryptionService.sign(sigPxk.jwk, ''));
4274
4272
  const publicSearchableSig = JSON.stringify(yield this.encryptionService.sign(sigPxk.jwk, ''));
4275
4273
  const plainDataJson = {
@@ -5026,7 +5024,7 @@ class TpAssemblyController {
5026
5024
  }
5027
5025
  prepareCreate(input) {
5028
5026
  return __awaiter(this, void 0, void 0, function* () {
5029
- const rootKey = yield this.keyService.getCurrentRootKey();
5027
+ const rootKey = this.keyService.currentRootKey;
5030
5028
  const subjectKey = yield this.keyFactory.createKey();
5031
5029
  const rootKeyWrappedSubjectKey = yield this.keyGraph.wrapKey(rootKey, subjectKey);
5032
5030
  const _a = yield this.prepareAssembly({
@@ -5080,7 +5078,7 @@ class TpAssemblyController {
5080
5078
  deleteSubAssembliesInput.length === 0) {
5081
5079
  throw new KcBadArgumentException('Must specify at least one of: [createSubAssemblies, updateSubAssemblies, deleteSubAssemblies]');
5082
5080
  }
5083
- const rootKey = yield this.keyService.getCurrentRootKey();
5081
+ const rootKey = this.keyService.currentRootKey;
5084
5082
  const subjectKey = yield this.keyGraph.getKey(assembly.subjectKey.id);
5085
5083
  const _b = yield this.prepareAssembly({
5086
5084
  rootKey: rootKey.jwk,
@@ -5871,40 +5869,698 @@ class LifeReadyAuthService {
5871
5869
  const passKey = (yield this.keyFactory.derivePassKey(Object.assign({ password }, resetUser.passKey.passKeyParams))).jwk;
5872
5870
  yield this.idleService.persistMasterKey(yield this.keyGraphService.unwrapWithPassKey(resetUser.passKey.id, passKey, resetUser.masterKey.id));
5873
5871
  }
5874
- this.keyService.populateKeys({
5872
+ this.keyService.setKeys({
5873
+ passKey: {
5874
+ id: resetUser.passKey.id,
5875
+ },
5876
+ masterKey: {
5877
+ id: resetUser.masterKey.id,
5878
+ },
5879
+ });
5880
+ const userAttributes = yield this.auth.userAttributes(yield this.auth.currentAuthenticatedUser());
5881
+ const sub = this.getUserAttribute('sub', userAttributes);
5882
+ return Object.assign(Object.assign({}, (yield this.tpPasswordResetProcessorService.processTpPasswordResetUserNode(resetUser))), { sub });
5883
+ });
5884
+ }
5885
+ refreshAccessToken() {
5886
+ return __awaiter(this, void 0, void 0, function* () {
5887
+ const cognitoUser = yield this.auth.currentAuthenticatedUser();
5888
+ const refreshToken = cognitoUser.getSignInUserSession().getRefreshToken();
5889
+ return new Promise((resolve, reject) => {
5890
+ cognitoUser.refreshSession(refreshToken, (err) => {
5891
+ if (err) {
5892
+ console.error('Error refreshing token: ', err);
5893
+ reject(err);
5894
+ }
5895
+ else {
5896
+ console.log('Token refresh complete');
5897
+ resolve(0);
5898
+ }
5899
+ });
5900
+ });
5901
+ });
5902
+ }
5903
+ completeRequest(newPassword) {
5904
+ return __awaiter(this, void 0, void 0, function* () {
5905
+ const resetUser = yield this.getResetUser(true);
5906
+ if (resetUser.state !== TpClaimState.APPROVED) {
5907
+ throw new KcBadStateException('Password reset request has not been approved.');
5908
+ }
5909
+ // --------------------------------------------------------------
5910
+ // Prepare all materials to ensure there are no errors.
5911
+ // --------------------------------------------------------------
5912
+ const assemblyKey = yield this.recoverAssemblyKey(resetUser);
5913
+ const { rootKey } = yield this.encryptionService.decrypt(assemblyKey, resetUser.assemblyCipherData);
5914
+ // Making sure it's a valid key.
5915
+ const rootKeyJwk = yield JWK.asKey(rootKey);
5916
+ const masterKey = yield this.keyGraphService.getKey(resetUser.masterKey.id);
5917
+ const masterKeyWrappedRootKey = yield this.encryptionService.encryptToString(masterKey.jwk, rootKeyJwk.toJSON(true));
5918
+ // The new password
5919
+ const newPassIdpResult = yield this.keyFactory.derivePassIdp(Object.assign({ password: newPassword }, resetUser.passKey.passIdpParams));
5920
+ const newIdpPassword = this.passwordService.getPassIdpString(newPassIdpResult.jwk);
5921
+ // --------------------------------------------------------------
5922
+ // Get assembly key challenge
5923
+ // --------------------------------------------------------------
5924
+ const challenge = (yield this.lrGraphQL.lrMutate(new LrMutation({
5925
+ mutation: CreateTpAssemblyKeyChallengeMutation,
5926
+ variables: {
5927
+ input: {},
5928
+ },
5929
+ }), {
5930
+ includeKeyGraph: false,
5931
+ })).createTpAssemblyKeyChallenge.challenge;
5932
+ // Sign the challenge
5933
+ // Generate a client side nonce that's no in the server's control.
5934
+ challenge.clientNonce = this.keyFactory.randomString(TP_PASSWORD_RESET_CLIENT_NONCE_LENGTH);
5935
+ const assemblyKeyVerifierPrk = yield this.encryptionService.decrypt(assemblyKey, resetUser.wrappedAssemblyKeyVerifierPrk);
5936
+ const signedChallenge = yield this.encryptionService.sign(assemblyKeyVerifierPrk, challenge);
5937
+ // --------------------------------------------------------------
5938
+ // Change password for the original user
5939
+ // --------------------------------------------------------------
5940
+ const tempIdpPassword = (yield this.lrGraphQL.lrMutate(new LrMutation({
5941
+ mutation: PreCompleteTpPasswordResetRequestMutation,
5942
+ variables: {
5943
+ input: {
5944
+ signedChallenge: JSON.stringify(signedChallenge),
5945
+ },
5946
+ },
5947
+ }), {
5948
+ includeKeyGraph: false,
5949
+ })).preCompleteTpPasswordResetRequest.idpPassword;
5950
+ // --------------------------------------------------------------
5951
+ // Login as the original user using new temporary password
5952
+ // --------------------------------------------------------------
5953
+ // At this point, the original account's password has been changed
5954
+ // to a temporary password. It is no longer possible for the user
5955
+ // to use the original password to login. Any successful login
5956
+ // can only be using the temporary password. So it's safe to assume
5957
+ // that we want to "complete" the password reset.
5958
+ // The maybe 2FA so we listen for the auth event from Amplify.
5959
+ const retPromise = new Promise((resolve) => {
5960
+ const listener = (data) => __awaiter(this, void 0, void 0, function* () {
5961
+ if (data.payload.event !== 'signIn') {
5962
+ return;
5963
+ }
5964
+ Hub.remove('auth', listener);
5965
+ yield this.auth.signIn(resetUser.username, newIdpPassword);
5966
+ // Switch over to the new set of keys
5967
+ yield this.lrGraphQL.lrMutate(new LrMutation({
5968
+ mutation: CompleteTpPasswordResetRequestMutation,
5969
+ variables: {
5970
+ input: {
5971
+ masterKeyWrappedRootKey,
5972
+ masterKeyId: masterKey.id,
5973
+ },
5974
+ },
5975
+ }));
5976
+ resolve();
5977
+ });
5978
+ Hub.listen('auth', listener);
5979
+ });
5980
+ // Signin as the original user. Password has been reset to temporary one. It should return
5981
+ // with NEW_PASSWORD_REQUIRED
5982
+ let user = yield this.auth.signIn(resetUser.username, tempIdpPassword, {
5983
+ noProxy: 'true',
5984
+ });
5985
+ if (user.challengeName !== 'NEW_PASSWORD_REQUIRED') {
5986
+ throw new KcInternalErrorException('Expecting Cognito to have done a password reset after call to PreCompleteTpPasswordResetRequestMutation.');
5987
+ }
5988
+ // Set new password on Idp
5989
+ // the awsFetch() function passes NEW_PASSWORD_REQUIRED directly to AWS without
5990
+ // going through the proxy.
5991
+ user = yield this.auth.completeNewPassword(user, newIdpPassword, {});
5992
+ return retPromise;
5993
+ });
5994
+ }
5995
+ recoverAssemblyKey(resetUser) {
5996
+ return __awaiter(this, void 0, void 0, function* () {
5997
+ const prk = yield this.keyGraphService.getKey(resetUser.pxk.id);
5998
+ const partials = yield Promise.all(resetUser.approvals
5999
+ .filter((approval) => !!approval.receiverCipherPartialAssemblyKey)
6000
+ .map((approval) => this.encryptionService.decrypt(prk, approval.receiverCipherPartialAssemblyKey)));
6001
+ return this.assemblyController.recoverAssemblyKey(partials);
6002
+ });
6003
+ }
6004
+ }
6005
+ LifeReadyAuthService.ɵprov = ɵɵdefineInjectable({ factory: function LifeReadyAuthService_Factory() { return new LifeReadyAuthService(ɵɵinject(KC_CONFIG), ɵɵinject(AuthClass), ɵɵinject(KeyFactoryService), ɵɵinject(KeyService), ɵɵinject(ProfileService), ɵɵinject(KeyGraphService), ɵɵinject(PasswordService), ɵɵinject(IdleService), ɵɵinject(LrGraphQLService), ɵɵinject(TpPasswordResetProcessorService), ɵɵinject(PersistService), ɵɵinject(EncryptionService), ɵɵinject(TpPasswordResetAssemblyController), ɵɵinject(HttpClient)); }, token: LifeReadyAuthService, providedIn: "root" });
6006
+ LifeReadyAuthService.decorators = [
6007
+ { type: Injectable, args: [{
6008
+ providedIn: 'root',
6009
+ },] }
6010
+ ];
6011
+ LifeReadyAuthService.ctorParameters = () => [
6012
+ { type: undefined, decorators: [{ type: Inject, args: [KC_CONFIG,] }] },
6013
+ { type: AuthClass },
6014
+ { type: KeyFactoryService },
6015
+ { type: KeyService },
6016
+ { type: ProfileService },
6017
+ { type: KeyGraphService },
6018
+ { type: PasswordService },
6019
+ { type: IdleService },
6020
+ { type: LrGraphQLService },
6021
+ { type: TpPasswordResetProcessorService },
6022
+ { type: PersistService },
6023
+ { type: EncryptionService },
6024
+ { type: TpPasswordResetAssemblyController },
6025
+ { type: HttpClient }
6026
+ ];
6027
+
6028
+ class KeyContainer {
6029
+ constructor(_key, timeout) {
6030
+ this._key = _key;
6031
+ this.timer = setTimeout(() => {
6032
+ this._key = null;
6033
+ }, timeout);
6034
+ }
6035
+ get key() {
6036
+ return this._key;
6037
+ }
6038
+ /**
6039
+ * Clears the reference to the key, clears the timer, return the key.
6040
+ * It's important to call this function when the key is no longer needed because
6041
+ * the anonymous function in setTimeout() holds a reference to "this", and hence
6042
+ * keeps the "this._key" reference until the timer expired. So if we have used
6043
+ * the key before it expired, we should clear the "this._key" reference immediately.
6044
+ */
6045
+ pop() {
6046
+ const ret = this._key;
6047
+ this._key = null;
6048
+ if (this.timer) {
6049
+ clearTimeout(this.timer);
6050
+ this.timer = null;
6051
+ }
6052
+ return ret;
6053
+ }
6054
+ }
6055
+
6056
+ const CurrentUserQuery$1 = gqlTyped `
6057
+ query {
6058
+ currentUser {
6059
+ id
6060
+ username
6061
+ currentUserKey {
6062
+ passKey {
6063
+ id
6064
+ passKeyParams
6065
+ passIdpParams
6066
+ wrappedPassIdpVerifierPrk
6067
+ created
6068
+ }
6069
+ masterKey {
6070
+ id
6071
+ }
6072
+ rootKey {
6073
+ id
6074
+ }
6075
+ pxk {
6076
+ id
6077
+ }
6078
+ sigPxk {
6079
+ id
6080
+ }
6081
+ }
6082
+ sessionEncryptionKey
6083
+ }
6084
+ keyGraph {
6085
+ ...KeyGraphFragment
6086
+ }
6087
+ }
6088
+ ${KeyGraphFragment}
6089
+ `;
6090
+ const ResetUserQuery = gqlTyped `
6091
+ query ResetUserQuery {
6092
+ tpPasswordResetUser {
6093
+ username
6094
+ sessionEncryptionKey
6095
+ state
6096
+ passKey {
6097
+ id
6098
+ passKeyParams
6099
+ passIdpParams
6100
+ }
6101
+ masterKey {
6102
+ id
6103
+ }
6104
+ pxk {
6105
+ id
6106
+ }
6107
+ assembly {
6108
+ singleReject
6109
+ quorum
6110
+ subAssemblies {
6111
+ singleReject
6112
+ quorum
6113
+ approvers {
6114
+ name
6115
+ email
6116
+ state
6117
+ }
6118
+ }
6119
+ }
6120
+ approvals {
6121
+ id
6122
+ modified
6123
+ approverEmail
6124
+ receiverCipher
6125
+ receiverCipherPartialAssemblyKey
6126
+ }
6127
+ assemblyCipherData
6128
+ wrappedAssemblyKeyVerifierPrk
6129
+ }
6130
+ }`;
6131
+
6132
+ var RecoveryStatus$1;
6133
+ (function (RecoveryStatus) {
6134
+ RecoveryStatus["NONE"] = "NONE";
6135
+ RecoveryStatus["NEW_PASSWORD"] = "NEW_PASSWORD";
6136
+ RecoveryStatus["OLD_PASSWORD"] = "OLD_PASSWORD";
6137
+ })(RecoveryStatus$1 || (RecoveryStatus$1 = {}));
6138
+ // TODO restrict this type
6139
+ // export type AuthResetUser = TpPasswordResetUserNode;
6140
+ var PasswordChangeStatus$1;
6141
+ (function (PasswordChangeStatus) {
6142
+ PasswordChangeStatus["IN_PROGRESS"] = "IN_PROGRESS";
6143
+ PasswordChangeStatus["RECOVERY"] = "RECOVERY";
6144
+ })(PasswordChangeStatus$1 || (PasswordChangeStatus$1 = {}));
6145
+ var CognitoChallengeName;
6146
+ (function (CognitoChallengeName) {
6147
+ CognitoChallengeName["NEW_PASSWORD_REQUIRED"] = "NEW_PASSWORD_REQUIRED";
6148
+ CognitoChallengeName["SMS_MFA"] = "SMS_MFA";
6149
+ CognitoChallengeName["SOFTWARE_TOKEN_MFA"] = "SOFTWARE_TOKEN_MFA";
6150
+ CognitoChallengeName["MFA_SETUP"] = "MFA_SETUP";
6151
+ })(CognitoChallengeName || (CognitoChallengeName = {}));
6152
+
6153
+ var auth2_types = /*#__PURE__*/Object.freeze({
6154
+ __proto__: null,
6155
+ get RecoveryStatus () { return RecoveryStatus$1; },
6156
+ get PasswordChangeStatus () { return PasswordChangeStatus$1; },
6157
+ get CognitoChallengeName () { return CognitoChallengeName; }
6158
+ });
6159
+
6160
+ var Auth2Service_1;
6161
+ let Auth2Service = Auth2Service_1 = class Auth2Service extends LrService {
6162
+ constructor(ngZone, injector, http, cognito, api, keyService, keyGraphService, keyFactoryService, passwordService, idleService, persistService, encryptionService, assemblyController, kcConfig) {
6163
+ super(injector);
6164
+ this.ngZone = ngZone;
6165
+ this.injector = injector;
6166
+ this.http = http;
6167
+ this.cognito = cognito;
6168
+ this.api = api;
6169
+ this.keyService = keyService;
6170
+ this.keyGraphService = keyGraphService;
6171
+ this.keyFactoryService = keyFactoryService;
6172
+ this.passwordService = passwordService;
6173
+ this.idleService = idleService;
6174
+ this.persistService = persistService;
6175
+ this.encryptionService = encryptionService;
6176
+ this.assemblyController = assemblyController;
6177
+ this.kcConfig = kcConfig;
6178
+ // Could use rxjs observables here. But trying to have kc-client use as little angular
6179
+ // features as possible. Rxjs is not used anywhere else in kc-client.
6180
+ this.logoutListeners = new Set();
6181
+ // Stores the password for use after mfa verification to decrypt masterKey.
6182
+ this.password = null;
6183
+ if (!isDevMode()) {
6184
+ if (this.kcConfig.debug != null) {
6185
+ throw new KcBadRequestException('In production mode, "KcConfig.debug" must be set to null');
6186
+ }
6187
+ }
6188
+ }
6189
+ importPassword(plainPassword) {
6190
+ return this.keyFactoryService.importPassword(plainPassword);
6191
+ }
6192
+ logout() {
6193
+ var _a;
6194
+ return __awaiter(this, void 0, void 0, function* () {
6195
+ // Notify all listeners to clean up.
6196
+ yield Promise.all([...this.logoutListeners].map((callback) => callback()));
6197
+ this.user = null;
6198
+ this.keyService.purgeKeys();
6199
+ this.keyGraphService.purgeKeys();
6200
+ // Sign out on both cognito and kc-server
6201
+ yield Promise.all([this.cognito.signOut(), this.kcLogout()]);
6202
+ if ((_a = this.kcConfig.debug) === null || _a === void 0 ? void 0 : _a.username) {
6203
+ this.kcConfig.debug.username = null;
6204
+ }
6205
+ });
6206
+ }
6207
+ addLogoutListener(callback) {
6208
+ this.logoutListeners.add(callback);
6209
+ }
6210
+ removeLogoutListener(callback) {
6211
+ this.logoutListeners.delete(callback);
6212
+ }
6213
+ login(emailOrPhone, password, { tpPasswordResetAutoComplete = true } = {}) {
6214
+ var _a;
6215
+ return __awaiter(this, void 0, void 0, function* () {
6216
+ let loginResult = yield this.loginImpl(emailOrPhone, password);
6217
+ // Save the password for use after meeting challenge.
6218
+ if (loginResult.challenge) {
6219
+ this.password = new KeyContainer(password, Auth2Service_1.CHALLENGE_TIMEOUT);
6220
+ return loginResult;
6221
+ }
6222
+ if (tpPasswordResetAutoComplete &&
6223
+ ((_a = loginResult.user.resetUser) === null || _a === void 0 ? void 0 : _a.state) === TpClaimState.APPROVED) {
6224
+ yield this.completeResetRequest(password);
6225
+ loginResult = yield this.loginImpl(emailOrPhone, password);
6226
+ }
6227
+ return loginResult;
6228
+ });
6229
+ }
6230
+ verifyLogin(options) {
6231
+ return __awaiter(this, void 0, void 0, function* () {
6232
+ const { challenge, code, rememberMe } = options;
6233
+ const VALID_CHALLENGE_NAMES = [
6234
+ CognitoChallengeName.SMS_MFA,
6235
+ CognitoChallengeName.SOFTWARE_TOKEN_MFA,
6236
+ ];
6237
+ if (!VALID_CHALLENGE_NAMES.includes(challenge.cognitoUser.challengeName)) {
6238
+ throw new KcBadRequestException(`challengeName must be one of ${VALID_CHALLENGE_NAMES}`);
6239
+ }
6240
+ // TODO: this.auth.confirmSignIn() could return another challenge.
6241
+ const cognitoUser = yield this.cognito.confirmSignIn(challenge.cognitoUser, code, challenge.cognitoUser.challengeName);
6242
+ yield this.handlePostAuth(challenge.recoveryStatus);
6243
+ const user = yield this.loadUser(cognitoUser, this.password.pop());
6244
+ // This is not strictly necessary since the this.password.pop() already clears the
6245
+ // password inside the container. But doesn't hurt either.
6246
+ this.password = null;
6247
+ if (rememberMe) {
6248
+ cognitoUser.setDeviceStatusRemembered({
6249
+ onSuccess: () => {
6250
+ return;
6251
+ },
6252
+ onFailure: (e) => console.error(e),
6253
+ });
6254
+ }
6255
+ return {
6256
+ user,
6257
+ };
6258
+ });
6259
+ }
6260
+ getUser() {
6261
+ return __awaiter(this, void 0, void 0, function* () {
6262
+ if (this.user) {
6263
+ return this.user;
6264
+ }
6265
+ const cognitoUser = yield this.cognito.currentAuthenticatedUser();
6266
+ return this.loadUser(cognitoUser);
6267
+ });
6268
+ }
6269
+ refreshAccessToken() {
6270
+ return __awaiter(this, void 0, void 0, function* () {
6271
+ const cognitoUser = yield this.cognito.currentAuthenticatedUser();
6272
+ const refreshToken = cognitoUser.getSignInUserSession().getRefreshToken();
6273
+ console.log('Token refresh...');
6274
+ return new Promise((resolve, reject) => {
6275
+ cognitoUser.refreshSession(refreshToken, (err) => {
6276
+ if (err) {
6277
+ console.error('Error refreshing token: ', err);
6278
+ reject(err);
6279
+ }
6280
+ else {
6281
+ console.log('Token refresh complete');
6282
+ resolve(0);
6283
+ }
6284
+ });
6285
+ });
6286
+ });
6287
+ }
6288
+ // ----------------------------------------------------------------------------------------------------
6289
+ // Helpers
6290
+ // ----------------------------------------------------------------------------------------------------
6291
+ fetchCurrentUser() {
6292
+ return __awaiter(this, void 0, void 0, function* () {
6293
+ return (yield this.api.query({
6294
+ query: CurrentUserQuery$1,
6295
+ processorOptions: {
6296
+ hasKeys: false,
6297
+ },
6298
+ })).currentUser;
6299
+ });
6300
+ }
6301
+ fetchResetUser() {
6302
+ return __awaiter(this, void 0, void 0, function* () {
6303
+ return (yield this.api.query({
6304
+ query: ResetUserQuery,
6305
+ processorOptions: {
6306
+ hasKeys: false,
6307
+ },
6308
+ })).tpPasswordResetUser;
6309
+ });
6310
+ }
6311
+ kcLogout() {
6312
+ return __awaiter(this, void 0, void 0, function* () {
6313
+ yield this.http
6314
+ .post(`${this.kcConfig.authUrl}auth/sign-out/`, null, {
6315
+ withCredentials: true,
6316
+ responseType: 'text',
6317
+ })
6318
+ .toPromise();
6319
+ });
6320
+ }
6321
+ fetchPassIdpParams(emailOrPhone) {
6322
+ return __awaiter(this, void 0, void 0, function* () {
6323
+ return yield this.http
6324
+ .get(`${this.kcConfig.authUrl}users/pass-idp-params/?login_name=${encodeURIComponent(emailOrPhone)}`)
6325
+ .toPromise();
6326
+ });
6327
+ }
6328
+ loginImpl(emailOrPhone, password) {
6329
+ return __awaiter(this, void 0, void 0, function* () {
6330
+ yield this.logout();
6331
+ const loginIdpResult = yield this.loginIdp(emailOrPhone, password);
6332
+ // Can't get the user yet because we still ned to meet MFA challenges
6333
+ if ([
6334
+ CognitoChallengeName.SMS_MFA,
6335
+ CognitoChallengeName.SOFTWARE_TOKEN_MFA,
6336
+ ].includes(loginIdpResult.cognitoUser.challengeName)) {
6337
+ return {
6338
+ challenge: {
6339
+ cognitoUser: loginIdpResult.cognitoUser,
6340
+ recoveryStatus: loginIdpResult.recoveryStatus,
6341
+ },
6342
+ };
6343
+ }
6344
+ yield this.handlePostAuth(loginIdpResult.recoveryStatus);
6345
+ // There should be no MFA on the TP reset user.
6346
+ const user = yield this.loadUser(loginIdpResult.cognitoUser, password);
6347
+ return {
6348
+ user,
6349
+ };
6350
+ });
6351
+ }
6352
+ loginIdp(emailOrPhone, password) {
6353
+ return __awaiter(this, void 0, void 0, function* () {
6354
+ // Download the salt needed to derive the PassIdp
6355
+ const passIdpApiResult = yield this.fetchPassIdpParams(emailOrPhone);
6356
+ if (passIdpApiResult.passwordChangeStatus === PasswordChangeStatus$1.IN_PROGRESS) {
6357
+ throw new KcConcurrentAccessException('A password change is in progress');
6358
+ }
6359
+ if (passIdpApiResult.passwordChangeStatus === PasswordChangeStatus$1.RECOVERY) {
6360
+ console.log('In recovery mode.');
6361
+ // Let's say we don't know if the password is the new one or the old one. We just have to try both.
6362
+ try {
6363
+ const user = {
6364
+ cognitoUser: yield this.loginIdpImpl(emailOrPhone, password, passIdpApiResult.newPassIdpParams),
6365
+ recoveryStatus: RecoveryStatus$1.NEW_PASSWORD,
6366
+ };
6367
+ // New password worked. Let's set to the current password
6368
+ // --Potential Failure Point 1--
6369
+ // if changePasswordComplete() doesn't get called, then it should remain
6370
+ console.log('New password works!');
6371
+ return user;
6372
+ }
6373
+ catch (error) {
6374
+ // Just bubble up any other type of error.
6375
+ if (error.code !== 'NotAuthorizedException') {
6376
+ throw error;
6377
+ }
6378
+ // pass, try again assuming it's the old password
6379
+ }
6380
+ // Now assume it's the previous password. Any exception is allowed to bubble up.
6381
+ try {
6382
+ const user = {
6383
+ cognitoUser: yield this.loginIdpImpl(emailOrPhone, password, passIdpApiResult.currentPassIdpParams),
6384
+ recoveryStatus: RecoveryStatus$1.OLD_PASSWORD,
6385
+ };
6386
+ // Old password worked.
6387
+ console.log('Old password works!');
6388
+ return user;
6389
+ }
6390
+ catch (error) {
6391
+ // Just bubble up any other type of error.
6392
+ throw error.code === 'NotAuthorizedException'
6393
+ ? new KcBadRequestException('The password change request was interrupted, please try to login with both your new and old password')
6394
+ : error;
6395
+ }
6396
+ }
6397
+ // Try again as the TP password reset account
6398
+ if (passIdpApiResult.tpPasswordReset) {
6399
+ try {
6400
+ // TP password reset is in process. We need to try the password against both
6401
+ // original account and the new reset account.
6402
+ const reset = passIdpApiResult.tpPasswordReset;
6403
+ const user = {
6404
+ cognitoUser: yield this.loginIdpImpl(reset.resetUsername, password, reset.passIdpParams),
6405
+ recoveryStatus: RecoveryStatus$1.NONE,
6406
+ };
6407
+ return user;
6408
+ }
6409
+ catch (err) {
6410
+ // continue, try again as regular user.
6411
+ }
6412
+ }
6413
+ // Login as regular user
6414
+ const user = {
6415
+ cognitoUser: yield this.loginIdpImpl(emailOrPhone, password, passIdpApiResult.currentPassIdpParams),
6416
+ recoveryStatus: RecoveryStatus$1.NONE,
6417
+ };
6418
+ return user;
6419
+ });
6420
+ }
6421
+ loginIdpImpl(emailOrPhone, password, passIdpParams) {
6422
+ return __awaiter(this, void 0, void 0, function* () {
6423
+ const passIdpResult = yield this.keyFactoryService.derivePassIdp(Object.assign({ password }, passIdpParams));
6424
+ // Use the derived password to signin with cognito
6425
+ return this.cognito.signIn(emailOrPhone, this.passwordService.getPassIdpString(passIdpResult.jwk));
6426
+ });
6427
+ }
6428
+ handlePostAuth(recoveryStatus) {
6429
+ return __awaiter(this, void 0, void 0, function* () {
6430
+ yield this.handlePasswordRecovery(recoveryStatus);
6431
+ yield this.handleSessionEncryptionKey();
6432
+ });
6433
+ }
6434
+ handlePasswordRecovery(recoveryStatus) {
6435
+ return __awaiter(this, void 0, void 0, function* () {
6436
+ if (recoveryStatus !== RecoveryStatus$1.NONE) {
6437
+ yield this.passwordService.changePasswordComplete({
6438
+ useNewPassword: recoveryStatus === RecoveryStatus$1.NEW_PASSWORD,
6439
+ });
6440
+ }
6441
+ });
6442
+ }
6443
+ handleSessionEncryptionKey() {
6444
+ return __awaiter(this, void 0, void 0, function* () {
6445
+ if (this.kcConfig.disableSessionEncryptionKey) {
6446
+ if (!isDevMode()) {
6447
+ const msg = 'You should not set disableSessionEncryptionKey=True in mode prod. It defaults to false.';
6448
+ console.error(msg);
6449
+ throw new KcInternalErrorException(msg);
6450
+ }
6451
+ else {
6452
+ console.warn('You have set disableSessionEncryptionKey=True. Make sure not to do this in prod mode.');
6453
+ }
6454
+ }
6455
+ else {
6456
+ // Set the session key to a new encryption key for this session
6457
+ const sessionEncryptionKey = yield this.keyFactoryService.createKey();
6458
+ yield this.lrGraphQL.lrMutate(new LrMutation({
6459
+ mutation: SetSessionEncryptionKeyMutation,
6460
+ variables: {
6461
+ input: {
6462
+ sessionEncryptionKey: JSON.stringify(sessionEncryptionKey.toJSON(true)),
6463
+ },
6464
+ },
6465
+ }), {
6466
+ includeKeyGraph: false,
6467
+ });
6468
+ this.persistService.setServerSessionEncryptionKey(sessionEncryptionKey);
6469
+ }
6470
+ });
6471
+ }
6472
+ getCognitoUserAttribute(attributeName, userAttributes) {
6473
+ const userAttribute = userAttributes.find((x) => x.getName() === attributeName);
6474
+ return userAttribute ? userAttribute.getValue() : null;
6475
+ }
6476
+ loadUserKeys(options) {
6477
+ return __awaiter(this, void 0, void 0, function* () {
6478
+ const { userKeys, password, sessionEncryptionKey } = options;
6479
+ if (sessionEncryptionKey) {
6480
+ this.persistService.setServerSessionEncryptionKey(yield JWK.asKey(sessionEncryptionKey));
6481
+ }
6482
+ // password is not needed if the master key is already persisted.
6483
+ if (password) {
6484
+ const passKey = (yield this.keyFactoryService.derivePassKey(Object.assign({ password }, userKeys.passKey.passKeyParams))).jwk;
6485
+ yield this.idleService.persistMasterKey(yield this.keyGraphService.unwrapWithPassKey(userKeys.passKey.id, passKey, userKeys.masterKey.id));
6486
+ }
6487
+ });
6488
+ }
6489
+ loadUser(cognitoUser, password) {
6490
+ return __awaiter(this, void 0, void 0, function* () {
6491
+ if (cognitoUser.getUsername().endsWith(TP_PASSWORD_RESET_USERNAME_SUFFIX)) {
6492
+ this.user = yield this.loadResetUser(cognitoUser, password);
6493
+ }
6494
+ else {
6495
+ this.user = yield this.loadRegularUser(cognitoUser, password);
6496
+ }
6497
+ yield this.idleService.start(); // Run idleService whenever user is logged in.
6498
+ return this.user;
6499
+ });
6500
+ }
6501
+ loadRegularUser(cognitoUser, password) {
6502
+ return __awaiter(this, void 0, void 0, function* () {
6503
+ const currentUser = yield this.fetchCurrentUser();
6504
+ yield this.loadUserKeys({
6505
+ userKeys: currentUser.currentUserKey,
6506
+ password,
6507
+ sessionEncryptionKey: currentUser.sessionEncryptionKey,
6508
+ });
6509
+ // Regular user populates all keys
6510
+ yield this.keyGraphService.populateKeys(currentUser.currentUserKey);
6511
+ const { username } = currentUser;
6512
+ const userAttributes = yield this.cognito.userAttributes(cognitoUser);
6513
+ return {
6514
+ username,
6515
+ sub: this.getCognitoUserAttribute('sub', userAttributes),
6516
+ loginEmail: this.getCognitoUserAttribute('email', userAttributes),
6517
+ resetUser: null,
6518
+ };
6519
+ });
6520
+ }
6521
+ loadResetUser(cognitoUser, password) {
6522
+ return __awaiter(this, void 0, void 0, function* () {
6523
+ const resetUser = yield this.fetchResetUser();
6524
+ const userKeys = {
5875
6525
  passKey: {
5876
6526
  id: resetUser.passKey.id,
6527
+ passKeyParams: resetUser.passKey.passKeyParams,
5877
6528
  },
5878
6529
  masterKey: {
5879
6530
  id: resetUser.masterKey.id,
5880
6531
  },
5881
- });
5882
- const userAttributes = yield this.auth.userAttributes(yield this.auth.currentAuthenticatedUser());
5883
- const sub = this.getUserAttribute('sub', userAttributes);
5884
- return Object.assign(Object.assign({}, (yield this.tpPasswordResetProcessorService.processTpPasswordResetUserNode(resetUser))), { sub });
6532
+ };
6533
+ yield this.loadUserKeys({
6534
+ userKeys,
6535
+ password,
6536
+ sessionEncryptionKey: resetUser.sessionEncryptionKey,
6537
+ });
6538
+ // Reset user only sets a subset of keys
6539
+ yield this.keyService.setKeys(userKeys);
6540
+ const { username } = resetUser;
6541
+ const userAttributes = yield this.cognito.userAttributes(cognitoUser);
6542
+ return {
6543
+ username,
6544
+ sub: this.getCognitoUserAttribute('sub', userAttributes),
6545
+ loginEmail: this.getCognitoUserAttribute('email', userAttributes),
6546
+ resetUser: {
6547
+ state: resetUser.state,
6548
+ },
6549
+ };
5885
6550
  });
5886
6551
  }
5887
- refreshAccessToken() {
6552
+ recoverAssemblyKey(resetUser) {
5888
6553
  return __awaiter(this, void 0, void 0, function* () {
5889
- const cognitoUser = yield this.auth.currentAuthenticatedUser();
5890
- const refreshToken = cognitoUser.getSignInUserSession().getRefreshToken();
5891
- return new Promise((resolve, reject) => {
5892
- cognitoUser.refreshSession(refreshToken, (err) => {
5893
- if (err) {
5894
- console.error('Error refreshing token: ', err);
5895
- reject(err);
5896
- }
5897
- else {
5898
- console.log('Token refresh complete');
5899
- resolve(0);
5900
- }
5901
- });
5902
- });
6554
+ const prk = yield this.keyGraphService.getKey(resetUser.pxk.id);
6555
+ const partials = yield Promise.all(resetUser.approvals
6556
+ .filter((approval) => !!approval.receiverCipherPartialAssemblyKey)
6557
+ .map((approval) => this.encryptionService.decrypt(prk, approval.receiverCipherPartialAssemblyKey)));
6558
+ return this.assemblyController.recoverAssemblyKey(partials);
5903
6559
  });
5904
6560
  }
5905
- completeRequest(newPassword) {
6561
+ completeResetRequest(newPassword) {
5906
6562
  return __awaiter(this, void 0, void 0, function* () {
5907
- const resetUser = yield this.getResetUser(true);
6563
+ const resetUser = yield this.fetchResetUser();
5908
6564
  if (resetUser.state !== TpClaimState.APPROVED) {
5909
6565
  throw new KcBadStateException('Password reset request has not been approved.');
5910
6566
  }
@@ -5918,7 +6574,7 @@ class LifeReadyAuthService {
5918
6574
  const masterKey = yield this.keyGraphService.getKey(resetUser.masterKey.id);
5919
6575
  const masterKeyWrappedRootKey = yield this.encryptionService.encryptToString(masterKey.jwk, rootKeyJwk.toJSON(true));
5920
6576
  // The new password
5921
- const newPassIdpResult = yield this.keyFactory.derivePassIdp(Object.assign({ password: newPassword }, resetUser.passKey.passIdpParams));
6577
+ const newPassIdpResult = yield this.keyFactoryService.derivePassIdp(Object.assign({ password: newPassword }, resetUser.passKey.passIdpParams));
5922
6578
  const newIdpPassword = this.passwordService.getPassIdpString(newPassIdpResult.jwk);
5923
6579
  // --------------------------------------------------------------
5924
6580
  // Get assembly key challenge
@@ -5933,7 +6589,7 @@ class LifeReadyAuthService {
5933
6589
  })).createTpAssemblyKeyChallenge.challenge;
5934
6590
  // Sign the challenge
5935
6591
  // Generate a client side nonce that's no in the server's control.
5936
- challenge.clientNonce = this.keyFactory.randomString(TP_PASSWORD_RESET_CLIENT_NONCE_LENGTH);
6592
+ challenge.clientNonce = this.keyFactoryService.randomString(TP_PASSWORD_RESET_CLIENT_NONCE_LENGTH);
5937
6593
  const assemblyKeyVerifierPrk = yield this.encryptionService.decrypt(assemblyKey, resetUser.wrappedAssemblyKeyVerifierPrk);
5938
6594
  const signedChallenge = yield this.encryptionService.sign(assemblyKeyVerifierPrk, challenge);
5939
6595
  // --------------------------------------------------------------
@@ -5957,14 +6613,14 @@ class LifeReadyAuthService {
5957
6613
  // to use the original password to login. Any successful login
5958
6614
  // can only be using the temporary password. So it's safe to assume
5959
6615
  // that we want to "complete" the password reset.
5960
- // The maybe 2FA so we listen for the auth event from Amplify.
6616
+ // There maybe 2FA so we listen for the auth event from Amplify.
5961
6617
  const retPromise = new Promise((resolve) => {
5962
6618
  const listener = (data) => __awaiter(this, void 0, void 0, function* () {
5963
6619
  if (data.payload.event !== 'signIn') {
5964
6620
  return;
5965
6621
  }
5966
6622
  Hub.remove('auth', listener);
5967
- yield this.auth.signIn(resetUser.username, newIdpPassword);
6623
+ yield this.cognito.signIn(resetUser.username, newIdpPassword);
5968
6624
  // Switch over to the new set of keys
5969
6625
  yield this.lrGraphQL.lrMutate(new LrMutation({
5970
6626
  mutation: CompleteTpPasswordResetRequestMutation,
@@ -5981,7 +6637,7 @@ class LifeReadyAuthService {
5981
6637
  });
5982
6638
  // Signin as the original user. Password has been reset to temporary one. It should return
5983
6639
  // with NEW_PASSWORD_REQUIRED
5984
- let user = yield this.auth.signIn(resetUser.username, tempIdpPassword, {
6640
+ let user = yield this.cognito.signIn(resetUser.username, tempIdpPassword, {
5985
6641
  noProxy: 'true',
5986
6642
  });
5987
6643
  if (user.challengeName !== 'NEW_PASSWORD_REQUIRED') {
@@ -5990,42 +6646,73 @@ class LifeReadyAuthService {
5990
6646
  // Set new password on Idp
5991
6647
  // the awsFetch() function passes NEW_PASSWORD_REQUIRED directly to AWS without
5992
6648
  // going through the proxy.
5993
- user = yield this.auth.completeNewPassword(user, newIdpPassword, {});
6649
+ user = yield this.cognito.completeNewPassword(user, newIdpPassword, {});
5994
6650
  return retPromise;
5995
6651
  });
5996
6652
  }
5997
- recoverAssemblyKey(resetUser) {
6653
+ // ------------------------------------------------------
6654
+ // Debug utilities
6655
+ // ------------------------------------------------------
6656
+ debugLogin(username, password) {
6657
+ // This will fail if debug is null. But when debug is null, this function
6658
+ // should not be called.
6659
+ this.kcConfig.debug.username = username;
6660
+ return this.debugLoadUser(password);
6661
+ }
6662
+ debugLoadUser(password) {
5998
6663
  return __awaiter(this, void 0, void 0, function* () {
5999
- const prk = yield this.keyGraphService.getKey(resetUser.pxk.id);
6000
- const partials = yield Promise.all(resetUser.approvals
6001
- .filter((approval) => !!approval.receiverCipherPartialAssemblyKey)
6002
- .map((approval) => this.encryptionService.decrypt(prk, approval.receiverCipherPartialAssemblyKey)));
6003
- return this.assemblyController.recoverAssemblyKey(partials);
6664
+ const currentUser = yield this.fetchCurrentUser();
6665
+ const { username, currentUserKey } = currentUser;
6666
+ // Debug mode can not deal with session encryption key yet.
6667
+ // NO SESSION ENCRYPTION KEY.
6668
+ const passKey = (yield this.keyFactoryService.derivePassKey(Object.assign({ password }, currentUserKey.passKey.passKeyParams))).jwk;
6669
+ const masterKey = yield this.keyGraphService.unwrapWithPassKey(currentUserKey.passKey.id, passKey, currentUserKey.masterKey.id);
6670
+ yield this.idleService.persistMasterKey(masterKey);
6671
+ yield this.keyGraphService.populateKeys(currentUserKey);
6672
+ this.user = {
6673
+ username,
6674
+ resetUser: null,
6675
+ sub: 'DEBUG_MODE',
6676
+ loginEmail: 'DEBUG_MODE',
6677
+ };
6678
+ return this.user;
6004
6679
  });
6005
6680
  }
6006
- }
6007
- LifeReadyAuthService.ɵprov = ɵɵdefineInjectable({ factory: function LifeReadyAuthService_Factory() { return new LifeReadyAuthService(ɵɵinject(KC_CONFIG), ɵɵinject(AuthClass), ɵɵinject(KeyFactoryService), ɵɵinject(KeyService), ɵɵinject(ProfileService), ɵɵinject(KeyGraphService), ɵɵinject(PasswordService), ɵɵinject(IdleService), ɵɵinject(LrGraphQLService), ɵɵinject(TpPasswordResetProcessorService), ɵɵinject(PersistService), ɵɵinject(EncryptionService), ɵɵinject(TpPasswordResetAssemblyController), ɵɵinject(HttpClient)); }, token: LifeReadyAuthService, providedIn: "root" });
6008
- LifeReadyAuthService.decorators = [
6681
+ /**
6682
+ * Clears the caches user. So we can simulate a page refresh and test getUser().
6683
+ */
6684
+ debugClearUser() {
6685
+ this.user = null;
6686
+ }
6687
+ };
6688
+ Auth2Service.CHALLENGE_TIMEOUT = 1000 * 60 * 5;
6689
+ Auth2Service.ɵprov = ɵɵdefineInjectable({ factory: function Auth2Service_Factory() { return new Auth2Service(ɵɵinject(NgZone), ɵɵinject(INJECTOR), ɵɵinject(HttpClient), ɵɵinject(AuthClass), ɵɵinject(LrGraphQLService), ɵɵinject(KeyService), ɵɵinject(KeyGraphService), ɵɵinject(KeyFactoryService), ɵɵinject(PasswordService), ɵɵinject(IdleService), ɵɵinject(PersistService), ɵɵinject(EncryptionService), ɵɵinject(TpPasswordResetAssemblyController), ɵɵinject(KC_CONFIG)); }, token: Auth2Service, providedIn: "root" });
6690
+ Auth2Service.decorators = [
6009
6691
  { type: Injectable, args: [{
6010
6692
  providedIn: 'root',
6011
6693
  },] }
6012
6694
  ];
6013
- LifeReadyAuthService.ctorParameters = () => [
6014
- { type: undefined, decorators: [{ type: Inject, args: [KC_CONFIG,] }] },
6695
+ Auth2Service.ctorParameters = () => [
6696
+ { type: NgZone },
6697
+ { type: Injector },
6698
+ { type: HttpClient },
6015
6699
  { type: AuthClass },
6016
- { type: KeyFactoryService },
6700
+ { type: LrGraphQLService },
6017
6701
  { type: KeyService },
6018
- { type: ProfileService },
6019
6702
  { type: KeyGraphService },
6703
+ { type: KeyFactoryService },
6020
6704
  { type: PasswordService },
6021
6705
  { type: IdleService },
6022
- { type: LrGraphQLService },
6023
- { type: TpPasswordResetProcessorService },
6024
6706
  { type: PersistService },
6025
6707
  { type: EncryptionService },
6026
6708
  { type: TpPasswordResetAssemblyController },
6027
- { type: HttpClient }
6709
+ { type: undefined, decorators: [{ type: Inject, args: [KC_CONFIG,] }] }
6028
6710
  ];
6711
+ Auth2Service = Auth2Service_1 = __decorate([
6712
+ RunOutsideAngular({
6713
+ ngZoneName: 'ngZone',
6714
+ })
6715
+ ], Auth2Service);
6029
6716
 
6030
6717
  var FileType;
6031
6718
  (function (FileType) {
@@ -6717,7 +7404,7 @@ let ContactCard2Service = class ContactCard2Service {
6717
7404
  createContactCard(input) {
6718
7405
  return __awaiter(this, void 0, void 0, function* () {
6719
7406
  // Get encryption key
6720
- const rootKey = yield this.keyService.getCurrentRootKey();
7407
+ const rootKey = this.keyService.currentRootKey;
6721
7408
  const key = yield this.keyFactory.createKey();
6722
7409
  const wrappedKey = yield this.keyGraph.encryptToString(rootKey.jwk, key.toJSON(true));
6723
7410
  const cipherData = yield this.keyGraph.encryptToString(key, input.plainCipherDataJson);
@@ -6756,7 +7443,7 @@ let ContactCard2Service = class ContactCard2Service {
6756
7443
  }
6757
7444
  prepareContactCardInput(input) {
6758
7445
  return __awaiter(this, void 0, void 0, function* () {
6759
- const sigPxk = yield this.keyService.getCurrentSigPxk();
7446
+ const sigPxk = this.keyService.currentSigPxk;
6760
7447
  const publicDataSig = JSON.stringify(yield this.encryptionService.sign(sigPxk.jwk, input.publicDataJson));
6761
7448
  const publicSearchableSig = JSON.stringify(yield this.encryptionService.sign(sigPxk.jwk, input.publicSearchableJson));
6762
7449
  const plainDataSig = JSON.stringify(yield this.encryptionService.sign(sigPxk.jwk, input.plainDataJson));
@@ -7128,7 +7815,7 @@ query FileStateKeyQuery($id: LrRelayIdInput!) {
7128
7815
 
7129
7816
  var Item2Service_1;
7130
7817
  let Item2Service = Item2Service_1 = class Item2Service extends LrService {
7131
- constructor(ngZone, injector, fileUploadService, keyService, keyFactory, keyGraph, lockService, authService) {
7818
+ constructor(ngZone, injector, fileUploadService, keyService, keyFactory, keyGraph, lockService, auth2Service) {
7132
7819
  super(injector);
7133
7820
  this.ngZone = ngZone;
7134
7821
  this.injector = injector;
@@ -7137,10 +7824,10 @@ let Item2Service = Item2Service_1 = class Item2Service extends LrService {
7137
7824
  this.keyFactory = keyFactory;
7138
7825
  this.keyGraph = keyGraph;
7139
7826
  this.lockService = lockService;
7140
- this.authService = authService;
7827
+ this.auth2Service = auth2Service;
7141
7828
  // Caching the temp directory.
7142
7829
  this.tempDirectory = null;
7143
- this.authService.addLogoutListener(() => this.onLogout());
7830
+ this.auth2Service.addLogoutListener(() => this.onLogout());
7144
7831
  }
7145
7832
  downloadFileContent(options) {
7146
7833
  return __awaiter(this, void 0, void 0, function* () {
@@ -7635,7 +8322,7 @@ let Item2Service = Item2Service_1 = class Item2Service extends LrService {
7635
8322
  // TODO this is rather an unfortunate name, change it to asRootDirectory.
7636
8323
  let parentRootDirectory;
7637
8324
  if (options.asRootDirectory) {
7638
- const rootKey = this.keyService.getCurrentRootKey();
8325
+ const rootKey = this.keyService.currentRootKey;
7639
8326
  parentRootDirectory = {
7640
8327
  wrappingKeyId: rootKey.id,
7641
8328
  wrappedKey: yield this.keyGraph.wrapKey(rootKey, directoryKey),
@@ -7704,7 +8391,7 @@ Item2Service.TEMP_DIRECTORY_PLAIN_META_FILTER = JSON.stringify({
7704
8391
  },
7705
8392
  ],
7706
8393
  });
7707
- Item2Service.ɵprov = ɵɵdefineInjectable({ factory: function Item2Service_Factory() { return new Item2Service(ɵɵinject(NgZone), ɵɵinject(INJECTOR), ɵɵinject(FileUploadService), ɵɵinject(KeyService), ɵɵinject(KeyFactoryService), ɵɵinject(KeyGraphService), ɵɵinject(LockService), ɵɵinject(LifeReadyAuthService)); }, token: Item2Service, providedIn: "root" });
8394
+ Item2Service.ɵprov = ɵɵdefineInjectable({ factory: function Item2Service_Factory() { return new Item2Service(ɵɵinject(NgZone), ɵɵinject(INJECTOR), ɵɵinject(FileUploadService), ɵɵinject(KeyService), ɵɵinject(KeyFactoryService), ɵɵinject(KeyGraphService), ɵɵinject(LockService), ɵɵinject(Auth2Service)); }, token: Item2Service, providedIn: "root" });
7708
8395
  Item2Service.decorators = [
7709
8396
  { type: Injectable, args: [{
7710
8397
  providedIn: 'root',
@@ -7718,7 +8405,7 @@ Item2Service.ctorParameters = () => [
7718
8405
  { type: KeyFactoryService },
7719
8406
  { type: KeyGraphService },
7720
8407
  { type: LockService },
7721
- { type: LifeReadyAuthService }
8408
+ { type: Auth2Service }
7722
8409
  ];
7723
8410
  Item2Service = Item2Service_1 = __decorate([
7724
8411
  RunOutsideAngular({
@@ -7912,88 +8599,6 @@ mutation CompleteKeyExchangeOtk(
7912
8599
  }
7913
8600
  }`;
7914
8601
 
7915
- const RequestUserDeleteMutation = gql `
7916
- mutation RequestUserDelete($input: RequestUserDeleteInput!) {
7917
- requestUserDelete(input: $input) {
7918
- userDelete {
7919
- state
7920
- created
7921
- }
7922
- }
7923
- }
7924
- `;
7925
- const CancelUserDeleteMutation = gql `
7926
- mutation CancelUserDelete($input: CancelUserDeleteInput!) {
7927
- cancelUserDelete(input: $input) {
7928
- id
7929
- }
7930
- }
7931
- `;
7932
- const LoginHistoryQuery = gql `
7933
- query LoginHistory($first: Int, $after: String) {
7934
- loginHistory(first: $first, after: $after) {
7935
- pageInfo {
7936
- hasNextPage
7937
- hasPreviousPage
7938
- startCursor
7939
- endCursor
7940
- }
7941
- events
7942
- }
7943
- }
7944
- `;
7945
-
7946
- class UserService {
7947
- constructor(lrApollo) {
7948
- this.lrApollo = lrApollo;
7949
- }
7950
- requestUserDelete() {
7951
- return __awaiter(this, void 0, void 0, function* () {
7952
- const res = yield this.lrApollo.mutate({
7953
- mutation: RequestUserDeleteMutation,
7954
- variables: {
7955
- input: {},
7956
- },
7957
- });
7958
- return res.requestUserDelete.userDelete;
7959
- });
7960
- }
7961
- cancelUserDelete() {
7962
- return __awaiter(this, void 0, void 0, function* () {
7963
- const res = yield this.lrApollo.mutate({
7964
- mutation: CancelUserDeleteMutation,
7965
- variables: {
7966
- input: {},
7967
- },
7968
- });
7969
- return res.cancelUserDelete.id;
7970
- });
7971
- }
7972
- loginHistory(first = null, after = null) {
7973
- return __awaiter(this, void 0, void 0, function* () {
7974
- // first: return first n entries
7975
- // after: pass in the pageInfo.endCursor to paginate
7976
- const res = yield this.lrApollo.query({
7977
- query: LoginHistoryQuery,
7978
- variables: {
7979
- first,
7980
- after,
7981
- },
7982
- });
7983
- return res.loginHistory;
7984
- });
7985
- }
7986
- }
7987
- UserService.ɵprov = ɵɵdefineInjectable({ factory: function UserService_Factory() { return new UserService(ɵɵinject(LrApolloService)); }, token: UserService, providedIn: "root" });
7988
- UserService.decorators = [
7989
- { type: Injectable, args: [{
7990
- providedIn: 'root',
7991
- },] }
7992
- ];
7993
- UserService.ctorParameters = () => [
7994
- { type: LrApolloService }
7995
- ];
7996
-
7997
8602
  var OtkState;
7998
8603
  (function (OtkState) {
7999
8604
  OtkState["OTK_INITIATED"] = "OTK_INITIATED";
@@ -8002,13 +8607,12 @@ var OtkState;
8002
8607
  })(OtkState || (OtkState = {}));
8003
8608
 
8004
8609
  class KeyExchangeService {
8005
- constructor(keyFactory, keyService, lrApollo, encryptionService, authService, userService) {
8610
+ constructor(keyFactory, keyService, lrApollo, encryptionService, auth2Service) {
8006
8611
  this.keyFactory = keyFactory;
8007
8612
  this.keyService = keyService;
8008
8613
  this.lrApollo = lrApollo;
8009
8614
  this.encryptionService = encryptionService;
8010
- this.authService = authService;
8011
- this.userService = userService;
8615
+ this.auth2Service = auth2Service;
8012
8616
  this.CLIENT_NONCE_LENGTH = 32;
8013
8617
  }
8014
8618
  getKeyExchangeList(input = {}) {
@@ -8057,7 +8661,7 @@ class KeyExchangeService {
8057
8661
  decryptKeyExchange(keyExchange, otKeyK) {
8058
8662
  return __awaiter(this, void 0, void 0, function* () {
8059
8663
  if (keyExchange.isInitiator) {
8060
- const rootKey = yield this.keyService.getCurrentRootKey();
8664
+ const rootKey = this.keyService.currentRootKey;
8061
8665
  // Decrypt using the root key to get the Prk
8062
8666
  const plainInitiatorRootKeyCipher = (yield this.encryptionService.decrypt(rootKey.jwk, keyExchange.initiatorRootKeyCipher));
8063
8667
  const plainInitiatorOneTimePbkCipher = keyExchange.otk
@@ -8102,7 +8706,7 @@ class KeyExchangeService {
8102
8706
  !keyExchange.isInitiator &&
8103
8707
  keyExchange.otk.responderPbkCipher) {
8104
8708
  // Assuming existing user getting invited where OTK is wrapped in responder's public key.
8105
- const prk = yield this.keyService.getCurrentPxk();
8709
+ const prk = this.keyService.currentPxk;
8106
8710
  const decryptedCipher = yield this.encryptionService.decrypt(prk.jwk, JSON.parse(keyExchange.otk.responderPbkCipher), {
8107
8711
  serializations: [JoseSerialization.COMPACT],
8108
8712
  });
@@ -8117,7 +8721,7 @@ class KeyExchangeService {
8117
8721
  return __awaiter(this, void 0, void 0, function* () {
8118
8722
  const otKey = yield this.keyFactory.createKey();
8119
8723
  const nonce = this.keyFactory.randomString(this.CLIENT_NONCE_LENGTH);
8120
- const user = yield this.authService.getUser();
8724
+ const user = yield this.auth2Service.getUser();
8121
8725
  // New PKC key for encryption. This key is used only once when the responder sends
8122
8726
  // back their signing public key.
8123
8727
  const initiatorOneTimePrk = yield this.keyFactory.createPkcKey();
@@ -8125,8 +8729,8 @@ class KeyExchangeService {
8125
8729
  // const initiatorSigPrk = await this.keyService.createPkcSignKey();
8126
8730
  // Option 2: Use the user's global signing key.
8127
8731
  // This key is used to prove the initiator's identity.
8128
- const initiatorPrk = yield this.keyService.getCurrentPxk();
8129
- const initiatorSigPrk = yield this.keyService.getCurrentSigPxk();
8732
+ const initiatorPrk = this.keyService.currentPxk;
8733
+ const initiatorSigPrk = this.keyService.currentSigPxk;
8130
8734
  let initiatorPlainDataSig = null;
8131
8735
  if (contactCard && contactCard.ownerPlainData) {
8132
8736
  initiatorPlainDataSig = JSON.stringify(yield this.encryptionService.sign(initiatorSigPrk.jwk, contactCard.ownerPlainData));
@@ -8162,7 +8766,7 @@ class KeyExchangeService {
8162
8766
  initiatorContactCard: contactCard,
8163
8767
  initiator,
8164
8768
  };
8165
- const rootKey = yield this.keyService.getCurrentRootKey();
8769
+ const rootKey = this.keyService.currentRootKey;
8166
8770
  const initiatorRootKeyCipher = yield this.encryptionService.encrypt(rootKey.jwk, plainInitiatorRootKeyCipher);
8167
8771
  // The raw OTK
8168
8772
  const otKeyK = otKey.toJSON(true).k;
@@ -8195,10 +8799,9 @@ class KeyExchangeService {
8195
8799
  }
8196
8800
  respondOtk({ id, token, decryptedOtk, message, initiatorContactCard, responderContactCard: sentContactCard, }) {
8197
8801
  return __awaiter(this, void 0, void 0, function* () {
8198
- const user = yield this.authService.getUser();
8199
- const rootKey = yield this.keyService.getCurrentRootKey();
8200
- const masterKeyId = this.keyService.getCurrentMasterKey().id;
8201
- const masterKey = yield this.keyService.getCurrentMasterKey();
8802
+ const user = yield this.auth2Service.getUser();
8803
+ const rootKey = this.keyService.currentRootKey;
8804
+ const masterKey = this.keyService.currentMasterKey;
8202
8805
  const sharedKey = yield this.keyFactory.createKey();
8203
8806
  const mkSharedKey = yield this.keyFactory.createKey();
8204
8807
  const rkWrappedSharedKey = yield this.encryptionService.encrypt(rootKey.jwk, sharedKey.toJSON(true));
@@ -8211,8 +8814,8 @@ class KeyExchangeService {
8211
8814
  // const responderSigPrk = await this.keyService.createPkcSignKey()
8212
8815
  // const rkWrappedResponderSigPrk = await this.encrypt(rootKey, responderSigPrk.toJSON(true));
8213
8816
  // Option 2: Responder already has a signing Prk
8214
- const responderPrk = yield this.keyService.getCurrentPxk();
8215
- const responderSigPrk = yield this.keyService.getCurrentSigPxk();
8817
+ const responderPrk = this.keyService.currentPxk;
8818
+ const responderSigPrk = this.keyService.currentSigPxk;
8216
8819
  const signedInitiatorPbk = yield this.encryptionService.sign(responderSigPrk.jwk, initiatorPbk.toJSON());
8217
8820
  const signedInitiatorSigPbk = yield this.encryptionService.sign(responderSigPrk.jwk, initiatorSigPbk.toJSON());
8218
8821
  const plainInitiatorOneTimePbkCipher = {
@@ -8238,7 +8841,7 @@ class KeyExchangeService {
8238
8841
  // Create keys
8239
8842
  const receiverKey = yield this.keyFactory.createKey();
8240
8843
  const ccSharedKey = yield this.keyFactory.createKey();
8241
- const sigPxk = yield this.keyService.getCurrentSigPxk();
8844
+ const sigPxk = this.keyService.currentSigPxk;
8242
8845
  receivedCardInput = {
8243
8846
  receiverWrappedKey: JSON.stringify(yield this.encryptionService.encrypt(rootKey.jwk, receiverKey.toJSON(true))),
8244
8847
  receiverWrappingKeyId: rootKey.id,
@@ -8257,7 +8860,7 @@ class KeyExchangeService {
8257
8860
  // Create keys
8258
8861
  const ownerKey = yield this.keyFactory.createKey();
8259
8862
  const ccSharedKey = yield this.keyFactory.createKey();
8260
- const sigPxk = yield this.keyService.getCurrentSigPxk();
8863
+ const sigPxk = this.keyService.currentSigPxk;
8261
8864
  sentCardInput = {
8262
8865
  ownerWrappedKey: JSON.stringify(yield this.encryptionService.encrypt(rootKey.jwk, ownerKey.toJSON(true))),
8263
8866
  ownerWrappingKeyId: rootKey.id,
@@ -8286,7 +8889,7 @@ class KeyExchangeService {
8286
8889
  keyExchangeId: id,
8287
8890
  keyExchangeToken: token,
8288
8891
  rootKeyId: rootKey.id,
8289
- masterKeyId,
8892
+ masterKeyId: masterKey.id,
8290
8893
  // These will be stored on the server
8291
8894
  responderPxkId: responderPrk.id,
8292
8895
  responderSigPxkId: responderSigPrk.id,
@@ -8313,8 +8916,8 @@ class KeyExchangeService {
8313
8916
  }
8314
8917
  completeOtk(keyExchangeId, initiatorRootKeyCipher, initiatorOneTimePbkCipher, responderContactCard) {
8315
8918
  return __awaiter(this, void 0, void 0, function* () {
8316
- const rootKey = yield this.keyService.getCurrentRootKey();
8317
- const masterKey = yield this.keyService.getCurrentMasterKey();
8919
+ const rootKey = this.keyService.currentRootKey;
8920
+ const masterKey = this.keyService.currentMasterKey;
8318
8921
  // Decrypt using the root key to get the Prk
8319
8922
  const plainInitiatorRootKeyCipher = (yield this.encryptionService.decrypt(rootKey.jwk, initiatorRootKeyCipher));
8320
8923
  // The Prk is single-use and only used to send information from the responder back to the initiator.
@@ -8330,7 +8933,7 @@ class KeyExchangeService {
8330
8933
  // In this case the initiatorSigPrk is already a part of the key graph.
8331
8934
  // So there's nothing to do here.
8332
8935
  // Protected the signing public key of the responder.
8333
- const initiatorSigPrk = yield this.keyService.getCurrentSigPxk();
8936
+ const initiatorSigPrk = this.keyService.currentSigPxk;
8334
8937
  const responderSigPbk = yield KeyFactoryService.asKey(plainInitiatorOneTimePbkCipher.responder.sigPbk);
8335
8938
  const responderPbk = yield KeyFactoryService.asKey(plainInitiatorOneTimePbkCipher.responder.pbk);
8336
8939
  const signedResponderPbk = yield this.encryptionService.sign(initiatorSigPrk.jwk, responderPbk.toJSON());
@@ -8408,7 +9011,7 @@ class KeyExchangeService {
8408
9011
  });
8409
9012
  }
8410
9013
  }
8411
- KeyExchangeService.ɵprov = ɵɵdefineInjectable({ factory: function KeyExchangeService_Factory() { return new KeyExchangeService(ɵɵinject(KeyFactoryService), ɵɵinject(KeyService), ɵɵinject(LrApolloService), ɵɵinject(EncryptionService), ɵɵinject(LifeReadyAuthService), ɵɵinject(UserService)); }, token: KeyExchangeService, providedIn: "root" });
9014
+ KeyExchangeService.ɵprov = ɵɵdefineInjectable({ factory: function KeyExchangeService_Factory() { return new KeyExchangeService(ɵɵinject(KeyFactoryService), ɵɵinject(KeyService), ɵɵinject(LrApolloService), ɵɵinject(EncryptionService), ɵɵinject(Auth2Service)); }, token: KeyExchangeService, providedIn: "root" });
8412
9015
  KeyExchangeService.decorators = [
8413
9016
  { type: Injectable, args: [{
8414
9017
  providedIn: 'root',
@@ -8419,8 +9022,7 @@ KeyExchangeService.ctorParameters = () => [
8419
9022
  { type: KeyService },
8420
9023
  { type: LrApolloService },
8421
9024
  { type: EncryptionService },
8422
- { type: LifeReadyAuthService },
8423
- { type: UserService }
9025
+ { type: Auth2Service }
8424
9026
  ];
8425
9027
 
8426
9028
  const KeyExchangeFragment = gqlTyped `
@@ -8614,7 +9216,7 @@ let KeyExchange2Service = class KeyExchange2Service extends LrService {
8614
9216
  !keyExchange.isInitiator &&
8615
9217
  keyExchange.otk.responderPbkCipher) {
8616
9218
  // Assuming existing user getting invited where OTK is wrapped in responder's public key.
8617
- const prk = yield this.keyService.getCurrentPxk();
9219
+ const prk = this.keyService.currentPxk;
8618
9220
  const decryptedCipher = yield this.encryptionService.decrypt(prk.jwk, JSON.parse(keyExchange.otk.responderPbkCipher), {
8619
9221
  serializations: [JoseSerialization.COMPACT],
8620
9222
  });
@@ -8653,7 +9255,7 @@ let KeyExchange2Service = class KeyExchange2Service extends LrService {
8653
9255
  }
8654
9256
  decryptKeyExchangeAsInitiator(keyExchange) {
8655
9257
  return __awaiter(this, void 0, void 0, function* () {
8656
- const rootKey = yield this.keyService.getCurrentRootKey();
9258
+ const rootKey = this.keyService.currentRootKey;
8657
9259
  // Decrypt using the root key to get the Prk
8658
9260
  const initiatorRootKeyCipherClearJson = (yield this.encryptionService.decrypt(rootKey.jwk, keyExchange.initiatorRootKeyCipher));
8659
9261
  const otKey = yield KeyFactoryService.asKey(initiatorRootKeyCipherClearJson.otKey);
@@ -8778,8 +9380,8 @@ let KeyExchange2Service = class KeyExchange2Service extends LrService {
8778
9380
  // const initiatorSigPrk = await this.keyService.createPkcSignKey();
8779
9381
  // Option 2: Use the user's global signing key.
8780
9382
  // This key is used to prove the initiator's identity.
8781
- const initiatorPrk = yield this.keyService.getCurrentPxk();
8782
- const initiatorSigPrk = yield this.keyService.getCurrentSigPxk();
9383
+ const initiatorPrk = this.keyService.currentPxk;
9384
+ const initiatorSigPrk = this.keyService.currentSigPxk;
8783
9385
  let initiatorPlainDataSig = null;
8784
9386
  if (contactCard && contactCard.ownerPlainDataJson) {
8785
9387
  initiatorPlainDataSig = yield this.encryptionService.signToString(initiatorSigPrk.jwk, contactCard.ownerPlainDataJson);
@@ -8816,7 +9418,7 @@ let KeyExchange2Service = class KeyExchange2Service extends LrService {
8816
9418
  initiatorContactCard: contactCard,
8817
9419
  initiator,
8818
9420
  };
8819
- const rootKey = yield this.keyService.getCurrentRootKey();
9421
+ const rootKey = this.keyService.currentRootKey;
8820
9422
  const initiatorRootKeyCipher = yield this.keyGraph.encryptToString(rootKey.jwk, initiatorRootKeyCipherClearJson);
8821
9423
  // The raw OTK
8822
9424
  const otKeyK = otKey.toJSON(true).k;
@@ -8854,9 +9456,8 @@ let KeyExchange2Service = class KeyExchange2Service extends LrService {
8854
9456
  }
8855
9457
  respondOtkMutation({ keyExchangeId, token, decryptedOtk, message, initiatorContactCard, responderContactCard, }) {
8856
9458
  return __awaiter(this, void 0, void 0, function* () {
8857
- const rootKey = yield this.keyService.getCurrentRootKey();
8858
- const masterKeyId = this.keyService.getCurrentMasterKey().id;
8859
- const masterKey = yield this.keyService.getCurrentMasterKey();
9459
+ const rootKey = this.keyService.currentRootKey;
9460
+ const masterKey = this.keyService.currentMasterKey;
8860
9461
  const sharedKey = yield this.keyFactory.createKey();
8861
9462
  const mkSharedKey = yield this.keyFactory.createKey();
8862
9463
  const rkWrappedSharedKey = yield this.encryptionService.encrypt(rootKey.jwk, sharedKey.toJSON(true));
@@ -8869,8 +9470,8 @@ let KeyExchange2Service = class KeyExchange2Service extends LrService {
8869
9470
  // const responderSigPrk = await this.keyService.createPkcSignKey()
8870
9471
  // const rkWrappedResponderSigPrk = await this.encrypt(rootKey, responderSigPrk.toJSON(true));
8871
9472
  // Option 2: Responder already has a signing Prk
8872
- const responderPrk = yield this.keyService.getCurrentPxk();
8873
- const responderSigPrk = yield this.keyService.getCurrentSigPxk();
9473
+ const responderPrk = this.keyService.currentPxk;
9474
+ const responderSigPrk = this.keyService.currentSigPxk;
8874
9475
  const signedInitiatorPbk = yield this.encryptionService.sign(responderSigPrk.jwk, initiatorPbk.toJSON());
8875
9476
  const signedInitiatorSigPbk = yield this.encryptionService.sign(responderSigPrk.jwk, initiatorSigPbk.toJSON());
8876
9477
  const initiatorOneTimePbkCipherClearJson = {
@@ -8893,7 +9494,7 @@ let KeyExchange2Service = class KeyExchange2Service extends LrService {
8893
9494
  // Create keys
8894
9495
  const receiverKey = yield this.keyFactory.createKey();
8895
9496
  const ccSharedKey = yield this.keyFactory.createKey();
8896
- const sigPxk = yield this.keyService.getCurrentSigPxk();
9497
+ const sigPxk = this.keyService.currentSigPxk;
8897
9498
  receivedCardInput = {
8898
9499
  receiverWrappedKey: JSON.stringify(yield this.encryptionService.encrypt(rootKey.jwk, receiverKey.toJSON(true))),
8899
9500
  receiverWrappingKeyId: rootKey.id,
@@ -8912,7 +9513,7 @@ let KeyExchange2Service = class KeyExchange2Service extends LrService {
8912
9513
  // Create keys
8913
9514
  const ownerKey = yield this.keyFactory.createKey();
8914
9515
  const ccSharedKey = yield this.keyFactory.createKey();
8915
- const sigPxk = yield this.keyService.getCurrentSigPxk();
9516
+ const sigPxk = this.keyService.currentSigPxk;
8916
9517
  responderCardInput = {
8917
9518
  ownerWrappedKey: JSON.stringify(yield this.encryptionService.encrypt(rootKey.jwk, ownerKey.toJSON(true))),
8918
9519
  ownerWrappingKeyId: rootKey.id,
@@ -8941,7 +9542,7 @@ let KeyExchange2Service = class KeyExchange2Service extends LrService {
8941
9542
  keyExchangeId,
8942
9543
  keyExchangeToken: token,
8943
9544
  rootKeyId: rootKey.id,
8944
- masterKeyId,
9545
+ masterKeyId: masterKey.id,
8945
9546
  // These will be stored on the server
8946
9547
  responderPxkId: responderPrk.id,
8947
9548
  responderSigPxkId: responderSigPrk.id,
@@ -8970,8 +9571,8 @@ let KeyExchange2Service = class KeyExchange2Service extends LrService {
8970
9571
  }
8971
9572
  completeOtkMutation({ keyExchangeId, initiatorRootKeyCipher, initiatorOneTimePbkCipher, responderContactCard, initiatorContactCard, }) {
8972
9573
  return __awaiter(this, void 0, void 0, function* () {
8973
- const rootKey = yield this.keyService.getCurrentRootKey();
8974
- const masterKey = yield this.keyService.getCurrentMasterKey();
9574
+ const rootKey = this.keyService.currentRootKey;
9575
+ const masterKey = this.keyService.currentMasterKey;
8975
9576
  // Decrypt using the root key to get the Prk
8976
9577
  const initiatorRootKeyCipherClearJson = (yield this.encryptionService.decrypt(rootKey.jwk, initiatorRootKeyCipher));
8977
9578
  // The Prk is single-use and only used to send information from the responder back to the initiator.
@@ -8988,7 +9589,7 @@ let KeyExchange2Service = class KeyExchange2Service extends LrService {
8988
9589
  // In this case the initiatorSigPrk is already a part of the key graph.
8989
9590
  // So there's nothing to do here.
8990
9591
  // Protected the signing public key of the responder.
8991
- const initiatorSigPrk = yield this.keyService.getCurrentSigPxk();
9592
+ const initiatorSigPrk = this.keyService.currentSigPxk;
8992
9593
  const responderSigPbk = yield KeyFactoryService.asKey(plainInitiatorOneTimePbkCipher.responder.sigPbk);
8993
9594
  const responderPbk = yield KeyFactoryService.asKey(plainInitiatorOneTimePbkCipher.responder.pbk);
8994
9595
  const signedResponderPbk = yield this.encryptionService.sign(initiatorSigPrk.jwk, responderPbk.toJSON());
@@ -9129,12 +9730,12 @@ const LbopsQuery = gql `
9129
9730
  }
9130
9731
  `;
9131
9732
  class LbopService {
9132
- constructor(config, http, lrApollo, auth, authService, keyFactory, keyService, encryptionService, keyGraph, passwordService) {
9733
+ constructor(config, http, lrApollo, auth, auth2Service, keyFactory, keyService, encryptionService, keyGraph, passwordService) {
9133
9734
  this.config = config;
9134
9735
  this.http = http;
9135
9736
  this.lrApollo = lrApollo;
9136
9737
  this.auth = auth;
9137
- this.authService = authService;
9738
+ this.auth2Service = auth2Service;
9138
9739
  this.keyFactory = keyFactory;
9139
9740
  this.keyService = keyService;
9140
9741
  this.encryptionService = encryptionService;
@@ -9164,7 +9765,7 @@ class LbopService {
9164
9765
  return __awaiter(this, void 0, void 0, function* () {
9165
9766
  const lbop = yield this.get(id);
9166
9767
  lbop.name = name;
9167
- const masterKey = yield this.keyService.getCurrentMasterKey();
9768
+ const masterKey = this.keyService.currentMasterKey;
9168
9769
  const cipherMeta = yield this.encryptionService.encrypt(masterKey.jwk, lbop);
9169
9770
  const res = yield this.lrApollo.mutate({
9170
9771
  mutation: UpdateLbopQuery,
@@ -9186,7 +9787,7 @@ class LbopService {
9186
9787
  id,
9187
9788
  },
9188
9789
  });
9189
- const masterKey = yield this.keyService.getCurrentMasterKey();
9790
+ const masterKey = this.keyService.currentMasterKey;
9190
9791
  const plainCipherMeta = yield this.encryptionService.decrypt(masterKey.jwk, JSON.parse(res.lbop.cipherMeta));
9191
9792
  return Object.assign({ id: res.id }, plainCipherMeta);
9192
9793
  });
@@ -9196,7 +9797,7 @@ class LbopService {
9196
9797
  const res = yield this.lrApollo.query({
9197
9798
  query: LbopsQuery,
9198
9799
  });
9199
- const masterKey = yield this.keyService.getCurrentMasterKey();
9800
+ const masterKey = yield this.keyService.currentMasterKey;
9200
9801
  return Promise.all(res.lbops.edges.map((edge) => __awaiter(this, void 0, void 0, function* () {
9201
9802
  const plainCipherMeta = yield this.encryptionService.decrypt(masterKey.jwk, JSON.parse(edge.node.cipherMeta));
9202
9803
  return Object.assign({ id: edge.node.id }, plainCipherMeta);
@@ -9227,8 +9828,7 @@ class LbopService {
9227
9828
  const lbopKeyVerifier = yield this.keyFactory.createSignKey();
9228
9829
  const wrappedLbopKeyVerifier = yield this.encryptionService.encrypt(lbopKey, lbopKeyVerifier.toJSON(true));
9229
9830
  // Re-encrypt master key with new key
9230
- const currentUser = yield this.authService.getUser();
9231
- const masterKey = yield this.keyGraph.getKey(currentUser.currentUserKey.masterKey.id);
9831
+ const masterKey = this.keyService.currentMasterKey;
9232
9832
  const wrappedMasterKey = yield this.encryptionService.encrypt(lbopKey, masterKey.jwk.toJSON(true));
9233
9833
  const meta = Object.assign(Object.assign({}, (name && { name })), { partial: this.getPartial(lbopString) });
9234
9834
  const cipherMeta = yield this.encryptionService.encrypt(masterKey.jwk, meta);
@@ -9240,7 +9840,7 @@ class LbopService {
9240
9840
  lbopKeyParams: JSON.stringify(lbopKeyParams),
9241
9841
  lbopKeyVerifier: JSON.stringify(lbopKeyVerifier.toJSON(true)),
9242
9842
  wrappedLbopKeyVerifier: JSON.stringify(wrappedLbopKeyVerifier),
9243
- masterKeyId: currentUser.currentUserKey.masterKey.id,
9843
+ masterKeyId: masterKey.id,
9244
9844
  wrappedMasterKey: JSON.stringify(wrappedMasterKey),
9245
9845
  },
9246
9846
  },
@@ -9392,7 +9992,7 @@ class LbopService {
9392
9992
  });
9393
9993
  }
9394
9994
  }
9395
- LbopService.ɵprov = ɵɵdefineInjectable({ factory: function LbopService_Factory() { return new LbopService(ɵɵinject(KC_CONFIG), ɵɵinject(HttpClient), ɵɵinject(LrApolloService), ɵɵinject(AuthClass), ɵɵinject(LifeReadyAuthService), ɵɵinject(KeyFactoryService), ɵɵinject(KeyService), ɵɵinject(EncryptionService), ɵɵinject(KeyGraphService), ɵɵinject(PasswordService)); }, token: LbopService, providedIn: "root" });
9995
+ LbopService.ɵprov = ɵɵdefineInjectable({ factory: function LbopService_Factory() { return new LbopService(ɵɵinject(KC_CONFIG), ɵɵinject(HttpClient), ɵɵinject(LrApolloService), ɵɵinject(AuthClass), ɵɵinject(Auth2Service), ɵɵinject(KeyFactoryService), ɵɵinject(KeyService), ɵɵinject(EncryptionService), ɵɵinject(KeyGraphService), ɵɵinject(PasswordService)); }, token: LbopService, providedIn: "root" });
9396
9996
  LbopService.decorators = [
9397
9997
  { type: Injectable, args: [{
9398
9998
  providedIn: 'root',
@@ -9403,7 +10003,7 @@ LbopService.ctorParameters = () => [
9403
10003
  { type: HttpClient },
9404
10004
  { type: LrApolloService },
9405
10005
  { type: AuthClass },
9406
- { type: LifeReadyAuthService },
10006
+ { type: Auth2Service },
9407
10007
  { type: KeyFactoryService },
9408
10008
  { type: KeyService },
9409
10009
  { type: EncryptionService },
@@ -10094,7 +10694,7 @@ class SharedContactCardService {
10094
10694
  return __awaiter(this, void 0, void 0, function* () {
10095
10695
  const ownerKey = yield this.keyGraph.getKey(ownedKeyId);
10096
10696
  const sharedKey = yield this.keyGraph.getKey(sharedKeyId);
10097
- const sigPxk = yield this.keyService.getCurrentSigPxk();
10697
+ const sigPxk = this.keyService.currentSigPxk;
10098
10698
  const sharedCipherData = yield this.encryptionService.encrypt(sharedKey.jwk, contactCard);
10099
10699
  const sharedCipherDataSig = JSON.stringify(yield this.encryptionService.sign(sigPxk.jwk, sharedCipherData));
10100
10700
  const ownerPlainData = {
@@ -10131,6 +10731,88 @@ SharedContactCardService.ctorParameters = () => [
10131
10731
  { type: EncryptionService }
10132
10732
  ];
10133
10733
 
10734
+ const RequestUserDeleteMutation = gql `
10735
+ mutation RequestUserDelete($input: RequestUserDeleteInput!) {
10736
+ requestUserDelete(input: $input) {
10737
+ userDelete {
10738
+ state
10739
+ created
10740
+ }
10741
+ }
10742
+ }
10743
+ `;
10744
+ const CancelUserDeleteMutation = gql `
10745
+ mutation CancelUserDelete($input: CancelUserDeleteInput!) {
10746
+ cancelUserDelete(input: $input) {
10747
+ id
10748
+ }
10749
+ }
10750
+ `;
10751
+ const LoginHistoryQuery = gql `
10752
+ query LoginHistory($first: Int, $after: String) {
10753
+ loginHistory(first: $first, after: $after) {
10754
+ pageInfo {
10755
+ hasNextPage
10756
+ hasPreviousPage
10757
+ startCursor
10758
+ endCursor
10759
+ }
10760
+ events
10761
+ }
10762
+ }
10763
+ `;
10764
+
10765
+ class UserService {
10766
+ constructor(lrApollo) {
10767
+ this.lrApollo = lrApollo;
10768
+ }
10769
+ requestUserDelete() {
10770
+ return __awaiter(this, void 0, void 0, function* () {
10771
+ const res = yield this.lrApollo.mutate({
10772
+ mutation: RequestUserDeleteMutation,
10773
+ variables: {
10774
+ input: {},
10775
+ },
10776
+ });
10777
+ return res.requestUserDelete.userDelete;
10778
+ });
10779
+ }
10780
+ cancelUserDelete() {
10781
+ return __awaiter(this, void 0, void 0, function* () {
10782
+ const res = yield this.lrApollo.mutate({
10783
+ mutation: CancelUserDeleteMutation,
10784
+ variables: {
10785
+ input: {},
10786
+ },
10787
+ });
10788
+ return res.cancelUserDelete.id;
10789
+ });
10790
+ }
10791
+ loginHistory(first = null, after = null) {
10792
+ return __awaiter(this, void 0, void 0, function* () {
10793
+ // first: return first n entries
10794
+ // after: pass in the pageInfo.endCursor to paginate
10795
+ const res = yield this.lrApollo.query({
10796
+ query: LoginHistoryQuery,
10797
+ variables: {
10798
+ first,
10799
+ after,
10800
+ },
10801
+ });
10802
+ return res.loginHistory;
10803
+ });
10804
+ }
10805
+ }
10806
+ UserService.ɵprov = ɵɵdefineInjectable({ factory: function UserService_Factory() { return new UserService(ɵɵinject(LrApolloService)); }, token: UserService, providedIn: "root" });
10807
+ UserService.decorators = [
10808
+ { type: Injectable, args: [{
10809
+ providedIn: 'root',
10810
+ },] }
10811
+ ];
10812
+ UserService.ctorParameters = () => [
10813
+ { type: LrApolloService }
10814
+ ];
10815
+
10134
10816
  const TrustedPartyProperties = `
10135
10817
  id
10136
10818
  user {
@@ -12315,7 +12997,7 @@ let SharedContactCard2Service = class SharedContactCard2Service {
12315
12997
  ownerKey = yield this.keyGraph.getKey(keys.ownerKeyId);
12316
12998
  sharedKey = yield this.keyGraph.getKey(keys.sharedKeyId);
12317
12999
  }
12318
- const sigPxk = yield this.keyService.getCurrentSigPxk();
13000
+ const sigPxk = this.keyService.currentSigPxk;
12319
13001
  const sharedCipherData = yield this.encryptionService.encrypt(sharedKey.jwk, sharedCipherDataClearJson);
12320
13002
  const sharedCipherDataSig = JSON.stringify(yield this.encryptionService.sign(sigPxk.jwk, sharedCipherData));
12321
13003
  const ownerPlainDataSig = JSON.stringify(yield this.encryptionService.sign(sigPxk.jwk, ownerPlainDataJson));
@@ -12925,7 +13607,7 @@ let TrustedParty2Service = class TrustedParty2Service extends LrService {
12925
13607
  if (userSharedKey.mkSharedKey) {
12926
13608
  throw new KcBadStateException('TP already has mkSharedKey');
12927
13609
  }
12928
- const masterKey = yield this.keyService.getCurrentMasterKey();
13610
+ const masterKey = this.keyService.currentMasterKey;
12929
13611
  const prk = yield this.keyFactory.createPkcKey();
12930
13612
  const mkWrappedMkPrk = yield this.encryptionService.encryptToString(masterKey.jwk, prk.toJSON(true));
12931
13613
  const sharedKey = yield this.keyGraph.getKey(userSharedKey.sharedKey.id);
@@ -12988,7 +13670,7 @@ let TrustedParty2Service = class TrustedParty2Service extends LrService {
12988
13670
  id: plainMkReshareResponseCipher.mkSharedKey.id,
12989
13671
  jwk: yield JWK.asKey(plainMkReshareResponseCipher.mkSharedKey.jwk),
12990
13672
  };
12991
- const masterKey = yield this.keyService.getCurrentMasterKey();
13673
+ const masterKey = this.keyService.currentMasterKey;
12992
13674
  const mkWrappedMkSharedKey = yield this.encryptionService.encryptToString(masterKey.jwk, mkSharedKey.jwk.toJSON(true));
12993
13675
  return new LrMutation({
12994
13676
  mutation: CompleteTpMkReshareMutation,
@@ -13116,5 +13798,5 @@ TwoFactorService.ctorParameters = () => [
13116
13798
  * Generated bundle index. Do not edit.
13117
13799
  */
13118
13800
 
13119
- export { AccessLevel, AccessRoleChoice, AccessRoleMethodChoice, ApiContactCard, ApiCurrentUser, ArchiveDirectoryMutation, CancelUserDeleteMutation, Category, CategoryFields, CategoryFilter, CategoryMetaService, CategoryService, ClaimApproverState, ClaimState, CognitoChallengeUser, CommonProcessorsService, CompleteOtkMutation, Config, ContactCard2Service, ContactCardAddress, ContactCardName, CreateCategoryMutation, CreateContactCardMutation$1 as CreateContactCardMutation, CreateFileMutation, CreateFileQuery, CreateLbopQuery, CreateRecordContainerMutation, CreateRecordMutation, CreateVaultMutation, CurrentCategory, CurrentUser, CurrentUserKey, CurrentUserQuery, CurrentUserSharedKeyQuery, DEFAULT_BREADCRUMB_DEPTH, DEFAULT_DESCENDANTS_DEPTH, DefaultCategory, DefaultProcessorOptions, DefaultVaultFilter, DeleteCategoryMutation, DeleteFileMutation, DeleteLbopQuery, DeleteRecordMutation, DirectoryQuery, DirectoryType, ERROR_SOURCE, FeatureAction, Features, FetchKeyGraphField, FileOperationField, FileQuery, FileType, FileUploadService, GetCategoriesQuery, GetCategoryKeyIdQuery, GetCategoryQuery, GetMySharedCategoriesQuery, GetRecordQuery, GetRootDirectoryIdsQuery, GetTrustedPartyCategoriesQuery, GetVaultsQuery, IdleService, InitiateOtkMutation, Item2Service, KC_CONFIG, KcAuthException, KcBadArgumentException, KcBadLogicException, KcBadRequestException, KcBadSignatureException, KcBadStateException, KcBadTimeSyncException, KcCodeMismatchException, KcConcurrentAccessException, KcEncryptionException, KcError, KcErrorCode, KcException, KcInternalErrorException, KcLbopErrorCode, KcLockedException, KcNotFoundException, KcSuspiciousOperationException, KcUnsupportedException, KeyExchange2Service, KeyExchangeFields, KeyExchangeMode, KeyExchangeOtkState, KeyExchangeQuery, KeyExchangeService, KeyExchangeState, KeyExchangeTokenQuery, KeyExchangesQuery, KeyGraphField, KeyGraphFragment, LbopQuery, LbopService, LbopsQuery, LifeReadyAuthService, LifeReadyModule, LinkTypeField, LoadedCategoryTree, LockService, LockState, LoginHistoryQuery, LoginResult, LrApolloService, LrGraphQLService, LrMergedMutation, LrMutation, LrMutationBase, LrRecord, LrService, MainContactCard, MainContactCardFields, MainContactCardPlainFields, MainContactCardProperty, MessageService, MoveDirectoryQuery, MoveFileQuery, NewAttachment, NewCategory, NewOrUpdatedAttachment, NewRecord, NotificationService, OtkState, OwnerPlainDataJson, PassIdpApiResult, PasswordChangeStatus, PasswordCheck, PasswordService, PermissionChoice, PersistService, Plan, Plan2Service, PlanService, PlanState, PlanStateField, ProfileDetailsService, ProfileService, QueryProcessorService, RecordAttachment, RecordAttachmentFilter, RecordAttachmentService, RecordContentFilter, RecordField, RecordFieldType, RecordFilter, RecordService, RecordType, RecordTypeField, RecordTypeFieldOption, RecordTypeService, RecordTypeSummary, RecoveryStatus, RegisterResult, RegisterService, RequestUserDeleteMutation, RespondOtkMutation, RevertFileQuery, ScenarioLastClaimState, ScenarioService, ScenarioState, ServerConfigService, ServerTimeQuery, SharedAccess, SharedContactCard2Service, StripeBillingPortalSession, StripeCheckoutSession, Subscription, TimeService, TpAssemblyState, TpClaimApproverState, TpClaimState, TpPasswordResetRequestService, TpPasswordResetService, TpPasswordResetUserService, TrustedParty2Service, TrustedPartyDetails, TwoFactorService, UnarchiveDirectoryMutation, UpdateCategoryMutation, UpdateContactCardMutation$1 as UpdateContactCardMutation, UpdateFileQuery, UpdateLbopQuery, UpdateRecordContainerMutation, UpdateRecordMutation, UpdatedCategory, UpdatedRecord, UserDeleteState, UserPlan, UserService, UserSharedKeyFields, Vault, VaultCategory, VaultFields, VaultRecord, VaultRecordType, WebCryptoService, awsFetch, configureAmplifyAuth, configureApollo, fragmentSpreadAstSelection, gqlTyped, handleApolloError, handleCognitoCallback, httpOptions, initialiseAuth, mapEdges, mapUserPlans, parentCategoriesField, processConnection, throwClaimIdMismatch, throwClaimNotApproved, ɵ0, KeyGraphService as ɵa, EncryptionService as ɵb, KeyService as ɵc, KeyFactoryService as ɵd, KeyMetaService as ɵe, LrGraphQLService as ɵf, TpPasswordResetProcessorService as ɵg, RunOutsideAngular as ɵh, TpPasswordResetAssemblyController as ɵi, TpAssemblyController as ɵj, LrService as ɵk, SharedContactCardService as ɵl, TrustedPartyService as ɵm, ScenarioAssemblyController as ɵn, TpPasswordResetPrivateService as ɵo };
13801
+ export { AccessLevel, AccessRoleChoice, AccessRoleMethodChoice, ApiContactCard, ApiCurrentUser, ArchiveDirectoryMutation, Auth2Service, auth2_types as AuthTypes, CancelUserDeleteMutation, Category, CategoryFields, CategoryFilter, CategoryMetaService, CategoryService, ClaimApproverState, ClaimState, CognitoChallengeUser, CommonProcessorsService, CompleteOtkMutation, Config, ContactCard2Service, ContactCardAddress, ContactCardName, CreateCategoryMutation, CreateContactCardMutation$1 as CreateContactCardMutation, CreateFileMutation, CreateFileQuery, CreateLbopQuery, CreateRecordContainerMutation, CreateRecordMutation, CreateVaultMutation, CurrentCategory, CurrentUser, CurrentUserKey, CurrentUserQuery, CurrentUserSharedKeyQuery, DEFAULT_BREADCRUMB_DEPTH, DEFAULT_DESCENDANTS_DEPTH, DefaultCategory, DefaultProcessorOptions, DefaultVaultFilter, DeleteCategoryMutation, DeleteFileMutation, DeleteLbopQuery, DeleteRecordMutation, DirectoryQuery, DirectoryType, ERROR_SOURCE, FeatureAction, Features, FetchKeyGraphField, FileOperationField, FileQuery, FileType, FileUploadService, GetCategoriesQuery, GetCategoryKeyIdQuery, GetCategoryQuery, GetMySharedCategoriesQuery, GetRecordQuery, GetRootDirectoryIdsQuery, GetTrustedPartyCategoriesQuery, GetVaultsQuery, IdleService, InitiateOtkMutation, Item2Service, KC_CONFIG, KcAuthException, KcBadArgumentException, KcBadLogicException, KcBadRequestException, KcBadSignatureException, KcBadStateException, KcBadTimeSyncException, KcCodeMismatchException, KcConcurrentAccessException, KcEncryptionException, KcError, KcErrorCode, KcException, KcInternalErrorException, KcLbopErrorCode, KcLockedException, KcNotFoundException, KcSuspiciousOperationException, KcUnsupportedException, KeyExchange2Service, KeyExchangeFields, KeyExchangeMode, KeyExchangeOtkState, KeyExchangeQuery, KeyExchangeService, KeyExchangeState, KeyExchangeTokenQuery, KeyExchangesQuery, KeyGraphField, KeyGraphFragment, LbopQuery, LbopService, LbopsQuery, LifeReadyAuthService, LifeReadyModule, LinkTypeField, LoadedCategoryTree, LockService, LockState, LoginHistoryQuery, LoginResult, LrApolloService, LrGraphQLService, LrMergedMutation, LrMutation, LrMutationBase, LrRecord, LrService, MainContactCard, MainContactCardFields, MainContactCardPlainFields, MainContactCardProperty, MessageService, MoveDirectoryQuery, MoveFileQuery, NewAttachment, NewCategory, NewOrUpdatedAttachment, NewRecord, NotificationService, OtkState, OwnerPlainDataJson, PassIdpApiResult, PasswordChangeStatus, PasswordCheck, PasswordService, PermissionChoice, PersistService, Plan, Plan2Service, PlanService, PlanState, PlanStateField, ProfileDetailsService, ProfileService, QueryProcessorService, RecordAttachment, RecordAttachmentFilter, RecordAttachmentService, RecordContentFilter, RecordField, RecordFieldType, RecordFilter, RecordService, RecordType, RecordTypeField, RecordTypeFieldOption, RecordTypeService, RecordTypeSummary, RecoveryStatus, RegisterService, RequestUserDeleteMutation, RespondOtkMutation, RevertFileQuery, ScenarioLastClaimState, ScenarioService, ScenarioState, ServerConfigService, ServerTimeQuery, SharedAccess, SharedContactCard2Service, StripeBillingPortalSession, StripeCheckoutSession, Subscription, TimeService, TpAssemblyState, TpClaimApproverState, TpClaimState, TpPasswordResetRequestService, TpPasswordResetService, TpPasswordResetUserService, TrustedParty2Service, TrustedPartyDetails, TwoFactorService, UnarchiveDirectoryMutation, UpdateCategoryMutation, UpdateContactCardMutation$1 as UpdateContactCardMutation, UpdateFileQuery, UpdateLbopQuery, UpdateRecordContainerMutation, UpdateRecordMutation, UpdatedCategory, UpdatedRecord, UserDeleteState, UserPlan, UserService, UserSharedKeyFields, Vault, VaultCategory, VaultFields, VaultRecord, VaultRecordType, WebCryptoService, awsFetch, configureAmplifyAuth, configureApollo, fragmentSpreadAstSelection, gqlTyped, handleApolloError, handleCognitoCallback, httpOptions, initialiseAuth, mapEdges, mapUserPlans, parentCategoriesField, processConnection, throwClaimIdMismatch, throwClaimNotApproved, ɵ0, KeyGraphService as ɵa, EncryptionService as ɵb, KeyService as ɵc, KeyFactoryService as ɵd, KeyMetaService as ɵe, LrGraphQLService as ɵf, TpPasswordResetProcessorService as ɵg, RunOutsideAngular as ɵh, TpPasswordResetAssemblyController as ɵi, TpAssemblyController as ɵj, LrService as ɵk, SharedContactCardService as ɵl, TrustedPartyService as ɵm, ScenarioAssemblyController as ɵn, TpPasswordResetPrivateService as ɵo };
13120
13802
  //# sourceMappingURL=lifeready-core.js.map