From e9af13a1eebfa311bb6eefb2f37637a0f4ed64a6 Mon Sep 17 00:00:00 2001 From: Jacob Heun Date: Thu, 7 May 2020 16:24:15 +0200 Subject: [PATCH] fix: marshal the verified peer from its public key This ensures that completed outbound handshakes will always contain the public key of the remote peer --- src/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.ts b/src/utils.ts index c6d9ba4..345b24f 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -97,7 +97,7 @@ export async function verifySignedPayload( if (!payload.identitySig || !publicKey.verify(generatedPayload, Buffer.from(payload.identitySig))) { throw new Error("Static key doesn't match to peer that signed payload!"); } - return remotePeer; + return PeerId.createFromPubKey(identityKey); } export function getHkdf(ck: bytes32, ikm: bytes): Hkdf {