@libp2p/floodsub 10.1.46-6059227cb → 10.1.46-8484de8a2

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.
@@ -1,71 +0,0 @@
1
- import { TypedEventEmitter } from 'main-event';
2
- import { Uint8ArrayList } from 'uint8arraylist';
3
- import type { PeerStreamEvents } from './index.ts';
4
- import type { ComponentLogger, Stream, PeerId } from '@libp2p/interface';
5
- import type { DecoderOptions as LpDecoderOptions } from 'it-length-prefixed';
6
- import type { Pushable } from 'it-pushable';
7
- export interface PeerStreamsInit {
8
- id: PeerId;
9
- protocol: string;
10
- }
11
- export interface PeerStreamsComponents {
12
- logger: ComponentLogger;
13
- }
14
- export interface DecoderOptions extends LpDecoderOptions {
15
- }
16
- /**
17
- * Thin wrapper around a peer's inbound / outbound pubsub streams
18
- */
19
- export declare class PeerStreams extends TypedEventEmitter<PeerStreamEvents> {
20
- readonly id: PeerId;
21
- readonly protocol: string;
22
- /**
23
- * Write stream - it's preferable to use the write method
24
- */
25
- outboundStream?: Pushable<Uint8ArrayList>;
26
- /**
27
- * Read stream
28
- */
29
- inboundStream?: AsyncIterable<Uint8ArrayList>;
30
- /**
31
- * The raw outbound stream, as retrieved from conn.newStream
32
- */
33
- private _rawOutboundStream?;
34
- /**
35
- * The raw inbound stream, as retrieved from the callback from libp2p.handle
36
- */
37
- private _rawInboundStream?;
38
- /**
39
- * An AbortController for controlled shutdown of the inbound stream
40
- */
41
- private readonly _inboundAbortController;
42
- private closed;
43
- private readonly log;
44
- constructor(components: PeerStreamsComponents, init: PeerStreamsInit);
45
- /**
46
- * Do we have a connection to read from?
47
- */
48
- get isReadable(): boolean;
49
- /**
50
- * Do we have a connection to write on?
51
- */
52
- get isWritable(): boolean;
53
- /**
54
- * Send a message to this peer.
55
- * Throws if there is no `stream` to write to available.
56
- */
57
- write(data: Uint8Array | Uint8ArrayList): void;
58
- /**
59
- * Attach a raw inbound stream and setup a read stream
60
- */
61
- attachInboundStream(stream: Stream, decoderOptions?: DecoderOptions): AsyncIterable<Uint8ArrayList>;
62
- /**
63
- * Attach a raw outbound stream and setup a write stream
64
- */
65
- attachOutboundStream(stream: Stream): Promise<Pushable<Uint8ArrayList>>;
66
- /**
67
- * Closes the open connection to peer
68
- */
69
- close(): void;
70
- }
71
- //# sourceMappingURL=peer-streams.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"peer-streams.d.ts","sourceRoot":"","sources":["../../src/peer-streams.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,KAAK,EAAE,eAAe,EAAU,MAAM,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAChF,OAAO,KAAK,EAAE,cAAc,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC5E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAE3C,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,eAAe,CAAA;CACxB;AAED,MAAM,WAAW,cAAe,SAAQ,gBAAgB;CAEvD;AAED;;GAEG;AACH,qBAAa,WAAY,SAAQ,iBAAiB,CAAC,gBAAgB,CAAC;IAClE,SAAgB,EAAE,EAAE,MAAM,CAAA;IAC1B,SAAgB,QAAQ,EAAE,MAAM,CAAA;IAChC;;OAEG;IACI,cAAc,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAA;IAChD;;OAEG;IACI,aAAa,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IACpD;;OAEG;IACH,OAAO,CAAC,kBAAkB,CAAC,CAAQ;IACnC;;OAEG;IACH,OAAO,CAAC,iBAAiB,CAAC,CAAQ;IAClC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAiB;IACzD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAQ;gBAEf,UAAU,EAAE,qBAAqB,EAAE,IAAI,EAAE,eAAe;IAWrE;;OAEG;IACH,IAAI,UAAU,IAAK,OAAO,CAEzB;IAED;;OAEG;IACH,IAAI,UAAU,IAAK,OAAO,CAEzB;IAED;;;OAGG;IACH,KAAK,CAAE,IAAI,EAAE,UAAU,GAAG,cAAc,GAAG,IAAI;IAS/C;;OAEG;IACH,mBAAmB,CAAE,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,cAAc,GAAG,aAAa,CAAC,cAAc,CAAC;IAuBpG;;OAEG;IACG,oBAAoB,CAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;IAqD9E;;OAEG;IACH,KAAK,IAAK,IAAI;CAsBf"}
@@ -1,154 +0,0 @@
1
- import { AbortError } from '@libp2p/interface';
2
- import { pipe } from '@libp2p/utils';
3
- import * as lp from 'it-length-prefixed';
4
- import { pushable } from 'it-pushable';
5
- import { TypedEventEmitter } from 'main-event';
6
- import { pEvent } from 'p-event';
7
- import { Uint8ArrayList } from 'uint8arraylist';
8
- /**
9
- * Thin wrapper around a peer's inbound / outbound pubsub streams
10
- */
11
- export class PeerStreams extends TypedEventEmitter {
12
- id;
13
- protocol;
14
- /**
15
- * Write stream - it's preferable to use the write method
16
- */
17
- outboundStream;
18
- /**
19
- * Read stream
20
- */
21
- inboundStream;
22
- /**
23
- * The raw outbound stream, as retrieved from conn.newStream
24
- */
25
- _rawOutboundStream;
26
- /**
27
- * The raw inbound stream, as retrieved from the callback from libp2p.handle
28
- */
29
- _rawInboundStream;
30
- /**
31
- * An AbortController for controlled shutdown of the inbound stream
32
- */
33
- _inboundAbortController;
34
- closed;
35
- log;
36
- constructor(components, init) {
37
- super();
38
- this.log = components.logger.forComponent('libp2p-pubsub:peer-streams');
39
- this.id = init.id;
40
- this.protocol = init.protocol;
41
- this._inboundAbortController = new AbortController();
42
- this.closed = false;
43
- }
44
- /**
45
- * Do we have a connection to read from?
46
- */
47
- get isReadable() {
48
- return Boolean(this.inboundStream);
49
- }
50
- /**
51
- * Do we have a connection to write on?
52
- */
53
- get isWritable() {
54
- return Boolean(this.outboundStream);
55
- }
56
- /**
57
- * Send a message to this peer.
58
- * Throws if there is no `stream` to write to available.
59
- */
60
- write(data) {
61
- if (this.outboundStream == null) {
62
- const id = this.id.toString();
63
- throw new Error('No writable connection to ' + id);
64
- }
65
- this.outboundStream.push(data instanceof Uint8Array ? new Uint8ArrayList(data) : data);
66
- }
67
- /**
68
- * Attach a raw inbound stream and setup a read stream
69
- */
70
- attachInboundStream(stream, decoderOptions) {
71
- const abortListener = () => {
72
- stream.abort(new AbortError());
73
- };
74
- this._inboundAbortController.signal.addEventListener('abort', abortListener, {
75
- once: true
76
- });
77
- // Create and attach a new inbound stream
78
- // The inbound stream is:
79
- // - abortable, set to only return on abort, rather than throw
80
- // - transformed with length-prefix transform
81
- this._rawInboundStream = stream;
82
- this.inboundStream = pipe(this._rawInboundStream, (source) => lp.decode(source, decoderOptions));
83
- this.dispatchEvent(new CustomEvent('stream:inbound'));
84
- return this.inboundStream;
85
- }
86
- /**
87
- * Attach a raw outbound stream and setup a write stream
88
- */
89
- async attachOutboundStream(stream) {
90
- // If an outbound stream already exists, gently close it
91
- const _prevStream = this.outboundStream;
92
- if (this.outboundStream != null) {
93
- // End the stream without emitting a close event
94
- this.outboundStream.end();
95
- }
96
- this._rawOutboundStream = stream;
97
- this.outboundStream = pushable({
98
- onEnd: (shouldEmit) => {
99
- // close writable side of the stream if it exists
100
- this._rawOutboundStream?.close()
101
- .catch(err => {
102
- this.log('error closing outbound stream', err);
103
- });
104
- this._rawOutboundStream = undefined;
105
- this.outboundStream = undefined;
106
- if (shouldEmit != null) {
107
- this.dispatchEvent(new CustomEvent('close'));
108
- }
109
- }
110
- });
111
- pipe(this.outboundStream, (source) => lp.encode(source), async (source) => {
112
- for await (const buf of source) {
113
- const sendMore = stream.send(buf);
114
- if (sendMore === false) {
115
- await pEvent(stream, 'drain', {
116
- rejectionEvents: [
117
- 'close'
118
- ]
119
- });
120
- }
121
- }
122
- }).catch((err) => {
123
- this.log.error(err);
124
- });
125
- // Only emit if the connection is new
126
- if (_prevStream == null) {
127
- this.dispatchEvent(new CustomEvent('stream:outbound'));
128
- }
129
- return this.outboundStream;
130
- }
131
- /**
132
- * Closes the open connection to peer
133
- */
134
- close() {
135
- if (this.closed) {
136
- return;
137
- }
138
- this.closed = true;
139
- // End the outbound stream
140
- if (this.outboundStream != null) {
141
- this.outboundStream.end();
142
- }
143
- // End the inbound stream
144
- if (this.inboundStream != null) {
145
- this._inboundAbortController.abort();
146
- }
147
- this._rawOutboundStream = undefined;
148
- this.outboundStream = undefined;
149
- this._rawInboundStream = undefined;
150
- this.inboundStream = undefined;
151
- this.dispatchEvent(new CustomEvent('close'));
152
- }
153
- }
154
- //# sourceMappingURL=peer-streams.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"peer-streams.js","sourceRoot":"","sources":["../../src/peer-streams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,OAAO,KAAK,EAAE,MAAM,oBAAoB,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAmB/C;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAAmC;IAClD,EAAE,CAAQ;IACV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BAAyB;QACzB,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI,EAAE,CAAC;YAC/B,IAAI,CAAC,uBAAuB,CAAC,KAAK,EAAE,CAAA;QACtC,CAAC;QAED,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAA;QACnC,IAAI,CAAC,cAAc,GAAG,SAAS,CAAA;QAC/B,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAA;QAClC,IAAI,CAAC,aAAa,GAAG,SAAS,CAAA;QAC9B,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC,CAAA;IAC9C,CAAC;CACF"}
@@ -1,23 +0,0 @@
1
- import type { PubSubRPCMessage } from './floodsub.ts';
2
- import type { SignedMessage } from './index.ts';
3
- import type { PeerId, PrivateKey, PublicKey } from '@libp2p/interface';
4
- export declare const SignPrefix: Uint8Array<ArrayBufferLike>;
5
- /**
6
- * Signs the provided message with the given `peerId`
7
- */
8
- export declare function signMessage(privateKey: PrivateKey, message: {
9
- from: PeerId;
10
- topic: string;
11
- data: Uint8Array;
12
- sequenceNumber: bigint;
13
- }, encode: (rpc: PubSubRPCMessage) => Uint8Array): Promise<SignedMessage>;
14
- /**
15
- * Verifies the signature of the given message
16
- */
17
- export declare function verifySignature(message: SignedMessage, encode: (rpc: PubSubRPCMessage) => Uint8Array): Promise<boolean>;
18
- /**
19
- * Returns the PublicKey associated with the given message.
20
- * If no valid PublicKey can be retrieved an error will be returned.
21
- */
22
- export declare function messagePublicKey(message: SignedMessage): PublicKey;
23
- //# sourceMappingURL=sign.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sign.d.ts","sourceRoot":"","sources":["../../src/sign.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAEtE,eAAO,MAAM,UAAU,6BAAyC,CAAA;AAEhE;;GAEG;AACH,wBAAsB,WAAW,CAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,UAAU,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,CAoBpN;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CA4B9H;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAE,OAAO,EAAE,aAAa,GAAG,SAAS,CAoBnE"}
package/dist/src/sign.js DELETED
@@ -1,75 +0,0 @@
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
@@ -1 +0,0 @@
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,EA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,MAAM,MAAM,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAA;IAExC,0BAA0B;IAC1B,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,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"}
@@ -1,29 +0,0 @@
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
@@ -1 +0,0 @@
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"}
package/dist/src/utils.js DELETED
@@ -1,129 +0,0 @@
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
@@ -1 +0,0 @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AAE,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/src/constants.ts DELETED
@@ -1,5 +0,0 @@
1
- /**
2
- * All Pubsub implementations must use this symbol as the name of a property
3
- * with a boolean `true` value
4
- */
5
- export const pubSubSymbol = Symbol.for('@libp2p/pubsub')