pub struct DefaultKeyManager {
pub generator: DIDKeyGenerator,
pub secrets: Arc<RwLock<HashMap<String, Secret>>>,
/* private fields */
}Expand description
A default implementation of the KeyManager trait.
Fields§
§generator: DIDKeyGeneratorThe DID key generator
secrets: Arc<RwLock<HashMap<String, Secret>>>The secret storage (legacy)
Implementations§
Source§impl DefaultKeyManager
impl DefaultKeyManager
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
Trait Implementations§
Source§impl Clone for DefaultKeyManager
impl Clone for DefaultKeyManager
Source§fn clone(&self) -> DefaultKeyManager
fn clone(&self) -> DefaultKeyManager
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 DefaultKeyManager
impl Debug for DefaultKeyManager
Source§impl Default for DefaultKeyManager
impl Default for DefaultKeyManager
Source§impl KeyManager for DefaultKeyManager
impl KeyManager for DefaultKeyManager
Source§fn get_private_key(&self, did: &str) -> Result<(Vec<u8>, KeyType)>
fn get_private_key(&self, did: &str) -> Result<(Vec<u8>, KeyType)>
Get the raw private key bytes and key type for a DID
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 DefaultKeyManager
impl KeyManagerPacking for DefaultKeyManager
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 DefaultKeyManager
impl RefUnwindSafe for DefaultKeyManager
impl Send for DefaultKeyManager
impl Sync for DefaultKeyManager
impl Unpin for DefaultKeyManager
impl UnsafeUnpin for DefaultKeyManager
impl UnwindSafe for DefaultKeyManager
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