Skip to main content

DeviceTracker

Struct DeviceTracker 

Source
pub struct DeviceTracker;
Expand description

Device-list tracking: outdated bookkeeping, /keys/query request building, and validating /keys/query responses. See the module doc for the security invariants this type enforces. Carries no state of its own – every method reads/writes through the caller’s CryptoStore.

Implementations§

Source§

impl DeviceTracker

Source

pub fn on_device_lists<S: CryptoStore>( store: &mut S, changed: &[UserId], left: &[UserId], ) -> Result<(), MessengerError>

Applies /sync’s device_lists.changed/device_lists.left (plan §3, research doc §3.2). See the module doc for what happens to a left user.

Source

pub fn keys_query_request<S: CryptoStore>( store: &S, id: RequestId, ) -> Result<Option<OutgoingRequest>, MessengerError>

Builds a POST /keys/query request for every currently-outdated tracked user, or None if none are outdated.

Source

pub fn devices_for_user<S: CryptoStore>( store: &S, user_id: &UserId, ) -> Result<Vec<StoredDevice>, MessengerError>

Every device this store currently has stored for user_id, or an empty list if none.

Source

pub fn on_keys_query_response<S: CryptoStore>( store: &mut S, body: &[u8], ) -> Result<KeysQueryOutcome, MessengerError>

Applies a /keys/query response body (plan §3): verifies each device’s self-signature over canonical JSON with its OWN claimed Ed25519 key, drops anything that doesn’t check out, applies a key change on an already-known device id (clears verified, keeps blocked, emits DeviceKeyChanged), and persists the resulting per-user device lists. Marks every user present in device_keys (even with zero devices) not-outdated.

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