@eluvio/elv-client-js 3.1.96 → 3.1.97

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-client-js",
3
- "version": "3.1.96",
3
+ "version": "3.1.97",
4
4
  "description": "Javascript client for the Eluvio Content Fabric",
5
5
  "main": "src/ElvClient.js",
6
6
  "author": "Kevin Talmadge",
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,
@@ -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
  *