@eluvio/elv-client-js 3.1.85 → 3.1.89
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 +2 -2
- package/dist/src/AuthorizationClient.js +1 -1
- package/dist/src/ElvClient.js +5 -3
- package/dist/src/RemoteSigner.js +78 -51
- package/package-lock.json +140 -114
- package/package.json +4 -5
- package/src/AuthorizationClient.js +1 -1
- package/src/ElvClient.js +4 -2
- package/src/RemoteSigner.js +27 -17
- package/src/UserProfileClient.js +7 -2
- package/src/Utils.js +30 -1
- package/src/client/ContentManagement.js +4 -0
package/src/Utils.js
CHANGED
|
@@ -6,7 +6,8 @@ const VarInt = require("varint");
|
|
|
6
6
|
const URI = require("urijs");
|
|
7
7
|
|
|
8
8
|
const {
|
|
9
|
-
keccak256
|
|
9
|
+
keccak256,
|
|
10
|
+
getAddress
|
|
10
11
|
} = require("ethers").utils;
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -245,6 +246,34 @@ const Utils = {
|
|
|
245
246
|
return (Utils.HashToAddress(firstHash) === Utils.HashToAddress(secondHash));
|
|
246
247
|
},
|
|
247
248
|
|
|
249
|
+
/**
|
|
250
|
+
* Determine whether the address is valid
|
|
251
|
+
*
|
|
252
|
+
* @param {string} address - Address to validate
|
|
253
|
+
*
|
|
254
|
+
* @returns {boolean} - Whether or not the address is valid
|
|
255
|
+
*/
|
|
256
|
+
ValidAddress: (address) => {
|
|
257
|
+
try {
|
|
258
|
+
getAddress(address);
|
|
259
|
+
return true;
|
|
260
|
+
} catch(error) {
|
|
261
|
+
this.Log(error);
|
|
262
|
+
return false;
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Determine whether the hash is valid
|
|
268
|
+
*
|
|
269
|
+
* @param {string} hash - Hash to validate
|
|
270
|
+
*
|
|
271
|
+
* @returns {boolean} - Whether or not the hash is valid
|
|
272
|
+
*/
|
|
273
|
+
ValidHash: (hash) => {
|
|
274
|
+
return Utils.ValidAddress(Utils.HashToAddress(hash));
|
|
275
|
+
},
|
|
276
|
+
|
|
248
277
|
/**
|
|
249
278
|
* Convert the specified string to a bytes32 string
|
|
250
279
|
*
|
|
@@ -271,6 +271,10 @@ exports.CreateContentLibrary = async function({
|
|
|
271
271
|
}
|
|
272
272
|
|
|
273
273
|
if(tenantId) {
|
|
274
|
+
if(!this.utils.ValidHash(tenantId)) {
|
|
275
|
+
throw Error(`Invalid tenant ID: ${tenantId}`);
|
|
276
|
+
}
|
|
277
|
+
|
|
274
278
|
await this.CallContractMethod({
|
|
275
279
|
contractAddress,
|
|
276
280
|
methodName: "putMeta",
|