trac-peer 0.2.2 → 0.2.4

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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/check.js +13 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "trac-peer",
3
3
  "main": "src/index.js",
4
- "version": "0.2.2",
4
+ "version": "0.2.4",
5
5
  "type": "module",
6
6
  "dependencies": {
7
7
  "assert": "npm:bare-node-assert",
@@ -37,7 +37,7 @@
37
37
  "child_process": "npm:bare-node-child-process",
38
38
  "compact-encoding": "2.16.1",
39
39
  "console": "npm:bare-node-console",
40
- "corestore": "7.4.2",
40
+ "corestore": "7.4.4",
41
41
  "crypto": "npm:bare-node-crypto",
42
42
  "debounceify": "1.1.0",
43
43
  "events": "npm:bare-node-events",
@@ -47,7 +47,7 @@
47
47
  "http": "npm:bare-node-http",
48
48
  "https": "npm:bare-node-https",
49
49
  "hyperbee": "^2.24.2",
50
- "hypercore": "11.6.2",
50
+ "hypercore": "11.8.3",
51
51
  "hypercore-crypto": "^3.4.0",
52
52
  "hyperdht": "^6.20.5",
53
53
  "hyperswarm": "^4.11.5",
package/src/check.js CHANGED
@@ -18,6 +18,7 @@ class Check {
18
18
  let result2 = false
19
19
  let result3 = false
20
20
  let result4 = false
21
+ let result5 = false
21
22
  try{
22
23
  result = WAValidator.validate(value, 'Bitcoin', { networkType : 'both' });
23
24
  if(false === result){
@@ -26,11 +27,22 @@ class Check {
26
27
  result3 = WAValidator.validate(value, 'DogeCoin', { networkType : 'both' });
27
28
  if(false === result3){
28
29
  result4 = WAValidator.validate(value, 'BinanceSmartChain', { networkType : 'both' });
30
+ if(false === result4){
31
+ // check for Trac public key hex
32
+ let buf = null
33
+ try{
34
+ buf = b4a.from(value, 'hex')
35
+ result5 = value === b4a.toString(buf, 'hex')
36
+ if(result5){
37
+ result5 = result5.length === 64
38
+ }
39
+ } catch (e) {}
40
+ }
29
41
  }
30
42
  }
31
43
  }
32
44
  } catch (e) {}
33
- return result || result2 || result3 || result4;
45
+ return result || result2 || result3 || result4 || result5;
34
46
  },
35
47
  hexCheck : (value, errors) => {
36
48
  let buf = null