1use alloc::vec::Vec;
2
3use crate::error::InvalidMessage;
4use crate::msgs::codec::{Codec, Reader};
5
6#[derive(Debug)]
7pub struct ChangeCipherSpecPayload;
8
9impl Codec for ChangeCipherSpecPayload {
10 fn encode(&self, bytes: &mut Vec<u8>) {
11 1u8.encode(bytes);
12 }
13
14 fn read(r: &mut Reader) -> Result<Self, InvalidMessage> {
15 let typ: u8 = u8::read(r)?;
16 if typ != 1 {
17 return Err(InvalidMessage::InvalidCcs);
18 }
19
20 r.expect_empty("ChangeCipherSpecPayload")
21 .map(|_| Self {})
22 }
23}
24