pub struct AccountFile {
pub user_id: Uuid,
pub device_id: Uuid,
pub wrapped_master: WrappedSecret,
pub sealed_ik: Vec<u8>,
pub sealed_dsk: Vec<u8>,
pub sealed_dek: Vec<u8>,
pub dek_binding: DekBinding,
}Expand description
The encrypted-at-rest account: the master key wrapped under a passphrase, and the device/identity private keys sealed under the master key. Safe to persist to disk.
Fields§
§user_id: UuidAccount owner id.
device_id: UuidThis device’s id.
wrapped_master: WrappedSecretMaster key wrapped under the passphrase (Argon2id + AES-256-GCM).
sealed_ik: Vec<u8>User IK seeds (64 bytes) sealed under the master key.
sealed_dsk: Vec<u8>Device DSK seeds (64 bytes) sealed under the master key.
sealed_dek: Vec<u8>The DEK’s software-sealed 32-byte seed under the master key: the X-Wing seed for a software DEK, the ML-KEM-768 seed for a hardware-bound one. A hardware classical half is never here — it is non-exportable by contract.
dek_binding: DekBindingWhere the DEK’s classical half lives. Absent in account files that predate
hardware DEKs, which are software-DEK by construction — hence the default, which is
what keeps every existing library on disk openable.
Implementations§
Source§impl AccountFile
impl AccountFile
Sourcepub fn unlock(&self, passphrase: &[u8]) -> Result<Account, CryptoError>
pub fn unlock(&self, passphrase: &[u8]) -> Result<Account, CryptoError>
Decrypt the account with passphrase. Returns CryptoError::Auth on a wrong
passphrase (master unwrap fails) or tampering.
A hardware-bound account (DekBinding::Hardware) cannot be unlocked this way — its
DEK’s classical half lives in an element this call was given no handle to — and returns
CryptoError::Key. Use unlock_with_element.
Sourcepub fn unlock_with_element(
&self,
passphrase: &[u8],
element: Option<Arc<dyn HardwareKeyAgreement>>,
) -> Result<Account, CryptoError>
pub fn unlock_with_element( &self, passphrase: &[u8], element: Option<Arc<dyn HardwareKeyAgreement>>, ) -> Result<Account, CryptoError>
As unlock, re-binding a DekBinding::Hardware account’s DEK to
element (the same secure element that enrolled it, e.g. a real Secure Enclave or a test
mock). The alias comes from the file, so the caller supplies only the element.
Passing an element for a software-DEK account is harmless and ignored: the binding recorded at creation decides, never the caller, so an attacker who can hand us an element cannot thereby move a software account onto a key they control.
Trait Implementations§
Source§impl Clone for AccountFile
impl Clone for AccountFile
Source§fn clone(&self) -> AccountFile
fn clone(&self) -> AccountFile
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AccountFile
impl Debug for AccountFile
Source§impl<'de> Deserialize<'de> for AccountFile
impl<'de> Deserialize<'de> for AccountFile
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for AccountFile
impl RefUnwindSafe for AccountFile
impl Send for AccountFile
impl Sync for AccountFile
impl Unpin for AccountFile
impl UnsafeUnpin for AccountFile
impl UnwindSafe for AccountFile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more