Struct identity_iota::account_storage::Stronghold
source · [−]pub struct Stronghold { /* private fields */ }
account
only.Expand description
The implementation of the Storage
interface using Stronghold
.
Stronghold is a secure storage for sensitive data. Secrets that are stored inside a Stronghold can never be read, but only be accessed via cryptographic procedures. Data written into a Stronghold is persisted in snapshots which are encrypted using the provided password.
Implementations
sourceimpl Stronghold
impl Stronghold
sourcepub async fn new<T>(
path: &T,
password: String,
dropsave: Option<bool>
) -> Result<Stronghold, Error> where
T: AsRef<Path> + ?Sized,
pub async fn new<T>(
path: &T,
password: String,
dropsave: Option<bool>
) -> Result<Stronghold, Error> where
T: AsRef<Path> + ?Sized,
Constructs a Stronghold storage instance.
Arguments:
path
: path to a local Stronghold snapshot file. Will be created if it does not exist.password
: password for the Stronghold snapshot file. If this is cloned from a reference, zeroization of that reference is strongly recommended.dropsave
: persist all changes when the instance is dropped. Default: true.
sourcepub fn set_dropsave(&mut self, dropsave: bool)
pub fn set_dropsave(&mut self, dropsave: bool)
Sets whether dropsave is enabled.
Trait Implementations
sourceimpl Debug for Stronghold
impl Debug for Stronghold
sourceimpl Drop for Stronghold
impl Drop for Stronghold
sourceimpl Storage for Stronghold
impl Storage for Stronghold
sourcefn did_create<'life0, 'life1, 'async_trait>(
&'life0 self,
network: NetworkName,
fragment: &'life1 str,
private_key: Option<Key<Private>>
) -> Pin<Box<dyn Future<Output = Result<(IotaDID, KeyLocation), Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Stronghold: 'async_trait,
fn did_create<'life0, 'life1, 'async_trait>(
&'life0 self,
network: NetworkName,
fragment: &'life1 str,
private_key: Option<Key<Private>>
) -> Pin<Box<dyn Future<Output = Result<(IotaDID, KeyLocation), Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Stronghold: 'async_trait,
Creates a new identity for the given network
. Read more
sourcefn did_purge<'life0, 'life1, 'async_trait>(
&'life0 self,
did: &'life1 IotaDID
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Stronghold: 'async_trait,
fn did_purge<'life0, 'life1, 'async_trait>(
&'life0 self,
did: &'life1 IotaDID
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Stronghold: 'async_trait,
Removes the keys and any other state for the given did
. Read more
sourcefn did_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
did: &'life1 IotaDID
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Stronghold: 'async_trait,
fn did_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
did: &'life1 IotaDID
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Stronghold: 'async_trait,
Returns true
if did
exists in the list of stored DIDs.
sourcefn did_list<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<IotaDID, Global>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Stronghold: 'async_trait,
fn did_list<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<IotaDID, Global>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Stronghold: 'async_trait,
Returns the list of stored DIDs.
sourcefn key_generate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
did: &'life1 IotaDID,
key_type: KeyType,
fragment: &'life2 str
) -> Pin<Box<dyn Future<Output = Result<KeyLocation, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Stronghold: 'async_trait,
fn key_generate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
did: &'life1 IotaDID,
key_type: KeyType,
fragment: &'life2 str
) -> Pin<Box<dyn Future<Output = Result<KeyLocation, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Stronghold: 'async_trait,
Generates a new key for the given did
with the given key_type
and fragment
identifier
and returns the location of the newly generated key. Read more
sourcefn key_insert<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
did: &'life1 IotaDID,
location: &'life2 KeyLocation,
private_key: Key<Private>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Stronghold: 'async_trait,
fn key_insert<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
did: &'life1 IotaDID,
location: &'life2 KeyLocation,
private_key: Key<Private>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Stronghold: 'async_trait,
Inserts a private key at the specified location
. Read more
sourcefn key_public<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
did: &'life1 IotaDID,
location: &'life2 KeyLocation
) -> Pin<Box<dyn Future<Output = Result<Key<Public>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Stronghold: 'async_trait,
fn key_public<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
did: &'life1 IotaDID,
location: &'life2 KeyLocation
) -> Pin<Box<dyn Future<Output = Result<Key<Public>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Stronghold: 'async_trait,
Retrieves the public key from location
.
sourcefn key_delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
did: &'life1 IotaDID,
location: &'life2 KeyLocation
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Stronghold: 'async_trait,
fn key_delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
did: &'life1 IotaDID,
location: &'life2 KeyLocation
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Stronghold: 'async_trait,
Deletes the key at location
. Read more
sourcefn key_sign<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
did: &'life1 IotaDID,
location: &'life2 KeyLocation,
data: Vec<u8, Global>
) -> Pin<Box<dyn Future<Output = Result<Signature, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Stronghold: 'async_trait,
fn key_sign<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
did: &'life1 IotaDID,
location: &'life2 KeyLocation,
data: Vec<u8, Global>
) -> Pin<Box<dyn Future<Output = Result<Signature, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Stronghold: 'async_trait,
Signs data
with the private key at the specified location
.
sourcefn key_exists<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
did: &'life1 IotaDID,
location: &'life2 KeyLocation
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Stronghold: 'async_trait,
fn key_exists<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
did: &'life1 IotaDID,
location: &'life2 KeyLocation
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Stronghold: 'async_trait,
Returns true
if a key exists at the specified location
.
sourcefn data_encrypt<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
did: &'life1 IotaDID,
plaintext: Vec<u8, Global>,
associated_data: Vec<u8, Global>,
encryption_algorithm: &'life2 EncryptionAlgorithm,
cek_algorithm: &'life3 CekAlgorithm,
public_key: Key<Public>
) -> Pin<Box<dyn Future<Output = Result<EncryptedData, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Stronghold: 'async_trait,
fn data_encrypt<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
did: &'life1 IotaDID,
plaintext: Vec<u8, Global>,
associated_data: Vec<u8, Global>,
encryption_algorithm: &'life2 EncryptionAlgorithm,
cek_algorithm: &'life3 CekAlgorithm,
public_key: Key<Public>
) -> Pin<Box<dyn Future<Output = Result<EncryptedData, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Stronghold: 'async_trait,
Encrypts the given plaintext
with the specified encryption_algorithm
and cek_algorithm
. Read more
sourcefn data_decrypt<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
did: &'life1 IotaDID,
data: EncryptedData,
encryption_algorithm: &'life2 EncryptionAlgorithm,
cek_algorithm: &'life3 CekAlgorithm,
private_key: &'life4 KeyLocation
) -> Pin<Box<dyn Future<Output = Result<Vec<u8, Global>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Stronghold: 'async_trait,
fn data_decrypt<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
did: &'life1 IotaDID,
data: EncryptedData,
encryption_algorithm: &'life2 EncryptionAlgorithm,
cek_algorithm: &'life3 CekAlgorithm,
private_key: &'life4 KeyLocation
) -> Pin<Box<dyn Future<Output = Result<Vec<u8, Global>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Stronghold: 'async_trait,
Decrypts the given data
with the specified encryption_algorithm
and cek_algorithm
. Read more
sourcefn chain_state_get<'life0, 'life1, 'async_trait>(
&'life0 self,
did: &'life1 IotaDID
) -> Pin<Box<dyn Future<Output = Result<Option<ChainState>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Stronghold: 'async_trait,
fn chain_state_get<'life0, 'life1, 'async_trait>(
&'life0 self,
did: &'life1 IotaDID
) -> Pin<Box<dyn Future<Output = Result<Option<ChainState>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Stronghold: 'async_trait,
Returns the chain state of the identity specified by did
.
sourcefn chain_state_set<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
did: &'life1 IotaDID,
chain_state: &'life2 ChainState
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Stronghold: 'async_trait,
fn chain_state_set<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
did: &'life1 IotaDID,
chain_state: &'life2 ChainState
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Stronghold: 'async_trait,
Set the chain state of the identity specified by did
.
sourcefn document_get<'life0, 'life1, 'async_trait>(
&'life0 self,
did: &'life1 IotaDID
) -> Pin<Box<dyn Future<Output = Result<Option<IotaDocument>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Stronghold: 'async_trait,
fn document_get<'life0, 'life1, 'async_trait>(
&'life0 self,
did: &'life1 IotaDID
) -> Pin<Box<dyn Future<Output = Result<Option<IotaDocument>, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Stronghold: 'async_trait,
Returns the IotaDocument
of the identity specified by did
.
sourcefn document_set<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
did: &'life1 IotaDID,
document: &'life2 IotaDocument
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Stronghold: 'async_trait,
fn document_set<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
did: &'life1 IotaDID,
document: &'life2 IotaDocument
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Stronghold: 'async_trait,
Sets a new state for the identity specified by did
.
Auto Trait Implementations
impl !RefUnwindSafe for Stronghold
impl Send for Stronghold
impl Sync for Stronghold
impl Unpin for Stronghold
impl UnwindSafe for Stronghold
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