Skip to content

Commit

Permalink
fix: proto file to pass interop tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mpetrunic committed Oct 5, 2022
1 parent bc4d509 commit 06f5673
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/proto/payload.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ message NoiseExtensions {
message NoiseHandshakePayload {
bytes identity_key = 1;
bytes identity_sig = 2;
NoiseExtensions extensions = 4;
optional NoiseExtensions extensions = 4;
}
11 changes: 2 additions & 9 deletions src/proto/payload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export namespace NoiseExtensions {
export interface NoiseHandshakePayload {
identityKey: Uint8Array
identitySig: Uint8Array
extensions: NoiseExtensions
extensions?: NoiseExtensions
}

export namespace NoiseHandshakePayload {
Expand Down Expand Up @@ -100,8 +100,6 @@ export namespace NoiseHandshakePayload {
if (obj.extensions != null) {
writer.uint32(34)
NoiseExtensions.codec().encode(obj.extensions, writer)
} else {
throw new Error('Protocol error: required field "extensions" was not found in object')
}

if (opts.lengthDelimited !== false) {
Expand All @@ -110,8 +108,7 @@ export namespace NoiseHandshakePayload {
}, (reader, length) => {
const obj: any = {
identityKey: new Uint8Array(0),
identitySig: new Uint8Array(0),
extensions: undefined
identitySig: new Uint8Array(0)
}

const end = length == null ? reader.len : reader.pos + length
Expand Down Expand Up @@ -143,10 +140,6 @@ export namespace NoiseHandshakePayload {
throw new Error('Protocol error: value for required field "identitySig" was not found in protobuf')
}

if (obj.extensions == null) {
throw new Error('Protocol error: value for required field "extensions" was not found in protobuf')
}

return obj
})
}
Expand Down

0 comments on commit 06f5673

Please sign in to comment.