pub struct UnlockedSeedBundle { /* private fields */ }
Expand description

This is the main struct for interacting with SeedBundles.

To create an UnlockedSeedBundle:

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

source

pub async fn new_random() -> SodokenResult<Self>

Construct a new random seed SeedBundle.

source

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.

source

pub fn get_seed(&self) -> BufReadSized<32>

Get the actual seed tracked by this seed bundle.

source

pub fn derive( &self, index: u32 ) -> impl Future<Output = SodokenResult<Self>> + 'static + Send

Derive a new sub SeedBundle by given index.

source

pub fn get_sign_pub_key( &self ) -> BufReadSized<{ sodoken::sign::PUBLICKEYBYTES }>

Get the signature pub key generated by this seed.

source

pub fn sign_detached<M>( &self, message: M ) -> impl Future<Output = SodokenResult<BufReadSized<{ sodoken::sign::BYTES }>>> + 'static + Send
where M: Into<BufRead> + 'static + Send,

Sign some data with the secret key generated by this seed.

source

pub fn get_app_data_bytes(&self) -> &[u8]

Get the raw appData bytes.

source

pub fn set_app_data_bytes<B>(&mut self, app_data: B)
where B: Into<Arc<[u8]>>,

Set the raw appData bytes.

source

pub fn get_app_data<T>(&self) -> SodokenResult<T>
where T: 'static + for<'de> Deserialize<'de>,

Get the decoded appData bytes by type.

source

pub fn set_app_data<T>(&mut self, t: &T) -> SodokenResult<()>
where T: Serialize,

Set the encoded appData bytes by type.

source

pub fn lock(&self) -> SeedCipherBuilder

Get a SeedCipherBuilder that will allow us to lock this bundle.

Trait Implementations§

source§

impl Clone for UnlockedSeedBundle

source§

fn clone(&self) -> UnlockedSeedBundle

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.