pub struct DirectoryCore {
pub user_id: Uuid,
pub directory_version: u64,
pub updated_at: String,
pub devices: Vec<DeviceEntry>,
pub unknown: BTreeMap<String, Value>,
}Expand description
The unsigned core of a directory — exactly the bytes the master signature covers.
Unknown keys survive under the signature (Versioning — invariant 2), here and in every
DeviceEntry: a directory from a newer writer that only adds a key decodes, re-emits that
key canonically, and so still verifies; stripping it fails verification.
Fields§
§user_id: UuidAccount owner.
directory_version: u64Monotonic; +1 on every change. Readers refuse a version below their high-water mark.
updated_at: StringRFC3339 last-update time.
devices: Vec<DeviceEntry>The user’s devices.
unknown: BTreeMap<String, Value>Keys a newer writer added that this build does not know, preserved verbatim and signed over. Empty (and so wire-absent) on everything this build writes.
A key here must never collide with a known field name: the decoder only ever places the keys it did not recognise here, and a caller building a core by hand must do the same.
Implementations§
Source§impl DirectoryCore
impl DirectoryCore
Sourcepub fn add_device(
&mut self,
entry: DeviceEntry,
updated_at: String,
) -> Result<(), DirectoryError>
pub fn add_device( &mut self, entry: DeviceEntry, updated_at: String, ) -> Result<(), DirectoryError>
Add a newly enrolled device’s entry — the cross-sign step of a cross-device add — at
the next directory_version, stamping updated_at. Sign the result with
sign to publish it.
Refused, leaving self unchanged, when the entry’s id or signing key is already listed
(including on a revoked entry, which is retained so its past manifests stay verifiable),
when the entry arrives already revoked, or when the version cannot advance.
Sourcepub fn sign(self, ik: &HybridSigningKey) -> DeviceDirectory
pub fn sign(self, ik: &HybridSigningKey) -> DeviceDirectory
Sign this core with the user IK, producing a DeviceDirectory.
Trait Implementations§
Source§impl Clone for DirectoryCore
impl Clone for DirectoryCore
Source§fn clone(&self) -> DirectoryCore
fn clone(&self) -> DirectoryCore
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 DirectoryCore
impl Debug for DirectoryCore
Source§impl<'de> Deserialize<'de> for DirectoryCore
impl<'de> Deserialize<'de> for DirectoryCore
Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
impl Eq for DirectoryCore
Source§impl PartialEq for DirectoryCore
impl PartialEq for DirectoryCore
Source§fn eq(&self, other: &DirectoryCore) -> bool
fn eq(&self, other: &DirectoryCore) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for DirectoryCore
impl Serialize for DirectoryCore
impl StructuralPartialEq for DirectoryCore
Auto Trait Implementations§
impl Freeze for DirectoryCore
impl RefUnwindSafe for DirectoryCore
impl Send for DirectoryCore
impl Sync for DirectoryCore
impl Unpin for DirectoryCore
impl UnsafeUnpin for DirectoryCore
impl UnwindSafe for DirectoryCore
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§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