Skip to content

Commit cc5f8b1

Browse files
authored
fix: update protons (#269)
1 parent 0235234 commit cc5f8b1

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
"it-pb-stream": "^2.0.2",
8484
"it-pipe": "^2.0.3",
8585
"it-stream-types": "^1.0.4",
86-
"protons-runtime": "^4.0.1",
86+
"protons-runtime": "^5.0.0",
8787
"uint8arraylist": "^2.3.2",
8888
"uint8arrays": "^4.0.2"
8989
},
@@ -104,7 +104,7 @@
104104
"libp2p": "^0.42.0",
105105
"mkdirp": "^2.0.0",
106106
"p-defer": "^4.0.0",
107-
"protons": "^6.0.0",
107+
"protons": "^7.0.0",
108108
"sinon": "^15.0.0",
109109
"util": "^0.12.4"
110110
},

src/proto/payload.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
/* eslint-disable complexity */
33
/* eslint-disable @typescript-eslint/no-namespace */
44
/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */
5+
/* eslint-disable @typescript-eslint/no-empty-interface */
56

67
import { encodeMessage, decodeMessage, message } from 'protons-runtime'
7-
import type { Uint8ArrayList } from 'uint8arraylist'
88
import type { Codec } from 'protons-runtime'
9+
import type { Uint8ArrayList } from 'uint8arraylist'
910

1011
export interface NoiseExtensions {
1112
webtransportCerthashes: Uint8Array[]
@@ -58,7 +59,7 @@ export namespace NoiseExtensions {
5859
return _codec
5960
}
6061

61-
export const encode = (obj: NoiseExtensions): Uint8Array => {
62+
export const encode = (obj: Partial<NoiseExtensions>): Uint8Array => {
6263
return encodeMessage(obj, NoiseExtensions.codec())
6364
}
6465

@@ -85,12 +86,12 @@ export namespace NoiseHandshakePayload {
8586

8687
if (opts.writeDefaults === true || (obj.identityKey != null && obj.identityKey.byteLength > 0)) {
8788
w.uint32(10)
88-
w.bytes(obj.identityKey)
89+
w.bytes(obj.identityKey ?? new Uint8Array(0))
8990
}
9091

9192
if (opts.writeDefaults === true || (obj.identitySig != null && obj.identitySig.byteLength > 0)) {
9293
w.uint32(18)
93-
w.bytes(obj.identitySig)
94+
w.bytes(obj.identitySig ?? new Uint8Array(0))
9495
}
9596

9697
if (obj.extensions != null) {
@@ -137,7 +138,7 @@ export namespace NoiseHandshakePayload {
137138
return _codec
138139
}
139140

140-
export const encode = (obj: NoiseHandshakePayload): Uint8Array => {
141+
export const encode = (obj: Partial<NoiseHandshakePayload>): Uint8Array => {
141142
return encodeMessage(obj, NoiseHandshakePayload.codec())
142143
}
143144

0 commit comments

Comments
 (0)