Skip to main content

Vault

Trait Vault 

Source
pub trait Vault {
    // Required methods
    fn new(
        public: Option<PublicKey>,
        private: Option<PrivateKey>,
    ) -> Result<Self>
       where Self: Sized;
    fn create(
        &self,
        password: SecretSlice<u8>,
        data: &mut [u8],
    ) -> Result<String>;
    fn view(
        &self,
        password: &[u8],
        data: &[u8],
        fingerprint: &str,
    ) -> Result<String>;
}
Expand description

Trait defining the vault operations for different key types

Required Methods§

Source

fn new(public: Option<PublicKey>, private: Option<PrivateKey>) -> Result<Self>
where Self: Sized,

Creates a new vault instance with the given keys

§Errors

Returns an error if the provided keys are invalid or mismatched.

Source

fn create(&self, password: SecretSlice<u8>, data: &mut [u8]) -> Result<String>

Encrypts data and creates a vault string

§Errors

Returns an error if encryption fails.

Source

fn view( &self, password: &[u8], data: &[u8], fingerprint: &str, ) -> Result<String>

Decrypts vault contents

§Errors

Returns an error if decryption fails or the fingerprint is invalid.

Implementors§