@leofcoin/codec-format-interface 1.2.4 → 1.2.7
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/index.js +22 -8
- package/package.json +1 -1
- package/src/basic-interface.js +1 -1
- package/src/codecs.js +2 -2
- package/src/index.js +11 -5
- /package/test/{test.js → index.js} +0 -0
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ var isHex__default = /*#__PURE__*/_interopDefaultLegacy(isHex);
|
|
|
34
34
|
var varint__default = /*#__PURE__*/_interopDefaultLegacy(varint);
|
|
35
35
|
var createKeccakHash__default = /*#__PURE__*/_interopDefaultLegacy(createKeccakHash);
|
|
36
36
|
|
|
37
|
-
class BasicInterface {
|
|
37
|
+
class BasicInterface$1 {
|
|
38
38
|
#handleDecode() {
|
|
39
39
|
if (!this.decode) throw new Error('bad implementation: needs decode func')
|
|
40
40
|
return this.decode()
|
|
@@ -51,7 +51,7 @@ class BasicInterface {
|
|
|
51
51
|
return bs32__default["default"].isBase32(string)
|
|
52
52
|
}
|
|
53
53
|
isBase58(string) {
|
|
54
|
-
return bs58__default["default"].
|
|
54
|
+
return bs58__default["default"].isBase58(string)
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
57
|
* @param {String} encoded
|
|
@@ -232,9 +232,17 @@ var codecs = {
|
|
|
232
232
|
codec: parseInt('636d', 16),
|
|
233
233
|
hashAlg: 'dbl-keccak-256',
|
|
234
234
|
},
|
|
235
|
+
'peernet-file' : {
|
|
236
|
+
codec: parseInt('7066', 16),
|
|
237
|
+
hashAlg: 'keccak-256',
|
|
238
|
+
},
|
|
239
|
+
'peernet-file-response' : {
|
|
240
|
+
codec: parseInt('706672', 16),
|
|
241
|
+
hashAlg: 'keccak-256',
|
|
242
|
+
}
|
|
235
243
|
};
|
|
236
244
|
|
|
237
|
-
class PeernetCodec extends BasicInterface {
|
|
245
|
+
class PeernetCodec extends BasicInterface$1 {
|
|
238
246
|
get codecs() {
|
|
239
247
|
return {...globalThis.peernet.codecs, ...codecs}
|
|
240
248
|
}
|
|
@@ -325,7 +333,7 @@ class PeernetCodec extends BasicInterface {
|
|
|
325
333
|
}
|
|
326
334
|
}
|
|
327
335
|
|
|
328
|
-
class CodecHash extends BasicInterface {
|
|
336
|
+
class CodecHash$1 extends BasicInterface$1 {
|
|
329
337
|
constructor(buffer, options = {}) {
|
|
330
338
|
super();
|
|
331
339
|
if (options.name) this.name = options.name;
|
|
@@ -450,7 +458,7 @@ class CodecHash extends BasicInterface {
|
|
|
450
458
|
|
|
451
459
|
let protons;
|
|
452
460
|
|
|
453
|
-
class FormatInterface extends BasicInterface {
|
|
461
|
+
class FormatInterface$1 extends BasicInterface$1 {
|
|
454
462
|
async #importProtons() {
|
|
455
463
|
let importee = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(/* webpackChunkName: "protons" */ 'protons')); });
|
|
456
464
|
return importee.default
|
|
@@ -498,7 +506,7 @@ class FormatInterface extends BasicInterface {
|
|
|
498
506
|
* @return {PeernetHash}
|
|
499
507
|
*/
|
|
500
508
|
get peernetHash() {
|
|
501
|
-
return new CodecHash(this.decoded, {name: this.name})
|
|
509
|
+
return new CodecHash$1(this.decoded, {name: this.name})
|
|
502
510
|
}
|
|
503
511
|
|
|
504
512
|
/**
|
|
@@ -557,8 +565,14 @@ class FormatInterface extends BasicInterface {
|
|
|
557
565
|
}
|
|
558
566
|
}
|
|
559
567
|
|
|
568
|
+
const BasicInterface = BasicInterface$1;
|
|
569
|
+
const FormatInterface = FormatInterface$1;
|
|
570
|
+
const CodecHash = CodecHash$1;
|
|
571
|
+
const Codec = PeernetCodec;
|
|
572
|
+
const Codecs = codecs;
|
|
573
|
+
|
|
560
574
|
exports.BasicInterface = BasicInterface;
|
|
561
|
-
exports.Codec =
|
|
575
|
+
exports.Codec = Codec;
|
|
562
576
|
exports.CodecHash = CodecHash;
|
|
577
|
+
exports.Codecs = Codecs;
|
|
563
578
|
exports.FormatInterface = FormatInterface;
|
|
564
|
-
exports.codecs = codecs;
|
package/package.json
CHANGED
package/src/basic-interface.js
CHANGED
package/src/codecs.js
CHANGED
|
@@ -76,11 +76,11 @@ export default {
|
|
|
76
76
|
codec: parseInt('636d', 16),
|
|
77
77
|
hashAlg: 'dbl-keccak-256',
|
|
78
78
|
},
|
|
79
|
-
'peernet-
|
|
79
|
+
'peernet-file' : {
|
|
80
80
|
codec: parseInt('7066', 16),
|
|
81
81
|
hashAlg: 'keccak-256',
|
|
82
82
|
},
|
|
83
|
-
'peernet-
|
|
83
|
+
'peernet-file-response' : {
|
|
84
84
|
codec: parseInt('706672', 16),
|
|
85
85
|
hashAlg: 'keccak-256',
|
|
86
86
|
}
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import basicInterface from './basic-interface.js'
|
|
2
|
+
import formatInterface from './codec-format-interface.js'
|
|
3
|
+
import codecHash from './codec-hash.js'
|
|
4
|
+
import codec from './codec.js'
|
|
5
|
+
import codecs from './codecs.js'
|
|
6
|
+
|
|
7
|
+
export const BasicInterface = basicInterface
|
|
8
|
+
export const FormatInterface = formatInterface
|
|
9
|
+
export const CodecHash = codecHash
|
|
10
|
+
export const Codec = codec
|
|
11
|
+
export const Codecs = codecs
|
|
File without changes
|