diff --git a/src/handshake-xx-fallback.ts b/src/handshake-xx-fallback.ts index da3f8ce..fd66546 100644 --- a/src/handshake-xx-fallback.ts +++ b/src/handshake-xx-fallback.ts @@ -66,13 +66,7 @@ export class XXFallbackHandshake extends XXHandshake { const decodedPayload = await decodePayload(plaintext); this.remotePeer = this.remotePeer || await getPeerIdFromPayload(decodedPayload); await verifySignedPayload(this.session.hs.rs, decodedPayload, this.remotePeer); - if(decodedPayload.data){ - this.remoteEarlyData = Buffer.from( - decodedPayload.data.buffer, - decodedPayload.data.byteOffset, - decodedPayload.data.length - ); - } + this.setRemoteEarlyData(decodedPayload.data) } catch (e) { throw new Error(`Error occurred while verifying signed payload from responder: ${e.message}`); } diff --git a/src/handshake-xx.ts b/src/handshake-xx.ts index bb2b849..17bece8 100644 --- a/src/handshake-xx.ts +++ b/src/handshake-xx.ts @@ -151,7 +151,7 @@ export class XXHandshake implements IHandshake { } } - private setRemoteEarlyData(data: Uint8Array|null|undefined): void { + protected setRemoteEarlyData(data: Uint8Array|null|undefined): void { if(data){ this.remoteEarlyData = Buffer.from(data.buffer, data.byteOffset, data.length); }