Struct diem_secure_storage::VaultStorage
source · pub struct VaultStorage { /* private fields */ }
Expand description
VaultStorage utilizes Vault for maintaining encrypted, authenticated data
for Diem. This version currently matches the behavior of OnDiskStorage and
InMemoryStorage. In the future, Vault will be able to create keys, sign
messages, and handle permissions across different services. The specific
vault service leveraged herein is called [KV (Key Value) Secrets Engine - Version 2](<https://www.vaultproject.io/api/secret/kv/kv-v2.html>
). So while Diem Secure Storage
calls pointers to data keys, Vault has actually a secret that contains
multiple key value pairs.
Implementations§
source§impl VaultStorage
impl VaultStorage
pub fn new( host: String, token: String, namespace: Option<String>, certificate: Option<String>, renew_ttl_secs: Option<u32>, use_cas: bool, connection_timeout_ms: Option<u64>, response_timeout_ms: Option<u64> ) -> Self
sourcepub fn create_token(&self, policies: Vec<&str>) -> Result<String, Error>
pub fn create_token(&self, policies: Vec<&str>) -> Result<String, Error>
Creates a token but uses the namespace for policies
sourcepub fn set_policy(
&self,
policy_name: &str,
engine: &VaultEngine,
key: &str,
capabilities: &[Capability]
) -> Result<(), Error>
pub fn set_policy( &self, policy_name: &str, engine: &VaultEngine, key: &str, capabilities: &[Capability] ) -> Result<(), Error>
Create a new policy in Vault, see the explanation for Policy for how the data is structured. Vault does not distingush a create and update. An update must first read the existing policy, amend the contents, and then be applied via this API.
pub fn set_policies( &self, name: &str, engine: &VaultEngine, policy: &Policy ) -> Result<(), Error>
Trait Implementations§
source§impl CryptoStorage for VaultStorage
impl CryptoStorage for VaultStorage
source§fn create_key(&mut self, name: &str) -> Result<ConsensusPublicKey, Error>
fn create_key(&mut self, name: &str) -> Result<ConsensusPublicKey, Error>
source§fn export_private_key(&self, name: &str) -> Result<ConsensusPrivateKey, Error>
fn export_private_key(&self, name: &str) -> Result<ConsensusPrivateKey, Error>
source§fn export_private_key_for_version(
&self,
name: &str,
version: ConsensusPublicKey
) -> Result<ConsensusPrivateKey, Error>
fn export_private_key_for_version( &self, name: &str, version: ConsensusPublicKey ) -> Result<ConsensusPrivateKey, Error>
source§fn import_private_key(
&mut self,
name: &str,
key: ConsensusPrivateKey
) -> Result<(), Error>
fn import_private_key( &mut self, name: &str, key: ConsensusPrivateKey ) -> Result<(), Error>
source§fn get_public_key(&self, name: &str) -> Result<PublicKeyResponse, Error>
fn get_public_key(&self, name: &str) -> Result<PublicKeyResponse, Error>
source§fn get_public_key_previous_version(
&self,
name: &str
) -> Result<ConsensusPublicKey, Error>
fn get_public_key_previous_version( &self, name: &str ) -> Result<ConsensusPublicKey, Error>
source§fn rotate_key(&mut self, name: &str) -> Result<ConsensusPublicKey, Error>
fn rotate_key(&mut self, name: &str) -> Result<ConsensusPublicKey, Error>
source§fn sign<T: CryptoHash + Serialize>(
&self,
name: &str,
message: &T
) -> Result<ConsensusSignature, Error>
fn sign<T: CryptoHash + Serialize>( &self, name: &str, message: &T ) -> Result<ConsensusSignature, Error>
source§fn sign_using_version<T: CryptoHash + Serialize>(
&self,
name: &str,
version: ConsensusPublicKey,
message: &T
) -> Result<ConsensusSignature, Error>
fn sign_using_version<T: CryptoHash + Serialize>( &self, name: &str, version: ConsensusPublicKey, message: &T ) -> Result<ConsensusSignature, Error>
source§impl From<VaultStorage> for Storage
impl From<VaultStorage> for Storage
source§fn from(v: VaultStorage) -> Storage
fn from(v: VaultStorage) -> Storage
source§impl KVStorage for VaultStorage
impl KVStorage for VaultStorage
source§fn available(&self) -> Result<(), Error>
fn available(&self) -> Result<(), Error>
source§fn get<T: DeserializeOwned>(&self, key: &str) -> Result<GetResponse<T>, Error>
fn get<T: DeserializeOwned>(&self, key: &str) -> Result<GetResponse<T>, Error>
Auto Trait Implementations§
impl RefUnwindSafe for VaultStorage
impl Send for VaultStorage
impl Sync for VaultStorage
impl Unpin for VaultStorage
impl UnwindSafe for VaultStorage
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.