This repository was archived by the owner on Jul 21, 2023. It is now read-only.
File tree 4 files changed +10
-11
lines changed
packages/libp2p-peer-id-factory
4 files changed +10
-11
lines changed Original file line number Diff line number Diff line change 147
147
"@libp2p/interface-peer-id" : " ^2.0.0" ,
148
148
"@libp2p/peer-id" : " ^2.0.0" ,
149
149
"multiformats" : " ^11.0.0" ,
150
- "protons-runtime" : " ^4 .0.1 " ,
150
+ "protons-runtime" : " ^5 .0.0 " ,
151
151
"uint8arraylist" : " ^2.0.0" ,
152
152
"uint8arrays" : " ^4.0.2"
153
153
},
154
154
"devDependencies" : {
155
155
"aegir" : " ^38.1.0" ,
156
- "protons" : " ^6 .0.0 " ,
156
+ "protons" : " ^7 .0.2 " ,
157
157
"util" : " ^0.12.4"
158
158
},
159
159
"typedoc" : {
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ export async function createFromProtobuf (buf: Uint8Array): Promise<PeerId> {
62
62
} = PeerIdProto . decode ( buf )
63
63
64
64
return await createFromParts (
65
- id ,
65
+ id ?? new Uint8Array ( 0 ) ,
66
66
privKey ,
67
67
pubKey
68
68
)
Original file line number Diff line number Diff line change 1
1
syntax = "proto3" ;
2
2
3
3
message PeerIdProto {
4
- required bytes id = 1 ;
4
+ optional bytes id = 1 ;
5
5
optional bytes pubKey = 2 ;
6
6
optional bytes privKey = 3 ;
7
7
}
Original file line number Diff line number Diff line change 2
2
/* eslint-disable complexity */
3
3
/* eslint-disable @typescript-eslint/no-namespace */
4
4
/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */
5
+ /* eslint-disable @typescript-eslint/no-empty-interface */
5
6
6
7
import { encodeMessage , decodeMessage , message } from 'protons-runtime'
7
- import type { Uint8ArrayList } from 'uint8arraylist'
8
8
import type { Codec } from 'protons-runtime'
9
+ import type { Uint8ArrayList } from 'uint8arraylist'
9
10
10
11
export interface PeerIdProto {
11
- id : Uint8Array
12
+ id ? : Uint8Array
12
13
pubKey ?: Uint8Array
13
14
privKey ?: Uint8Array
14
15
}
@@ -23,7 +24,7 @@ export namespace PeerIdProto {
23
24
w . fork ( )
24
25
}
25
26
26
- if ( opts . writeDefaults === true || ( obj . id != null && obj . id . byteLength > 0 ) ) {
27
+ if ( obj . id != null ) {
27
28
w . uint32 ( 10 )
28
29
w . bytes ( obj . id )
29
30
}
@@ -42,9 +43,7 @@ export namespace PeerIdProto {
42
43
w . ldelim ( )
43
44
}
44
45
} , ( reader , length ) => {
45
- const obj : any = {
46
- id : new Uint8Array ( 0 )
47
- }
46
+ const obj : any = { }
48
47
49
48
const end = length == null ? reader . len : reader . pos + length
50
49
@@ -74,7 +73,7 @@ export namespace PeerIdProto {
74
73
return _codec
75
74
}
76
75
77
- export const encode = ( obj : PeerIdProto ) : Uint8Array => {
76
+ export const encode = ( obj : Partial < PeerIdProto > ) : Uint8Array => {
78
77
return encodeMessage ( obj , PeerIdProto . codec ( ) )
79
78
}
80
79
You can’t perform that action at this time.
0 commit comments