@eluvio/elv-client-js 4.2.22 → 4.2.24
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/dist/ElvClient-min.js +1 -1
- package/dist/ElvClient-node-min.js +1 -1
- package/dist/ElvFrameClient-min.js +1 -1
- package/dist/ElvPermissionsClient-min.js +1 -1
- package/dist/ElvWalletClient-min.js +1 -1
- package/dist/ElvWalletClient-node-min.js +1 -1
- package/dist/src/Crypto.js +33 -5
- package/dist/src/ElvClient.js +4 -17
- package/dist/src/FrameClient.js +1 -1
- package/dist/src/client/ContentAccess.js +75 -101
- package/dist/src/client/ContentManagement.js +43 -69
- package/dist/src/client/Contracts.js +2 -2
- package/dist/src/client/LiveStream.js +938 -542
- package/package.json +1 -1
- package/src/Crypto.js +13 -1
- package/src/ElvClient.js +1 -3
- package/src/FrameClient.js +2 -0
- package/src/client/ContentAccess.js +2 -6
- package/src/client/ContentManagement.js +2 -6
- package/src/client/Contracts.js +1 -1
- package/src/client/LiveStream.js +337 -92
- package/utilities/LiveOutputs.js +9 -4
package/dist/src/Crypto.js
CHANGED
|
@@ -117,15 +117,43 @@ var Crypto = {
|
|
|
117
117
|
}, _callee2);
|
|
118
118
|
}))();
|
|
119
119
|
},
|
|
120
|
-
|
|
120
|
+
// accepts either a raw private key string (legacy usage) or a signer
|
|
121
|
+
DecryptCap: function DecryptCap(encryptedCap, signerOrPrivateKey) {
|
|
121
122
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
122
|
-
var elvCrypto, ephemeralKey, tag, data, cap;
|
|
123
|
+
var privateKey, elvCrypto, ephemeralKey, tag, data, cap;
|
|
123
124
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
124
125
|
while (1) switch (_context3.prev = _context3.next) {
|
|
125
126
|
case 0:
|
|
126
|
-
|
|
127
|
+
if (!(typeof signerOrPrivateKey === "string")) {
|
|
128
|
+
_context3.next = 4;
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
privateKey = signerOrPrivateKey;
|
|
132
|
+
_context3.next = 15;
|
|
133
|
+
break;
|
|
134
|
+
case 4:
|
|
135
|
+
if (!(signerOrPrivateKey && signerOrPrivateKey.remoteSigner)) {
|
|
136
|
+
_context3.next = 10;
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
_context3.next = 7;
|
|
140
|
+
return signerOrPrivateKey.DecryptCap(encryptedCap);
|
|
141
|
+
case 7:
|
|
142
|
+
return _context3.abrupt("return", _context3.sent);
|
|
143
|
+
case 10:
|
|
144
|
+
if (!(signerOrPrivateKey && typeof signerOrPrivateKey._signingKey === "function")) {
|
|
145
|
+
_context3.next = 14;
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
privateKey = signerOrPrivateKey._signingKey().privateKey;
|
|
149
|
+
_context3.next = 15;
|
|
150
|
+
break;
|
|
151
|
+
case 14:
|
|
152
|
+
throw Error("Crypto.DecryptCap: second argument must be a signer or a private key string");
|
|
153
|
+
case 15:
|
|
154
|
+
_context3.next = 17;
|
|
127
155
|
return Crypto.ElvCrypto();
|
|
128
|
-
case
|
|
156
|
+
case 17:
|
|
129
157
|
elvCrypto = _context3.sent;
|
|
130
158
|
privateKey = new Uint8Array(Buffer.from(privateKey.replace("0x", ""), "hex"));
|
|
131
159
|
encryptedCap = Buffer.from(encryptedCap, "base64");
|
|
@@ -134,7 +162,7 @@ var Crypto = {
|
|
|
134
162
|
data = encryptedCap.slice(81);
|
|
135
163
|
cap = elvCrypto.decryptECIES(new Uint8Array(data), privateKey, new Uint8Array(ephemeralKey), new Uint8Array(tag));
|
|
136
164
|
return _context3.abrupt("return", JSON.parse(Buffer.from(cap).toString()));
|
|
137
|
-
case
|
|
165
|
+
case 25:
|
|
138
166
|
case "end":
|
|
139
167
|
return _context3.stop();
|
|
140
168
|
}
|
package/dist/src/ElvClient.js
CHANGED
|
@@ -1724,24 +1724,11 @@ var ElvClient = /*#__PURE__*/function () {
|
|
|
1724
1724
|
throw "Signer not set";
|
|
1725
1725
|
case 3:
|
|
1726
1726
|
ValidatePresence("message", message);
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
_context23.next = 7;
|
|
1732
|
-
return this.signer.DecryptCap(message);
|
|
1727
|
+
_context23.next = 6;
|
|
1728
|
+
return this.Crypto.DecryptCap(message, this.signer);
|
|
1729
|
+
case 6:
|
|
1730
|
+
return _context23.abrupt("return", _context23.sent);
|
|
1733
1731
|
case 7:
|
|
1734
|
-
_context23.t0 = _context23.sent;
|
|
1735
|
-
_context23.next = 13;
|
|
1736
|
-
break;
|
|
1737
|
-
case 10:
|
|
1738
|
-
_context23.next = 12;
|
|
1739
|
-
return this.Crypto.DecryptCap(message, this.signer._signingKey().privateKey);
|
|
1740
|
-
case 12:
|
|
1741
|
-
_context23.t0 = _context23.sent;
|
|
1742
|
-
case 13:
|
|
1743
|
-
return _context23.abrupt("return", _context23.t0);
|
|
1744
|
-
case 14:
|
|
1745
1732
|
case "end":
|
|
1746
1733
|
return _context23.stop();
|
|
1747
1734
|
}
|
package/dist/src/FrameClient.js
CHANGED
|
@@ -449,7 +449,7 @@ var FrameClient = /*#__PURE__*/function () {
|
|
|
449
449
|
}, {
|
|
450
450
|
key: "AllowedMethods",
|
|
451
451
|
value: function AllowedMethods() {
|
|
452
|
-
return ["AccessGroupManagers", "AccessGroupMembers", "AccessGroupOwner", "AccessInfo", "AccessRequest", "AccessType", "AddAccessGroupManager", "AddAccessGroupMember", "AddContentLibraryGroup", "AddContentObjectGroupPermission", "AddLibraryContentType", "AssetMetadata", "AuditContentObject", "AuditStream", "AvailableDRMs", "AvailableOfferings", "AwaitPending", "BitmovinPlayoutOptions", "BlockNumber", "CallBitcodeMethod", "CallContractMethod", "CallContractMethodAndWait", "ClearCache", "ClearStaticToken", "Collection", "CollectionTransactions", "ConfigUrl", "ContentLibraries", "ContentLibrary", "ContentLibraryGroupPermissions", "ContentLibraryOwner", "ContentObject", "ContentObjectAccessComplete", "ContentObjectGraph", "ContentObjectGroupPermissions", "ContentObjectImageUrl", "ContentObjectLibraryId", "ContentObjectMetadata", "ContentObjectOwner", "ContentObjectTenantId", "ContentObjectVersions", "ContentObjects", "ContentPart", "ContentParts", "ContentSpaceId", "ContentType", "ContentTypeOwner", "ContentTypes", "ContractAbi", "ContractEvents", "ContractInfo", "ContractMetadata", "ContractName", "CopyContentObject", "CreateABRMezzanine", "CreateAccessGroup", "CreateAndFinalizeContentObject", "CreateAuthorizationToken", "CreateContentLibrary", "CreateContentObject", "CreateContentType", "CreateEncryptionConk", "CreateFabricToken", "CreateFileDirectories", "CreateFileUploadJob", "CreateLinks", "CreateNTPInstance", "CreateNonOwnerCap", "CreatePart", "CreateProductionMaster", "CreateShare", "CreateSignedMessageJSON", "CreateSignedToken", "CreateStaticToken", "CurrentAccountAddress", "CustomContractAddress", "DecodeSignedMessageJSON", "Decrypt", "DecryptECIES", "DefaultKMSAddress", "DeleteAccessGroup", "DeleteContentLibrary", "DeleteContentObject", "DeleteContentVersion", "DeleteFiles", "DeleteMetadata", "DeleteNTPInstance", "DeletePart", "DeleteWriteToken", "DeployContract", "Download", "DownloadEncrypted", "DownloadFile", "DownloadPart", "EditAndFinalizeContentObject", "EditContentObject", "EmbedUrl", "Encrypt", "EncryptECIES", "EncryptionConk", "Events", "ExtractEventFromLogs", "ExtractValueFromEvent", "FabricUrl", "FileUrl", "FinalizeABRMezzanine", "FinalizeContentObject", "FinalizePart", "FinalizeStateChannelAccess", "FinalizeUploadJob", "FormatContractArguments", "GenerateStateChannelToken", "GenerateSignedLinkToken", "GetBalance", "GlobalUrl", "InitializeAuthPolicy", "IssueNTPCode", "IssueSignedNTPCode", "LatestVersionHash", "LibraryContentTypes", "LinkAccessGroupToOauth", "LinkData", "LinkTarget", "LinkUrl", "ListAccessGroups", "ListFiles", "ListNTPInstances", "LRODraftInfo", "LROStatus", "MakeAuthServiceRequest", "MakeFileServiceRequest", "MergeContractMetadata", "MergeMetadata", "MetadataAuth", "MintNFT", "MoveFiles", "NetworkInfo", "NodeId", "Nodes", "NTPInstance", "ObjectCleanup", "OutputsCreate", "OutputsDelete", "OutputsList", "OutputsListItem", "OutputsModify", "OutputsModifyBatch", "OutputsResolveSrtPullUrls", "OutputsState", "OutputsStop", "Permission", "PlayoutOptions", "PlayoutPathResolution", "ProduceMetadataLinks", "Proofs", "PublicRep", "PublishContentVersion", "QParts", "RecordWriteToken", "RedeemCode", "RedeemShareToken", "RemoveAccessGroupManager", "RemoveAccessGroupMember", "RemoveContentObjectGroupPermission", "RemoveContentLibraryGroup", "RemoveLibraryContentType", "Rep", "ReplaceContractMetadata", "ReplaceMetadata", "Request", "ResetRegion", "ResetTenantId", "RevokeShare", "SendFunds", "SetAccessCharge", "StreamApplyProfile", "SetAuth", "SetAuthContext", "SetAuthPolicy", "SetContentLibraryImage", "SetContentObjectImage", "SetCustomContentContract", "SetGroupPermission", "SetNodes", "SetOauthToken", "SetPolicyAuthorization", "SetSignerFromOauthToken", "SetStaticToken", "SetTenantContractId", "SetTenantId", "TenantAdminGroup", "ContentAdminGroup", "TenantUsersGroup", "SetVisibility", "SetPermission", "ShareInfo", "Shares", "SpaceNodes", "StartABRMezzanineJobs", "StreamAddWatermark", "StreamApplyProfile", "StreamAssignProfile", "StreamConfig", "StreamConfigProfile", "StreamConfigProfiles", "StreamCopyToVod", "StreamCreate", "StreamInitialize", "StreamInsertion", "StreamLinkToSite", "StreamListUrls", "StreamRemoveLinkToSite", "StreamRemoveWatermark", "StreamSaveConfigProfile", "StreamSetOfferingAndDRM", "StreamSiteSettings", "StreamStartRecording", "StreamStartOrStopOrReset", "StreamStatus", "StreamStopRecording", "StreamUnassignProfile", "StreamUpdateConfig", "SuspendNTPInstance", "TenantContractId", "TenantId", "UnlinkAccessGroupFromOauth", "UpdateContentObjectGraph", "UpdateNTPInstance", "UpdateShare", "UploadFileData", "UploadFilesFromS3", "UploadJobStatus", "UploadPart", "UploadPartChunk", "UploadStatus", "UseRegion", "Visibility", "WriteTokenNodeUrlLocal", "WriteTokenNodeUrlNetwork"];
|
|
452
|
+
return ["AccessGroupManagers", "AccessGroupMembers", "AccessGroupOwner", "AccessInfo", "AccessRequest", "AccessType", "AddAccessGroupManager", "AddAccessGroupMember", "AddContentLibraryGroup", "AddContentObjectGroupPermission", "AddLibraryContentType", "AssetMetadata", "AuditContentObject", "AuditStream", "AvailableDRMs", "AvailableOfferings", "AwaitPending", "BitmovinPlayoutOptions", "BlockNumber", "CallBitcodeMethod", "CallContractMethod", "CallContractMethodAndWait", "ClearCache", "ClearStaticToken", "Collection", "CollectionTransactions", "ConfigUrl", "ContentLibraries", "ContentLibrary", "ContentLibraryGroupPermissions", "ContentLibraryOwner", "ContentObject", "ContentObjectAccessComplete", "ContentObjectGraph", "ContentObjectGroupPermissions", "ContentObjectImageUrl", "ContentObjectLibraryId", "ContentObjectMetadata", "ContentObjectOwner", "ContentObjectTenantId", "ContentObjectVersions", "ContentObjects", "ContentPart", "ContentParts", "ContentSpaceId", "ContentType", "ContentTypeOwner", "ContentTypes", "ContractAbi", "ContractEvents", "ContractInfo", "ContractMetadata", "ContractName", "CopyContentObject", "CreateABRMezzanine", "CreateAccessGroup", "CreateAndFinalizeContentObject", "CreateAuthorizationToken", "CreateContentLibrary", "CreateContentObject", "CreateContentType", "CreateEncryptionConk", "CreateFabricToken", "CreateFileDirectories", "CreateFileUploadJob", "CreateLinks", "CreateNTPInstance", "CreateNonOwnerCap", "CreatePart", "CreateProductionMaster", "CreateShare", "CreateSignedMessageJSON", "CreateSignedToken", "CreateStaticToken", "CurrentAccountAddress", "CustomContractAddress", "DecodeSignedMessageJSON", "Decrypt", "DecryptECIES", "DefaultKMSAddress", "DeleteAccessGroup", "DeleteContentLibrary", "DeleteContentObject", "DeleteContentVersion", "DeleteFiles", "DeleteMetadata", "DeleteNTPInstance", "DeletePart", "DeleteWriteToken", "DeployContract", "Download", "DownloadEncrypted", "DownloadFile", "DownloadPart", "EditAndFinalizeContentObject", "EditContentObject", "EmbedUrl", "Encrypt", "EncryptECIES", "EncryptionConk", "Events", "ExtractEventFromLogs", "ExtractValueFromEvent", "FabricUrl", "FileUrl", "FinalizeABRMezzanine", "FinalizeContentObject", "FinalizePart", "FinalizeStateChannelAccess", "FinalizeUploadJob", "FormatContractArguments", "GenerateStateChannelToken", "GenerateSignedLinkToken", "GetBalance", "GlobalUrl", "InitializeAuthPolicy", "IssueNTPCode", "IssueSignedNTPCode", "LatestVersionHash", "LibraryContentTypes", "LinkAccessGroupToOauth", "LinkData", "LinkTarget", "LinkUrl", "ListAccessGroups", "ListFiles", "ListNTPInstances", "LRODraftInfo", "LROStatus", "MakeAuthServiceRequest", "MakeFileServiceRequest", "MergeContractMetadata", "MergeMetadata", "MetadataAuth", "MintNFT", "MoveFiles", "NetworkInfo", "NodeId", "Nodes", "NTPInstance", "ObjectCleanup", "OutputsCreate", "OutputsDelete", "OutputsDeleteBatch", "OutputsList", "OutputsListItem", "OutputsModify", "OutputsModifyBatch", "OutputsReset", "OutputsResolveSrtPullUrls", "OutputsState", "OutputsStop", "Permission", "PlayoutOptions", "PlayoutPathResolution", "ProduceMetadataLinks", "Proofs", "PublicRep", "PublishContentVersion", "QParts", "RecordWriteToken", "RedeemCode", "RedeemShareToken", "RemoveAccessGroupManager", "RemoveAccessGroupMember", "RemoveContentObjectGroupPermission", "RemoveContentLibraryGroup", "RemoveLibraryContentType", "Rep", "ReplaceContractMetadata", "ReplaceMetadata", "Request", "ResetRegion", "ResetTenantId", "RevokeShare", "SendFunds", "SetAccessCharge", "StreamApplyProfile", "SetAuth", "SetAuthContext", "SetAuthPolicy", "SetContentLibraryImage", "SetContentObjectImage", "SetCustomContentContract", "SetGroupPermission", "SetNodes", "SetOauthToken", "SetPolicyAuthorization", "SetSignerFromOauthToken", "SetStaticToken", "SetTenantContractId", "SetTenantId", "TenantAdminGroup", "ContentAdminGroup", "TenantUsersGroup", "SetVisibility", "SetPermission", "ShareInfo", "Shares", "SpaceNodes", "StartABRMezzanineJobs", "StreamAddWatermark", "StreamApplyProfile", "StreamAssignProfile", "StreamConfig", "StreamConfigProfile", "StreamConfigProfiles", "StreamCopyToVod", "StreamCreate", "StreamInitialize", "StreamInsertion", "StreamLinkToSite", "StreamListUrls", "StreamRemoveLinkToSite", "StreamRemoveWatermark", "StreamSaveConfigProfile", "StreamSetOfferingAndDRM", "StreamSiteSettings", "StreamStartRecording", "StreamStartOrStopOrReset", "StreamStatus", "StreamStopRecording", "StreamUnassignProfile", "StreamUpdateConfig", "SuspendNTPInstance", "TenantContractId", "TenantId", "UnlinkAccessGroupFromOauth", "UpdateContentObjectGraph", "UpdateNTPInstance", "UpdateShare", "UploadFileData", "UploadFilesFromS3", "UploadJobStatus", "UploadPart", "UploadPartChunk", "UploadStatus", "UseRegion", "Visibility", "WriteTokenNodeUrlLocal", "WriteTokenNodeUrlNetwork"];
|
|
453
453
|
}
|
|
454
454
|
}, {
|
|
455
455
|
key: "AllowedUserProfileMethods",
|
|
@@ -4198,74 +4198,61 @@ exports.CreateEncryptionConk = /*#__PURE__*/function () {
|
|
|
4198
4198
|
case 14:
|
|
4199
4199
|
existingUserCap = _context47.sent;
|
|
4200
4200
|
if (!existingUserCap) {
|
|
4201
|
-
_context47.next =
|
|
4201
|
+
_context47.next = 21;
|
|
4202
4202
|
break;
|
|
4203
4203
|
}
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
_context47.next =
|
|
4209
|
-
return this.signer.DecryptCap(existingUserCap);
|
|
4210
|
-
case 19:
|
|
4211
|
-
_context47.t0 = _context47.sent;
|
|
4212
|
-
_context47.next = 25;
|
|
4213
|
-
break;
|
|
4214
|
-
case 22:
|
|
4215
|
-
_context47.next = 24;
|
|
4216
|
-
return this.Crypto.DecryptCap(existingUserCap, this.signer._signingKey().privateKey);
|
|
4217
|
-
case 24:
|
|
4218
|
-
_context47.t0 = _context47.sent;
|
|
4219
|
-
case 25:
|
|
4220
|
-
this.encryptionConks[objectId] = _context47.t0;
|
|
4221
|
-
_context47.next = 42;
|
|
4204
|
+
_context47.next = 18;
|
|
4205
|
+
return this.Crypto.DecryptCap(existingUserCap, this.signer);
|
|
4206
|
+
case 18:
|
|
4207
|
+
this.encryptionConks[objectId] = _context47.sent;
|
|
4208
|
+
_context47.next = 35;
|
|
4222
4209
|
break;
|
|
4223
|
-
case
|
|
4224
|
-
_context47.next =
|
|
4210
|
+
case 21:
|
|
4211
|
+
_context47.next = 23;
|
|
4225
4212
|
return this.Crypto.GeneratePrimaryConk({
|
|
4226
4213
|
spaceId: this.contentSpaceId,
|
|
4227
4214
|
objectId: objectId
|
|
4228
4215
|
});
|
|
4229
|
-
case
|
|
4216
|
+
case 23:
|
|
4230
4217
|
this.encryptionConks[objectId] = _context47.sent;
|
|
4231
|
-
_context47.
|
|
4232
|
-
_context47.
|
|
4233
|
-
_context47.
|
|
4234
|
-
_context47.
|
|
4235
|
-
_context47.
|
|
4236
|
-
_context47.next =
|
|
4218
|
+
_context47.t0 = this;
|
|
4219
|
+
_context47.t1 = libraryId;
|
|
4220
|
+
_context47.t2 = objectId;
|
|
4221
|
+
_context47.t3 = writeToken;
|
|
4222
|
+
_context47.t4 = capKey;
|
|
4223
|
+
_context47.next = 31;
|
|
4237
4224
|
return this.Crypto.EncryptConk(this.encryptionConks[objectId], this.signer._signingKey().publicKey);
|
|
4238
|
-
case
|
|
4239
|
-
_context47.
|
|
4240
|
-
_context47.
|
|
4241
|
-
libraryId: _context47.
|
|
4242
|
-
objectId: _context47.
|
|
4243
|
-
writeToken: _context47.
|
|
4244
|
-
metadataSubtree: _context47.
|
|
4245
|
-
metadata: _context47.
|
|
4225
|
+
case 31:
|
|
4226
|
+
_context47.t5 = _context47.sent;
|
|
4227
|
+
_context47.t6 = {
|
|
4228
|
+
libraryId: _context47.t1,
|
|
4229
|
+
objectId: _context47.t2,
|
|
4230
|
+
writeToken: _context47.t3,
|
|
4231
|
+
metadataSubtree: _context47.t4,
|
|
4232
|
+
metadata: _context47.t5
|
|
4246
4233
|
};
|
|
4247
|
-
_context47.next =
|
|
4248
|
-
return _context47.
|
|
4249
|
-
case
|
|
4234
|
+
_context47.next = 35;
|
|
4235
|
+
return _context47.t0.ReplaceMetadata.call(_context47.t0, _context47.t6);
|
|
4236
|
+
case 35:
|
|
4250
4237
|
if (!createKMSConk) {
|
|
4251
|
-
_context47.next =
|
|
4238
|
+
_context47.next = 65;
|
|
4252
4239
|
break;
|
|
4253
4240
|
}
|
|
4254
|
-
_context47.prev =
|
|
4255
|
-
_context47.next =
|
|
4241
|
+
_context47.prev = 36;
|
|
4242
|
+
_context47.next = 39;
|
|
4256
4243
|
return this.authClient.KMSAddress({
|
|
4257
4244
|
objectId: objectId
|
|
4258
4245
|
});
|
|
4259
|
-
case
|
|
4246
|
+
case 39:
|
|
4260
4247
|
kmsAddress = _context47.sent;
|
|
4261
|
-
_context47.next =
|
|
4248
|
+
_context47.next = 42;
|
|
4262
4249
|
return this.authClient.KMSInfo({
|
|
4263
4250
|
objectId: objectId
|
|
4264
4251
|
});
|
|
4265
|
-
case
|
|
4252
|
+
case 42:
|
|
4266
4253
|
kmsPublicKey = _context47.sent.publicKey;
|
|
4267
4254
|
kmsCapKey = "eluv.caps.ikms".concat(this.utils.AddressToHash(kmsAddress));
|
|
4268
|
-
_context47.next =
|
|
4255
|
+
_context47.next = 46;
|
|
4269
4256
|
return this.ContentObjectMetadata({
|
|
4270
4257
|
libraryId: libraryId,
|
|
4271
4258
|
// Cap may only exist in draft
|
|
@@ -4273,47 +4260,47 @@ exports.CreateEncryptionConk = /*#__PURE__*/function () {
|
|
|
4273
4260
|
writeToken: writeToken,
|
|
4274
4261
|
metadataSubtree: kmsCapKey
|
|
4275
4262
|
});
|
|
4276
|
-
case
|
|
4263
|
+
case 46:
|
|
4277
4264
|
existingKMSCap = _context47.sent;
|
|
4278
4265
|
if (existingKMSCap) {
|
|
4279
|
-
_context47.next =
|
|
4266
|
+
_context47.next = 59;
|
|
4280
4267
|
break;
|
|
4281
4268
|
}
|
|
4282
|
-
_context47.
|
|
4283
|
-
_context47.
|
|
4284
|
-
_context47.
|
|
4285
|
-
_context47.
|
|
4286
|
-
_context47.
|
|
4287
|
-
_context47.next =
|
|
4269
|
+
_context47.t7 = this;
|
|
4270
|
+
_context47.t8 = libraryId;
|
|
4271
|
+
_context47.t9 = objectId;
|
|
4272
|
+
_context47.t10 = writeToken;
|
|
4273
|
+
_context47.t11 = kmsCapKey;
|
|
4274
|
+
_context47.next = 55;
|
|
4288
4275
|
return this.Crypto.EncryptConk(this.encryptionConks[objectId], kmsPublicKey);
|
|
4289
|
-
case
|
|
4290
|
-
_context47.
|
|
4291
|
-
_context47.
|
|
4292
|
-
libraryId: _context47.
|
|
4293
|
-
objectId: _context47.
|
|
4294
|
-
writeToken: _context47.
|
|
4295
|
-
metadataSubtree: _context47.
|
|
4296
|
-
metadata: _context47.
|
|
4276
|
+
case 55:
|
|
4277
|
+
_context47.t12 = _context47.sent;
|
|
4278
|
+
_context47.t13 = {
|
|
4279
|
+
libraryId: _context47.t8,
|
|
4280
|
+
objectId: _context47.t9,
|
|
4281
|
+
writeToken: _context47.t10,
|
|
4282
|
+
metadataSubtree: _context47.t11,
|
|
4283
|
+
metadata: _context47.t12
|
|
4297
4284
|
};
|
|
4298
|
-
_context47.next =
|
|
4299
|
-
return _context47.
|
|
4300
|
-
case
|
|
4301
|
-
_context47.next =
|
|
4285
|
+
_context47.next = 59;
|
|
4286
|
+
return _context47.t7.ReplaceMetadata.call(_context47.t7, _context47.t13);
|
|
4287
|
+
case 59:
|
|
4288
|
+
_context47.next = 65;
|
|
4302
4289
|
break;
|
|
4303
|
-
case
|
|
4304
|
-
_context47.prev =
|
|
4305
|
-
_context47.
|
|
4290
|
+
case 61:
|
|
4291
|
+
_context47.prev = 61;
|
|
4292
|
+
_context47.t14 = _context47["catch"](36);
|
|
4306
4293
|
// eslint-disable-next-line no-console
|
|
4307
4294
|
console.error("Failed to create encryption cap for KMS:");
|
|
4308
4295
|
// eslint-disable-next-line no-console
|
|
4309
|
-
console.error(_context47.
|
|
4310
|
-
case
|
|
4296
|
+
console.error(_context47.t14);
|
|
4297
|
+
case 65:
|
|
4311
4298
|
return _context47.abrupt("return", this.encryptionConks[objectId]);
|
|
4312
|
-
case
|
|
4299
|
+
case 66:
|
|
4313
4300
|
case "end":
|
|
4314
4301
|
return _context47.stop();
|
|
4315
4302
|
}
|
|
4316
|
-
}, _callee47, this, [[
|
|
4303
|
+
}, _callee47, this, [[36, 61]]);
|
|
4317
4304
|
}));
|
|
4318
4305
|
return function (_x43) {
|
|
4319
4306
|
return _ref86.apply(this, arguments);
|
|
@@ -4399,7 +4386,7 @@ exports.EncryptionConk = /*#__PURE__*/function () {
|
|
|
4399
4386
|
return _context48.abrupt("return", _context48.sent);
|
|
4400
4387
|
case 21:
|
|
4401
4388
|
if (this.encryptionConks[objectId]) {
|
|
4402
|
-
_context48.next =
|
|
4389
|
+
_context48.next = 38;
|
|
4403
4390
|
break;
|
|
4404
4391
|
}
|
|
4405
4392
|
capKey = "eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address));
|
|
@@ -4415,34 +4402,21 @@ exports.EncryptionConk = /*#__PURE__*/function () {
|
|
|
4415
4402
|
case 25:
|
|
4416
4403
|
existingUserCap = _context48.sent;
|
|
4417
4404
|
if (!existingUserCap) {
|
|
4418
|
-
_context48.next =
|
|
4419
|
-
break;
|
|
4420
|
-
}
|
|
4421
|
-
if (!this.signer.remoteSigner) {
|
|
4422
|
-
_context48.next = 33;
|
|
4405
|
+
_context48.next = 32;
|
|
4423
4406
|
break;
|
|
4424
4407
|
}
|
|
4425
|
-
_context48.next =
|
|
4426
|
-
return this.
|
|
4427
|
-
case
|
|
4428
|
-
|
|
4429
|
-
_context48.next =
|
|
4430
|
-
break;
|
|
4431
|
-
case 33:
|
|
4432
|
-
_context48.next = 35;
|
|
4433
|
-
return this.Crypto.DecryptCap(existingUserCap, this.signer._signingKey().privateKey);
|
|
4434
|
-
case 35:
|
|
4435
|
-
_context48.t0 = _context48.sent;
|
|
4436
|
-
case 36:
|
|
4437
|
-
this.encryptionConks[objectId] = _context48.t0;
|
|
4438
|
-
_context48.next = 45;
|
|
4408
|
+
_context48.next = 29;
|
|
4409
|
+
return this.Crypto.DecryptCap(existingUserCap, this.signer);
|
|
4410
|
+
case 29:
|
|
4411
|
+
this.encryptionConks[objectId] = _context48.sent;
|
|
4412
|
+
_context48.next = 38;
|
|
4439
4413
|
break;
|
|
4440
|
-
case
|
|
4414
|
+
case 32:
|
|
4441
4415
|
if (!writeToken) {
|
|
4442
|
-
_context48.next =
|
|
4416
|
+
_context48.next = 37;
|
|
4443
4417
|
break;
|
|
4444
4418
|
}
|
|
4445
|
-
_context48.next =
|
|
4419
|
+
_context48.next = 35;
|
|
4446
4420
|
return this.CreateEncryptionConk({
|
|
4447
4421
|
libraryId: libraryId,
|
|
4448
4422
|
objectId: objectId,
|
|
@@ -4450,14 +4424,14 @@ exports.EncryptionConk = /*#__PURE__*/function () {
|
|
|
4450
4424
|
writeToken: writeToken,
|
|
4451
4425
|
createKMSConk: false
|
|
4452
4426
|
});
|
|
4453
|
-
case
|
|
4454
|
-
_context48.next =
|
|
4427
|
+
case 35:
|
|
4428
|
+
_context48.next = 38;
|
|
4455
4429
|
break;
|
|
4456
|
-
case
|
|
4430
|
+
case 37:
|
|
4457
4431
|
throw "No encryption conk present for " + objectId;
|
|
4458
|
-
case
|
|
4432
|
+
case 38:
|
|
4459
4433
|
return _context48.abrupt("return", this.encryptionConks[objectId]);
|
|
4460
|
-
case
|
|
4434
|
+
case 39:
|
|
4461
4435
|
case "end":
|
|
4462
4436
|
return _context48.stop();
|
|
4463
4437
|
}
|
|
@@ -1064,47 +1064,34 @@ exports.CopyContentObject = /*#__PURE__*/function () {
|
|
|
1064
1064
|
// User CAP
|
|
1065
1065
|
userCapKey = "eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address));
|
|
1066
1066
|
if (!metadata[userCapKey]) {
|
|
1067
|
-
_context13.next =
|
|
1067
|
+
_context13.next = 33;
|
|
1068
1068
|
break;
|
|
1069
1069
|
}
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
_context13.next = 21;
|
|
1075
|
-
return this.signer.DecryptCap(metadata[userCapKey]);
|
|
1076
|
-
case 21:
|
|
1077
|
-
_context13.t0 = _context13.sent;
|
|
1078
|
-
_context13.next = 27;
|
|
1079
|
-
break;
|
|
1080
|
-
case 24:
|
|
1081
|
-
_context13.next = 26;
|
|
1082
|
-
return this.Crypto.DecryptCap(metadata[userCapKey], this.signer._signingKey().privateKey);
|
|
1083
|
-
case 26:
|
|
1084
|
-
_context13.t0 = _context13.sent;
|
|
1085
|
-
case 27:
|
|
1086
|
-
userConkKey = _context13.t0;
|
|
1070
|
+
_context13.next = 20;
|
|
1071
|
+
return this.Crypto.DecryptCap(metadata[userCapKey], this.signer);
|
|
1072
|
+
case 20:
|
|
1073
|
+
userConkKey = _context13.sent;
|
|
1087
1074
|
userConkKey.qid = objectId;
|
|
1088
|
-
_context13.
|
|
1089
|
-
_context13.
|
|
1090
|
-
_context13.
|
|
1091
|
-
_context13.
|
|
1092
|
-
_context13.
|
|
1093
|
-
_context13.next =
|
|
1075
|
+
_context13.t0 = this;
|
|
1076
|
+
_context13.t1 = libraryId;
|
|
1077
|
+
_context13.t2 = objectId;
|
|
1078
|
+
_context13.t3 = writeToken;
|
|
1079
|
+
_context13.t4 = userCapKey;
|
|
1080
|
+
_context13.next = 29;
|
|
1094
1081
|
return this.Crypto.EncryptConk(userConkKey, this.signer._signingKey().publicKey);
|
|
1095
|
-
case
|
|
1096
|
-
_context13.
|
|
1097
|
-
_context13.
|
|
1098
|
-
libraryId: _context13.
|
|
1099
|
-
objectId: _context13.
|
|
1100
|
-
writeToken: _context13.
|
|
1101
|
-
metadataSubtree: _context13.
|
|
1102
|
-
metadata: _context13.
|
|
1082
|
+
case 29:
|
|
1083
|
+
_context13.t5 = _context13.sent;
|
|
1084
|
+
_context13.t6 = {
|
|
1085
|
+
libraryId: _context13.t1,
|
|
1086
|
+
objectId: _context13.t2,
|
|
1087
|
+
writeToken: _context13.t3,
|
|
1088
|
+
metadataSubtree: _context13.t4,
|
|
1089
|
+
metadata: _context13.t5
|
|
1103
1090
|
};
|
|
1104
|
-
_context13.next =
|
|
1105
|
-
return _context13.
|
|
1106
|
-
case
|
|
1107
|
-
_context13.next =
|
|
1091
|
+
_context13.next = 33;
|
|
1092
|
+
return _context13.t0.ReplaceMetadata.call(_context13.t0, _context13.t6);
|
|
1093
|
+
case 33:
|
|
1094
|
+
_context13.next = 35;
|
|
1108
1095
|
return Promise.all(Object.keys(metadata).filter(function (key) {
|
|
1109
1096
|
return key.startsWith("eluv.caps.ikms");
|
|
1110
1097
|
}).map( /*#__PURE__*/function () {
|
|
@@ -1131,28 +1118,28 @@ exports.CopyContentObject = /*#__PURE__*/function () {
|
|
|
1131
1118
|
return _ref24.apply(this, arguments);
|
|
1132
1119
|
};
|
|
1133
1120
|
}()));
|
|
1134
|
-
case
|
|
1121
|
+
case 35:
|
|
1135
1122
|
if (!(permission !== "owner")) {
|
|
1136
|
-
_context13.next =
|
|
1123
|
+
_context13.next = 38;
|
|
1137
1124
|
break;
|
|
1138
1125
|
}
|
|
1139
|
-
_context13.next =
|
|
1126
|
+
_context13.next = 38;
|
|
1140
1127
|
return this.CreateEncryptionConk({
|
|
1141
1128
|
libraryId: libraryId,
|
|
1142
1129
|
objectId: objectId,
|
|
1143
1130
|
writeToken: writeToken,
|
|
1144
1131
|
createKMSConk: true
|
|
1145
1132
|
});
|
|
1146
|
-
case
|
|
1147
|
-
_context13.next =
|
|
1133
|
+
case 38:
|
|
1134
|
+
_context13.next = 40;
|
|
1148
1135
|
return this.FinalizeContentObject({
|
|
1149
1136
|
libraryId: libraryId,
|
|
1150
1137
|
objectId: objectId,
|
|
1151
1138
|
writeToken: writeToken
|
|
1152
1139
|
});
|
|
1153
|
-
case
|
|
1140
|
+
case 40:
|
|
1154
1141
|
return _context13.abrupt("return", _context13.sent);
|
|
1155
|
-
case
|
|
1142
|
+
case 41:
|
|
1156
1143
|
case "end":
|
|
1157
1144
|
return _context13.stop();
|
|
1158
1145
|
}
|
|
@@ -1197,42 +1184,29 @@ exports.CreateNonOwnerCap = /*#__PURE__*/function () {
|
|
|
1197
1184
|
}
|
|
1198
1185
|
throw Error("No user cap found for current user");
|
|
1199
1186
|
case 7:
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
_context14.next = 10;
|
|
1205
|
-
return this.signer.DecryptCap(userCapValue);
|
|
1206
|
-
case 10:
|
|
1207
|
-
_context14.t0 = _context14.sent;
|
|
1208
|
-
_context14.next = 16;
|
|
1209
|
-
break;
|
|
1210
|
-
case 13:
|
|
1211
|
-
_context14.next = 15;
|
|
1212
|
-
return this.Crypto.DecryptCap(userCapValue, this.signer._signingKey().privateKey);
|
|
1213
|
-
case 15:
|
|
1214
|
-
_context14.t0 = _context14.sent;
|
|
1215
|
-
case 16:
|
|
1216
|
-
userConk = _context14.t0;
|
|
1187
|
+
_context14.next = 9;
|
|
1188
|
+
return this.Crypto.DecryptCap(userCapValue, this.signer);
|
|
1189
|
+
case 9:
|
|
1190
|
+
userConk = _context14.sent;
|
|
1217
1191
|
publicAddress = this.utils.PublicKeyToAddress(publicKey);
|
|
1218
1192
|
targetUserCapKey = "eluv.caps.iusr".concat(this.utils.AddressToHash(publicAddress));
|
|
1219
|
-
_context14.next =
|
|
1193
|
+
_context14.next = 14;
|
|
1220
1194
|
return this.Crypto.EncryptConk(userConk, publicKey);
|
|
1221
|
-
case
|
|
1195
|
+
case 14:
|
|
1222
1196
|
targetUserCapValue = _context14.sent;
|
|
1223
1197
|
finalize = !writeToken;
|
|
1224
1198
|
if (writeToken) {
|
|
1225
|
-
_context14.next =
|
|
1199
|
+
_context14.next = 20;
|
|
1226
1200
|
break;
|
|
1227
1201
|
}
|
|
1228
|
-
_context14.next =
|
|
1202
|
+
_context14.next = 19;
|
|
1229
1203
|
return this.EditContentObject({
|
|
1230
1204
|
libraryId: libraryId,
|
|
1231
1205
|
objectId: objectId
|
|
1232
1206
|
}).writeToken;
|
|
1233
|
-
case
|
|
1207
|
+
case 19:
|
|
1234
1208
|
writeToken = _context14.sent;
|
|
1235
|
-
case
|
|
1209
|
+
case 20:
|
|
1236
1210
|
this.ReplaceMetadata({
|
|
1237
1211
|
libraryId: libraryId,
|
|
1238
1212
|
objectId: objectId,
|
|
@@ -1241,17 +1215,17 @@ exports.CreateNonOwnerCap = /*#__PURE__*/function () {
|
|
|
1241
1215
|
metadata: targetUserCapValue
|
|
1242
1216
|
});
|
|
1243
1217
|
if (!finalize) {
|
|
1244
|
-
_context14.next =
|
|
1218
|
+
_context14.next = 24;
|
|
1245
1219
|
break;
|
|
1246
1220
|
}
|
|
1247
|
-
_context14.next =
|
|
1221
|
+
_context14.next = 24;
|
|
1248
1222
|
return this.FinalizeContentObject({
|
|
1249
1223
|
libraryId: libraryId,
|
|
1250
1224
|
objectId: objectId,
|
|
1251
1225
|
writeToken: writeToken,
|
|
1252
1226
|
commitMessage: "Create non-owner cap"
|
|
1253
1227
|
});
|
|
1254
|
-
case
|
|
1228
|
+
case 24:
|
|
1255
1229
|
case "end":
|
|
1256
1230
|
return _context14.stop();
|
|
1257
1231
|
}
|
|
@@ -1579,13 +1579,13 @@ function _GetTenantGroupAddress() {
|
|
|
1579
1579
|
case 20:
|
|
1580
1580
|
_context33.prev = 20;
|
|
1581
1581
|
_context33.t0 = _context33["catch"](11);
|
|
1582
|
-
|
|
1582
|
+
ctx.Log(_context33.t0);
|
|
1583
1583
|
throw new Error("Failed to retrieve ".concat(groupName, " group address."));
|
|
1584
1584
|
case 24:
|
|
1585
1585
|
case "end":
|
|
1586
1586
|
return _context33.stop();
|
|
1587
1587
|
}
|
|
1588
|
-
}, _callee33,
|
|
1588
|
+
}, _callee33, null, [[11, 20]]);
|
|
1589
1589
|
}));
|
|
1590
1590
|
return _GetTenantGroupAddress.apply(this, arguments);
|
|
1591
1591
|
}
|