use crate::{
command::{Command, CommandCode},
object::ObjectId,
response::Response,
};
#[derive(Serialize, Deserialize, Debug)]
pub(crate) struct SignAttestationCertificateCommand {
pub key_id: ObjectId,
pub attestation_key_id: ObjectId,
}
impl Command for SignAttestationCertificateCommand {
type ResponseType = AttestationCertificate;
}
#[derive(Serialize, Deserialize, Debug)]
pub struct AttestationCertificate(pub Vec<u8>);
impl Response for AttestationCertificate {
const COMMAND_CODE: CommandCode = CommandCode::SignAttestationCertificate;
}
#[allow(clippy::len_without_is_empty)]
impl AttestationCertificate {
pub fn into_vec(self) -> Vec<u8> {
self.into()
}
pub fn len(&self) -> usize {
self.0.len()
}
pub fn as_slice(&self) -> &[u8] {
self.as_ref()
}
}
impl AsRef<[u8]> for AttestationCertificate {
fn as_ref(&self) -> &[u8] {
self.0.as_ref()
}
}
impl Into<Vec<u8>> for AttestationCertificate {
fn into(self) -> Vec<u8> {
self.0
}
}