signstar_yubihsm2/connection.rs
1#[cfg(feature = "serde")]
2use serde::{Deserialize, Serialize};
3
4use crate::yubihsm::SerialNumber;
5
6/// A connection to a YubiHSM2.
7#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
8#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
9#[cfg_attr(feature = "serde", serde(rename_all = "lowercase"))]
10pub enum Connection {
11 /// Connection to a Mock HSM.
12 #[cfg(feature = "_yubihsm2-mockhsm")]
13 Mock,
14
15 /// Connection to a device over USB.
16 ///
17 /// Each YubiHSM2 is identified by a unique serial number.
18 /// This number is printed on the enclosure of the physical device.
19 Usb {
20 /// Serial number of the connected YubiHSM2.
21 serial_number: SerialNumber,
22 },
23}