@lifeready/core 1.0.19 → 1.0.20
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 +124 -105
- 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/api/types/lr-graphql.types.js +9 -9
- package/esm2015/lib/auth/auth.gql.js +1 -6
- package/esm2015/lib/auth/password.service.js +3 -8
- package/esm2015/lib/items2/item2.gql.js +10 -1
- package/esm2015/lib/items2/item2.service.js +18 -2
- package/esm2015/lib/items2/item2.types.js +1 -1
- package/esm2015/lib/scenario/scenario.service.js +1 -2
- package/esm2015/lib/trusted-parties/tp-assembly.js +8 -5
- package/esm2015/lib/trusted-parties/tp-assembly.types.js +1 -1
- package/fesm2015/lifeready-core.js +42 -25
- package/fesm2015/lifeready-core.js.map +1 -1
- package/lib/api/types/lr-graphql.types.d.ts +4 -2
- package/lib/items2/item2.gql.d.ts +8 -0
- package/lib/items2/item2.service.d.ts +8 -1
- package/lib/items2/item2.types.d.ts +4 -0
- package/lib/trusted-parties/tp-assembly.types.d.ts +2 -0
- package/lifeready-core.metadata.json +1 -1
- package/package.json +1 -1
|
@@ -3230,7 +3230,7 @@
|
|
|
3230
3230
|
return gql.apply(void 0, __spread([literals], placeholders));
|
|
3231
3231
|
}
|
|
3232
3232
|
|
|
3233
|
-
var PasswordChangeRequestMutation = gql(templateObject_1$6 || (templateObject_1$6 = __makeTemplateObject(["\n mutation {\n passwordChangeRequest(input: {}) {\n challenge\n
|
|
3233
|
+
var PasswordChangeRequestMutation = gql(templateObject_1$6 || (templateObject_1$6 = __makeTemplateObject(["\n mutation {\n passwordChangeRequest(input: {}) {\n challenge\n }\n }\n"], ["\n mutation {\n passwordChangeRequest(input: {}) {\n challenge\n }\n }\n"])));
|
|
3234
3234
|
var PasswordChangeMutation = gql(templateObject_2$5 || (templateObject_2$5 = __makeTemplateObject(["\n mutation PasswordChange($input: PasswordChangeInput!) {\n passwordChange(input: $input) {\n token\n newPassKey {\n id\n }\n }\n }\n"], ["\n mutation PasswordChange($input: PasswordChangeInput!) {\n passwordChange(input: $input) {\n token\n newPassKey {\n id\n }\n }\n }\n"])));
|
|
3235
3235
|
var PasswordChangeConfigQuery = gql(templateObject_3$5 || (templateObject_3$5 = __makeTemplateObject(["\n query PasswordChangeConfigQuery {\n passwordChangeConfig {\n maxAuthAgeSeconds\n authTime\n serverTime\n }\n }\n"], ["\n query PasswordChangeConfigQuery {\n passwordChangeConfig {\n maxAuthAgeSeconds\n authTime\n serverTime\n }\n }\n"])));
|
|
3236
3236
|
var SetSessionEncryptionKeyMutation = gqlTyped(templateObject_4$4 || (templateObject_4$4 = __makeTemplateObject(["\nmutation SetSessionEncryptionKeyMutation($input: SetSessionEncryptionKeyInput!) {\n setSessionEncryptionKey(input: $input) {\n sessionEncryptionKey\n }\n}\n"], ["\nmutation SetSessionEncryptionKeyMutation($input: SetSessionEncryptionKeyInput!) {\n setSessionEncryptionKey(input: $input) {\n sessionEncryptionKey\n }\n}\n"])));
|
|
@@ -3613,12 +3613,6 @@
|
|
|
3613
3613
|
case 0: return [4 /*yield*/, this.auth.currentAuthenticatedUser()];
|
|
3614
3614
|
case 1:
|
|
3615
3615
|
cognitoUser = _c.sent();
|
|
3616
|
-
// Validation
|
|
3617
|
-
// todo: Add this back in
|
|
3618
|
-
// Note the passIdp will always have a random salt, so will always be different to the current passIdp.
|
|
3619
|
-
if (password === newPassword) {
|
|
3620
|
-
throw new LrBadArgumentException('New password is the same as the current one.');
|
|
3621
|
-
}
|
|
3622
3616
|
return [4 /*yield*/, this.profileService.getCurrentUser()];
|
|
3623
3617
|
case 2:
|
|
3624
3618
|
currentUser = (_c.sent()).currentUser;
|
|
@@ -5209,13 +5203,13 @@
|
|
|
5209
5203
|
AccessRoleMethod["inherited"] = "inherited";
|
|
5210
5204
|
AccessRoleMethod["direct"] = "direct";
|
|
5211
5205
|
})(exports.AccessRoleMethod || (exports.AccessRoleMethod = {}));
|
|
5212
|
-
(function (
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
})(exports.
|
|
5206
|
+
(function (FileOperationField) {
|
|
5207
|
+
FileOperationField["CREATE"] = "CREATE";
|
|
5208
|
+
FileOperationField["READ"] = "READ";
|
|
5209
|
+
FileOperationField["UPDATE"] = "UPDATE";
|
|
5210
|
+
FileOperationField["REVERT"] = "REVERT";
|
|
5211
|
+
FileOperationField["DELETE"] = "DELETE";
|
|
5212
|
+
})(exports.FileOperationField || (exports.FileOperationField = {}));
|
|
5219
5213
|
(function (KeyExchangeOtkState) {
|
|
5220
5214
|
KeyExchangeOtkState["OTK_INITIATED"] = "OTK_INITIATED";
|
|
5221
5215
|
KeyExchangeOtkState["OTK_ACCEPTED"] = "OTK_ACCEPTED";
|
|
@@ -5525,8 +5519,8 @@
|
|
|
5525
5519
|
TpAssemblyController.prototype.recoverAssemblyKey = function (partials) {
|
|
5526
5520
|
return __awaiter(this, void 0, void 0, function () {
|
|
5527
5521
|
var assemblyKeyParams, shares, rawAssemblyKey;
|
|
5528
|
-
return __generator(this, function (
|
|
5529
|
-
switch (
|
|
5522
|
+
return __generator(this, function (_c) {
|
|
5523
|
+
switch (_c.label) {
|
|
5530
5524
|
case 0:
|
|
5531
5525
|
shares = partials.map(function (partial) {
|
|
5532
5526
|
if (assemblyKeyParams) {
|
|
@@ -5542,46 +5536,46 @@
|
|
|
5542
5536
|
});
|
|
5543
5537
|
return [4 /*yield*/, this.slip39Service.recoverSecret(shares, this.slip39Passphrase)];
|
|
5544
5538
|
case 1:
|
|
5545
|
-
rawAssemblyKey =
|
|
5539
|
+
rawAssemblyKey = _c.sent();
|
|
5546
5540
|
return [4 /*yield*/, KeyFactoryService.asKey(Object.assign(Object.assign({}, assemblyKeyParams), { k: rawAssemblyKey }))];
|
|
5547
|
-
case 2: return [2 /*return*/,
|
|
5541
|
+
case 2: return [2 /*return*/, _c.sent()];
|
|
5548
5542
|
}
|
|
5549
5543
|
});
|
|
5550
5544
|
});
|
|
5551
5545
|
};
|
|
5552
5546
|
TpAssemblyController.prototype.prepareTpWrappingKey = function (tp) {
|
|
5553
5547
|
return __awaiter(this, void 0, void 0, function () {
|
|
5554
|
-
return __generator(this, function (
|
|
5548
|
+
return __generator(this, function (_c) {
|
|
5555
5549
|
return [2 /*return*/, this.keyGraph.getKey(tp.wrappingKeyId)];
|
|
5556
5550
|
});
|
|
5557
5551
|
});
|
|
5558
5552
|
};
|
|
5559
|
-
TpAssemblyController.prototype.prepareAssembly = function (
|
|
5560
|
-
var subjectKey =
|
|
5553
|
+
TpAssemblyController.prototype.prepareAssembly = function (_c) {
|
|
5554
|
+
var subjectKey = _c.subjectKey, rootKey = _c.rootKey;
|
|
5561
5555
|
return __awaiter(this, void 0, void 0, function () {
|
|
5562
5556
|
var assemblyKey, _a, rawAssemblyKey, assemblyKeyParams, assemblyKeyVerifierPrk, wrappedAssemblyKeyVerifierPrk, assemblyKeyVerifierPbk, subjectKeyWrappedAssemblyKey, assemblyCipherData;
|
|
5563
|
-
return __generator(this, function (
|
|
5564
|
-
switch (
|
|
5557
|
+
return __generator(this, function (_c) {
|
|
5558
|
+
switch (_c.label) {
|
|
5565
5559
|
case 0: return [4 /*yield*/, this.keyFactory.createKey()];
|
|
5566
5560
|
case 1:
|
|
5567
|
-
assemblyKey =
|
|
5561
|
+
assemblyKey = _c.sent();
|
|
5568
5562
|
console.log('prepareAssembly assemblyKey', assemblyKey);
|
|
5569
5563
|
_a = assemblyKey.toJSON(true), rawAssemblyKey = _a.k, assemblyKeyParams = __rest(_a, ["k"]);
|
|
5570
5564
|
return [4 /*yield*/, this.keyFactory.createPkcSignKey()];
|
|
5571
5565
|
case 2:
|
|
5572
|
-
assemblyKeyVerifierPrk =
|
|
5566
|
+
assemblyKeyVerifierPrk = _c.sent();
|
|
5573
5567
|
return [4 /*yield*/, this.encryptionService.encryptToString(assemblyKey, assemblyKeyVerifierPrk.toJSON(true))];
|
|
5574
5568
|
case 3:
|
|
5575
|
-
wrappedAssemblyKeyVerifierPrk =
|
|
5569
|
+
wrappedAssemblyKeyVerifierPrk = _c.sent();
|
|
5576
5570
|
assemblyKeyVerifierPbk = JSON.stringify(assemblyKeyVerifierPrk.toJSON());
|
|
5577
5571
|
return [4 /*yield*/, this.encryptionService.encryptToString(subjectKey, assemblyKey.toJSON(true))];
|
|
5578
5572
|
case 4:
|
|
5579
|
-
subjectKeyWrappedAssemblyKey =
|
|
5573
|
+
subjectKeyWrappedAssemblyKey = _c.sent();
|
|
5580
5574
|
return [4 /*yield*/, this.encryptionService.encryptToString(assemblyKey, {
|
|
5581
5575
|
rootKey: rootKey.toJSON(true),
|
|
5582
5576
|
})];
|
|
5583
5577
|
case 5:
|
|
5584
|
-
assemblyCipherData =
|
|
5578
|
+
assemblyCipherData = _c.sent();
|
|
5585
5579
|
return [2 /*return*/, {
|
|
5586
5580
|
assemblyKey: assemblyKey,
|
|
5587
5581
|
rawAssemblyKey: rawAssemblyKey,
|
|
@@ -5595,21 +5589,21 @@
|
|
|
5595
5589
|
});
|
|
5596
5590
|
});
|
|
5597
5591
|
};
|
|
5598
|
-
TpAssemblyController.prototype.prepareCreateSubAssemblies = function (
|
|
5599
|
-
var input =
|
|
5592
|
+
TpAssemblyController.prototype.prepareCreateSubAssemblies = function (_c) {
|
|
5593
|
+
var input = _c.input, subjectKey = _c.subjectKey, slipSubAssemblies = _c.slipSubAssemblies, assemblyKeyParams = _c.assemblyKeyParams;
|
|
5600
5594
|
return __awaiter(this, void 0, void 0, function () {
|
|
5601
5595
|
var _this = this;
|
|
5602
|
-
return __generator(this, function (
|
|
5596
|
+
return __generator(this, function (_c) {
|
|
5603
5597
|
return [2 /*return*/, Promise.all(input.map(function (sa, saIndex) { return __awaiter(_this, void 0, void 0, function () {
|
|
5604
5598
|
var subjectCipherData, createApprovers;
|
|
5605
5599
|
var _this = this;
|
|
5606
|
-
return __generator(this, function (
|
|
5607
|
-
switch (
|
|
5600
|
+
return __generator(this, function (_c) {
|
|
5601
|
+
switch (_c.label) {
|
|
5608
5602
|
case 0: return [4 /*yield*/, this.encryptionService.encryptToString(subjectKey, sa.subjectCipherDataClearJson || '')];
|
|
5609
5603
|
case 1:
|
|
5610
|
-
subjectCipherData =
|
|
5604
|
+
subjectCipherData = _c.sent();
|
|
5611
5605
|
return [4 /*yield*/, Promise.all(sa.approverTps.map(function (approverTp, approverIndex) { return __awaiter(_this, void 0, void 0, function () {
|
|
5612
|
-
return __generator(this, function (
|
|
5606
|
+
return __generator(this, function (_c) {
|
|
5613
5607
|
return [2 /*return*/, this.prepareApprover({
|
|
5614
5608
|
tp: approverTp,
|
|
5615
5609
|
approverIndex: approverIndex,
|
|
@@ -5620,7 +5614,7 @@
|
|
|
5620
5614
|
});
|
|
5621
5615
|
}); }))];
|
|
5622
5616
|
case 2:
|
|
5623
|
-
createApprovers =
|
|
5617
|
+
createApprovers = _c.sent();
|
|
5624
5618
|
return [2 /*return*/, {
|
|
5625
5619
|
singleReject: sa.singleReject,
|
|
5626
5620
|
quorum: sa.quorum,
|
|
@@ -5633,22 +5627,22 @@
|
|
|
5633
5627
|
});
|
|
5634
5628
|
});
|
|
5635
5629
|
};
|
|
5636
|
-
TpAssemblyController.prototype.prepareUpdateSubAssemblies = function (
|
|
5637
|
-
var input =
|
|
5630
|
+
TpAssemblyController.prototype.prepareUpdateSubAssemblies = function (_c) {
|
|
5631
|
+
var input = _c.input, subjectKey = _c.subjectKey, slipSubAssemblies = _c.slipSubAssemblies, assemblyKeyParams = _c.assemblyKeyParams, subAssemblies = _c.subAssemblies;
|
|
5638
5632
|
return __awaiter(this, void 0, void 0, function () {
|
|
5639
5633
|
var _this = this;
|
|
5640
|
-
return __generator(this, function (
|
|
5634
|
+
return __generator(this, function (_c) {
|
|
5641
5635
|
if (slipSubAssemblies.length !== input.length) {
|
|
5642
5636
|
throw new LrBadArgumentException('The slipSubAssemblies must be the same length as the input');
|
|
5643
5637
|
}
|
|
5644
5638
|
return [2 /*return*/, Promise.all(input.map(function (sa, saIndex) { return __awaiter(_this, void 0, void 0, function () {
|
|
5645
|
-
var subjectCipherData, existingSa, createApprovers, updateApprovers, slipSubAssembly,
|
|
5639
|
+
var subjectCipherData, existingSa, createApprovers, updateApprovers, slipSubAssembly, _c;
|
|
5646
5640
|
var _this = this;
|
|
5647
|
-
return __generator(this, function (
|
|
5648
|
-
switch (
|
|
5641
|
+
return __generator(this, function (_d) {
|
|
5642
|
+
switch (_d.label) {
|
|
5649
5643
|
case 0: return [4 /*yield*/, this.encryptionService.encryptToString(subjectKey, sa.subjectCipherDataClearJson || '')];
|
|
5650
5644
|
case 1:
|
|
5651
|
-
subjectCipherData =
|
|
5645
|
+
subjectCipherData = _d.sent();
|
|
5652
5646
|
existingSa = subAssemblies.edges.find(function (edge) { return edge.node.id === sa.id; }).node;
|
|
5653
5647
|
createApprovers = [];
|
|
5654
5648
|
updateApprovers = [];
|
|
@@ -5668,16 +5662,16 @@
|
|
|
5668
5662
|
}
|
|
5669
5663
|
});
|
|
5670
5664
|
slipSubAssembly = slipSubAssemblies[saIndex];
|
|
5671
|
-
|
|
5665
|
+
_c = {
|
|
5672
5666
|
subAssemblyId: sa.id,
|
|
5673
5667
|
singleReject: sa.singleReject,
|
|
5674
5668
|
quorum: sa.quorum,
|
|
5675
5669
|
subjectCipherData: subjectCipherData
|
|
5676
5670
|
};
|
|
5677
|
-
return [4 /*yield*/, Promise.all(createApprovers.map(function (
|
|
5678
|
-
var tp =
|
|
5671
|
+
return [4 /*yield*/, Promise.all(createApprovers.map(function (_c, approverIndex) {
|
|
5672
|
+
var tp = _c.tp;
|
|
5679
5673
|
return __awaiter(_this, void 0, void 0, function () {
|
|
5680
|
-
return __generator(this, function (
|
|
5674
|
+
return __generator(this, function (_c) {
|
|
5681
5675
|
return [2 /*return*/, this.prepareApprover({
|
|
5682
5676
|
tp: tp,
|
|
5683
5677
|
approverIndex: approverIndex,
|
|
@@ -5689,11 +5683,11 @@
|
|
|
5689
5683
|
});
|
|
5690
5684
|
}))];
|
|
5691
5685
|
case 2:
|
|
5692
|
-
|
|
5693
|
-
return [4 /*yield*/, Promise.all(updateApprovers.map(function (
|
|
5694
|
-
var tp =
|
|
5686
|
+
_c.createApprovers = _d.sent();
|
|
5687
|
+
return [4 /*yield*/, Promise.all(updateApprovers.map(function (_c, approverIndex) {
|
|
5688
|
+
var tp = _c.tp, approverId = _c.approverId;
|
|
5695
5689
|
return __awaiter(_this, void 0, void 0, function () {
|
|
5696
|
-
return __generator(this, function (
|
|
5690
|
+
return __generator(this, function (_c) {
|
|
5697
5691
|
return [2 /*return*/, this.prepareApprover({
|
|
5698
5692
|
approverId: approverId,
|
|
5699
5693
|
tp: tp,
|
|
@@ -5705,8 +5699,8 @@
|
|
|
5705
5699
|
});
|
|
5706
5700
|
});
|
|
5707
5701
|
}))];
|
|
5708
|
-
case 3: return [2 /*return*/, (
|
|
5709
|
-
|
|
5702
|
+
case 3: return [2 /*return*/, (_c.updateApprovers = _d.sent(),
|
|
5703
|
+
_c)];
|
|
5710
5704
|
}
|
|
5711
5705
|
});
|
|
5712
5706
|
}); }))];
|
|
@@ -5736,29 +5730,29 @@
|
|
|
5736
5730
|
};
|
|
5737
5731
|
TpAssemblyController.prototype.prepareCreate = function (input) {
|
|
5738
5732
|
return __awaiter(this, void 0, void 0, function () {
|
|
5739
|
-
var rootKey, subjectKey, rootKeyWrappedSubjectKey, _a, assemblyKey, rawAssemblyKey, assemblyKeyParams, assemblyInput, slipAssembly, tpIds, tps,
|
|
5740
|
-
return __generator(this, function (
|
|
5741
|
-
switch (
|
|
5733
|
+
var rootKey, subjectKey, rootKeyWrappedSubjectKey, _a, assemblyKey, rawAssemblyKey, assemblyKeyParams, assemblyInput, slipAssembly, tpIds, tps, _c, createSubAssemblies, subjectCipherData;
|
|
5734
|
+
return __generator(this, function (_d) {
|
|
5735
|
+
switch (_d.label) {
|
|
5742
5736
|
case 0: return [4 /*yield*/, this.keyService.getCurrentRootKey()];
|
|
5743
5737
|
case 1:
|
|
5744
|
-
rootKey =
|
|
5738
|
+
rootKey = _d.sent();
|
|
5745
5739
|
return [4 /*yield*/, this.keyFactory.createKey()];
|
|
5746
5740
|
case 2:
|
|
5747
|
-
subjectKey =
|
|
5741
|
+
subjectKey = _d.sent();
|
|
5748
5742
|
return [4 /*yield*/, this.keyGraph.wrapKey(rootKey, subjectKey)];
|
|
5749
5743
|
case 3:
|
|
5750
|
-
rootKeyWrappedSubjectKey =
|
|
5744
|
+
rootKeyWrappedSubjectKey = _d.sent();
|
|
5751
5745
|
return [4 /*yield*/, this.prepareAssembly({
|
|
5752
5746
|
rootKey: rootKey.jwk,
|
|
5753
5747
|
subjectKey: subjectKey,
|
|
5754
5748
|
})];
|
|
5755
5749
|
case 4:
|
|
5756
|
-
_a =
|
|
5750
|
+
_a = _d.sent(), assemblyKey = _a.assemblyKey, rawAssemblyKey = _a.rawAssemblyKey, assemblyKeyParams = _a.assemblyKeyParams, assemblyInput = __rest(_a, ["assemblyKey", "rawAssemblyKey", "assemblyKeyParams"]);
|
|
5757
5751
|
return [4 /*yield*/, this.prepareSlip39(input.createSubAssemblies, input.quorum, rawAssemblyKey)];
|
|
5758
5752
|
case 5:
|
|
5759
|
-
slipAssembly =
|
|
5753
|
+
slipAssembly = _d.sent();
|
|
5760
5754
|
tpIds = this.getInputApprovers(input.createSubAssemblies);
|
|
5761
|
-
|
|
5755
|
+
_c = mapEdges;
|
|
5762
5756
|
return [4 /*yield*/, this.lrGraphQl.query({
|
|
5763
5757
|
query: TpsKeysQuery,
|
|
5764
5758
|
variables: {
|
|
@@ -5766,7 +5760,7 @@
|
|
|
5766
5760
|
},
|
|
5767
5761
|
})];
|
|
5768
5762
|
case 6:
|
|
5769
|
-
tps =
|
|
5763
|
+
tps = _c.apply(void 0, [(_d.sent()).tps]);
|
|
5770
5764
|
// Fill in wrappingKeyId if not present
|
|
5771
5765
|
this.fillWrappingKeyId(input.createSubAssemblies, tps);
|
|
5772
5766
|
return [4 /*yield*/, this.prepareCreateSubAssemblies({
|
|
@@ -5776,10 +5770,13 @@
|
|
|
5776
5770
|
subjectKey: subjectKey,
|
|
5777
5771
|
})];
|
|
5778
5772
|
case 7:
|
|
5779
|
-
createSubAssemblies =
|
|
5773
|
+
createSubAssemblies = _d.sent();
|
|
5774
|
+
return [4 /*yield*/, this.encryptionService.encryptToString(subjectKey, input.subjectCipherDataClearJson || '')];
|
|
5775
|
+
case 8:
|
|
5776
|
+
subjectCipherData = _d.sent();
|
|
5780
5777
|
return [2 /*return*/, {
|
|
5781
5778
|
assemblyKey: assemblyKey,
|
|
5782
|
-
mutationInput: Object.assign(Object.assign({}, assemblyInput), { singleReject: input.singleReject, quorum: input.quorum, subjectCipherData:
|
|
5779
|
+
mutationInput: Object.assign(Object.assign({}, assemblyInput), { singleReject: input.singleReject, quorum: input.quorum, subjectCipherData: subjectCipherData,
|
|
5783
5780
|
createSubAssemblies: createSubAssemblies, rootKeyId: rootKey.id, rootKeyWrappedSubjectKey: rootKeyWrappedSubjectKey }),
|
|
5784
5781
|
}];
|
|
5785
5782
|
}
|
|
@@ -5796,10 +5793,11 @@
|
|
|
5796
5793
|
};
|
|
5797
5794
|
TpAssemblyController.prototype.prepareUpdate = function (input, assembly // TODO type this to only what we need.
|
|
5798
5795
|
) {
|
|
5796
|
+
var _a;
|
|
5799
5797
|
return __awaiter(this, void 0, void 0, function () {
|
|
5800
|
-
var createSubAssembliesInput, updateSubAssembliesInput, deleteSubAssembliesInput, rootKey, subjectKey,
|
|
5801
|
-
return __generator(this, function (
|
|
5802
|
-
switch (
|
|
5798
|
+
var createSubAssembliesInput, updateSubAssembliesInput, deleteSubAssembliesInput, rootKey, subjectKey, _b, assemblyKey, rawAssemblyKey, assemblyKeyParams, assemblyInput, tpIds, tps, _c, slipAssembly, error_1, common, createSubAssemblies, updateSubAssemblies, subjectCipherData;
|
|
5799
|
+
return __generator(this, function (_d) {
|
|
5800
|
+
switch (_d.label) {
|
|
5803
5801
|
case 0:
|
|
5804
5802
|
input = Object.assign({ createSubAssemblies: [] }, input);
|
|
5805
5803
|
createSubAssembliesInput = input.createSubAssemblies || [];
|
|
@@ -5813,18 +5811,18 @@
|
|
|
5813
5811
|
}
|
|
5814
5812
|
return [4 /*yield*/, this.keyService.getCurrentRootKey()];
|
|
5815
5813
|
case 1:
|
|
5816
|
-
rootKey =
|
|
5814
|
+
rootKey = _d.sent();
|
|
5817
5815
|
return [4 /*yield*/, this.keyGraph.getKey(assembly.subjectKey.id)];
|
|
5818
5816
|
case 2:
|
|
5819
|
-
subjectKey =
|
|
5817
|
+
subjectKey = _d.sent();
|
|
5820
5818
|
return [4 /*yield*/, this.prepareAssembly({
|
|
5821
5819
|
rootKey: rootKey.jwk,
|
|
5822
5820
|
subjectKey: subjectKey.jwk,
|
|
5823
5821
|
})];
|
|
5824
5822
|
case 3:
|
|
5825
|
-
|
|
5823
|
+
_b = _d.sent(), assemblyKey = _b.assemblyKey, rawAssemblyKey = _b.rawAssemblyKey, assemblyKeyParams = _b.assemblyKeyParams, assemblyInput = __rest(_b, ["assemblyKey", "rawAssemblyKey", "assemblyKeyParams"]);
|
|
5826
5824
|
tpIds = this.getAssemblyApprovers(assembly).concat(this.getInputApprovers(createSubAssembliesInput), this.getInputApprovers(updateSubAssembliesInput));
|
|
5827
|
-
|
|
5825
|
+
_c = mapEdges;
|
|
5828
5826
|
return [4 /*yield*/, this.lrGraphQl.query({
|
|
5829
5827
|
query: TpsKeysQuery,
|
|
5830
5828
|
variables: {
|
|
@@ -5832,7 +5830,7 @@
|
|
|
5832
5830
|
},
|
|
5833
5831
|
})];
|
|
5834
5832
|
case 4:
|
|
5835
|
-
tps =
|
|
5833
|
+
tps = _c.apply(void 0, [(_d.sent()).tps]);
|
|
5836
5834
|
// Auto fill the updateSubAssemblies with existing sub assemblies if they are not
|
|
5837
5835
|
// explicitly deleted.
|
|
5838
5836
|
mapEdges(assembly.subAssemblies).forEach(function (existing) {
|
|
@@ -5862,15 +5860,15 @@
|
|
|
5862
5860
|
// Fill in wrappingKeyId if not present
|
|
5863
5861
|
this.fillWrappingKeyId(createSubAssembliesInput, tps);
|
|
5864
5862
|
this.fillWrappingKeyId(updateSubAssembliesInput, tps);
|
|
5865
|
-
|
|
5863
|
+
_d.label = 5;
|
|
5866
5864
|
case 5:
|
|
5867
|
-
|
|
5865
|
+
_d.trys.push([5, 7, , 8]);
|
|
5868
5866
|
return [4 /*yield*/, this.prepareSlip39((createSubAssembliesInput || []).concat(updateSubAssembliesInput || []), input.quorum, rawAssemblyKey)];
|
|
5869
5867
|
case 6:
|
|
5870
|
-
slipAssembly =
|
|
5868
|
+
slipAssembly = _d.sent();
|
|
5871
5869
|
return [3 /*break*/, 8];
|
|
5872
5870
|
case 7:
|
|
5873
|
-
error_1 =
|
|
5871
|
+
error_1 = _d.sent();
|
|
5874
5872
|
// TODO this sometimes happens. Maybe missing await.
|
|
5875
5873
|
console.log('Error while creating slip assembly', error_1);
|
|
5876
5874
|
return [3 /*break*/, 8];
|
|
@@ -5883,39 +5881,42 @@
|
|
|
5883
5881
|
// Need to match the slip sub assemblies to the input
|
|
5884
5882
|
slipSubAssemblies: slipAssembly.subAssemblies.slice(0, createSubAssembliesInput.length) }))];
|
|
5885
5883
|
case 9:
|
|
5886
|
-
createSubAssemblies =
|
|
5884
|
+
createSubAssemblies = _d.sent();
|
|
5887
5885
|
return [4 /*yield*/, this.prepareUpdateSubAssemblies(Object.assign(Object.assign({}, common), { input: updateSubAssembliesInput,
|
|
5888
5886
|
// Add an offset to the sub assemblies to skip the one that are created.
|
|
5889
5887
|
slipSubAssemblies: slipAssembly.subAssemblies.slice(createSubAssembliesInput.length), subAssemblies: assembly.subAssemblies }))];
|
|
5890
5888
|
case 10:
|
|
5891
|
-
updateSubAssemblies =
|
|
5889
|
+
updateSubAssemblies = _d.sent();
|
|
5890
|
+
return [4 /*yield*/, this.encryptionService.encryptToString(subjectKey.jwk, (_a = input.subjectCipherDataClearJson) !== null && _a !== void 0 ? _a : assembly.subjectCipherDataClearJson)];
|
|
5891
|
+
case 11:
|
|
5892
|
+
subjectCipherData = _d.sent();
|
|
5892
5893
|
return [2 /*return*/, {
|
|
5893
5894
|
assemblyKey: assemblyKey,
|
|
5894
|
-
mutationInput: Object.assign(Object.assign({}, assemblyInput), { singleReject: input.singleReject, quorum: input.quorum, subjectCipherData:
|
|
5895
|
+
mutationInput: Object.assign(Object.assign({}, assemblyInput), { singleReject: input.singleReject, quorum: input.quorum, subjectCipherData: subjectCipherData, subjectKeyId: subjectKey.id, createSubAssemblies: createSubAssemblies,
|
|
5895
5896
|
updateSubAssemblies: updateSubAssemblies }),
|
|
5896
5897
|
}];
|
|
5897
5898
|
}
|
|
5898
5899
|
});
|
|
5899
5900
|
});
|
|
5900
5901
|
};
|
|
5901
|
-
TpAssemblyController.prototype.prepareApprover = function (
|
|
5902
|
-
var approverId =
|
|
5902
|
+
TpAssemblyController.prototype.prepareApprover = function (_c) {
|
|
5903
|
+
var approverId = _c.approverId, tp = _c.tp, approverIndex = _c.approverIndex, slipSubAssembly = _c.slipSubAssembly, assemblyKeyParams = _c.assemblyKeyParams, subjectKey = _c.subjectKey;
|
|
5903
5904
|
return __awaiter(this, void 0, void 0, function () {
|
|
5904
5905
|
var tpWrappingKey, sharedKey, tpWrappedSharedKey, subjectKeyWrappedSharedKey, share, partialAssemblyKey, sharedCipherData, sharedCipherApprovalData, sharedCipherPartialAssemblyKey;
|
|
5905
|
-
return __generator(this, function (
|
|
5906
|
-
switch (
|
|
5906
|
+
return __generator(this, function (_c) {
|
|
5907
|
+
switch (_c.label) {
|
|
5907
5908
|
case 0: return [4 /*yield*/, this.prepareTpWrappingKey(tp)];
|
|
5908
5909
|
case 1:
|
|
5909
|
-
tpWrappingKey =
|
|
5910
|
+
tpWrappingKey = _c.sent();
|
|
5910
5911
|
return [4 /*yield*/, this.keyFactory.createKey()];
|
|
5911
5912
|
case 2:
|
|
5912
|
-
sharedKey =
|
|
5913
|
+
sharedKey = _c.sent();
|
|
5913
5914
|
return [4 /*yield*/, this.encryptionService.encryptToString(tpWrappingKey.jwk, sharedKey.toJSON(true))];
|
|
5914
5915
|
case 3:
|
|
5915
|
-
tpWrappedSharedKey =
|
|
5916
|
+
tpWrappedSharedKey = _c.sent();
|
|
5916
5917
|
return [4 /*yield*/, this.encryptionService.encryptToString(subjectKey, sharedKey.toJSON(true))];
|
|
5917
5918
|
case 4:
|
|
5918
|
-
subjectKeyWrappedSharedKey =
|
|
5919
|
+
subjectKeyWrappedSharedKey = _c.sent();
|
|
5919
5920
|
share = slipSubAssembly.threshold === 1
|
|
5920
5921
|
? slipSubAssembly.shares[0]
|
|
5921
5922
|
: slipSubAssembly.shares[approverIndex];
|
|
@@ -5932,13 +5933,13 @@
|
|
|
5932
5933
|
console.log('partialAssemblyKey', partialAssemblyKey);
|
|
5933
5934
|
return [4 /*yield*/, this.encryptionService.encryptToString(sharedKey, tp.sharedCipherDataClearJson || '')];
|
|
5934
5935
|
case 5:
|
|
5935
|
-
sharedCipherData =
|
|
5936
|
+
sharedCipherData = _c.sent();
|
|
5936
5937
|
return [4 /*yield*/, this.encryptionService.encryptToString(sharedKey, tp.sharedCipherApprovalDataClearJson || '')];
|
|
5937
5938
|
case 6:
|
|
5938
|
-
sharedCipherApprovalData =
|
|
5939
|
+
sharedCipherApprovalData = _c.sent();
|
|
5939
5940
|
return [4 /*yield*/, this.encryptionService.encryptToString(sharedKey, partialAssemblyKey)];
|
|
5940
5941
|
case 7:
|
|
5941
|
-
sharedCipherPartialAssemblyKey =
|
|
5942
|
+
sharedCipherPartialAssemblyKey = _c.sent();
|
|
5942
5943
|
return [2 /*return*/, {
|
|
5943
5944
|
tpWrappingKeyId: tpWrappingKey.id,
|
|
5944
5945
|
tpWrappedSharedKey: tpWrappedSharedKey,
|
|
@@ -5954,7 +5955,7 @@
|
|
|
5954
5955
|
});
|
|
5955
5956
|
};
|
|
5956
5957
|
TpAssemblyController.prototype.validateApprovers = function (approvers) {
|
|
5957
|
-
var e_1,
|
|
5958
|
+
var e_1, _c;
|
|
5958
5959
|
try {
|
|
5959
5960
|
// Ensure all approvers have mkSharedKey.
|
|
5960
5961
|
for (var approvers_1 = __values(approvers), approvers_1_1 = approvers_1.next(); !approvers_1_1.done; approvers_1_1 = approvers_1.next()) {
|
|
@@ -5969,7 +5970,7 @@
|
|
|
5969
5970
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
5970
5971
|
finally {
|
|
5971
5972
|
try {
|
|
5972
|
-
if (approvers_1_1 && !approvers_1_1.done && (
|
|
5973
|
+
if (approvers_1_1 && !approvers_1_1.done && (_c = approvers_1.return)) _c.call(approvers_1);
|
|
5973
5974
|
}
|
|
5974
5975
|
finally { if (e_1) throw e_1.error; }
|
|
5975
5976
|
}
|
|
@@ -5978,8 +5979,8 @@
|
|
|
5978
5979
|
TpAssemblyController.prototype.prepareSlip39 = function (subAssemblies, assemblyQuorum, rawAssemblyKey) {
|
|
5979
5980
|
return __awaiter(this, void 0, void 0, function () {
|
|
5980
5981
|
var slipAssembly;
|
|
5981
|
-
return __generator(this, function (
|
|
5982
|
-
switch (
|
|
5982
|
+
return __generator(this, function (_c) {
|
|
5983
|
+
switch (_c.label) {
|
|
5983
5984
|
case 0:
|
|
5984
5985
|
// Is there enough sub assemblies to meet quorum
|
|
5985
5986
|
if (subAssemblies.length < assemblyQuorum) {
|
|
@@ -5997,7 +5998,7 @@
|
|
|
5997
5998
|
});
|
|
5998
5999
|
return [4 /*yield*/, this.slip39Service.generateShares(rawAssemblyKey, this.slip39Passphrase, slipAssembly)];
|
|
5999
6000
|
case 1:
|
|
6000
|
-
|
|
6001
|
+
_c.sent();
|
|
6001
6002
|
return [2 /*return*/, slipAssembly];
|
|
6002
6003
|
}
|
|
6003
6004
|
});
|
|
@@ -12079,14 +12080,15 @@
|
|
|
12079
12080
|
var DeleteDirectoryMutation = gqlTyped(templateObject_6$a || (templateObject_6$a = __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"])));
|
|
12080
12081
|
var CreateFileMutation$1 = gqlTyped(templateObject_7$8 || (templateObject_7$8 = __makeTemplateObject(["\nmutation CreateFileMutation($input: CreateFileInput!) {\n createFile(input: $input) {\n file {\n id\n }\n }\n}\n"], ["\nmutation CreateFileMutation($input: CreateFileInput!) {\n createFile(input: $input) {\n file {\n id\n }\n }\n}\n"])));
|
|
12081
12082
|
var UpdateFileMutation = gqlTyped(templateObject_8$7 || (templateObject_8$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"])));
|
|
12082
|
-
var
|
|
12083
|
-
var
|
|
12084
|
-
var
|
|
12085
|
-
var
|
|
12086
|
-
var
|
|
12087
|
-
var
|
|
12088
|
-
var
|
|
12089
|
-
var
|
|
12083
|
+
var RevertFileMutation = gqlTyped(templateObject_9$4 || (templateObject_9$4 = __makeTemplateObject(["\nmutation RevertFileMutation($input: RevertFileInput!) {\n revertFile(input: $input) {\n file {\n id\n }\n }\n}\n"], ["\nmutation RevertFileMutation($input: RevertFileInput!) {\n revertFile(input: $input) {\n file {\n id\n }\n }\n}\n"])));
|
|
12084
|
+
var DeleteFileMutation$1 = gqlTyped(templateObject_10$4 || (templateObject_10$4 = __makeTemplateObject(["\nmutation DeleteFileMutation($input: DeleteFileInput!) {\n deleteFile(input: $input) {\n id\n }\n}\n"], ["\nmutation DeleteFileMutation($input: DeleteFileInput!) {\n deleteFile(input: $input) {\n id\n }\n}\n"])));
|
|
12085
|
+
var ArchiveDirectoryMutation$1 = gqlTyped(templateObject_11$3 || (templateObject_11$3 = __makeTemplateObject(["\nmutation ArchiveDirectoryMutation($input: ArchiveDirectoryInput!) {\n archiveDirectory(input: $input) {\n directory {\n id\n }\n }\n}\n"], ["\nmutation ArchiveDirectoryMutation($input: ArchiveDirectoryInput!) {\n archiveDirectory(input: $input) {\n directory {\n id\n }\n }\n}\n"])));
|
|
12086
|
+
var UnarchiveDirectoryMutation$1 = gqlTyped(templateObject_12$2 || (templateObject_12$2 = __makeTemplateObject(["\nmutation UnarchiveDirectoryMutation($input: UnarchiveDirectoryInput!) {\n unarchiveDirectory(input: $input) {\n directory {\n id\n }\n }\n}\n"], ["\nmutation UnarchiveDirectoryMutation($input: UnarchiveDirectoryInput!) {\n unarchiveDirectory(input: $input) {\n directory {\n id\n }\n }\n}\n"])));
|
|
12087
|
+
var ChangeDirectoryParentsMutation = gqlTyped(templateObject_13$2 || (templateObject_13$2 = __makeTemplateObject(["\nmutation ChangeDirectoryParentsMutation($input: ChangeDirectoryParentsInput!) {\n changeDirectoryParents(input: $input) {\n directory {\n id\n }\n }\n}\n"], ["\nmutation ChangeDirectoryParentsMutation($input: ChangeDirectoryParentsInput!) {\n changeDirectoryParents(input: $input) {\n directory {\n id\n }\n }\n}\n"])));
|
|
12088
|
+
var ChangeFileParentsMutation = gqlTyped(templateObject_14$1 || (templateObject_14$1 = __makeTemplateObject(["\nmutation ChangeFileParentsMutation($input: ChangeFileParentsInput!) {\n changeFileParents(input: $input) {\n file {\n id\n }\n }\n}\n"], ["\nmutation ChangeFileParentsMutation($input: ChangeFileParentsInput!) {\n changeFileParents(input: $input) {\n file {\n id\n }\n }\n}\n"])));
|
|
12089
|
+
var BeginDeleteChildItemLinksWindowMutation = gqlTyped(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\nmutation BeginDeleteChildItemLinksWindowMutation($input: BeginDeleteChildItemLinksWindowInput!) {\n beginDeleteChildItemLinksWindow(input: $input) {\n begin\n end\n scheduled\n windowMs\n directory {\n id\n }\n }\n}\n"], ["\nmutation BeginDeleteChildItemLinksWindowMutation($input: BeginDeleteChildItemLinksWindowInput!) {\n beginDeleteChildItemLinksWindow(input: $input) {\n begin\n end\n scheduled\n windowMs\n directory {\n id\n }\n }\n}\n"])));
|
|
12090
|
+
var TempDirectoryQuery = gqlTyped(templateObject_16 || (templateObject_16 = __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"])));
|
|
12091
|
+
var templateObject_1$m, templateObject_2$i, templateObject_3$g, templateObject_4$f, templateObject_5$c, templateObject_6$a, templateObject_7$8, templateObject_8$7, templateObject_9$4, templateObject_10$4, templateObject_11$3, templateObject_12$2, templateObject_13$2, templateObject_14$1, templateObject_15, templateObject_16;
|
|
12090
12092
|
|
|
12091
12093
|
var Item2Service_1;
|
|
12092
12094
|
exports.Item2Service = Item2Service_1 = /** @class */ (function (_super) {
|
|
@@ -12283,6 +12285,24 @@
|
|
|
12283
12285
|
});
|
|
12284
12286
|
});
|
|
12285
12287
|
};
|
|
12288
|
+
Item2Service.prototype.revertFileExec = function (options) {
|
|
12289
|
+
return this.mutate(this.revertFileMutation(options));
|
|
12290
|
+
};
|
|
12291
|
+
Item2Service.prototype.revertFile = function (options) {
|
|
12292
|
+
return this.revertFileMutation(options);
|
|
12293
|
+
};
|
|
12294
|
+
Item2Service.prototype.revertFileMutation = function (options) {
|
|
12295
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
12296
|
+
return __generator(this, function (_c) {
|
|
12297
|
+
return [2 /*return*/, new LrMutation({
|
|
12298
|
+
mutation: RevertFileMutation,
|
|
12299
|
+
variables: {
|
|
12300
|
+
input: options,
|
|
12301
|
+
},
|
|
12302
|
+
})];
|
|
12303
|
+
});
|
|
12304
|
+
});
|
|
12305
|
+
};
|
|
12286
12306
|
Item2Service.prototype.deleteFileExec = function (id) {
|
|
12287
12307
|
return this.mutate(this.deleteFileMutation(id));
|
|
12288
12308
|
};
|
|
@@ -13745,7 +13765,6 @@
|
|
|
13745
13765
|
});
|
|
13746
13766
|
});
|
|
13747
13767
|
};
|
|
13748
|
-
// TODO auto add the missing existing receivers and directories
|
|
13749
13768
|
ScenarioService.prototype.updateScenarioMutation = function (options) {
|
|
13750
13769
|
return __awaiter(this, void 0, void 0, function () {
|
|
13751
13770
|
var scenario, input;
|