Skip to main content

Invite

Struct Invite 

Source
pub struct Invite {
Show 13 fields pub inviter_device_pubkey: DevicePubkey, pub inviter_ephemeral_public_key: DevicePubkey, pub shared_secret: [u8; 32], pub inviter_ephemeral_private_key: Option<[u8; 32]>, pub max_uses: Option<usize>, pub used_by: Vec<DevicePubkey>, pub used_response_contents: Vec<String>, pub created_at: UnixSeconds, pub inviter_owner_pubkey: Option<OwnerPubkey>, pub purpose: Option<String>, pub inviter: PublicKey, pub device_id: Option<String>, pub owner_public_key: Option<PublicKey>,
}

Fields§

§inviter_device_pubkey: DevicePubkey§inviter_ephemeral_public_key: DevicePubkey§shared_secret: [u8; 32]§inviter_ephemeral_private_key: Option<[u8; 32]>§max_uses: Option<usize>§used_by: Vec<DevicePubkey>§used_response_contents: Vec<String>§created_at: UnixSeconds§inviter_owner_pubkey: Option<OwnerPubkey>§purpose: Option<String>§inviter: PublicKey§device_id: Option<String>§owner_public_key: Option<PublicKey>

Implementations§

Source§

impl Invite

Source

pub fn create_new( inviter: PublicKey, device_id: Option<String>, max_uses: Option<usize>, ) -> Result<Invite, Error>

Source

pub fn create_new_with_context<R>( ctx: &mut ProtocolContext<'_, R>, inviter_device_pubkey: DevicePubkey, inviter_owner_pubkey: Option<OwnerPubkey>, max_uses: Option<usize>, ) -> Result<Invite, Error>
where R: RngCore + CryptoRng,

Source

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

Source

pub fn deserialize(json: &str) -> Result<Invite, Error>

Source

pub fn accept( &self, invitee_public_key: PublicKey, invitee_private_key: [u8; 32], device_id: Option<String>, ) -> Result<(Session, InviteResponseEnvelope), Error>

Source

pub fn accept_with_owner( &self, invitee_public_key: PublicKey, invitee_private_key: [u8; 32], device_id: Option<String>, owner_public_key: Option<PublicKey>, ) -> Result<(Session, InviteResponseEnvelope), Error>

Source

pub fn accept_with_context<R>( &self, ctx: &mut ProtocolContext<'_, R>, invitee_public_key: DevicePubkey, invitee_private_key: [u8; 32], ) -> Result<(Session, InviteResponseEnvelope), Error>
where R: RngCore + CryptoRng,

Source

pub fn accept_with_owner_context<R>( &self, ctx: &mut ProtocolContext<'_, R>, invitee_public_key: DevicePubkey, invitee_private_key: [u8; 32], invitee_owner_pubkey: Option<OwnerPubkey>, ) -> Result<(Session, InviteResponseEnvelope), Error>
where R: RngCore + CryptoRng,

Source

pub fn process_response<R>( &mut self, ctx: &mut ProtocolContext<'_, R>, envelope: &InviteResponseEnvelope, inviter_private_key: [u8; 32], ) -> Result<InviteResponse, Error>
where R: RngCore + CryptoRng,

Trait Implementations§

Source§

impl Clone for Invite

Source§

fn clone(&self) -> Invite

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 Invite

Source§

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

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

impl<'de> Deserialize<'de> for Invite

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Invite, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for Invite

Source§

impl InviteNostrExt for Invite

Source§

impl PartialEq for Invite

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Invite

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Invite

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> 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> 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> 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V