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 NoiseExtensions {
11
12
webtransportCerthashes : Uint8Array [ ]
@@ -58,7 +59,7 @@ export namespace NoiseExtensions {
58
59
return _codec
59
60
}
60
61
61
- export const encode = ( obj : NoiseExtensions ) : Uint8Array => {
62
+ export const encode = ( obj : Partial < NoiseExtensions > ) : Uint8Array => {
62
63
return encodeMessage ( obj , NoiseExtensions . codec ( ) )
63
64
}
64
65
@@ -85,12 +86,12 @@ export namespace NoiseHandshakePayload {
85
86
86
87
if ( opts . writeDefaults === true || ( obj . identityKey != null && obj . identityKey . byteLength > 0 ) ) {
87
88
w . uint32 ( 10 )
88
- w . bytes ( obj . identityKey )
89
+ w . bytes ( obj . identityKey ?? new Uint8Array ( 0 ) )
89
90
}
90
91
91
92
if ( opts . writeDefaults === true || ( obj . identitySig != null && obj . identitySig . byteLength > 0 ) ) {
92
93
w . uint32 ( 18 )
93
- w . bytes ( obj . identitySig )
94
+ w . bytes ( obj . identitySig ?? new Uint8Array ( 0 ) )
94
95
}
95
96
96
97
if ( obj . extensions != null ) {
@@ -137,7 +138,7 @@ export namespace NoiseHandshakePayload {
137
138
return _codec
138
139
}
139
140
140
- export const encode = ( obj : NoiseHandshakePayload ) : Uint8Array => {
141
+ export const encode = ( obj : Partial < NoiseHandshakePayload > ) : Uint8Array => {
141
142
return encodeMessage ( obj , NoiseHandshakePayload . codec ( ) )
142
143
}
143
144
0 commit comments