#[derive(Clone, Debug, PartialEq, Eq)]
pub struct DeviceCredentialClaim {
pub device_id: String,
pub binding_type: DeviceBindingType,
pub hardware_backed: bool,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum DeviceBindingType {
HardwareKeystore,
SoftwareKeystore,
PlatformAttestation,
}
impl DeviceCredentialClaim {
#[must_use]
pub fn hardware_backed(device_id: impl Into<String>) -> Self {
Self {
device_id: device_id.into(),
binding_type: DeviceBindingType::HardwareKeystore,
hardware_backed: true,
}
}
#[must_use]
pub fn software_backed(device_id: impl Into<String>) -> Self {
Self {
device_id: device_id.into(),
binding_type: DeviceBindingType::SoftwareKeystore,
hardware_backed: false,
}
}
#[must_use]
pub fn is_hardware_backed(&self) -> bool {
self.hardware_backed
}
}