@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/package.json
CHANGED
package/src/Crypto.js
CHANGED
|
@@ -82,7 +82,19 @@ const Crypto = {
|
|
|
82
82
|
return Utils.B64(cap);
|
|
83
83
|
},
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
// accepts either a raw private key string (legacy usage) or a signer
|
|
86
|
+
async DecryptCap(encryptedCap, signerOrPrivateKey) {
|
|
87
|
+
let privateKey;
|
|
88
|
+
if(typeof signerOrPrivateKey === "string") {
|
|
89
|
+
privateKey = signerOrPrivateKey;
|
|
90
|
+
} else if(signerOrPrivateKey && signerOrPrivateKey.remoteSigner) {
|
|
91
|
+
return await signerOrPrivateKey.DecryptCap(encryptedCap);
|
|
92
|
+
} else if(signerOrPrivateKey && typeof signerOrPrivateKey._signingKey === "function") {
|
|
93
|
+
privateKey = signerOrPrivateKey._signingKey().privateKey;
|
|
94
|
+
} else {
|
|
95
|
+
throw Error("Crypto.DecryptCap: second argument must be a signer or a private key string");
|
|
96
|
+
}
|
|
97
|
+
|
|
86
98
|
const elvCrypto = await Crypto.ElvCrypto();
|
|
87
99
|
privateKey = new Uint8Array(Buffer.from(privateKey.replace("0x", ""), "hex"));
|
|
88
100
|
|
package/src/ElvClient.js
CHANGED
|
@@ -1348,9 +1348,7 @@ class ElvClient {
|
|
|
1348
1348
|
|
|
1349
1349
|
ValidatePresence("message", message);
|
|
1350
1350
|
|
|
1351
|
-
return this.
|
|
1352
|
-
await this.signer.DecryptCap(message) :
|
|
1353
|
-
await this.Crypto.DecryptCap(message, this.signer._signingKey().privateKey);
|
|
1351
|
+
return await this.Crypto.DecryptCap(message, this.signer);
|
|
1354
1352
|
}
|
|
1355
1353
|
|
|
1356
1354
|
/**
|
package/src/FrameClient.js
CHANGED
|
@@ -449,10 +449,12 @@ class FrameClient {
|
|
|
449
449
|
"ObjectCleanup",
|
|
450
450
|
"OutputsCreate",
|
|
451
451
|
"OutputsDelete",
|
|
452
|
+
"OutputsDeleteBatch",
|
|
452
453
|
"OutputsList",
|
|
453
454
|
"OutputsListItem",
|
|
454
455
|
"OutputsModify",
|
|
455
456
|
"OutputsModifyBatch",
|
|
457
|
+
"OutputsReset",
|
|
456
458
|
"OutputsResolveSrtPullUrls",
|
|
457
459
|
"OutputsState",
|
|
458
460
|
"OutputsStop",
|
|
@@ -2743,9 +2743,7 @@ exports.CreateEncryptionConk = async function({libraryId, objectId, versionHash,
|
|
|
2743
2743
|
});
|
|
2744
2744
|
|
|
2745
2745
|
if(existingUserCap) {
|
|
2746
|
-
this.encryptionConks[objectId] = this.
|
|
2747
|
-
await this.signer.DecryptCap(existingUserCap) :
|
|
2748
|
-
await this.Crypto.DecryptCap(existingUserCap, this.signer._signingKey().privateKey);
|
|
2746
|
+
this.encryptionConks[objectId] = await this.Crypto.DecryptCap(existingUserCap, this.signer);
|
|
2749
2747
|
} else {
|
|
2750
2748
|
this.encryptionConks[objectId] = await this.Crypto.GeneratePrimaryConk({
|
|
2751
2749
|
spaceId: this.contentSpaceId,
|
|
@@ -2848,9 +2846,7 @@ exports.EncryptionConk = async function({libraryId, objectId, versionHash, write
|
|
|
2848
2846
|
});
|
|
2849
2847
|
|
|
2850
2848
|
if(existingUserCap) {
|
|
2851
|
-
this.encryptionConks[objectId] = this.
|
|
2852
|
-
await this.signer.DecryptCap(existingUserCap) :
|
|
2853
|
-
await this.Crypto.DecryptCap(existingUserCap, this.signer._signingKey().privateKey);
|
|
2849
|
+
this.encryptionConks[objectId] = await this.Crypto.DecryptCap(existingUserCap, this.signer);
|
|
2854
2850
|
} else if(writeToken) {
|
|
2855
2851
|
await this.CreateEncryptionConk({libraryId, objectId, versionHash, writeToken, createKMSConk: false});
|
|
2856
2852
|
} else {
|
|
@@ -680,9 +680,7 @@ exports.CopyContentObject = async function({libraryId, originalVersionHash, opti
|
|
|
680
680
|
const userCapKey = `eluv.caps.iusr${this.utils.AddressToHash(this.signer.address)}`;
|
|
681
681
|
|
|
682
682
|
if(metadata[userCapKey]) {
|
|
683
|
-
const userConkKey = this.
|
|
684
|
-
await this.signer.DecryptCap(metadata[userCapKey]) :
|
|
685
|
-
await this.Crypto.DecryptCap(metadata[userCapKey], this.signer._signingKey().privateKey);
|
|
683
|
+
const userConkKey = await this.Crypto.DecryptCap(metadata[userCapKey], this.signer);
|
|
686
684
|
userConkKey.qid = objectId;
|
|
687
685
|
|
|
688
686
|
await this.ReplaceMetadata({
|
|
@@ -735,9 +733,7 @@ exports.CreateNonOwnerCap = async function({objectId, libraryId, publicKey, writ
|
|
|
735
733
|
throw Error("No user cap found for current user");
|
|
736
734
|
}
|
|
737
735
|
|
|
738
|
-
const userConk = this.
|
|
739
|
-
await this.signer.DecryptCap(userCapValue) :
|
|
740
|
-
await this.Crypto.DecryptCap(userCapValue, this.signer._signingKey().privateKey);
|
|
736
|
+
const userConk = await this.Crypto.DecryptCap(userCapValue, this.signer);
|
|
741
737
|
|
|
742
738
|
const publicAddress = this.utils.PublicKeyToAddress(publicKey);
|
|
743
739
|
|
package/src/client/Contracts.js
CHANGED