Trait fog_crypto::Vault
source · [−]pub trait Vault {
Show 19 methods
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>;
}
Expand description
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
fn new_id(&self, name: String) -> IdentityKey
Create & store a new IdentityKey
.
fn new_stream(&self, name: String) -> StreamKey
fn new_stream(&self, name: String) -> StreamKey
Create & store a new StreamKey
.
fn get_id(&self, name: &str) -> Option<IdentityKey>
fn get_id(&self, name: &str) -> Option<IdentityKey>
Fetch a stored IdentityKey
by name. Returns none if no key by that name is stored.
Fetch a stored LockKey
by name. Returns none if no key by that name is stored.
fn get_stream(&self, name: &str) -> Option<StreamKey>
fn get_stream(&self, name: &str) -> Option<StreamKey>
Fetch a stored StreamKey
by name. Returns none if no key by that name is stored.
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.
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.
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.
Change the lookup name for a StreamKey
.
fn rename_lock(&self, old_name: &str, new_name: String) -> bool
fn rename_lock(&self, old_name: &str, new_name: String) -> bool
Change the lookup name for a StreamKey
.
fn rename_stream(&self, old_name: &str, new_name: String) -> bool
fn rename_stream(&self, old_name: &str, new_name: String) -> bool
Change the lookup name for a StreamKey
.
fn remove_lock(&self, name: &str) -> bool
fn remove_lock(&self, name: &str) -> bool
Remove the LockKey
stored under this name.
fn remove_stream(&self, name: &str) -> bool
fn remove_stream(&self, name: &str) -> bool
Remove the StreamKey
stored under this name.
fn decrypt_lock_key(
&self,
name: String,
lock: &LockLockboxRef
) -> Result<LockKey, CryptoError>
fn decrypt_lock_key(
&self,
name: String,
lock: &LockLockboxRef
) -> Result<LockKey, CryptoError>
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>
fn decrypt_identity_key(
&self,
name: String,
lock: &IdentityLockboxRef
) -> Result<IdentityKey, CryptoError>
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>
fn decrypt_stream_key(
&self,
name: String,
lock: &StreamLockboxRef
) -> Result<StreamKey, CryptoError>
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>
fn decrypt_data(&self, lock: &DataLockbox) -> Result<Vec<u8>, CryptoError>
Attempt to decrypt a StreamLockbox
using any of the LockKey
and StreamKey
instances
stored.