in src/messages.js [50:59]
static fromBytes(bytes) {
// Each handshake message has a type and length prefix, per
// https://tools.ietf.org/html/rfc8446#appendix-B.3
const buf = new BufferReader(bytes);
const msg = this.read(buf);
if (buf.hasMoreBytes()) {
throw new TLSError(ALERT_DESCRIPTION.DECODE_ERROR);
}
return msg;
}