@libp2p/pubsub 1.2.14 → 1.2.15
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/src/utils.d.ts +2 -2
- package/package.json +1 -1
- package/src/utils.ts +2 -2
package/dist/src/utils.d.ts
CHANGED
@@ -2,11 +2,11 @@ import type { Message, PubSubRPCMessage } from '@libp2p/interfaces/pubsub';
|
|
2
2
|
/**
|
3
3
|
* Generate a random sequence number
|
4
4
|
*/
|
5
|
-
export declare function randomSeqno():
|
5
|
+
export declare function randomSeqno(): bigint;
|
6
6
|
/**
|
7
7
|
* Generate a message id, based on the `key` and `seqno`
|
8
8
|
*/
|
9
|
-
export declare const msgId: (key: Uint8Array, seqno:
|
9
|
+
export declare const msgId: (key: Uint8Array, seqno: bigint) => Uint8Array;
|
10
10
|
/**
|
11
11
|
* Generate a message id, based on message `data`
|
12
12
|
*/
|
package/package.json
CHANGED
package/src/utils.ts
CHANGED
@@ -10,14 +10,14 @@ import errcode from 'err-code'
|
|
10
10
|
/**
|
11
11
|
* Generate a random sequence number
|
12
12
|
*/
|
13
|
-
export function randomSeqno ():
|
13
|
+
export function randomSeqno (): bigint {
|
14
14
|
return BigInt(`0x${uint8ArrayToString(randomBytes(8), 'base16')}`)
|
15
15
|
}
|
16
16
|
|
17
17
|
/**
|
18
18
|
* Generate a message id, based on the `key` and `seqno`
|
19
19
|
*/
|
20
|
-
export const msgId = (key: Uint8Array, seqno:
|
20
|
+
export const msgId = (key: Uint8Array, seqno: bigint) => {
|
21
21
|
const seqnoBytes = uint8ArrayFromString(seqno.toString(16).padStart(16, '0'), 'base16')
|
22
22
|
|
23
23
|
const msgId = new Uint8Array(key.length + seqnoBytes.length)
|