From 44a04a94281c993e7ad356ddf3f11e65fd401664 Mon Sep 17 00:00:00 2001 From: Marin Petrunic Date: Thu, 2 Feb 2023 13:09:25 +0100 Subject: [PATCH] fix: update protons --- package.json | 4 ++-- src/proto/payload.ts | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 12060f51..8758efae 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "it-pb-stream": "^2.0.2", "it-pipe": "^2.0.3", "it-stream-types": "^1.0.4", - "protons-runtime": "^4.0.1", + "protons-runtime": "^5.0.0", "uint8arraylist": "^2.3.2", "uint8arrays": "^4.0.2" }, @@ -104,7 +104,7 @@ "libp2p": "^0.42.0", "mkdirp": "^2.0.0", "p-defer": "^4.0.0", - "protons": "^6.0.0", + "protons": "^7.0.0", "sinon": "^15.0.0", "util": "^0.12.4" }, diff --git a/src/proto/payload.ts b/src/proto/payload.ts index 2da5436a..50acd62e 100644 --- a/src/proto/payload.ts +++ b/src/proto/payload.ts @@ -2,10 +2,11 @@ /* eslint-disable complexity */ /* eslint-disable @typescript-eslint/no-namespace */ /* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */ +/* eslint-disable @typescript-eslint/no-empty-interface */ import { encodeMessage, decodeMessage, message } from 'protons-runtime' -import type { Uint8ArrayList } from 'uint8arraylist' import type { Codec } from 'protons-runtime' +import type { Uint8ArrayList } from 'uint8arraylist' export interface NoiseExtensions { webtransportCerthashes: Uint8Array[] @@ -58,7 +59,7 @@ export namespace NoiseExtensions { return _codec } - export const encode = (obj: NoiseExtensions): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, NoiseExtensions.codec()) } @@ -85,12 +86,12 @@ export namespace NoiseHandshakePayload { if (opts.writeDefaults === true || (obj.identityKey != null && obj.identityKey.byteLength > 0)) { w.uint32(10) - w.bytes(obj.identityKey) + w.bytes(obj.identityKey ?? new Uint8Array(0)) } if (opts.writeDefaults === true || (obj.identitySig != null && obj.identitySig.byteLength > 0)) { w.uint32(18) - w.bytes(obj.identitySig) + w.bytes(obj.identitySig ?? new Uint8Array(0)) } if (obj.extensions != null) { @@ -137,7 +138,7 @@ export namespace NoiseHandshakePayload { return _codec } - export const encode = (obj: NoiseHandshakePayload): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, NoiseHandshakePayload.codec()) }