Struct hc_seed_bundle::UnlockedSeedBundle
source · 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() -> SodokenResult<Self>
pub async fn new_random() -> SodokenResult<Self>
Construct a new random seed SeedBundle.
sourcepub async fn from_locked(bytes: &[u8]) -> SodokenResult<Vec<LockedSeedCipher>>
pub async fn from_locked(bytes: &[u8]) -> SodokenResult<Vec<LockedSeedCipher>>
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 = SodokenResult<Self>> + 'static + Send
pub fn derive( &self, index: u32 ) -> impl Future<Output = SodokenResult<Self>> + 'static + Send
Derive a new sub SeedBundle by given index.
sourcepub fn get_sign_pub_key(
&self
) -> BufReadSized<{ sodoken::sign::PUBLICKEYBYTES }>
pub fn get_sign_pub_key( &self ) -> BufReadSized<{ sodoken::sign::PUBLICKEYBYTES }>
Get the signature pub key generated by this seed.
sourcepub fn sign_detached<M>(
&self,
message: M
) -> impl Future<Output = SodokenResult<BufReadSized<{ sodoken::sign::BYTES }>>> + 'static + Send
pub fn sign_detached<M>( &self, message: M ) -> impl Future<Output = SodokenResult<BufReadSized<{ sodoken::sign::BYTES }>>> + 'static + Send
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) -> SodokenResult<T>where
T: 'static + for<'de> Deserialize<'de>,
pub fn get_app_data<T>(&self) -> SodokenResult<T>where
T: 'static + for<'de> Deserialize<'de>,
Get the decoded appData bytes by type.
sourcepub fn set_app_data<T>(&mut self, t: &T) -> SodokenResult<()>where
T: Serialize,
pub fn set_app_data<T>(&mut self, t: &T) -> SodokenResult<()>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 more