Skip to main content

LinkSession

Struct LinkSession 

Source
pub struct LinkSession { /* private fields */ }
Expand description

Linking session, one side (desktop or phone). Secrets never leave the core and are wiped on close, on any mismatch and when the object is dropped.

Implementations§

Source§

impl LinkSession

Source

pub fn desktop( link_id: Vec<u8>, relay_hint: String, now_secs: u64, ) -> LR<Arc<Self>>

Desktop: new session with ephemeral keys. link_id is 16..32 bytes (issued by the server or random), relay_hint is the relay address for the phone (part of the transcript), now_secs is the desktop’s Unix time.

Source

pub fn phone(qr_text: String, now_secs: u64) -> LR<Arc<Self>>

Phone: session from the QR text. Checks format, checksum and validity window (with clock tolerance).

Source

pub fn role(&self) -> LinkRole

Source

pub fn state(&self) -> LinkState

Source

pub fn relay_hint(&self) -> String

Source

pub fn issued_at(&self) -> u64

Source

pub fn qr_text(&self) -> LR<String>

Desktop: text for the QR (“umbera-link:” + base64url).

Source

pub fn offer(&self) -> LR<LinkBlob>

Desktop: OFFER blob (ML-KEM key). May be resent; it is always the same.

Source

pub fn phone_accept(&self, offer: LinkBlob, now_secs: u64) -> LR<LinkBlob>

Phone: check OFFER against the QR, encapsulate, return ACCEPT.

Source

pub fn desktop_accept(&self, accept: LinkBlob, now_secs: u64) -> LR<LinkBlob>

Desktop: accept ACCEPT (no later than 60 s after the QR was shown), verify the phone’s confirmation, return CONFIRM. Any mismatch destroys the session.

Source

pub fn phone_confirm(&self, confirm: LinkBlob, now_secs: u64) -> LR<()>

Phone: verify the desktop’s CONFIRM.

Source

pub fn sas(&self) -> LR<String>

Verification code (6 digits), after mutual key confirmation.

Source

pub fn confirm_sas(&self, now_secs: u64) -> LR<()>

The user saw matching codes and tapped “Link”.

Source

pub fn seal(&self, kind: u8, plaintext: Vec<u8>) -> LR<LinkBlob>

Encrypt a blob of one’s own kind (see KIND_). The package goes only through package_.

Source

pub fn open(&self, blob: LinkBlob) -> LR<Vec<u8>>

Decrypt a peer blob (except package parts and the device request).

Source

pub fn device_request( &self, device_seed: Vec<u8>, device_type: u8, label: String, ) -> LR<LinkBlob>

Desktop: “sign my keys” request: device public keys from device_seed and proof of possession (Ed25519 + ML-DSA-65 signatures over the linking transcript).

Source

pub fn open_device_request(&self, blob: LinkBlob) -> LR<DeviceRequest>

Phone: open the desktop’s request and verify the proof of possession.

Source

pub fn package_begin(&self, include_history: bool) -> LR<LinkBlob>

Phone: start a transfer package. include_history: the user chose “with history”.

Source

pub fn package_add( &self, section: u8, id: Vec<u8>, body: Vec<u8>, ) -> LR<Vec<LinkBlob>>

Phone: add a record. Returns parts ready to send (may be empty).

Source

pub fn package_finish(&self) -> LR<Vec<LinkBlob>>

Phone: finish the package: the last parts and END with the final checksum.

Source

pub fn package_receive(&self, blob: LinkBlob) -> LR<PackageProgress>

Desktop: accept HEADER/PART/END. Records are returned as they arrive; commit them to the database only once done (the final checksum matched).

Source

pub fn package_ack(&self) -> LR<LinkBlob>

Desktop: “package received in full” acknowledgement (package checksum inside), after done.

Source

pub fn package_check_ack(&self, blob: LinkBlob) -> LR<()>

Phone: verify the desktop’s acknowledgement: the package checksum must match the one sent.

Source

pub fn wipe(&self)

Cancel and wipe secrets (without notifying the peer; to notify, seal(KIND_ABORT)). Not named close: in the Kotlin bindings that name is taken by AutoCloseable.

Trait Implementations§

Source§

impl Debug for LinkSession

No secrets: only the side and the state.

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<UT> LiftRef<UT> for LinkSession

Source§

impl<UT> LowerError<UT> for LinkSession

Source§

fn lower_error(obj: Self) -> RustBuffer

Lower this value for scaffolding function return Read more
Source§

impl<UT> LowerReturn<UT> for LinkSession

Source§

type ReturnType = <Arc<LinkSession> as LowerReturn<UniFfiTag>>::ReturnType

The type that should be returned by scaffolding functions for this type. Read more
Source§

fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>

Lower the return value from an scaffolding call Read more
Source§

fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>

Lower the return value for failed argument lifts Read more
Source§

impl<UT> TypeId<UT> for LinkSession

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, UT> HandleAlloc<UT> for T
where T: Send + Sync,

Source§

fn new_handle(value: Arc<T>) -> Handle

Create a new handle for an Arc value Read more
Source§

unsafe fn clone_handle(handle: Handle) -> Handle

Clone a handle Read more
Source§

unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ

Consume a handle, getting back the initial Arc<> Read more
Source§

unsafe fn get_arc(handle: Handle) -> Arc<Self> ⓘ

Get a clone of the Arc<> using a “borrowed” handle. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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