pub trait DidKeyStore: Send + Sync {
// Required methods
fn sign(&self, signer: &Did, message: &[u8]) -> Result<String, DidError>;
fn verify(
&self,
method: &VerificationMethod,
message: &[u8],
signature: &str,
) -> Result<(), DidError>;
fn encrypt_for(
&self,
sender: &Did,
recipient_public_key: &[u8],
plaintext: &[u8],
nonce: &[u8],
associated_data: &[u8],
) -> Result<String, DidError>;
fn decrypt_for(
&self,
recipient: &Did,
sender_public_key: &[u8],
nonce: &[u8],
ciphertext_hex: &str,
associated_data: &[u8],
) -> Result<Vec<u8>, DidError>;
}Expand description
Key-store and envelope crypto boundary.
Required Methods§
Sourcefn verify(
&self,
method: &VerificationMethod,
message: &[u8],
signature: &str,
) -> Result<(), DidError>
fn verify( &self, method: &VerificationMethod, message: &[u8], signature: &str, ) -> Result<(), DidError>
Verify a signature with the public key in method.
Sourcefn encrypt_for(
&self,
sender: &Did,
recipient_public_key: &[u8],
plaintext: &[u8],
nonce: &[u8],
associated_data: &[u8],
) -> Result<String, DidError>
fn encrypt_for( &self, sender: &Did, recipient_public_key: &[u8], plaintext: &[u8], nonce: &[u8], associated_data: &[u8], ) -> Result<String, DidError>
Encrypt bytes from sender to the recipient public key.
associated_data is authenticated but not encrypted (AEAD AAD); the
recipient must supply the identical bytes to decrypt_for.
Sourcefn decrypt_for(
&self,
recipient: &Did,
sender_public_key: &[u8],
nonce: &[u8],
ciphertext_hex: &str,
associated_data: &[u8],
) -> Result<Vec<u8>, DidError>
fn decrypt_for( &self, recipient: &Did, sender_public_key: &[u8], nonce: &[u8], ciphertext_hex: &str, associated_data: &[u8], ) -> Result<Vec<u8>, DidError>
Decrypt bytes addressed to recipient from the sender public key.
associated_data must match the bytes passed to encrypt_for
or authentication fails.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".