Skip to main content

DidKeyStore

Trait DidKeyStore 

Source
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],
    ) -> Result<String, DidError>;
    fn decrypt_for(
        &self,
        recipient: &Did,
        sender_public_key: &[u8],
        nonce: &[u8],
        ciphertext_hex: &str,
    ) -> Result<Vec<u8>, DidError>;
}
Expand description

Key-store and envelope crypto boundary.

Required Methods§

Source

fn sign(&self, signer: &Did, message: &[u8]) -> Result<String, DidError>

Sign bytes as signer.

Source

fn verify( &self, method: &VerificationMethod, message: &[u8], signature: &str, ) -> Result<(), DidError>

Verify a signature with the public key in method.

Source

fn encrypt_for( &self, sender: &Did, recipient_public_key: &[u8], plaintext: &[u8], nonce: &[u8], ) -> Result<String, DidError>

Encrypt bytes from sender to the recipient public key.

Source

fn decrypt_for( &self, recipient: &Did, sender_public_key: &[u8], nonce: &[u8], ciphertext_hex: &str, ) -> Result<Vec<u8>, DidError>

Decrypt bytes addressed to recipient from the sender public key.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§