Skip to main content

InviteHandle

Struct InviteHandle 

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

FFI wrapper for Invite.

Implementations§

Source§

impl InviteHandle

Source

pub fn create_new( inviter_pubkey_hex: String, device_id: Option<String>, max_uses: Option<u32>, ) -> Result<Arc<Self>, NdrError>

Create a new invite.

Source

pub fn from_url(url: String) -> Result<Arc<Self>, NdrError>

Parse an invite from a URL.

Source

pub fn from_event_json(event_json: String) -> Result<Arc<Self>, NdrError>

Parse an invite from a Nostr event JSON.

Source

pub fn deserialize(json: String) -> Result<Arc<Self>, NdrError>

Deserialize an invite from JSON.

Source

pub fn to_url(&self, root: String) -> Result<String, NdrError>

Convert the invite to a shareable URL.

Source

pub fn to_event_json(&self) -> Result<String, NdrError>

Convert the invite to a Nostr event JSON.

Source

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

Serialize the invite to JSON for persistence.

Source

pub fn accept( &self, invitee_pubkey_hex: String, invitee_privkey_hex: String, device_id: Option<String>, ) -> Result<InviteAcceptResult, NdrError>

Accept the invite and create a session.

Source

pub fn accept_with_owner( &self, invitee_pubkey_hex: String, invitee_privkey_hex: String, device_id: Option<String>, owner_pubkey_hex: Option<String>, ) -> Result<InviteAcceptResult, NdrError>

Accept the invite as an owner and include the owner pubkey in the response payload.

Source

pub fn set_purpose(&self, purpose: Option<String>)

Update the invite purpose (e.g. "link").

Source

pub fn set_owner_pubkey_hex( &self, owner_pubkey_hex: Option<String>, ) -> Result<(), NdrError>

Update the owner pubkey embedded in invite URLs.

Source

pub fn process_response( &self, event_json: String, inviter_privkey_hex: String, ) -> Result<Option<InviteProcessResult>, NdrError>

Process an invite response event and create a session (inviter side).

Returns None if the event is not a valid response for this invite.

Source

pub fn get_inviter_pubkey_hex(&self) -> String

Get the inviter’s public key as hex.

Source

pub fn get_shared_secret_hex(&self) -> String

Get the shared secret as hex.

Trait Implementations§

Source§

impl<UT> LiftRef<UT> for InviteHandle

Source§

impl<UT> LowerError<UT> for InviteHandle

Source§

fn lower_error(obj: Self) -> RustBuffer

Lower this value for scaffolding function return Read more
Source§

impl<UT> LowerReturn<UT> for InviteHandle

Source§

type ReturnType = <Arc<InviteHandle> 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 InviteHandle

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.

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

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

Source§

fn vzip(self) -> V