Enum aptos_secure_storage::Storage
source · [−]pub enum Storage {
GitHubStorage(GitHubStorage),
VaultStorage(VaultStorage),
InMemoryStorage(InMemoryStorage),
NamespacedStorage(Namespaced<Box<Storage>>),
OnDiskStorage(OnDiskStorage),
}Expand description
This is the interface into secure storage. Any storage engine implementing this trait should support both key/value operations (e.g., get, set and create) and cryptographic key operations (e.g., generate_key, sign and rotate_key). This is a hack that allows us to convert from SecureBackend into a useable T: Storage. This boilerplate can be 100% generated by a proc macro.
Variants
GitHubStorage(GitHubStorage)
VaultStorage(VaultStorage)
InMemoryStorage(InMemoryStorage)
NamespacedStorage(Namespaced<Box<Storage>>)
OnDiskStorage(OnDiskStorage)
Trait Implementations
sourceimpl CryptoStorage for Box<Storage>
impl CryptoStorage for Box<Storage>
sourcefn create_key(&mut self, name: &str) -> Result<Ed25519PublicKey, Error>
fn create_key(&mut self, name: &str) -> Result<Ed25519PublicKey, Error>
Securely generates a new named Ed25519 private key. The behavior for calling this interface multiple times with the same name is implementation specific. Read more
sourcefn export_private_key(&self, name: &str) -> Result<Ed25519PrivateKey, Error>
fn export_private_key(&self, name: &str) -> Result<Ed25519PrivateKey, Error>
Returns the Ed25519 private key stored at ‘name’.
sourcefn import_private_key(
&mut self,
name: &str,
key: Ed25519PrivateKey
) -> Result<(), Error>
fn import_private_key(
&mut self,
name: &str,
key: Ed25519PrivateKey
) -> Result<(), Error>
An optional API that allows importing private keys and storing them at the provided name. This is not intended to be used in production and the API may throw unimplemented if not used correctly. As this is purely a testing API, there is no defined behavior for importing a key for a given name if that name already exists. It only exists to allow running in test environments where a set of deterministic keys must be generated. Read more
sourcefn export_private_key_for_version(
&self,
name: &str,
version: Ed25519PublicKey
) -> Result<Ed25519PrivateKey, Error>
fn export_private_key_for_version(
&self,
name: &str,
version: Ed25519PublicKey
) -> Result<Ed25519PrivateKey, Error>
Returns the Ed25519 private key stored at ‘name’ and identified by ‘version’, which is the corresponding public key. This may fail even if the ‘named’ key exists but the version is not present. Read more
sourcefn get_public_key(&self, name: &str) -> Result<PublicKeyResponse, Error>
fn get_public_key(&self, name: &str) -> Result<PublicKeyResponse, Error>
Returns the Ed25519 public key stored at ‘name’.
sourcefn get_public_key_previous_version(
&self,
name: &str
) -> Result<Ed25519PublicKey, Error>
fn get_public_key_previous_version(
&self,
name: &str
) -> Result<Ed25519PublicKey, Error>
Returns the previous version of the Ed25519 public key stored at ‘name’. For the most recent version, see ‘get_public_key(..)’ above. Read more
sourcefn rotate_key(&mut self, name: &str) -> Result<Ed25519PublicKey, Error>
fn rotate_key(&mut self, name: &str) -> Result<Ed25519PublicKey, Error>
Rotates an Ed25519 private key. Future calls without version to this ‘named’ key will return the rotated key instance. The previous key is retained and can be accessed via the version. At most two versions are expected to be retained. Read more
sourcefn sign<T: CryptoHash + Serialize>(
&self,
name: &str,
message: &T
) -> Result<Ed25519Signature, Error>
fn sign<T: CryptoHash + Serialize>(
&self,
name: &str,
message: &T
) -> Result<Ed25519Signature, Error>
Signs the provided securely-hashable struct, using the ‘named’ private key. Read more
sourcefn sign_using_version<T: CryptoHash + Serialize>(
&self,
name: &str,
version: Ed25519PublicKey,
message: &T
) -> Result<Ed25519Signature, Error>
fn sign_using_version<T: CryptoHash + Serialize>(
&self,
name: &str,
version: Ed25519PublicKey,
message: &T
) -> Result<Ed25519Signature, Error>
Signs the provided securely-hashable struct, using the ‘named’ and ‘versioned’ private key. This may fail even if the ‘named’ key exists but the version is not present. Read more
sourceimpl CryptoStorage for Storage
impl CryptoStorage for Storage
sourcefn create_key(
&mut self,
__enum_dispatch_arg_0: &str
) -> Result<Ed25519PublicKey, Error>
fn create_key(
&mut self,
__enum_dispatch_arg_0: &str
) -> Result<Ed25519PublicKey, Error>
Securely generates a new named Ed25519 private key. The behavior for calling this interface multiple times with the same name is implementation specific.
sourcefn export_private_key(
&self,
__enum_dispatch_arg_0: &str
) -> Result<Ed25519PrivateKey, Error>
fn export_private_key(
&self,
__enum_dispatch_arg_0: &str
) -> Result<Ed25519PrivateKey, Error>
Returns the Ed25519 private key stored at ‘name’.
sourcefn import_private_key(
&mut self,
__enum_dispatch_arg_0: &str,
__enum_dispatch_arg_1: Ed25519PrivateKey
) -> Result<(), Error>
fn import_private_key(
&mut self,
__enum_dispatch_arg_0: &str,
__enum_dispatch_arg_1: Ed25519PrivateKey
) -> Result<(), Error>
An optional API that allows importing private keys and storing them at the provided name. This is not intended to be used in production and the API may throw unimplemented if not used correctly. As this is purely a testing API, there is no defined behavior for importing a key for a given name if that name already exists. It only exists to allow running in test environments where a set of deterministic keys must be generated.
sourcefn export_private_key_for_version(
&self,
__enum_dispatch_arg_0: &str,
__enum_dispatch_arg_1: Ed25519PublicKey
) -> Result<Ed25519PrivateKey, Error>
fn export_private_key_for_version(
&self,
__enum_dispatch_arg_0: &str,
__enum_dispatch_arg_1: Ed25519PublicKey
) -> Result<Ed25519PrivateKey, Error>
Returns the Ed25519 private key stored at ‘name’ and identified by ‘version’, which is the corresponding public key. This may fail even if the ‘named’ key exists but the version is not present.
sourcefn get_public_key(
&self,
__enum_dispatch_arg_0: &str
) -> Result<PublicKeyResponse, Error>
fn get_public_key(
&self,
__enum_dispatch_arg_0: &str
) -> Result<PublicKeyResponse, Error>
Returns the Ed25519 public key stored at ‘name’.
sourcefn get_public_key_previous_version(
&self,
__enum_dispatch_arg_0: &str
) -> Result<Ed25519PublicKey, Error>
fn get_public_key_previous_version(
&self,
__enum_dispatch_arg_0: &str
) -> Result<Ed25519PublicKey, Error>
Returns the previous version of the Ed25519 public key stored at ‘name’. For the most recent version, see ‘get_public_key(..)’ above.
sourcefn rotate_key(
&mut self,
__enum_dispatch_arg_0: &str
) -> Result<Ed25519PublicKey, Error>
fn rotate_key(
&mut self,
__enum_dispatch_arg_0: &str
) -> Result<Ed25519PublicKey, Error>
Rotates an Ed25519 private key. Future calls without version to this ‘named’ key will return the rotated key instance. The previous key is retained and can be accessed via the version. At most two versions are expected to be retained.
sourcefn sign<T: CryptoHash + Serialize>(
&self,
__enum_dispatch_arg_0: &str,
__enum_dispatch_arg_1: &T
) -> Result<Ed25519Signature, Error>
fn sign<T: CryptoHash + Serialize>(
&self,
__enum_dispatch_arg_0: &str,
__enum_dispatch_arg_1: &T
) -> Result<Ed25519Signature, Error>
Signs the provided securely-hashable struct, using the ‘named’ private key.
sourcefn sign_using_version<T: CryptoHash + Serialize>(
&self,
__enum_dispatch_arg_0: &str,
__enum_dispatch_arg_1: Ed25519PublicKey,
__enum_dispatch_arg_2: &T
) -> Result<Ed25519Signature, Error>
fn sign_using_version<T: CryptoHash + Serialize>(
&self,
__enum_dispatch_arg_0: &str,
__enum_dispatch_arg_1: Ed25519PublicKey,
__enum_dispatch_arg_2: &T
) -> Result<Ed25519Signature, Error>
Signs the provided securely-hashable struct, using the ‘named’ and ‘versioned’ private key. This may fail even if the ‘named’ key exists but the version is not present.
sourceimpl From<GitHubStorage> for Storage
impl From<GitHubStorage> for Storage
sourcefn from(v: GitHubStorage) -> Storage
fn from(v: GitHubStorage) -> Storage
Converts to this type from the input type.
sourceimpl From<InMemoryStorage> for Storage
impl From<InMemoryStorage> for Storage
sourcefn from(v: InMemoryStorage) -> Storage
fn from(v: InMemoryStorage) -> Storage
Converts to this type from the input type.
sourceimpl From<OnDiskStorage> for Storage
impl From<OnDiskStorage> for Storage
sourcefn from(v: OnDiskStorage) -> Storage
fn from(v: OnDiskStorage) -> Storage
Converts to this type from the input type.
sourceimpl From<VaultStorage> for Storage
impl From<VaultStorage> for Storage
sourcefn from(v: VaultStorage) -> Storage
fn from(v: VaultStorage) -> Storage
Converts to this type from the input type.
sourceimpl KVStorage for Box<Storage>
impl KVStorage for Box<Storage>
sourcefn available(&self) -> Result<(), Error>
fn available(&self) -> Result<(), Error>
Returns an error if the backend service is not online and available.
sourcefn get<T: DeserializeOwned>(&self, key: &str) -> Result<GetResponse<T>, Error>
fn get<T: DeserializeOwned>(&self, key: &str) -> Result<GetResponse<T>, Error>
Retrieves a value from storage and fails if the backend is unavailable or the process has invalid permissions. Read more
sourceimpl KVStorage for Storage
impl KVStorage for Storage
sourcefn available(&self) -> Result<(), Error>
fn available(&self) -> Result<(), Error>
Returns an error if the backend service is not online and available.
sourcefn get<T: DeserializeOwned>(
&self,
__enum_dispatch_arg_0: &str
) -> Result<GetResponse<T>, Error>
fn get<T: DeserializeOwned>(
&self,
__enum_dispatch_arg_0: &str
) -> Result<GetResponse<T>, Error>
Retrieves a value from storage and fails if the backend is unavailable or the process has invalid permissions.
sourceimpl TryInto<GitHubStorage> for Storage
impl TryInto<GitHubStorage> for Storage
sourcefn try_into(
self
) -> Result<GitHubStorage, <Self as TryInto<GitHubStorage>>::Error>
fn try_into(
self
) -> Result<GitHubStorage, <Self as TryInto<GitHubStorage>>::Error>
Performs the conversion.
sourceimpl TryInto<InMemoryStorage> for Storage
impl TryInto<InMemoryStorage> for Storage
sourcefn try_into(
self
) -> Result<InMemoryStorage, <Self as TryInto<InMemoryStorage>>::Error>
fn try_into(
self
) -> Result<InMemoryStorage, <Self as TryInto<InMemoryStorage>>::Error>
Performs the conversion.
sourceimpl TryInto<OnDiskStorage> for Storage
impl TryInto<OnDiskStorage> for Storage
sourcefn try_into(
self
) -> Result<OnDiskStorage, <Self as TryInto<OnDiskStorage>>::Error>
fn try_into(
self
) -> Result<OnDiskStorage, <Self as TryInto<OnDiskStorage>>::Error>
Performs the conversion.
sourceimpl TryInto<VaultStorage> for Storage
impl TryInto<VaultStorage> for Storage
sourcefn try_into(
self
) -> Result<VaultStorage, <Self as TryInto<VaultStorage>>::Error>
fn try_into(
self
) -> Result<VaultStorage, <Self as TryInto<VaultStorage>>::Error>
Performs the conversion.
Auto Trait Implementations
impl RefUnwindSafe for Storage
impl Send for Storage
impl Sync for Storage
impl Unpin for Storage
impl UnwindSafe for Storage
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more