@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.
- package/bundles/lifeready-core.umd.js +1529 -737
- package/bundles/lifeready-core.umd.js.map +1 -1
- package/bundles/lifeready-core.umd.min.js +1 -1
- package/bundles/lifeready-core.umd.min.js.map +1 -1
- package/esm2015/lib/_common/key.js +28 -0
- package/esm2015/lib/_common/types.js +1 -1
- package/esm2015/lib/api/types/lr-graphql.types.js +1 -1
- package/esm2015/lib/auth/auth.types.js +1 -3
- package/esm2015/lib/auth/life-ready-auth.service.js +2 -2
- package/esm2015/lib/auth2/auth2.gql.private.js +78 -0
- package/esm2015/lib/auth2/auth2.service.js +596 -0
- package/esm2015/lib/auth2/auth2.types.js +21 -0
- package/esm2015/lib/contact-card/contact-card.service.js +3 -3
- package/esm2015/lib/contact-card/contact-card2.service.js +3 -3
- package/esm2015/lib/item2/item2.service.js +9 -9
- package/esm2015/lib/key/key-factory.service.js +1 -1
- package/esm2015/lib/key/key-graph.service.js +3 -3
- package/esm2015/lib/key/key-meta.service.js +2 -2
- package/esm2015/lib/key/key.service.js +7 -7
- package/esm2015/lib/key-exchange/key-exchange.service.js +24 -29
- package/esm2015/lib/key-exchange/key-exchange2.service.js +16 -17
- package/esm2015/lib/lbop/lbop.service.js +13 -14
- package/esm2015/lib/profile/profile.service.js +2 -2
- package/esm2015/lib/profile/profile.types.js +1 -1
- package/esm2015/lib/register/register.service.js +1 -1
- package/esm2015/lib/register/register.types.js +3 -0
- package/esm2015/lib/server-config/server-config.gql.js +1 -1
- package/esm2015/lib/shared-contact-card/shared-contact-card.service.js +3 -3
- package/esm2015/lib/shared-contact-card/shared-contact-card2.service.js +2 -2
- package/esm2015/lib/tp-assembly/tp-assembly.js +3 -3
- package/esm2015/lib/trusted-party/trusted-party2.service.js +4 -4
- package/esm2015/public-api.js +4 -1
- package/fesm2015/lifeready-core.js +885 -203
- package/fesm2015/lifeready-core.js.map +1 -1
- package/lib/_common/key.d.ts +14 -0
- package/lib/_common/types.d.ts +6 -0
- package/lib/api/types/lr-graphql.types.d.ts +1 -0
- package/lib/auth/auth.types.d.ts +0 -6
- package/lib/auth2/auth2.gql.private.d.ts +12 -0
- package/lib/auth2/auth2.service.d.ts +70 -0
- package/lib/auth2/auth2.types.d.ts +50 -0
- package/lib/item2/item2.service.d.ts +3 -3
- package/lib/key/key-factory.service.d.ts +1 -0
- package/lib/key/key-graph.service.d.ts +2 -3
- package/lib/key/key.service.d.ts +6 -6
- package/lib/key-exchange/key-exchange.service.d.ts +3 -5
- package/lib/lbop/lbop.service.d.ts +3 -3
- package/lib/profile/profile.types.d.ts +2 -2
- package/lib/register/register.service.d.ts +1 -1
- package/lib/register/register.types.d.ts +6 -0
- package/lib/server-config/server-config.gql.d.ts +1 -1
- package/lib/server-config/server-config.service.d.ts +1 -1
- package/lib/shared-contact-card/shared-contact-card.service.d.ts +2 -2
- package/lifeready-core.metadata.json +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +3 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('apollo-angular'), require('@dagrejs/graphlib'), require('lodash'), require('node-jose'), require('@aws-amplify/auth/lib-esm/Auth'), require('graphql-tag'), require('moment'), require('@apollo/client/core'), require('@apollo/client/link/context'), require('@apollo/client/link/retry'), require('ngx-cookie-service'), require('graphql/language/printer'), require('@aws-amplify/auth'), require('@angular/common/http'), require('@aws-amplify/core'), require('rxjs'), require('@ng-idle/core'), require('@ng-idle/keepalive'), require('slip39')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define('@lifeready/core', ['exports', '@angular/core', 'apollo-angular', '@dagrejs/graphlib', 'lodash', 'node-jose', '@aws-amplify/auth/lib-esm/Auth', 'graphql-tag', 'moment', '@apollo/client/core', '@apollo/client/link/context', '@apollo/client/link/retry', 'ngx-cookie-service', 'graphql/language/printer', '@aws-amplify/auth', '@angular/common/http', '@aws-amplify/core', 'rxjs', '@ng-idle/core', '@ng-idle/keepalive', 'slip39'], factory) :
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.lifeready = global.lifeready || {}, global.lifeready.core = {}), global.ng.core, global['apollo-angular'], global['@dagrejs/graphlib'], global.lodash, global['node-jose'], global['@aws-amplify/auth/lib-esm/Auth'], global['graphql-tag'], global.moment, global['@apollo/client/core'], global['@apollo/client/link/context'], global['@apollo/client/link/retry'], global['ngx-cookie-service'], global['graphql/language/printer'], global['@aws-amplify/auth'], global.ng.common.http, global['@aws-amplify/core'], global.rxjs, global['@ng-idle/core'], global['@ng-idle/keepalive'], global.slip39));
|
|
5
|
-
}(this, (function (exports, i0, i1, graphlib, _, nodeJose,
|
|
5
|
+
}(this, (function (exports, i0, i1, graphlib, _, nodeJose, i2, gql, moment_, core, context, retry, i2$1, gqlPrinter, Auth, i2$2, core$1, rxjs, i3, i4, slip39) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -788,14 +788,14 @@
|
|
|
788
788
|
};
|
|
789
789
|
return TimeService;
|
|
790
790
|
}());
|
|
791
|
-
TimeService.ɵprov = i0.ɵɵdefineInjectable({ factory: function TimeService_Factory() { return new TimeService(i0.ɵɵinject(
|
|
791
|
+
TimeService.ɵprov = i0.ɵɵdefineInjectable({ factory: function TimeService_Factory() { return new TimeService(i0.ɵɵinject(i2.AuthClass), i0.ɵɵinject(i1.Apollo)); }, token: TimeService, providedIn: "root" });
|
|
792
792
|
TimeService.decorators = [
|
|
793
793
|
{ type: i0.Injectable, args: [{
|
|
794
794
|
providedIn: 'root',
|
|
795
795
|
},] }
|
|
796
796
|
];
|
|
797
797
|
TimeService.ctorParameters = function () { return [
|
|
798
|
-
{ type:
|
|
798
|
+
{ type: i2.AuthClass },
|
|
799
799
|
{ type: i1.Apollo }
|
|
800
800
|
]; };
|
|
801
801
|
var templateObject_1;
|
|
@@ -1670,7 +1670,7 @@
|
|
|
1670
1670
|
};
|
|
1671
1671
|
return PersistService;
|
|
1672
1672
|
}());
|
|
1673
|
-
PersistService.ɵprov = i0.ɵɵdefineInjectable({ factory: function PersistService_Factory() { return new PersistService(i0.ɵɵinject(KeyFactoryService), i0.ɵɵinject(i2.CookieService), i0.ɵɵinject(EncryptionService), i0.ɵɵinject(i0.INJECTOR)); }, token: PersistService, providedIn: "root" });
|
|
1673
|
+
PersistService.ɵprov = i0.ɵɵdefineInjectable({ factory: function PersistService_Factory() { return new PersistService(i0.ɵɵinject(KeyFactoryService), i0.ɵɵinject(i2$1.CookieService), i0.ɵɵinject(EncryptionService), i0.ɵɵinject(i0.INJECTOR)); }, token: PersistService, providedIn: "root" });
|
|
1674
1674
|
PersistService.decorators = [
|
|
1675
1675
|
{ type: i0.Injectable, args: [{
|
|
1676
1676
|
providedIn: 'root',
|
|
@@ -1678,7 +1678,7 @@
|
|
|
1678
1678
|
];
|
|
1679
1679
|
PersistService.ctorParameters = function () { return [
|
|
1680
1680
|
{ type: KeyFactoryService },
|
|
1681
|
-
{ type: i2.CookieService },
|
|
1681
|
+
{ type: i2$1.CookieService },
|
|
1682
1682
|
{ type: EncryptionService },
|
|
1683
1683
|
{ type: i0.Injector }
|
|
1684
1684
|
]; };
|
|
@@ -1715,24 +1715,44 @@
|
|
|
1715
1715
|
this.resetKeys();
|
|
1716
1716
|
this.persistService.clear();
|
|
1717
1717
|
};
|
|
1718
|
-
KeyService.prototype.
|
|
1718
|
+
KeyService.prototype.setKeys = function (keys) {
|
|
1719
1719
|
this.keys = keys;
|
|
1720
1720
|
};
|
|
1721
|
-
KeyService.prototype
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1721
|
+
Object.defineProperty(KeyService.prototype, "currentPassKey", {
|
|
1722
|
+
get: function () {
|
|
1723
|
+
return this.keys.passKey;
|
|
1724
|
+
},
|
|
1725
|
+
enumerable: false,
|
|
1726
|
+
configurable: true
|
|
1727
|
+
});
|
|
1728
|
+
Object.defineProperty(KeyService.prototype, "currentMasterKey", {
|
|
1729
|
+
get: function () {
|
|
1730
|
+
return this.keys.masterKey;
|
|
1731
|
+
},
|
|
1732
|
+
enumerable: false,
|
|
1733
|
+
configurable: true
|
|
1734
|
+
});
|
|
1735
|
+
Object.defineProperty(KeyService.prototype, "currentRootKey", {
|
|
1736
|
+
get: function () {
|
|
1737
|
+
return this.keys.rootKey;
|
|
1738
|
+
},
|
|
1739
|
+
enumerable: false,
|
|
1740
|
+
configurable: true
|
|
1741
|
+
});
|
|
1742
|
+
Object.defineProperty(KeyService.prototype, "currentPxk", {
|
|
1743
|
+
get: function () {
|
|
1744
|
+
return this.keys.pxk;
|
|
1745
|
+
},
|
|
1746
|
+
enumerable: false,
|
|
1747
|
+
configurable: true
|
|
1748
|
+
});
|
|
1749
|
+
Object.defineProperty(KeyService.prototype, "currentSigPxk", {
|
|
1750
|
+
get: function () {
|
|
1751
|
+
return this.keys.sigPxk;
|
|
1752
|
+
},
|
|
1753
|
+
enumerable: false,
|
|
1754
|
+
configurable: true
|
|
1755
|
+
});
|
|
1736
1756
|
KeyService.prototype.expiresAfter = function (seconds) {
|
|
1737
1757
|
return new Date(Date.now() + 1000 * seconds);
|
|
1738
1758
|
};
|
|
@@ -1864,7 +1884,7 @@
|
|
|
1864
1884
|
return __generator(this, function (_d) {
|
|
1865
1885
|
switch (_d.label) {
|
|
1866
1886
|
case 0:
|
|
1867
|
-
_b = (_a = this.keyService).
|
|
1887
|
+
_b = (_a = this.keyService).setKeys;
|
|
1868
1888
|
_c = {
|
|
1869
1889
|
passKey: userKey.passKey
|
|
1870
1890
|
};
|
|
@@ -2049,7 +2069,7 @@
|
|
|
2049
2069
|
return [2 /*return*/, key];
|
|
2050
2070
|
}
|
|
2051
2071
|
else {
|
|
2052
|
-
return [2 /*return*/, this.unwrapKey(this.keyService.
|
|
2072
|
+
return [2 /*return*/, this.unwrapKey(this.keyService.currentMasterKey.id, keyId)];
|
|
2053
2073
|
}
|
|
2054
2074
|
return [2 /*return*/];
|
|
2055
2075
|
}
|
|
@@ -3889,11 +3909,6 @@
|
|
|
3889
3909
|
}
|
|
3890
3910
|
return LoginResult;
|
|
3891
3911
|
}());
|
|
3892
|
-
var RegisterResult = /** @class */ (function () {
|
|
3893
|
-
function RegisterResult() {
|
|
3894
|
-
}
|
|
3895
|
-
return RegisterResult;
|
|
3896
|
-
}());
|
|
3897
3912
|
(function (RecoveryStatus) {
|
|
3898
3913
|
RecoveryStatus["NONE"] = "none";
|
|
3899
3914
|
RecoveryStatus["NEW_PASSWORD"] = "new-password";
|
|
@@ -4094,7 +4109,7 @@
|
|
|
4094
4109
|
};
|
|
4095
4110
|
return IdleService;
|
|
4096
4111
|
}());
|
|
4097
|
-
IdleService.ɵprov = i0.ɵɵdefineInjectable({ factory: function IdleService_Factory() { return new IdleService(i0.ɵɵinject(KC_CONFIG), i0.ɵɵinject(i2$
|
|
4112
|
+
IdleService.ɵprov = i0.ɵɵdefineInjectable({ factory: function IdleService_Factory() { return new IdleService(i0.ɵɵinject(KC_CONFIG), i0.ɵɵinject(i2$2.HttpClient), i0.ɵɵinject(i3.Idle), i0.ɵɵinject(i4.Keepalive), i0.ɵɵinject(KeyService), i0.ɵɵinject(i2.AuthClass)); }, token: IdleService, providedIn: "root" });
|
|
4098
4113
|
IdleService.decorators = [
|
|
4099
4114
|
{ type: i0.Injectable, args: [{
|
|
4100
4115
|
providedIn: 'root',
|
|
@@ -4102,11 +4117,11 @@
|
|
|
4102
4117
|
];
|
|
4103
4118
|
IdleService.ctorParameters = function () { return [
|
|
4104
4119
|
{ type: undefined, decorators: [{ type: i0.Inject, args: [KC_CONFIG,] }] },
|
|
4105
|
-
{ type: i2$
|
|
4120
|
+
{ type: i2$2.HttpClient },
|
|
4106
4121
|
{ type: i3.Idle },
|
|
4107
|
-
{ type: i4
|
|
4122
|
+
{ type: i4.Keepalive },
|
|
4108
4123
|
{ type: KeyService },
|
|
4109
|
-
{ type:
|
|
4124
|
+
{ type: i2.AuthClass }
|
|
4110
4125
|
]; };
|
|
4111
4126
|
|
|
4112
4127
|
var ContactCardFields = "\nid\npublicData\npublicSearchable\ncipherData\nkey {\n id\n}\n";
|
|
@@ -4378,7 +4393,7 @@
|
|
|
4378
4393
|
wrappedKeys = _g.sent();
|
|
4379
4394
|
return [3 /*break*/, 5];
|
|
4380
4395
|
case 3:
|
|
4381
|
-
rootKey = this.keyService.
|
|
4396
|
+
rootKey = this.keyService.currentRootKey;
|
|
4382
4397
|
_b = (_a = JSON).stringify;
|
|
4383
4398
|
return [4 /*yield*/, this.encryptionService.encrypt(rootKey.jwk, key.toJSON(true))];
|
|
4384
4399
|
case 4:
|
|
@@ -4874,16 +4889,15 @@
|
|
|
4874
4889
|
var sigPxk, publicDataSig, _a, _b, publicSearchableSig, _c, _d, plainDataJson, plainDataSig, _e, _f;
|
|
4875
4890
|
return __generator(this, function (_g) {
|
|
4876
4891
|
switch (_g.label) {
|
|
4877
|
-
case 0:
|
|
4878
|
-
|
|
4879
|
-
sigPxk = _g.sent();
|
|
4892
|
+
case 0:
|
|
4893
|
+
sigPxk = this.keyService.currentSigPxk;
|
|
4880
4894
|
_b = (_a = JSON).stringify;
|
|
4881
4895
|
return [4 /*yield*/, this.encryptionService.sign(sigPxk.jwk, '')];
|
|
4882
|
-
case
|
|
4896
|
+
case 1:
|
|
4883
4897
|
publicDataSig = _b.apply(_a, [_g.sent()]);
|
|
4884
4898
|
_d = (_c = JSON).stringify;
|
|
4885
4899
|
return [4 /*yield*/, this.encryptionService.sign(sigPxk.jwk, '')];
|
|
4886
|
-
case
|
|
4900
|
+
case 2:
|
|
4887
4901
|
publicSearchableSig = _d.apply(_c, [_g.sent()]);
|
|
4888
4902
|
plainDataJson = {
|
|
4889
4903
|
// contactCard.name.value may have additional attributes such as the id of the contact card.
|
|
@@ -4892,7 +4906,7 @@
|
|
|
4892
4906
|
};
|
|
4893
4907
|
_f = (_e = JSON).stringify;
|
|
4894
4908
|
return [4 /*yield*/, this.encryptionService.sign(sigPxk.jwk, plainDataJson)];
|
|
4895
|
-
case
|
|
4909
|
+
case 3:
|
|
4896
4910
|
plainDataSig = _f.apply(_e, [_g.sent()]);
|
|
4897
4911
|
return [2 /*return*/, {
|
|
4898
4912
|
sigPxkId: sigPxk.id,
|
|
@@ -5026,7 +5040,7 @@
|
|
|
5026
5040
|
};
|
|
5027
5041
|
return ProfileService;
|
|
5028
5042
|
}());
|
|
5029
|
-
ProfileService.ɵprov = i0.ɵɵdefineInjectable({ factory: function ProfileService_Factory() { return new ProfileService(i0.ɵɵinject(KC_CONFIG), i0.ɵɵinject(i2$
|
|
5043
|
+
ProfileService.ɵprov = i0.ɵɵdefineInjectable({ factory: function ProfileService_Factory() { return new ProfileService(i0.ɵɵinject(KC_CONFIG), i0.ɵɵinject(i2$2.HttpClient), i0.ɵɵinject(LrApolloService), i0.ɵɵinject(KeyService), i0.ɵɵinject(KeyMetaService), i0.ɵɵinject(KeyGraphService), i0.ɵɵinject(EncryptionService)); }, token: ProfileService, providedIn: "root" });
|
|
5030
5044
|
ProfileService.decorators = [
|
|
5031
5045
|
{ type: i0.Injectable, args: [{
|
|
5032
5046
|
providedIn: 'root',
|
|
@@ -5034,7 +5048,7 @@
|
|
|
5034
5048
|
];
|
|
5035
5049
|
ProfileService.ctorParameters = function () { return [
|
|
5036
5050
|
{ type: undefined, decorators: [{ type: i0.Inject, args: [KC_CONFIG,] }] },
|
|
5037
|
-
{ type: i2$
|
|
5051
|
+
{ type: i2$2.HttpClient },
|
|
5038
5052
|
{ type: LrApolloService },
|
|
5039
5053
|
{ type: KeyService },
|
|
5040
5054
|
{ type: KeyMetaService },
|
|
@@ -5426,7 +5440,7 @@
|
|
|
5426
5440
|
};
|
|
5427
5441
|
return PasswordService;
|
|
5428
5442
|
}());
|
|
5429
|
-
PasswordService.ɵprov = i0.ɵɵdefineInjectable({ factory: function PasswordService_Factory() { return new PasswordService(i0.ɵɵinject(KC_CONFIG), i0.ɵɵinject(i2$
|
|
5443
|
+
PasswordService.ɵprov = i0.ɵɵdefineInjectable({ factory: function PasswordService_Factory() { return new PasswordService(i0.ɵɵinject(KC_CONFIG), i0.ɵɵinject(i2$2.HttpClient), i0.ɵɵinject(LrApolloService), i0.ɵɵinject(i2.AuthClass), i0.ɵɵinject(ProfileService), i0.ɵɵinject(KeyFactoryService), i0.ɵɵinject(EncryptionService), i0.ɵɵinject(KeyGraphService), i0.ɵɵinject(WebCryptoService)); }, token: PasswordService, providedIn: "root" });
|
|
5430
5444
|
PasswordService.decorators = [
|
|
5431
5445
|
{ type: i0.Injectable, args: [{
|
|
5432
5446
|
providedIn: 'root',
|
|
@@ -5434,9 +5448,9 @@
|
|
|
5434
5448
|
];
|
|
5435
5449
|
PasswordService.ctorParameters = function () { return [
|
|
5436
5450
|
{ type: undefined, decorators: [{ type: i0.Inject, args: [KC_CONFIG,] }] },
|
|
5437
|
-
{ type: i2$
|
|
5451
|
+
{ type: i2$2.HttpClient },
|
|
5438
5452
|
{ type: LrApolloService },
|
|
5439
|
-
{ type:
|
|
5453
|
+
{ type: i2.AuthClass },
|
|
5440
5454
|
{ type: ProfileService },
|
|
5441
5455
|
{ type: KeyFactoryService },
|
|
5442
5456
|
{ type: EncryptionService },
|
|
@@ -5899,23 +5913,22 @@
|
|
|
5899
5913
|
var rootKey, subjectKey, rootKeyWrappedSubjectKey, _a, assemblyKey, rawAssemblyKey, assemblyKeyParams, assemblyInput, slipAssembly, tpIds, tps, _c, createSubAssemblies, subjectCipherData;
|
|
5900
5914
|
return __generator(this, function (_d) {
|
|
5901
5915
|
switch (_d.label) {
|
|
5902
|
-
case 0:
|
|
5903
|
-
|
|
5904
|
-
rootKey = _d.sent();
|
|
5916
|
+
case 0:
|
|
5917
|
+
rootKey = this.keyService.currentRootKey;
|
|
5905
5918
|
return [4 /*yield*/, this.keyFactory.createKey()];
|
|
5906
|
-
case
|
|
5919
|
+
case 1:
|
|
5907
5920
|
subjectKey = _d.sent();
|
|
5908
5921
|
return [4 /*yield*/, this.keyGraph.wrapKey(rootKey, subjectKey)];
|
|
5909
|
-
case
|
|
5922
|
+
case 2:
|
|
5910
5923
|
rootKeyWrappedSubjectKey = _d.sent();
|
|
5911
5924
|
return [4 /*yield*/, this.prepareAssembly({
|
|
5912
5925
|
rootKey: rootKey.jwk,
|
|
5913
5926
|
subjectKey: subjectKey,
|
|
5914
5927
|
})];
|
|
5915
|
-
case
|
|
5928
|
+
case 3:
|
|
5916
5929
|
_a = _d.sent(), assemblyKey = _a.assemblyKey, rawAssemblyKey = _a.rawAssemblyKey, assemblyKeyParams = _a.assemblyKeyParams, assemblyInput = __rest(_a, ["assemblyKey", "rawAssemblyKey", "assemblyKeyParams"]);
|
|
5917
5930
|
return [4 /*yield*/, this.prepareSlip39(input.createSubAssemblies, input.quorum, rawAssemblyKey)];
|
|
5918
|
-
case
|
|
5931
|
+
case 4:
|
|
5919
5932
|
slipAssembly = _d.sent();
|
|
5920
5933
|
tpIds = this.getInputApprovers(input.createSubAssemblies);
|
|
5921
5934
|
_c = mapEdges;
|
|
@@ -5925,7 +5938,7 @@
|
|
|
5925
5938
|
ids: tpIds,
|
|
5926
5939
|
},
|
|
5927
5940
|
})];
|
|
5928
|
-
case
|
|
5941
|
+
case 5:
|
|
5929
5942
|
tps = _c.apply(void 0, [(_d.sent()).tps]);
|
|
5930
5943
|
// Fill in wrappingKeyId if not present
|
|
5931
5944
|
this.fillWrappingKeyId(input.createSubAssemblies, tps);
|
|
@@ -5935,10 +5948,10 @@
|
|
|
5935
5948
|
slipSubAssemblies: slipAssembly.subAssemblies,
|
|
5936
5949
|
subjectKey: subjectKey,
|
|
5937
5950
|
})];
|
|
5938
|
-
case
|
|
5951
|
+
case 6:
|
|
5939
5952
|
createSubAssemblies = _d.sent();
|
|
5940
5953
|
return [4 /*yield*/, this.encryptionService.encryptToString(subjectKey, input.subjectCipherDataClearJson || '')];
|
|
5941
|
-
case
|
|
5954
|
+
case 7:
|
|
5942
5955
|
subjectCipherData = _d.sent();
|
|
5943
5956
|
return [2 /*return*/, {
|
|
5944
5957
|
assemblyKey: assemblyKey,
|
|
@@ -5975,17 +5988,15 @@
|
|
|
5975
5988
|
deleteSubAssembliesInput.length === 0) {
|
|
5976
5989
|
throw new KcBadArgumentException('Must specify at least one of: [createSubAssemblies, updateSubAssemblies, deleteSubAssemblies]');
|
|
5977
5990
|
}
|
|
5978
|
-
|
|
5979
|
-
case 1:
|
|
5980
|
-
rootKey = _d.sent();
|
|
5991
|
+
rootKey = this.keyService.currentRootKey;
|
|
5981
5992
|
return [4 /*yield*/, this.keyGraph.getKey(assembly.subjectKey.id)];
|
|
5982
|
-
case
|
|
5993
|
+
case 1:
|
|
5983
5994
|
subjectKey = _d.sent();
|
|
5984
5995
|
return [4 /*yield*/, this.prepareAssembly({
|
|
5985
5996
|
rootKey: rootKey.jwk,
|
|
5986
5997
|
subjectKey: subjectKey.jwk,
|
|
5987
5998
|
})];
|
|
5988
|
-
case
|
|
5999
|
+
case 2:
|
|
5989
6000
|
_b = _d.sent(), assemblyKey = _b.assemblyKey, rawAssemblyKey = _b.rawAssemblyKey, assemblyKeyParams = _b.assemblyKeyParams, assemblyInput = __rest(_b, ["assemblyKey", "rawAssemblyKey", "assemblyKeyParams"]);
|
|
5990
6001
|
tpIds = this.getAssemblyApprovers(assembly).concat(this.getInputApprovers(createSubAssembliesInput), this.getInputApprovers(updateSubAssembliesInput));
|
|
5991
6002
|
_c = mapEdges;
|
|
@@ -5995,7 +6006,7 @@
|
|
|
5995
6006
|
ids: tpIds,
|
|
5996
6007
|
},
|
|
5997
6008
|
})];
|
|
5998
|
-
case
|
|
6009
|
+
case 3:
|
|
5999
6010
|
tps = _c.apply(void 0, [(_d.sent()).tps]);
|
|
6000
6011
|
// Auto fill the updateSubAssemblies with existing sub assemblies if they are not
|
|
6001
6012
|
// explicitly deleted.
|
|
@@ -6026,19 +6037,19 @@
|
|
|
6026
6037
|
// Fill in wrappingKeyId if not present
|
|
6027
6038
|
this.fillWrappingKeyId(createSubAssembliesInput, tps);
|
|
6028
6039
|
this.fillWrappingKeyId(updateSubAssembliesInput, tps);
|
|
6029
|
-
_d.label =
|
|
6030
|
-
case
|
|
6031
|
-
_d.trys.push([
|
|
6040
|
+
_d.label = 4;
|
|
6041
|
+
case 4:
|
|
6042
|
+
_d.trys.push([4, 6, , 7]);
|
|
6032
6043
|
return [4 /*yield*/, this.prepareSlip39((createSubAssembliesInput || []).concat(updateSubAssembliesInput || []), input.quorum, rawAssemblyKey)];
|
|
6033
|
-
case
|
|
6044
|
+
case 5:
|
|
6034
6045
|
slipAssembly = _d.sent();
|
|
6035
|
-
return [3 /*break*/,
|
|
6036
|
-
case
|
|
6046
|
+
return [3 /*break*/, 7];
|
|
6047
|
+
case 6:
|
|
6037
6048
|
error_1 = _d.sent();
|
|
6038
6049
|
// TODO this sometimes happens. Maybe missing await.
|
|
6039
6050
|
console.log('Error while creating slip assembly', error_1);
|
|
6040
|
-
return [3 /*break*/,
|
|
6041
|
-
case
|
|
6051
|
+
return [3 /*break*/, 7];
|
|
6052
|
+
case 7:
|
|
6042
6053
|
common = {
|
|
6043
6054
|
assemblyKeyParams: assemblyKeyParams,
|
|
6044
6055
|
subjectKey: subjectKey.jwk,
|
|
@@ -6046,15 +6057,15 @@
|
|
|
6046
6057
|
return [4 /*yield*/, this.prepareCreateSubAssemblies(Object.assign(Object.assign({}, common), { input: createSubAssembliesInput,
|
|
6047
6058
|
// Need to match the slip sub assemblies to the input
|
|
6048
6059
|
slipSubAssemblies: slipAssembly.subAssemblies.slice(0, createSubAssembliesInput.length) }))];
|
|
6049
|
-
case
|
|
6060
|
+
case 8:
|
|
6050
6061
|
createSubAssemblies = _d.sent();
|
|
6051
6062
|
return [4 /*yield*/, this.prepareUpdateSubAssemblies(Object.assign(Object.assign({}, common), { input: updateSubAssembliesInput,
|
|
6052
6063
|
// Add an offset to the sub assemblies to skip the one that are created.
|
|
6053
6064
|
slipSubAssemblies: slipAssembly.subAssemblies.slice(createSubAssembliesInput.length), subAssemblies: assembly.subAssemblies }))];
|
|
6054
|
-
case
|
|
6065
|
+
case 9:
|
|
6055
6066
|
updateSubAssemblies = _d.sent();
|
|
6056
6067
|
return [4 /*yield*/, this.encryptionService.encryptToString(subjectKey.jwk, (_a = input.subjectCipherDataClearJson) !== null && _a !== void 0 ? _a : assembly.subjectCipherDataClearJson)];
|
|
6057
|
-
case
|
|
6068
|
+
case 10:
|
|
6058
6069
|
subjectCipherData = _d.sent();
|
|
6059
6070
|
return [2 /*return*/, {
|
|
6060
6071
|
assemblyKey: assemblyKey,
|
|
@@ -6782,7 +6793,7 @@
|
|
|
6782
6793
|
_o.sent();
|
|
6783
6794
|
_o.label = 7;
|
|
6784
6795
|
case 7:
|
|
6785
|
-
this.keyService.
|
|
6796
|
+
this.keyService.setKeys({
|
|
6786
6797
|
passKey: {
|
|
6787
6798
|
id: resetUser.passKey.id,
|
|
6788
6799
|
},
|
|
@@ -6964,7 +6975,7 @@
|
|
|
6964
6975
|
};
|
|
6965
6976
|
return LifeReadyAuthService;
|
|
6966
6977
|
}());
|
|
6967
|
-
LifeReadyAuthService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LifeReadyAuthService_Factory() { return new LifeReadyAuthService(i0.ɵɵinject(KC_CONFIG), i0.ɵɵinject(
|
|
6978
|
+
LifeReadyAuthService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LifeReadyAuthService_Factory() { return new LifeReadyAuthService(i0.ɵɵinject(KC_CONFIG), i0.ɵɵinject(i2.AuthClass), i0.ɵɵinject(KeyFactoryService), i0.ɵɵinject(KeyService), i0.ɵɵinject(ProfileService), i0.ɵɵinject(KeyGraphService), i0.ɵɵinject(PasswordService), i0.ɵɵinject(IdleService), i0.ɵɵinject(exports.ɵf), i0.ɵɵinject(exports.ɵg), i0.ɵɵinject(PersistService), i0.ɵɵinject(EncryptionService), i0.ɵɵinject(exports.ɵi), i0.ɵɵinject(i2$2.HttpClient)); }, token: LifeReadyAuthService, providedIn: "root" });
|
|
6968
6979
|
LifeReadyAuthService.decorators = [
|
|
6969
6980
|
{ type: i0.Injectable, args: [{
|
|
6970
6981
|
providedIn: 'root',
|
|
@@ -6972,7 +6983,7 @@
|
|
|
6972
6983
|
];
|
|
6973
6984
|
LifeReadyAuthService.ctorParameters = function () { return [
|
|
6974
6985
|
{ type: undefined, decorators: [{ type: i0.Inject, args: [KC_CONFIG,] }] },
|
|
6975
|
-
{ type:
|
|
6986
|
+
{ type: i2.AuthClass },
|
|
6976
6987
|
{ type: KeyFactoryService },
|
|
6977
6988
|
{ type: KeyService },
|
|
6978
6989
|
{ type: ProfileService },
|
|
@@ -6984,140 +6995,995 @@
|
|
|
6984
6995
|
{ type: PersistService },
|
|
6985
6996
|
{ type: EncryptionService },
|
|
6986
6997
|
{ type: exports.ɵi },
|
|
6987
|
-
{ type: i2$
|
|
6998
|
+
{ type: i2$2.HttpClient }
|
|
6988
6999
|
]; };
|
|
6989
7000
|
|
|
6990
|
-
(function (
|
|
6991
|
-
|
|
6992
|
-
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
],
|
|
7002
|
-
});
|
|
7003
|
-
var RecordAttachmentFilter = JSON.stringify({
|
|
7004
|
-
filter: [
|
|
7005
|
-
{
|
|
7006
|
-
contains: {
|
|
7007
|
-
fileType: exports.FileType.RecordAttachment,
|
|
7008
|
-
},
|
|
7001
|
+
var KeyContainer = /** @class */ (function () {
|
|
7002
|
+
function KeyContainer(_key, timeout) {
|
|
7003
|
+
var _this = this;
|
|
7004
|
+
this._key = _key;
|
|
7005
|
+
this.timer = setTimeout(function () {
|
|
7006
|
+
_this._key = null;
|
|
7007
|
+
}, timeout);
|
|
7008
|
+
}
|
|
7009
|
+
Object.defineProperty(KeyContainer.prototype, "key", {
|
|
7010
|
+
get: function () {
|
|
7011
|
+
return this._key;
|
|
7009
7012
|
},
|
|
7010
|
-
|
|
7013
|
+
enumerable: false,
|
|
7014
|
+
configurable: true
|
|
7015
|
+
});
|
|
7016
|
+
/**
|
|
7017
|
+
* Clears the reference to the key, clears the timer, return the key.
|
|
7018
|
+
* It's important to call this function when the key is no longer needed because
|
|
7019
|
+
* the anonymous function in setTimeout() holds a reference to "this", and hence
|
|
7020
|
+
* keeps the "this._key" reference until the timer expired. So if we have used
|
|
7021
|
+
* the key before it expired, we should clear the "this._key" reference immediately.
|
|
7022
|
+
*/
|
|
7023
|
+
KeyContainer.prototype.pop = function () {
|
|
7024
|
+
var ret = this._key;
|
|
7025
|
+
this._key = null;
|
|
7026
|
+
if (this.timer) {
|
|
7027
|
+
clearTimeout(this.timer);
|
|
7028
|
+
this.timer = null;
|
|
7029
|
+
}
|
|
7030
|
+
return ret;
|
|
7031
|
+
};
|
|
7032
|
+
return KeyContainer;
|
|
7033
|
+
}());
|
|
7034
|
+
|
|
7035
|
+
var CurrentUserQuery$1 = gqlTyped(templateObject_1$d || (templateObject_1$d = __makeTemplateObject(["\nquery {\n currentUser {\n id\n username\n currentUserKey {\n passKey {\n id\n passKeyParams\n passIdpParams\n wrappedPassIdpVerifierPrk\n created\n }\n masterKey {\n id\n }\n rootKey {\n id\n }\n pxk {\n id\n }\n sigPxk {\n id\n }\n }\n sessionEncryptionKey\n }\n keyGraph {\n ...KeyGraphFragment\n }\n}\n", "\n"], ["\nquery {\n currentUser {\n id\n username\n currentUserKey {\n passKey {\n id\n passKeyParams\n passIdpParams\n wrappedPassIdpVerifierPrk\n created\n }\n masterKey {\n id\n }\n rootKey {\n id\n }\n pxk {\n id\n }\n sigPxk {\n id\n }\n }\n sessionEncryptionKey\n }\n keyGraph {\n ...KeyGraphFragment\n }\n}\n", "\n"])), KeyGraphFragment);
|
|
7036
|
+
var ResetUserQuery = gqlTyped(templateObject_2$a || (templateObject_2$a = __makeTemplateObject(["\nquery ResetUserQuery {\n tpPasswordResetUser {\n username\n sessionEncryptionKey\n state\n passKey {\n id\n passKeyParams\n passIdpParams\n }\n masterKey {\n id\n }\n pxk {\n id\n }\n assembly {\n singleReject\n quorum\n subAssemblies {\n singleReject\n quorum\n approvers {\n name\n email\n state\n }\n }\n }\n approvals {\n id\n modified\n approverEmail\n receiverCipher\n receiverCipherPartialAssemblyKey\n }\n assemblyCipherData\n wrappedAssemblyKeyVerifierPrk\n }\n}"], ["\nquery ResetUserQuery {\n tpPasswordResetUser {\n username\n sessionEncryptionKey\n state\n passKey {\n id\n passKeyParams\n passIdpParams\n }\n masterKey {\n id\n }\n pxk {\n id\n }\n assembly {\n singleReject\n quorum\n subAssemblies {\n singleReject\n quorum\n approvers {\n name\n email\n state\n }\n }\n }\n approvals {\n id\n modified\n approverEmail\n receiverCipher\n receiverCipherPartialAssemblyKey\n }\n assemblyCipherData\n wrappedAssemblyKeyVerifierPrk\n }\n}"])));
|
|
7037
|
+
var templateObject_1$d, templateObject_2$a;
|
|
7038
|
+
|
|
7039
|
+
var RecoveryStatus;
|
|
7040
|
+
(function (RecoveryStatus) {
|
|
7041
|
+
RecoveryStatus["NONE"] = "NONE";
|
|
7042
|
+
RecoveryStatus["NEW_PASSWORD"] = "NEW_PASSWORD";
|
|
7043
|
+
RecoveryStatus["OLD_PASSWORD"] = "OLD_PASSWORD";
|
|
7044
|
+
})(RecoveryStatus || (RecoveryStatus = {}));
|
|
7045
|
+
// TODO restrict this type
|
|
7046
|
+
// export type AuthResetUser = TpPasswordResetUserNode;
|
|
7047
|
+
var PasswordChangeStatus;
|
|
7048
|
+
(function (PasswordChangeStatus) {
|
|
7049
|
+
PasswordChangeStatus["IN_PROGRESS"] = "IN_PROGRESS";
|
|
7050
|
+
PasswordChangeStatus["RECOVERY"] = "RECOVERY";
|
|
7051
|
+
})(PasswordChangeStatus || (PasswordChangeStatus = {}));
|
|
7052
|
+
var CognitoChallengeName;
|
|
7053
|
+
(function (CognitoChallengeName) {
|
|
7054
|
+
CognitoChallengeName["NEW_PASSWORD_REQUIRED"] = "NEW_PASSWORD_REQUIRED";
|
|
7055
|
+
CognitoChallengeName["SMS_MFA"] = "SMS_MFA";
|
|
7056
|
+
CognitoChallengeName["SOFTWARE_TOKEN_MFA"] = "SOFTWARE_TOKEN_MFA";
|
|
7057
|
+
CognitoChallengeName["MFA_SETUP"] = "MFA_SETUP";
|
|
7058
|
+
})(CognitoChallengeName || (CognitoChallengeName = {}));
|
|
7059
|
+
|
|
7060
|
+
var auth2_types = /*#__PURE__*/Object.freeze({
|
|
7061
|
+
__proto__: null,
|
|
7062
|
+
get RecoveryStatus () { return RecoveryStatus; },
|
|
7063
|
+
get PasswordChangeStatus () { return PasswordChangeStatus; },
|
|
7064
|
+
get CognitoChallengeName () { return CognitoChallengeName; }
|
|
7011
7065
|
});
|
|
7012
|
-
var GetRecordQuery = function (depth) {
|
|
7013
|
-
if (depth === void 0) { depth = DEFAULT_BREADCRUMB_DEPTH; }
|
|
7014
|
-
return gql__default['default'](templateObject_1$d || (templateObject_1$d = __makeTemplateObject(["\nquery Record(\n $id: LrRelayIdInput!,\n $cachedKeyIds: [LrRelayIdInput!],\n $categoryFilter: LrJSONFilter,\n $contentFilter: LrJSONFilter,\n $attachmentsFilter: LrJSONFilter,\n) {\n record: directory(id: $id) {\n id\n keyId\n archived\n plainMeta\n cipherMeta\n created\n modified\n confidentiality {\n isConfidential\n method\n }\n ", "\n content: childFileLinks(plainMeta: $contentFilter) {\n edges {\n node {\n childFile {\n id\n keyId\n archived\n currentVersion {\n state {\n id\n keyId\n plainMeta\n cipherMeta\n created\n modified\n }\n }\n versions {\n edges {\n node {\n operation\n }\n }\n }\n }\n }\n }\n }\n attachments: childFileLinks(plainMeta: $attachmentsFilter) {\n edges {\n node {\n childFile {\n id\n keyId\n archived\n currentVersion {\n state {\n id\n keyId\n plainMeta\n cipherMeta\n contentResource\n }\n }\n versions {\n edges {\n node {\n operation\n }\n }\n }\n }\n }\n }\n }\n }\n keyGraph(cachedKeyIds: $cachedKeyIds) {\n ...KeyGraphFragment\n }\n}\n", "\n"], ["\nquery Record(\n $id: LrRelayIdInput!,\n $cachedKeyIds: [LrRelayIdInput!],\n $categoryFilter: LrJSONFilter,\n $contentFilter: LrJSONFilter,\n $attachmentsFilter: LrJSONFilter,\n) {\n record: directory(id: $id) {\n id\n keyId\n archived\n plainMeta\n cipherMeta\n created\n modified\n confidentiality {\n isConfidential\n method\n }\n ", "\n content: childFileLinks(plainMeta: $contentFilter) {\n edges {\n node {\n childFile {\n id\n keyId\n archived\n currentVersion {\n state {\n id\n keyId\n plainMeta\n cipherMeta\n created\n modified\n }\n }\n versions {\n edges {\n node {\n operation\n }\n }\n }\n }\n }\n }\n }\n attachments: childFileLinks(plainMeta: $attachmentsFilter) {\n edges {\n node {\n childFile {\n id\n keyId\n archived\n currentVersion {\n state {\n id\n keyId\n plainMeta\n cipherMeta\n contentResource\n }\n }\n versions {\n edges {\n node {\n operation\n }\n }\n }\n }\n }\n }\n }\n }\n keyGraph(cachedKeyIds: $cachedKeyIds) {\n ...KeyGraphFragment\n }\n}\n", "\n"])), parentCategoriesField(depth), KeyGraphFragment);
|
|
7015
|
-
};
|
|
7016
|
-
var CreateRecordContainerMutation = gql__default['default'](templateObject_2$a || (templateObject_2$a = __makeTemplateObject(["\n mutation CreateRecordContainer(\n $plainMeta: LrJSONString\n $cipherMeta: String\n $parentDirectories: [ParentDirectoryInput!]\n $parentRootDirectory: ParentRootDirectoryInput\n ) {\n new: createDirectory(\n input: {\n plainMeta: $plainMeta\n cipherMeta: $cipherMeta\n parentDirectories: $parentDirectories\n parentRootDirectory: $parentRootDirectory\n }\n ) {\n category: directory {\n id\n keyId\n }\n }\n }\n"], ["\n mutation CreateRecordContainer(\n $plainMeta: LrJSONString\n $cipherMeta: String\n $parentDirectories: [ParentDirectoryInput!]\n $parentRootDirectory: ParentRootDirectoryInput\n ) {\n new: createDirectory(\n input: {\n plainMeta: $plainMeta\n cipherMeta: $cipherMeta\n parentDirectories: $parentDirectories\n parentRootDirectory: $parentRootDirectory\n }\n ) {\n category: directory {\n id\n keyId\n }\n }\n }\n"])));
|
|
7017
|
-
var CreateRecordMutation = gql__default['default'](templateObject_3$8 || (templateObject_3$8 = __makeTemplateObject(["\n mutation CreateFile($input: CreateFileInput!) {\n createFile(input: $input) {\n file {\n id\n }\n }\n }\n"], ["\n mutation CreateFile($input: CreateFileInput!) {\n createFile(input: $input) {\n file {\n id\n }\n }\n }\n"])));
|
|
7018
|
-
var UpdateRecordContainerMutation = gql__default['default'](templateObject_4$6 || (templateObject_4$6 = __makeTemplateObject(["\n mutation UpdateRecord($input: UpdateDirectoryInput!) {\n updateDirectory(input: $input) {\n directory {\n id\n }\n }\n }\n"], ["\n mutation UpdateRecord($input: UpdateDirectoryInput!) {\n updateDirectory(input: $input) {\n directory {\n id\n }\n }\n }\n"])));
|
|
7019
|
-
var UpdateRecordMutation = gql__default['default'](templateObject_5$6 || (templateObject_5$6 = __makeTemplateObject(["\n mutation UpdateFile($input: UpdateFileInput!) {\n updateFile(input: $input) {\n file {\n id\n }\n }\n }\n"], ["\n mutation UpdateFile($input: UpdateFileInput!) {\n updateFile(input: $input) {\n file {\n id\n }\n }\n }\n"])));
|
|
7020
|
-
var DeleteRecordMutation = gql__default['default'](templateObject_6$5 || (templateObject_6$5 = __makeTemplateObject(["\n mutation DeleteRecord($recordId: LrRelayIdInput!) {\n deleteDirectory(input: { directoryId: $recordId }) {\n id\n }\n }\n"], ["\n mutation DeleteRecord($recordId: LrRelayIdInput!) {\n deleteDirectory(input: { directoryId: $recordId }) {\n id\n }\n }\n"])));
|
|
7021
|
-
var CreateFileMutation = gql__default['default'](templateObject_7$4 || (templateObject_7$4 = __makeTemplateObject(["\n mutation CreateFile($input: CreateFileInput!) {\n createFile(input: $input) {\n file {\n id\n }\n }\n }\n"], ["\n mutation CreateFile($input: CreateFileInput!) {\n createFile(input: $input) {\n file {\n id\n }\n }\n }\n"])));
|
|
7022
|
-
var DeleteFileMutation = gql__default['default'](templateObject_8$4 || (templateObject_8$4 = __makeTemplateObject(["\n mutation DeleteFile($fileId: LrRelayIdInput!) {\n deleteFile(input: { fileId: $fileId }) {\n id\n }\n }\n"], ["\n mutation DeleteFile($fileId: LrRelayIdInput!) {\n deleteFile(input: { fileId: $fileId }) {\n id\n }\n }\n"])));
|
|
7023
|
-
var templateObject_1$d, templateObject_2$a, templateObject_3$8, templateObject_4$6, templateObject_5$6, templateObject_6$5, templateObject_7$4, templateObject_8$4;
|
|
7024
7066
|
|
|
7025
|
-
var
|
|
7026
|
-
|
|
7027
|
-
|
|
7028
|
-
|
|
7029
|
-
|
|
7067
|
+
var Auth2Service_1;
|
|
7068
|
+
exports.Auth2Service = Auth2Service_1 = /** @class */ (function (_super) {
|
|
7069
|
+
__extends(Auth2Service, _super);
|
|
7070
|
+
function Auth2Service(ngZone, injector, http, cognito, api, keyService, keyGraphService, keyFactoryService, passwordService, idleService, persistService, encryptionService, assemblyController, kcConfig) {
|
|
7071
|
+
var _this = _super.call(this, injector) || this;
|
|
7072
|
+
_this.ngZone = ngZone;
|
|
7073
|
+
_this.injector = injector;
|
|
7074
|
+
_this.http = http;
|
|
7075
|
+
_this.cognito = cognito;
|
|
7076
|
+
_this.api = api;
|
|
7077
|
+
_this.keyService = keyService;
|
|
7078
|
+
_this.keyGraphService = keyGraphService;
|
|
7079
|
+
_this.keyFactoryService = keyFactoryService;
|
|
7080
|
+
_this.passwordService = passwordService;
|
|
7081
|
+
_this.idleService = idleService;
|
|
7082
|
+
_this.persistService = persistService;
|
|
7083
|
+
_this.encryptionService = encryptionService;
|
|
7084
|
+
_this.assemblyController = assemblyController;
|
|
7085
|
+
_this.kcConfig = kcConfig;
|
|
7086
|
+
// Could use rxjs observables here. But trying to have kc-client use as little angular
|
|
7087
|
+
// features as possible. Rxjs is not used anywhere else in kc-client.
|
|
7088
|
+
_this.logoutListeners = new Set();
|
|
7089
|
+
// Stores the password for use after mfa verification to decrypt masterKey.
|
|
7090
|
+
_this.password = null;
|
|
7091
|
+
if (!i0.isDevMode()) {
|
|
7092
|
+
if (_this.kcConfig.debug != null) {
|
|
7093
|
+
throw new KcBadRequestException('In production mode, "KcConfig.debug" must be set to null');
|
|
7094
|
+
}
|
|
7095
|
+
}
|
|
7096
|
+
return _this;
|
|
7030
7097
|
}
|
|
7031
|
-
|
|
7032
|
-
|
|
7098
|
+
Auth2Service.prototype.importPassword = function (plainPassword) {
|
|
7099
|
+
return this.keyFactoryService.importPassword(plainPassword);
|
|
7100
|
+
};
|
|
7101
|
+
Auth2Service.prototype.logout = function () {
|
|
7102
|
+
var _a;
|
|
7033
7103
|
return __awaiter(this, void 0, void 0, function () {
|
|
7034
|
-
var rootDirectories;
|
|
7035
7104
|
return __generator(this, function (_b) {
|
|
7036
7105
|
switch (_b.label) {
|
|
7037
|
-
case 0:
|
|
7038
|
-
|
|
7039
|
-
|
|
7040
|
-
archived: input && input.archived,
|
|
7041
|
-
},
|
|
7042
|
-
})];
|
|
7106
|
+
case 0:
|
|
7107
|
+
// Notify all listeners to clean up.
|
|
7108
|
+
return [4 /*yield*/, Promise.all(__spread(this.logoutListeners).map(function (callback) { return callback(); }))];
|
|
7043
7109
|
case 1:
|
|
7044
|
-
|
|
7045
|
-
|
|
7110
|
+
// Notify all listeners to clean up.
|
|
7111
|
+
_b.sent();
|
|
7112
|
+
this.user = null;
|
|
7113
|
+
this.keyService.purgeKeys();
|
|
7114
|
+
this.keyGraphService.purgeKeys();
|
|
7115
|
+
// Sign out on both cognito and kc-server
|
|
7116
|
+
return [4 /*yield*/, Promise.all([this.cognito.signOut(), this.kcLogout()])];
|
|
7117
|
+
case 2:
|
|
7118
|
+
// Sign out on both cognito and kc-server
|
|
7119
|
+
_b.sent();
|
|
7120
|
+
if ((_a = this.kcConfig.debug) === null || _a === void 0 ? void 0 : _a.username) {
|
|
7121
|
+
this.kcConfig.debug.username = null;
|
|
7122
|
+
}
|
|
7123
|
+
return [2 /*return*/];
|
|
7046
7124
|
}
|
|
7047
7125
|
});
|
|
7048
7126
|
});
|
|
7049
7127
|
};
|
|
7050
|
-
|
|
7128
|
+
Auth2Service.prototype.addLogoutListener = function (callback) {
|
|
7129
|
+
this.logoutListeners.add(callback);
|
|
7130
|
+
};
|
|
7131
|
+
Auth2Service.prototype.removeLogoutListener = function (callback) {
|
|
7132
|
+
this.logoutListeners.delete(callback);
|
|
7133
|
+
};
|
|
7134
|
+
Auth2Service.prototype.login = function (emailOrPhone, password, _b) {
|
|
7135
|
+
var _c = _b === void 0 ? {} : _b, _d = _c.tpPasswordResetAutoComplete, tpPasswordResetAutoComplete = _d === void 0 ? true : _d;
|
|
7136
|
+
var _a;
|
|
7051
7137
|
return __awaiter(this, void 0, void 0, function () {
|
|
7052
|
-
var
|
|
7138
|
+
var loginResult;
|
|
7053
7139
|
return __generator(this, function (_b) {
|
|
7054
7140
|
switch (_b.label) {
|
|
7055
|
-
case 0: return [4 /*yield*/, this.
|
|
7056
|
-
query: GetVaultsQuery,
|
|
7057
|
-
variables: {
|
|
7058
|
-
plainMetaFilter: DefaultVaultFilter,
|
|
7059
|
-
},
|
|
7060
|
-
})];
|
|
7141
|
+
case 0: return [4 /*yield*/, this.loginImpl(emailOrPhone, password)];
|
|
7061
7142
|
case 1:
|
|
7062
|
-
|
|
7063
|
-
|
|
7064
|
-
|
|
7065
|
-
|
|
7066
|
-
|
|
7067
|
-
throw new KcBadStateException('There are more than one default vaults');
|
|
7143
|
+
loginResult = _b.sent();
|
|
7144
|
+
// Save the password for use after meeting challenge.
|
|
7145
|
+
if (loginResult.challenge) {
|
|
7146
|
+
this.password = new KeyContainer(password, Auth2Service_1.CHALLENGE_TIMEOUT);
|
|
7147
|
+
return [2 /*return*/, loginResult];
|
|
7068
7148
|
}
|
|
7069
|
-
|
|
7149
|
+
if (!(tpPasswordResetAutoComplete &&
|
|
7150
|
+
((_a = loginResult.user.resetUser) === null || _a === void 0 ? void 0 : _a.state) === exports.TpClaimState.APPROVED)) return [3 /*break*/, 4];
|
|
7151
|
+
return [4 /*yield*/, this.completeResetRequest(password)];
|
|
7152
|
+
case 2:
|
|
7153
|
+
_b.sent();
|
|
7154
|
+
return [4 /*yield*/, this.loginImpl(emailOrPhone, password)];
|
|
7155
|
+
case 3:
|
|
7156
|
+
loginResult = _b.sent();
|
|
7157
|
+
_b.label = 4;
|
|
7158
|
+
case 4: return [2 /*return*/, loginResult];
|
|
7070
7159
|
}
|
|
7071
7160
|
});
|
|
7072
7161
|
});
|
|
7073
7162
|
};
|
|
7074
|
-
|
|
7075
|
-
var _a;
|
|
7163
|
+
Auth2Service.prototype.verifyLogin = function (options) {
|
|
7076
7164
|
return __awaiter(this, void 0, void 0, function () {
|
|
7077
|
-
var
|
|
7078
|
-
return __generator(this, function (
|
|
7079
|
-
switch (
|
|
7165
|
+
var challenge, code, rememberMe, VALID_CHALLENGE_NAMES, cognitoUser, user;
|
|
7166
|
+
return __generator(this, function (_b) {
|
|
7167
|
+
switch (_b.label) {
|
|
7080
7168
|
case 0:
|
|
7081
|
-
|
|
7082
|
-
|
|
7083
|
-
|
|
7169
|
+
challenge = options.challenge, code = options.code, rememberMe = options.rememberMe;
|
|
7170
|
+
VALID_CHALLENGE_NAMES = [
|
|
7171
|
+
CognitoChallengeName.SMS_MFA,
|
|
7172
|
+
CognitoChallengeName.SOFTWARE_TOKEN_MFA,
|
|
7173
|
+
];
|
|
7174
|
+
if (!VALID_CHALLENGE_NAMES.includes(challenge.cognitoUser.challengeName)) {
|
|
7175
|
+
throw new KcBadRequestException("challengeName must be one of " + VALID_CHALLENGE_NAMES);
|
|
7176
|
+
}
|
|
7177
|
+
return [4 /*yield*/, this.cognito.confirmSignIn(challenge.cognitoUser, code, challenge.cognitoUser.challengeName)];
|
|
7084
7178
|
case 1:
|
|
7085
|
-
|
|
7086
|
-
|
|
7179
|
+
cognitoUser = _b.sent();
|
|
7180
|
+
return [4 /*yield*/, this.handlePostAuth(challenge.recoveryStatus)];
|
|
7087
7181
|
case 2:
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
console.error('There is no default vault.');
|
|
7091
|
-
return [2 /*return*/, []];
|
|
7092
|
-
}
|
|
7093
|
-
return [4 /*yield*/, this.lrApollo.query({
|
|
7094
|
-
query: GetCategoriesQuery,
|
|
7095
|
-
variables: {
|
|
7096
|
-
vaultDirectoryId: vaultDirectoryId,
|
|
7097
|
-
categoryFilter: CategoryFilter,
|
|
7098
|
-
recordFilter: RecordFilter,
|
|
7099
|
-
archived: input === null || input === void 0 ? void 0 : input.archived,
|
|
7100
|
-
},
|
|
7101
|
-
})];
|
|
7182
|
+
_b.sent();
|
|
7183
|
+
return [4 /*yield*/, this.loadUser(cognitoUser, this.password.pop())];
|
|
7102
7184
|
case 3:
|
|
7103
|
-
|
|
7104
|
-
|
|
7185
|
+
user = _b.sent();
|
|
7186
|
+
// This is not strictly necessary since the this.password.pop() already clears the
|
|
7187
|
+
// password inside the container. But doesn't hurt either.
|
|
7188
|
+
this.password = null;
|
|
7189
|
+
if (rememberMe) {
|
|
7190
|
+
cognitoUser.setDeviceStatusRemembered({
|
|
7191
|
+
onSuccess: function () {
|
|
7192
|
+
return;
|
|
7193
|
+
},
|
|
7194
|
+
onFailure: function (e) { return console.error(e); },
|
|
7195
|
+
});
|
|
7196
|
+
}
|
|
7197
|
+
return [2 /*return*/, {
|
|
7198
|
+
user: user,
|
|
7199
|
+
}];
|
|
7105
7200
|
}
|
|
7106
7201
|
});
|
|
7107
7202
|
});
|
|
7108
7203
|
};
|
|
7109
|
-
|
|
7204
|
+
Auth2Service.prototype.getUser = function () {
|
|
7110
7205
|
return __awaiter(this, void 0, void 0, function () {
|
|
7111
|
-
var
|
|
7112
|
-
return __generator(this, function (
|
|
7113
|
-
switch (
|
|
7114
|
-
case 0:
|
|
7115
|
-
|
|
7116
|
-
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
|
|
7206
|
+
var cognitoUser;
|
|
7207
|
+
return __generator(this, function (_b) {
|
|
7208
|
+
switch (_b.label) {
|
|
7209
|
+
case 0:
|
|
7210
|
+
if (this.user) {
|
|
7211
|
+
return [2 /*return*/, this.user];
|
|
7212
|
+
}
|
|
7213
|
+
return [4 /*yield*/, this.cognito.currentAuthenticatedUser()];
|
|
7214
|
+
case 1:
|
|
7215
|
+
cognitoUser = _b.sent();
|
|
7216
|
+
return [2 /*return*/, this.loadUser(cognitoUser)];
|
|
7217
|
+
}
|
|
7218
|
+
});
|
|
7219
|
+
});
|
|
7220
|
+
};
|
|
7221
|
+
Auth2Service.prototype.refreshAccessToken = function () {
|
|
7222
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7223
|
+
var cognitoUser, refreshToken;
|
|
7224
|
+
return __generator(this, function (_b) {
|
|
7225
|
+
switch (_b.label) {
|
|
7226
|
+
case 0: return [4 /*yield*/, this.cognito.currentAuthenticatedUser()];
|
|
7227
|
+
case 1:
|
|
7228
|
+
cognitoUser = _b.sent();
|
|
7229
|
+
refreshToken = cognitoUser.getSignInUserSession().getRefreshToken();
|
|
7230
|
+
console.log('Token refresh...');
|
|
7231
|
+
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
7232
|
+
cognitoUser.refreshSession(refreshToken, function (err) {
|
|
7233
|
+
if (err) {
|
|
7234
|
+
console.error('Error refreshing token: ', err);
|
|
7235
|
+
reject(err);
|
|
7236
|
+
}
|
|
7237
|
+
else {
|
|
7238
|
+
console.log('Token refresh complete');
|
|
7239
|
+
resolve(0);
|
|
7240
|
+
}
|
|
7241
|
+
});
|
|
7242
|
+
})];
|
|
7243
|
+
}
|
|
7244
|
+
});
|
|
7245
|
+
});
|
|
7246
|
+
};
|
|
7247
|
+
// ----------------------------------------------------------------------------------------------------
|
|
7248
|
+
// Helpers
|
|
7249
|
+
// ----------------------------------------------------------------------------------------------------
|
|
7250
|
+
Auth2Service.prototype.fetchCurrentUser = function () {
|
|
7251
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7252
|
+
return __generator(this, function (_b) {
|
|
7253
|
+
switch (_b.label) {
|
|
7254
|
+
case 0: return [4 /*yield*/, this.api.query({
|
|
7255
|
+
query: CurrentUserQuery$1,
|
|
7256
|
+
processorOptions: {
|
|
7257
|
+
hasKeys: false,
|
|
7258
|
+
},
|
|
7259
|
+
})];
|
|
7260
|
+
case 1: return [2 /*return*/, (_b.sent()).currentUser];
|
|
7261
|
+
}
|
|
7262
|
+
});
|
|
7263
|
+
});
|
|
7264
|
+
};
|
|
7265
|
+
Auth2Service.prototype.fetchResetUser = function () {
|
|
7266
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7267
|
+
return __generator(this, function (_b) {
|
|
7268
|
+
switch (_b.label) {
|
|
7269
|
+
case 0: return [4 /*yield*/, this.api.query({
|
|
7270
|
+
query: ResetUserQuery,
|
|
7271
|
+
processorOptions: {
|
|
7272
|
+
hasKeys: false,
|
|
7273
|
+
},
|
|
7274
|
+
})];
|
|
7275
|
+
case 1: return [2 /*return*/, (_b.sent()).tpPasswordResetUser];
|
|
7276
|
+
}
|
|
7277
|
+
});
|
|
7278
|
+
});
|
|
7279
|
+
};
|
|
7280
|
+
Auth2Service.prototype.kcLogout = function () {
|
|
7281
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7282
|
+
return __generator(this, function (_b) {
|
|
7283
|
+
switch (_b.label) {
|
|
7284
|
+
case 0: return [4 /*yield*/, this.http
|
|
7285
|
+
.post(this.kcConfig.authUrl + "auth/sign-out/", null, {
|
|
7286
|
+
withCredentials: true,
|
|
7287
|
+
responseType: 'text',
|
|
7288
|
+
})
|
|
7289
|
+
.toPromise()];
|
|
7290
|
+
case 1:
|
|
7291
|
+
_b.sent();
|
|
7292
|
+
return [2 /*return*/];
|
|
7293
|
+
}
|
|
7294
|
+
});
|
|
7295
|
+
});
|
|
7296
|
+
};
|
|
7297
|
+
Auth2Service.prototype.fetchPassIdpParams = function (emailOrPhone) {
|
|
7298
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7299
|
+
return __generator(this, function (_b) {
|
|
7300
|
+
switch (_b.label) {
|
|
7301
|
+
case 0: return [4 /*yield*/, this.http
|
|
7302
|
+
.get(this.kcConfig.authUrl + "users/pass-idp-params/?login_name=" + encodeURIComponent(emailOrPhone))
|
|
7303
|
+
.toPromise()];
|
|
7304
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
7305
|
+
}
|
|
7306
|
+
});
|
|
7307
|
+
});
|
|
7308
|
+
};
|
|
7309
|
+
Auth2Service.prototype.loginImpl = function (emailOrPhone, password) {
|
|
7310
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7311
|
+
var loginIdpResult, user;
|
|
7312
|
+
return __generator(this, function (_b) {
|
|
7313
|
+
switch (_b.label) {
|
|
7314
|
+
case 0: return [4 /*yield*/, this.logout()];
|
|
7315
|
+
case 1:
|
|
7316
|
+
_b.sent();
|
|
7317
|
+
return [4 /*yield*/, this.loginIdp(emailOrPhone, password)];
|
|
7318
|
+
case 2:
|
|
7319
|
+
loginIdpResult = _b.sent();
|
|
7320
|
+
// Can't get the user yet because we still ned to meet MFA challenges
|
|
7321
|
+
if ([
|
|
7322
|
+
CognitoChallengeName.SMS_MFA,
|
|
7323
|
+
CognitoChallengeName.SOFTWARE_TOKEN_MFA,
|
|
7324
|
+
].includes(loginIdpResult.cognitoUser.challengeName)) {
|
|
7325
|
+
return [2 /*return*/, {
|
|
7326
|
+
challenge: {
|
|
7327
|
+
cognitoUser: loginIdpResult.cognitoUser,
|
|
7328
|
+
recoveryStatus: loginIdpResult.recoveryStatus,
|
|
7329
|
+
},
|
|
7330
|
+
}];
|
|
7331
|
+
}
|
|
7332
|
+
return [4 /*yield*/, this.handlePostAuth(loginIdpResult.recoveryStatus)];
|
|
7333
|
+
case 3:
|
|
7334
|
+
_b.sent();
|
|
7335
|
+
return [4 /*yield*/, this.loadUser(loginIdpResult.cognitoUser, password)];
|
|
7336
|
+
case 4:
|
|
7337
|
+
user = _b.sent();
|
|
7338
|
+
return [2 /*return*/, {
|
|
7339
|
+
user: user,
|
|
7340
|
+
}];
|
|
7341
|
+
}
|
|
7342
|
+
});
|
|
7343
|
+
});
|
|
7344
|
+
};
|
|
7345
|
+
Auth2Service.prototype.loginIdp = function (emailOrPhone, password) {
|
|
7346
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7347
|
+
var passIdpApiResult, user_1, _b, error_1, user_2, _c, error_2, reset, user_3, _d, err_1, user, _e;
|
|
7348
|
+
return __generator(this, function (_f) {
|
|
7349
|
+
switch (_f.label) {
|
|
7350
|
+
case 0: return [4 /*yield*/, this.fetchPassIdpParams(emailOrPhone)];
|
|
7351
|
+
case 1:
|
|
7352
|
+
passIdpApiResult = _f.sent();
|
|
7353
|
+
if (passIdpApiResult.passwordChangeStatus === PasswordChangeStatus.IN_PROGRESS) {
|
|
7354
|
+
throw new KcConcurrentAccessException('A password change is in progress');
|
|
7355
|
+
}
|
|
7356
|
+
if (!(passIdpApiResult.passwordChangeStatus === PasswordChangeStatus.RECOVERY)) return [3 /*break*/, 8];
|
|
7357
|
+
console.log('In recovery mode.');
|
|
7358
|
+
_f.label = 2;
|
|
7359
|
+
case 2:
|
|
7360
|
+
_f.trys.push([2, 4, , 5]);
|
|
7361
|
+
_b = {};
|
|
7362
|
+
return [4 /*yield*/, this.loginIdpImpl(emailOrPhone, password, passIdpApiResult.newPassIdpParams)];
|
|
7363
|
+
case 3:
|
|
7364
|
+
user_1 = (_b.cognitoUser = _f.sent(),
|
|
7365
|
+
_b.recoveryStatus = RecoveryStatus.NEW_PASSWORD,
|
|
7366
|
+
_b);
|
|
7367
|
+
// New password worked. Let's set to the current password
|
|
7368
|
+
// --Potential Failure Point 1--
|
|
7369
|
+
// if changePasswordComplete() doesn't get called, then it should remain
|
|
7370
|
+
console.log('New password works!');
|
|
7371
|
+
return [2 /*return*/, user_1];
|
|
7372
|
+
case 4:
|
|
7373
|
+
error_1 = _f.sent();
|
|
7374
|
+
// Just bubble up any other type of error.
|
|
7375
|
+
if (error_1.code !== 'NotAuthorizedException') {
|
|
7376
|
+
throw error_1;
|
|
7377
|
+
}
|
|
7378
|
+
return [3 /*break*/, 5];
|
|
7379
|
+
case 5:
|
|
7380
|
+
_f.trys.push([5, 7, , 8]);
|
|
7381
|
+
_c = {};
|
|
7382
|
+
return [4 /*yield*/, this.loginIdpImpl(emailOrPhone, password, passIdpApiResult.currentPassIdpParams)];
|
|
7383
|
+
case 6:
|
|
7384
|
+
user_2 = (_c.cognitoUser = _f.sent(),
|
|
7385
|
+
_c.recoveryStatus = RecoveryStatus.OLD_PASSWORD,
|
|
7386
|
+
_c);
|
|
7387
|
+
// Old password worked.
|
|
7388
|
+
console.log('Old password works!');
|
|
7389
|
+
return [2 /*return*/, user_2];
|
|
7390
|
+
case 7:
|
|
7391
|
+
error_2 = _f.sent();
|
|
7392
|
+
// Just bubble up any other type of error.
|
|
7393
|
+
throw error_2.code === 'NotAuthorizedException'
|
|
7394
|
+
? new KcBadRequestException('The password change request was interrupted, please try to login with both your new and old password')
|
|
7395
|
+
: error_2;
|
|
7396
|
+
case 8:
|
|
7397
|
+
if (!passIdpApiResult.tpPasswordReset) return [3 /*break*/, 12];
|
|
7398
|
+
_f.label = 9;
|
|
7399
|
+
case 9:
|
|
7400
|
+
_f.trys.push([9, 11, , 12]);
|
|
7401
|
+
reset = passIdpApiResult.tpPasswordReset;
|
|
7402
|
+
_d = {};
|
|
7403
|
+
return [4 /*yield*/, this.loginIdpImpl(reset.resetUsername, password, reset.passIdpParams)];
|
|
7404
|
+
case 10:
|
|
7405
|
+
user_3 = (_d.cognitoUser = _f.sent(),
|
|
7406
|
+
_d.recoveryStatus = RecoveryStatus.NONE,
|
|
7407
|
+
_d);
|
|
7408
|
+
return [2 /*return*/, user_3];
|
|
7409
|
+
case 11:
|
|
7410
|
+
err_1 = _f.sent();
|
|
7411
|
+
return [3 /*break*/, 12];
|
|
7412
|
+
case 12:
|
|
7413
|
+
_e = {};
|
|
7414
|
+
return [4 /*yield*/, this.loginIdpImpl(emailOrPhone, password, passIdpApiResult.currentPassIdpParams)];
|
|
7415
|
+
case 13:
|
|
7416
|
+
user = (_e.cognitoUser = _f.sent(),
|
|
7417
|
+
_e.recoveryStatus = RecoveryStatus.NONE,
|
|
7418
|
+
_e);
|
|
7419
|
+
return [2 /*return*/, user];
|
|
7420
|
+
}
|
|
7421
|
+
});
|
|
7422
|
+
});
|
|
7423
|
+
};
|
|
7424
|
+
Auth2Service.prototype.loginIdpImpl = function (emailOrPhone, password, passIdpParams) {
|
|
7425
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7426
|
+
var passIdpResult;
|
|
7427
|
+
return __generator(this, function (_b) {
|
|
7428
|
+
switch (_b.label) {
|
|
7429
|
+
case 0: return [4 /*yield*/, this.keyFactoryService.derivePassIdp(Object.assign({ password: password }, passIdpParams))];
|
|
7430
|
+
case 1:
|
|
7431
|
+
passIdpResult = _b.sent();
|
|
7432
|
+
// Use the derived password to signin with cognito
|
|
7433
|
+
return [2 /*return*/, this.cognito.signIn(emailOrPhone, this.passwordService.getPassIdpString(passIdpResult.jwk))];
|
|
7434
|
+
}
|
|
7435
|
+
});
|
|
7436
|
+
});
|
|
7437
|
+
};
|
|
7438
|
+
Auth2Service.prototype.handlePostAuth = function (recoveryStatus) {
|
|
7439
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7440
|
+
return __generator(this, function (_b) {
|
|
7441
|
+
switch (_b.label) {
|
|
7442
|
+
case 0: return [4 /*yield*/, this.handlePasswordRecovery(recoveryStatus)];
|
|
7443
|
+
case 1:
|
|
7444
|
+
_b.sent();
|
|
7445
|
+
return [4 /*yield*/, this.handleSessionEncryptionKey()];
|
|
7446
|
+
case 2:
|
|
7447
|
+
_b.sent();
|
|
7448
|
+
return [2 /*return*/];
|
|
7449
|
+
}
|
|
7450
|
+
});
|
|
7451
|
+
});
|
|
7452
|
+
};
|
|
7453
|
+
Auth2Service.prototype.handlePasswordRecovery = function (recoveryStatus) {
|
|
7454
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7455
|
+
return __generator(this, function (_b) {
|
|
7456
|
+
switch (_b.label) {
|
|
7457
|
+
case 0:
|
|
7458
|
+
if (!(recoveryStatus !== RecoveryStatus.NONE)) return [3 /*break*/, 2];
|
|
7459
|
+
return [4 /*yield*/, this.passwordService.changePasswordComplete({
|
|
7460
|
+
useNewPassword: recoveryStatus === RecoveryStatus.NEW_PASSWORD,
|
|
7461
|
+
})];
|
|
7462
|
+
case 1:
|
|
7463
|
+
_b.sent();
|
|
7464
|
+
_b.label = 2;
|
|
7465
|
+
case 2: return [2 /*return*/];
|
|
7466
|
+
}
|
|
7467
|
+
});
|
|
7468
|
+
});
|
|
7469
|
+
};
|
|
7470
|
+
Auth2Service.prototype.handleSessionEncryptionKey = function () {
|
|
7471
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7472
|
+
var msg, sessionEncryptionKey;
|
|
7473
|
+
return __generator(this, function (_b) {
|
|
7474
|
+
switch (_b.label) {
|
|
7475
|
+
case 0:
|
|
7476
|
+
if (!this.kcConfig.disableSessionEncryptionKey) return [3 /*break*/, 1];
|
|
7477
|
+
if (!i0.isDevMode()) {
|
|
7478
|
+
msg = 'You should not set disableSessionEncryptionKey=True in mode prod. It defaults to false.';
|
|
7479
|
+
console.error(msg);
|
|
7480
|
+
throw new KcInternalErrorException(msg);
|
|
7481
|
+
}
|
|
7482
|
+
else {
|
|
7483
|
+
console.warn('You have set disableSessionEncryptionKey=True. Make sure not to do this in prod mode.');
|
|
7484
|
+
}
|
|
7485
|
+
return [3 /*break*/, 4];
|
|
7486
|
+
case 1: return [4 /*yield*/, this.keyFactoryService.createKey()];
|
|
7487
|
+
case 2:
|
|
7488
|
+
sessionEncryptionKey = _b.sent();
|
|
7489
|
+
return [4 /*yield*/, this.lrGraphQL.lrMutate(new LrMutation({
|
|
7490
|
+
mutation: SetSessionEncryptionKeyMutation,
|
|
7491
|
+
variables: {
|
|
7492
|
+
input: {
|
|
7493
|
+
sessionEncryptionKey: JSON.stringify(sessionEncryptionKey.toJSON(true)),
|
|
7494
|
+
},
|
|
7495
|
+
},
|
|
7496
|
+
}), {
|
|
7497
|
+
includeKeyGraph: false,
|
|
7498
|
+
})];
|
|
7499
|
+
case 3:
|
|
7500
|
+
_b.sent();
|
|
7501
|
+
this.persistService.setServerSessionEncryptionKey(sessionEncryptionKey);
|
|
7502
|
+
_b.label = 4;
|
|
7503
|
+
case 4: return [2 /*return*/];
|
|
7504
|
+
}
|
|
7505
|
+
});
|
|
7506
|
+
});
|
|
7507
|
+
};
|
|
7508
|
+
Auth2Service.prototype.getCognitoUserAttribute = function (attributeName, userAttributes) {
|
|
7509
|
+
var userAttribute = userAttributes.find(function (x) { return x.getName() === attributeName; });
|
|
7510
|
+
return userAttribute ? userAttribute.getValue() : null;
|
|
7511
|
+
};
|
|
7512
|
+
Auth2Service.prototype.loadUserKeys = function (options) {
|
|
7513
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7514
|
+
var userKeys, password, sessionEncryptionKey, _b, _c, passKey, _d, _e;
|
|
7515
|
+
return __generator(this, function (_f) {
|
|
7516
|
+
switch (_f.label) {
|
|
7517
|
+
case 0:
|
|
7518
|
+
userKeys = options.userKeys, password = options.password, sessionEncryptionKey = options.sessionEncryptionKey;
|
|
7519
|
+
if (!sessionEncryptionKey) return [3 /*break*/, 2];
|
|
7520
|
+
_c = (_b = this.persistService).setServerSessionEncryptionKey;
|
|
7521
|
+
return [4 /*yield*/, nodeJose.JWK.asKey(sessionEncryptionKey)];
|
|
7522
|
+
case 1:
|
|
7523
|
+
_c.apply(_b, [_f.sent()]);
|
|
7524
|
+
_f.label = 2;
|
|
7525
|
+
case 2:
|
|
7526
|
+
if (!password) return [3 /*break*/, 6];
|
|
7527
|
+
return [4 /*yield*/, this.keyFactoryService.derivePassKey(Object.assign({ password: password }, userKeys.passKey.passKeyParams))];
|
|
7528
|
+
case 3:
|
|
7529
|
+
passKey = (_f.sent()).jwk;
|
|
7530
|
+
_e = (_d = this.idleService).persistMasterKey;
|
|
7531
|
+
return [4 /*yield*/, this.keyGraphService.unwrapWithPassKey(userKeys.passKey.id, passKey, userKeys.masterKey.id)];
|
|
7532
|
+
case 4: return [4 /*yield*/, _e.apply(_d, [_f.sent()])];
|
|
7533
|
+
case 5:
|
|
7534
|
+
_f.sent();
|
|
7535
|
+
_f.label = 6;
|
|
7536
|
+
case 6: return [2 /*return*/];
|
|
7537
|
+
}
|
|
7538
|
+
});
|
|
7539
|
+
});
|
|
7540
|
+
};
|
|
7541
|
+
Auth2Service.prototype.loadUser = function (cognitoUser, password) {
|
|
7542
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7543
|
+
var _b, _c;
|
|
7544
|
+
return __generator(this, function (_d) {
|
|
7545
|
+
switch (_d.label) {
|
|
7546
|
+
case 0:
|
|
7547
|
+
if (!cognitoUser.getUsername().endsWith(TP_PASSWORD_RESET_USERNAME_SUFFIX)) return [3 /*break*/, 2];
|
|
7548
|
+
_b = this;
|
|
7549
|
+
return [4 /*yield*/, this.loadResetUser(cognitoUser, password)];
|
|
7550
|
+
case 1:
|
|
7551
|
+
_b.user = _d.sent();
|
|
7552
|
+
return [3 /*break*/, 4];
|
|
7553
|
+
case 2:
|
|
7554
|
+
_c = this;
|
|
7555
|
+
return [4 /*yield*/, this.loadRegularUser(cognitoUser, password)];
|
|
7556
|
+
case 3:
|
|
7557
|
+
_c.user = _d.sent();
|
|
7558
|
+
_d.label = 4;
|
|
7559
|
+
case 4: return [4 /*yield*/, this.idleService.start()];
|
|
7560
|
+
case 5:
|
|
7561
|
+
_d.sent(); // Run idleService whenever user is logged in.
|
|
7562
|
+
return [2 /*return*/, this.user];
|
|
7563
|
+
}
|
|
7564
|
+
});
|
|
7565
|
+
});
|
|
7566
|
+
};
|
|
7567
|
+
Auth2Service.prototype.loadRegularUser = function (cognitoUser, password) {
|
|
7568
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7569
|
+
var currentUser, username, userAttributes;
|
|
7570
|
+
return __generator(this, function (_b) {
|
|
7571
|
+
switch (_b.label) {
|
|
7572
|
+
case 0: return [4 /*yield*/, this.fetchCurrentUser()];
|
|
7573
|
+
case 1:
|
|
7574
|
+
currentUser = _b.sent();
|
|
7575
|
+
return [4 /*yield*/, this.loadUserKeys({
|
|
7576
|
+
userKeys: currentUser.currentUserKey,
|
|
7577
|
+
password: password,
|
|
7578
|
+
sessionEncryptionKey: currentUser.sessionEncryptionKey,
|
|
7579
|
+
})];
|
|
7580
|
+
case 2:
|
|
7581
|
+
_b.sent();
|
|
7582
|
+
// Regular user populates all keys
|
|
7583
|
+
return [4 /*yield*/, this.keyGraphService.populateKeys(currentUser.currentUserKey)];
|
|
7584
|
+
case 3:
|
|
7585
|
+
// Regular user populates all keys
|
|
7586
|
+
_b.sent();
|
|
7587
|
+
username = currentUser.username;
|
|
7588
|
+
return [4 /*yield*/, this.cognito.userAttributes(cognitoUser)];
|
|
7589
|
+
case 4:
|
|
7590
|
+
userAttributes = _b.sent();
|
|
7591
|
+
return [2 /*return*/, {
|
|
7592
|
+
username: username,
|
|
7593
|
+
sub: this.getCognitoUserAttribute('sub', userAttributes),
|
|
7594
|
+
loginEmail: this.getCognitoUserAttribute('email', userAttributes),
|
|
7595
|
+
resetUser: null,
|
|
7596
|
+
}];
|
|
7597
|
+
}
|
|
7598
|
+
});
|
|
7599
|
+
});
|
|
7600
|
+
};
|
|
7601
|
+
Auth2Service.prototype.loadResetUser = function (cognitoUser, password) {
|
|
7602
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7603
|
+
var resetUser, userKeys, username, userAttributes;
|
|
7604
|
+
return __generator(this, function (_b) {
|
|
7605
|
+
switch (_b.label) {
|
|
7606
|
+
case 0: return [4 /*yield*/, this.fetchResetUser()];
|
|
7607
|
+
case 1:
|
|
7608
|
+
resetUser = _b.sent();
|
|
7609
|
+
userKeys = {
|
|
7610
|
+
passKey: {
|
|
7611
|
+
id: resetUser.passKey.id,
|
|
7612
|
+
passKeyParams: resetUser.passKey.passKeyParams,
|
|
7613
|
+
},
|
|
7614
|
+
masterKey: {
|
|
7615
|
+
id: resetUser.masterKey.id,
|
|
7616
|
+
},
|
|
7617
|
+
};
|
|
7618
|
+
return [4 /*yield*/, this.loadUserKeys({
|
|
7619
|
+
userKeys: userKeys,
|
|
7620
|
+
password: password,
|
|
7621
|
+
sessionEncryptionKey: resetUser.sessionEncryptionKey,
|
|
7622
|
+
})];
|
|
7623
|
+
case 2:
|
|
7624
|
+
_b.sent();
|
|
7625
|
+
// Reset user only sets a subset of keys
|
|
7626
|
+
return [4 /*yield*/, this.keyService.setKeys(userKeys)];
|
|
7627
|
+
case 3:
|
|
7628
|
+
// Reset user only sets a subset of keys
|
|
7629
|
+
_b.sent();
|
|
7630
|
+
username = resetUser.username;
|
|
7631
|
+
return [4 /*yield*/, this.cognito.userAttributes(cognitoUser)];
|
|
7632
|
+
case 4:
|
|
7633
|
+
userAttributes = _b.sent();
|
|
7634
|
+
return [2 /*return*/, {
|
|
7635
|
+
username: username,
|
|
7636
|
+
sub: this.getCognitoUserAttribute('sub', userAttributes),
|
|
7637
|
+
loginEmail: this.getCognitoUserAttribute('email', userAttributes),
|
|
7638
|
+
resetUser: {
|
|
7639
|
+
state: resetUser.state,
|
|
7640
|
+
},
|
|
7641
|
+
}];
|
|
7642
|
+
}
|
|
7643
|
+
});
|
|
7644
|
+
});
|
|
7645
|
+
};
|
|
7646
|
+
Auth2Service.prototype.recoverAssemblyKey = function (resetUser) {
|
|
7647
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7648
|
+
var prk, partials;
|
|
7649
|
+
var _this = this;
|
|
7650
|
+
return __generator(this, function (_b) {
|
|
7651
|
+
switch (_b.label) {
|
|
7652
|
+
case 0: return [4 /*yield*/, this.keyGraphService.getKey(resetUser.pxk.id)];
|
|
7653
|
+
case 1:
|
|
7654
|
+
prk = _b.sent();
|
|
7655
|
+
return [4 /*yield*/, Promise.all(resetUser.approvals
|
|
7656
|
+
.filter(function (approval) { return !!approval.receiverCipherPartialAssemblyKey; })
|
|
7657
|
+
.map(function (approval) { return _this.encryptionService.decrypt(prk, approval.receiverCipherPartialAssemblyKey); }))];
|
|
7658
|
+
case 2:
|
|
7659
|
+
partials = _b.sent();
|
|
7660
|
+
return [2 /*return*/, this.assemblyController.recoverAssemblyKey(partials)];
|
|
7661
|
+
}
|
|
7662
|
+
});
|
|
7663
|
+
});
|
|
7664
|
+
};
|
|
7665
|
+
Auth2Service.prototype.completeResetRequest = function (newPassword) {
|
|
7666
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7667
|
+
var resetUser, assemblyKey, rootKey, rootKeyJwk, masterKey, masterKeyWrappedRootKey, newPassIdpResult, newIdpPassword, challenge, assemblyKeyVerifierPrk, signedChallenge, tempIdpPassword, retPromise, user;
|
|
7668
|
+
var _this = this;
|
|
7669
|
+
return __generator(this, function (_b) {
|
|
7670
|
+
switch (_b.label) {
|
|
7671
|
+
case 0: return [4 /*yield*/, this.fetchResetUser()];
|
|
7672
|
+
case 1:
|
|
7673
|
+
resetUser = _b.sent();
|
|
7674
|
+
if (resetUser.state !== exports.TpClaimState.APPROVED) {
|
|
7675
|
+
throw new KcBadStateException('Password reset request has not been approved.');
|
|
7676
|
+
}
|
|
7677
|
+
return [4 /*yield*/, this.recoverAssemblyKey(resetUser)];
|
|
7678
|
+
case 2:
|
|
7679
|
+
assemblyKey = _b.sent();
|
|
7680
|
+
return [4 /*yield*/, this.encryptionService.decrypt(assemblyKey, resetUser.assemblyCipherData)];
|
|
7681
|
+
case 3:
|
|
7682
|
+
rootKey = (_b.sent()).rootKey;
|
|
7683
|
+
return [4 /*yield*/, nodeJose.JWK.asKey(rootKey)];
|
|
7684
|
+
case 4:
|
|
7685
|
+
rootKeyJwk = _b.sent();
|
|
7686
|
+
return [4 /*yield*/, this.keyGraphService.getKey(resetUser.masterKey.id)];
|
|
7687
|
+
case 5:
|
|
7688
|
+
masterKey = _b.sent();
|
|
7689
|
+
return [4 /*yield*/, this.encryptionService.encryptToString(masterKey.jwk, rootKeyJwk.toJSON(true))];
|
|
7690
|
+
case 6:
|
|
7691
|
+
masterKeyWrappedRootKey = _b.sent();
|
|
7692
|
+
return [4 /*yield*/, this.keyFactoryService.derivePassIdp(Object.assign({ password: newPassword }, resetUser.passKey.passIdpParams))];
|
|
7693
|
+
case 7:
|
|
7694
|
+
newPassIdpResult = _b.sent();
|
|
7695
|
+
newIdpPassword = this.passwordService.getPassIdpString(newPassIdpResult.jwk);
|
|
7696
|
+
return [4 /*yield*/, this.lrGraphQL.lrMutate(new LrMutation({
|
|
7697
|
+
mutation: CreateTpAssemblyKeyChallengeMutation,
|
|
7698
|
+
variables: {
|
|
7699
|
+
input: {},
|
|
7700
|
+
},
|
|
7701
|
+
}), {
|
|
7702
|
+
includeKeyGraph: false,
|
|
7703
|
+
})];
|
|
7704
|
+
case 8:
|
|
7705
|
+
challenge = (_b.sent()).createTpAssemblyKeyChallenge.challenge;
|
|
7706
|
+
// Sign the challenge
|
|
7707
|
+
// Generate a client side nonce that's no in the server's control.
|
|
7708
|
+
challenge.clientNonce = this.keyFactoryService.randomString(TP_PASSWORD_RESET_CLIENT_NONCE_LENGTH);
|
|
7709
|
+
return [4 /*yield*/, this.encryptionService.decrypt(assemblyKey, resetUser.wrappedAssemblyKeyVerifierPrk)];
|
|
7710
|
+
case 9:
|
|
7711
|
+
assemblyKeyVerifierPrk = _b.sent();
|
|
7712
|
+
return [4 /*yield*/, this.encryptionService.sign(assemblyKeyVerifierPrk, challenge)];
|
|
7713
|
+
case 10:
|
|
7714
|
+
signedChallenge = _b.sent();
|
|
7715
|
+
return [4 /*yield*/, this.lrGraphQL.lrMutate(new LrMutation({
|
|
7716
|
+
mutation: PreCompleteTpPasswordResetRequestMutation,
|
|
7717
|
+
variables: {
|
|
7718
|
+
input: {
|
|
7719
|
+
signedChallenge: JSON.stringify(signedChallenge),
|
|
7720
|
+
},
|
|
7721
|
+
},
|
|
7722
|
+
}), {
|
|
7723
|
+
includeKeyGraph: false,
|
|
7724
|
+
})];
|
|
7725
|
+
case 11:
|
|
7726
|
+
tempIdpPassword = (_b.sent()).preCompleteTpPasswordResetRequest.idpPassword;
|
|
7727
|
+
retPromise = new Promise(function (resolve) {
|
|
7728
|
+
var listener = function (data) { return __awaiter(_this, void 0, void 0, function () {
|
|
7729
|
+
return __generator(this, function (_b) {
|
|
7730
|
+
switch (_b.label) {
|
|
7731
|
+
case 0:
|
|
7732
|
+
if (data.payload.event !== 'signIn') {
|
|
7733
|
+
return [2 /*return*/];
|
|
7734
|
+
}
|
|
7735
|
+
core$1.Hub.remove('auth', listener);
|
|
7736
|
+
return [4 /*yield*/, this.cognito.signIn(resetUser.username, newIdpPassword)];
|
|
7737
|
+
case 1:
|
|
7738
|
+
_b.sent();
|
|
7739
|
+
// Switch over to the new set of keys
|
|
7740
|
+
return [4 /*yield*/, this.lrGraphQL.lrMutate(new LrMutation({
|
|
7741
|
+
mutation: CompleteTpPasswordResetRequestMutation,
|
|
7742
|
+
variables: {
|
|
7743
|
+
input: {
|
|
7744
|
+
masterKeyWrappedRootKey: masterKeyWrappedRootKey,
|
|
7745
|
+
masterKeyId: masterKey.id,
|
|
7746
|
+
},
|
|
7747
|
+
},
|
|
7748
|
+
}))];
|
|
7749
|
+
case 2:
|
|
7750
|
+
// Switch over to the new set of keys
|
|
7751
|
+
_b.sent();
|
|
7752
|
+
resolve();
|
|
7753
|
+
return [2 /*return*/];
|
|
7754
|
+
}
|
|
7755
|
+
});
|
|
7756
|
+
}); };
|
|
7757
|
+
core$1.Hub.listen('auth', listener);
|
|
7758
|
+
});
|
|
7759
|
+
return [4 /*yield*/, this.cognito.signIn(resetUser.username, tempIdpPassword, {
|
|
7760
|
+
noProxy: 'true',
|
|
7761
|
+
})];
|
|
7762
|
+
case 12:
|
|
7763
|
+
user = _b.sent();
|
|
7764
|
+
if (user.challengeName !== 'NEW_PASSWORD_REQUIRED') {
|
|
7765
|
+
throw new KcInternalErrorException('Expecting Cognito to have done a password reset after call to PreCompleteTpPasswordResetRequestMutation.');
|
|
7766
|
+
}
|
|
7767
|
+
return [4 /*yield*/, this.cognito.completeNewPassword(user, newIdpPassword, {})];
|
|
7768
|
+
case 13:
|
|
7769
|
+
// Set new password on Idp
|
|
7770
|
+
// the awsFetch() function passes NEW_PASSWORD_REQUIRED directly to AWS without
|
|
7771
|
+
// going through the proxy.
|
|
7772
|
+
user = _b.sent();
|
|
7773
|
+
return [2 /*return*/, retPromise];
|
|
7774
|
+
}
|
|
7775
|
+
});
|
|
7776
|
+
});
|
|
7777
|
+
};
|
|
7778
|
+
// ------------------------------------------------------
|
|
7779
|
+
// Debug utilities
|
|
7780
|
+
// ------------------------------------------------------
|
|
7781
|
+
Auth2Service.prototype.debugLogin = function (username, password) {
|
|
7782
|
+
// This will fail if debug is null. But when debug is null, this function
|
|
7783
|
+
// should not be called.
|
|
7784
|
+
this.kcConfig.debug.username = username;
|
|
7785
|
+
return this.debugLoadUser(password);
|
|
7786
|
+
};
|
|
7787
|
+
Auth2Service.prototype.debugLoadUser = function (password) {
|
|
7788
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7789
|
+
var currentUser, username, currentUserKey, passKey, masterKey;
|
|
7790
|
+
return __generator(this, function (_b) {
|
|
7791
|
+
switch (_b.label) {
|
|
7792
|
+
case 0: return [4 /*yield*/, this.fetchCurrentUser()];
|
|
7793
|
+
case 1:
|
|
7794
|
+
currentUser = _b.sent();
|
|
7795
|
+
username = currentUser.username, currentUserKey = currentUser.currentUserKey;
|
|
7796
|
+
return [4 /*yield*/, this.keyFactoryService.derivePassKey(Object.assign({ password: password }, currentUserKey.passKey.passKeyParams))];
|
|
7797
|
+
case 2:
|
|
7798
|
+
passKey = (_b.sent()).jwk;
|
|
7799
|
+
return [4 /*yield*/, this.keyGraphService.unwrapWithPassKey(currentUserKey.passKey.id, passKey, currentUserKey.masterKey.id)];
|
|
7800
|
+
case 3:
|
|
7801
|
+
masterKey = _b.sent();
|
|
7802
|
+
return [4 /*yield*/, this.idleService.persistMasterKey(masterKey)];
|
|
7803
|
+
case 4:
|
|
7804
|
+
_b.sent();
|
|
7805
|
+
return [4 /*yield*/, this.keyGraphService.populateKeys(currentUserKey)];
|
|
7806
|
+
case 5:
|
|
7807
|
+
_b.sent();
|
|
7808
|
+
this.user = {
|
|
7809
|
+
username: username,
|
|
7810
|
+
resetUser: null,
|
|
7811
|
+
sub: 'DEBUG_MODE',
|
|
7812
|
+
loginEmail: 'DEBUG_MODE',
|
|
7813
|
+
};
|
|
7814
|
+
return [2 /*return*/, this.user];
|
|
7815
|
+
}
|
|
7816
|
+
});
|
|
7817
|
+
});
|
|
7818
|
+
};
|
|
7819
|
+
/**
|
|
7820
|
+
* Clears the caches user. So we can simulate a page refresh and test getUser().
|
|
7821
|
+
*/
|
|
7822
|
+
Auth2Service.prototype.debugClearUser = function () {
|
|
7823
|
+
this.user = null;
|
|
7824
|
+
};
|
|
7825
|
+
return Auth2Service;
|
|
7826
|
+
}(LrService));
|
|
7827
|
+
exports.Auth2Service.CHALLENGE_TIMEOUT = 1000 * 60 * 5;
|
|
7828
|
+
exports.Auth2Service.ɵprov = i0.ɵɵdefineInjectable({ factory: function Auth2Service_Factory() { return new exports.Auth2Service(i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(i2$2.HttpClient), i0.ɵɵinject(i2.AuthClass), i0.ɵɵinject(exports.ɵf), i0.ɵɵinject(KeyService), i0.ɵɵinject(KeyGraphService), i0.ɵɵinject(KeyFactoryService), i0.ɵɵinject(PasswordService), i0.ɵɵinject(IdleService), i0.ɵɵinject(PersistService), i0.ɵɵinject(EncryptionService), i0.ɵɵinject(exports.ɵi), i0.ɵɵinject(KC_CONFIG)); }, token: exports.Auth2Service, providedIn: "root" });
|
|
7829
|
+
exports.Auth2Service.decorators = [
|
|
7830
|
+
{ type: i0.Injectable, args: [{
|
|
7831
|
+
providedIn: 'root',
|
|
7832
|
+
},] }
|
|
7833
|
+
];
|
|
7834
|
+
exports.Auth2Service.ctorParameters = function () { return [
|
|
7835
|
+
{ type: i0.NgZone },
|
|
7836
|
+
{ type: i0.Injector },
|
|
7837
|
+
{ type: i2$2.HttpClient },
|
|
7838
|
+
{ type: i2.AuthClass },
|
|
7839
|
+
{ type: exports.ɵf },
|
|
7840
|
+
{ type: KeyService },
|
|
7841
|
+
{ type: KeyGraphService },
|
|
7842
|
+
{ type: KeyFactoryService },
|
|
7843
|
+
{ type: PasswordService },
|
|
7844
|
+
{ type: IdleService },
|
|
7845
|
+
{ type: PersistService },
|
|
7846
|
+
{ type: EncryptionService },
|
|
7847
|
+
{ type: exports.ɵi },
|
|
7848
|
+
{ type: undefined, decorators: [{ type: i0.Inject, args: [KC_CONFIG,] }] }
|
|
7849
|
+
]; };
|
|
7850
|
+
exports.Auth2Service = Auth2Service_1 = __decorate([
|
|
7851
|
+
RunOutsideAngular({
|
|
7852
|
+
ngZoneName: 'ngZone',
|
|
7853
|
+
})
|
|
7854
|
+
], exports.Auth2Service);
|
|
7855
|
+
|
|
7856
|
+
(function (FileType) {
|
|
7857
|
+
FileType["RecordContent"] = "record-content";
|
|
7858
|
+
FileType["RecordAttachment"] = "record-attachment";
|
|
7859
|
+
})(exports.FileType || (exports.FileType = {}));
|
|
7860
|
+
var RecordContentFilter = JSON.stringify({
|
|
7861
|
+
filter: [
|
|
7862
|
+
{
|
|
7863
|
+
contains: {
|
|
7864
|
+
fileType: exports.FileType.RecordContent,
|
|
7865
|
+
},
|
|
7866
|
+
},
|
|
7867
|
+
],
|
|
7868
|
+
});
|
|
7869
|
+
var RecordAttachmentFilter = JSON.stringify({
|
|
7870
|
+
filter: [
|
|
7871
|
+
{
|
|
7872
|
+
contains: {
|
|
7873
|
+
fileType: exports.FileType.RecordAttachment,
|
|
7874
|
+
},
|
|
7875
|
+
},
|
|
7876
|
+
],
|
|
7877
|
+
});
|
|
7878
|
+
var GetRecordQuery = function (depth) {
|
|
7879
|
+
if (depth === void 0) { depth = DEFAULT_BREADCRUMB_DEPTH; }
|
|
7880
|
+
return gql__default['default'](templateObject_1$e || (templateObject_1$e = __makeTemplateObject(["\nquery Record(\n $id: LrRelayIdInput!,\n $cachedKeyIds: [LrRelayIdInput!],\n $categoryFilter: LrJSONFilter,\n $contentFilter: LrJSONFilter,\n $attachmentsFilter: LrJSONFilter,\n) {\n record: directory(id: $id) {\n id\n keyId\n archived\n plainMeta\n cipherMeta\n created\n modified\n confidentiality {\n isConfidential\n method\n }\n ", "\n content: childFileLinks(plainMeta: $contentFilter) {\n edges {\n node {\n childFile {\n id\n keyId\n archived\n currentVersion {\n state {\n id\n keyId\n plainMeta\n cipherMeta\n created\n modified\n }\n }\n versions {\n edges {\n node {\n operation\n }\n }\n }\n }\n }\n }\n }\n attachments: childFileLinks(plainMeta: $attachmentsFilter) {\n edges {\n node {\n childFile {\n id\n keyId\n archived\n currentVersion {\n state {\n id\n keyId\n plainMeta\n cipherMeta\n contentResource\n }\n }\n versions {\n edges {\n node {\n operation\n }\n }\n }\n }\n }\n }\n }\n }\n keyGraph(cachedKeyIds: $cachedKeyIds) {\n ...KeyGraphFragment\n }\n}\n", "\n"], ["\nquery Record(\n $id: LrRelayIdInput!,\n $cachedKeyIds: [LrRelayIdInput!],\n $categoryFilter: LrJSONFilter,\n $contentFilter: LrJSONFilter,\n $attachmentsFilter: LrJSONFilter,\n) {\n record: directory(id: $id) {\n id\n keyId\n archived\n plainMeta\n cipherMeta\n created\n modified\n confidentiality {\n isConfidential\n method\n }\n ", "\n content: childFileLinks(plainMeta: $contentFilter) {\n edges {\n node {\n childFile {\n id\n keyId\n archived\n currentVersion {\n state {\n id\n keyId\n plainMeta\n cipherMeta\n created\n modified\n }\n }\n versions {\n edges {\n node {\n operation\n }\n }\n }\n }\n }\n }\n }\n attachments: childFileLinks(plainMeta: $attachmentsFilter) {\n edges {\n node {\n childFile {\n id\n keyId\n archived\n currentVersion {\n state {\n id\n keyId\n plainMeta\n cipherMeta\n contentResource\n }\n }\n versions {\n edges {\n node {\n operation\n }\n }\n }\n }\n }\n }\n }\n }\n keyGraph(cachedKeyIds: $cachedKeyIds) {\n ...KeyGraphFragment\n }\n}\n", "\n"])), parentCategoriesField(depth), KeyGraphFragment);
|
|
7881
|
+
};
|
|
7882
|
+
var CreateRecordContainerMutation = gql__default['default'](templateObject_2$b || (templateObject_2$b = __makeTemplateObject(["\n mutation CreateRecordContainer(\n $plainMeta: LrJSONString\n $cipherMeta: String\n $parentDirectories: [ParentDirectoryInput!]\n $parentRootDirectory: ParentRootDirectoryInput\n ) {\n new: createDirectory(\n input: {\n plainMeta: $plainMeta\n cipherMeta: $cipherMeta\n parentDirectories: $parentDirectories\n parentRootDirectory: $parentRootDirectory\n }\n ) {\n category: directory {\n id\n keyId\n }\n }\n }\n"], ["\n mutation CreateRecordContainer(\n $plainMeta: LrJSONString\n $cipherMeta: String\n $parentDirectories: [ParentDirectoryInput!]\n $parentRootDirectory: ParentRootDirectoryInput\n ) {\n new: createDirectory(\n input: {\n plainMeta: $plainMeta\n cipherMeta: $cipherMeta\n parentDirectories: $parentDirectories\n parentRootDirectory: $parentRootDirectory\n }\n ) {\n category: directory {\n id\n keyId\n }\n }\n }\n"])));
|
|
7883
|
+
var CreateRecordMutation = gql__default['default'](templateObject_3$8 || (templateObject_3$8 = __makeTemplateObject(["\n mutation CreateFile($input: CreateFileInput!) {\n createFile(input: $input) {\n file {\n id\n }\n }\n }\n"], ["\n mutation CreateFile($input: CreateFileInput!) {\n createFile(input: $input) {\n file {\n id\n }\n }\n }\n"])));
|
|
7884
|
+
var UpdateRecordContainerMutation = gql__default['default'](templateObject_4$6 || (templateObject_4$6 = __makeTemplateObject(["\n mutation UpdateRecord($input: UpdateDirectoryInput!) {\n updateDirectory(input: $input) {\n directory {\n id\n }\n }\n }\n"], ["\n mutation UpdateRecord($input: UpdateDirectoryInput!) {\n updateDirectory(input: $input) {\n directory {\n id\n }\n }\n }\n"])));
|
|
7885
|
+
var UpdateRecordMutation = gql__default['default'](templateObject_5$6 || (templateObject_5$6 = __makeTemplateObject(["\n mutation UpdateFile($input: UpdateFileInput!) {\n updateFile(input: $input) {\n file {\n id\n }\n }\n }\n"], ["\n mutation UpdateFile($input: UpdateFileInput!) {\n updateFile(input: $input) {\n file {\n id\n }\n }\n }\n"])));
|
|
7886
|
+
var DeleteRecordMutation = gql__default['default'](templateObject_6$5 || (templateObject_6$5 = __makeTemplateObject(["\n mutation DeleteRecord($recordId: LrRelayIdInput!) {\n deleteDirectory(input: { directoryId: $recordId }) {\n id\n }\n }\n"], ["\n mutation DeleteRecord($recordId: LrRelayIdInput!) {\n deleteDirectory(input: { directoryId: $recordId }) {\n id\n }\n }\n"])));
|
|
7887
|
+
var CreateFileMutation = gql__default['default'](templateObject_7$4 || (templateObject_7$4 = __makeTemplateObject(["\n mutation CreateFile($input: CreateFileInput!) {\n createFile(input: $input) {\n file {\n id\n }\n }\n }\n"], ["\n mutation CreateFile($input: CreateFileInput!) {\n createFile(input: $input) {\n file {\n id\n }\n }\n }\n"])));
|
|
7888
|
+
var DeleteFileMutation = gql__default['default'](templateObject_8$4 || (templateObject_8$4 = __makeTemplateObject(["\n mutation DeleteFile($fileId: LrRelayIdInput!) {\n deleteFile(input: { fileId: $fileId }) {\n id\n }\n }\n"], ["\n mutation DeleteFile($fileId: LrRelayIdInput!) {\n deleteFile(input: { fileId: $fileId }) {\n id\n }\n }\n"])));
|
|
7889
|
+
var templateObject_1$e, templateObject_2$b, templateObject_3$8, templateObject_4$6, templateObject_5$6, templateObject_6$5, templateObject_7$4, templateObject_8$4;
|
|
7890
|
+
|
|
7891
|
+
var CategoryService = /** @class */ (function () {
|
|
7892
|
+
function CategoryService(lrApollo, keyMetaService, keyGraph) {
|
|
7893
|
+
this.lrApollo = lrApollo;
|
|
7894
|
+
this.keyMetaService = keyMetaService;
|
|
7895
|
+
this.keyGraph = keyGraph;
|
|
7896
|
+
}
|
|
7897
|
+
CategoryService.prototype.getRootDirectoryIds = function (input) {
|
|
7898
|
+
if (input === void 0) { input = null; }
|
|
7899
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7900
|
+
var rootDirectories;
|
|
7901
|
+
return __generator(this, function (_b) {
|
|
7902
|
+
switch (_b.label) {
|
|
7903
|
+
case 0: return [4 /*yield*/, this.lrApollo.query({
|
|
7904
|
+
query: GetRootDirectoryIdsQuery,
|
|
7905
|
+
variables: {
|
|
7906
|
+
archived: input && input.archived,
|
|
7907
|
+
},
|
|
7908
|
+
})];
|
|
7909
|
+
case 1:
|
|
7910
|
+
rootDirectories = (_b.sent()).rootDirectories;
|
|
7911
|
+
return [2 /*return*/, rootDirectories.edges.map(function (edge) { return edge.node.id; })];
|
|
7912
|
+
}
|
|
7913
|
+
});
|
|
7914
|
+
});
|
|
7915
|
+
};
|
|
7916
|
+
CategoryService.prototype.getDefaultVault = function () {
|
|
7917
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7918
|
+
var list, defaultVaults;
|
|
7919
|
+
return __generator(this, function (_b) {
|
|
7920
|
+
switch (_b.label) {
|
|
7921
|
+
case 0: return [4 /*yield*/, this.lrApollo.query({
|
|
7922
|
+
query: GetVaultsQuery,
|
|
7923
|
+
variables: {
|
|
7924
|
+
plainMetaFilter: DefaultVaultFilter,
|
|
7925
|
+
},
|
|
7926
|
+
})];
|
|
7927
|
+
case 1:
|
|
7928
|
+
list = (_b.sent()).list;
|
|
7929
|
+
return [4 /*yield*/, this.mapVaults(list)];
|
|
7930
|
+
case 2:
|
|
7931
|
+
defaultVaults = _b.sent();
|
|
7932
|
+
if (defaultVaults.length > 1) {
|
|
7933
|
+
throw new KcBadStateException('There are more than one default vaults');
|
|
7934
|
+
}
|
|
7935
|
+
return [2 /*return*/, defaultVaults[0] || null];
|
|
7936
|
+
}
|
|
7937
|
+
});
|
|
7938
|
+
});
|
|
7939
|
+
};
|
|
7940
|
+
CategoryService.prototype.getCategories = function (input) {
|
|
7941
|
+
var _a;
|
|
7942
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7943
|
+
var vaultDirectoryId, _b, res;
|
|
7944
|
+
return __generator(this, function (_c) {
|
|
7945
|
+
switch (_c.label) {
|
|
7946
|
+
case 0:
|
|
7947
|
+
_b = (input === null || input === void 0 ? void 0 : input.vaultDirectoryId);
|
|
7948
|
+
if (_b) return [3 /*break*/, 2];
|
|
7949
|
+
return [4 /*yield*/, this.getDefaultVault()];
|
|
7950
|
+
case 1:
|
|
7951
|
+
_b = ((_a = (_c.sent())) === null || _a === void 0 ? void 0 : _a.id);
|
|
7952
|
+
_c.label = 2;
|
|
7953
|
+
case 2:
|
|
7954
|
+
vaultDirectoryId = _b;
|
|
7955
|
+
if (!vaultDirectoryId) {
|
|
7956
|
+
console.error('There is no default vault.');
|
|
7957
|
+
return [2 /*return*/, []];
|
|
7958
|
+
}
|
|
7959
|
+
return [4 /*yield*/, this.lrApollo.query({
|
|
7960
|
+
query: GetCategoriesQuery,
|
|
7961
|
+
variables: {
|
|
7962
|
+
vaultDirectoryId: vaultDirectoryId,
|
|
7963
|
+
categoryFilter: CategoryFilter,
|
|
7964
|
+
recordFilter: RecordFilter,
|
|
7965
|
+
archived: input === null || input === void 0 ? void 0 : input.archived,
|
|
7966
|
+
},
|
|
7967
|
+
})];
|
|
7968
|
+
case 3:
|
|
7969
|
+
res = _c.sent();
|
|
7970
|
+
return [2 /*return*/, this.mapCategories(res.directory.childDirectoryLinks)];
|
|
7971
|
+
}
|
|
7972
|
+
});
|
|
7973
|
+
});
|
|
7974
|
+
};
|
|
7975
|
+
CategoryService.prototype.getTrustedPartyCategories = function (trustedPartyId) {
|
|
7976
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7977
|
+
var tp, _b;
|
|
7978
|
+
return __generator(this, function (_c) {
|
|
7979
|
+
switch (_c.label) {
|
|
7980
|
+
case 0: return [4 /*yield*/, this.lrApollo.query({
|
|
7981
|
+
query: GetTrustedPartyCategoriesQuery,
|
|
7982
|
+
variables: {
|
|
7983
|
+
trustedPartyId: trustedPartyId,
|
|
7984
|
+
categoryFilter: CategoryFilter,
|
|
7985
|
+
recordFilter: RecordFilter,
|
|
7986
|
+
contentFilter: RecordContentFilter,
|
|
7121
7987
|
},
|
|
7122
7988
|
})];
|
|
7123
7989
|
case 1:
|
|
@@ -7705,14 +8571,14 @@
|
|
|
7705
8571
|
};
|
|
7706
8572
|
return CategoryMetaService;
|
|
7707
8573
|
}());
|
|
7708
|
-
CategoryMetaService.ɵprov = i0.ɵɵdefineInjectable({ factory: function CategoryMetaService_Factory() { return new CategoryMetaService(i0.ɵɵinject(i2$
|
|
8574
|
+
CategoryMetaService.ɵprov = i0.ɵɵdefineInjectable({ factory: function CategoryMetaService_Factory() { return new CategoryMetaService(i0.ɵɵinject(i2$2.HttpClient), i0.ɵɵinject(CategoryService)); }, token: CategoryMetaService, providedIn: "root" });
|
|
7709
8575
|
CategoryMetaService.decorators = [
|
|
7710
8576
|
{ type: i0.Injectable, args: [{
|
|
7711
8577
|
providedIn: 'root',
|
|
7712
8578
|
},] }
|
|
7713
8579
|
];
|
|
7714
8580
|
CategoryMetaService.ctorParameters = function () { return [
|
|
7715
|
-
{ type: i2$
|
|
8581
|
+
{ type: i2$2.HttpClient },
|
|
7716
8582
|
{ type: CategoryService }
|
|
7717
8583
|
]; };
|
|
7718
8584
|
|
|
@@ -7776,10 +8642,10 @@
|
|
|
7776
8642
|
return Vault;
|
|
7777
8643
|
}());
|
|
7778
8644
|
|
|
7779
|
-
var CreateContactCardMutation$2 = gqlTyped(templateObject_1$
|
|
7780
|
-
var UpdateContactCardMutation$2 = gqlTyped(templateObject_2$
|
|
8645
|
+
var CreateContactCardMutation$2 = gqlTyped(templateObject_1$f || (templateObject_1$f = __makeTemplateObject(["\nmutation CreateContactCardMutation(\n $input: CreateContactCardInput!\n) {\n createContactCard(input: $input) {\n contactCard {\n id\n }\n }\n}\n"], ["\nmutation CreateContactCardMutation(\n $input: CreateContactCardInput!\n) {\n createContactCard(input: $input) {\n contactCard {\n id\n }\n }\n}\n"])));
|
|
8646
|
+
var UpdateContactCardMutation$2 = gqlTyped(templateObject_2$c || (templateObject_2$c = __makeTemplateObject(["\nmutation UpdateContactCardMutation($input: UpdateContactCardInput!) {\n updateContactCard(input: $input) {\n contactCard {\n id\n }\n }\n}\n"], ["\nmutation UpdateContactCardMutation($input: UpdateContactCardInput!) {\n updateContactCard(input: $input) {\n contactCard {\n id\n }\n }\n}\n"])));
|
|
7781
8647
|
var DeleteContactCardMutation$1 = gqlTyped(templateObject_3$9 || (templateObject_3$9 = __makeTemplateObject(["\nmutation DeleteContactCardMutation($input: DeleteContactCardInput!) {\n deleteContactCard(input: $input) {\n id\n }\n}\n"], ["\nmutation DeleteContactCardMutation($input: DeleteContactCardInput!) {\n deleteContactCard(input: $input) {\n id\n }\n}\n"])));
|
|
7782
|
-
var templateObject_1$
|
|
8648
|
+
var templateObject_1$f, templateObject_2$c, templateObject_3$9;
|
|
7783
8649
|
|
|
7784
8650
|
var OwnerPlainDataJson = /** @class */ (function () {
|
|
7785
8651
|
function OwnerPlainDataJson() {
|
|
@@ -7800,20 +8666,19 @@
|
|
|
7800
8666
|
var rootKey, key, wrappedKey, cipherData, params;
|
|
7801
8667
|
return __generator(this, function (_a) {
|
|
7802
8668
|
switch (_a.label) {
|
|
7803
|
-
case 0:
|
|
7804
|
-
|
|
7805
|
-
rootKey = _a.sent();
|
|
8669
|
+
case 0:
|
|
8670
|
+
rootKey = this.keyService.currentRootKey;
|
|
7806
8671
|
return [4 /*yield*/, this.keyFactory.createKey()];
|
|
7807
|
-
case
|
|
8672
|
+
case 1:
|
|
7808
8673
|
key = _a.sent();
|
|
7809
8674
|
return [4 /*yield*/, this.keyGraph.encryptToString(rootKey.jwk, key.toJSON(true))];
|
|
7810
|
-
case
|
|
8675
|
+
case 2:
|
|
7811
8676
|
wrappedKey = _a.sent();
|
|
7812
8677
|
return [4 /*yield*/, this.keyGraph.encryptToString(key, input.plainCipherDataJson)];
|
|
7813
|
-
case
|
|
8678
|
+
case 3:
|
|
7814
8679
|
cipherData = _a.sent();
|
|
7815
8680
|
return [4 /*yield*/, this.prepareContactCardInput(input)];
|
|
7816
|
-
case
|
|
8681
|
+
case 4:
|
|
7817
8682
|
params = _a.sent();
|
|
7818
8683
|
return [2 /*return*/, new LrMutation({
|
|
7819
8684
|
mutation: CreateContactCardMutation$2,
|
|
@@ -7862,20 +8727,19 @@
|
|
|
7862
8727
|
var sigPxk, publicDataSig, _a, _b, publicSearchableSig, _c, _d, plainDataSig, _e, _f;
|
|
7863
8728
|
return __generator(this, function (_g) {
|
|
7864
8729
|
switch (_g.label) {
|
|
7865
|
-
case 0:
|
|
7866
|
-
|
|
7867
|
-
sigPxk = _g.sent();
|
|
8730
|
+
case 0:
|
|
8731
|
+
sigPxk = this.keyService.currentSigPxk;
|
|
7868
8732
|
_b = (_a = JSON).stringify;
|
|
7869
8733
|
return [4 /*yield*/, this.encryptionService.sign(sigPxk.jwk, input.publicDataJson)];
|
|
7870
|
-
case
|
|
8734
|
+
case 1:
|
|
7871
8735
|
publicDataSig = _b.apply(_a, [_g.sent()]);
|
|
7872
8736
|
_d = (_c = JSON).stringify;
|
|
7873
8737
|
return [4 /*yield*/, this.encryptionService.sign(sigPxk.jwk, input.publicSearchableJson)];
|
|
7874
|
-
case
|
|
8738
|
+
case 2:
|
|
7875
8739
|
publicSearchableSig = _d.apply(_c, [_g.sent()]);
|
|
7876
8740
|
_f = (_e = JSON).stringify;
|
|
7877
8741
|
return [4 /*yield*/, this.encryptionService.sign(sigPxk.jwk, input.plainDataJson)];
|
|
7878
|
-
case
|
|
8742
|
+
case 3:
|
|
7879
8743
|
plainDataSig = _f.apply(_e, [_g.sent()]);
|
|
7880
8744
|
return [2 /*return*/, {
|
|
7881
8745
|
sigPxkId: sigPxk.id,
|
|
@@ -7989,7 +8853,7 @@
|
|
|
7989
8853
|
};
|
|
7990
8854
|
return FileUploadService;
|
|
7991
8855
|
}());
|
|
7992
|
-
FileUploadService.ɵprov = i0.ɵɵdefineInjectable({ factory: function FileUploadService_Factory() { return new FileUploadService(i0.ɵɵinject(KC_CONFIG), i0.ɵɵinject(i2$
|
|
8856
|
+
FileUploadService.ɵprov = i0.ɵɵdefineInjectable({ factory: function FileUploadService_Factory() { return new FileUploadService(i0.ɵɵinject(KC_CONFIG), i0.ɵɵinject(i2$2.HttpClient), i0.ɵɵinject(i2.AuthClass)); }, token: FileUploadService, providedIn: "root" });
|
|
7993
8857
|
FileUploadService.decorators = [
|
|
7994
8858
|
{ type: i0.Injectable, args: [{
|
|
7995
8859
|
providedIn: 'root',
|
|
@@ -7997,15 +8861,15 @@
|
|
|
7997
8861
|
];
|
|
7998
8862
|
FileUploadService.ctorParameters = function () { return [
|
|
7999
8863
|
{ type: undefined, decorators: [{ type: i0.Inject, args: [KC_CONFIG,] }] },
|
|
8000
|
-
{ type: i2$
|
|
8001
|
-
{ type:
|
|
8864
|
+
{ type: i2$2.HttpClient },
|
|
8865
|
+
{ type: i2.AuthClass }
|
|
8002
8866
|
]; };
|
|
8003
8867
|
|
|
8004
|
-
var LockFragment = gqlTyped(templateObject_1$
|
|
8005
|
-
var UpdateLockMutation = gqlTyped(templateObject_2$
|
|
8868
|
+
var LockFragment = gqlTyped(templateObject_1$g || (templateObject_1$g = __makeTemplateObject(["\nfragment LockFragment on LockField {\n created\n modified\n version\n expiryTime\n state\n}"], ["\nfragment LockFragment on LockField {\n created\n modified\n version\n expiryTime\n state\n}"])));
|
|
8869
|
+
var UpdateLockMutation = gqlTyped(templateObject_2$d || (templateObject_2$d = __makeTemplateObject(["\nmutation UpdateLockMutation($input: UpdateLockInput!) {\n updateLock(input: $input) {\n lock {\n ...LockFragment\n }\n }\n}\n", "\n"], ["\nmutation UpdateLockMutation($input: UpdateLockInput!) {\n updateLock(input: $input) {\n lock {\n ...LockFragment\n }\n }\n}\n", "\n"])), LockFragment);
|
|
8006
8870
|
var AcquireLockMutation = gqlTyped(templateObject_3$a || (templateObject_3$a = __makeTemplateObject(["\nmutation AcquireLockMutation($input: AcquireLockInput!) {\n acquireLock(input: $input) {\n lock {\n ...LockFragment\n }\n }\n}\n", "\n"], ["\nmutation AcquireLockMutation($input: AcquireLockInput!) {\n acquireLock(input: $input) {\n lock {\n ...LockFragment\n }\n }\n}\n", "\n"])), LockFragment);
|
|
8007
8871
|
var ReleaseLockMutation = gqlTyped(templateObject_4$7 || (templateObject_4$7 = __makeTemplateObject(["\nmutation ReleaseLockMutation($input: ReleaseLockInput!) {\n releaseLock(input: $input) {\n lock {\n ...LockFragment\n }\n }\n}\n", "\n"], ["\nmutation ReleaseLockMutation($input: ReleaseLockInput!) {\n releaseLock(input: $input) {\n lock {\n ...LockFragment\n }\n }\n}\n", "\n"])), LockFragment);
|
|
8008
|
-
var templateObject_1$
|
|
8872
|
+
var templateObject_1$g, templateObject_2$d, templateObject_3$a, templateObject_4$7;
|
|
8009
8873
|
|
|
8010
8874
|
exports.LockService = /** @class */ (function (_super) {
|
|
8011
8875
|
__extends(LockService, _super);
|
|
@@ -8067,8 +8931,8 @@
|
|
|
8067
8931
|
})
|
|
8068
8932
|
], exports.LockService);
|
|
8069
8933
|
|
|
8070
|
-
var CreateDirectoryMutation = gqlTyped(templateObject_1$
|
|
8071
|
-
var UpdateDirectoryMutation = gqlTyped(templateObject_2$
|
|
8934
|
+
var CreateDirectoryMutation = gqlTyped(templateObject_1$h || (templateObject_1$h = __makeTemplateObject(["\nmutation CreateDirectoryMutation($input: CreateDirectoryInput!) {\n createDirectory(input: $input) {\n directory {\n id\n keyId\n }\n }\n}\n"], ["\nmutation CreateDirectoryMutation($input: CreateDirectoryInput!) {\n createDirectory(input: $input) {\n directory {\n id\n keyId\n }\n }\n}\n"])));
|
|
8935
|
+
var UpdateDirectoryMutation = gqlTyped(templateObject_2$e || (templateObject_2$e = __makeTemplateObject(["\nmutation UpdateDirectoryMutation($input: UpdateDirectoryInput!) {\n updateDirectory(input: $input) {\n directory {\n id\n modified\n }\n }\n}\n"], ["\nmutation UpdateDirectoryMutation($input: UpdateDirectoryInput!) {\n updateDirectory(input: $input) {\n directory {\n id\n modified\n }\n }\n}\n"])));
|
|
8072
8936
|
var DeleteDirectoryMutation = gqlTyped(templateObject_3$b || (templateObject_3$b = __makeTemplateObject(["\nmutation DeleteDirectoryMutation($input: DeleteDirectoryInput!) {\n deleteDirectory(input: $input) {\n id\n }\n}\n"], ["\nmutation DeleteDirectoryMutation($input: DeleteDirectoryInput!) {\n deleteDirectory(input: $input) {\n id\n }\n}\n"])));
|
|
8073
8937
|
var CreateFileMutation$1 = gqlTyped(templateObject_4$8 || (templateObject_4$8 = __makeTemplateObject(["\nmutation CreateFileMutation($input: CreateFileInput!) {\n createFile(input: $input) {\n file {\n id\n keyId\n }\n }\n}\n"], ["\nmutation CreateFileMutation($input: CreateFileInput!) {\n createFile(input: $input) {\n file {\n id\n keyId\n }\n }\n}\n"])));
|
|
8074
8938
|
var UpdateFileMutation = gqlTyped(templateObject_5$7 || (templateObject_5$7 = __makeTemplateObject(["\nmutation UpdateFileMutation($input: UpdateFileInput!) {\n updateFile(input: $input) {\n file {\n id\n }\n }\n}\n"], ["\nmutation UpdateFileMutation($input: UpdateFileInput!) {\n updateFile(input: $input) {\n file {\n id\n }\n }\n}\n"])));
|
|
@@ -8084,17 +8948,17 @@
|
|
|
8084
8948
|
var TempDirectoryQuery = gqlTyped(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\nquery TempDirectoryQuery($plainMeta: LrJSONFilter!) {\n rootDirectories(plainMeta: $plainMeta, first: 2, orderBy: \"created\") {\n edges {\n node {\n id\n keyId\n }\n }\n }\n lock {\n version\n }\n}\n"], ["\nquery TempDirectoryQuery($plainMeta: LrJSONFilter!) {\n rootDirectories(plainMeta: $plainMeta, first: 2, orderBy: \"created\") {\n edges {\n node {\n id\n keyId\n }\n }\n }\n lock {\n version\n }\n}\n"])));
|
|
8085
8949
|
var SetFileConfidentialMutation = gqlTyped(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\nmutation SetFileConfidentialMutation($input: SetFileConfidentialInput!) {\n setFileConfidential(input: $input) {\n file {\n id\n }\n }\n}\n"], ["\nmutation SetFileConfidentialMutation($input: SetFileConfidentialInput!) {\n setFileConfidential(input: $input) {\n file {\n id\n }\n }\n}\n"])));
|
|
8086
8950
|
var SetDirectoryConfidentialMutation = gqlTyped(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\nmutation SetDirectoryConfidentialMutation($input: SetDirectoryConfidentialInput!) {\n setDirectoryConfidential(input: $input) {\n directory {\n id\n }\n }\n}\n"], ["\nmutation SetDirectoryConfidentialMutation($input: SetDirectoryConfidentialInput!) {\n setDirectoryConfidential(input: $input) {\n directory {\n id\n }\n }\n}\n"])));
|
|
8087
|
-
var templateObject_1$
|
|
8951
|
+
var templateObject_1$h, templateObject_2$e, templateObject_3$b, templateObject_4$8, templateObject_5$7, templateObject_6$6, templateObject_7$5, templateObject_8$5, templateObject_9$3, templateObject_10$2, templateObject_11$1, templateObject_12$1, templateObject_13$1, templateObject_14, templateObject_15, templateObject_16, templateObject_17;
|
|
8088
8952
|
|
|
8089
|
-
var DirectoryKeyQuery = gqlTyped(templateObject_1$
|
|
8090
|
-
var FileKeyQuery = gqlTyped(templateObject_2$
|
|
8953
|
+
var DirectoryKeyQuery = gqlTyped(templateObject_1$i || (templateObject_1$i = __makeTemplateObject(["\nquery DirectoryKeyQuery($id: LrRelayIdInput!) {\n directory(id: $id) {\n keyId\n }\n}\n"], ["\nquery DirectoryKeyQuery($id: LrRelayIdInput!) {\n directory(id: $id) {\n keyId\n }\n}\n"])));
|
|
8954
|
+
var FileKeyQuery = gqlTyped(templateObject_2$f || (templateObject_2$f = __makeTemplateObject(["\nquery FileKeyQuery($id: LrRelayIdInput!) {\n file(id: $id) {\n keyId\n }\n}\n"], ["\nquery FileKeyQuery($id: LrRelayIdInput!) {\n file(id: $id) {\n keyId\n }\n}\n"])));
|
|
8091
8955
|
var FileStateKeyQuery = gqlTyped(templateObject_3$c || (templateObject_3$c = __makeTemplateObject(["\nquery FileStateKeyQuery($id: LrRelayIdInput!) {\n fileState(id: $id) {\n keyId\n }\n}\n"], ["\nquery FileStateKeyQuery($id: LrRelayIdInput!) {\n fileState(id: $id) {\n keyId\n }\n}\n"])));
|
|
8092
|
-
var templateObject_1$
|
|
8956
|
+
var templateObject_1$i, templateObject_2$f, templateObject_3$c;
|
|
8093
8957
|
|
|
8094
8958
|
var Item2Service_1;
|
|
8095
8959
|
exports.Item2Service = Item2Service_1 = /** @class */ (function (_super) {
|
|
8096
8960
|
__extends(Item2Service, _super);
|
|
8097
|
-
function Item2Service(ngZone, injector, fileUploadService, keyService, keyFactory, keyGraph, lockService,
|
|
8961
|
+
function Item2Service(ngZone, injector, fileUploadService, keyService, keyFactory, keyGraph, lockService, auth2Service) {
|
|
8098
8962
|
var _this = _super.call(this, injector) || this;
|
|
8099
8963
|
_this.ngZone = ngZone;
|
|
8100
8964
|
_this.injector = injector;
|
|
@@ -8103,10 +8967,10 @@
|
|
|
8103
8967
|
_this.keyFactory = keyFactory;
|
|
8104
8968
|
_this.keyGraph = keyGraph;
|
|
8105
8969
|
_this.lockService = lockService;
|
|
8106
|
-
_this.
|
|
8970
|
+
_this.auth2Service = auth2Service;
|
|
8107
8971
|
// Caching the temp directory.
|
|
8108
8972
|
_this.tempDirectory = null;
|
|
8109
|
-
_this.
|
|
8973
|
+
_this.auth2Service.addLogoutListener(function () { return _this.onLogout(); });
|
|
8110
8974
|
return _this;
|
|
8111
8975
|
}
|
|
8112
8976
|
Item2Service.prototype.downloadFileContent = function (options) {
|
|
@@ -8792,7 +9656,7 @@
|
|
|
8792
9656
|
case 2:
|
|
8793
9657
|
parentDirectories = _e.sent();
|
|
8794
9658
|
if (!options.asRootDirectory) return [3 /*break*/, 4];
|
|
8795
|
-
rootKey = this.keyService.
|
|
9659
|
+
rootKey = this.keyService.currentRootKey;
|
|
8796
9660
|
_d = {
|
|
8797
9661
|
wrappingKeyId: rootKey.id
|
|
8798
9662
|
};
|
|
@@ -8895,147 +9759,69 @@
|
|
|
8895
9759
|
});
|
|
8896
9760
|
};
|
|
8897
9761
|
Item2Service.prototype.prepareChangeFileParents = function (options) {
|
|
8898
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
8899
|
-
var fileKey, input;
|
|
8900
|
-
return __generator(this, function (_d) {
|
|
8901
|
-
switch (_d.label) {
|
|
8902
|
-
case 0: return [4 /*yield*/, this.getFileKey(options.fileId, options.fileKeyId)];
|
|
8903
|
-
case 1:
|
|
8904
|
-
fileKey = _d.sent();
|
|
8905
|
-
return [4 /*yield*/, this.prepareChangeItemParents(options, fileKey.jwk)];
|
|
8906
|
-
case 2:
|
|
8907
|
-
input = _d.sent();
|
|
8908
|
-
return [2 /*return*/, Object.assign(Object.assign({}, input), { fileId: options.fileId })];
|
|
8909
|
-
}
|
|
8910
|
-
});
|
|
8911
|
-
});
|
|
8912
|
-
};
|
|
8913
|
-
Item2Service.prototype.onLogout = function () {
|
|
8914
|
-
// Clear all cached data.
|
|
8915
|
-
this.tempDirectory = null;
|
|
8916
|
-
};
|
|
8917
|
-
return Item2Service;
|
|
8918
|
-
}(LrService));
|
|
8919
|
-
exports.Item2Service.TEMP_DIRECTORY_PLAIN_META = { kcType: 'temp' };
|
|
8920
|
-
exports.Item2Service.TEMP_DIRECTORY_PLAIN_META_FILTER = JSON.stringify({
|
|
8921
|
-
filter: [
|
|
8922
|
-
{
|
|
8923
|
-
contains: Item2Service_1.TEMP_DIRECTORY_PLAIN_META,
|
|
8924
|
-
},
|
|
8925
|
-
],
|
|
8926
|
-
});
|
|
8927
|
-
exports.Item2Service.ɵprov = i0.ɵɵdefineInjectable({ factory: function Item2Service_Factory() { return new exports.Item2Service(i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(FileUploadService), i0.ɵɵinject(KeyService), i0.ɵɵinject(KeyFactoryService), i0.ɵɵinject(KeyGraphService), i0.ɵɵinject(exports.LockService), i0.ɵɵinject(LifeReadyAuthService)); }, token: exports.Item2Service, providedIn: "root" });
|
|
8928
|
-
exports.Item2Service.decorators = [
|
|
8929
|
-
{ type: i0.Injectable, args: [{
|
|
8930
|
-
providedIn: 'root',
|
|
8931
|
-
},] }
|
|
8932
|
-
];
|
|
8933
|
-
exports.Item2Service.ctorParameters = function () { return [
|
|
8934
|
-
{ type: i0.NgZone },
|
|
8935
|
-
{ type: i0.Injector },
|
|
8936
|
-
{ type: FileUploadService },
|
|
8937
|
-
{ type: KeyService },
|
|
8938
|
-
{ type: KeyFactoryService },
|
|
8939
|
-
{ type: KeyGraphService },
|
|
8940
|
-
{ type: exports.LockService },
|
|
8941
|
-
{ type: LifeReadyAuthService }
|
|
8942
|
-
]; };
|
|
8943
|
-
exports.Item2Service = Item2Service_1 = __decorate([
|
|
8944
|
-
RunOutsideAngular({
|
|
8945
|
-
ngZoneName: 'ngZone',
|
|
8946
|
-
})
|
|
8947
|
-
], exports.Item2Service);
|
|
8948
|
-
|
|
8949
|
-
var KeyExchangeFields = "\n id\n token\n state\n mode\n isInitiator\n initiator {\n id\n username\n }\n responder {\n id\n username\n }\n created\n modified\n tokenExpiryTime\n isExpired\n initiatorRootKeyCipher\n initiatorActionRequired\n responderActionRequired\n responderEmailAddress\n otk {\n state\n otKeyParams\n otKeyCipher\n sharedKey {\n id\n }\n mkSharedKey {\n id\n }\n initiatorSigPxk {\n id\n }\n responderSigPxk {\n id\n }\n initiatorOneTimePbkCipher\n responderPbkCipher\n}";
|
|
8950
|
-
var UserSharedKeyFields = "\n userSigPrk {\n id\n }\n otherSigPbk {\n id\n }\n sharedKey {\n id\n }\n mkSharedKey {\n id\n }\n mkPxk {\n id\n pbk\n }\n mkReshareRequestCipher\n mkReshareResponseCipher\n mkReshareRequestSent\n mkReshareResponseSent\n";
|
|
8951
|
-
var CurrentUserSharedKeyQuery = gql__default['default'](templateObject_1$i || (templateObject_1$i = __makeTemplateObject(["\nquery CurrentUserSharedKeyQuery(\n $username: String\n $userId: LrRelayIdInput\n $cachedKeyIds: [LrRelayIdInput!]\n) {\n currentUserSharedKey(\n username: $username\n userId: $userId\n ) {\n userSharedKey {\n ", "\n }\n }\n keyGraph(cachedKeyIds: $cachedKeyIds) {\n ...KeyGraphFragment\n }\n}\n", ""], ["\nquery CurrentUserSharedKeyQuery(\n $username: String\n $userId: LrRelayIdInput\n $cachedKeyIds: [LrRelayIdInput!]\n) {\n currentUserSharedKey(\n username: $username\n userId: $userId\n ) {\n userSharedKey {\n ", "\n }\n }\n keyGraph(cachedKeyIds: $cachedKeyIds) {\n ...KeyGraphFragment\n }\n}\n", ""])), UserSharedKeyFields, KeyGraphFragment);
|
|
8952
|
-
var KeyExchangesQuery = gql__default['default'](templateObject_2$f || (templateObject_2$f = __makeTemplateObject(["\nquery KeyExchangeQuery(\n$orderBy: String\n$isExpired: Boolean\n$initiatorActionRequired: Boolean\n$responderActionRequired: Boolean\n$initiator: ID\n$responder: ID\n$state: String\n) {\nkeyExchanges(\n orderBy: $orderBy\n isExpired: $isExpired\n initiatorActionRequired: $initiatorActionRequired\n responderActionRequired: $responderActionRequired\n initiator: $initiator\n responder: $responder\n state: $state\n) {\n edges {\n node {\n ", "\n }\n }\n}\nkeyGraph {\n ...KeyGraphFragment\n}\n}\n", "\n"], ["\nquery KeyExchangeQuery(\n$orderBy: String\n$isExpired: Boolean\n$initiatorActionRequired: Boolean\n$responderActionRequired: Boolean\n$initiator: ID\n$responder: ID\n$state: String\n) {\nkeyExchanges(\n orderBy: $orderBy\n isExpired: $isExpired\n initiatorActionRequired: $initiatorActionRequired\n responderActionRequired: $responderActionRequired\n initiator: $initiator\n responder: $responder\n state: $state\n) {\n edges {\n node {\n ", "\n }\n }\n}\nkeyGraph {\n ...KeyGraphFragment\n}\n}\n", "\n"])), KeyExchangeFields, KeyGraphFragment);
|
|
8953
|
-
var KeyExchangeQuery = gql__default['default'](templateObject_3$d || (templateObject_3$d = __makeTemplateObject(["\nquery KeyExchangeQuery(\n $id: LrRelayIdInput!\n) {\n keyExchange(\n id: $id\n ) {\n ", "\n }\n keyGraph {\n ...KeyGraphFragment\n }\n}\n", "\n"], ["\nquery KeyExchangeQuery(\n $id: LrRelayIdInput!\n) {\n keyExchange(\n id: $id\n ) {\n ", "\n }\n keyGraph {\n ...KeyGraphFragment\n }\n}\n", "\n"])), KeyExchangeFields, KeyGraphFragment);
|
|
8954
|
-
// Key graph is only available for authenticated users. This query
|
|
8955
|
-
// is for unauthenticated users.
|
|
8956
|
-
var KeyExchangeTokenQuery = gql__default['default'](templateObject_4$9 || (templateObject_4$9 = __makeTemplateObject(["\nquery KeyExchangeQuery(\n $id: LrRelayIdInput!\n $token: String\n) {\n keyExchange(\n id: $id\n token: $token\n ) {\n ", "\n }\n}"], ["\nquery KeyExchangeQuery(\n $id: LrRelayIdInput!\n $token: String\n) {\n keyExchange(\n id: $id\n token: $token\n ) {\n ", "\n }\n}"])), KeyExchangeFields);
|
|
8957
|
-
var InitiateOtkMutation = gql__default['default'](templateObject_5$8 || (templateObject_5$8 = __makeTemplateObject(["\nmutation InitiateKeyExchangeOtk(\n$input: InitiateKeyExchangeOtkInput!\n) {\ninitiateKeyExchangeOtk(input: $input) {\n keyExchange {\n ", "\n }\n}\n", "\n}"], ["\nmutation InitiateKeyExchangeOtk(\n$input: InitiateKeyExchangeOtkInput!\n) {\ninitiateKeyExchangeOtk(input: $input) {\n keyExchange {\n ", "\n }\n}\n", "\n}"])), KeyExchangeFields, FetchKeyGraphField);
|
|
8958
|
-
var RespondOtkMutation = gql__default['default'](templateObject_6$7 || (templateObject_6$7 = __makeTemplateObject(["\nmutation RespondKeyExchangeOtk(\n $input: RespondKeyExchangeOtkInput!\n) {\n respondKeyExchangeOtk(input: $input) {\n keyExchange {\n ", "\n }\n userSharedKey {\n ", "\n }\n tp {\n id\n }\n }\n}"], ["\nmutation RespondKeyExchangeOtk(\n $input: RespondKeyExchangeOtkInput!\n) {\n respondKeyExchangeOtk(input: $input) {\n keyExchange {\n ", "\n }\n userSharedKey {\n ", "\n }\n tp {\n id\n }\n }\n}"])), KeyExchangeFields, UserSharedKeyFields);
|
|
8959
|
-
var CompleteOtkMutation = gql__default['default'](templateObject_7$6 || (templateObject_7$6 = __makeTemplateObject(["\nmutation CompleteKeyExchangeOtk(\n $input: CompleteKeyExchangeOtkInput!\n) {\n completeKeyExchangeOtk(input: $input) {\n keyExchange {\n ", "\n }\n userSharedKey {\n ", "\n }\n tp {\n id\n }\n }\n}"], ["\nmutation CompleteKeyExchangeOtk(\n $input: CompleteKeyExchangeOtkInput!\n) {\n completeKeyExchangeOtk(input: $input) {\n keyExchange {\n ", "\n }\n userSharedKey {\n ", "\n }\n tp {\n id\n }\n }\n}"])), KeyExchangeFields, UserSharedKeyFields);
|
|
8960
|
-
var templateObject_1$i, templateObject_2$f, templateObject_3$d, templateObject_4$9, templateObject_5$8, templateObject_6$7, templateObject_7$6;
|
|
8961
|
-
|
|
8962
|
-
var RequestUserDeleteMutation = gql__default['default'](templateObject_1$j || (templateObject_1$j = __makeTemplateObject(["\n mutation RequestUserDelete($input: RequestUserDeleteInput!) {\n requestUserDelete(input: $input) {\n userDelete {\n state\n created\n }\n }\n }\n"], ["\n mutation RequestUserDelete($input: RequestUserDeleteInput!) {\n requestUserDelete(input: $input) {\n userDelete {\n state\n created\n }\n }\n }\n"])));
|
|
8963
|
-
var CancelUserDeleteMutation = gql__default['default'](templateObject_2$g || (templateObject_2$g = __makeTemplateObject(["\n mutation CancelUserDelete($input: CancelUserDeleteInput!) {\n cancelUserDelete(input: $input) {\n id\n }\n }\n"], ["\n mutation CancelUserDelete($input: CancelUserDeleteInput!) {\n cancelUserDelete(input: $input) {\n id\n }\n }\n"])));
|
|
8964
|
-
var LoginHistoryQuery = gql__default['default'](templateObject_3$e || (templateObject_3$e = __makeTemplateObject(["\n query LoginHistory($first: Int, $after: String) {\n loginHistory(first: $first, after: $after) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n events\n }\n }\n"], ["\n query LoginHistory($first: Int, $after: String) {\n loginHistory(first: $first, after: $after) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n events\n }\n }\n"])));
|
|
8965
|
-
var templateObject_1$j, templateObject_2$g, templateObject_3$e;
|
|
8966
|
-
|
|
8967
|
-
var UserService = /** @class */ (function () {
|
|
8968
|
-
function UserService(lrApollo) {
|
|
8969
|
-
this.lrApollo = lrApollo;
|
|
8970
|
-
}
|
|
8971
|
-
UserService.prototype.requestUserDelete = function () {
|
|
8972
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
8973
|
-
var res;
|
|
8974
|
-
return __generator(this, function (_a) {
|
|
8975
|
-
switch (_a.label) {
|
|
8976
|
-
case 0: return [4 /*yield*/, this.lrApollo.mutate({
|
|
8977
|
-
mutation: RequestUserDeleteMutation,
|
|
8978
|
-
variables: {
|
|
8979
|
-
input: {},
|
|
8980
|
-
},
|
|
8981
|
-
})];
|
|
8982
|
-
case 1:
|
|
8983
|
-
res = _a.sent();
|
|
8984
|
-
return [2 /*return*/, res.requestUserDelete.userDelete];
|
|
8985
|
-
}
|
|
8986
|
-
});
|
|
8987
|
-
});
|
|
8988
|
-
};
|
|
8989
|
-
UserService.prototype.cancelUserDelete = function () {
|
|
8990
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
8991
|
-
var res;
|
|
8992
|
-
return __generator(this, function (_a) {
|
|
8993
|
-
switch (_a.label) {
|
|
8994
|
-
case 0: return [4 /*yield*/, this.lrApollo.mutate({
|
|
8995
|
-
mutation: CancelUserDeleteMutation,
|
|
8996
|
-
variables: {
|
|
8997
|
-
input: {},
|
|
8998
|
-
},
|
|
8999
|
-
})];
|
|
9000
|
-
case 1:
|
|
9001
|
-
res = _a.sent();
|
|
9002
|
-
return [2 /*return*/, res.cancelUserDelete.id];
|
|
9003
|
-
}
|
|
9004
|
-
});
|
|
9005
|
-
});
|
|
9006
|
-
};
|
|
9007
|
-
UserService.prototype.loginHistory = function (first, after) {
|
|
9008
|
-
if (first === void 0) { first = null; }
|
|
9009
|
-
if (after === void 0) { after = null; }
|
|
9010
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
9011
|
-
var res;
|
|
9012
|
-
return __generator(this, function (_a) {
|
|
9013
|
-
switch (_a.label) {
|
|
9014
|
-
case 0: return [4 /*yield*/, this.lrApollo.query({
|
|
9015
|
-
query: LoginHistoryQuery,
|
|
9016
|
-
variables: {
|
|
9017
|
-
first: first,
|
|
9018
|
-
after: after,
|
|
9019
|
-
},
|
|
9020
|
-
})];
|
|
9762
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
9763
|
+
var fileKey, input;
|
|
9764
|
+
return __generator(this, function (_d) {
|
|
9765
|
+
switch (_d.label) {
|
|
9766
|
+
case 0: return [4 /*yield*/, this.getFileKey(options.fileId, options.fileKeyId)];
|
|
9021
9767
|
case 1:
|
|
9022
|
-
|
|
9023
|
-
return [
|
|
9768
|
+
fileKey = _d.sent();
|
|
9769
|
+
return [4 /*yield*/, this.prepareChangeItemParents(options, fileKey.jwk)];
|
|
9770
|
+
case 2:
|
|
9771
|
+
input = _d.sent();
|
|
9772
|
+
return [2 /*return*/, Object.assign(Object.assign({}, input), { fileId: options.fileId })];
|
|
9024
9773
|
}
|
|
9025
9774
|
});
|
|
9026
9775
|
});
|
|
9027
9776
|
};
|
|
9028
|
-
|
|
9029
|
-
|
|
9030
|
-
|
|
9031
|
-
|
|
9777
|
+
Item2Service.prototype.onLogout = function () {
|
|
9778
|
+
// Clear all cached data.
|
|
9779
|
+
this.tempDirectory = null;
|
|
9780
|
+
};
|
|
9781
|
+
return Item2Service;
|
|
9782
|
+
}(LrService));
|
|
9783
|
+
exports.Item2Service.TEMP_DIRECTORY_PLAIN_META = { kcType: 'temp' };
|
|
9784
|
+
exports.Item2Service.TEMP_DIRECTORY_PLAIN_META_FILTER = JSON.stringify({
|
|
9785
|
+
filter: [
|
|
9786
|
+
{
|
|
9787
|
+
contains: Item2Service_1.TEMP_DIRECTORY_PLAIN_META,
|
|
9788
|
+
},
|
|
9789
|
+
],
|
|
9790
|
+
});
|
|
9791
|
+
exports.Item2Service.ɵprov = i0.ɵɵdefineInjectable({ factory: function Item2Service_Factory() { return new exports.Item2Service(i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(FileUploadService), i0.ɵɵinject(KeyService), i0.ɵɵinject(KeyFactoryService), i0.ɵɵinject(KeyGraphService), i0.ɵɵinject(exports.LockService), i0.ɵɵinject(exports.Auth2Service)); }, token: exports.Item2Service, providedIn: "root" });
|
|
9792
|
+
exports.Item2Service.decorators = [
|
|
9032
9793
|
{ type: i0.Injectable, args: [{
|
|
9033
9794
|
providedIn: 'root',
|
|
9034
9795
|
},] }
|
|
9035
9796
|
];
|
|
9036
|
-
|
|
9037
|
-
{ type:
|
|
9797
|
+
exports.Item2Service.ctorParameters = function () { return [
|
|
9798
|
+
{ type: i0.NgZone },
|
|
9799
|
+
{ type: i0.Injector },
|
|
9800
|
+
{ type: FileUploadService },
|
|
9801
|
+
{ type: KeyService },
|
|
9802
|
+
{ type: KeyFactoryService },
|
|
9803
|
+
{ type: KeyGraphService },
|
|
9804
|
+
{ type: exports.LockService },
|
|
9805
|
+
{ type: exports.Auth2Service }
|
|
9038
9806
|
]; };
|
|
9807
|
+
exports.Item2Service = Item2Service_1 = __decorate([
|
|
9808
|
+
RunOutsideAngular({
|
|
9809
|
+
ngZoneName: 'ngZone',
|
|
9810
|
+
})
|
|
9811
|
+
], exports.Item2Service);
|
|
9812
|
+
|
|
9813
|
+
var KeyExchangeFields = "\n id\n token\n state\n mode\n isInitiator\n initiator {\n id\n username\n }\n responder {\n id\n username\n }\n created\n modified\n tokenExpiryTime\n isExpired\n initiatorRootKeyCipher\n initiatorActionRequired\n responderActionRequired\n responderEmailAddress\n otk {\n state\n otKeyParams\n otKeyCipher\n sharedKey {\n id\n }\n mkSharedKey {\n id\n }\n initiatorSigPxk {\n id\n }\n responderSigPxk {\n id\n }\n initiatorOneTimePbkCipher\n responderPbkCipher\n}";
|
|
9814
|
+
var UserSharedKeyFields = "\n userSigPrk {\n id\n }\n otherSigPbk {\n id\n }\n sharedKey {\n id\n }\n mkSharedKey {\n id\n }\n mkPxk {\n id\n pbk\n }\n mkReshareRequestCipher\n mkReshareResponseCipher\n mkReshareRequestSent\n mkReshareResponseSent\n";
|
|
9815
|
+
var CurrentUserSharedKeyQuery = gql__default['default'](templateObject_1$j || (templateObject_1$j = __makeTemplateObject(["\nquery CurrentUserSharedKeyQuery(\n $username: String\n $userId: LrRelayIdInput\n $cachedKeyIds: [LrRelayIdInput!]\n) {\n currentUserSharedKey(\n username: $username\n userId: $userId\n ) {\n userSharedKey {\n ", "\n }\n }\n keyGraph(cachedKeyIds: $cachedKeyIds) {\n ...KeyGraphFragment\n }\n}\n", ""], ["\nquery CurrentUserSharedKeyQuery(\n $username: String\n $userId: LrRelayIdInput\n $cachedKeyIds: [LrRelayIdInput!]\n) {\n currentUserSharedKey(\n username: $username\n userId: $userId\n ) {\n userSharedKey {\n ", "\n }\n }\n keyGraph(cachedKeyIds: $cachedKeyIds) {\n ...KeyGraphFragment\n }\n}\n", ""])), UserSharedKeyFields, KeyGraphFragment);
|
|
9816
|
+
var KeyExchangesQuery = gql__default['default'](templateObject_2$g || (templateObject_2$g = __makeTemplateObject(["\nquery KeyExchangeQuery(\n$orderBy: String\n$isExpired: Boolean\n$initiatorActionRequired: Boolean\n$responderActionRequired: Boolean\n$initiator: ID\n$responder: ID\n$state: String\n) {\nkeyExchanges(\n orderBy: $orderBy\n isExpired: $isExpired\n initiatorActionRequired: $initiatorActionRequired\n responderActionRequired: $responderActionRequired\n initiator: $initiator\n responder: $responder\n state: $state\n) {\n edges {\n node {\n ", "\n }\n }\n}\nkeyGraph {\n ...KeyGraphFragment\n}\n}\n", "\n"], ["\nquery KeyExchangeQuery(\n$orderBy: String\n$isExpired: Boolean\n$initiatorActionRequired: Boolean\n$responderActionRequired: Boolean\n$initiator: ID\n$responder: ID\n$state: String\n) {\nkeyExchanges(\n orderBy: $orderBy\n isExpired: $isExpired\n initiatorActionRequired: $initiatorActionRequired\n responderActionRequired: $responderActionRequired\n initiator: $initiator\n responder: $responder\n state: $state\n) {\n edges {\n node {\n ", "\n }\n }\n}\nkeyGraph {\n ...KeyGraphFragment\n}\n}\n", "\n"])), KeyExchangeFields, KeyGraphFragment);
|
|
9817
|
+
var KeyExchangeQuery = gql__default['default'](templateObject_3$d || (templateObject_3$d = __makeTemplateObject(["\nquery KeyExchangeQuery(\n $id: LrRelayIdInput!\n) {\n keyExchange(\n id: $id\n ) {\n ", "\n }\n keyGraph {\n ...KeyGraphFragment\n }\n}\n", "\n"], ["\nquery KeyExchangeQuery(\n $id: LrRelayIdInput!\n) {\n keyExchange(\n id: $id\n ) {\n ", "\n }\n keyGraph {\n ...KeyGraphFragment\n }\n}\n", "\n"])), KeyExchangeFields, KeyGraphFragment);
|
|
9818
|
+
// Key graph is only available for authenticated users. This query
|
|
9819
|
+
// is for unauthenticated users.
|
|
9820
|
+
var KeyExchangeTokenQuery = gql__default['default'](templateObject_4$9 || (templateObject_4$9 = __makeTemplateObject(["\nquery KeyExchangeQuery(\n $id: LrRelayIdInput!\n $token: String\n) {\n keyExchange(\n id: $id\n token: $token\n ) {\n ", "\n }\n}"], ["\nquery KeyExchangeQuery(\n $id: LrRelayIdInput!\n $token: String\n) {\n keyExchange(\n id: $id\n token: $token\n ) {\n ", "\n }\n}"])), KeyExchangeFields);
|
|
9821
|
+
var InitiateOtkMutation = gql__default['default'](templateObject_5$8 || (templateObject_5$8 = __makeTemplateObject(["\nmutation InitiateKeyExchangeOtk(\n$input: InitiateKeyExchangeOtkInput!\n) {\ninitiateKeyExchangeOtk(input: $input) {\n keyExchange {\n ", "\n }\n}\n", "\n}"], ["\nmutation InitiateKeyExchangeOtk(\n$input: InitiateKeyExchangeOtkInput!\n) {\ninitiateKeyExchangeOtk(input: $input) {\n keyExchange {\n ", "\n }\n}\n", "\n}"])), KeyExchangeFields, FetchKeyGraphField);
|
|
9822
|
+
var RespondOtkMutation = gql__default['default'](templateObject_6$7 || (templateObject_6$7 = __makeTemplateObject(["\nmutation RespondKeyExchangeOtk(\n $input: RespondKeyExchangeOtkInput!\n) {\n respondKeyExchangeOtk(input: $input) {\n keyExchange {\n ", "\n }\n userSharedKey {\n ", "\n }\n tp {\n id\n }\n }\n}"], ["\nmutation RespondKeyExchangeOtk(\n $input: RespondKeyExchangeOtkInput!\n) {\n respondKeyExchangeOtk(input: $input) {\n keyExchange {\n ", "\n }\n userSharedKey {\n ", "\n }\n tp {\n id\n }\n }\n}"])), KeyExchangeFields, UserSharedKeyFields);
|
|
9823
|
+
var CompleteOtkMutation = gql__default['default'](templateObject_7$6 || (templateObject_7$6 = __makeTemplateObject(["\nmutation CompleteKeyExchangeOtk(\n $input: CompleteKeyExchangeOtkInput!\n) {\n completeKeyExchangeOtk(input: $input) {\n keyExchange {\n ", "\n }\n userSharedKey {\n ", "\n }\n tp {\n id\n }\n }\n}"], ["\nmutation CompleteKeyExchangeOtk(\n $input: CompleteKeyExchangeOtkInput!\n) {\n completeKeyExchangeOtk(input: $input) {\n keyExchange {\n ", "\n }\n userSharedKey {\n ", "\n }\n tp {\n id\n }\n }\n}"])), KeyExchangeFields, UserSharedKeyFields);
|
|
9824
|
+
var templateObject_1$j, templateObject_2$g, templateObject_3$d, templateObject_4$9, templateObject_5$8, templateObject_6$7, templateObject_7$6;
|
|
9039
9825
|
|
|
9040
9826
|
(function (OtkState) {
|
|
9041
9827
|
OtkState["OTK_INITIATED"] = "OTK_INITIATED";
|
|
@@ -9044,13 +9830,12 @@
|
|
|
9044
9830
|
})(exports.OtkState || (exports.OtkState = {}));
|
|
9045
9831
|
|
|
9046
9832
|
var KeyExchangeService = /** @class */ (function () {
|
|
9047
|
-
function KeyExchangeService(keyFactory, keyService, lrApollo, encryptionService,
|
|
9833
|
+
function KeyExchangeService(keyFactory, keyService, lrApollo, encryptionService, auth2Service) {
|
|
9048
9834
|
this.keyFactory = keyFactory;
|
|
9049
9835
|
this.keyService = keyService;
|
|
9050
9836
|
this.lrApollo = lrApollo;
|
|
9051
9837
|
this.encryptionService = encryptionService;
|
|
9052
|
-
this.
|
|
9053
|
-
this.userService = userService;
|
|
9838
|
+
this.auth2Service = auth2Service;
|
|
9054
9839
|
this.CLIENT_NONCE_LENGTH = 32;
|
|
9055
9840
|
}
|
|
9056
9841
|
KeyExchangeService.prototype.getKeyExchangeList = function (input) {
|
|
@@ -9128,28 +9913,26 @@
|
|
|
9128
9913
|
return __generator(this, function (_d) {
|
|
9129
9914
|
switch (_d.label) {
|
|
9130
9915
|
case 0:
|
|
9131
|
-
if (!keyExchange.isInitiator) return [3 /*break*/,
|
|
9132
|
-
|
|
9133
|
-
case 1:
|
|
9134
|
-
rootKey = _d.sent();
|
|
9916
|
+
if (!keyExchange.isInitiator) return [3 /*break*/, 7];
|
|
9917
|
+
rootKey = this.keyService.currentRootKey;
|
|
9135
9918
|
return [4 /*yield*/, this.encryptionService.decrypt(rootKey.jwk, keyExchange.initiatorRootKeyCipher)];
|
|
9136
|
-
case
|
|
9919
|
+
case 1:
|
|
9137
9920
|
plainInitiatorRootKeyCipher = (_d.sent());
|
|
9138
9921
|
if (!keyExchange.otk
|
|
9139
|
-
.initiatorOneTimePbkCipher) return [3 /*break*/,
|
|
9922
|
+
.initiatorOneTimePbkCipher) return [3 /*break*/, 5];
|
|
9140
9923
|
_b = this.decryptResponseCipher;
|
|
9141
9924
|
return [4 /*yield*/, KeyFactoryService.asKey(plainInitiatorRootKeyCipher.otKey)];
|
|
9142
|
-
case
|
|
9925
|
+
case 2:
|
|
9143
9926
|
_c = [_d.sent()];
|
|
9144
9927
|
return [4 /*yield*/, KeyFactoryService.asKey(plainInitiatorRootKeyCipher.oneTimePrk)];
|
|
9145
|
-
case
|
|
9146
|
-
case
|
|
9928
|
+
case 3: return [4 /*yield*/, _b.apply(this, _c.concat([_d.sent(), keyExchange.otk.initiatorOneTimePbkCipher]))];
|
|
9929
|
+
case 4:
|
|
9147
9930
|
_a = _d.sent();
|
|
9148
|
-
return [3 /*break*/,
|
|
9149
|
-
case
|
|
9931
|
+
return [3 /*break*/, 6];
|
|
9932
|
+
case 5:
|
|
9150
9933
|
_a = null;
|
|
9151
|
-
_d.label =
|
|
9152
|
-
case
|
|
9934
|
+
_d.label = 6;
|
|
9935
|
+
case 6:
|
|
9153
9936
|
plainInitiatorOneTimePbkCipher = _a;
|
|
9154
9937
|
responder = plainInitiatorOneTimePbkCipher &&
|
|
9155
9938
|
plainInitiatorOneTimePbkCipher.responder;
|
|
@@ -9159,8 +9942,8 @@
|
|
|
9159
9942
|
: null, myContactCard: initiator && initiator.contactCard
|
|
9160
9943
|
? initiator.contactCard.plainSharedCipherDataJson
|
|
9161
9944
|
: null, myMessage: initiator && initiator.message })];
|
|
9162
|
-
case
|
|
9163
|
-
case
|
|
9945
|
+
case 7: return [4 /*yield*/, this.decryptOtk(keyExchange, otKeyK)];
|
|
9946
|
+
case 8:
|
|
9164
9947
|
decryptedOtk = _d.sent();
|
|
9165
9948
|
initiator = decryptedOtk && decryptedOtk.plainOtKeyCipher.initiator;
|
|
9166
9949
|
return [2 /*return*/, Object.assign(Object.assign({}, keyExchange), { decryptedOtk: decryptedOtk, message: initiator && initiator.message, contactCard: initiator &&
|
|
@@ -9206,19 +9989,17 @@
|
|
|
9206
9989
|
case 2:
|
|
9207
9990
|
if (!(keyExchange.otk.state === exports.OtkState.OTK_INITIATED &&
|
|
9208
9991
|
!keyExchange.isInitiator &&
|
|
9209
|
-
keyExchange.otk.responderPbkCipher)) return [3 /*break*/,
|
|
9210
|
-
|
|
9211
|
-
case 3:
|
|
9212
|
-
prk = _a.sent();
|
|
9992
|
+
keyExchange.otk.responderPbkCipher)) return [3 /*break*/, 5];
|
|
9993
|
+
prk = this.keyService.currentPxk;
|
|
9213
9994
|
return [4 /*yield*/, this.encryptionService.decrypt(prk.jwk, JSON.parse(keyExchange.otk.responderPbkCipher), {
|
|
9214
9995
|
serializations: [JoseSerialization.COMPACT],
|
|
9215
9996
|
})];
|
|
9216
|
-
case
|
|
9997
|
+
case 3:
|
|
9217
9998
|
decryptedCipher = _a.sent();
|
|
9218
|
-
if (!decryptedCipher.otKey) return [3 /*break*/,
|
|
9999
|
+
if (!decryptedCipher.otKey) return [3 /*break*/, 5];
|
|
9219
10000
|
return [4 /*yield*/, KeyFactoryService.asKey(decryptedCipher.otKey)];
|
|
9220
|
-
case
|
|
9221
|
-
case
|
|
10001
|
+
case 4: return [2 /*return*/, _a.sent()];
|
|
10002
|
+
case 5: return [2 /*return*/, null];
|
|
9222
10003
|
}
|
|
9223
10004
|
});
|
|
9224
10005
|
});
|
|
@@ -9233,26 +10014,22 @@
|
|
|
9233
10014
|
case 1:
|
|
9234
10015
|
otKey = _c.sent();
|
|
9235
10016
|
nonce = this.keyFactory.randomString(this.CLIENT_NONCE_LENGTH);
|
|
9236
|
-
return [4 /*yield*/, this.
|
|
10017
|
+
return [4 /*yield*/, this.auth2Service.getUser()];
|
|
9237
10018
|
case 2:
|
|
9238
10019
|
user = _c.sent();
|
|
9239
10020
|
return [4 /*yield*/, this.keyFactory.createPkcKey()];
|
|
9240
10021
|
case 3:
|
|
9241
10022
|
initiatorOneTimePrk = _c.sent();
|
|
9242
|
-
|
|
9243
|
-
|
|
9244
|
-
initiatorPrk = _c.sent();
|
|
9245
|
-
return [4 /*yield*/, this.keyService.getCurrentSigPxk()];
|
|
9246
|
-
case 5:
|
|
9247
|
-
initiatorSigPrk = _c.sent();
|
|
10023
|
+
initiatorPrk = this.keyService.currentPxk;
|
|
10024
|
+
initiatorSigPrk = this.keyService.currentSigPxk;
|
|
9248
10025
|
initiatorPlainDataSig = null;
|
|
9249
|
-
if (!(contactCard && contactCard.ownerPlainData)) return [3 /*break*/,
|
|
10026
|
+
if (!(contactCard && contactCard.ownerPlainData)) return [3 /*break*/, 5];
|
|
9250
10027
|
_b = (_a = JSON).stringify;
|
|
9251
10028
|
return [4 /*yield*/, this.encryptionService.sign(initiatorSigPrk.jwk, contactCard.ownerPlainData)];
|
|
9252
|
-
case
|
|
10029
|
+
case 4:
|
|
9253
10030
|
initiatorPlainDataSig = _b.apply(_a, [_c.sent()]);
|
|
9254
|
-
_c.label =
|
|
9255
|
-
case
|
|
10031
|
+
_c.label = 5;
|
|
10032
|
+
case 5:
|
|
9256
10033
|
initiator = {
|
|
9257
10034
|
message: message,
|
|
9258
10035
|
contactCard: contactCard
|
|
@@ -9268,7 +10045,7 @@
|
|
|
9268
10045
|
} }),
|
|
9269
10046
|
};
|
|
9270
10047
|
return [4 /*yield*/, this.encryptionService.encrypt(otKey, plainOtKeyCipher)];
|
|
9271
|
-
case
|
|
10048
|
+
case 6:
|
|
9272
10049
|
otKeyCipher = _c.sent();
|
|
9273
10050
|
plainInitiatorRootKeyCipher = {
|
|
9274
10051
|
nonce: nonce,
|
|
@@ -9284,11 +10061,9 @@
|
|
|
9284
10061
|
initiatorContactCard: contactCard,
|
|
9285
10062
|
initiator: initiator,
|
|
9286
10063
|
};
|
|
9287
|
-
|
|
9288
|
-
case 9:
|
|
9289
|
-
rootKey = _c.sent();
|
|
10064
|
+
rootKey = this.keyService.currentRootKey;
|
|
9290
10065
|
return [4 /*yield*/, this.encryptionService.encrypt(rootKey.jwk, plainInitiatorRootKeyCipher)];
|
|
9291
|
-
case
|
|
10066
|
+
case 7:
|
|
9292
10067
|
initiatorRootKeyCipher = _c.sent();
|
|
9293
10068
|
otKeyK = otKey.toJSON(true).k;
|
|
9294
10069
|
return [4 /*yield*/, this.lrApollo.mutate({
|
|
@@ -9314,7 +10089,7 @@
|
|
|
9314
10089
|
},
|
|
9315
10090
|
},
|
|
9316
10091
|
})];
|
|
9317
|
-
case
|
|
10092
|
+
case 8:
|
|
9318
10093
|
initiateKeyExchangeOtk = (_c.sent()).initiateKeyExchangeOtk;
|
|
9319
10094
|
return [2 /*return*/, { keyExchange: initiateKeyExchangeOtk.keyExchange, otKeyK: otKeyK }];
|
|
9320
10095
|
}
|
|
@@ -9324,51 +10099,42 @@
|
|
|
9324
10099
|
KeyExchangeService.prototype.respondOtk = function (_a) {
|
|
9325
10100
|
var id = _a.id, token = _a.token, decryptedOtk = _a.decryptedOtk, message = _a.message, initiatorContactCard = _a.initiatorContactCard, sentContactCard = _a.responderContactCard;
|
|
9326
10101
|
return __awaiter(this, void 0, void 0, function () {
|
|
9327
|
-
var user, rootKey,
|
|
10102
|
+
var user, rootKey, masterKey, sharedKey, mkSharedKey, rkWrappedSharedKey, mkWrappedMkSharedKey, initiatorOneTimePbk, initiatorPbk, initiatorSigPbk, responderPrk, responderSigPrk, signedInitiatorPbk, signedInitiatorSigPbk, plainInitiatorOneTimePbkCipher, receivedCardInput, plainSharedCipherDataJson, receiverKey, ccSharedKey, sigPxk, _a, _b, _c, _d, _e, _f, _g, _h, sharedCipherData, _j, _k, _l, sentCardInput, ownerKey, ccSharedKey, sigPxk, _m, _o, _p, _q, _r, _s, _t, _u, sharedCipherData, _v, _w, _x, _y, _z, _0, initiatorOneTimePbkCipher, respondKeyExchangeOtk;
|
|
9328
10103
|
return __generator(this, function (_1) {
|
|
9329
10104
|
switch (_1.label) {
|
|
9330
|
-
case 0: return [4 /*yield*/, this.
|
|
10105
|
+
case 0: return [4 /*yield*/, this.auth2Service.getUser()];
|
|
9331
10106
|
case 1:
|
|
9332
10107
|
user = _1.sent();
|
|
9333
|
-
|
|
9334
|
-
|
|
9335
|
-
rootKey = _1.sent();
|
|
9336
|
-
masterKeyId = this.keyService.getCurrentMasterKey().id;
|
|
9337
|
-
return [4 /*yield*/, this.keyService.getCurrentMasterKey()];
|
|
9338
|
-
case 3:
|
|
9339
|
-
masterKey = _1.sent();
|
|
10108
|
+
rootKey = this.keyService.currentRootKey;
|
|
10109
|
+
masterKey = this.keyService.currentMasterKey;
|
|
9340
10110
|
return [4 /*yield*/, this.keyFactory.createKey()];
|
|
9341
|
-
case
|
|
10111
|
+
case 2:
|
|
9342
10112
|
sharedKey = _1.sent();
|
|
9343
10113
|
return [4 /*yield*/, this.keyFactory.createKey()];
|
|
9344
|
-
case
|
|
10114
|
+
case 3:
|
|
9345
10115
|
mkSharedKey = _1.sent();
|
|
9346
10116
|
return [4 /*yield*/, this.encryptionService.encrypt(rootKey.jwk, sharedKey.toJSON(true))];
|
|
9347
|
-
case
|
|
10117
|
+
case 4:
|
|
9348
10118
|
rkWrappedSharedKey = _1.sent();
|
|
9349
10119
|
return [4 /*yield*/, this.encryptionService.encrypt(masterKey.jwk, mkSharedKey.toJSON(true))];
|
|
9350
|
-
case
|
|
10120
|
+
case 5:
|
|
9351
10121
|
mkWrappedMkSharedKey = _1.sent();
|
|
9352
10122
|
return [4 /*yield*/, KeyFactoryService.asKey(decryptedOtk.plainOtKeyCipher.initiator.oneTimePbk)];
|
|
9353
|
-
case
|
|
10123
|
+
case 6:
|
|
9354
10124
|
initiatorOneTimePbk = _1.sent();
|
|
9355
10125
|
return [4 /*yield*/, KeyFactoryService.asKey(decryptedOtk.plainOtKeyCipher.initiator.pbk)];
|
|
9356
|
-
case
|
|
10126
|
+
case 7:
|
|
9357
10127
|
initiatorPbk = _1.sent();
|
|
9358
10128
|
return [4 /*yield*/, KeyFactoryService.asKey(decryptedOtk.plainOtKeyCipher.initiator.sigPbk)];
|
|
9359
|
-
case
|
|
10129
|
+
case 8:
|
|
9360
10130
|
initiatorSigPbk = _1.sent();
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
responderPrk = _1.sent();
|
|
9364
|
-
return [4 /*yield*/, this.keyService.getCurrentSigPxk()];
|
|
9365
|
-
case 12:
|
|
9366
|
-
responderSigPrk = _1.sent();
|
|
10131
|
+
responderPrk = this.keyService.currentPxk;
|
|
10132
|
+
responderSigPrk = this.keyService.currentSigPxk;
|
|
9367
10133
|
return [4 /*yield*/, this.encryptionService.sign(responderSigPrk.jwk, initiatorPbk.toJSON())];
|
|
9368
|
-
case
|
|
10134
|
+
case 9:
|
|
9369
10135
|
signedInitiatorPbk = _1.sent();
|
|
9370
10136
|
return [4 /*yield*/, this.encryptionService.sign(responderSigPrk.jwk, initiatorSigPbk.toJSON())];
|
|
9371
|
-
case
|
|
10137
|
+
case 10:
|
|
9372
10138
|
signedInitiatorSigPbk = _1.sent();
|
|
9373
10139
|
plainInitiatorOneTimePbkCipher = {
|
|
9374
10140
|
nonce: decryptedOtk.plainOtKeyCipher.nonce,
|
|
@@ -9383,109 +10149,105 @@
|
|
|
9383
10149
|
message: message,
|
|
9384
10150
|
},
|
|
9385
10151
|
};
|
|
9386
|
-
if (!decryptedOtk.plainOtKeyCipher.initiator.contactCard) return [3 /*break*/,
|
|
10152
|
+
if (!decryptedOtk.plainOtKeyCipher.initiator.contactCard) return [3 /*break*/, 20];
|
|
9387
10153
|
plainSharedCipherDataJson = decryptedOtk.plainOtKeyCipher.initiator.contactCard
|
|
9388
10154
|
.plainSharedCipherDataJson;
|
|
9389
10155
|
return [4 /*yield*/, this.keyFactory.createKey()];
|
|
9390
|
-
case
|
|
10156
|
+
case 11:
|
|
9391
10157
|
receiverKey = _1.sent();
|
|
9392
10158
|
return [4 /*yield*/, this.keyFactory.createKey()];
|
|
9393
|
-
case
|
|
10159
|
+
case 12:
|
|
9394
10160
|
ccSharedKey = _1.sent();
|
|
9395
|
-
|
|
9396
|
-
case 17:
|
|
9397
|
-
sigPxk = _1.sent();
|
|
10161
|
+
sigPxk = this.keyService.currentSigPxk;
|
|
9398
10162
|
_a = {};
|
|
9399
10163
|
_c = (_b = JSON).stringify;
|
|
9400
10164
|
return [4 /*yield*/, this.encryptionService.encrypt(rootKey.jwk, receiverKey.toJSON(true))];
|
|
9401
|
-
case
|
|
10165
|
+
case 13:
|
|
9402
10166
|
_a.receiverWrappedKey = _c.apply(_b, [_1.sent()]),
|
|
9403
10167
|
_a.receiverWrappingKeyId = rootKey.id;
|
|
9404
|
-
if (!initiatorContactCard) return [3 /*break*/,
|
|
10168
|
+
if (!initiatorContactCard) return [3 /*break*/, 15];
|
|
9405
10169
|
_f = (_e = JSON).stringify;
|
|
9406
10170
|
return [4 /*yield*/, this.encryptionService.encrypt(receiverKey, initiatorContactCard.plainReceiverCipherDataJson)];
|
|
9407
|
-
case
|
|
10171
|
+
case 14:
|
|
9408
10172
|
_d = _f.apply(_e, [_1.sent()]);
|
|
9409
|
-
return [3 /*break*/,
|
|
9410
|
-
case
|
|
10173
|
+
return [3 /*break*/, 16];
|
|
10174
|
+
case 15:
|
|
9411
10175
|
_d = '';
|
|
9412
|
-
_1.label =
|
|
9413
|
-
case
|
|
10176
|
+
_1.label = 16;
|
|
10177
|
+
case 16:
|
|
9414
10178
|
_a.receiverCipherData = _d;
|
|
9415
10179
|
_h = (_g = JSON).stringify;
|
|
9416
10180
|
return [4 /*yield*/, this.encryptionService.encrypt(sharedKey, ccSharedKey.toJSON(true))];
|
|
9417
|
-
case
|
|
10181
|
+
case 17:
|
|
9418
10182
|
receivedCardInput = (_a.sharedWrappedKey = _h.apply(_g, [_1.sent()]),
|
|
9419
10183
|
_a);
|
|
9420
10184
|
return [4 /*yield*/, this.encryptionService.encrypt(ccSharedKey, plainSharedCipherDataJson)];
|
|
9421
|
-
case
|
|
10185
|
+
case 18:
|
|
9422
10186
|
sharedCipherData = _1.sent();
|
|
9423
10187
|
_j = receivedCardInput;
|
|
9424
10188
|
_l = (_k = JSON).stringify;
|
|
9425
10189
|
return [4 /*yield*/, this.encryptionService.sign(sigPxk.jwk, sharedCipherData)];
|
|
9426
|
-
case
|
|
10190
|
+
case 19:
|
|
9427
10191
|
_j.sharedCipherDataSig = _l.apply(_k, [_1.sent()]);
|
|
9428
10192
|
receivedCardInput.sigPxkId = sigPxk.id;
|
|
9429
10193
|
plainInitiatorOneTimePbkCipher.responder.contactCard = Object.assign(Object.assign({}, plainInitiatorOneTimePbkCipher.responder.contactCard), { sharedCipherKey: ccSharedKey.toJSON(true) });
|
|
9430
|
-
_1.label =
|
|
9431
|
-
case
|
|
9432
|
-
if (!sentContactCard) return [3 /*break*/,
|
|
10194
|
+
_1.label = 20;
|
|
10195
|
+
case 20:
|
|
10196
|
+
if (!sentContactCard) return [3 /*break*/, 32];
|
|
9433
10197
|
return [4 /*yield*/, this.keyFactory.createKey()];
|
|
9434
|
-
case
|
|
10198
|
+
case 21:
|
|
9435
10199
|
ownerKey = _1.sent();
|
|
9436
10200
|
return [4 /*yield*/, this.keyFactory.createKey()];
|
|
9437
|
-
case
|
|
10201
|
+
case 22:
|
|
9438
10202
|
ccSharedKey = _1.sent();
|
|
9439
|
-
|
|
9440
|
-
case 28:
|
|
9441
|
-
sigPxk = _1.sent();
|
|
10203
|
+
sigPxk = this.keyService.currentSigPxk;
|
|
9442
10204
|
_m = {};
|
|
9443
10205
|
_p = (_o = JSON).stringify;
|
|
9444
10206
|
return [4 /*yield*/, this.encryptionService.encrypt(rootKey.jwk, ownerKey.toJSON(true))];
|
|
9445
|
-
case
|
|
10207
|
+
case 23:
|
|
9446
10208
|
_m.ownerWrappedKey = _p.apply(_o, [_1.sent()]),
|
|
9447
10209
|
_m.ownerWrappingKeyId = rootKey.id;
|
|
9448
|
-
if (!sentContactCard.plainOwnerCipherDataJson) return [3 /*break*/,
|
|
10210
|
+
if (!sentContactCard.plainOwnerCipherDataJson) return [3 /*break*/, 25];
|
|
9449
10211
|
_s = (_r = JSON).stringify;
|
|
9450
10212
|
return [4 /*yield*/, this.encryptionService.encrypt(ownerKey, sentContactCard.plainOwnerCipherDataJson)];
|
|
9451
|
-
case
|
|
10213
|
+
case 24:
|
|
9452
10214
|
_q = _s.apply(_r, [_1.sent()]);
|
|
9453
|
-
return [3 /*break*/,
|
|
9454
|
-
case
|
|
10215
|
+
return [3 /*break*/, 26];
|
|
10216
|
+
case 25:
|
|
9455
10217
|
_q = '';
|
|
9456
|
-
_1.label =
|
|
9457
|
-
case
|
|
10218
|
+
_1.label = 26;
|
|
10219
|
+
case 26:
|
|
9458
10220
|
_m.ownerCipherData = _q;
|
|
9459
10221
|
_u = (_t = JSON).stringify;
|
|
9460
10222
|
return [4 /*yield*/, this.encryptionService.encrypt(sharedKey, ccSharedKey.toJSON(true))];
|
|
9461
|
-
case
|
|
10223
|
+
case 27:
|
|
9462
10224
|
sentCardInput = (_m.sharedWrappedKey = _u.apply(_t, [_1.sent()]),
|
|
9463
10225
|
_m);
|
|
9464
10226
|
return [4 /*yield*/, this.encryptionService.encrypt(ccSharedKey, sentContactCard.plainSharedCipherDataJson)];
|
|
9465
|
-
case
|
|
10227
|
+
case 28:
|
|
9466
10228
|
sharedCipherData = _1.sent();
|
|
9467
10229
|
_v = sentCardInput;
|
|
9468
10230
|
_x = (_w = JSON).stringify;
|
|
9469
10231
|
return [4 /*yield*/, this.encryptionService.sign(sigPxk.jwk, sharedCipherData)];
|
|
9470
|
-
case
|
|
10232
|
+
case 29:
|
|
9471
10233
|
_v.sharedCipherDataSig = _x.apply(_w, [_1.sent()]);
|
|
9472
10234
|
sentCardInput.sigPxkId = sigPxk.id;
|
|
9473
|
-
if (!sentContactCard.ownerPlainData) return [3 /*break*/,
|
|
10235
|
+
if (!sentContactCard.ownerPlainData) return [3 /*break*/, 31];
|
|
9474
10236
|
_y = sentCardInput;
|
|
9475
10237
|
_0 = (_z = JSON).stringify;
|
|
9476
10238
|
return [4 /*yield*/, this.encryptionService.sign(responderSigPrk.jwk, sentContactCard.ownerPlainData)];
|
|
9477
|
-
case
|
|
10239
|
+
case 30:
|
|
9478
10240
|
_y.ownerPlainDataSig = _0.apply(_z, [_1.sent()]);
|
|
9479
|
-
_1.label =
|
|
9480
|
-
case
|
|
10241
|
+
_1.label = 31;
|
|
10242
|
+
case 31:
|
|
9481
10243
|
// Contact card info readable by the initiator
|
|
9482
10244
|
plainInitiatorOneTimePbkCipher.responder.contactCard = Object.assign(Object.assign({}, plainInitiatorOneTimePbkCipher.responder.contactCard), { plainSharedCipherDataJson: sentContactCard.plainSharedCipherDataJson });
|
|
9483
|
-
_1.label =
|
|
9484
|
-
case
|
|
9485
|
-
case
|
|
10245
|
+
_1.label = 32;
|
|
10246
|
+
case 32: return [4 /*yield*/, this.encryptionService.encrypt(initiatorOneTimePbk, plainInitiatorOneTimePbkCipher)];
|
|
10247
|
+
case 33:
|
|
9486
10248
|
initiatorOneTimePbkCipher = _1.sent();
|
|
9487
10249
|
return [4 /*yield*/, this.encryptionService.encrypt(decryptedOtk.otKey, initiatorOneTimePbkCipher)];
|
|
9488
|
-
case
|
|
10250
|
+
case 34:
|
|
9489
10251
|
// Encrypt with the otk again to keep use of asymmetric keys to a minimum.
|
|
9490
10252
|
initiatorOneTimePbkCipher = _1.sent();
|
|
9491
10253
|
return [4 /*yield*/, this.lrApollo.mutate({
|
|
@@ -9495,7 +10257,7 @@
|
|
|
9495
10257
|
keyExchangeId: id,
|
|
9496
10258
|
keyExchangeToken: token,
|
|
9497
10259
|
rootKeyId: rootKey.id,
|
|
9498
|
-
masterKeyId:
|
|
10260
|
+
masterKeyId: masterKey.id,
|
|
9499
10261
|
// These will be stored on the server
|
|
9500
10262
|
responderPxkId: responderPrk.id,
|
|
9501
10263
|
responderSigPxkId: responderSigPrk.id,
|
|
@@ -9513,7 +10275,7 @@
|
|
|
9513
10275
|
},
|
|
9514
10276
|
},
|
|
9515
10277
|
})];
|
|
9516
|
-
case
|
|
10278
|
+
case 35:
|
|
9517
10279
|
respondKeyExchangeOtk = (_1.sent()).respondKeyExchangeOtk;
|
|
9518
10280
|
return [2 /*return*/, {
|
|
9519
10281
|
keyExchange: respondKeyExchangeOtk.keyExchange,
|
|
@@ -9529,93 +10291,88 @@
|
|
|
9529
10291
|
var rootKey, masterKey, plainInitiatorRootKeyCipher, plainInitiatorOneTimePbkCipher, _a, _b, initiatorSigPrk, responderSigPbk, responderPbk, signedResponderPbk, signedResponderSigPbk, sharedKey, rkWrappedSharedKey, mkSharedKey, mkWrappedMkSharedKey, responderContactCardCipherInput, receiverKey, _c, _d, _e, _f, _g, initiatorContactCardCipherInput, initiatorContactCardSharedCipherInput, initiatorContactCard, ownerKey, sharedCipherKey, ownerWrappedKey, _h, _j, ownerCipherData, _k, _l, _m, sharedCipherData, _o, _p, _q, res;
|
|
9530
10292
|
return __generator(this, function (_r) {
|
|
9531
10293
|
switch (_r.label) {
|
|
9532
|
-
case 0:
|
|
9533
|
-
|
|
9534
|
-
|
|
9535
|
-
return [4 /*yield*/, this.keyService.getCurrentMasterKey()];
|
|
9536
|
-
case 2:
|
|
9537
|
-
masterKey = _r.sent();
|
|
10294
|
+
case 0:
|
|
10295
|
+
rootKey = this.keyService.currentRootKey;
|
|
10296
|
+
masterKey = this.keyService.currentMasterKey;
|
|
9538
10297
|
return [4 /*yield*/, this.encryptionService.decrypt(rootKey.jwk, initiatorRootKeyCipher)];
|
|
9539
|
-
case
|
|
10298
|
+
case 1:
|
|
9540
10299
|
plainInitiatorRootKeyCipher = (_r.sent());
|
|
9541
10300
|
_a = this.decryptResponseCipher;
|
|
9542
10301
|
return [4 /*yield*/, KeyFactoryService.asKey(plainInitiatorRootKeyCipher.otKey)];
|
|
9543
|
-
case
|
|
10302
|
+
case 2:
|
|
9544
10303
|
_b = [_r.sent()];
|
|
9545
10304
|
return [4 /*yield*/, KeyFactoryService.asKey(plainInitiatorRootKeyCipher.oneTimePrk)];
|
|
9546
|
-
case
|
|
9547
|
-
case
|
|
10305
|
+
case 3: return [4 /*yield*/, _a.apply(this, _b.concat([_r.sent(), initiatorOneTimePbkCipher]))];
|
|
10306
|
+
case 4:
|
|
9548
10307
|
plainInitiatorOneTimePbkCipher = _r.sent();
|
|
9549
10308
|
// Check the nonce match to ensure the responder was the one holding the OTK
|
|
9550
10309
|
if (plainInitiatorRootKeyCipher.nonce !== plainInitiatorOneTimePbkCipher.nonce) {
|
|
9551
10310
|
throw new KcCodeMismatchException('The nonce returned by responder does not match with the one created by the initiator.');
|
|
9552
10311
|
}
|
|
9553
|
-
|
|
9554
|
-
case 7:
|
|
9555
|
-
initiatorSigPrk = _r.sent();
|
|
10312
|
+
initiatorSigPrk = this.keyService.currentSigPxk;
|
|
9556
10313
|
return [4 /*yield*/, KeyFactoryService.asKey(plainInitiatorOneTimePbkCipher.responder.sigPbk)];
|
|
9557
|
-
case
|
|
10314
|
+
case 5:
|
|
9558
10315
|
responderSigPbk = _r.sent();
|
|
9559
10316
|
return [4 /*yield*/, KeyFactoryService.asKey(plainInitiatorOneTimePbkCipher.responder.pbk)];
|
|
9560
|
-
case
|
|
10317
|
+
case 6:
|
|
9561
10318
|
responderPbk = _r.sent();
|
|
9562
10319
|
return [4 /*yield*/, this.encryptionService.sign(initiatorSigPrk.jwk, responderPbk.toJSON())];
|
|
9563
|
-
case
|
|
10320
|
+
case 7:
|
|
9564
10321
|
signedResponderPbk = _r.sent();
|
|
9565
10322
|
return [4 /*yield*/, this.encryptionService.sign(initiatorSigPrk.jwk, responderSigPbk.toJSON())];
|
|
9566
|
-
case
|
|
10323
|
+
case 8:
|
|
9567
10324
|
signedResponderSigPbk = _r.sent();
|
|
9568
10325
|
return [4 /*yield*/, KeyFactoryService.asKey(plainInitiatorOneTimePbkCipher.sharedKey)];
|
|
9569
|
-
case
|
|
10326
|
+
case 9:
|
|
9570
10327
|
sharedKey = _r.sent();
|
|
9571
10328
|
return [4 /*yield*/, this.encryptionService.encrypt(rootKey.jwk, sharedKey.toJSON(true))];
|
|
9572
|
-
case
|
|
10329
|
+
case 10:
|
|
9573
10330
|
rkWrappedSharedKey = _r.sent();
|
|
9574
10331
|
return [4 /*yield*/, KeyFactoryService.asKey(plainInitiatorOneTimePbkCipher.mkSharedKey)];
|
|
9575
|
-
case
|
|
10332
|
+
case 11:
|
|
9576
10333
|
mkSharedKey = _r.sent();
|
|
9577
10334
|
return [4 /*yield*/, this.encryptionService.encrypt(masterKey.jwk, mkSharedKey.toJSON(true))];
|
|
9578
|
-
case
|
|
10335
|
+
case 12:
|
|
9579
10336
|
mkWrappedMkSharedKey = _r.sent();
|
|
9580
|
-
if (!responderContactCard) return [3 /*break*/,
|
|
10337
|
+
if (!responderContactCard) return [3 /*break*/, 16];
|
|
9581
10338
|
return [4 /*yield*/, this.keyFactory.createKey()];
|
|
9582
|
-
case
|
|
10339
|
+
case 13:
|
|
9583
10340
|
receiverKey = _r.sent();
|
|
9584
10341
|
_c = {};
|
|
9585
10342
|
_e = (_d = JSON).stringify;
|
|
9586
10343
|
return [4 /*yield*/, this.encryptionService.encrypt(rootKey.jwk, receiverKey.toJSON(true))];
|
|
9587
|
-
case
|
|
10344
|
+
case 14:
|
|
9588
10345
|
_c.receiverWrappedKey = _e.apply(_d, [_r.sent()]),
|
|
9589
10346
|
_c.receiverWrappingKeyId = rootKey.id;
|
|
9590
10347
|
_g = (_f = JSON).stringify;
|
|
9591
10348
|
return [4 /*yield*/, this.encryptionService.encrypt(receiverKey, responderContactCard)];
|
|
9592
|
-
case
|
|
10349
|
+
case 15:
|
|
9593
10350
|
responderContactCardCipherInput = (_c.receiverCipherData = _g.apply(_f, [_r.sent()]),
|
|
9594
10351
|
_c);
|
|
9595
|
-
_r.label =
|
|
9596
|
-
case
|
|
9597
|
-
if (!plainInitiatorRootKeyCipher.initiatorContactCard) return [3 /*break*/,
|
|
10352
|
+
_r.label = 16;
|
|
10353
|
+
case 16:
|
|
10354
|
+
if (!plainInitiatorRootKeyCipher.initiatorContactCard) return [3 /*break*/, 25];
|
|
9598
10355
|
initiatorContactCard = plainInitiatorRootKeyCipher.initiatorContactCard;
|
|
9599
10356
|
return [4 /*yield*/, this.keyFactory.createKey()];
|
|
9600
|
-
case
|
|
10357
|
+
case 17:
|
|
9601
10358
|
ownerKey = _r.sent();
|
|
9602
10359
|
return [4 /*yield*/, KeyFactoryService.asKey(plainInitiatorOneTimePbkCipher.responder.contactCard.sharedCipherKey)];
|
|
9603
|
-
case
|
|
10360
|
+
case 18:
|
|
9604
10361
|
sharedCipherKey = _r.sent();
|
|
9605
10362
|
_j = (_h = JSON).stringify;
|
|
9606
10363
|
return [4 /*yield*/, this.encryptionService.encrypt(rootKey.jwk, ownerKey.toJSON(true))];
|
|
9607
|
-
case
|
|
10364
|
+
case 19:
|
|
9608
10365
|
ownerWrappedKey = _j.apply(_h, [_r.sent()]);
|
|
9609
|
-
if (!initiatorContactCard.plainOwnerCipherDataJson) return [3 /*break*/,
|
|
10366
|
+
if (!initiatorContactCard.plainOwnerCipherDataJson) return [3 /*break*/, 21];
|
|
9610
10367
|
_m = (_l = JSON).stringify;
|
|
9611
10368
|
return [4 /*yield*/, this.encryptionService.encrypt(ownerKey, initiatorContactCard.plainOwnerCipherDataJson)];
|
|
9612
|
-
case
|
|
10369
|
+
case 20:
|
|
9613
10370
|
_k = _m.apply(_l, [_r.sent()]);
|
|
9614
|
-
return [3 /*break*/,
|
|
9615
|
-
case
|
|
10371
|
+
return [3 /*break*/, 22];
|
|
10372
|
+
case 21:
|
|
9616
10373
|
_k = '';
|
|
9617
|
-
_r.label =
|
|
9618
|
-
case
|
|
10374
|
+
_r.label = 22;
|
|
10375
|
+
case 22:
|
|
9619
10376
|
ownerCipherData = _k;
|
|
9620
10377
|
initiatorContactCardCipherInput = {
|
|
9621
10378
|
ownerWrappedKey: ownerWrappedKey,
|
|
@@ -9626,16 +10383,16 @@
|
|
|
9626
10383
|
sigPxkId: initiatorSigPrk.id,
|
|
9627
10384
|
};
|
|
9628
10385
|
return [4 /*yield*/, this.encryptionService.encrypt(sharedCipherKey, initiatorContactCard.plainSharedCipherDataJson)];
|
|
9629
|
-
case
|
|
10386
|
+
case 23:
|
|
9630
10387
|
sharedCipherData = _r.sent();
|
|
9631
10388
|
_o = initiatorContactCardSharedCipherInput;
|
|
9632
10389
|
_q = (_p = JSON).stringify;
|
|
9633
10390
|
return [4 /*yield*/, this.encryptionService.sign(initiatorSigPrk.jwk, sharedCipherData)];
|
|
9634
|
-
case
|
|
10391
|
+
case 24:
|
|
9635
10392
|
_o.sharedCipherDataSig =
|
|
9636
10393
|
_q.apply(_p, [_r.sent()]);
|
|
9637
|
-
_r.label =
|
|
9638
|
-
case
|
|
10394
|
+
_r.label = 25;
|
|
10395
|
+
case 25: return [4 /*yield*/, this.lrApollo.mutate({
|
|
9639
10396
|
mutation: CompleteOtkMutation,
|
|
9640
10397
|
variables: {
|
|
9641
10398
|
input: {
|
|
@@ -9653,7 +10410,7 @@
|
|
|
9653
10410
|
},
|
|
9654
10411
|
},
|
|
9655
10412
|
})];
|
|
9656
|
-
case
|
|
10413
|
+
case 26:
|
|
9657
10414
|
res = _r.sent();
|
|
9658
10415
|
return [2 /*return*/, res.completeKeyExchangeOtk];
|
|
9659
10416
|
}
|
|
@@ -9681,7 +10438,7 @@
|
|
|
9681
10438
|
};
|
|
9682
10439
|
return KeyExchangeService;
|
|
9683
10440
|
}());
|
|
9684
|
-
KeyExchangeService.ɵprov = i0.ɵɵdefineInjectable({ factory: function KeyExchangeService_Factory() { return new KeyExchangeService(i0.ɵɵinject(KeyFactoryService), i0.ɵɵinject(KeyService), i0.ɵɵinject(LrApolloService), i0.ɵɵinject(EncryptionService), i0.ɵɵinject(
|
|
10441
|
+
KeyExchangeService.ɵprov = i0.ɵɵdefineInjectable({ factory: function KeyExchangeService_Factory() { return new KeyExchangeService(i0.ɵɵinject(KeyFactoryService), i0.ɵɵinject(KeyService), i0.ɵɵinject(LrApolloService), i0.ɵɵinject(EncryptionService), i0.ɵɵinject(exports.Auth2Service)); }, token: KeyExchangeService, providedIn: "root" });
|
|
9685
10442
|
KeyExchangeService.decorators = [
|
|
9686
10443
|
{ type: i0.Injectable, args: [{
|
|
9687
10444
|
providedIn: 'root',
|
|
@@ -9692,13 +10449,12 @@
|
|
|
9692
10449
|
{ type: KeyService },
|
|
9693
10450
|
{ type: LrApolloService },
|
|
9694
10451
|
{ type: EncryptionService },
|
|
9695
|
-
{ type:
|
|
9696
|
-
{ type: UserService }
|
|
10452
|
+
{ type: exports.Auth2Service }
|
|
9697
10453
|
]; };
|
|
9698
10454
|
|
|
9699
10455
|
var KeyExchangeFragment = gqlTyped(templateObject_1$k || (templateObject_1$k = __makeTemplateObject(["\nfragment KeyExchangeFragment on KeyExchangeNode {\n id\n token\n state\n mode\n isInitiator\n initiator {\n id\n username\n config\n }\n responder {\n id\n username\n }\n created\n modified\n tokenExpiryTime\n isExpired\n initiatorRootKeyCipher\n initiatorActionRequired\n responderActionRequired\n responderEmailAddress\n otk {\n state\n otKeyParams\n otKeyCipher\n sharedKey {\n id\n }\n mkSharedKey {\n id\n }\n initiatorSigPxk {\n id\n }\n responderSigPxk {\n id\n }\n initiatorOneTimePbkCipher\n responderPbkCipher\n }\n}\n"], ["\nfragment KeyExchangeFragment on KeyExchangeNode {\n id\n token\n state\n mode\n isInitiator\n initiator {\n id\n username\n config\n }\n responder {\n id\n username\n }\n created\n modified\n tokenExpiryTime\n isExpired\n initiatorRootKeyCipher\n initiatorActionRequired\n responderActionRequired\n responderEmailAddress\n otk {\n state\n otKeyParams\n otKeyCipher\n sharedKey {\n id\n }\n mkSharedKey {\n id\n }\n initiatorSigPxk {\n id\n }\n responderSigPxk {\n id\n }\n initiatorOneTimePbkCipher\n responderPbkCipher\n }\n}\n"])));
|
|
9700
10456
|
var UserSharedKeyFragment = gqlTyped(templateObject_2$h || (templateObject_2$h = __makeTemplateObject(["\nfragment UserSharedKeyFragment on UserSharedKeyNode {\n userSigPrk {\n id\n }\n otherSigPbk {\n id\n }\n sharedKey {\n id\n }\n mkSharedKey {\n id\n }\n}"], ["\nfragment UserSharedKeyFragment on UserSharedKeyNode {\n userSigPrk {\n id\n }\n otherSigPbk {\n id\n }\n sharedKey {\n id\n }\n mkSharedKey {\n id\n }\n}"])));
|
|
9701
|
-
var KeyExchangesQuery2 = gqlTyped(templateObject_3$
|
|
10457
|
+
var KeyExchangesQuery2 = gqlTyped(templateObject_3$e || (templateObject_3$e = __makeTemplateObject(["\nquery KeyExchangesQuery2($state: String) {\n keyExchanges(state: $state) {\n edges {\n node {\n ...KeyExchangeFragment\n }\n }\n }\n}\n", "\n"], ["\nquery KeyExchangesQuery2($state: String) {\n keyExchanges(state: $state) {\n edges {\n node {\n ...KeyExchangeFragment\n }\n }\n }\n}\n", "\n"])), KeyExchangeFragment);
|
|
9702
10458
|
var KeyExchangeQuery2 = gqlTyped(templateObject_4$a || (templateObject_4$a = __makeTemplateObject(["\nquery KeyExchangeQuery2($id: LrRelayIdInput!) {\n keyExchange(id: $id) {\n ...KeyExchangeFragment\n }\n}\n", "\n"], ["\nquery KeyExchangeQuery2($id: LrRelayIdInput!) {\n keyExchange(id: $id) {\n ...KeyExchangeFragment\n }\n}\n", "\n"])), KeyExchangeFragment);
|
|
9703
10459
|
var KeyExchangeTokenQuery2 = gqlTyped(templateObject_5$9 || (templateObject_5$9 = __makeTemplateObject(["\nquery KeyExchangeTokenQuery2($id: LrRelayIdInput!, $token: String) {\n keyExchange(id: $id, token: $token) {\n ...KeyExchangeFragment\n }\n}\n", "\n"], ["\nquery KeyExchangeTokenQuery2($id: LrRelayIdInput!, $token: String) {\n keyExchange(id: $id, token: $token) {\n ...KeyExchangeFragment\n }\n}\n", "\n"])), KeyExchangeFragment);
|
|
9704
10460
|
var CancelKeyExchangeMutation = gqlTyped(templateObject_6$8 || (templateObject_6$8 = __makeTemplateObject(["\nmutation CancelKeyExchangeMutation($input: CancelKeyExchangeInput!) {\n cancelKeyExchange(input: $input) {\n keyExchange {\n id\n }\n }\n}\n"], ["\nmutation CancelKeyExchangeMutation($input: CancelKeyExchangeInput!) {\n cancelKeyExchange(input: $input) {\n keyExchange {\n id\n }\n }\n}\n"])));
|
|
@@ -9707,7 +10463,7 @@
|
|
|
9707
10463
|
var RespondKeyExchangeOtkMutation = gqlTyped(templateObject_9$4 || (templateObject_9$4 = __makeTemplateObject(["\nmutation RespondKeyExchangeOtkMutation($input: RespondKeyExchangeOtkInput!) {\n respondKeyExchangeOtk(input: $input) {\n keyExchange {\n ...KeyExchangeFragment\n }\n userSharedKey {\n ...UserSharedKeyFragment\n }\n tp {\n id\n }\n }\n}\n", "\n", "\n"], ["\nmutation RespondKeyExchangeOtkMutation($input: RespondKeyExchangeOtkInput!) {\n respondKeyExchangeOtk(input: $input) {\n keyExchange {\n ...KeyExchangeFragment\n }\n userSharedKey {\n ...UserSharedKeyFragment\n }\n tp {\n id\n }\n }\n}\n", "\n", "\n"])), KeyExchangeFragment, UserSharedKeyFragment);
|
|
9708
10464
|
var CompleteKeyExchangeOtkMutation = gqlTyped(templateObject_10$3 || (templateObject_10$3 = __makeTemplateObject(["\nmutation CompleteKeyExchangeOtkMutation(\n $input: CompleteKeyExchangeOtkInput!\n) {\n completeKeyExchangeOtk(input: $input) {\n keyExchange {\n ...KeyExchangeFragment\n }\n userSharedKey {\n ...UserSharedKeyFragment\n }\n tp {\n id\n }\n }\n}\n", "\n", "\n"], ["\nmutation CompleteKeyExchangeOtkMutation(\n $input: CompleteKeyExchangeOtkInput!\n) {\n completeKeyExchangeOtk(input: $input) {\n keyExchange {\n ...KeyExchangeFragment\n }\n userSharedKey {\n ...UserSharedKeyFragment\n }\n tp {\n id\n }\n }\n}\n", "\n", "\n"])), KeyExchangeFragment, UserSharedKeyFragment);
|
|
9709
10465
|
var CurrentUserSharedKeyQuery2 = gqlTyped(templateObject_11$2 || (templateObject_11$2 = __makeTemplateObject(["\nquery CurrentUserSharedKeyQuery2(\n $username: String\n $userId: LrRelayIdInput\n) {\n currentUserSharedKey(\n username: $username\n userId: $userId\n ) {\n userSharedKey {\n ...UserSharedKeyFragment\n }\n }\n}\n", "\n"], ["\nquery CurrentUserSharedKeyQuery2(\n $username: String\n $userId: LrRelayIdInput\n) {\n currentUserSharedKey(\n username: $username\n userId: $userId\n ) {\n userSharedKey {\n ...UserSharedKeyFragment\n }\n }\n}\n", "\n"])), UserSharedKeyFragment);
|
|
9710
|
-
var templateObject_1$k, templateObject_2$h, templateObject_3$
|
|
10466
|
+
var templateObject_1$k, templateObject_2$h, templateObject_3$e, templateObject_4$a, templateObject_5$9, templateObject_6$8, templateObject_7$7, templateObject_8$6, templateObject_9$4, templateObject_10$3, templateObject_11$2;
|
|
9711
10467
|
|
|
9712
10468
|
exports.KeyExchange2Service = /** @class */ (function (_super) {
|
|
9713
10469
|
__extends(KeyExchange2Service, _super);
|
|
@@ -9734,19 +10490,17 @@
|
|
|
9734
10490
|
case 2:
|
|
9735
10491
|
if (!(keyExchange.otk.state === 'OTK_INITIATED' &&
|
|
9736
10492
|
!keyExchange.isInitiator &&
|
|
9737
|
-
keyExchange.otk.responderPbkCipher)) return [3 /*break*/,
|
|
9738
|
-
|
|
9739
|
-
case 3:
|
|
9740
|
-
prk = _a.sent();
|
|
10493
|
+
keyExchange.otk.responderPbkCipher)) return [3 /*break*/, 5];
|
|
10494
|
+
prk = this.keyService.currentPxk;
|
|
9741
10495
|
return [4 /*yield*/, this.encryptionService.decrypt(prk.jwk, JSON.parse(keyExchange.otk.responderPbkCipher), {
|
|
9742
10496
|
serializations: [JoseSerialization.COMPACT],
|
|
9743
10497
|
})];
|
|
9744
|
-
case
|
|
10498
|
+
case 3:
|
|
9745
10499
|
decryptedCipher = _a.sent();
|
|
9746
|
-
if (!decryptedCipher.otKey) return [3 /*break*/,
|
|
10500
|
+
if (!decryptedCipher.otKey) return [3 /*break*/, 5];
|
|
9747
10501
|
return [4 /*yield*/, KeyFactoryService.asKey(decryptedCipher.otKey)];
|
|
9748
|
-
case
|
|
9749
|
-
case
|
|
10502
|
+
case 4: return [2 /*return*/, _a.sent()];
|
|
10503
|
+
case 5: return [2 /*return*/, null];
|
|
9750
10504
|
}
|
|
9751
10505
|
});
|
|
9752
10506
|
});
|
|
@@ -9803,36 +10557,35 @@
|
|
|
9803
10557
|
var rootKey, initiatorRootKeyCipherClearJson, otKey, otk, _a, _b, _c, _d, _e, _f, _g;
|
|
9804
10558
|
return __generator(this, function (_h) {
|
|
9805
10559
|
switch (_h.label) {
|
|
9806
|
-
case 0:
|
|
9807
|
-
|
|
9808
|
-
rootKey = _h.sent();
|
|
10560
|
+
case 0:
|
|
10561
|
+
rootKey = this.keyService.currentRootKey;
|
|
9809
10562
|
return [4 /*yield*/, this.encryptionService.decrypt(rootKey.jwk, keyExchange.initiatorRootKeyCipher)];
|
|
9810
|
-
case
|
|
10563
|
+
case 1:
|
|
9811
10564
|
initiatorRootKeyCipherClearJson = (_h.sent());
|
|
9812
10565
|
return [4 /*yield*/, KeyFactoryService.asKey(initiatorRootKeyCipherClearJson.otKey)];
|
|
9813
|
-
case
|
|
10566
|
+
case 2:
|
|
9814
10567
|
otKey = _h.sent();
|
|
9815
10568
|
keyExchange = Object.assign(Object.assign({}, keyExchange), { initiatorRootKeyCipherClearJson: initiatorRootKeyCipherClearJson });
|
|
9816
10569
|
otk = keyExchange.otk;
|
|
9817
|
-
if (!otk.initiatorOneTimePbkCipher) return [3 /*break*/,
|
|
10570
|
+
if (!otk.initiatorOneTimePbkCipher) return [3 /*break*/, 5];
|
|
9818
10571
|
_b = (_a = Object).assign;
|
|
9819
10572
|
_c = [Object.assign({}, otk)];
|
|
9820
10573
|
_d = {};
|
|
9821
10574
|
_e = this.decryptResponseCipher;
|
|
9822
10575
|
_f = [otKey];
|
|
9823
10576
|
return [4 /*yield*/, KeyFactoryService.asKey(initiatorRootKeyCipherClearJson.oneTimePrk)];
|
|
9824
|
-
case
|
|
9825
|
-
case
|
|
10577
|
+
case 3: return [4 /*yield*/, _e.apply(this, _f.concat([_h.sent(), otk.initiatorOneTimePbkCipher]))];
|
|
10578
|
+
case 4:
|
|
9826
10579
|
otk = _b.apply(_a, _c.concat([(_d.initiatorOneTimePbkCipherClearJson = _h.sent(), _d)]));
|
|
9827
|
-
_h.label =
|
|
9828
|
-
case
|
|
9829
|
-
if (!otk.otKeyCipher) return [3 /*break*/,
|
|
10580
|
+
_h.label = 5;
|
|
10581
|
+
case 5:
|
|
10582
|
+
if (!otk.otKeyCipher) return [3 /*break*/, 7];
|
|
9830
10583
|
_g = otk;
|
|
9831
10584
|
return [4 /*yield*/, this.encryptionService.decrypt(otKey, otk.otKeyCipher)];
|
|
9832
|
-
case
|
|
10585
|
+
case 6:
|
|
9833
10586
|
_g.otKeyCipherClearJson = _h.sent();
|
|
9834
|
-
_h.label =
|
|
9835
|
-
case
|
|
10587
|
+
_h.label = 7;
|
|
10588
|
+
case 7: return [2 /*return*/, Object.assign(Object.assign({}, keyExchange), { otk: otk })];
|
|
9836
10589
|
}
|
|
9837
10590
|
});
|
|
9838
10591
|
});
|
|
@@ -9985,19 +10738,15 @@
|
|
|
9985
10738
|
return [4 /*yield*/, this.keyFactory.createPkcKey()];
|
|
9986
10739
|
case 2:
|
|
9987
10740
|
initiatorOneTimePrk = _a.sent();
|
|
9988
|
-
|
|
9989
|
-
|
|
9990
|
-
initiatorPrk = _a.sent();
|
|
9991
|
-
return [4 /*yield*/, this.keyService.getCurrentSigPxk()];
|
|
9992
|
-
case 4:
|
|
9993
|
-
initiatorSigPrk = _a.sent();
|
|
10741
|
+
initiatorPrk = this.keyService.currentPxk;
|
|
10742
|
+
initiatorSigPrk = this.keyService.currentSigPxk;
|
|
9994
10743
|
initiatorPlainDataSig = null;
|
|
9995
|
-
if (!(contactCard && contactCard.ownerPlainDataJson)) return [3 /*break*/,
|
|
10744
|
+
if (!(contactCard && contactCard.ownerPlainDataJson)) return [3 /*break*/, 4];
|
|
9996
10745
|
return [4 /*yield*/, this.encryptionService.signToString(initiatorSigPrk.jwk, contactCard.ownerPlainDataJson)];
|
|
9997
|
-
case
|
|
10746
|
+
case 3:
|
|
9998
10747
|
initiatorPlainDataSig = _a.sent();
|
|
9999
|
-
_a.label =
|
|
10000
|
-
case
|
|
10748
|
+
_a.label = 4;
|
|
10749
|
+
case 4:
|
|
10001
10750
|
initiator = {
|
|
10002
10751
|
message: message,
|
|
10003
10752
|
contactCard: contactCard && {
|
|
@@ -10014,7 +10763,7 @@
|
|
|
10014
10763
|
initiator: Object.assign(Object.assign({}, initiator), { oneTimePbk: initiatorOneTimePrk.toJSON(), pbk: initiatorPrk.jwk.toJSON(), sigPbk: initiatorSigPrk.jwk.toJSON() }),
|
|
10015
10764
|
};
|
|
10016
10765
|
return [4 /*yield*/, this.keyGraph.encryptToString(otKey, plainOtKeyCipher)];
|
|
10017
|
-
case
|
|
10766
|
+
case 5:
|
|
10018
10767
|
otKeyCipher = _a.sent();
|
|
10019
10768
|
initiatorRootKeyCipherClearJson = {
|
|
10020
10769
|
nonce: nonce,
|
|
@@ -10030,11 +10779,9 @@
|
|
|
10030
10779
|
initiatorContactCard: contactCard,
|
|
10031
10780
|
initiator: initiator,
|
|
10032
10781
|
};
|
|
10033
|
-
|
|
10034
|
-
case 8:
|
|
10035
|
-
rootKey = _a.sent();
|
|
10782
|
+
rootKey = this.keyService.currentRootKey;
|
|
10036
10783
|
return [4 /*yield*/, this.keyGraph.encryptToString(rootKey.jwk, initiatorRootKeyCipherClearJson)];
|
|
10037
|
-
case
|
|
10784
|
+
case 6:
|
|
10038
10785
|
initiatorRootKeyCipher = _a.sent();
|
|
10039
10786
|
otKeyK = otKey.toJSON(true).k;
|
|
10040
10787
|
lrMutation = new LrMutation({
|
|
@@ -10073,48 +10820,40 @@
|
|
|
10073
10820
|
KeyExchange2Service.prototype.respondOtkMutation = function (_a) {
|
|
10074
10821
|
var keyExchangeId = _a.keyExchangeId, token = _a.token, decryptedOtk = _a.decryptedOtk, message = _a.message, initiatorContactCard = _a.initiatorContactCard, responderContactCard = _a.responderContactCard;
|
|
10075
10822
|
return __awaiter(this, void 0, void 0, function () {
|
|
10076
|
-
var rootKey,
|
|
10823
|
+
var rootKey, masterKey, sharedKey, mkSharedKey, rkWrappedSharedKey, mkWrappedMkSharedKey, initiatorOneTimePbk, initiatorPbk, initiatorSigPbk, responderPrk, responderSigPrk, signedInitiatorPbk, signedInitiatorSigPbk, initiatorOneTimePbkCipherClearJson, receivedCardInput, sharedCipherDataClearJson, receiverKey, ccSharedKey, sigPxk, _a, _b, _c, _d, _e, _f, _g, _h, sharedCipherData, _j, _k, _l, responderCardInput, ownerKey, ccSharedKey, sigPxk, _m, _o, _p, _q, _r, _s, _t, _u, sharedCipherData, _v, _w, _x, _y, _z, _0, initiatorOneTimePbkCipher;
|
|
10077
10824
|
return __generator(this, function (_1) {
|
|
10078
10825
|
switch (_1.label) {
|
|
10079
|
-
case 0:
|
|
10080
|
-
|
|
10081
|
-
|
|
10082
|
-
masterKeyId = this.keyService.getCurrentMasterKey().id;
|
|
10083
|
-
return [4 /*yield*/, this.keyService.getCurrentMasterKey()];
|
|
10084
|
-
case 2:
|
|
10085
|
-
masterKey = _1.sent();
|
|
10826
|
+
case 0:
|
|
10827
|
+
rootKey = this.keyService.currentRootKey;
|
|
10828
|
+
masterKey = this.keyService.currentMasterKey;
|
|
10086
10829
|
return [4 /*yield*/, this.keyFactory.createKey()];
|
|
10087
|
-
case
|
|
10830
|
+
case 1:
|
|
10088
10831
|
sharedKey = _1.sent();
|
|
10089
10832
|
return [4 /*yield*/, this.keyFactory.createKey()];
|
|
10090
|
-
case
|
|
10833
|
+
case 2:
|
|
10091
10834
|
mkSharedKey = _1.sent();
|
|
10092
10835
|
return [4 /*yield*/, this.encryptionService.encrypt(rootKey.jwk, sharedKey.toJSON(true))];
|
|
10093
|
-
case
|
|
10836
|
+
case 3:
|
|
10094
10837
|
rkWrappedSharedKey = _1.sent();
|
|
10095
10838
|
return [4 /*yield*/, this.encryptionService.encrypt(masterKey.jwk, mkSharedKey.toJSON(true))];
|
|
10096
|
-
case
|
|
10839
|
+
case 4:
|
|
10097
10840
|
mkWrappedMkSharedKey = _1.sent();
|
|
10098
10841
|
return [4 /*yield*/, KeyFactoryService.asKey(decryptedOtk.otKeyCipherClearJson.initiator.oneTimePbk)];
|
|
10099
|
-
case
|
|
10842
|
+
case 5:
|
|
10100
10843
|
initiatorOneTimePbk = _1.sent();
|
|
10101
10844
|
return [4 /*yield*/, KeyFactoryService.asKey(decryptedOtk.otKeyCipherClearJson.initiator.pbk)];
|
|
10102
|
-
case
|
|
10845
|
+
case 6:
|
|
10103
10846
|
initiatorPbk = _1.sent();
|
|
10104
10847
|
return [4 /*yield*/, KeyFactoryService.asKey(decryptedOtk.otKeyCipherClearJson.initiator.sigPbk)];
|
|
10105
|
-
case
|
|
10848
|
+
case 7:
|
|
10106
10849
|
initiatorSigPbk = _1.sent();
|
|
10107
|
-
|
|
10108
|
-
|
|
10109
|
-
responderPrk = _1.sent();
|
|
10110
|
-
return [4 /*yield*/, this.keyService.getCurrentSigPxk()];
|
|
10111
|
-
case 11:
|
|
10112
|
-
responderSigPrk = _1.sent();
|
|
10850
|
+
responderPrk = this.keyService.currentPxk;
|
|
10851
|
+
responderSigPrk = this.keyService.currentSigPxk;
|
|
10113
10852
|
return [4 /*yield*/, this.encryptionService.sign(responderSigPrk.jwk, initiatorPbk.toJSON())];
|
|
10114
|
-
case
|
|
10853
|
+
case 8:
|
|
10115
10854
|
signedInitiatorPbk = _1.sent();
|
|
10116
10855
|
return [4 /*yield*/, this.encryptionService.sign(responderSigPrk.jwk, initiatorSigPbk.toJSON())];
|
|
10117
|
-
case
|
|
10856
|
+
case 9:
|
|
10118
10857
|
signedInitiatorSigPbk = _1.sent();
|
|
10119
10858
|
initiatorOneTimePbkCipherClearJson = {
|
|
10120
10859
|
nonce: decryptedOtk.otKeyCipherClearJson.nonce,
|
|
@@ -10126,109 +10865,105 @@
|
|
|
10126
10865
|
message: message,
|
|
10127
10866
|
},
|
|
10128
10867
|
};
|
|
10129
|
-
if (!decryptedOtk.otKeyCipherClearJson.initiator.contactCard) return [3 /*break*/,
|
|
10868
|
+
if (!decryptedOtk.otKeyCipherClearJson.initiator.contactCard) return [3 /*break*/, 19];
|
|
10130
10869
|
sharedCipherDataClearJson = decryptedOtk.otKeyCipherClearJson.initiator.contactCard
|
|
10131
10870
|
.sharedCipherDataClearJson;
|
|
10132
10871
|
return [4 /*yield*/, this.keyFactory.createKey()];
|
|
10133
|
-
case
|
|
10872
|
+
case 10:
|
|
10134
10873
|
receiverKey = _1.sent();
|
|
10135
10874
|
return [4 /*yield*/, this.keyFactory.createKey()];
|
|
10136
|
-
case
|
|
10875
|
+
case 11:
|
|
10137
10876
|
ccSharedKey = _1.sent();
|
|
10138
|
-
|
|
10139
|
-
case 16:
|
|
10140
|
-
sigPxk = _1.sent();
|
|
10877
|
+
sigPxk = this.keyService.currentSigPxk;
|
|
10141
10878
|
_a = {};
|
|
10142
10879
|
_c = (_b = JSON).stringify;
|
|
10143
10880
|
return [4 /*yield*/, this.encryptionService.encrypt(rootKey.jwk, receiverKey.toJSON(true))];
|
|
10144
|
-
case
|
|
10881
|
+
case 12:
|
|
10145
10882
|
_a.receiverWrappedKey = _c.apply(_b, [_1.sent()]),
|
|
10146
10883
|
_a.receiverWrappingKeyId = rootKey.id;
|
|
10147
|
-
if (!initiatorContactCard) return [3 /*break*/,
|
|
10884
|
+
if (!initiatorContactCard) return [3 /*break*/, 14];
|
|
10148
10885
|
_f = (_e = JSON).stringify;
|
|
10149
10886
|
return [4 /*yield*/, this.encryptionService.encrypt(receiverKey, initiatorContactCard.receiverCipherDataClearJson)];
|
|
10150
|
-
case
|
|
10887
|
+
case 13:
|
|
10151
10888
|
_d = _f.apply(_e, [_1.sent()]);
|
|
10152
|
-
return [3 /*break*/,
|
|
10153
|
-
case
|
|
10889
|
+
return [3 /*break*/, 15];
|
|
10890
|
+
case 14:
|
|
10154
10891
|
_d = '';
|
|
10155
|
-
_1.label =
|
|
10156
|
-
case
|
|
10892
|
+
_1.label = 15;
|
|
10893
|
+
case 15:
|
|
10157
10894
|
_a.receiverCipherData = _d;
|
|
10158
10895
|
_h = (_g = JSON).stringify;
|
|
10159
10896
|
return [4 /*yield*/, this.encryptionService.encrypt(sharedKey, ccSharedKey.toJSON(true))];
|
|
10160
|
-
case
|
|
10897
|
+
case 16:
|
|
10161
10898
|
receivedCardInput = (_a.sharedWrappedKey = _h.apply(_g, [_1.sent()]),
|
|
10162
10899
|
_a);
|
|
10163
10900
|
return [4 /*yield*/, this.encryptionService.encrypt(ccSharedKey, sharedCipherDataClearJson)];
|
|
10164
|
-
case
|
|
10901
|
+
case 17:
|
|
10165
10902
|
sharedCipherData = _1.sent();
|
|
10166
10903
|
_j = receivedCardInput;
|
|
10167
10904
|
_l = (_k = JSON).stringify;
|
|
10168
10905
|
return [4 /*yield*/, this.encryptionService.sign(sigPxk.jwk, sharedCipherData)];
|
|
10169
|
-
case
|
|
10906
|
+
case 18:
|
|
10170
10907
|
_j.sharedCipherDataSig = _l.apply(_k, [_1.sent()]);
|
|
10171
10908
|
receivedCardInput.sigPxkId = sigPxk.id;
|
|
10172
10909
|
initiatorOneTimePbkCipherClearJson.responder.contactCard = Object.assign(Object.assign({}, initiatorOneTimePbkCipherClearJson.responder.contactCard), { sharedCipherKey: ccSharedKey.toJSON(true) });
|
|
10173
|
-
_1.label =
|
|
10174
|
-
case
|
|
10175
|
-
if (!responderContactCard) return [3 /*break*/,
|
|
10910
|
+
_1.label = 19;
|
|
10911
|
+
case 19:
|
|
10912
|
+
if (!responderContactCard) return [3 /*break*/, 31];
|
|
10176
10913
|
return [4 /*yield*/, this.keyFactory.createKey()];
|
|
10177
|
-
case
|
|
10914
|
+
case 20:
|
|
10178
10915
|
ownerKey = _1.sent();
|
|
10179
10916
|
return [4 /*yield*/, this.keyFactory.createKey()];
|
|
10180
|
-
case
|
|
10917
|
+
case 21:
|
|
10181
10918
|
ccSharedKey = _1.sent();
|
|
10182
|
-
|
|
10183
|
-
case 27:
|
|
10184
|
-
sigPxk = _1.sent();
|
|
10919
|
+
sigPxk = this.keyService.currentSigPxk;
|
|
10185
10920
|
_m = {};
|
|
10186
10921
|
_p = (_o = JSON).stringify;
|
|
10187
10922
|
return [4 /*yield*/, this.encryptionService.encrypt(rootKey.jwk, ownerKey.toJSON(true))];
|
|
10188
|
-
case
|
|
10923
|
+
case 22:
|
|
10189
10924
|
_m.ownerWrappedKey = _p.apply(_o, [_1.sent()]),
|
|
10190
10925
|
_m.ownerWrappingKeyId = rootKey.id;
|
|
10191
|
-
if (!responderContactCard.ownerCipherDataClearJson) return [3 /*break*/,
|
|
10926
|
+
if (!responderContactCard.ownerCipherDataClearJson) return [3 /*break*/, 24];
|
|
10192
10927
|
_s = (_r = JSON).stringify;
|
|
10193
10928
|
return [4 /*yield*/, this.encryptionService.encrypt(ownerKey, responderContactCard.ownerCipherDataClearJson)];
|
|
10194
|
-
case
|
|
10929
|
+
case 23:
|
|
10195
10930
|
_q = _s.apply(_r, [_1.sent()]);
|
|
10196
|
-
return [3 /*break*/,
|
|
10197
|
-
case
|
|
10931
|
+
return [3 /*break*/, 25];
|
|
10932
|
+
case 24:
|
|
10198
10933
|
_q = '';
|
|
10199
|
-
_1.label =
|
|
10200
|
-
case
|
|
10934
|
+
_1.label = 25;
|
|
10935
|
+
case 25:
|
|
10201
10936
|
_m.ownerCipherData = _q;
|
|
10202
10937
|
_u = (_t = JSON).stringify;
|
|
10203
10938
|
return [4 /*yield*/, this.encryptionService.encrypt(sharedKey, ccSharedKey.toJSON(true))];
|
|
10204
|
-
case
|
|
10939
|
+
case 26:
|
|
10205
10940
|
responderCardInput = (_m.sharedWrappedKey = _u.apply(_t, [_1.sent()]),
|
|
10206
10941
|
_m);
|
|
10207
10942
|
return [4 /*yield*/, this.encryptionService.encrypt(ccSharedKey, responderContactCard.sharedCipherDataClearJson)];
|
|
10208
|
-
case
|
|
10943
|
+
case 27:
|
|
10209
10944
|
sharedCipherData = _1.sent();
|
|
10210
10945
|
_v = responderCardInput;
|
|
10211
10946
|
_x = (_w = JSON).stringify;
|
|
10212
10947
|
return [4 /*yield*/, this.encryptionService.sign(sigPxk.jwk, sharedCipherData)];
|
|
10213
|
-
case
|
|
10948
|
+
case 28:
|
|
10214
10949
|
_v.sharedCipherDataSig = _x.apply(_w, [_1.sent()]);
|
|
10215
10950
|
responderCardInput.sigPxkId = sigPxk.id;
|
|
10216
|
-
if (!responderContactCard.ownerPlainDataJson) return [3 /*break*/,
|
|
10951
|
+
if (!responderContactCard.ownerPlainDataJson) return [3 /*break*/, 30];
|
|
10217
10952
|
_y = responderCardInput;
|
|
10218
10953
|
_0 = (_z = JSON).stringify;
|
|
10219
10954
|
return [4 /*yield*/, this.encryptionService.sign(responderSigPrk.jwk, responderContactCard.ownerPlainDataJson)];
|
|
10220
|
-
case
|
|
10955
|
+
case 29:
|
|
10221
10956
|
_y.ownerPlainDataSig = _0.apply(_z, [_1.sent()]);
|
|
10222
|
-
_1.label =
|
|
10223
|
-
case
|
|
10957
|
+
_1.label = 30;
|
|
10958
|
+
case 30:
|
|
10224
10959
|
// Contact card info readable by the initiator
|
|
10225
10960
|
initiatorOneTimePbkCipherClearJson.responder.contactCard = Object.assign(Object.assign({}, initiatorOneTimePbkCipherClearJson.responder.contactCard), { sharedCipherDataClearJson: responderContactCard.sharedCipherDataClearJson });
|
|
10226
|
-
_1.label =
|
|
10227
|
-
case
|
|
10228
|
-
case
|
|
10961
|
+
_1.label = 31;
|
|
10962
|
+
case 31: return [4 /*yield*/, this.encryptionService.encrypt(initiatorOneTimePbk, initiatorOneTimePbkCipherClearJson)];
|
|
10963
|
+
case 32:
|
|
10229
10964
|
initiatorOneTimePbkCipher = _1.sent();
|
|
10230
10965
|
return [4 /*yield*/, this.encryptionService.encrypt(decryptedOtk.otKey, initiatorOneTimePbkCipher)];
|
|
10231
|
-
case
|
|
10966
|
+
case 33:
|
|
10232
10967
|
// Encrypt with the otk again to keep use of asymmetric keys to a minimum.
|
|
10233
10968
|
initiatorOneTimePbkCipher = _1.sent();
|
|
10234
10969
|
return [2 /*return*/, new LrMutation({
|
|
@@ -10238,7 +10973,7 @@
|
|
|
10238
10973
|
keyExchangeId: keyExchangeId,
|
|
10239
10974
|
keyExchangeToken: token,
|
|
10240
10975
|
rootKeyId: rootKey.id,
|
|
10241
|
-
masterKeyId:
|
|
10976
|
+
masterKeyId: masterKey.id,
|
|
10242
10977
|
// These will be stored on the server
|
|
10243
10978
|
responderPxkId: responderPrk.id,
|
|
10244
10979
|
responderSigPxkId: responderSigPrk.id,
|
|
@@ -10273,95 +11008,90 @@
|
|
|
10273
11008
|
var rootKey, masterKey, initiatorRootKeyCipherClearJson, plainInitiatorOneTimePbkCipher, _a, _b, initiatorSigPrk, responderSigPbk, responderPbk, signedResponderPbk, signedResponderSigPbk, sharedKey, rkWrappedSharedKey, mkSharedKey, mkWrappedMkSharedKey, responderContactCardCipherInput, receiverKey, _c, _d, _e, _f, _g, initiatorContactCardCipherInput, initiatorContactCardSharedCipherInput, initiatorContactCardFromInit, ownerKey, sharedCipherKey, ownerWrappedKey, _h, _j, ownerCipherDataClearJson, ownerCipherData, _k, sharedCipherData, _l, _m, _o;
|
|
10274
11009
|
return __generator(this, function (_p) {
|
|
10275
11010
|
switch (_p.label) {
|
|
10276
|
-
case 0:
|
|
10277
|
-
|
|
10278
|
-
|
|
10279
|
-
return [4 /*yield*/, this.keyService.getCurrentMasterKey()];
|
|
10280
|
-
case 2:
|
|
10281
|
-
masterKey = _p.sent();
|
|
11011
|
+
case 0:
|
|
11012
|
+
rootKey = this.keyService.currentRootKey;
|
|
11013
|
+
masterKey = this.keyService.currentMasterKey;
|
|
10282
11014
|
return [4 /*yield*/, this.encryptionService.decrypt(rootKey.jwk, initiatorRootKeyCipher)];
|
|
10283
|
-
case
|
|
11015
|
+
case 1:
|
|
10284
11016
|
initiatorRootKeyCipherClearJson = (_p.sent());
|
|
10285
11017
|
_a = this.decryptResponseCipher;
|
|
10286
11018
|
return [4 /*yield*/, KeyFactoryService.asKey(initiatorRootKeyCipherClearJson.otKey)];
|
|
10287
|
-
case
|
|
11019
|
+
case 2:
|
|
10288
11020
|
_b = [_p.sent()];
|
|
10289
11021
|
return [4 /*yield*/, KeyFactoryService.asKey(initiatorRootKeyCipherClearJson.oneTimePrk)];
|
|
10290
|
-
case
|
|
10291
|
-
case
|
|
11022
|
+
case 3: return [4 /*yield*/, _a.apply(this, _b.concat([_p.sent(), initiatorOneTimePbkCipher]))];
|
|
11023
|
+
case 4:
|
|
10292
11024
|
plainInitiatorOneTimePbkCipher = _p.sent();
|
|
10293
11025
|
// Check the nonce match to ensure the responder was the one holding the OTK
|
|
10294
11026
|
if (initiatorRootKeyCipherClearJson.nonce !==
|
|
10295
11027
|
plainInitiatorOneTimePbkCipher.nonce) {
|
|
10296
11028
|
throw new KcCodeMismatchException('The nonce returned by responder does not match with the one created by the initiator.');
|
|
10297
11029
|
}
|
|
10298
|
-
|
|
10299
|
-
case 7:
|
|
10300
|
-
initiatorSigPrk = _p.sent();
|
|
11030
|
+
initiatorSigPrk = this.keyService.currentSigPxk;
|
|
10301
11031
|
return [4 /*yield*/, KeyFactoryService.asKey(plainInitiatorOneTimePbkCipher.responder.sigPbk)];
|
|
10302
|
-
case
|
|
11032
|
+
case 5:
|
|
10303
11033
|
responderSigPbk = _p.sent();
|
|
10304
11034
|
return [4 /*yield*/, KeyFactoryService.asKey(plainInitiatorOneTimePbkCipher.responder.pbk)];
|
|
10305
|
-
case
|
|
11035
|
+
case 6:
|
|
10306
11036
|
responderPbk = _p.sent();
|
|
10307
11037
|
return [4 /*yield*/, this.encryptionService.sign(initiatorSigPrk.jwk, responderPbk.toJSON())];
|
|
10308
|
-
case
|
|
11038
|
+
case 7:
|
|
10309
11039
|
signedResponderPbk = _p.sent();
|
|
10310
11040
|
return [4 /*yield*/, this.encryptionService.sign(initiatorSigPrk.jwk, responderSigPbk.toJSON())];
|
|
10311
|
-
case
|
|
11041
|
+
case 8:
|
|
10312
11042
|
signedResponderSigPbk = _p.sent();
|
|
10313
11043
|
return [4 /*yield*/, KeyFactoryService.asKey(plainInitiatorOneTimePbkCipher.sharedKey)];
|
|
10314
|
-
case
|
|
11044
|
+
case 9:
|
|
10315
11045
|
sharedKey = _p.sent();
|
|
10316
11046
|
return [4 /*yield*/, this.encryptionService.encrypt(rootKey.jwk, sharedKey.toJSON(true))];
|
|
10317
|
-
case
|
|
11047
|
+
case 10:
|
|
10318
11048
|
rkWrappedSharedKey = _p.sent();
|
|
10319
11049
|
return [4 /*yield*/, KeyFactoryService.asKey(plainInitiatorOneTimePbkCipher.mkSharedKey)];
|
|
10320
|
-
case
|
|
11050
|
+
case 11:
|
|
10321
11051
|
mkSharedKey = _p.sent();
|
|
10322
11052
|
return [4 /*yield*/, this.encryptionService.encrypt(masterKey.jwk, mkSharedKey.toJSON(true))];
|
|
10323
|
-
case
|
|
11053
|
+
case 12:
|
|
10324
11054
|
mkWrappedMkSharedKey = _p.sent();
|
|
10325
|
-
if (!responderContactCard) return [3 /*break*/,
|
|
11055
|
+
if (!responderContactCard) return [3 /*break*/, 16];
|
|
10326
11056
|
return [4 /*yield*/, this.keyFactory.createKey()];
|
|
10327
|
-
case
|
|
11057
|
+
case 13:
|
|
10328
11058
|
receiverKey = _p.sent();
|
|
10329
11059
|
_c = {};
|
|
10330
11060
|
_e = (_d = JSON).stringify;
|
|
10331
11061
|
return [4 /*yield*/, this.encryptionService.encrypt(rootKey.jwk, receiverKey.toJSON(true))];
|
|
10332
|
-
case
|
|
11062
|
+
case 14:
|
|
10333
11063
|
_c.receiverWrappedKey = _e.apply(_d, [_p.sent()]),
|
|
10334
11064
|
_c.receiverWrappingKeyId = rootKey.id;
|
|
10335
11065
|
_g = (_f = JSON).stringify;
|
|
10336
11066
|
return [4 /*yield*/, this.encryptionService.encrypt(receiverKey, responderContactCard.receiverCipherDataClearJson)];
|
|
10337
|
-
case
|
|
11067
|
+
case 15:
|
|
10338
11068
|
responderContactCardCipherInput = (_c.receiverCipherData = _g.apply(_f, [_p.sent()]),
|
|
10339
11069
|
_c);
|
|
10340
|
-
_p.label =
|
|
10341
|
-
case
|
|
10342
|
-
if (!initiatorRootKeyCipherClearJson.initiatorContactCard) return [3 /*break*/,
|
|
11070
|
+
_p.label = 16;
|
|
11071
|
+
case 16:
|
|
11072
|
+
if (!initiatorRootKeyCipherClearJson.initiatorContactCard) return [3 /*break*/, 25];
|
|
10343
11073
|
initiatorContactCardFromInit = initiatorRootKeyCipherClearJson.initiatorContactCard;
|
|
10344
11074
|
return [4 /*yield*/, this.keyFactory.createKey()];
|
|
10345
|
-
case
|
|
11075
|
+
case 17:
|
|
10346
11076
|
ownerKey = _p.sent();
|
|
10347
11077
|
return [4 /*yield*/, KeyFactoryService.asKey(plainInitiatorOneTimePbkCipher.responder.contactCard.sharedCipherKey)];
|
|
10348
|
-
case
|
|
11078
|
+
case 18:
|
|
10349
11079
|
sharedCipherKey = _p.sent();
|
|
10350
11080
|
_j = (_h = JSON).stringify;
|
|
10351
11081
|
return [4 /*yield*/, this.encryptionService.encrypt(rootKey.jwk, ownerKey.toJSON(true))];
|
|
10352
|
-
case
|
|
11082
|
+
case 19:
|
|
10353
11083
|
ownerWrappedKey = _j.apply(_h, [_p.sent()]);
|
|
10354
11084
|
ownerCipherDataClearJson = (initiatorContactCard === null || initiatorContactCard === void 0 ? void 0 : initiatorContactCard.ownerCipherDataClearJson) ||
|
|
10355
11085
|
initiatorContactCardFromInit.ownerCipherDataClearJson;
|
|
10356
|
-
if (!ownerCipherDataClearJson) return [3 /*break*/,
|
|
11086
|
+
if (!ownerCipherDataClearJson) return [3 /*break*/, 21];
|
|
10357
11087
|
return [4 /*yield*/, this.keyGraph.encryptToString(ownerKey, ownerCipherDataClearJson)];
|
|
10358
|
-
case
|
|
11088
|
+
case 20:
|
|
10359
11089
|
_k = _p.sent();
|
|
10360
|
-
return [3 /*break*/,
|
|
10361
|
-
case
|
|
11090
|
+
return [3 /*break*/, 22];
|
|
11091
|
+
case 21:
|
|
10362
11092
|
_k = '';
|
|
10363
|
-
_p.label =
|
|
10364
|
-
case
|
|
11093
|
+
_p.label = 22;
|
|
11094
|
+
case 22:
|
|
10365
11095
|
ownerCipherData = _k;
|
|
10366
11096
|
initiatorContactCardCipherInput = {
|
|
10367
11097
|
ownerWrappedKey: ownerWrappedKey,
|
|
@@ -10372,16 +11102,16 @@
|
|
|
10372
11102
|
sigPxkId: initiatorSigPrk.id,
|
|
10373
11103
|
};
|
|
10374
11104
|
return [4 /*yield*/, this.encryptionService.encrypt(sharedCipherKey, initiatorContactCardFromInit.sharedCipherDataClearJson)];
|
|
10375
|
-
case
|
|
11105
|
+
case 23:
|
|
10376
11106
|
sharedCipherData = _p.sent();
|
|
10377
11107
|
_l = initiatorContactCardSharedCipherInput;
|
|
10378
11108
|
_o = (_m = JSON).stringify;
|
|
10379
11109
|
return [4 /*yield*/, this.encryptionService.sign(initiatorSigPrk.jwk, sharedCipherData)];
|
|
10380
|
-
case
|
|
11110
|
+
case 24:
|
|
10381
11111
|
_l.sharedCipherDataSig =
|
|
10382
11112
|
_o.apply(_m, [_p.sent()]);
|
|
10383
|
-
_p.label =
|
|
10384
|
-
case
|
|
11113
|
+
_p.label = 25;
|
|
11114
|
+
case 25:
|
|
10385
11115
|
// TODO ideally we update the shared data in the contact card sent to the responder as well since that
|
|
10386
11116
|
// CC was created by the responder.
|
|
10387
11117
|
return [2 /*return*/, new LrMutation({
|
|
@@ -10434,16 +11164,16 @@
|
|
|
10434
11164
|
})(exports.KcLbopErrorCode || (exports.KcLbopErrorCode = {}));
|
|
10435
11165
|
var CreateLbopQuery = gql__default['default'](templateObject_1$l || (templateObject_1$l = __makeTemplateObject(["\n mutation CreateLbop($input: CreateLbopInput!) {\n createLbop(input: $input) {\n lbop {\n id\n }\n }\n }\n"], ["\n mutation CreateLbop($input: CreateLbopInput!) {\n createLbop(input: $input) {\n lbop {\n id\n }\n }\n }\n"])));
|
|
10436
11166
|
var DeleteLbopQuery = gql__default['default'](templateObject_2$i || (templateObject_2$i = __makeTemplateObject(["\n mutation DeleteLbop($input: DeleteLbopInput!) {\n deleteLbop(input: $input) {\n id\n }\n }\n"], ["\n mutation DeleteLbop($input: DeleteLbopInput!) {\n deleteLbop(input: $input) {\n id\n }\n }\n"])));
|
|
10437
|
-
var UpdateLbopQuery = gql__default['default'](templateObject_3$
|
|
11167
|
+
var UpdateLbopQuery = gql__default['default'](templateObject_3$f || (templateObject_3$f = __makeTemplateObject(["\n mutation UpdateLbop($input: UpdateLbopInput!) {\n updateLbop(input: $input) {\n lbop {\n id\n }\n }\n }\n"], ["\n mutation UpdateLbop($input: UpdateLbopInput!) {\n updateLbop(input: $input) {\n lbop {\n id\n }\n }\n }\n"])));
|
|
10438
11168
|
var LbopQuery = gql__default['default'](templateObject_4$b || (templateObject_4$b = __makeTemplateObject(["\n query Lbop($id: LrRelayIdInput!) {\n lbop(id: $id) {\n id\n cipherMeta\n }\n }\n"], ["\n query Lbop($id: LrRelayIdInput!) {\n lbop(id: $id) {\n id\n cipherMeta\n }\n }\n"])));
|
|
10439
11169
|
var LbopsQuery = gql__default['default'](templateObject_5$a || (templateObject_5$a = __makeTemplateObject(["\n query Lbops {\n lbops {\n edges {\n node {\n id\n cipherMeta\n }\n }\n }\n }\n"], ["\n query Lbops {\n lbops {\n edges {\n node {\n id\n cipherMeta\n }\n }\n }\n }\n"])));
|
|
10440
11170
|
var LbopService = /** @class */ (function () {
|
|
10441
|
-
function LbopService(config, http, lrApollo, auth,
|
|
11171
|
+
function LbopService(config, http, lrApollo, auth, auth2Service, keyFactory, keyService, encryptionService, keyGraph, passwordService) {
|
|
10442
11172
|
this.config = config;
|
|
10443
11173
|
this.http = http;
|
|
10444
11174
|
this.lrApollo = lrApollo;
|
|
10445
11175
|
this.auth = auth;
|
|
10446
|
-
this.
|
|
11176
|
+
this.auth2Service = auth2Service;
|
|
10447
11177
|
this.keyFactory = keyFactory;
|
|
10448
11178
|
this.keyService = keyService;
|
|
10449
11179
|
this.encryptionService = encryptionService;
|
|
@@ -10486,11 +11216,9 @@
|
|
|
10486
11216
|
case 1:
|
|
10487
11217
|
lbop = _a.sent();
|
|
10488
11218
|
lbop.name = name;
|
|
10489
|
-
|
|
10490
|
-
case 2:
|
|
10491
|
-
masterKey = _a.sent();
|
|
11219
|
+
masterKey = this.keyService.currentMasterKey;
|
|
10492
11220
|
return [4 /*yield*/, this.encryptionService.encrypt(masterKey.jwk, lbop)];
|
|
10493
|
-
case
|
|
11221
|
+
case 2:
|
|
10494
11222
|
cipherMeta = _a.sent();
|
|
10495
11223
|
return [4 /*yield*/, this.lrApollo.mutate({
|
|
10496
11224
|
mutation: UpdateLbopQuery,
|
|
@@ -10501,7 +11229,7 @@
|
|
|
10501
11229
|
},
|
|
10502
11230
|
},
|
|
10503
11231
|
})];
|
|
10504
|
-
case
|
|
11232
|
+
case 3:
|
|
10505
11233
|
res = _a.sent();
|
|
10506
11234
|
return [2 /*return*/, res.updateLbop];
|
|
10507
11235
|
}
|
|
@@ -10521,11 +11249,9 @@
|
|
|
10521
11249
|
})];
|
|
10522
11250
|
case 1:
|
|
10523
11251
|
res = _a.sent();
|
|
10524
|
-
|
|
10525
|
-
case 2:
|
|
10526
|
-
masterKey = _a.sent();
|
|
11252
|
+
masterKey = this.keyService.currentMasterKey;
|
|
10527
11253
|
return [4 /*yield*/, this.encryptionService.decrypt(masterKey.jwk, JSON.parse(res.lbop.cipherMeta))];
|
|
10528
|
-
case
|
|
11254
|
+
case 2:
|
|
10529
11255
|
plainCipherMeta = _a.sent();
|
|
10530
11256
|
return [2 /*return*/, Object.assign({ id: res.id }, plainCipherMeta)];
|
|
10531
11257
|
}
|
|
@@ -10543,7 +11269,7 @@
|
|
|
10543
11269
|
})];
|
|
10544
11270
|
case 1:
|
|
10545
11271
|
res = _a.sent();
|
|
10546
|
-
return [4 /*yield*/, this.keyService.
|
|
11272
|
+
return [4 /*yield*/, this.keyService.currentMasterKey];
|
|
10547
11273
|
case 2:
|
|
10548
11274
|
masterKey = _a.sent();
|
|
10549
11275
|
return [2 /*return*/, Promise.all(res.lbops.edges.map(function (edge) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -10564,7 +11290,7 @@
|
|
|
10564
11290
|
LbopService.prototype.create = function (_a) {
|
|
10565
11291
|
var name = _a.name;
|
|
10566
11292
|
return __awaiter(this, void 0, void 0, function () {
|
|
10567
|
-
var lbops, lbopString, _loop_1, this_1, state_1, lbopKeyParams, lbopKey, _a, _b, _c, _d, _e, lbopKeyVerifier, wrappedLbopKeyVerifier,
|
|
11293
|
+
var lbops, lbopString, _loop_1, this_1, state_1, lbopKeyParams, lbopKey, _a, _b, _c, _d, _e, lbopKeyVerifier, wrappedLbopKeyVerifier, masterKey, wrappedMasterKey, meta, cipherMeta, res;
|
|
10568
11294
|
return __generator(this, function (_f) {
|
|
10569
11295
|
switch (_f.label) {
|
|
10570
11296
|
case 0:
|
|
@@ -10606,18 +11332,13 @@
|
|
|
10606
11332
|
return [4 /*yield*/, this.encryptionService.encrypt(lbopKey, lbopKeyVerifier.toJSON(true))];
|
|
10607
11333
|
case 6:
|
|
10608
11334
|
wrappedLbopKeyVerifier = _f.sent();
|
|
10609
|
-
|
|
10610
|
-
case 7:
|
|
10611
|
-
currentUser = _f.sent();
|
|
10612
|
-
return [4 /*yield*/, this.keyGraph.getKey(currentUser.currentUserKey.masterKey.id)];
|
|
10613
|
-
case 8:
|
|
10614
|
-
masterKey = _f.sent();
|
|
11335
|
+
masterKey = this.keyService.currentMasterKey;
|
|
10615
11336
|
return [4 /*yield*/, this.encryptionService.encrypt(lbopKey, masterKey.jwk.toJSON(true))];
|
|
10616
|
-
case
|
|
11337
|
+
case 7:
|
|
10617
11338
|
wrappedMasterKey = _f.sent();
|
|
10618
11339
|
meta = Object.assign(Object.assign({}, (name && { name: name })), { partial: this.getPartial(lbopString) });
|
|
10619
11340
|
return [4 /*yield*/, this.encryptionService.encrypt(masterKey.jwk, meta)];
|
|
10620
|
-
case
|
|
11341
|
+
case 8:
|
|
10621
11342
|
cipherMeta = _f.sent();
|
|
10622
11343
|
return [4 /*yield*/, this.lrApollo.mutate({
|
|
10623
11344
|
mutation: CreateLbopQuery,
|
|
@@ -10627,12 +11348,12 @@
|
|
|
10627
11348
|
lbopKeyParams: JSON.stringify(lbopKeyParams),
|
|
10628
11349
|
lbopKeyVerifier: JSON.stringify(lbopKeyVerifier.toJSON(true)),
|
|
10629
11350
|
wrappedLbopKeyVerifier: JSON.stringify(wrappedLbopKeyVerifier),
|
|
10630
|
-
masterKeyId:
|
|
11351
|
+
masterKeyId: masterKey.id,
|
|
10631
11352
|
wrappedMasterKey: JSON.stringify(wrappedMasterKey),
|
|
10632
11353
|
},
|
|
10633
11354
|
},
|
|
10634
11355
|
})];
|
|
10635
|
-
case
|
|
11356
|
+
case 9:
|
|
10636
11357
|
res = _f.sent();
|
|
10637
11358
|
return [2 /*return*/, Object.assign(Object.assign({}, res.createLbop.lbop), { lbopString: lbopString })];
|
|
10638
11359
|
}
|
|
@@ -10848,7 +11569,7 @@
|
|
|
10848
11569
|
};
|
|
10849
11570
|
return LbopService;
|
|
10850
11571
|
}());
|
|
10851
|
-
LbopService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LbopService_Factory() { return new LbopService(i0.ɵɵinject(KC_CONFIG), i0.ɵɵinject(i2$
|
|
11572
|
+
LbopService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LbopService_Factory() { return new LbopService(i0.ɵɵinject(KC_CONFIG), i0.ɵɵinject(i2$2.HttpClient), i0.ɵɵinject(LrApolloService), i0.ɵɵinject(i2.AuthClass), i0.ɵɵinject(exports.Auth2Service), i0.ɵɵinject(KeyFactoryService), i0.ɵɵinject(KeyService), i0.ɵɵinject(EncryptionService), i0.ɵɵinject(KeyGraphService), i0.ɵɵinject(PasswordService)); }, token: LbopService, providedIn: "root" });
|
|
10852
11573
|
LbopService.decorators = [
|
|
10853
11574
|
{ type: i0.Injectable, args: [{
|
|
10854
11575
|
providedIn: 'root',
|
|
@@ -10856,17 +11577,17 @@
|
|
|
10856
11577
|
];
|
|
10857
11578
|
LbopService.ctorParameters = function () { return [
|
|
10858
11579
|
{ type: undefined, decorators: [{ type: i0.Inject, args: [KC_CONFIG,] }] },
|
|
10859
|
-
{ type: i2$
|
|
11580
|
+
{ type: i2$2.HttpClient },
|
|
10860
11581
|
{ type: LrApolloService },
|
|
10861
|
-
{ type:
|
|
10862
|
-
{ type:
|
|
11582
|
+
{ type: i2.AuthClass },
|
|
11583
|
+
{ type: exports.Auth2Service },
|
|
10863
11584
|
{ type: KeyFactoryService },
|
|
10864
11585
|
{ type: KeyService },
|
|
10865
11586
|
{ type: EncryptionService },
|
|
10866
11587
|
{ type: KeyGraphService },
|
|
10867
11588
|
{ type: PasswordService }
|
|
10868
11589
|
]; };
|
|
10869
|
-
var templateObject_1$l, templateObject_2$i, templateObject_3$
|
|
11590
|
+
var templateObject_1$l, templateObject_2$i, templateObject_3$f, templateObject_4$b, templateObject_5$a;
|
|
10870
11591
|
|
|
10871
11592
|
var LifeReadyModule = /** @class */ (function () {
|
|
10872
11593
|
function LifeReadyModule() {
|
|
@@ -10880,13 +11601,13 @@
|
|
|
10880
11601
|
useValue: config,
|
|
10881
11602
|
},
|
|
10882
11603
|
{
|
|
10883
|
-
provide:
|
|
11604
|
+
provide: i2.AuthClass,
|
|
10884
11605
|
useValue: Auth__default['default'],
|
|
10885
11606
|
},
|
|
10886
11607
|
{
|
|
10887
11608
|
provide: i0.APP_INITIALIZER,
|
|
10888
11609
|
useFactory: configureAmplifyAuth,
|
|
10889
|
-
deps: [KC_CONFIG,
|
|
11610
|
+
deps: [KC_CONFIG, i2.AuthClass],
|
|
10890
11611
|
multi: true,
|
|
10891
11612
|
},
|
|
10892
11613
|
{
|
|
@@ -10898,7 +11619,7 @@
|
|
|
10898
11619
|
{
|
|
10899
11620
|
provide: i1.APOLLO_OPTIONS,
|
|
10900
11621
|
useFactory: configureApollo,
|
|
10901
|
-
deps: [KC_CONFIG,
|
|
11622
|
+
deps: [KC_CONFIG, i2.AuthClass],
|
|
10902
11623
|
},
|
|
10903
11624
|
],
|
|
10904
11625
|
};
|
|
@@ -10907,7 +11628,7 @@
|
|
|
10907
11628
|
}());
|
|
10908
11629
|
LifeReadyModule.decorators = [
|
|
10909
11630
|
{ type: i0.NgModule, args: [{
|
|
10910
|
-
imports: [i2$
|
|
11631
|
+
imports: [i2$2.HttpClientModule, i4.NgIdleKeepaliveModule.forRoot()],
|
|
10911
11632
|
},] }
|
|
10912
11633
|
];
|
|
10913
11634
|
|
|
@@ -11067,10 +11788,10 @@
|
|
|
11067
11788
|
|
|
11068
11789
|
var UpdateNotificationMutation = gqlTyped(templateObject_1$n || (templateObject_1$n = __makeTemplateObject(["\nmutation UpdateNotificationMutation($input: UpdateNotificationInput!) {\n updateNotification(input: $input) {\n notification {\n id\n }\n }\n}\n"], ["\nmutation UpdateNotificationMutation($input: UpdateNotificationInput!) {\n updateNotification(input: $input) {\n notification {\n id\n }\n }\n}\n"])));
|
|
11069
11790
|
var UpdateAllNotificationsReadStateMutation = gqlTyped(templateObject_2$k || (templateObject_2$k = __makeTemplateObject(["\nmutation UpdateAllNotificationsReadStateMutation($input: UpdateAllNotificationsReadStateInput!) {\n updateAllNotificationsReadState(input: $input) {\n count\n }\n}\n"], ["\nmutation UpdateAllNotificationsReadStateMutation($input: UpdateAllNotificationsReadStateInput!) {\n updateAllNotificationsReadState(input: $input) {\n count\n }\n}\n"])));
|
|
11070
|
-
var DebugCreateNotificationMutation = gqlTyped(templateObject_3$
|
|
11791
|
+
var DebugCreateNotificationMutation = gqlTyped(templateObject_3$g || (templateObject_3$g = __makeTemplateObject(["\nmutation DebugCreateNotificationMutation($input: DebugCreateNotificationInput!) {\n debugCreateNotification(input: $input) {\n notification {\n id\n }\n }\n}\n"], ["\nmutation DebugCreateNotificationMutation($input: DebugCreateNotificationInput!) {\n debugCreateNotification(input: $input) {\n notification {\n id\n }\n }\n}\n"])));
|
|
11071
11792
|
var DebugDeleteAllNotificationsMutation = gqlTyped(templateObject_4$c || (templateObject_4$c = __makeTemplateObject(["\nmutation DebugDeleteAllNotificationsMutation($input: DebugDeleteAllNotificationsInput!) {\n debugDeleteAllNotifications(input: $input) {\n count\n }\n}\n"], ["\nmutation DebugDeleteAllNotificationsMutation($input: DebugDeleteAllNotificationsInput!) {\n debugDeleteAllNotifications(input: $input) {\n count\n }\n}\n"])));
|
|
11072
11793
|
var UpdateNotificationFeatureStateMutation = gqlTyped(templateObject_5$b || (templateObject_5$b = __makeTemplateObject(["\nmutation UpdateNotificationFeatureStateMutation($input: UpdateNotificationFeatureStateInput!) {\n updateNotificationFeatureState(input: $input) {\n featureState {\n notificationsLastViewed\n\t\t}\n }\n}\n"], ["\nmutation UpdateNotificationFeatureStateMutation($input: UpdateNotificationFeatureStateInput!) {\n updateNotificationFeatureState(input: $input) {\n featureState {\n notificationsLastViewed\n\t\t}\n }\n}\n"])));
|
|
11073
|
-
var templateObject_1$n, templateObject_2$k, templateObject_3$
|
|
11794
|
+
var templateObject_1$n, templateObject_2$k, templateObject_3$g, templateObject_4$c, templateObject_5$b;
|
|
11074
11795
|
|
|
11075
11796
|
exports.NotificationService = /** @class */ (function (_super) {
|
|
11076
11797
|
__extends(NotificationService, _super);
|
|
@@ -11234,14 +11955,14 @@
|
|
|
11234
11955
|
|
|
11235
11956
|
var InitiateStripePaymentMethodCaptureMutation = gqlTyped(templateObject_1$o || (templateObject_1$o = __makeTemplateObject(["\nmutation InitiateStripePaymentMethodCaptureMutation {\n initiateStripePaymentMethodCapture(input: {}) {\n paymentCapture {\n stripeIntentId\n stripeClientSecret\n }\n }\n}\n"], ["\nmutation InitiateStripePaymentMethodCaptureMutation {\n initiateStripePaymentMethodCapture(input: {}) {\n paymentCapture {\n stripeIntentId\n stripeClientSecret\n }\n }\n}\n"])));
|
|
11236
11957
|
var CompleteStripePaymentMethodCaptureMutation = gqlTyped(templateObject_2$l || (templateObject_2$l = __makeTemplateObject(["\nmutation CompleteStripePaymentMethodCaptureMutation($input: CompleteStripePaymentMethodCaptureInput!) {\n completeStripePaymentMethodCapture(input: $input) {\n paymentMethod {\n id\n created\n modified\n card {\n brand\n lastFourDigits\n expiryYear\n expiryMonth\n }\n isDefault \n }\n }\n}\n"], ["\nmutation CompleteStripePaymentMethodCaptureMutation($input: CompleteStripePaymentMethodCaptureInput!) {\n completeStripePaymentMethodCapture(input: $input) {\n paymentMethod {\n id\n created\n modified\n card {\n brand\n lastFourDigits\n expiryYear\n expiryMonth\n }\n isDefault \n }\n }\n}\n"])));
|
|
11237
|
-
var RemovePaymentMethodMutation = gqlTyped(templateObject_3$
|
|
11958
|
+
var RemovePaymentMethodMutation = gqlTyped(templateObject_3$h || (templateObject_3$h = __makeTemplateObject(["\nmutation RemovePaymentMethodMutation($input: RemovePaymentMethodInput!) {\n removePaymentMethod(input: $input) {\n id\n }\n}\n"], ["\nmutation RemovePaymentMethodMutation($input: RemovePaymentMethodInput!) {\n removePaymentMethod(input: $input) {\n id\n }\n}\n"])));
|
|
11238
11959
|
var SetDefaultPaymentMethodMutation = gqlTyped(templateObject_4$d || (templateObject_4$d = __makeTemplateObject(["\nmutation SetDefaultPaymentMethodMutation($input: SetDefaultPaymentMethodInput!) {\n setDefaultPaymentMethod(input: $input) {\n paymentMethod {\n id\n } \n }\n}\n"], ["\nmutation SetDefaultPaymentMethodMutation($input: SetDefaultPaymentMethodInput!) {\n setDefaultPaymentMethod(input: $input) {\n paymentMethod {\n id\n } \n }\n}\n"])));
|
|
11239
11960
|
var RemoveDefaultPaymentMethodMutation = gqlTyped(templateObject_5$c || (templateObject_5$c = __makeTemplateObject(["\nmutation RemoveDefaultPaymentMethodMutation {\n removeDefaultPaymentMethod(input: {}) {\n paymentMethod {\n id\n } \n }\n}\n"], ["\nmutation RemoveDefaultPaymentMethodMutation {\n removeDefaultPaymentMethod(input: {}) {\n paymentMethod {\n id\n } \n }\n}\n"])));
|
|
11240
11961
|
var IssuePlanMutation = gqlTyped(templateObject_6$9 || (templateObject_6$9 = __makeTemplateObject(["\nmutation IssuePlanMutation($input: IssuePlanInput!) {\n issuePlan(input: $input) {\n plan {\n id\n }\n }\n}\n"], ["\nmutation IssuePlanMutation($input: IssuePlanInput!) {\n issuePlan(input: $input) {\n plan {\n id\n }\n }\n}\n"])));
|
|
11241
11962
|
var CancelPlanMutation = gqlTyped(templateObject_7$8 || (templateObject_7$8 = __makeTemplateObject(["\nmutation CancelPlanMutation($input: CancelPlanInput!) {\n cancelPlan(input: $input) {\n plan {\n id\n } \n }\n}\n"], ["\nmutation CancelPlanMutation($input: CancelPlanInput!) {\n cancelPlan(input: $input) {\n plan {\n id\n } \n }\n}\n"])));
|
|
11242
11963
|
var ChangePriceOptionMutation = gqlTyped(templateObject_8$7 || (templateObject_8$7 = __makeTemplateObject(["\nmutation ChangePriceOptionMutation($input: ChangePriceOptionInput!) {\n changePriceOption(input: $input) {\n plan {\n id\n }\n }\n}\n"], ["\nmutation ChangePriceOptionMutation($input: ChangePriceOptionInput!) {\n changePriceOption(input: $input) {\n plan {\n id\n }\n }\n}\n"])));
|
|
11243
11964
|
var ReactivatePlanMutation = gqlTyped(templateObject_9$5 || (templateObject_9$5 = __makeTemplateObject(["\nmutation ReactivatePlanMutation($input: ReactivatePlanInput!) {\n reactivatePlan(input: $input) {\n plan {\n id\n }\n }\n}\n"], ["\nmutation ReactivatePlanMutation($input: ReactivatePlanInput!) {\n reactivatePlan(input: $input) {\n plan {\n id\n }\n }\n}\n"])));
|
|
11244
|
-
var templateObject_1$o, templateObject_2$l, templateObject_3$
|
|
11965
|
+
var templateObject_1$o, templateObject_2$l, templateObject_3$h, templateObject_4$d, templateObject_5$c, templateObject_6$9, templateObject_7$8, templateObject_8$7, templateObject_9$5;
|
|
11245
11966
|
|
|
11246
11967
|
exports.Plan2Service = /** @class */ (function (_super) {
|
|
11247
11968
|
__extends(Plan2Service, _super);
|
|
@@ -11486,22 +12207,20 @@
|
|
|
11486
12207
|
return [4 /*yield*/, this.keyGraph.getKey(sharedKeyId)];
|
|
11487
12208
|
case 2:
|
|
11488
12209
|
sharedKey = _e.sent();
|
|
11489
|
-
|
|
11490
|
-
case 3:
|
|
11491
|
-
sigPxk = _e.sent();
|
|
12210
|
+
sigPxk = this.keyService.currentSigPxk;
|
|
11492
12211
|
return [4 /*yield*/, this.encryptionService.encrypt(sharedKey.jwk, contactCard)];
|
|
11493
|
-
case
|
|
12212
|
+
case 3:
|
|
11494
12213
|
sharedCipherData = _e.sent();
|
|
11495
12214
|
_b = (_a = JSON).stringify;
|
|
11496
12215
|
return [4 /*yield*/, this.encryptionService.sign(sigPxk.jwk, sharedCipherData)];
|
|
11497
|
-
case
|
|
12216
|
+
case 4:
|
|
11498
12217
|
sharedCipherDataSig = _b.apply(_a, [_e.sent()]);
|
|
11499
12218
|
ownerPlainData = {
|
|
11500
12219
|
name: new ContactCardName(contactCard.name),
|
|
11501
12220
|
};
|
|
11502
12221
|
_d = (_c = JSON).stringify;
|
|
11503
12222
|
return [4 /*yield*/, this.encryptionService.sign(sigPxk.jwk, ownerPlainData)];
|
|
11504
|
-
case
|
|
12223
|
+
case 5:
|
|
11505
12224
|
ownerPlainDataSig = _d.apply(_c, [_e.sent()]);
|
|
11506
12225
|
return [4 /*yield*/, this.lrApollo.mutate({
|
|
11507
12226
|
mutation: UpdateOwnedContactCard,
|
|
@@ -11517,7 +12236,7 @@
|
|
|
11517
12236
|
},
|
|
11518
12237
|
},
|
|
11519
12238
|
})];
|
|
11520
|
-
case
|
|
12239
|
+
case 6:
|
|
11521
12240
|
_e.sent();
|
|
11522
12241
|
return [2 /*return*/];
|
|
11523
12242
|
}
|
|
@@ -11540,16 +12259,94 @@
|
|
|
11540
12259
|
]; };
|
|
11541
12260
|
var templateObject_1$p;
|
|
11542
12261
|
|
|
12262
|
+
var RequestUserDeleteMutation = gql__default['default'](templateObject_1$q || (templateObject_1$q = __makeTemplateObject(["\n mutation RequestUserDelete($input: RequestUserDeleteInput!) {\n requestUserDelete(input: $input) {\n userDelete {\n state\n created\n }\n }\n }\n"], ["\n mutation RequestUserDelete($input: RequestUserDeleteInput!) {\n requestUserDelete(input: $input) {\n userDelete {\n state\n created\n }\n }\n }\n"])));
|
|
12263
|
+
var CancelUserDeleteMutation = gql__default['default'](templateObject_2$m || (templateObject_2$m = __makeTemplateObject(["\n mutation CancelUserDelete($input: CancelUserDeleteInput!) {\n cancelUserDelete(input: $input) {\n id\n }\n }\n"], ["\n mutation CancelUserDelete($input: CancelUserDeleteInput!) {\n cancelUserDelete(input: $input) {\n id\n }\n }\n"])));
|
|
12264
|
+
var LoginHistoryQuery = gql__default['default'](templateObject_3$i || (templateObject_3$i = __makeTemplateObject(["\n query LoginHistory($first: Int, $after: String) {\n loginHistory(first: $first, after: $after) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n events\n }\n }\n"], ["\n query LoginHistory($first: Int, $after: String) {\n loginHistory(first: $first, after: $after) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n events\n }\n }\n"])));
|
|
12265
|
+
var templateObject_1$q, templateObject_2$m, templateObject_3$i;
|
|
12266
|
+
|
|
12267
|
+
var UserService = /** @class */ (function () {
|
|
12268
|
+
function UserService(lrApollo) {
|
|
12269
|
+
this.lrApollo = lrApollo;
|
|
12270
|
+
}
|
|
12271
|
+
UserService.prototype.requestUserDelete = function () {
|
|
12272
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
12273
|
+
var res;
|
|
12274
|
+
return __generator(this, function (_a) {
|
|
12275
|
+
switch (_a.label) {
|
|
12276
|
+
case 0: return [4 /*yield*/, this.lrApollo.mutate({
|
|
12277
|
+
mutation: RequestUserDeleteMutation,
|
|
12278
|
+
variables: {
|
|
12279
|
+
input: {},
|
|
12280
|
+
},
|
|
12281
|
+
})];
|
|
12282
|
+
case 1:
|
|
12283
|
+
res = _a.sent();
|
|
12284
|
+
return [2 /*return*/, res.requestUserDelete.userDelete];
|
|
12285
|
+
}
|
|
12286
|
+
});
|
|
12287
|
+
});
|
|
12288
|
+
};
|
|
12289
|
+
UserService.prototype.cancelUserDelete = function () {
|
|
12290
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
12291
|
+
var res;
|
|
12292
|
+
return __generator(this, function (_a) {
|
|
12293
|
+
switch (_a.label) {
|
|
12294
|
+
case 0: return [4 /*yield*/, this.lrApollo.mutate({
|
|
12295
|
+
mutation: CancelUserDeleteMutation,
|
|
12296
|
+
variables: {
|
|
12297
|
+
input: {},
|
|
12298
|
+
},
|
|
12299
|
+
})];
|
|
12300
|
+
case 1:
|
|
12301
|
+
res = _a.sent();
|
|
12302
|
+
return [2 /*return*/, res.cancelUserDelete.id];
|
|
12303
|
+
}
|
|
12304
|
+
});
|
|
12305
|
+
});
|
|
12306
|
+
};
|
|
12307
|
+
UserService.prototype.loginHistory = function (first, after) {
|
|
12308
|
+
if (first === void 0) { first = null; }
|
|
12309
|
+
if (after === void 0) { after = null; }
|
|
12310
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
12311
|
+
var res;
|
|
12312
|
+
return __generator(this, function (_a) {
|
|
12313
|
+
switch (_a.label) {
|
|
12314
|
+
case 0: return [4 /*yield*/, this.lrApollo.query({
|
|
12315
|
+
query: LoginHistoryQuery,
|
|
12316
|
+
variables: {
|
|
12317
|
+
first: first,
|
|
12318
|
+
after: after,
|
|
12319
|
+
},
|
|
12320
|
+
})];
|
|
12321
|
+
case 1:
|
|
12322
|
+
res = _a.sent();
|
|
12323
|
+
return [2 /*return*/, res.loginHistory];
|
|
12324
|
+
}
|
|
12325
|
+
});
|
|
12326
|
+
});
|
|
12327
|
+
};
|
|
12328
|
+
return UserService;
|
|
12329
|
+
}());
|
|
12330
|
+
UserService.ɵprov = i0.ɵɵdefineInjectable({ factory: function UserService_Factory() { return new UserService(i0.ɵɵinject(LrApolloService)); }, token: UserService, providedIn: "root" });
|
|
12331
|
+
UserService.decorators = [
|
|
12332
|
+
{ type: i0.Injectable, args: [{
|
|
12333
|
+
providedIn: 'root',
|
|
12334
|
+
},] }
|
|
12335
|
+
];
|
|
12336
|
+
UserService.ctorParameters = function () { return [
|
|
12337
|
+
{ type: LrApolloService }
|
|
12338
|
+
]; };
|
|
12339
|
+
|
|
11543
12340
|
var TrustedPartyProperties = "\n id\n user {\n id\n username\n }\n other{\n id\n username,\n features {\n shareVault\n }\n }\n sharedContactCard {\n " + SharedContactCardFields + "\n }\n myContactCard {\n " + SharedContactCardFields + "\n }\n sharedScenarios {\n edges {\n node {\n id\n }\n }\n }\n theirItems {\n directories {\n edges {\n node {\n id\n }\n }\n }\n }\n currentUserSharedKey {\n userSharedKey {\n keyExchange {\n " + KeyExchangeFields + "\n }\n " + UserSharedKeyFields + "\n }\n }";
|
|
11544
|
-
var GetTrustedPartiesQuery = gql__default['default'](templateObject_1$
|
|
11545
|
-
var GetAllTrustedPartiesQuery = gql__default['default'](templateObject_2$
|
|
12341
|
+
var GetTrustedPartiesQuery = gql__default['default'](templateObject_1$r || (templateObject_1$r = __makeTemplateObject(["\nquery GetTrustedPartiesQuery {\n tps {\n edges {\n node {\n ", "\n }\n }\n }\n ", "\n}"], ["\nquery GetTrustedPartiesQuery {\n tps {\n edges {\n node {\n ", "\n }\n }\n }\n ", "\n}"])), TrustedPartyProperties, KeyGraphField);
|
|
12342
|
+
var GetAllTrustedPartiesQuery = gql__default['default'](templateObject_2$n || (templateObject_2$n = __makeTemplateObject(["\nquery GetAllTrustedPartiesQuery($userId: ID, $isExpired: Boolean, $inviteState: String, $sentInviteState: String) {\n tps {\n edges {\n node {\n ", "\n }\n }\n }\n invites: keyExchanges(\n responder: $userId\n isExpired: $isExpired\n state: $inviteState\n orderBy: \"state,-created\"\n ) {\n edges {\n node {\n ", "\n }\n }\n }\n sentInvites: keyExchanges(\n initiator: $userId\n isExpired: $isExpired\n state: $sentInviteState\n orderBy: \"state,-created\"\n ) {\n edges {\n node {\n ", "\n }\n }\n }\n ", "\n}"], ["\nquery GetAllTrustedPartiesQuery($userId: ID, $isExpired: Boolean, $inviteState: String, $sentInviteState: String) {\n tps {\n edges {\n node {\n ", "\n }\n }\n }\n invites: keyExchanges(\n responder: $userId\n isExpired: $isExpired\n state: $inviteState\n orderBy: \"state,-created\"\n ) {\n edges {\n node {\n ", "\n }\n }\n }\n sentInvites: keyExchanges(\n initiator: $userId\n isExpired: $isExpired\n state: $sentInviteState\n orderBy: \"state,-created\"\n ) {\n edges {\n node {\n ", "\n }\n }\n }\n ", "\n}"])), TrustedPartyProperties, KeyExchangeFields, KeyExchangeFields, KeyGraphField);
|
|
11546
12343
|
var GetTrustedPartyQuery = gql__default['default'](templateObject_3$j || (templateObject_3$j = __makeTemplateObject(["\nquery GetTrustedPartyQuery($partyId: LrRelayIdInput!) {\n tp(id: $partyId) {\n ", "\n }\n ", "\n}"], ["\nquery GetTrustedPartyQuery($partyId: LrRelayIdInput!) {\n tp(id: $partyId) {\n ", "\n }\n ", "\n}"])), TrustedPartyProperties, KeyGraphField);
|
|
11547
12344
|
var DeclineTrustedPartyInvitationMutation = gql__default['default'](templateObject_4$e || (templateObject_4$e = __makeTemplateObject(["\n mutation DeclineKeyExchange($input: DeclineKeyExchangeInput!) {\n declineKeyExchange(input: $input) {\n keyExchange {\n id\n }\n }\n }\n"], ["\n mutation DeclineKeyExchange($input: DeclineKeyExchangeInput!) {\n declineKeyExchange(input: $input) {\n keyExchange {\n id\n }\n }\n }\n"])));
|
|
11548
12345
|
var CancelTrustedPartyInvitationMutation = gql__default['default'](templateObject_5$d || (templateObject_5$d = __makeTemplateObject(["\n mutation CancelKeyExchange($input: CancelKeyExchangeInput!) {\n cancelKeyExchange(input: $input) {\n keyExchange {\n id\n }\n }\n }\n"], ["\n mutation CancelKeyExchange($input: CancelKeyExchangeInput!) {\n cancelKeyExchange(input: $input) {\n keyExchange {\n id\n }\n }\n }\n"])));
|
|
11549
12346
|
var DeleteTrustedPartyMutation = gql__default['default'](templateObject_6$a || (templateObject_6$a = __makeTemplateObject(["\n mutation DeleteTpMutation($input: DeleteTpInput!) {\n deleteTp(input: $input) {\n id\n }\n }\n"], ["\n mutation DeleteTpMutation($input: DeleteTpInput!) {\n deleteTp(input: $input) {\n id\n }\n }\n"])));
|
|
11550
12347
|
var ShareCategoryMutation = gql__default['default'](templateObject_7$9 || (templateObject_7$9 = __makeTemplateObject(["\n mutation ShareDirectory($input: ShareDirectoryInput!) {\n shareDirectory(input: $input) {\n tpSharedDirectory {\n item {\n plainMeta\n }\n }\n }\n }\n"], ["\n mutation ShareDirectory($input: ShareDirectoryInput!) {\n shareDirectory(input: $input) {\n tpSharedDirectory {\n item {\n plainMeta\n }\n }\n }\n }\n"])));
|
|
11551
12348
|
var UnshareCategoryMutation = gql__default['default'](templateObject_8$8 || (templateObject_8$8 = __makeTemplateObject(["\n mutation UnshareDirectory($input: UnshareDirectoryInput!) {\n unshareDirectory(input: $input) {\n tpSharedDirectory {\n item {\n plainMeta\n }\n }\n }\n }\n"], ["\n mutation UnshareDirectory($input: UnshareDirectoryInput!) {\n unshareDirectory(input: $input) {\n tpSharedDirectory {\n item {\n plainMeta\n }\n }\n }\n }\n"])));
|
|
11552
|
-
var templateObject_1$
|
|
12349
|
+
var templateObject_1$r, templateObject_2$n, templateObject_3$j, templateObject_4$e, templateObject_5$d, templateObject_6$a, templateObject_7$9, templateObject_8$8;
|
|
11553
12350
|
|
|
11554
12351
|
var TrustedPartyRole = /** @class */ (function () {
|
|
11555
12352
|
function TrustedPartyRole() {
|
|
@@ -12041,14 +12838,14 @@
|
|
|
12041
12838
|
};
|
|
12042
12839
|
return TrustedPartyService;
|
|
12043
12840
|
}());
|
|
12044
|
-
TrustedPartyService.ɵprov = i0.ɵɵdefineInjectable({ factory: function TrustedPartyService_Factory() { return new TrustedPartyService(i0.ɵɵinject(i2$
|
|
12841
|
+
TrustedPartyService.ɵprov = i0.ɵɵdefineInjectable({ factory: function TrustedPartyService_Factory() { return new TrustedPartyService(i0.ɵɵinject(i2$2.HttpClient), i0.ɵɵinject(LrApolloService), i0.ɵɵinject(SharedContactCardService), i0.ɵɵinject(UserService), i0.ɵɵinject(LifeReadyAuthService), i0.ɵɵinject(KeyExchangeService), i0.ɵɵinject(KeyGraphService), i0.ɵɵinject(KeyService), i0.ɵɵinject(KeyFactoryService), i0.ɵɵinject(EncryptionService)); }, token: TrustedPartyService, providedIn: "root" });
|
|
12045
12842
|
TrustedPartyService.decorators = [
|
|
12046
12843
|
{ type: i0.Injectable, args: [{
|
|
12047
12844
|
providedIn: 'root',
|
|
12048
12845
|
},] }
|
|
12049
12846
|
];
|
|
12050
12847
|
TrustedPartyService.ctorParameters = function () { return [
|
|
12051
|
-
{ type: i2$
|
|
12848
|
+
{ type: i2$2.HttpClient },
|
|
12052
12849
|
{ type: LrApolloService },
|
|
12053
12850
|
{ type: SharedContactCardService },
|
|
12054
12851
|
{ type: UserService },
|
|
@@ -12489,14 +13286,14 @@
|
|
|
12489
13286
|
};
|
|
12490
13287
|
return RecordTypeService;
|
|
12491
13288
|
}());
|
|
12492
|
-
RecordTypeService.ɵprov = i0.ɵɵdefineInjectable({ factory: function RecordTypeService_Factory() { return new RecordTypeService(i0.ɵɵinject(i2$
|
|
13289
|
+
RecordTypeService.ɵprov = i0.ɵɵdefineInjectable({ factory: function RecordTypeService_Factory() { return new RecordTypeService(i0.ɵɵinject(i2$2.HttpClient)); }, token: RecordTypeService, providedIn: "root" });
|
|
12493
13290
|
RecordTypeService.decorators = [
|
|
12494
13291
|
{ type: i0.Injectable, args: [{
|
|
12495
13292
|
providedIn: 'root',
|
|
12496
13293
|
},] }
|
|
12497
13294
|
];
|
|
12498
13295
|
RecordTypeService.ctorParameters = function () { return [
|
|
12499
|
-
{ type: i2$
|
|
13296
|
+
{ type: i2$2.HttpClient }
|
|
12500
13297
|
]; };
|
|
12501
13298
|
|
|
12502
13299
|
(function (RecordFieldType) {
|
|
@@ -13158,7 +13955,7 @@
|
|
|
13158
13955
|
};
|
|
13159
13956
|
return RegisterService;
|
|
13160
13957
|
}());
|
|
13161
|
-
RegisterService.ɵprov = i0.ɵɵdefineInjectable({ factory: function RegisterService_Factory() { return new RegisterService(i0.ɵɵinject(KC_CONFIG), i0.ɵɵinject(
|
|
13958
|
+
RegisterService.ɵprov = i0.ɵɵdefineInjectable({ factory: function RegisterService_Factory() { return new RegisterService(i0.ɵɵinject(KC_CONFIG), i0.ɵɵinject(i2.AuthClass), i0.ɵɵinject(i2$2.HttpClient), i0.ɵɵinject(KeyFactoryService), i0.ɵɵinject(EncryptionService), i0.ɵɵinject(PasswordService)); }, token: RegisterService, providedIn: "root" });
|
|
13162
13959
|
RegisterService.decorators = [
|
|
13163
13960
|
{ type: i0.Injectable, args: [{
|
|
13164
13961
|
providedIn: 'root',
|
|
@@ -13166,8 +13963,8 @@
|
|
|
13166
13963
|
];
|
|
13167
13964
|
RegisterService.ctorParameters = function () { return [
|
|
13168
13965
|
{ type: undefined, decorators: [{ type: i0.Inject, args: [KC_CONFIG,] }] },
|
|
13169
|
-
{ type:
|
|
13170
|
-
{ type: i2$
|
|
13966
|
+
{ type: i2.AuthClass },
|
|
13967
|
+
{ type: i2$2.HttpClient },
|
|
13171
13968
|
{ type: KeyFactoryService },
|
|
13172
13969
|
{ type: EncryptionService },
|
|
13173
13970
|
{ type: PasswordService }
|
|
@@ -13205,8 +14002,8 @@
|
|
|
13205
14002
|
})
|
|
13206
14003
|
], exports.ɵn);
|
|
13207
14004
|
|
|
13208
|
-
var CreateScenarioMutation = gqlTyped(templateObject_1$
|
|
13209
|
-
var UpdateScenarioMutation = gqlTyped(templateObject_2$
|
|
14005
|
+
var CreateScenarioMutation = gqlTyped(templateObject_1$s || (templateObject_1$s = __makeTemplateObject(["\nmutation CreateScenarioMutation($input: CreateScenarioInput!) {\n createScenario(input: $input) {\n scenario {\n id\n }\n }\n}\n"], ["\nmutation CreateScenarioMutation($input: CreateScenarioInput!) {\n createScenario(input: $input) {\n scenario {\n id\n }\n }\n}\n"])));
|
|
14006
|
+
var UpdateScenarioMutation = gqlTyped(templateObject_2$o || (templateObject_2$o = __makeTemplateObject(["\nmutation UpdateScenarioMutation($input: UpdateScenarioInput!) {\n updateScenario(input: $input) {\n scenario {\n id\n }\n }\n}\n"], ["\nmutation UpdateScenarioMutation($input: UpdateScenarioInput!) {\n updateScenario(input: $input) {\n scenario {\n id\n }\n }\n}\n"])));
|
|
13210
14007
|
var DeleteScenarioMutation = gqlTyped(templateObject_3$k || (templateObject_3$k = __makeTemplateObject(["\nmutation DeleteScenarioMutation($input: DeleteScenarioInput!) {\n deleteScenario(input: $input) {\n id\n }\n}\n"], ["\nmutation DeleteScenarioMutation($input: DeleteScenarioInput!) {\n deleteScenario(input: $input) {\n id\n }\n}\n"])));
|
|
13211
14008
|
var CreateScenarioClaimMutation = gqlTyped(templateObject_4$f || (templateObject_4$f = __makeTemplateObject(["\nmutation CreateScenarioClaimMutation($input: CreateScenarioClaimInput!) {\n createScenarioClaim(input: $input) {\n sharedClaim {\n id\n }\n }\n}\n"], ["\nmutation CreateScenarioClaimMutation($input: CreateScenarioClaimInput!) {\n createScenarioClaim(input: $input) {\n sharedClaim {\n id\n }\n }\n}\n"])));
|
|
13212
14009
|
var CancelScenarioClaimMutation = gqlTyped(templateObject_5$e || (templateObject_5$e = __makeTemplateObject(["\nmutation CancelScenarioClaimMutation($input: CancelScenarioClaimInput!) {\n cancelScenarioClaim(input: $input) {\n sharedClaim {\n id\n }\n }\n}\n"], ["\nmutation CancelScenarioClaimMutation($input: CancelScenarioClaimInput!) {\n cancelScenarioClaim(input: $input) {\n sharedClaim {\n id\n }\n }\n}\n"])));
|
|
@@ -13215,11 +14012,11 @@
|
|
|
13215
14012
|
var ReceiveScenarioClaimMutation = gqlTyped(templateObject_8$9 || (templateObject_8$9 = __makeTemplateObject(["\nmutation ReceiveScenarioClaimMutation($input: ReceiveScenarioClaimInput!) {\n receiveScenarioClaim(input: $input) {\n sharedClaim {\n id\n }\n }\n}\n"], ["\nmutation ReceiveScenarioClaimMutation($input: ReceiveScenarioClaimInput!) {\n receiveScenarioClaim(input: $input) {\n sharedClaim {\n id\n }\n }\n}\n"])));
|
|
13216
14013
|
var DebugExpireScenarioClaimMutation = gqlTyped(templateObject_9$6 || (templateObject_9$6 = __makeTemplateObject(["\nmutation DebugExpireScenarioClaimMutation($input: DebugExpireScenarioClaimInput!) {\n debugExpireScenarioClaim(input: $input) {\n scenarioClaim {\n id\n }\n }\n}\n"], ["\nmutation DebugExpireScenarioClaimMutation($input: DebugExpireScenarioClaimInput!) {\n debugExpireScenarioClaim(input: $input) {\n scenarioClaim {\n id\n }\n }\n}\n"])));
|
|
13217
14014
|
var DebugExpireTpPasswordResetRequestMutation = gqlTyped(templateObject_10$4 || (templateObject_10$4 = __makeTemplateObject(["\nmutation DebugExpireTpPasswordResetRequestMutation($input: DebugExpireTpPasswordResetRequestInput!) {\n debugExpireTpPasswordResetRequest(input: $input) {\n passwordResetRequest {\n id\n }\n }\n}\n"], ["\nmutation DebugExpireTpPasswordResetRequestMutation($input: DebugExpireTpPasswordResetRequestInput!) {\n debugExpireTpPasswordResetRequest(input: $input) {\n passwordResetRequest {\n id\n }\n }\n}\n"])));
|
|
13218
|
-
var templateObject_1$
|
|
14015
|
+
var templateObject_1$s, templateObject_2$o, templateObject_3$k, templateObject_4$f, templateObject_5$e, templateObject_6$b, templateObject_7$a, templateObject_8$9, templateObject_9$6, templateObject_10$4;
|
|
13219
14016
|
|
|
13220
|
-
var ScenarioQuery = gqlTyped(templateObject_1$
|
|
13221
|
-
var SharedScenarioQuery = gqlTyped(templateObject_2$
|
|
13222
|
-
var templateObject_1$
|
|
14017
|
+
var ScenarioQuery = gqlTyped(templateObject_1$t || (templateObject_1$t = __makeTemplateObject(["\nquery ScenarioQuery(\n $scenarioId: LrRelayIdInput!\n) {\n scenario(id: $scenarioId) {\n id\n state\n assembly {\n quorum\n singleReject\n assemblyKey {\n id\n }\n subjectKey {\n id\n }\n subjectCipherData\n subAssemblies {\n edges {\n node {\n id\n subjectKey {\n id\n }\n subjectCipherData\n quorum\n singleReject\n approvers {\n edges {\n node {\n id\n tp {\n id\n }\n sharedKey {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n claimants {\n edges {\n node {\n tp {\n id\n }\n sharedKey {\n id\n }\n }\n }\n }\n receivers {\n edges {\n node {\n tp {\n id\n }\n sharedKey {\n id\n }\n sharedCipherData\n receiverDirectories {\n edges {\n node {\n id\n sharedCipherData\n sharedKey {\n id\n }\n accessRole\n itemKey {\n id\n }\n directory {\n id\n keyId\n }\n }\n }\n }\n receiverFiles {\n edges {\n node {\n id\n sharedCipherData\n sharedKey {\n id\n }\n accessRole\n itemKey {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n}"], ["\nquery ScenarioQuery(\n $scenarioId: LrRelayIdInput!\n) {\n scenario(id: $scenarioId) {\n id\n state\n assembly {\n quorum\n singleReject\n assemblyKey {\n id\n }\n subjectKey {\n id\n }\n subjectCipherData\n subAssemblies {\n edges {\n node {\n id\n subjectKey {\n id\n }\n subjectCipherData\n quorum\n singleReject\n approvers {\n edges {\n node {\n id\n tp {\n id\n }\n sharedKey {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n claimants {\n edges {\n node {\n tp {\n id\n }\n sharedKey {\n id\n }\n }\n }\n }\n receivers {\n edges {\n node {\n tp {\n id\n }\n sharedKey {\n id\n }\n sharedCipherData\n receiverDirectories {\n edges {\n node {\n id\n sharedCipherData\n sharedKey {\n id\n }\n accessRole\n itemKey {\n id\n }\n directory {\n id\n keyId\n }\n }\n }\n }\n receiverFiles {\n edges {\n node {\n id\n sharedCipherData\n sharedKey {\n id\n }\n accessRole\n itemKey {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n}"])));
|
|
14018
|
+
var SharedScenarioQuery = gqlTyped(templateObject_2$p || (templateObject_2$p = __makeTemplateObject(["\nquery SharedScenarioQuery($scenarioId: LrRelayIdInput!) {\n sharedScenario(id: $scenarioId) {\n id\n state\n tp {\n id\n }\n asClaimant {\n sharedKey {\n id\n }\n sharedCipherData\n }\n asReceiver {\n sharedKey {\n id\n }\n sharedCipherData\n pbk {\n id\n }\n receiverDirectories {\n edges {\n node {\n id\n wrappedItemKey\n }\n }\n }\n }\n assembly {\n asApprovers {\n edges {\n node {\n id\n sharedKey {\n id\n }\n sharedCipherData\n }\n }\n }\n }\n sharedClaim {\n\t \t\tid\n isClaimant\n claim {\n state\n asClaimApprovers {\n edges {\n node {\n id\n state\n sharedKey {\n id\n }\n sharedCipherApprovalData\n sharedCipherPartialAssemblyKey\n receiverApprovals {\n edges {\n node {\n id\n pxk {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n asClaimReceiver {\n received\n approvals {\n edges {\n node {\n receiverCipher\n receiverCipherPartialAssemblyKey\n pxk {\n id\n }\n }\n }\n }\n }\n }\n }\n}\n"], ["\nquery SharedScenarioQuery($scenarioId: LrRelayIdInput!) {\n sharedScenario(id: $scenarioId) {\n id\n state\n tp {\n id\n }\n asClaimant {\n sharedKey {\n id\n }\n sharedCipherData\n }\n asReceiver {\n sharedKey {\n id\n }\n sharedCipherData\n pbk {\n id\n }\n receiverDirectories {\n edges {\n node {\n id\n wrappedItemKey\n }\n }\n }\n }\n assembly {\n asApprovers {\n edges {\n node {\n id\n sharedKey {\n id\n }\n sharedCipherData\n }\n }\n }\n }\n sharedClaim {\n\t \t\tid\n isClaimant\n claim {\n state\n asClaimApprovers {\n edges {\n node {\n id\n state\n sharedKey {\n id\n }\n sharedCipherApprovalData\n sharedCipherPartialAssemblyKey\n receiverApprovals {\n edges {\n node {\n id\n pxk {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n asClaimReceiver {\n received\n approvals {\n edges {\n node {\n receiverCipher\n receiverCipherPartialAssemblyKey\n pxk {\n id\n }\n }\n }\n }\n }\n }\n }\n}\n"])));
|
|
14019
|
+
var templateObject_1$t, templateObject_2$p;
|
|
13223
14020
|
|
|
13224
14021
|
function throwClaimIdMismatch() {
|
|
13225
14022
|
throw new KcBadArgumentException('claimId does not match with the current claimId of the scenario');
|
|
@@ -14065,8 +14862,8 @@
|
|
|
14065
14862
|
})
|
|
14066
14863
|
], exports.ScenarioService);
|
|
14067
14864
|
|
|
14068
|
-
var ServerConfigQuery = gqlTyped(templateObject_1$
|
|
14069
|
-
var templateObject_1$
|
|
14865
|
+
var ServerConfigQuery = gqlTyped(templateObject_1$u || (templateObject_1$u = __makeTemplateObject(["\nquery ServerConfigQuery {\n serverConfig {\n relayConnectionMaxLimit\n }\n}\n"], ["\nquery ServerConfigQuery {\n serverConfig {\n relayConnectionMaxLimit\n }\n}\n"])));
|
|
14866
|
+
var templateObject_1$u;
|
|
14070
14867
|
|
|
14071
14868
|
exports.ServerConfigService = /** @class */ (function (_super) {
|
|
14072
14869
|
__extends(ServerConfigService, _super);
|
|
@@ -14114,11 +14911,11 @@
|
|
|
14114
14911
|
})
|
|
14115
14912
|
], exports.ServerConfigService);
|
|
14116
14913
|
|
|
14117
|
-
var UpdateOwnedContactCardMutation = gqlTyped(templateObject_1$
|
|
14118
|
-
var UpdateReceivedContactCardMutation = gqlTyped(templateObject_2$
|
|
14914
|
+
var UpdateOwnedContactCardMutation = gqlTyped(templateObject_1$v || (templateObject_1$v = __makeTemplateObject(["\nmutation UpdateOwnedContactCardMutation(\n $input: UpdateOwnedContactCardInput!\n) {\n updateOwnedContactCard(input: $input) {\n ownedContactCard {\n id\n }\n }\n}"], ["\nmutation UpdateOwnedContactCardMutation(\n $input: UpdateOwnedContactCardInput!\n) {\n updateOwnedContactCard(input: $input) {\n ownedContactCard {\n id\n }\n }\n}"])));
|
|
14915
|
+
var UpdateReceivedContactCardMutation = gqlTyped(templateObject_2$q || (templateObject_2$q = __makeTemplateObject(["\nmutation UpdateReceivedContactCardMutation(\n $input: UpdateReceivedContactCardInput!\n) {\n updateReceivedContactCard(input: $input) {\n receivedContactCard {\n id\n }\n }\n}"], ["\nmutation UpdateReceivedContactCardMutation(\n $input: UpdateReceivedContactCardInput!\n) {\n updateReceivedContactCard(input: $input) {\n receivedContactCard {\n id\n }\n }\n}"])));
|
|
14119
14916
|
var GetOwnedContactCardKeyIdsQuery = gqlTyped(templateObject_3$l || (templateObject_3$l = __makeTemplateObject(["\nquery GetOwnedContactCardKeyIdsQuery($id: LrRelayIdInput!) {\n ownedContactCard(id: $id) {\n sharedKey {\n id\n }\n ownerKey {\n id\n }\n }\n}"], ["\nquery GetOwnedContactCardKeyIdsQuery($id: LrRelayIdInput!) {\n ownedContactCard(id: $id) {\n sharedKey {\n id\n }\n ownerKey {\n id\n }\n }\n}"])));
|
|
14120
14917
|
var GetReceivedContactCardKeyIdQuery = gqlTyped(templateObject_4$g || (templateObject_4$g = __makeTemplateObject(["\nquery GetReceivedContactCardKeyIdQuery($id: LrRelayIdInput!) {\n receivedContactCard(id: $id) {\n receiverKey {\n id\n }\n }\n}"], ["\nquery GetReceivedContactCardKeyIdQuery($id: LrRelayIdInput!) {\n receivedContactCard(id: $id) {\n receiverKey {\n id\n }\n }\n}"])));
|
|
14121
|
-
var templateObject_1$
|
|
14918
|
+
var templateObject_1$v, templateObject_2$q, templateObject_3$l, templateObject_4$g;
|
|
14122
14919
|
|
|
14123
14920
|
exports.SharedContactCard2Service = /** @class */ (function () {
|
|
14124
14921
|
function SharedContactCard2Service(ngZone, keyService, keyGraph, encryptionService, lrGraphQL) {
|
|
@@ -14192,22 +14989,21 @@
|
|
|
14192
14989
|
case 6:
|
|
14193
14990
|
sharedKey = _e.sent();
|
|
14194
14991
|
return [3 /*break*/, 7];
|
|
14195
|
-
case 7:
|
|
14196
|
-
|
|
14197
|
-
sigPxk = _e.sent();
|
|
14992
|
+
case 7:
|
|
14993
|
+
sigPxk = this.keyService.currentSigPxk;
|
|
14198
14994
|
return [4 /*yield*/, this.encryptionService.encrypt(sharedKey.jwk, sharedCipherDataClearJson)];
|
|
14199
|
-
case
|
|
14995
|
+
case 8:
|
|
14200
14996
|
sharedCipherData = _e.sent();
|
|
14201
14997
|
_b = (_a = JSON).stringify;
|
|
14202
14998
|
return [4 /*yield*/, this.encryptionService.sign(sigPxk.jwk, sharedCipherData)];
|
|
14203
|
-
case
|
|
14999
|
+
case 9:
|
|
14204
15000
|
sharedCipherDataSig = _b.apply(_a, [_e.sent()]);
|
|
14205
15001
|
_d = (_c = JSON).stringify;
|
|
14206
15002
|
return [4 /*yield*/, this.encryptionService.sign(sigPxk.jwk, ownerPlainDataJson)];
|
|
14207
|
-
case
|
|
15003
|
+
case 10:
|
|
14208
15004
|
ownerPlainDataSig = _d.apply(_c, [_e.sent()]);
|
|
14209
15005
|
return [4 /*yield*/, this.encryptionService.encryptToString(ownerKey.jwk, ownerCipherDataClearJson)];
|
|
14210
|
-
case
|
|
15006
|
+
case 11:
|
|
14211
15007
|
ownerCipherData = _e.sent();
|
|
14212
15008
|
return [2 /*return*/, new LrMutation({
|
|
14213
15009
|
mutation: UpdateOwnedContactCardMutation,
|
|
@@ -14608,7 +15404,7 @@
|
|
|
14608
15404
|
};
|
|
14609
15405
|
return TpPasswordResetUserService;
|
|
14610
15406
|
}(LrService));
|
|
14611
|
-
exports.TpPasswordResetUserService.ɵprov = i0.ɵɵdefineInjectable({ factory: function TpPasswordResetUserService_Factory() { return new exports.TpPasswordResetUserService(i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(KC_CONFIG), i0.ɵɵinject(KeyFactoryService), i0.ɵɵinject(EncryptionService), i0.ɵɵinject(PasswordService), i0.ɵɵinject(i2$
|
|
15407
|
+
exports.TpPasswordResetUserService.ɵprov = i0.ɵɵdefineInjectable({ factory: function TpPasswordResetUserService_Factory() { return new exports.TpPasswordResetUserService(i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(KC_CONFIG), i0.ɵɵinject(KeyFactoryService), i0.ɵɵinject(EncryptionService), i0.ɵɵinject(PasswordService), i0.ɵɵinject(i2$2.HttpClient), i0.ɵɵinject(i2.AuthClass)); }, token: exports.TpPasswordResetUserService, providedIn: "root" });
|
|
14612
15408
|
exports.TpPasswordResetUserService.decorators = [
|
|
14613
15409
|
{ type: i0.Injectable, args: [{
|
|
14614
15410
|
providedIn: 'root',
|
|
@@ -14621,8 +15417,8 @@
|
|
|
14621
15417
|
{ type: KeyFactoryService },
|
|
14622
15418
|
{ type: EncryptionService },
|
|
14623
15419
|
{ type: PasswordService },
|
|
14624
|
-
{ type: i2$
|
|
14625
|
-
{ type:
|
|
15420
|
+
{ type: i2$2.HttpClient },
|
|
15421
|
+
{ type: i2.AuthClass }
|
|
14626
15422
|
]; };
|
|
14627
15423
|
exports.TpPasswordResetUserService = __decorate([
|
|
14628
15424
|
RunOutsideAngular({
|
|
@@ -14748,18 +15544,18 @@
|
|
|
14748
15544
|
})
|
|
14749
15545
|
], exports.TpPasswordResetService);
|
|
14750
15546
|
|
|
14751
|
-
var DeleteTpMutation = gqlTyped(templateObject_1$
|
|
14752
|
-
var ShareDirectoryMutation = gqlTyped(templateObject_2$
|
|
15547
|
+
var DeleteTpMutation = gqlTyped(templateObject_1$w || (templateObject_1$w = __makeTemplateObject(["\nmutation DeleteTpMutation($input: DeleteTpInput!) {\n deleteTp(input: $input) {\n id\n }\n}\n"], ["\nmutation DeleteTpMutation($input: DeleteTpInput!) {\n deleteTp(input: $input) {\n id\n }\n}\n"])));
|
|
15548
|
+
var ShareDirectoryMutation = gqlTyped(templateObject_2$r || (templateObject_2$r = __makeTemplateObject(["\n mutation ShareDirectoryMutation($input: ShareDirectoryInput!) {\n shareDirectory(input: $input) {\n tpSharedDirectory {\n id\n }\n }\n }\n"], ["\n mutation ShareDirectoryMutation($input: ShareDirectoryInput!) {\n shareDirectory(input: $input) {\n tpSharedDirectory {\n id\n }\n }\n }\n"])));
|
|
14753
15549
|
var UnshareDirectoryMutation = gqlTyped(templateObject_3$m || (templateObject_3$m = __makeTemplateObject(["\n mutation UnshareDirectoryMutation($input: UnshareDirectoryInput!) {\n unshareDirectory(input: $input) {\n tpSharedDirectory {\n id\n }\n }\n }\n"], ["\n mutation UnshareDirectoryMutation($input: UnshareDirectoryInput!) {\n unshareDirectory(input: $input) {\n tpSharedDirectory {\n id\n }\n }\n }\n"])));
|
|
14754
15550
|
var ShareFileMutation = gqlTyped(templateObject_4$h || (templateObject_4$h = __makeTemplateObject(["\n mutation ShareFileMutation($input: ShareFileInput!) {\n shareFile(input: $input) {\n tpSharedFile {\n id\n }\n }\n }\n"], ["\n mutation ShareFileMutation($input: ShareFileInput!) {\n shareFile(input: $input) {\n tpSharedFile {\n id\n }\n }\n }\n"])));
|
|
14755
15551
|
var UnshareFileMutation = gqlTyped(templateObject_5$f || (templateObject_5$f = __makeTemplateObject(["\n mutation UnshareFileMutation($input: UnshareFileInput!) {\n unshareFile(input: $input) {\n tpSharedFile {\n id\n }\n }\n }\n"], ["\n mutation UnshareFileMutation($input: UnshareFileInput!) {\n unshareFile(input: $input) {\n tpSharedFile {\n id\n }\n }\n }\n"])));
|
|
14756
15552
|
var RequestTpMkReshareMutation = gqlTyped(templateObject_6$c || (templateObject_6$c = __makeTemplateObject(["\nmutation RequestTpMkReshareMutation($input: RequestTpMkReshareInput!) {\n requestTpMkReshare(input: $input) {\n id\n }\n}"], ["\nmutation RequestTpMkReshareMutation($input: RequestTpMkReshareInput!) {\n requestTpMkReshare(input: $input) {\n id\n }\n}"])));
|
|
14757
15553
|
var RespondTpMkReshareMutation = gqlTyped(templateObject_7$b || (templateObject_7$b = __makeTemplateObject(["\n mutation RespondTpMkReshareMutation($input: RespondTpMkReshareInput!) {\n respondTpMkReshare(input: $input) {\n id\n }\n }\n"], ["\n mutation RespondTpMkReshareMutation($input: RespondTpMkReshareInput!) {\n respondTpMkReshare(input: $input) {\n id\n }\n }\n"])));
|
|
14758
15554
|
var CompleteTpMkReshareMutation = gqlTyped(templateObject_8$a || (templateObject_8$a = __makeTemplateObject(["\nmutation CompleteTpMkReshareMutation($input: CompleteTpMkReshareInput!) {\n completeTpMkReshare(input: $input) {\n id\n }\n}"], ["\nmutation CompleteTpMkReshareMutation($input: CompleteTpMkReshareInput!) {\n completeTpMkReshare(input: $input) {\n id\n }\n}"])));
|
|
14759
|
-
var templateObject_1$
|
|
15555
|
+
var templateObject_1$w, templateObject_2$r, templateObject_3$m, templateObject_4$h, templateObject_5$f, templateObject_6$c, templateObject_7$b, templateObject_8$a;
|
|
14760
15556
|
|
|
14761
|
-
var TpCurrentUserSharedKeyQuery = gqlTyped(templateObject_1$
|
|
14762
|
-
var templateObject_1$
|
|
15557
|
+
var TpCurrentUserSharedKeyQuery = gqlTyped(templateObject_1$x || (templateObject_1$x = __makeTemplateObject(["\nquery TpCurrentUserSharedKeyQuery($id: LrRelayIdInput!) {\n tp(id: $id){\n currentUserSharedKey {\n userSharedKey {\n sharedKey {\n id\n }\n mkSharedKey {\n id\n }\n mkPxk {\n id\n }\n mkReshareRequestCipher\n mkReshareRequestSent\n mkReshareResponseCipher\n mkReshareResponseSent\n }\n }\n }\n}\n"], ["\nquery TpCurrentUserSharedKeyQuery($id: LrRelayIdInput!) {\n tp(id: $id){\n currentUserSharedKey {\n userSharedKey {\n sharedKey {\n id\n }\n mkSharedKey {\n id\n }\n mkPxk {\n id\n }\n mkReshareRequestCipher\n mkReshareRequestSent\n mkReshareResponseCipher\n mkReshareResponseSent\n }\n }\n }\n}\n"])));
|
|
15558
|
+
var templateObject_1$x;
|
|
14763
15559
|
|
|
14764
15560
|
exports.TrustedParty2Service = /** @class */ (function (_super) {
|
|
14765
15561
|
__extends(TrustedParty2Service, _super);
|
|
@@ -14909,22 +15705,20 @@
|
|
|
14909
15705
|
if (userSharedKey.mkSharedKey) {
|
|
14910
15706
|
throw new KcBadStateException('TP already has mkSharedKey');
|
|
14911
15707
|
}
|
|
14912
|
-
|
|
14913
|
-
case 2:
|
|
14914
|
-
masterKey = _a.sent();
|
|
15708
|
+
masterKey = this.keyService.currentMasterKey;
|
|
14915
15709
|
return [4 /*yield*/, this.keyFactory.createPkcKey()];
|
|
14916
|
-
case
|
|
15710
|
+
case 2:
|
|
14917
15711
|
prk = _a.sent();
|
|
14918
15712
|
return [4 /*yield*/, this.encryptionService.encryptToString(masterKey.jwk, prk.toJSON(true))];
|
|
14919
|
-
case
|
|
15713
|
+
case 3:
|
|
14920
15714
|
mkWrappedMkPrk = _a.sent();
|
|
14921
15715
|
return [4 /*yield*/, this.keyGraph.getKey(userSharedKey.sharedKey.id)];
|
|
14922
|
-
case
|
|
15716
|
+
case 4:
|
|
14923
15717
|
sharedKey = _a.sent();
|
|
14924
15718
|
return [4 /*yield*/, this.encryptionService.encryptToString(sharedKey.jwk, {
|
|
14925
15719
|
pbk: prk.toJSON(),
|
|
14926
15720
|
})];
|
|
14927
|
-
case
|
|
15721
|
+
case 5:
|
|
14928
15722
|
mkReshareRequestCipher = _a.sent();
|
|
14929
15723
|
return [4 /*yield*/, new LrMutation({
|
|
14930
15724
|
mutation: RequestTpMkReshareMutation,
|
|
@@ -14939,7 +15733,7 @@
|
|
|
14939
15733
|
},
|
|
14940
15734
|
},
|
|
14941
15735
|
})];
|
|
14942
|
-
case
|
|
15736
|
+
case 6: return [2 /*return*/, _a.sent()];
|
|
14943
15737
|
}
|
|
14944
15738
|
});
|
|
14945
15739
|
});
|
|
@@ -15020,11 +15814,9 @@
|
|
|
15020
15814
|
case 6:
|
|
15021
15815
|
mkSharedKey = (_d.jwk = _e.sent(),
|
|
15022
15816
|
_d);
|
|
15023
|
-
|
|
15024
|
-
case 7:
|
|
15025
|
-
masterKey = _e.sent();
|
|
15817
|
+
masterKey = this.keyService.currentMasterKey;
|
|
15026
15818
|
return [4 /*yield*/, this.encryptionService.encryptToString(masterKey.jwk, mkSharedKey.jwk.toJSON(true))];
|
|
15027
|
-
case
|
|
15819
|
+
case 7:
|
|
15028
15820
|
mkWrappedMkSharedKey = _e.sent();
|
|
15029
15821
|
return [2 /*return*/, new LrMutation({
|
|
15030
15822
|
mutation: CompleteTpMkReshareMutation,
|
|
@@ -15204,14 +15996,14 @@
|
|
|
15204
15996
|
};
|
|
15205
15997
|
return TwoFactorService;
|
|
15206
15998
|
}());
|
|
15207
|
-
TwoFactorService.ɵprov = i0.ɵɵdefineInjectable({ factory: function TwoFactorService_Factory() { return new TwoFactorService(i0.ɵɵinject(
|
|
15999
|
+
TwoFactorService.ɵprov = i0.ɵɵdefineInjectable({ factory: function TwoFactorService_Factory() { return new TwoFactorService(i0.ɵɵinject(i2.AuthClass)); }, token: TwoFactorService, providedIn: "root" });
|
|
15208
16000
|
TwoFactorService.decorators = [
|
|
15209
16001
|
{ type: i0.Injectable, args: [{
|
|
15210
16002
|
providedIn: 'root',
|
|
15211
16003
|
},] }
|
|
15212
16004
|
];
|
|
15213
16005
|
TwoFactorService.ctorParameters = function () { return [
|
|
15214
|
-
{ type:
|
|
16006
|
+
{ type: i2.AuthClass }
|
|
15215
16007
|
]; };
|
|
15216
16008
|
|
|
15217
16009
|
/*
|
|
@@ -15225,6 +16017,7 @@
|
|
|
15225
16017
|
exports.ApiContactCard = ApiContactCard;
|
|
15226
16018
|
exports.ApiCurrentUser = ApiCurrentUser;
|
|
15227
16019
|
exports.ArchiveDirectoryMutation = ArchiveDirectoryMutation;
|
|
16020
|
+
exports.AuthTypes = auth2_types;
|
|
15228
16021
|
exports.CancelUserDeleteMutation = CancelUserDeleteMutation;
|
|
15229
16022
|
exports.Category = Category;
|
|
15230
16023
|
exports.CategoryFields = CategoryFields;
|
|
@@ -15344,7 +16137,6 @@
|
|
|
15344
16137
|
exports.RecordTypeFieldOption = RecordTypeFieldOption;
|
|
15345
16138
|
exports.RecordTypeService = RecordTypeService;
|
|
15346
16139
|
exports.RecordTypeSummary = RecordTypeSummary;
|
|
15347
|
-
exports.RegisterResult = RegisterResult;
|
|
15348
16140
|
exports.RegisterService = RegisterService;
|
|
15349
16141
|
exports.RequestUserDeleteMutation = RequestUserDeleteMutation;
|
|
15350
16142
|
exports.RespondOtkMutation = RespondOtkMutation;
|