@eluvio/elv-client-js 3.1.95 → 3.2.0
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 +11 -15
- package/dist/ElvClient-node-min.js +13 -17
- package/dist/ElvFrameClient-min.js +9 -13
- package/dist/ElvPermissionsClient-min.js +9 -13
- package/dist/src/AuthorizationClient.js +1980 -2238
- package/dist/src/ContentObjectVerification.js +173 -164
- package/dist/src/Crypto.js +324 -376
- package/dist/src/ElvClient.js +1022 -1182
- package/dist/src/ElvWallet.js +95 -119
- package/dist/src/EthClient.js +896 -1040
- package/dist/src/FrameClient.js +300 -331
- package/dist/src/HttpClient.js +147 -153
- package/dist/src/Id.js +3 -1
- package/dist/src/PermissionsClient.js +1168 -1294
- package/dist/src/RemoteSigner.js +211 -263
- package/dist/src/UserProfileClient.js +1023 -1164
- package/dist/src/Utils.js +217 -212
- package/dist/src/client/ABRPublishing.js +858 -895
- package/dist/src/client/AccessGroups.js +959 -1102
- package/dist/src/client/ContentAccess.js +3433 -3717
- package/dist/src/client/ContentManagement.js +2068 -2252
- package/dist/src/client/Contracts.js +563 -647
- package/dist/src/client/Files.js +1757 -1886
- package/dist/src/client/NFT.js +112 -126
- package/dist/src/client/NTP.js +422 -478
- package/dist/src/index.js +11 -0
- package/dist/src/marketplaceClient/ClientMethods.js +1918 -0
- package/dist/src/marketplaceClient/Configuration.js +29 -0
- package/dist/src/marketplaceClient/Utils.js +304 -0
- package/dist/src/marketplaceClient/index.js +1553 -0
- package/dist/src/walletClient/ClientMethods.js +1828 -0
- package/dist/src/walletClient/Configuration.js +29 -0
- package/dist/src/walletClient/Utils.js +290 -0
- package/dist/src/walletClient/index.js +1459 -0
- package/package-lock.json +22001 -0
- package/package.json +6 -4
- package/src/AuthorizationClient.js +1 -1
- package/src/ElvClient.js +4 -1
- package/src/Utils.js +44 -3
- package/src/client/ContentAccess.js +4 -0
- package/src/index.js +7 -0
- package/src/walletClient/ClientMethods.js +1016 -0
- package/src/walletClient/Configuration.js +40 -0
- package/src/walletClient/README.md +185 -0
- package/src/walletClient/Utils.js +234 -0
- package/src/walletClient/index.js +884 -0
- package/testScripts/TestMarketplaceClient.js +25 -0
- package/utilities/ObjectSetPermission.js +4 -4
- package/utilities/SimpleIngest.js +41 -0
- package/utilities/example_files/simple_ingest_library_metadata.json +180 -0
- package/utilities/example_files/simple_ingest_library_metadata_animation_NFTs.json +133 -0
package/package.json
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eluvio/elv-client-js",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Javascript client for the Eluvio Content Fabric",
|
|
5
|
-
"main": "src/
|
|
5
|
+
"main": "src/index.js",
|
|
6
6
|
"author": "Kevin Talmadge",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"homepage": "https://github.com/eluv-io/elv-client-js",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"bump-version": "npm --git-tag-version --no-commit-hooks version patch",
|
|
11
11
|
"build": "npm run build-docs && npm run build-dist && npm run build-frame-client && npm run build-permissions-client && npm run build-prod",
|
|
12
|
-
"build-docs": "node build/BuildDocs.js &&
|
|
12
|
+
"build-docs": "node build/BuildDocs.js && npm run build-client-docs && npm run build-wallet-client-docs",
|
|
13
|
+
"build-client-docs": "./node_modules/.bin/jsdoc --configure ./.jsdoc.json --readme README.md",
|
|
14
|
+
"build-wallet-client-docs": "./node_modules/.bin/jsdoc --configure ./.jsdoc-mc.json --readme ./src/walletClient/README.md",
|
|
13
15
|
"build-dist": "node ./node_modules/@babel/cli/bin/babel.js --source-type=unambiguous --presets=@babel/preset-env --plugins @babel/plugin-transform-runtime src --out-dir dist/src",
|
|
14
16
|
"build-contracts": "node build/BuildContracts.js",
|
|
15
17
|
"build-frame-client": "webpack -p --progress --entry ./dist/src/FrameClient.js --output-filename ElvFrameClient-min.js --devtool none --optimize-minimize && mv test/bundle-analysis/index.html test/bundle-analysis/frame-client.html",
|
|
@@ -57,7 +59,7 @@
|
|
|
57
59
|
"dependencies": {
|
|
58
60
|
"@babel/runtime": "^7.8.4",
|
|
59
61
|
"@eluvio/crypto": ">=1.0.8",
|
|
60
|
-
"@eluvio/elv-abr-profile": "^0.
|
|
62
|
+
"@eluvio/elv-abr-profile": "^1.0.0",
|
|
61
63
|
"@sindresorhus/slugify": "^1.1.0",
|
|
62
64
|
"babel-loader": "^8.0.6",
|
|
63
65
|
"bignumber.js": "^8.0.2",
|
|
@@ -204,7 +204,7 @@ class AuthorizationClient {
|
|
|
204
204
|
addr: Utils.FormatAddress(((this.client.signer && this.client.signer.address) || ""))
|
|
205
205
|
};
|
|
206
206
|
|
|
207
|
-
if(!(this.noAuth || noAuth)
|
|
207
|
+
if(!(this.noAuth || noAuth)) {
|
|
208
208
|
const { transactionHash } = await this.MakeAccessRequest({
|
|
209
209
|
libraryId,
|
|
210
210
|
objectId,
|
package/src/ElvClient.js
CHANGED
|
@@ -39,6 +39,9 @@ if(Utils.Platform() === Utils.PLATFORM_NODE) {
|
|
|
39
39
|
/**
|
|
40
40
|
* See the Modules section on the sidebar for details about methods related to interacting with the Fabric.
|
|
41
41
|
*
|
|
42
|
+
* <br/>
|
|
43
|
+
*
|
|
44
|
+
* For information about the Eluvio Wallet Client, go <a href="wallet-client/index.html">here</a>.
|
|
42
45
|
*/
|
|
43
46
|
class ElvClient {
|
|
44
47
|
Log(message, error = false) {
|
|
@@ -116,7 +119,7 @@ class ElvClient {
|
|
|
116
119
|
/**
|
|
117
120
|
* Create a new ElvClient
|
|
118
121
|
*
|
|
119
|
-
* NOTE: It is highly recommended to use
|
|
122
|
+
* NOTE: It is highly recommended to use the <a href="#.FromConfigurationUrl">FromConfigurationUrl</a> or <a href="#.FromNetworkName">FromNetworkName</a> method
|
|
120
123
|
* automatically import the client settings from the fabric
|
|
121
124
|
*
|
|
122
125
|
* @constructor
|
package/src/Utils.js
CHANGED
|
@@ -4,6 +4,7 @@ const bs58 = require("bs58");
|
|
|
4
4
|
const BigNumber = require("bignumber.js").default;
|
|
5
5
|
const VarInt = require("varint");
|
|
6
6
|
const URI = require("urijs");
|
|
7
|
+
const Pako = require("pako");
|
|
7
8
|
|
|
8
9
|
const {
|
|
9
10
|
keccak256,
|
|
@@ -17,14 +18,14 @@ const {
|
|
|
17
18
|
*
|
|
18
19
|
* Utils can be imported separately from the client:
|
|
19
20
|
*
|
|
20
|
-
* const Utils = require("@eluvio/elv-client-js/src/Utils)
|
|
21
|
+
* `const Utils = require("@eluvio/elv-client-js/src/Utils)`
|
|
21
22
|
*
|
|
22
23
|
* or
|
|
23
24
|
*
|
|
24
|
-
* import Utils from "@eluvio/elv-client-js/src/Utils"
|
|
25
|
+
* `import Utils from "@eluvio/elv-client-js/src/Utils"`
|
|
25
26
|
*
|
|
26
27
|
*
|
|
27
|
-
* It can be accessed from ElvClient and FrameClient as client.utils
|
|
28
|
+
* It can be accessed from ElvClient and FrameClient as `client.utils`
|
|
28
29
|
*/
|
|
29
30
|
const Utils = {
|
|
30
31
|
name: "Utils",
|
|
@@ -150,6 +151,27 @@ const Utils = {
|
|
|
150
151
|
};
|
|
151
152
|
},
|
|
152
153
|
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Decode the specified signed token into its component parts
|
|
157
|
+
*
|
|
158
|
+
* @param {string} token - The token to decode
|
|
159
|
+
*
|
|
160
|
+
* @return {Object} - Components of the signed token
|
|
161
|
+
*/
|
|
162
|
+
DecodeSignedToken: (token) => {
|
|
163
|
+
const decodedToken = Utils.FromB58(token.slice(6));
|
|
164
|
+
const signature = `0x${decodedToken.slice(0, 65).toString("hex")}`;
|
|
165
|
+
|
|
166
|
+
let payload = JSON.parse(Buffer.from(Pako.inflateRaw(decodedToken.slice(65))).toString("utf-8"));
|
|
167
|
+
payload.adr = Utils.FormatAddress(`0x${Buffer.from(payload.adr, "base64").toString("hex")}`);
|
|
168
|
+
|
|
169
|
+
return {
|
|
170
|
+
payload,
|
|
171
|
+
signature
|
|
172
|
+
};
|
|
173
|
+
},
|
|
174
|
+
|
|
153
175
|
/**
|
|
154
176
|
* Decode the specified write token into its component parts
|
|
155
177
|
*
|
|
@@ -420,6 +442,21 @@ const Utils = {
|
|
|
420
442
|
return Buffer.from(str, "base64").toString("utf-8");
|
|
421
443
|
},
|
|
422
444
|
|
|
445
|
+
FromB64URL: str => {
|
|
446
|
+
str = str.replace(/-/g, "+").replace(/_/g, "/");
|
|
447
|
+
|
|
448
|
+
const pad = str.length % 4;
|
|
449
|
+
if(pad) {
|
|
450
|
+
if(pad === 1) {
|
|
451
|
+
throw new Error("InvalidLengthError: Input base64url string is the wrong length to determine padding");
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
str += new Array(5-pad).join("=");
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
return Utils.FromB64(str);
|
|
458
|
+
},
|
|
459
|
+
|
|
423
460
|
B58: arr => {
|
|
424
461
|
return bs58.encode(Buffer.from(arr));
|
|
425
462
|
},
|
|
@@ -428,6 +465,10 @@ const Utils = {
|
|
|
428
465
|
return bs58.decode(str);
|
|
429
466
|
},
|
|
430
467
|
|
|
468
|
+
FromB58ToStr: str => {
|
|
469
|
+
return new TextDecoder().decode(Utils.FromB58(str));
|
|
470
|
+
},
|
|
471
|
+
|
|
431
472
|
/**
|
|
432
473
|
* Decode the given fabric authorization token
|
|
433
474
|
*
|
|
@@ -2332,6 +2332,10 @@ exports.LinkData = async function({libraryId, objectId, versionHash, writeToken,
|
|
|
2332
2332
|
/* Encryption */
|
|
2333
2333
|
|
|
2334
2334
|
exports.CreateEncryptionConk = async function({libraryId, objectId, versionHash, writeToken, createKMSConk=true}) {
|
|
2335
|
+
if(this.signer.remoteSigner) {
|
|
2336
|
+
return;
|
|
2337
|
+
}
|
|
2338
|
+
|
|
2335
2339
|
ValidateParameters({libraryId, objectId, versionHash});
|
|
2336
2340
|
ValidateWriteToken(writeToken);
|
|
2337
2341
|
|
package/src/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const {ElvClient} = require("./ElvClient.js");
|
|
2
|
+
const {ElvMarketplaceClient} = require("./walletClient/index.js");
|
|
3
|
+
const Utils = require("./Utils.js");
|
|
4
|
+
|
|
5
|
+
exports.ElvClient = ElvClient;
|
|
6
|
+
exports.ElvMarketplaceClient = ElvMarketplaceClient;
|
|
7
|
+
exports.Utils = Utils;
|