Rename function

This commit is contained in:
Matija Petrunic 2020-04-17 11:09:46 +02:00
parent 93d6a9a99b
commit 01a4388fa2
2 changed files with 6 additions and 6 deletions

View File

@ -65,7 +65,7 @@ export class IKHandshake implements IHandshake {
const decodedPayload = await decodePayload(plaintext); const decodedPayload = await decodePayload(plaintext);
this.remotePeer = this.remotePeer || await getPeerIdFromPayload(decodedPayload); this.remotePeer = this.remotePeer || await getPeerIdFromPayload(decodedPayload);
await verifySignedPayload(this.session.hs.rs, decodedPayload, this.remotePeer); await verifySignedPayload(this.session.hs.rs, decodedPayload, this.remotePeer);
this.setEarlyData(decodedPayload.data); this.setRemoteEarlyData(decodedPayload.data);
logger("IK Stage 0 - Responder successfully verified payload!"); logger("IK Stage 0 - Responder successfully verified payload!");
} catch (e) { } catch (e) {
logger("Responder breaking up with IK handshake in stage 0."); logger("Responder breaking up with IK handshake in stage 0.");
@ -89,7 +89,7 @@ export class IKHandshake implements IHandshake {
const decodedPayload = await decodePayload(plaintext); const decodedPayload = await decodePayload(plaintext);
this.remotePeer = this.remotePeer || await getPeerIdFromPayload(decodedPayload); this.remotePeer = this.remotePeer || await getPeerIdFromPayload(decodedPayload);
await verifySignedPayload(receivedMessageBuffer.ns.slice(0, 32), decodedPayload, this.remotePeer); await verifySignedPayload(receivedMessageBuffer.ns.slice(0, 32), decodedPayload, this.remotePeer);
this.setEarlyData(decodedPayload.data); this.setRemoteEarlyData(decodedPayload.data);
logger("IK Stage 1 - Initiator successfully verified payload!"); logger("IK Stage 1 - Initiator successfully verified payload!");
} catch (e) { } catch (e) {
logger("Initiator breaking up with IK handshake in stage 1."); logger("Initiator breaking up with IK handshake in stage 1.");
@ -133,7 +133,7 @@ export class IKHandshake implements IHandshake {
} }
} }
private setEarlyData(data: Uint8Array|null|undefined): void { private setRemoteEarlyData(data: Uint8Array|null|undefined): void {
if(data){ if(data){
this.remoteEarlyData = Buffer.from(data.buffer, data.byteOffset, data.length); this.remoteEarlyData = Buffer.from(data.buffer, data.byteOffset, data.length);
} }

View File

@ -84,7 +84,7 @@ export class XXHandshake implements IHandshake {
const decodedPayload = await decodePayload(plaintext); const decodedPayload = await decodePayload(plaintext);
this.remotePeer = this.remotePeer || await getPeerIdFromPayload(decodedPayload); this.remotePeer = this.remotePeer || await getPeerIdFromPayload(decodedPayload);
this.remotePeer = await verifySignedPayload(receivedMessageBuffer.ns, decodedPayload, this.remotePeer); this.remotePeer = await verifySignedPayload(receivedMessageBuffer.ns, decodedPayload, this.remotePeer);
this.setEarlyData(decodedPayload.data) this.setRemoteEarlyData(decodedPayload.data)
} catch (e) { } catch (e) {
throw new Error(`Error occurred while verifying signed payload: ${e.message}`); throw new Error(`Error occurred while verifying signed payload: ${e.message}`);
} }
@ -117,7 +117,7 @@ export class XXHandshake implements IHandshake {
const decodedPayload = await decodePayload(plaintext); const decodedPayload = await decodePayload(plaintext);
this.remotePeer = this.remotePeer || await getPeerIdFromPayload(decodedPayload); this.remotePeer = this.remotePeer || await getPeerIdFromPayload(decodedPayload);
await verifySignedPayload(this.session.hs.rs, decodedPayload, this.remotePeer); await verifySignedPayload(this.session.hs.rs, decodedPayload, this.remotePeer);
this.setEarlyData(decodedPayload.data) this.setRemoteEarlyData(decodedPayload.data)
} catch (e) { } catch (e) {
throw new Error(`Error occurred while verifying signed payload: ${e.message}`); throw new Error(`Error occurred while verifying signed payload: ${e.message}`);
} }
@ -151,7 +151,7 @@ export class XXHandshake implements IHandshake {
} }
} }
private setEarlyData(data: Uint8Array|null|undefined): void { private setRemoteEarlyData(data: Uint8Array|null|undefined): void {
if(data){ if(data){
this.remoteEarlyData = Buffer.from(data.buffer, data.byteOffset, data.length); this.remoteEarlyData = Buffer.from(data.buffer, data.byteOffset, data.length);
} }