Trait fog_crypto::Vault[][src]

pub trait Vault {
    fn new_id(&self, name: String) -> IdentityKey;
fn new_lock(&self, name: String) -> LockKey;
fn new_stream(&self, name: String) -> StreamKey;
fn get_id(&self, name: &str) -> Option<IdentityKey>;
fn get_lock(&self, name: &str) -> Option<LockKey>;
fn get_stream(&self, name: &str) -> Option<StreamKey>;
fn find_id(&self, id: Identity) -> Option<(&str, IdentityKey)>;
fn find_lock(&self, lock: LockId) -> Option<(&str, LockKey)>;
fn find_stream(&self, stream: StreamId) -> Option<(&str, StreamKey)>;
fn rename_id(&self, old_name: &str, new_name: String) -> bool;
fn rename_lock(&self, old_name: &str, new_name: String) -> bool;
fn rename_stream(&self, old_name: &str, new_name: String) -> bool;
fn remove_id(&self, name: &str) -> bool;
fn remove_lock(&self, name: &str) -> bool;
fn remove_stream(&self, name: &str) -> bool;
fn decrypt_lock_key(
        &self,
        name: String,
        lock: &LockLockboxRef
    ) -> Result<LockKey, CryptoError>;
fn decrypt_identity_key(
        &self,
        name: String,
        lock: &IdentityLockboxRef
    ) -> Result<IdentityKey, CryptoError>;
fn decrypt_stream_key(
        &self,
        name: String,
        lock: &StreamLockboxRef
    ) -> Result<StreamKey, CryptoError>;
fn decrypt_data(&self, lock: &DataLockbox) -> Result<Vec<u8>, CryptoError>; }

A trait to interface with long-term storage of various cryptographic keys.

Any implementor should store keys in three separate key-value stores: one for IdentityKey storage, one for LockKey storage, and one for StreamKey storage. Each provides a separate lookup by name, or the various keys may be retrieved by looking them up by their public identities.

Required methods

fn new_id(&self, name: String) -> IdentityKey[src]

Create & store a new IdentityKey.

fn new_lock(&self, name: String) -> LockKey[src]

Create & store a new LockKey.

fn new_stream(&self, name: String) -> StreamKey[src]

Create & store a new StreamKey.

fn get_id(&self, name: &str) -> Option<IdentityKey>[src]

Fetch a stored IdentityKey by name. Returns none if no key by that name is stored.

fn get_lock(&self, name: &str) -> Option<LockKey>[src]

Fetch a stored LockKey by name. Returns none if no key by that name is stored.

fn get_stream(&self, name: &str) -> Option<StreamKey>[src]

Fetch a stored StreamKey by name. Returns none if no key by that name is stored.

fn find_id(&self, id: Identity) -> Option<(&str, IdentityKey)>[src]

Fetch a stored IdentityKey by its public Identity, also returning the name it is stored under. Returns none if the key is not in the vault.

fn find_lock(&self, lock: LockId) -> Option<(&str, LockKey)>[src]

Fetch a stored LockKey by its public LockId, also returning the name it is stored under. Returns none if the key is not in the vault.

fn find_stream(&self, stream: StreamId) -> Option<(&str, StreamKey)>[src]

Fetch a stored StreamKey by its public StreamId, also returning the name it is stored under. Returns none if the key is not in the vault.

fn rename_id(&self, old_name: &str, new_name: String) -> bool[src]

Change the lookup name for a StreamKey.

fn rename_lock(&self, old_name: &str, new_name: String) -> bool[src]

Change the lookup name for a StreamKey.

fn rename_stream(&self, old_name: &str, new_name: String) -> bool[src]

Change the lookup name for a StreamKey.

fn remove_id(&self, name: &str) -> bool[src]

Remove the IdentityKey stored under this name.

fn remove_lock(&self, name: &str) -> bool[src]

Remove the LockKey stored under this name.

fn remove_stream(&self, name: &str) -> bool[src]

Remove the StreamKey stored under this name.

fn decrypt_lock_key(
    &self,
    name: String,
    lock: &LockLockboxRef
) -> Result<LockKey, CryptoError>
[src]

Attempt to decrypt a LockLockbox using any of the LockKey and StreamKey instances stored. On success, the new LockKey is stored in the vault under the provided name.

fn decrypt_identity_key(
    &self,
    name: String,
    lock: &IdentityLockboxRef
) -> Result<IdentityKey, CryptoError>
[src]

Attempt to decrypt a IdentityLockbox using any of the LockKey and StreamKey instances stored. On success, the new IdentityKey is stored in the vault under the provided name.

fn decrypt_stream_key(
    &self,
    name: String,
    lock: &StreamLockboxRef
) -> Result<StreamKey, CryptoError>
[src]

Attempt to decrypt a StreamLockbox using any of the LockKey and StreamKey instances stored. On success, the new StreamKey is stored in the vault under the provided name.

fn decrypt_data(&self, lock: &DataLockbox) -> Result<Vec<u8>, CryptoError>[src]

Attempt to decrypt a StreamLockbox using any of the LockKey and StreamKey instances stored.

Loading content...

Implementors

Loading content...