Skip to content

Commit 2fbcdb6

Browse files
authored
fix: always send key type (#3028)
Mark the field `optional` so we always send it on the wire, otherwise proto2 decoders that have it marked `required` will fail to decode the incoming message.
1 parent 2c8ecb4 commit 2fbcdb6

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

packages/connection-encrypter-plaintext/src/pb/proto.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ enum KeyType {
1313
}
1414

1515
message PublicKey {
16-
KeyType Type = 1;
16+
optional KeyType Type = 1;
1717
bytes Data = 2;
18-
}
18+
}

packages/connection-encrypter-plaintext/src/pb/proto.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export namespace KeyType {
9898
}
9999
}
100100
export interface PublicKey {
101-
Type: KeyType
101+
Type?: KeyType
102102
Data: Uint8Array
103103
}
104104

@@ -112,7 +112,7 @@ export namespace PublicKey {
112112
w.fork()
113113
}
114114

115-
if (obj.Type != null && __KeyTypeValues[obj.Type] !== 0) {
115+
if (obj.Type != null) {
116116
w.uint32(8)
117117
KeyType.codec().encode(obj.Type, w)
118118
}
@@ -127,7 +127,6 @@ export namespace PublicKey {
127127
}
128128
}, (reader, length, opts = {}) => {
129129
const obj: any = {
130-
Type: KeyType.RSA,
131130
Data: uint8ArrayAlloc(0)
132131
}
133132

0 commit comments

Comments
 (0)