pub struct Device { /* private fields */ }Expand description
Handle to an open QUAC 100 device.
This struct provides access to all device functionality including KEM, signatures, hashing, random number generation, and key storage.
The device is automatically closed when this struct is dropped.
§Thread Safety
Device is Send and Sync, allowing it to be shared across threads.
The underlying hardware operations are serialized by the device.
§Example
use quantacore::{initialize, open_first_device};
initialize().unwrap();
let device = open_first_device().unwrap();
let info = device.get_info().unwrap();
println!("Connected to: {}", info.model);
// Access subsystems
let kem = device.kem();
let sign = device.sign();
let hash = device.hash();
let random = device.random();Implementations§
Source§impl Device
impl Device
Sourcepub fn get_info(&self) -> Result<DeviceInfo>
pub fn get_info(&self) -> Result<DeviceInfo>
Get device information.
§Example
let device = open_first_device().unwrap();
let info = device.get_info().unwrap();
println!("Model: {}", info.model);
println!("Serial: {}", info.serial_number);
println!("Firmware: {}", info.firmware_version);Sourcepub fn get_status(&self) -> Result<DeviceStatus>
pub fn get_status(&self) -> Result<DeviceStatus>
Get device status.
§Example
let device = open_first_device().unwrap();
let status = device.get_status().unwrap();
println!("Temperature: {}°C", status.temperature);
println!("Entropy: {}%", status.entropy_level);
println!("Healthy: {}", status.is_healthy());Sourcepub fn self_test(&self) -> Result<()>
pub fn self_test(&self) -> Result<()>
Run device self-test.
This performs a comprehensive self-test of the device hardware and cryptographic implementations.
§Example
let device = open_first_device().unwrap();
device.self_test().expect("Self-test failed");
println!("Device self-test passed");Sourcepub fn reset(&self) -> Result<()>
pub fn reset(&self) -> Result<()>
Reset the device.
This performs a soft reset of the device. All ongoing operations will be cancelled.
Sourcepub fn kem(&self) -> Kem
pub fn kem(&self) -> Kem
Get the KEM (Key Encapsulation Mechanism) subsystem.
§Example
let device = open_first_device().unwrap();
let kem = device.kem();
let keypair = kem.generate_keypair(KemAlgorithm::MlKem768).unwrap();Sourcepub fn sign(&self) -> Sign
pub fn sign(&self) -> Sign
Get the signature subsystem.
§Example
let device = open_first_device().unwrap();
let sign = device.sign();
let keypair = sign.generate_keypair(SignAlgorithm::MlDsa65).unwrap();Sourcepub fn hash(&self) -> Hash
pub fn hash(&self) -> Hash
Get the hash subsystem.
§Example
let device = open_first_device().unwrap();
let hash = device.hash();
let digest = hash.sha256(b"Hello, World!").unwrap();Sourcepub fn random(&self) -> Random
pub fn random(&self) -> Random
Get the random number generator subsystem.
§Example
let device = open_first_device().unwrap();
let random = device.random();
let bytes = random.bytes(32).unwrap();Trait Implementations§
Auto Trait Implementations§
impl Freeze for Device
impl RefUnwindSafe for Device
impl Send for Device
impl Sync for Device
impl Unpin for Device
impl UnwindSafe for Device
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)