mirror of
https://github.com/fluencelabs/js-libp2p-noise
synced 2025-04-25 08:22:35 +00:00
Address PR comment
This commit is contained in:
parent
d3a652aecb
commit
e2b7eef295
@ -33,7 +33,6 @@ export async function getPayload(
|
||||
|
||||
return await createHandshakePayload(
|
||||
localPeer.marshalPubKey(),
|
||||
localPeer.marshalPrivKey(),
|
||||
signedPayload,
|
||||
signedEarlyDataPayload
|
||||
);
|
||||
@ -41,7 +40,6 @@ export async function getPayload(
|
||||
|
||||
export async function createHandshakePayload(
|
||||
libp2pPublicKey: bytes,
|
||||
libp2pPrivateKey: bytes,
|
||||
signedPayload: bytes,
|
||||
signedEarlyData?: EarlyDataPayload,
|
||||
): Promise<bytes> {
|
||||
|
@ -31,7 +31,7 @@ describe("Index", () => {
|
||||
const initSignedPayload = await libp2pInitKeys.sign(getHandshakePayload(kpInitiator.publicKey));
|
||||
const libp2pInitPrivKey = libp2pInitKeys.marshal().slice(0, 32);
|
||||
const libp2pInitPubKey = libp2pInitKeys.marshal().slice(32, 64);
|
||||
const payloadInitEnc = await createHandshakePayload(libp2pInitPubKey, libp2pInitPrivKey, initSignedPayload);
|
||||
const payloadInitEnc = await createHandshakePayload(libp2pInitPubKey, initSignedPayload);
|
||||
|
||||
// initiator sends message
|
||||
const message = Buffer.concat([Buffer.alloc(0), payloadInitEnc]);
|
||||
@ -48,7 +48,7 @@ describe("Index", () => {
|
||||
const libp2pRespPrivKey = libp2pRespKeys.marshal().slice(0, 32);
|
||||
const libp2pRespPubKey = libp2pRespKeys.marshal().slice(32, 64);
|
||||
const respSignedPayload = await libp2pRespKeys.sign(getHandshakePayload(kpResponder.publicKey));
|
||||
const payloadRespEnc = await createHandshakePayload(libp2pRespPubKey, libp2pRespPrivKey, respSignedPayload);
|
||||
const payloadRespEnc = await createHandshakePayload(libp2pRespPubKey, respSignedPayload);
|
||||
|
||||
const message1 = Buffer.concat([message, payloadRespEnc]);
|
||||
const messageBuffer2 = ikR.sendMessage(responderSession, message1);
|
||||
|
@ -58,7 +58,7 @@ describe("Index", () => {
|
||||
const libp2pInitPrivKey = libp2pInitKeys.marshal().slice(0, 32);
|
||||
const libp2pInitPubKey = libp2pInitKeys.marshal().slice(32, 64);
|
||||
|
||||
const payloadInitEnc = await createHandshakePayload(libp2pInitPubKey, libp2pInitPrivKey, initSignedPayload);
|
||||
const payloadInitEnc = await createHandshakePayload(libp2pInitPubKey, initSignedPayload);
|
||||
|
||||
// initiator sends message
|
||||
const message = Buffer.concat([Buffer.alloc(0), payloadInitEnc]);
|
||||
@ -75,7 +75,7 @@ describe("Index", () => {
|
||||
// responder creates payload
|
||||
const libp2pRespPrivKey = libp2pRespKeys.marshal().slice(0, 32);
|
||||
const libp2pRespPubKey = libp2pRespKeys.marshal().slice(32, 64);
|
||||
const payloadRespEnc = await createHandshakePayload(libp2pRespPubKey, libp2pRespPrivKey, respSignedPayload);
|
||||
const payloadRespEnc = await createHandshakePayload(libp2pRespPubKey, respSignedPayload);
|
||||
|
||||
const message1 = Buffer.concat([message, payloadRespEnc]);
|
||||
const messageBuffer2 = xx.sendMessage(nsResp, message1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user