Skip to main content

InviteCode

Struct InviteCode 

Source
pub struct InviteCode {
    pub store: StoreId,
    pub name: String,
    pub inviter: String,
    pub kind: InviteKind,
    pub expires_at: u64,
    pub invite: InviteId,
    pub member: MemberId,
    pub secret: InviteSecret,
    pub initial_key: KeyId,
    pub inviting_writer: DeviceId,
    pub read_through: u64,
    pub storage: SecretBytes,
}
Expand description

A one-time invitation; the secret permits a join request, not store access.

Fields§

§store: StoreId

The store’s id.

§name: String

The store’s display name.

§inviter: String

The inviting admin’s name, as their app gave it when it made the invite: the joining device can’t read who is who until it is let in.

§kind: InviteKind

Whether the invite adds a new person or recovers a member.

§expires_at: u64

When the invite ends, in seconds since the Unix epoch by the inviting device’s clock: a joining device sends no first request after it.

§invite: InviteId

The invite named by the join request.

§member: MemberId

The member id the admin fixed: fresh for an addition, or an existing active id for a re-binding. The signed request must repeat it (D13).

§secret: InviteSecret

Crypto owns the one-time secret and its erasure.

§initial_key: KeyId

The store key introduced by the creation entry, even after rotations.

§inviting_writer: DeviceId

The device whose claimed approval supplies binding evidence.

§read_through: u64

The inviting device’s last applied slot.

§storage: SecretBytes

Storage settings, including any credentials for the recipient.

Implementations§

Source§

impl InviteCode

Source

pub const TEXT_PREFIX: &'static str = "CVI1-"

How an invite code’s text starts: its kind and version.

Source

pub fn request_path(&self) -> ObjectPath

Where the joining device’s request goes: under the device that made the invite, as this code names it (§13.2).

Source

pub fn to_bytes(&self) -> Result<Zeroizing<Vec<u8>>, Error>

Encode a bounded frame into a buffer erased on drop, allocated once.

Source

pub fn from_bytes(bytes: &[u8]) -> Result<Self, Error>

Decode a borrowed frame; every owned secret buffer erases on drop.

Source

pub fn to_text(&self) -> Result<Zeroizing<String>, Error>

Canonical uppercase base32, with CRC-32C, erased on drop.

Source

pub fn from_text(text: &str) -> Result<Self, Error>

Decode borrowed text without retaining any unerased private copies.

Trait Implementations§

Source§

impl Debug for InviteCode

Source§

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

Formats the value using the given formatter. Read more

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. 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> 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 = 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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,