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
impl AccountKeys
Sourcepub fn private_bytes(&self) -> Zeroizing<[u8; 64]>
pub fn private_bytes(&self) -> Zeroizing<[u8; 64]>
The private halves, as AccountKeys::from_private takes them.
Sourcepub fn from_private_bytes(bytes: &[u8]) -> Option<Self>
pub fn from_private_bytes(bytes: &[u8]) -> Option<Self>
The key pairs from their private halves, if bytes holds 64.
Sourcepub fn public_keys(&self) -> Vec<u8> ⓘ
pub fn public_keys(&self) -> Vec<u8> ⓘ
The public halves: X25519, then Ed25519, 32 bytes each.
Sourcepub fn wrap(&self, derived: &Derived, name: &str) -> Result<Vec<u8>>
pub fn wrap(&self, derived: &Derived, name: &str) -> Result<Vec<u8>>
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.
Sourcepub fn unwrap(
derived: &Derived,
name: &str,
wrapped: &[u8],
public_keys: &[u8],
) -> Result<Self, AccountError>
pub fn unwrap( derived: &Derived, name: &str, wrapped: &[u8], public_keys: &[u8], ) -> Result<Self, 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
impl AccountKeys
Sourcepub fn sign(&self, message: &[u8]) -> Vec<u8> ⓘ
pub fn sign(&self, message: &[u8]) -> Vec<u8> ⓘ
The account’s Ed25519 signature of message (#88).
Sourcepub fn open_sealed(
&self,
info: &[u8],
sealed: &[u8],
) -> Result<Zeroizing<Vec<u8>>, AccountError>
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.