trac-msb 0.0.67 → 0.0.69
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/Whitelist/pubkeys.csv +2 -1
- package/package.json +20 -22
- package/src/index.js +25 -0
- package/src/network.js +1 -2
package/Whitelist/pubkeys.csv
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
e247a9ceefb8a83e28d3c5845055910bc61e0b418c7578d297354708f276af04
|
|
1
|
+
e247a9ceefb8a83e28d3c5845055910bc61e0b418c7578d297354708f276af04
|
|
2
|
+
580c44d7827fbeeb7778e4d2dce660b30f3ca3baa4de254ecd556dfb5b60fc35
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trac-msb",
|
|
3
3
|
"main": "msb.mjs",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.69",
|
|
5
5
|
"pear": {
|
|
6
6
|
"name": "trac-msb",
|
|
7
7
|
"type": "terminal"
|
|
@@ -12,32 +12,15 @@
|
|
|
12
12
|
"test": "brittle test/*.test.js"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"
|
|
15
|
+
"assert": "npm:bare-node-assert",
|
|
16
16
|
"autobase": "7.2.2",
|
|
17
17
|
"b4a": "1.6.7",
|
|
18
|
-
"hyperbee": "2.24.1",
|
|
19
|
-
"corestore": "7.1.0",
|
|
20
|
-
"hypercore": "11.1.2",
|
|
21
|
-
"hypercore-crypto": "3.4.0",
|
|
22
|
-
"hyperdht": "6.20.1",
|
|
23
|
-
"hyperswarm": "4.11.1",
|
|
24
|
-
"brittle": "3.0.0",
|
|
25
|
-
"xache": "1.2.0",
|
|
26
|
-
"debounceify": "1.1.0",
|
|
27
|
-
"ready-resource": "^1.0.0",
|
|
28
|
-
"is-options": "1.0.2",
|
|
29
|
-
"safety-catch": "1.0.2",
|
|
30
|
-
"sodium-native": "^5.0.1",
|
|
31
|
-
"pear-interface": "1.0.0",
|
|
32
|
-
"protomux-wakeup": "^2.2.1",
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"bare-fetch": "^2.2.1",
|
|
36
18
|
"bare-assert": "^1.0.2",
|
|
37
19
|
"bare-buffer": "^3.1.2",
|
|
38
20
|
"bare-console": "^6.0.1",
|
|
39
21
|
"bare-crypto": "^1.4.3",
|
|
40
22
|
"bare-events": "^2.5.4",
|
|
23
|
+
"bare-fetch": "^2.2.1",
|
|
41
24
|
"bare-fs": "^4.0.2",
|
|
42
25
|
"bare-http1": "^4.0.2",
|
|
43
26
|
"bare-https": "^2.0.0",
|
|
@@ -57,31 +40,46 @@
|
|
|
57
40
|
"bare-utils": "^1.2.0",
|
|
58
41
|
"bare-worker": "^3.0.0",
|
|
59
42
|
"bare-zlib": "^1.2.5",
|
|
60
|
-
"
|
|
61
|
-
"assert": "npm:bare-node-assert",
|
|
43
|
+
"brittle": "3.0.0",
|
|
62
44
|
"buffer": "npm:bare-node-buffer",
|
|
63
45
|
"child_process": "npm:bare-node-child-process",
|
|
64
46
|
"console": "npm:bare-node-console",
|
|
47
|
+
"corestore": "7.1.0",
|
|
65
48
|
"crypto": "npm:bare-node-crypto",
|
|
49
|
+
"debounceify": "1.1.0",
|
|
66
50
|
"events": "npm:bare-node-events",
|
|
67
51
|
"fastest-validator": "^1.19.0",
|
|
52
|
+
"fetch": "npm:bare-node-fetch",
|
|
68
53
|
"fs": "npm:bare-node-fs",
|
|
69
54
|
"http": "npm:bare-node-http",
|
|
70
55
|
"https": "npm:bare-node-https",
|
|
56
|
+
"hyperbee": "2.24.1",
|
|
57
|
+
"hypercore": "11.1.2",
|
|
58
|
+
"hypercore-crypto": "3.4.0",
|
|
59
|
+
"hyperdht": "^6.20.1",
|
|
60
|
+
"hyperswarm": "4.11.1",
|
|
71
61
|
"inspector": "npm:bare-node-inspector",
|
|
62
|
+
"is-options": "1.0.2",
|
|
72
63
|
"module": "npm:bare-node-module",
|
|
73
64
|
"os": "npm:bare-node-os",
|
|
74
65
|
"path": "npm:bare-node-path",
|
|
66
|
+
"pear-interface": "1.0.0",
|
|
75
67
|
"process": "npm:bare-node-process",
|
|
68
|
+
"protomux-wakeup": "^2.2.1",
|
|
76
69
|
"readline": "npm:bare-node-readline",
|
|
70
|
+
"ready-resource": "^1.0.0",
|
|
77
71
|
"repl": "npm:bare-node-repl",
|
|
72
|
+
"safety-catch": "1.0.2",
|
|
73
|
+
"sodium-native": "^5.0.1",
|
|
78
74
|
"stream": "npm:bare-node-stream",
|
|
79
75
|
"timers": "npm:bare-node-timers",
|
|
80
76
|
"tls": "npm:bare-node-tls",
|
|
77
|
+
"trac-wallet": "^0.0.36",
|
|
81
78
|
"tty": "npm:bare-node-tty",
|
|
82
79
|
"url": "npm:bare-node-url",
|
|
83
80
|
"util": "npm:bare-node-util",
|
|
84
81
|
"worker_threads": "npm:bare-node-worker-threads",
|
|
82
|
+
"xache": "1.2.0",
|
|
85
83
|
"zlib": "npm:bare-node-zlib"
|
|
86
84
|
},
|
|
87
85
|
"publishConfig": {
|
package/src/index.js
CHANGED
|
@@ -12,6 +12,9 @@ import MsgUtils from './utils/msgUtils.js';
|
|
|
12
12
|
import { LISTENER_TIMEOUT, EntryType, OperationType, EventType, ACK_INTERVAL, WHITELIST_SLEEP_INTERVAL, UPDATER_INTERVAL, MAX_INDEXERS, MIN_INDEXERS, WHITELIST_PREFIX } from './utils/constants.js';
|
|
13
13
|
import Network from './network.js';
|
|
14
14
|
import Check from './utils/check.js';
|
|
15
|
+
|
|
16
|
+
import DHT from 'hyperdht'
|
|
17
|
+
|
|
15
18
|
//TODO: CHANGE NONCE.
|
|
16
19
|
|
|
17
20
|
export class MainSettlementBus extends ReadyResource {
|
|
@@ -335,6 +338,26 @@ export class MainSettlementBus extends ReadyResource {
|
|
|
335
338
|
}
|
|
336
339
|
}
|
|
337
340
|
|
|
341
|
+
async dhtNode(wallet){
|
|
342
|
+
const node = new DHT()
|
|
343
|
+
const server = node.createServer()
|
|
344
|
+
|
|
345
|
+
server.on('connection', function (socket) {
|
|
346
|
+
// socket is E2E encrypted between you and the other peer
|
|
347
|
+
console.log('Remote public key', socket)
|
|
348
|
+
process.stdin.pipe(socket).pipe(process.stdout)
|
|
349
|
+
})
|
|
350
|
+
|
|
351
|
+
const keyPair = {
|
|
352
|
+
publicKey: b4a.from(wallet.publicKey, 'hex'),
|
|
353
|
+
secretKey: b4a.from(wallet.secretKey, 'hex')
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
// this makes the server accept connections on this keypair
|
|
357
|
+
await server.listen(keyPair)
|
|
358
|
+
console.log('DHT node is listening');
|
|
359
|
+
}
|
|
360
|
+
|
|
338
361
|
async _open() {
|
|
339
362
|
await this.#base.ready();
|
|
340
363
|
if (this.#enable_wallet) {
|
|
@@ -355,6 +378,8 @@ export class MainSettlementBus extends ReadyResource {
|
|
|
355
378
|
this.#tx_swarm = await Network.txChannel(this.#tx_swarm, this.#tx, this.#base, this.#wallet, this.#writingKey, this.#network);
|
|
356
379
|
}
|
|
357
380
|
|
|
381
|
+
this.dhtNode(this.#wallet);
|
|
382
|
+
|
|
358
383
|
const adminEntry = await this.getSigned(EntryType.ADMIN);
|
|
359
384
|
|
|
360
385
|
if (this.#isAdmin(adminEntry)) {
|
package/src/network.js
CHANGED
|
@@ -106,8 +106,7 @@ class Network {
|
|
|
106
106
|
|
|
107
107
|
});
|
|
108
108
|
|
|
109
|
-
|
|
110
|
-
tx_swarm.join(channelBuffer, { server: true, client: true });
|
|
109
|
+
tx_swarm.join(tx_channel, { server: true, client: true });
|
|
111
110
|
await tx_swarm.flush();
|
|
112
111
|
console.log('Joined MSB TX channel');
|
|
113
112
|
}
|