pub struct UnlockedSeedBundle { /* private fields */ }
Expand description
This is the main struct for interacting with SeedBundles.
To create an UnlockedSeedBundle:
- A new random bundle: UnlockedSeedBundle::new_random
- Derived from an existing bundle: UnlockedSeedBundle::derive
- Unlock encrypted bundle bytes: UnlockedSeedBundle::from_locked
Once unlocked, you can get or set associated app data, or sign messages.
To “lock” (generate encrypted binary seed bundle representation), use UnlockedSeedBundle::lock and supply the desired SeedCiphers.
Implementations§
source§impl UnlockedSeedBundle
impl UnlockedSeedBundle
sourcepub async fn new_random() -> Result<UnlockedSeedBundle, OneErr>
pub async fn new_random() -> Result<UnlockedSeedBundle, OneErr>
Construct a new random seed SeedBundle.
sourcepub async fn from_locked(bytes: &[u8]) -> Result<Vec<LockedSeedCipher>, OneErr>
pub async fn from_locked(bytes: &[u8]) -> Result<Vec<LockedSeedCipher>, OneErr>
Decode locked SeedBundle bytes into a list of LockedSeedCiphers to be used for decrypting the bundle.
sourcepub fn get_seed(&self) -> BufReadSized<32>
pub fn get_seed(&self) -> BufReadSized<32>
Get the actual seed tracked by this seed bundle.
sourcepub fn derive(
&self,
index: u32,
) -> impl Future<Output = Result<UnlockedSeedBundle, OneErr>> + Send + 'static
pub fn derive( &self, index: u32, ) -> impl Future<Output = Result<UnlockedSeedBundle, OneErr>> + Send + 'static
Derive a new sub SeedBundle by given index.
sourcepub fn get_sign_pub_key(
&self,
) -> BufReadSized<hc_seed_bundle::::unlocked_seed_bundle::{impl#0}::get_sign_pub_key::{constant#0}>
pub fn get_sign_pub_key( &self, ) -> BufReadSized<hc_seed_bundle::::unlocked_seed_bundle::{impl#0}::get_sign_pub_key::{constant#0}>
Get the signature pub key generated by this seed.
sourcepub fn sign_detached<M>(
&self,
message: M,
) -> impl Future<Output = Result<BufReadSized<hc_seed_bundle::::unlocked_seed_bundle::{impl#0}::sign_detached::{constant#0}>, OneErr>> + Send + 'static
pub fn sign_detached<M>( &self, message: M, ) -> impl Future<Output = Result<BufReadSized<hc_seed_bundle::::unlocked_seed_bundle::{impl#0}::sign_detached::{constant#0}>, OneErr>> + Send + 'static
Sign some data with the secret key generated by this seed.
sourcepub fn get_app_data_bytes(&self) -> &[u8] ⓘ
pub fn get_app_data_bytes(&self) -> &[u8] ⓘ
Get the raw appData bytes.
sourcepub fn set_app_data_bytes<B>(&mut self, app_data: B)
pub fn set_app_data_bytes<B>(&mut self, app_data: B)
Set the raw appData bytes.
sourcepub fn get_app_data<T>(&self) -> Result<T, OneErr>where
T: 'static + for<'de> Deserialize<'de>,
pub fn get_app_data<T>(&self) -> Result<T, OneErr>where
T: 'static + for<'de> Deserialize<'de>,
Get the decoded appData bytes by type.
sourcepub fn set_app_data<T>(&mut self, t: &T) -> Result<(), OneErr>where
T: Serialize,
pub fn set_app_data<T>(&mut self, t: &T) -> Result<(), OneErr>where
T: Serialize,
Set the encoded appData bytes by type.
sourcepub fn lock(&self) -> SeedCipherBuilder
pub fn lock(&self) -> SeedCipherBuilder
Get a SeedCipherBuilder that will allow us to lock this bundle.
Trait Implementations§
source§impl Clone for UnlockedSeedBundle
impl Clone for UnlockedSeedBundle
source§fn clone(&self) -> UnlockedSeedBundle
fn clone(&self) -> UnlockedSeedBundle
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for UnlockedSeedBundle
impl !RefUnwindSafe for UnlockedSeedBundle
impl Send for UnlockedSeedBundle
impl Sync for UnlockedSeedBundle
impl Unpin for UnlockedSeedBundle
impl !UnwindSafe for UnlockedSeedBundle
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more