pub struct DirectoryClient { /* private fields */ }Expand description
The device-directory client. Borrows an authenticated Session, so every call rides the
SDK’s bearer/refresh machinery and no token is handled here.
Implementations§
Source§impl DirectoryClient
impl DirectoryClient
Sourcepub fn new(session: Session, api_base_url: &str) -> Self
pub fn new(session: Session, api_base_url: &str) -> Self
Build a client against the API base URL — the same base the auth session authenticates
against (e.g. https://api.example.com/v1/auth).
Sourcepub async fn publish(
&self,
directory: &DeviceDirectory,
identity_key: &HybridVerifyingKey,
) -> Result<u64, DirectoryError>
pub async fn publish( &self, directory: &DeviceDirectory, identity_key: &HybridVerifyingKey, ) -> Result<u64, DirectoryError>
Publish directory for the authenticated caller, returning the directory_version the
server now stores.
identity_key is the account’s user identity verifying key — the key directory is
signed under. It travels base64 in X-Capsule-Identity-Key; the server anchors it on
the first publish, answers DirectoryError::Malformed for a document that does not
verify under it, and DirectoryError::IdentityMismatch for a key other than the
anchored one.
Idempotent only at the same version is not the contract: invariant 23 requires the
version to advance, so re-publishing an unchanged document answers
DirectoryError::VersionConflict. Publish when the document actually changes — a
device enrolled, a device revoked.
Sourcepub async fn fetch(
&self,
user_id: Uuid,
pinned_user_ik: &HybridVerifyingKey,
) -> Result<DeviceDirectory, DirectoryError>
pub async fn fetch( &self, user_id: Uuid, pinned_user_ik: &HybridVerifyingKey, ) -> Result<DeviceDirectory, DirectoryError>
Fetch user_id’s signed device directory and verify it under pinned_user_ik before
returning it. A document that does not verify is DirectoryError::UntrustedSignature
and never reaches the caller.
The anti-rollback high-water mark is the caller’s to keep: compare
core.directory_version against the highest version already seen for this user and
refuse a regression, exactly as the sync feed’s sync_seq is refused.
Trait Implementations§
Source§impl Clone for DirectoryClient
impl Clone for DirectoryClient
Source§fn clone(&self) -> DirectoryClient
fn clone(&self) -> DirectoryClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for DirectoryClient
impl !UnwindSafe for DirectoryClient
impl Freeze for DirectoryClient
impl Send for DirectoryClient
impl Sync for DirectoryClient
impl Unpin for DirectoryClient
impl UnsafeUnpin for DirectoryClient
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> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
Arc<> Read more§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