pub struct KeyStorage {
pub keys: HashMap<String, StoredKey>,
pub default_did: Option<String>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
/* private fields */
}Expand description
A collection of stored keys
Fields§
§keys: HashMap<String, StoredKey>A map of DIDs to their stored keys
default_did: Option<String>The default DID to use when not specified
created_at: DateTime<Utc>Creation timestamp
updated_at: DateTime<Utc>Last update timestamp
Implementations§
Source§impl KeyStorage
impl KeyStorage
Sourcepub fn find_by_label(&self, label: &str) -> Option<&StoredKey>
pub fn find_by_label(&self, label: &str) -> Option<&StoredKey>
Find a key by label
Sourcepub fn default_key_path() -> Option<PathBuf>
pub fn default_key_path() -> Option<PathBuf>
Get the default key path
Sourcepub fn load_default() -> Result<Self>
pub fn load_default() -> Result<Self>
Load keys from the default location
Sourcepub fn load_from_path(path: &Path) -> Result<Self>
pub fn load_from_path(path: &Path) -> Result<Self>
Load keys from a specific path
Sourcepub fn save_default(&self) -> Result<()>
pub fn save_default(&self) -> Result<()>
Save keys to the default location
Sourcepub fn save_to_path(&self, path: &Path) -> Result<()>
pub fn save_to_path(&self, path: &Path) -> Result<()>
Save keys to a specific path
On Unix systems, the file is created with restrictive permissions (0o600) to protect private key material from unauthorized access.
Sourcepub fn from_generated_key(key: &GeneratedKey) -> StoredKey
pub fn from_generated_key(key: &GeneratedKey) -> StoredKey
Convert a GeneratedKey to a StoredKey
Sourcepub fn from_generated_key_with_label(
key: &GeneratedKey,
label: &str,
) -> StoredKey
pub fn from_generated_key_with_label( key: &GeneratedKey, label: &str, ) -> StoredKey
Convert a GeneratedKey to a StoredKey with a specific label
Sourcepub fn create_agent_directory(
&self,
did: &str,
policies: &[String],
metadata: &HashMap<String, String>,
) -> Result<()>
pub fn create_agent_directory( &self, did: &str, policies: &[String], metadata: &HashMap<String, String>, ) -> Result<()>
Create agent directory and save policies/metadata files
On Unix systems, files are created with restrictive permissions (0o600) to protect sensitive agent configuration from unauthorized access.
Trait Implementations§
Source§impl Clone for KeyStorage
impl Clone for KeyStorage
Source§fn clone(&self) -> KeyStorage
fn clone(&self) -> KeyStorage
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 KeyStorage
impl Debug for KeyStorage
Source§impl Default for KeyStorage
impl Default for KeyStorage
Source§fn default() -> KeyStorage
fn default() -> KeyStorage
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for KeyStorage
impl<'de> Deserialize<'de> for KeyStorage
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
Auto Trait Implementations§
impl Freeze for KeyStorage
impl RefUnwindSafe for KeyStorage
impl Send for KeyStorage
impl Sync for KeyStorage
impl Unpin for KeyStorage
impl UnsafeUnpin for KeyStorage
impl UnwindSafe for KeyStorage
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