Struct btlib_tests::TEST_STORE
source · pub struct TEST_STORE { /* private fields */ }
Expand description
A static instance of InMemCredStore for use in tests.
Trait Implementations§
source§impl Deref for TEST_STORE
impl Deref for TEST_STORE
§type Target = InMemCredStore
type Target = InMemCredStore
The resulting type after dereferencing.
source§fn deref(&self) -> &InMemCredStore
fn deref(&self) -> &InMemCredStore
Dereferences the value.
impl LazyStatic for TEST_STORE
Auto Trait Implementations§
impl RefUnwindSafe for TEST_STORE
impl Send for TEST_STORE
impl Sync for TEST_STORE
impl Unpin for TEST_STORE
impl UnwindSafe for TEST_STORE
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
Mutably borrows from an owned value. Read more
§impl<T, P> CredStore for Pwhere
T: CredStore + ?Sized,
P: Deref<Target = T>,
impl<T, P> CredStore for Pwhere T: CredStore + ?Sized, P: Deref<Target = T>,
§type CredHandle = <T as CredStore>::CredHandle
type CredHandle = <T as CredStore>::CredHandle
The type of the credential handle returned by this store.
§type ExportedCreds = <T as CredStore>::ExportedCreds
type ExportedCreds = <T as CredStore>::ExportedCreds
The type of the exported credentials returned by this store.
§fn node_creds(&self) -> Result<<P as CredStore>::CredHandle, Error>
fn node_creds(&self) -> Result<<P as CredStore>::CredHandle, Error>
Returns the node credentials. If credentials haven’t been generated, they are generated
stored and returned.
§fn root_creds(
&self,
password: &str
) -> Result<<P as CredStore>::CredHandle, Error>
fn root_creds( &self, password: &str ) -> Result<<P as CredStore>::CredHandle, Error>
Returns the root credentials. If no root credentials have been generated, or the provided
password is incorrect, then an error is returned.
§fn storage_key(&self) -> Result<AsymKey<Public, Encrypt>, Error>
fn storage_key(&self) -> Result<AsymKey<Public, Encrypt>, Error>
Returns a public key which can be used to encrypt data intended only to be accessed by this
node. The returned key can be given as the
new_parent
parameter to the
[CredStore::export_root_creds] method.§fn export_root_creds(
&self,
root_creds: &<P as CredStore>::CredHandle,
password: &str,
new_parent: &AsymKey<Public, Encrypt>
) -> Result<<P as CredStore>::ExportedCreds, Error>
fn export_root_creds( &self, root_creds: &<P as CredStore>::CredHandle, password: &str, new_parent: &AsymKey<Public, Encrypt> ) -> Result<<P as CredStore>::ExportedCreds, Error>
Exports the root credentials. These can be serialized and persisted external to the
application and later loaded and deserialized and passed to the
[CredStoreMut::import_root_creds] method.
The
password
argument must match the value provided when the [CredStore::root_creds]
method was called. The new_parent
argument is the public key of the node that is to import
the root key, which can be obtained using the [CredStoreMut::gen_root_creds] method on the
importing node.§impl<T, P> CredStoreMut for Pwhere
T: CredStoreMut + ?Sized,
P: Deref<Target = T>,
impl<T, P> CredStoreMut for Pwhere T: CredStoreMut + ?Sized, P: Deref<Target = T>,
§fn gen_root_creds(
&self,
password: &str
) -> Result<<T as CredStore>::CredHandle, Error>
fn gen_root_creds( &self, password: &str ) -> Result<<T as CredStore>::CredHandle, Error>
Generates the root credentials and protects them using the given password. If the root
credentials have already been generated then an error is returned.
§fn import_root_creds(
&self,
password: &str,
exported: <P as CredStore>::ExportedCreds
) -> Result<<P as CredStore>::CredHandle, Error>
fn import_root_creds( &self, password: &str, exported: <P as CredStore>::ExportedCreds ) -> Result<<P as CredStore>::CredHandle, Error>
Imports root credentials that were previously created with [CredStore::export_root_creds].
The provided password must match the value that was given to that method.
§fn assign_node_writecap(
&self,
handle: &mut <P as CredStore>::CredHandle,
writecap: Writecap
) -> Result<(), Error>
fn assign_node_writecap( &self, handle: &mut <P as CredStore>::CredHandle, writecap: Writecap ) -> Result<(), Error>
Assigns the given [Writecap] to the node credentials referred to by the given handle.
This method is responsible for committing the given [Writecap] to durable storage.
§fn assign_root_writecap(
&self,
handle: &mut <P as CredStore>::CredHandle,
writecap: Writecap
) -> Result<(), Error>
fn assign_root_writecap( &self, handle: &mut <P as CredStore>::CredHandle, writecap: Writecap ) -> Result<(), Error>
Assigns
writecap
to the root credentials referred to by handle
. This method
is responsible for committing the given [Writecap] to durable storage.§fn provision_root(
&self,
password: &str,
expires: Epoch
) -> Result<Self::CredHandle, Error>
fn provision_root( &self, password: &str, expires: Epoch ) -> Result<Self::CredHandle, Error>
Generates new root credentials protected by
password
and issues them a self-signed
[Writecap] which expires after valid_for
. The newly generated root credentials are
returned.§fn provision_node_start(&self) -> Result<Principal, Error>
fn provision_node_start(&self) -> Result<Principal, Error>
Begin the provisioning process for a node by generating a new set of node credentials. The
[Principal] of the newly generated credentials is returned. This [Principal] may then be
transmitted to a root node which can use it to issue a [Writecap] to this node.
§fn provision_node_finish(
&self,
writecap: Writecap
) -> Result<Self::CredHandle, Error>
fn provision_node_finish( &self, writecap: Writecap ) -> Result<Self::CredHandle, Error>
Assigns the given [Writecap] to the node credentials and commits it to durable storage.
A handle to the node credentials is returned.