@libp2p/floodsub 10.1.46 → 11.0.0-55b7e5fea
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/README.md +2 -2
- package/dist/index.min.js +9 -10
- package/dist/index.min.js.map +4 -4
- package/dist/src/constants.d.ts +6 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/constants.js +6 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/floodsub.d.ts +205 -0
- package/dist/src/floodsub.d.ts.map +1 -0
- package/dist/src/floodsub.js +641 -0
- package/dist/src/floodsub.js.map +1 -0
- package/dist/src/index.d.ts +221 -8
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +37 -88
- package/dist/src/index.js.map +1 -1
- package/dist/src/peer-streams.d.ts +71 -0
- package/dist/src/peer-streams.d.ts.map +1 -0
- package/dist/src/peer-streams.js +154 -0
- package/dist/src/peer-streams.js.map +1 -0
- package/dist/src/sign.d.ts +23 -0
- package/dist/src/sign.d.ts.map +1 -0
- package/dist/src/sign.js +75 -0
- package/dist/src/sign.js.map +1 -0
- package/dist/src/utils.d.ts +29 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/src/utils.js +129 -0
- package/dist/src/utils.js.map +1 -0
- package/package.json +25 -16
- package/src/constants.ts +5 -0
- package/src/floodsub.ts +794 -0
- package/src/index.ts +225 -97
- package/src/peer-streams.ts +200 -0
- package/src/sign.ts +93 -0
- package/src/utils.ts +157 -0
- package/dist/src/config.d.ts +0 -2
- package/dist/src/config.d.ts.map +0 -1
- package/dist/src/config.js +0 -2
- package/dist/src/config.js.map +0 -1
- package/dist/typedoc-urls.json +0 -9
- package/src/config.ts +0 -1
package/dist/src/sign.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { peerIdFromPrivateKey } from '@libp2p/peer-id';
|
|
2
|
+
import { concat as uint8ArrayConcat } from 'uint8arrays/concat';
|
|
3
|
+
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string';
|
|
4
|
+
import { toRpcMessage } from './utils.js';
|
|
5
|
+
export const SignPrefix = uint8ArrayFromString('libp2p-pubsub:');
|
|
6
|
+
/**
|
|
7
|
+
* Signs the provided message with the given `peerId`
|
|
8
|
+
*/
|
|
9
|
+
export async function signMessage(privateKey, message, encode) {
|
|
10
|
+
// @ts-expect-error signature field is missing, added below
|
|
11
|
+
const outputMessage = {
|
|
12
|
+
type: 'signed',
|
|
13
|
+
topic: message.topic,
|
|
14
|
+
data: message.data,
|
|
15
|
+
sequenceNumber: message.sequenceNumber,
|
|
16
|
+
from: peerIdFromPrivateKey(privateKey)
|
|
17
|
+
};
|
|
18
|
+
// Get the message in bytes, and prepend with the pubsub prefix
|
|
19
|
+
const bytes = uint8ArrayConcat([
|
|
20
|
+
SignPrefix,
|
|
21
|
+
encode(toRpcMessage(outputMessage)).subarray()
|
|
22
|
+
]);
|
|
23
|
+
outputMessage.signature = await privateKey.sign(bytes);
|
|
24
|
+
outputMessage.key = privateKey.publicKey;
|
|
25
|
+
return outputMessage;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Verifies the signature of the given message
|
|
29
|
+
*/
|
|
30
|
+
export async function verifySignature(message, encode) {
|
|
31
|
+
if (message.type !== 'signed') {
|
|
32
|
+
throw new Error('Message type must be "signed" to be verified');
|
|
33
|
+
}
|
|
34
|
+
if (message.signature == null) {
|
|
35
|
+
throw new Error('Message must contain a signature to be verified');
|
|
36
|
+
}
|
|
37
|
+
if (message.from == null) {
|
|
38
|
+
throw new Error('Message must contain a from property to be verified');
|
|
39
|
+
}
|
|
40
|
+
// Get message sans the signature
|
|
41
|
+
const bytes = uint8ArrayConcat([
|
|
42
|
+
SignPrefix,
|
|
43
|
+
encode({
|
|
44
|
+
...toRpcMessage(message),
|
|
45
|
+
signature: undefined,
|
|
46
|
+
key: undefined
|
|
47
|
+
}).subarray()
|
|
48
|
+
]);
|
|
49
|
+
// Get the public key
|
|
50
|
+
const pubKey = messagePublicKey(message);
|
|
51
|
+
// verify the base message
|
|
52
|
+
return pubKey.verify(bytes, message.signature);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Returns the PublicKey associated with the given message.
|
|
56
|
+
* If no valid PublicKey can be retrieved an error will be returned.
|
|
57
|
+
*/
|
|
58
|
+
export function messagePublicKey(message) {
|
|
59
|
+
if (message.type !== 'signed') {
|
|
60
|
+
throw new Error('Message type must be "signed" to have a public key');
|
|
61
|
+
}
|
|
62
|
+
// should be available in the from property of the message (peer id)
|
|
63
|
+
if (message.from == null) {
|
|
64
|
+
throw new Error('Could not get the public key from the originator id');
|
|
65
|
+
}
|
|
66
|
+
if (message.key != null) {
|
|
67
|
+
return message.key;
|
|
68
|
+
}
|
|
69
|
+
if (message.from.publicKey != null) {
|
|
70
|
+
return message.from.publicKey;
|
|
71
|
+
}
|
|
72
|
+
// We couldn't validate pubkey is from the originator, error
|
|
73
|
+
throw new Error('Could not get the public key from the originator id');
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=sign.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sign.js","sourceRoot":"","sources":["../../src/sign.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,MAAM,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC/D,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAKzC,MAAM,CAAC,MAAM,UAAU,GAAG,oBAAoB,CAAC,gBAAgB,CAAC,CAAA;AAEhE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAE,UAAsB,EAAE,OAAkF,EAAE,MAA6C;IAC1L,2DAA2D;IAC3D,MAAM,aAAa,GAAkB;QACnC,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE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K,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;AAChD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAE,OAAsB;IACtD,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAA;IACvE,CAAC;IAED,oEAAoE;IACpE,IAAI,OAAO,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAA;IACxE,CAAC;IAED,IAAI,OAAO,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC;QACxB,OAAO,OAAO,CAAC,GAAG,CAAA;IACpB,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,EAAE,CAAC;QACnC,OAAO,OAAO,CAAC,IAAI,CAAC,SAAS,CAAA;IAC/B,CAAC;IAED,4DAA4D;IAC5D,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAA;AACxE,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { PubSubRPCMessage } from './floodsub.ts';
|
|
2
|
+
import type { Message } from './index.ts';
|
|
3
|
+
import type { PublicKey } from '@libp2p/interface';
|
|
4
|
+
/**
|
|
5
|
+
* Generate a random sequence number
|
|
6
|
+
*/
|
|
7
|
+
export declare function randomSeqno(): bigint;
|
|
8
|
+
/**
|
|
9
|
+
* Generate a message id, based on the `key` and `seqno`
|
|
10
|
+
*/
|
|
11
|
+
export declare const msgId: (key: PublicKey, seqno: bigint) => Uint8Array;
|
|
12
|
+
/**
|
|
13
|
+
* Generate a message id, based on message `data`
|
|
14
|
+
*/
|
|
15
|
+
export declare const noSignMsgId: (data: Uint8Array) => Uint8Array | Promise<Uint8Array>;
|
|
16
|
+
/**
|
|
17
|
+
* Check if any member of the first set is also a member
|
|
18
|
+
* of the second set
|
|
19
|
+
*/
|
|
20
|
+
export declare const anyMatch: (a: Set<number> | number[], b: Set<number> | number[]) => boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Make everything an array
|
|
23
|
+
*/
|
|
24
|
+
export declare const ensureArray: <T>(maybeArray: T | T[]) => T[];
|
|
25
|
+
export declare const toMessage: (message: PubSubRPCMessage) => Promise<Message>;
|
|
26
|
+
export declare const toRpcMessage: (message: Message) => PubSubRPCMessage;
|
|
27
|
+
export declare const bigIntToBytes: (num: bigint) => Uint8Array;
|
|
28
|
+
export declare const bigIntFromBytes: (num: Uint8Array) => bigint;
|
|
29
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAElD;;GAEG;AACH,wBAAgB,WAAW,IAAK,MAAM,CAErC;AAED;;GAEG;AACH,eAAO,MAAM,KAAK,GAAI,KAAK,SAAS,EAAE,OAAO,MAAM,KAAG,UASrD,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,UAAU,KAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAE7E,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,QAAQ,GAAI,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,KAAG,OAe/E,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,GAAa,CAAC,EAAG,YAAY,CAAC,GAAG,CAAC,EAAE,KAAG,CAAC,EAM/D,CAAA;AAsBD,eAAO,MAAM,SAAS,GAAU,SAAS,gBAAgB,KAAG,OAAO,CAAC,OAAO,CA+B1E,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,SAAS,OAAO,KAAG,gBAiB/C,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,KAAG,UAQ3C,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,KAAK,UAAU,KAAG,MAEjD,CAAA"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { randomBytes } from '@libp2p/crypto';
|
|
2
|
+
import { publicKeyFromProtobuf, publicKeyToProtobuf } from '@libp2p/crypto/keys';
|
|
3
|
+
import { InvalidMessageError } from '@libp2p/interface';
|
|
4
|
+
import { peerIdFromMultihash, peerIdFromPublicKey } from '@libp2p/peer-id';
|
|
5
|
+
import * as Digest from 'multiformats/hashes/digest';
|
|
6
|
+
import { sha256 } from 'multiformats/hashes/sha2';
|
|
7
|
+
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string';
|
|
8
|
+
import { toString as uint8ArrayToString } from 'uint8arrays/to-string';
|
|
9
|
+
/**
|
|
10
|
+
* Generate a random sequence number
|
|
11
|
+
*/
|
|
12
|
+
export function randomSeqno() {
|
|
13
|
+
return BigInt(`0x${uint8ArrayToString(randomBytes(8), 'base16')}`);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Generate a message id, based on the `key` and `seqno`
|
|
17
|
+
*/
|
|
18
|
+
export const msgId = (key, seqno) => {
|
|
19
|
+
const seqnoBytes = uint8ArrayFromString(seqno.toString(16).padStart(16, '0'), 'base16');
|
|
20
|
+
const keyBytes = publicKeyToProtobuf(key);
|
|
21
|
+
const msgId = new Uint8Array(keyBytes.byteLength + seqnoBytes.length);
|
|
22
|
+
msgId.set(keyBytes, 0);
|
|
23
|
+
msgId.set(seqnoBytes, keyBytes.byteLength);
|
|
24
|
+
return msgId;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Generate a message id, based on message `data`
|
|
28
|
+
*/
|
|
29
|
+
export const noSignMsgId = (data) => {
|
|
30
|
+
return sha256.encode(data);
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Check if any member of the first set is also a member
|
|
34
|
+
* of the second set
|
|
35
|
+
*/
|
|
36
|
+
export const anyMatch = (a, b) => {
|
|
37
|
+
let bHas;
|
|
38
|
+
if (Array.isArray(b)) {
|
|
39
|
+
bHas = (val) => b.includes(val);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
bHas = (val) => b.has(val);
|
|
43
|
+
}
|
|
44
|
+
for (const val of a) {
|
|
45
|
+
if (bHas(val)) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return false;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Make everything an array
|
|
53
|
+
*/
|
|
54
|
+
export const ensureArray = function (maybeArray) {
|
|
55
|
+
if (!Array.isArray(maybeArray)) {
|
|
56
|
+
return [maybeArray];
|
|
57
|
+
}
|
|
58
|
+
return maybeArray;
|
|
59
|
+
};
|
|
60
|
+
const isSigned = async (message) => {
|
|
61
|
+
if ((message.sequenceNumber == null) || (message.from == null) || (message.signature == null)) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
// if a public key is present in the `from` field, the message should be signed
|
|
65
|
+
const fromID = peerIdFromMultihash(Digest.decode(message.from));
|
|
66
|
+
if (fromID.publicKey != null) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
if (message.key != null) {
|
|
70
|
+
const signingKey = message.key;
|
|
71
|
+
const signingID = peerIdFromPublicKey(publicKeyFromProtobuf(signingKey));
|
|
72
|
+
return signingID.equals(fromID);
|
|
73
|
+
}
|
|
74
|
+
return false;
|
|
75
|
+
};
|
|
76
|
+
export const toMessage = async (message) => {
|
|
77
|
+
if (message.from == null) {
|
|
78
|
+
throw new InvalidMessageError('RPC message was missing from');
|
|
79
|
+
}
|
|
80
|
+
if (!await isSigned(message)) {
|
|
81
|
+
return {
|
|
82
|
+
type: 'unsigned',
|
|
83
|
+
topic: message.topic ?? '',
|
|
84
|
+
data: message.data ?? new Uint8Array(0)
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
const from = peerIdFromMultihash(Digest.decode(message.from));
|
|
88
|
+
const key = message.key ?? from.publicKey;
|
|
89
|
+
if (key == null) {
|
|
90
|
+
throw new InvalidMessageError('RPC message was missing public key');
|
|
91
|
+
}
|
|
92
|
+
const msg = {
|
|
93
|
+
type: 'signed',
|
|
94
|
+
from,
|
|
95
|
+
topic: message.topic ?? '',
|
|
96
|
+
sequenceNumber: bigIntFromBytes(message.sequenceNumber ?? new Uint8Array(0)),
|
|
97
|
+
data: message.data ?? new Uint8Array(0),
|
|
98
|
+
signature: message.signature ?? new Uint8Array(0),
|
|
99
|
+
key: key instanceof Uint8Array ? publicKeyFromProtobuf(key) : key
|
|
100
|
+
};
|
|
101
|
+
return msg;
|
|
102
|
+
};
|
|
103
|
+
export const toRpcMessage = (message) => {
|
|
104
|
+
if (message.type === 'signed') {
|
|
105
|
+
return {
|
|
106
|
+
from: message.from.toMultihash().bytes,
|
|
107
|
+
data: message.data,
|
|
108
|
+
sequenceNumber: bigIntToBytes(message.sequenceNumber),
|
|
109
|
+
topic: message.topic,
|
|
110
|
+
signature: message.signature,
|
|
111
|
+
key: message.key ? publicKeyToProtobuf(message.key) : undefined
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
data: message.data,
|
|
116
|
+
topic: message.topic
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
export const bigIntToBytes = (num) => {
|
|
120
|
+
let str = num.toString(16);
|
|
121
|
+
if (str.length % 2 !== 0) {
|
|
122
|
+
str = `0${str}`;
|
|
123
|
+
}
|
|
124
|
+
return uint8ArrayFromString(str, 'base16');
|
|
125
|
+
};
|
|
126
|
+
export const bigIntFromBytes = (num) => {
|
|
127
|
+
return BigInt(`0x${uint8ArrayToString(num, 'base16')}`);
|
|
128
|
+
};
|
|
129
|
+
//# sourceMappingURL=utils.js.map
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AAM,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,GAAG,GAAG,IAAI,GAAG,EAAE,CAAA;IACjB,CAAC;IAED,OAAO,oBAAoB,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;AAC5C,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAe,EAAU,EAAE;IACzD,OAAO,MAAM,CAAC,KAAK,kBAAkB,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAA;AACzD,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/floodsub",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0-55b7e5fea",
|
|
4
4
|
"description": "libp2p-floodsub, also known as pubsub-flood or just dumbsub, this implementation of pubsub focused on delivering an API for Publish/Subscribe, but with no CastTree Forming (it just floods the network).",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
|
-
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/
|
|
6
|
+
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/floodsub#readme",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/libp2p/js-libp2p.git"
|
|
@@ -53,25 +53,34 @@
|
|
|
53
53
|
"test:electron-main": "aegir test -t electron-main"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@libp2p/
|
|
57
|
-
"@libp2p/
|
|
58
|
-
"
|
|
56
|
+
"@libp2p/crypto": "5.1.9-55b7e5fea",
|
|
57
|
+
"@libp2p/interface": "3.0.0-55b7e5fea",
|
|
58
|
+
"@libp2p/interface-internal": "3.0.0-55b7e5fea",
|
|
59
|
+
"@libp2p/peer-collections": "7.0.0-55b7e5fea",
|
|
60
|
+
"@libp2p/peer-id": "6.0.0-55b7e5fea",
|
|
61
|
+
"@libp2p/utils": "7.0.0-55b7e5fea",
|
|
62
|
+
"it-length-prefixed": "^10.0.1",
|
|
63
|
+
"it-pipe": "^3.0.1",
|
|
64
|
+
"it-pushable": "^3.2.3",
|
|
65
|
+
"main-event": "^1.0.1",
|
|
66
|
+
"multiformats": "^13.4.1",
|
|
67
|
+
"p-event": "^7.0.0",
|
|
68
|
+
"p-queue": "^8.1.1",
|
|
69
|
+
"protons-runtime": "^5.6.0",
|
|
59
70
|
"uint8arraylist": "^2.4.8",
|
|
60
71
|
"uint8arrays": "^5.1.0"
|
|
61
72
|
},
|
|
62
73
|
"devDependencies": {
|
|
63
|
-
"@libp2p/
|
|
64
|
-
"@
|
|
65
|
-
"@libp2p/logger": "^5.2.0",
|
|
66
|
-
"@libp2p/peer-collections": "^6.0.35",
|
|
67
|
-
"@libp2p/peer-id": "^5.1.9",
|
|
68
|
-
"@multiformats/multiaddr": "^12.4.4",
|
|
74
|
+
"@libp2p/logger": "6.0.0-55b7e5fea",
|
|
75
|
+
"@multiformats/multiaddr": "^13.0.1",
|
|
69
76
|
"@types/sinon": "^17.0.4",
|
|
70
|
-
"aegir": "^47.0.
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
77
|
+
"aegir": "^47.0.22",
|
|
78
|
+
"delay": "^6.0.0",
|
|
79
|
+
"it-all": "^3.0.9",
|
|
80
|
+
"p-wait-for": "^6.0.0",
|
|
81
|
+
"protons": "^7.7.0",
|
|
82
|
+
"sinon": "^21.0.0",
|
|
83
|
+
"sinon-ts": "^2.0.0"
|
|
75
84
|
},
|
|
76
85
|
"sideEffects": false
|
|
77
86
|
}
|