Struct wildland_crypto::identity::Identity
source · [−]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
sourceimpl Identity
impl Identity
sourcepub fn forest_keypair(
&self,
forest_index: u64
) -> Result<SigningKeypair, KeyDeriveError>
pub fn forest_keypair(
&self,
forest_index: u64
) -> Result<SigningKeypair, KeyDeriveError>
Derive the key that represents a forest. Pubkey represents forest to the world.
sourcepub fn encryption_keypair(
&self,
forest_index: u64,
index: u64
) -> Result<EncryptingKeypair, KeyDeriveError>
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.
sourcepub fn single_use_encryption_keypair(
&self,
index: u64
) -> Result<EncryptingKeypair, KeyDeriveError>
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.
sourcepub fn backup_keypair(&self) -> Result<EncryptingKeypair, KeyDeriveError>
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.
pub fn get_mnemonic(&self) -> MnemonicPhrase
Trait Implementations
sourceimpl TryFrom<&[String; 12]> for Identity
impl TryFrom<&[String; 12]> for Identity
sourcefn try_from(mnemonic_phrase: &MnemonicPhrase) -> Result<Self, Self::Error>
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
type Error = CryptoError
sourceimpl TryFrom<&[u8]> for Identity
impl TryFrom<&[u8]> for Identity
sourcefn try_from(entropy: &[u8]) -> Result<Self, CryptoError>
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.