pub struct DeviceIdentity {
pub device_instance_id: Uuid,
pub device_name: String,
}Expand description
Persistent identity for a CLI installation.
Each device gets a unique device_instance_id (UUIDv4) and a human-readable
device_name (defaults to the hostname). The identity is stored in
~/.cipherstash/device.json and reused across sessions so the server can
track device lifecycle.
Fields§
§device_instance_id: UuidA UUIDv4 that uniquely identifies this CLI installation.
device_name: StringA human-readable name for this device (defaults to the hostname).
Implementations§
Source§impl DeviceIdentity
impl DeviceIdentity
Sourcepub fn load_or_create(store: &ProfileStore) -> Result<Self, ProfileError>
pub fn load_or_create(store: &ProfileStore) -> Result<Self, ProfileError>
Load an existing device identity from the given store, or create a new one if none exists.
When creating, generates a UUIDv4 and uses the system hostname as the default device name. The file is written with mode 0600 on Unix.
Sourcepub fn load(store: &ProfileStore) -> Result<Self, ProfileError>
pub fn load(store: &ProfileStore) -> Result<Self, ProfileError>
Load a device identity from the given store.
Returns ProfileError::NotFound if the file does not exist.
Trait Implementations§
Source§impl Clone for DeviceIdentity
impl Clone for DeviceIdentity
Source§fn clone(&self) -> DeviceIdentity
fn clone(&self) -> DeviceIdentity
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DeviceIdentity
impl Debug for DeviceIdentity
Source§impl<'de> Deserialize<'de> for DeviceIdentity
impl<'de> Deserialize<'de> for DeviceIdentity
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl ProfileData for DeviceIdentity
impl ProfileData for DeviceIdentity
Auto Trait Implementations§
impl Freeze for DeviceIdentity
impl RefUnwindSafe for DeviceIdentity
impl Send for DeviceIdentity
impl Sync for DeviceIdentity
impl Unpin for DeviceIdentity
impl UnsafeUnpin for DeviceIdentity
impl UnwindSafe for DeviceIdentity
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more