@streamr/dht 103.0.0-rc.8 → 103.0.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/generated/google/protobuf/any.d.ts +2 -2
- package/dist/generated/google/protobuf/timestamp.d.ts +2 -2
- package/dist/generated/packages/dht/protos/DhtRpc.client.d.ts +44 -44
- package/dist/generated/packages/dht/protos/DhtRpc.client.js +23 -23
- package/dist/generated/packages/dht/protos/DhtRpc.client.js.map +1 -1
- package/dist/generated/packages/dht/protos/DhtRpc.d.ts +100 -100
- package/dist/generated/packages/dht/protos/DhtRpc.js +12 -12
- package/dist/generated/packages/dht/protos/DhtRpc.js.map +1 -1
- package/dist/generated/packages/dht/protos/DhtRpc.server.d.ts +22 -22
- package/dist/generated/packages/proto-rpc/protos/ProtoRpc.d.ts +8 -8
- package/dist/generated/packages/proto-rpc/protos/ProtoRpc.js +1 -1
- package/dist/generated/packages/proto-rpc/protos/ProtoRpc.js.map +1 -1
- package/dist/package.json +11 -11
- package/dist/src/connection/ConnectionManager.d.ts +1 -1
- package/dist/src/connection/ConnectionManager.js +2 -3
- package/dist/src/connection/ConnectionManager.js.map +1 -1
- package/dist/src/connection/IConnection.d.ts +0 -4
- package/dist/src/connection/IConnection.js.map +1 -1
- package/dist/src/connection/ManagedConnection.d.ts +0 -2
- package/dist/src/connection/ManagedConnection.js +0 -1
- package/dist/src/connection/ManagedConnection.js.map +1 -1
- package/dist/src/connection/connectivityChecker.js +3 -3
- package/dist/src/connection/connectivityChecker.js.map +1 -1
- package/dist/src/connection/webrtc/BrowserWebrtcConnection.d.ts +4 -4
- package/dist/src/connection/webrtc/BrowserWebrtcConnection.js +15 -6
- package/dist/src/connection/webrtc/BrowserWebrtcConnection.js.map +1 -1
- package/dist/src/connection/webrtc/IWebrtcConnection.d.ts +2 -1
- package/dist/src/connection/webrtc/IWebrtcConnection.js.map +1 -1
- package/dist/src/connection/webrtc/NodeWebrtcConnection.d.ts +2 -4
- package/dist/src/connection/webrtc/NodeWebrtcConnection.js.map +1 -1
- package/dist/src/connection/websocket/AutoCertifierClientFacade.d.ts +1 -0
- package/dist/src/connection/websocket/AutoCertifierClientFacade.js +1 -1
- package/dist/src/connection/websocket/AutoCertifierClientFacade.js.map +1 -1
- package/dist/src/dht/DhtNode.d.ts +3 -3
- package/dist/src/dht/DhtNode.js +4 -3
- package/dist/src/dht/DhtNode.js.map +1 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationManager.js +3 -3
- package/dist/src/dht/recursive-operation/RecursiveOperationManager.js.map +1 -1
- package/dist/src/dht/routing/Router.js +6 -9
- package/dist/src/dht/routing/Router.js.map +1 -1
- package/dist/src/exports.d.ts +11 -11
- package/dist/src/exports.js.map +1 -1
- package/dist/src/helpers/createPeerDescriptor.d.ts +1 -1
- package/dist/src/helpers/createPeerDescriptor.js +7 -6
- package/dist/src/helpers/createPeerDescriptor.js.map +1 -1
- package/dist/src/transport/ITransport.d.ts +1 -2
- package/dist/src/transport/ITransport.js.map +1 -1
- package/package.json +11 -11
package/dist/src/exports.d.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
export { DhtNode, DhtNodeEvents, DhtNodeOptions } from './dht/DhtNode';
|
|
1
|
+
export { DhtNode, type DhtNodeEvents, type DhtNodeOptions } from './dht/DhtNode';
|
|
2
2
|
export { ListeningRpcCommunicator } from './transport/ListeningRpcCommunicator';
|
|
3
3
|
export { RoutingRpcCommunicator } from './transport/RoutingRpcCommunicator';
|
|
4
4
|
export { Simulator, LatencyType } from './connection/simulator/Simulator';
|
|
5
5
|
export { SimulatorTransport } from './connection/simulator/SimulatorTransport';
|
|
6
6
|
export { getRandomRegion, getRegionDelayMatrix } from './connection/simulator/pings';
|
|
7
7
|
export { PeerDescriptor, Message, NodeType, DataEntry } from '../generated/packages/dht/protos/DhtRpc';
|
|
8
|
-
export { ITransport, TransportEvents } from './transport/ITransport';
|
|
9
|
-
export { ConnectionManager, ConnectionLocker, PortRange, TlsCertificate } from './connection/ConnectionManager';
|
|
10
|
-
export { ConnectionsView } from './connection/ConnectionsView';
|
|
11
|
-
export { LockID } from './connection/ConnectionLockStates';
|
|
8
|
+
export type { ITransport, TransportEvents } from './transport/ITransport';
|
|
9
|
+
export { ConnectionManager, type ConnectionLocker, type PortRange, type TlsCertificate } from './connection/ConnectionManager';
|
|
10
|
+
export type { ConnectionsView } from './connection/ConnectionsView';
|
|
11
|
+
export type { LockID } from './connection/ConnectionLockStates';
|
|
12
12
|
export { DefaultConnectorFacade } from './connection/ConnectorFacade';
|
|
13
|
-
export { DhtRpcOptions } from './rpc-protocol/DhtRpcOptions';
|
|
13
|
+
export type { DhtRpcOptions } from './rpc-protocol/DhtRpcOptions';
|
|
14
14
|
export { RpcRemote, EXISTING_CONNECTION_TIMEOUT } from './dht/contact/RpcRemote';
|
|
15
|
-
export { IceServer } from './connection/webrtc/WebrtcConnector';
|
|
15
|
+
export type { IceServer } from './connection/webrtc/WebrtcConnector';
|
|
16
16
|
export { DhtCallContext } from './rpc-protocol/DhtCallContext';
|
|
17
17
|
export { WebsocketClientConnection } from './connection/websocket/NodeWebsocketClientConnection';
|
|
18
18
|
export { ManagedConnection } from './connection/ManagedConnection';
|
|
19
19
|
export { PendingConnection } from './connection/PendingConnection';
|
|
20
|
-
export { IConnection } from './connection/IConnection';
|
|
20
|
+
export type { IConnection } from './connection/IConnection';
|
|
21
21
|
export { ConnectionType } from './connection/IConnection';
|
|
22
|
-
export { ServiceID } from './types/ServiceID';
|
|
23
|
-
export { RingContacts } from './dht/contact/RingContactList';
|
|
22
|
+
export type { ServiceID } from './types/ServiceID';
|
|
23
|
+
export type { RingContacts } from './dht/contact/RingContactList';
|
|
24
24
|
export { createOutgoingHandshaker } from './connection/Handshaker';
|
|
25
|
-
export { DhtAddress, DhtAddressRaw, toDhtAddress, toDhtAddressRaw, randomDhtAddress, areEqualPeerDescriptors, toNodeId } from './identifiers';
|
|
25
|
+
export { type DhtAddress, type DhtAddressRaw, toDhtAddress, toDhtAddressRaw, randomDhtAddress, areEqualPeerDescriptors, toNodeId } from './identifiers';
|
package/dist/src/exports.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../../src/exports.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../../src/exports.ts"],"names":[],"mappings":";;;AAAA,yCAAgF;AAAvE,kGAAA,OAAO,OAAA;AAChB,iFAA+E;AAAtE,oIAAA,wBAAwB,OAAA;AACjC,6EAA2E;AAAlE,gIAAA,sBAAsB,OAAA;AAC/B,8DAAyE;AAAhE,sGAAA,SAAS,OAAA;AAAE,wGAAA,WAAW,OAAA;AAC/B,gFAA8E;AAArE,wHAAA,kBAAkB,OAAA;AAC3B,sDAAoF;AAA3E,wGAAA,eAAe,OAAA;AAAE,6GAAA,oBAAoB,OAAA;AAC9C,kEAAsG;AAA7F,wGAAA,cAAc,OAAA;AAAE,iGAAA,OAAO,OAAA;AAAE,kGAAA,QAAQ,OAAA;AAAE,mGAAA,SAAS,OAAA;AAErD,oEAA8H;AAArH,sHAAA,iBAAiB,OAAA;AAG1B,gEAAqE;AAA5D,yHAAA,sBAAsB,OAAA;AAE/B,qDAAgF;AAAvE,sGAAA,SAAS,OAAA;AAAE,wHAAA,2BAA2B,OAAA;AAE/C,gEAA8D;AAArD,gHAAA,cAAc,OAAA;AACvB,sGAAgG;AAAvF,0IAAA,yBAAyB,OAAA;AAClC,oEAAkE;AAAzD,sHAAA,iBAAiB,OAAA;AAC1B,oEAAkE;AAAzD,sHAAA,iBAAiB,OAAA;AAE1B,wDAAyD;AAAhD,6GAAA,cAAc,OAAA;AAGvB,sDAAkE;AAAzD,sHAAA,wBAAwB,OAAA;AACjC,6CAQsB;AALlB,2GAAA,YAAY,OAAA;AACZ,8GAAA,eAAe,OAAA;AACf,+GAAA,gBAAgB,OAAA;AAChB,sHAAA,uBAAuB,OAAA;AACvB,uGAAA,QAAQ,OAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { DhtAddress } from '../identifiers';
|
|
2
2
|
import { ConnectivityResponse, PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc';
|
|
3
|
-
export declare const createPeerDescriptor: (connectivityResponse: ConnectivityResponse, region: number, nodeId?: DhtAddress) => PeerDescriptor
|
|
3
|
+
export declare const createPeerDescriptor: (connectivityResponse: ConnectivityResponse, region: number, nodeId?: DhtAddress) => Promise<PeerDescriptor>;
|
|
@@ -10,7 +10,8 @@ const isBrowserEnvironment_1 = require("../helpers/browser/isBrowserEnvironment"
|
|
|
10
10
|
const createPeerDescriptorSignaturePayload_1 = require("../helpers/createPeerDescriptorSignaturePayload");
|
|
11
11
|
const identifiers_1 = require("../identifiers");
|
|
12
12
|
const DhtRpc_1 = require("../../generated/packages/dht/protos/DhtRpc");
|
|
13
|
-
const
|
|
13
|
+
const signingUtil = new utils_1.EcdsaSecp256k1Evm();
|
|
14
|
+
const calculateNodeIdRaw = async (ipAddress, privateKey) => {
|
|
14
15
|
// nodeId is calculated as
|
|
15
16
|
// concatenate(
|
|
16
17
|
// get104leastSignificatBits(hash(ipAddress)),
|
|
@@ -18,15 +19,15 @@ const calculateNodeIdRaw = (ipAddress, privateKey) => {
|
|
|
18
19
|
// )
|
|
19
20
|
const ipAsBuffer = Buffer.alloc(4);
|
|
20
21
|
ipAsBuffer.writeUInt32BE(ipAddress);
|
|
21
|
-
const ipHash =
|
|
22
|
-
const signature =
|
|
22
|
+
const ipHash = signingUtil.keccakHash(ipAsBuffer);
|
|
23
|
+
const signature = await signingUtil.createSignature(ipAsBuffer, privateKey);
|
|
23
24
|
const nodeIdRaw = Buffer.concat([
|
|
24
25
|
ipHash.subarray(ipHash.length - 13, ipHash.length),
|
|
25
26
|
signature.subarray(signature.length - 7, signature.length)
|
|
26
27
|
]);
|
|
27
28
|
return nodeIdRaw;
|
|
28
29
|
};
|
|
29
|
-
const createPeerDescriptor = (connectivityResponse, region, nodeId) => {
|
|
30
|
+
const createPeerDescriptor = async (connectivityResponse, region, nodeId) => {
|
|
30
31
|
const privateKey = crypto_1.default.randomBytes(32);
|
|
31
32
|
const publicKey = crypto_1.default.randomBytes(20); // TODO calculate publicKey from privateKey
|
|
32
33
|
let nodeIdRaw;
|
|
@@ -34,7 +35,7 @@ const createPeerDescriptor = (connectivityResponse, region, nodeId) => {
|
|
|
34
35
|
nodeIdRaw = (0, identifiers_1.toDhtAddressRaw)(nodeId);
|
|
35
36
|
}
|
|
36
37
|
else {
|
|
37
|
-
nodeIdRaw = calculateNodeIdRaw(connectivityResponse.ipAddress, privateKey);
|
|
38
|
+
nodeIdRaw = await calculateNodeIdRaw(connectivityResponse.ipAddress, privateKey);
|
|
38
39
|
}
|
|
39
40
|
const ret = {
|
|
40
41
|
nodeId: nodeIdRaw,
|
|
@@ -50,7 +51,7 @@ const createPeerDescriptor = (connectivityResponse, region, nodeId) => {
|
|
|
50
51
|
tls: connectivityResponse.websocket.tls
|
|
51
52
|
};
|
|
52
53
|
}
|
|
53
|
-
ret.signature =
|
|
54
|
+
ret.signature = await signingUtil.createSignature((0, createPeerDescriptorSignaturePayload_1.createPeerDescriptorSignaturePayload)(ret), privateKey);
|
|
54
55
|
return ret;
|
|
55
56
|
};
|
|
56
57
|
exports.createPeerDescriptor = createPeerDescriptor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPeerDescriptor.js","sourceRoot":"","sources":["../../../src/helpers/createPeerDescriptor.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"createPeerDescriptor.js","sourceRoot":"","sources":["../../../src/helpers/createPeerDescriptor.ts"],"names":[],"mappings":";;;;;;AAAA,0CAAkD;AAClD,oDAA2B;AAC3B,kFAA8E;AAC9E,0GAAsG;AACtG,gDAA2E;AAC3E,uEAImD;AAEnD,MAAM,WAAW,GAAG,IAAI,yBAAiB,EAAE,CAAA;AAE3C,MAAM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IAAA,2CAAoB,GAAE,CAAC,CAAC,CAAC,iBAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,iBAAQ,CAAC,MAAM;QACjE,SAAS,EAAE,oBAAoB,CAAC,SAAS;QACzC,MAAM;QACN,SAAS;KACZ,CAAA;IACD,IAAI,oBAAoB,CAAC,SAAS,EAAE,CAAC;QACjC,GAAG,CAAC,SAAS,GAAG;YACZ,IAAI,EAAE,oBAAoB,CAAC,SAAS,CAAC,IAAI;YACzC,IAAI,EAAE,oBAAoB,CAAC,SAAS,CAAC,IAAI;YACzC,GAAG,EAAE,oBAAoB,CAAC,SAAS,CAAC,GAAG;SAC1C,CAAA;IACL,CAAC;IACD,GAAG,CAAC,SAAS,GAAG,MAAM,WAAW,CAAC,eAAe,CAAC,IAAA,2EAAoC,EAAC,GAAG,CAAC,EAAE,UAAU,CAAC,CAAA;IACxG,OAAO,GAAG,CAAA;AACd,CAAC,CAAA;AA1BY,QAAA,oBAAoB,wBA0BhC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Message, PeerDescriptor } from '../../generated/packages/dht/protos/DhtRpc';
|
|
2
2
|
export interface TransportEvents {
|
|
3
|
+
connected: (peerDescriptor: PeerDescriptor) => void;
|
|
3
4
|
disconnected: (peerDescriptor: PeerDescriptor, gracefulLeave: boolean) => void;
|
|
4
5
|
message: (message: Message) => void;
|
|
5
|
-
connected: (peerDescriptor: PeerDescriptor) => void;
|
|
6
|
-
bufferedAmountChanged: (peerDescriptor: PeerDescriptor, bufferedAmount: number) => void;
|
|
7
6
|
}
|
|
8
7
|
export interface SendOptions {
|
|
9
8
|
connect: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ITransport.js","sourceRoot":"","sources":["../../../src/transport/ITransport.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ITransport.js","sourceRoot":"","sources":["../../../src/transport/ITransport.ts"],"names":[],"mappings":";;;AAca,QAAA,oBAAoB,GAAG;IAChC,OAAO,EAAE,IAAI;IACb,aAAa,EAAE,KAAK;IACpB,0BAA0B,EAAE,KAAK;CACpC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamr/dht",
|
|
3
|
-
"version": "103.0.0
|
|
3
|
+
"version": "103.0.0",
|
|
4
4
|
"description": "Streamr Network DHT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -40,33 +40,33 @@
|
|
|
40
40
|
"@js-sdsl/ordered-map": "^4.4.2",
|
|
41
41
|
"@protobuf-ts/runtime": "^2.8.2",
|
|
42
42
|
"@protobuf-ts/runtime-rpc": "^2.8.2",
|
|
43
|
-
"@streamr/autocertifier-client": "103.0.0
|
|
44
|
-
"@streamr/cdn-location": "103.0.0
|
|
45
|
-
"@streamr/geoip-location": "103.0.0
|
|
46
|
-
"@streamr/proto-rpc": "103.0.0
|
|
47
|
-
"@streamr/utils": "103.0.0
|
|
43
|
+
"@streamr/autocertifier-client": "103.0.0",
|
|
44
|
+
"@streamr/cdn-location": "103.0.0",
|
|
45
|
+
"@streamr/geoip-location": "103.0.0",
|
|
46
|
+
"@streamr/proto-rpc": "103.0.0",
|
|
47
|
+
"@streamr/utils": "103.0.0",
|
|
48
48
|
"eventemitter3": "^5.0.0",
|
|
49
49
|
"heap": "^0.2.6",
|
|
50
50
|
"ipaddr.js": "^2.0.1",
|
|
51
51
|
"k-bucket": "^5.1.0",
|
|
52
52
|
"lodash": "^4.17.21",
|
|
53
53
|
"lru-cache": "^11.1.0",
|
|
54
|
-
"node-datachannel": "^0.
|
|
54
|
+
"node-datachannel": "^0.27.0",
|
|
55
55
|
"uuid": "^11.1.0",
|
|
56
56
|
"websocket": "^1.0.34",
|
|
57
|
-
"ws": "^8.18.
|
|
57
|
+
"ws": "^8.18.2"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@streamr/browser-test-runner": "^0.0.1",
|
|
61
|
-
"@streamr/test-utils": "103.0.0
|
|
61
|
+
"@streamr/test-utils": "103.0.0",
|
|
62
62
|
"@types/heap": "^0.2.34",
|
|
63
63
|
"@types/k-bucket": "^5.0.1",
|
|
64
|
-
"@types/lodash": "^4.17.
|
|
64
|
+
"@types/lodash": "^4.17.17",
|
|
65
65
|
"@types/websocket": "^1.0.10",
|
|
66
66
|
"@types/ws": "^8.18.1",
|
|
67
67
|
"jest-leak-detector": "^27.3.1",
|
|
68
68
|
"jest-matcher-utils": "^29.7.0",
|
|
69
|
-
"ts-essentials": "^10.0
|
|
69
|
+
"ts-essentials": "^10.1.0",
|
|
70
70
|
"ts-node": "^10.9.2"
|
|
71
71
|
},
|
|
72
72
|
"optionalDependencies": {
|