Skip to main content

AccountKeys

Struct AccountKeys 

Source
pub struct AccountKeys { /* private fields */ }
Expand description

The account’s key pairs: X25519 (to receive sealed session keys) and Ed25519 (to sign commands). Its Debug hides the private halves.

Implementations§

Source§

impl AccountKeys

Source

pub fn generate() -> Result<AccountKeys, Error>

New key pairs.

§Errors

When the system’s random source fails.

Source

pub fn private_bytes(&self) -> Zeroizing<[u8; 64]>

The private halves, as AccountKeys::from_private takes them.

Source

pub fn from_private_bytes(bytes: &[u8]) -> Option<AccountKeys>

The key pairs from their private halves, if bytes holds 64.

Source

pub fn public_keys(&self) -> Vec<u8> ⓘ

The public halves: X25519, then Ed25519, 32 bytes each.

Source

pub fn wrap(&self, derived: &Derived, name: &str) -> Result<Vec<u8>, Error>

The private halves wrapped under derived’s wrapping key, bound to account name: a nonce, then the ciphertext.

§Errors

When the system’s random source fails.

Source

pub fn unwrap( derived: &Derived, name: &str, wrapped: &[u8], public_keys: &[u8], ) -> Result<AccountKeys, AccountError>

The key pairs wrapped holds, for account name, under derived’s wrapping key; they must match public_keys.

§Errors

AccountError::WrongKeys when they do not open or do not match.

Source§

impl AccountKeys

Source

pub fn sign(&self, message: &[u8]) -> Vec<u8> ⓘ

The account’s Ed25519 signature of message (#88).

Source

pub fn open_sealed( &self, info: &[u8], sealed: &[u8], ) -> Result<Zeroizing<Vec<u8>>, AccountError>

What seal_to sealed to this account, for info.

§Errors

AccountError::WrongKeys when it does not open: sealed to another account, for another info, or altered.

Trait Implementations§

Source§

impl Debug for AccountKeys

Source§

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

Formats the value using the given formatter. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.
Source§

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

Source§

fn vzip(self) -> V