in src/states.js [287:303]
async recvHandshakeMessage(msg) {
if (! (msg instanceof Finished)) {
throw new TLSError(ALERT_DESCRIPTION.UNEXPECTED_MESSAGE);
}
// Verify server Finished MAC.
const keyschedule = this.conn._keyschedule;
await keyschedule.verifyFinishedMAC(keyschedule.serverHandshakeTrafficSecret, msg.verifyData, this._serverFinishedTranscript);
// Send our own Finished message in return.
// This must be encrypted with the handshake traffic key,
// but must not appear in the transcript used to calculate the application keys.
const clientFinishedMAC = await keyschedule.calculateFinishedMAC(keyschedule.clientHandshakeTrafficSecret);
await keyschedule.finalize();
await this.conn._sendHandshakeMessage(new Finished(clientFinishedMAC));
await this.conn._setSendKey(keyschedule.clientApplicationTrafficSecret);
await this.conn._setRecvKey(keyschedule.serverApplicationTrafficSecret);
await this.conn._transition(CLIENT_CONNECTED);
}