Skip to main content

InvitePayload

Struct InvitePayload 

Source
pub struct InvitePayload {
    pub community_id: CommunityId,
    pub host_id: HostId,
    pub host_address: String,
    pub invite_secret: InviteSecret,
    pub expires_at: Option<u64>,
    pub protocol_min: u16,
    pub protocol_max: u16,
}
Expand description

The canonical InvitePayload (§8.6). Unsigned: after connecting, the welcome must show a descriptor deriving community_id, a delegation naming host_id, and a host proof — which InvitePayload::session_config makes the session check.

Debug never shows the secret (InviteSecret is redacted); it is zeroized on drop.

Fields§

§community_id: CommunityId

The community.

§host_id: HostId

The host to connect to.

§host_address: String

The host’s SimpleX contact address, ≤ 2 048 bytes.

§invite_secret: InviteSecret

The invitation secret.

§expires_at: Option<u64>

Expiry, ms; none = never.

§protocol_min: u16

Lowest protocol version of the community.

§protocol_max: u16

Highest protocol version of the community.

Implementations§

Source§

impl InvitePayload

Source

pub fn parse(link: &str) -> Result<Self, LinkError>

Parses a link strictly: prefix, canonical base64url, canonical payload, no trailing bytes. Decoded bytes are zeroized.

§Errors

LinkError, which never echoes the input.

Formats the link. The intermediate bytes are zeroized; the returned link is redacted in Debug.

§Errors

LinkError::Field for an empty or oversized address or a bad version range.

Source

pub fn is_expired(&self, now_ms: u64) -> bool

Whether the invitation has expired at now_ms.

Source

pub const fn supports(&self, ours: VersionRange) -> bool

Whether the community’s version range overlaps ours.

Source

pub fn session_config(&self) -> SessionConfig

A session configuration that pins the link’s host and community (§8.6).

Trait Implementations§

Source§

impl Clone for InvitePayload

Source§

fn clone(&self) -> InvitePayload

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for InvitePayload

Source§

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

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

impl Eq for InvitePayload

Source§

impl PartialEq for InvitePayload

Source§

fn eq(&self, other: &InvitePayload) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for InvitePayload

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.