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

This structure represents Wildland cryptographic identity.

It uses BIP39 and BIP32 processes to derive keypairs of three purposes:

  • signing (not rotated, used to sign “user manifest”)
  • encryption (used by other people to encrypt secrets to the user, rotated)
  • single-use-encryption - to transfer secrets in public

Implementations§

source§

impl Identity

source

pub fn forest_keypair( &self, forest_index: u64 ) -> Result<SigningKeypair, KeyDeriveError>

Derive the key that represents a forest. Pubkey represents forest to the world.

source

pub fn encryption_keypair( &self, forest_index: u64, index: u64 ) -> Result<EncryptingKeypair, KeyDeriveError>

Derive current encryption key, used to encrypt secrets to the owner of the forest. This keypair should be rotated whenever any of user’s devices is compromised / stolen / lost. Current encryption pubkey should be accessible to anyone willing to communicate with the user.

source

pub fn single_use_encryption_keypair( &self, index: u64 ) -> Result<EncryptingKeypair, KeyDeriveError>

Deterministically derive single-use encryption key. Send it to the seller of storage, so it can use it to encrypt your storage credentials. By bumping index, one can create multiple keys to be used with different on-chain identities, making linking the purchases harder. Please note that this keys are not scoped to particular forest, since they are supposed to be used only once anyway.

source

pub fn backup_keypair(&self) -> Result<EncryptingKeypair, KeyDeriveError>

Deterministically derive encryption keypair that can be used to backup secrets with intent of using them later, during recovery process. This keypair is not scoped to the forest. It should be used only internally.

source

pub fn get_mnemonic(&self) -> MnemonicPhrase

Trait Implementations§

source§

impl Debug for Identity

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl TryFrom<&[String; 12]> for Identity

source§

fn try_from(mnemonic_phrase: &MnemonicPhrase) -> Result<Self, Self::Error>

Derive identity from mnemonic phrase.

Derived identity is bound to Wildland project - same 12 words will produce different seed (number) in other project. Only English language is accepted.

§

type Error = CryptoError

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

impl TryFrom<&[u8]> for Identity

source§

fn try_from(entropy: &[u8]) -> Result<Self, CryptoError>

Deterministically derive Wildland identity from Ethereum signature (or any random bits). Assumes high quality entropy and does not perform any checks.

§

type Error = CryptoError

The type returned in the event of a conversion error.

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere 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> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere 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 Twhere 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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more