yubihsm 0.26.0

Pure Rust client for YubiHSM2 devices with support for HTTP and USB-based access to the device. Supports most HSM functionality including ECDSA, Ed25519, HMAC, and RSA.
Documentation
//! Responses to command sent from the HSM.

mod code;
mod message;

pub use self::code::Code;
pub(crate) use self::message::Message;
use crate::command;
#[cfg(feature = "mockhsm")]
use crate::serialization::serialize;
use serde::{de::DeserializeOwned, Serialize};

/// Structured responses to `Command` messages sent from the HSM
pub(crate) trait Response: Serialize + DeserializeOwned + Sized {
    /// Command ID this response is for
    const COMMAND_CODE: command::Code;

    /// Serialize a response type into a response::Message
    #[cfg(feature = "mockhsm")]
    fn serialize(&self) -> Message {
        Message::success(Self::COMMAND_CODE, serialize(self).unwrap())
    }
}