pub struct AgentKeyManager { /* private fields */ }Expand description
Agent Key Manager implements the KeyManager trait using the agent key abstraction
Implementations§
Source§impl AgentKeyManager
impl AgentKeyManager
Sourcepub async fn get_signing_key_type(&self, did: &str) -> Result<String>
pub async fn get_signing_key_type(&self, did: &str) -> Result<String>
Get the key type for a signing key (for debugging)
Sourcepub fn agent_key_from_generated(
&self,
key: &GeneratedKey,
) -> Result<LocalAgentKey>
pub fn agent_key_from_generated( &self, key: &GeneratedKey, ) -> Result<LocalAgentKey>
Create a LocalAgentKey from a GeneratedKey
Sourcepub fn save_to_storage(&self) -> Result<()>
pub fn save_to_storage(&self) -> Result<()>
Save keys to storage if a storage path is configured
Sourcepub fn load_from_default_storage(self) -> Result<Self>
pub fn load_from_default_storage(self) -> Result<Self>
Load from default storage location
Sourcepub fn load_from_path(self, path: PathBuf) -> Result<Self>
pub fn load_from_path(self, path: PathBuf) -> Result<Self>
Load from a specific storage path
Trait Implementations§
Source§impl Clone for AgentKeyManager
impl Clone for AgentKeyManager
Source§fn clone(&self) -> AgentKeyManager
fn clone(&self) -> AgentKeyManager
Returns a copy 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 AgentKeyManager
impl Debug for AgentKeyManager
Source§impl Default for AgentKeyManager
impl Default for AgentKeyManager
Source§impl KeyManager for AgentKeyManager
impl KeyManager for AgentKeyManager
Source§fn generate_key(&self, options: DIDGenerationOptions) -> Result<GeneratedKey>
fn generate_key(&self, options: DIDGenerationOptions) -> Result<GeneratedKey>
Generate a new key with the specified options
Source§fn generate_web_did(
&self,
domain: &str,
options: DIDGenerationOptions,
) -> Result<GeneratedKey>
fn generate_web_did( &self, domain: &str, options: DIDGenerationOptions, ) -> Result<GeneratedKey>
Generate a new web DID with the specified domain and options
Source§fn has_key(&self, did: &str) -> Result<bool>
fn has_key(&self, did: &str) -> Result<bool>
Check if the key manager has a key for the given DID
Source§fn add_signing_key<'life0, 'async_trait>(
&'life0 self,
key: Arc<dyn SigningKey + Send + Sync>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn add_signing_key<'life0, 'async_trait>(
&'life0 self,
key: Arc<dyn SigningKey + Send + Sync>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Add a signing key to the key manager
Source§fn add_encryption_key<'life0, 'async_trait>(
&'life0 self,
key: Arc<dyn EncryptionKey + Send + Sync>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn add_encryption_key<'life0, 'async_trait>(
&'life0 self,
key: Arc<dyn EncryptionKey + Send + Sync>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Add an encryption key to the key manager
Source§fn add_decryption_key<'life0, 'async_trait>(
&'life0 self,
key: Arc<dyn DecryptionKey + Send + Sync>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn add_decryption_key<'life0, 'async_trait>(
&'life0 self,
key: Arc<dyn DecryptionKey + Send + Sync>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Add a decryption key to the key manager
Source§fn get_signing_key<'life0, 'life1, 'async_trait>(
&'life0 self,
kid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn SigningKey + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_signing_key<'life0, 'life1, 'async_trait>(
&'life0 self,
kid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn SigningKey + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get a signing key by ID
Source§fn get_encryption_key<'life0, 'life1, 'async_trait>(
&'life0 self,
kid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn EncryptionKey + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_encryption_key<'life0, 'life1, 'async_trait>(
&'life0 self,
kid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn EncryptionKey + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get an encryption key by ID
Source§fn get_decryption_key<'life0, 'life1, 'async_trait>(
&'life0 self,
kid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn DecryptionKey + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_decryption_key<'life0, 'life1, 'async_trait>(
&'life0 self,
kid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn DecryptionKey + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get a decryption key by ID
Source§fn resolve_verification_key<'life0, 'life1, 'async_trait>(
&'life0 self,
kid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn VerificationKey + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn resolve_verification_key<'life0, 'life1, 'async_trait>(
&'life0 self,
kid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn VerificationKey + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Resolve a verification key by ID
Source§fn sign_jws<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
kid: &'life1 str,
payload: &'life2 [u8],
protected_header: Option<JwsProtected>,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn sign_jws<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
kid: &'life1 str,
payload: &'life2 [u8],
protected_header: Option<JwsProtected>,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Sign data with a key
Source§fn verify_jws<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
jws: &'life1 str,
expected_kid: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn verify_jws<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
jws: &'life1 str,
expected_kid: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Verify a JWS
Source§fn encrypt_jwe<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
sender_kid: &'life1 str,
recipient_kid: &'life2 str,
plaintext: &'life3 [u8],
protected_header: Option<JweProtected>,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn encrypt_jwe<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
sender_kid: &'life1 str,
recipient_kid: &'life2 str,
plaintext: &'life3 [u8],
protected_header: Option<JweProtected>,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Encrypt data for a recipient
Source§fn decrypt_jwe<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
jwe: &'life1 str,
expected_kid: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn decrypt_jwe<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
jwe: &'life1 str,
expected_kid: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Decrypt a JWE
Source§impl KeyManagerPacking for AgentKeyManager
impl KeyManagerPacking for AgentKeyManager
Source§fn get_signing_key<'life0, 'life1, 'async_trait>(
&'life0 self,
kid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn SigningKey + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_signing_key<'life0, 'life1, 'async_trait>(
&'life0 self,
kid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn SigningKey + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get a signing key by ID
Source§fn get_encryption_key<'life0, 'life1, 'async_trait>(
&'life0 self,
kid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn EncryptionKey + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_encryption_key<'life0, 'life1, 'async_trait>(
&'life0 self,
kid: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn EncryptionKey + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get an encryption key by ID
Auto Trait Implementations§
impl Freeze for AgentKeyManager
impl RefUnwindSafe for AgentKeyManager
impl Send for AgentKeyManager
impl Sync for AgentKeyManager
impl Unpin for AgentKeyManager
impl UnwindSafe for AgentKeyManager
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