pub struct InviteHandle { /* private fields */ }Expand description
FFI wrapper for Invite.
Implementations§
Source§impl InviteHandle
impl InviteHandle
Sourcepub fn create_new(
inviter_pubkey_hex: String,
device_id: Option<String>,
max_uses: Option<u32>,
) -> Result<Arc<Self>, NdrError>
pub fn create_new( inviter_pubkey_hex: String, device_id: Option<String>, max_uses: Option<u32>, ) -> Result<Arc<Self>, NdrError>
Create a new invite.
Sourcepub fn from_event_json(event_json: String) -> Result<Arc<Self>, NdrError>
pub fn from_event_json(event_json: String) -> Result<Arc<Self>, NdrError>
Parse an invite from a Nostr event JSON.
Sourcepub fn deserialize(json: String) -> Result<Arc<Self>, NdrError>
pub fn deserialize(json: String) -> Result<Arc<Self>, NdrError>
Deserialize an invite from JSON.
Sourcepub fn to_url(&self, root: String) -> Result<String, NdrError>
pub fn to_url(&self, root: String) -> Result<String, NdrError>
Convert the invite to a shareable URL.
Sourcepub fn to_event_json(&self) -> Result<String, NdrError>
pub fn to_event_json(&self) -> Result<String, NdrError>
Convert the invite to a Nostr event JSON.
Sourcepub fn serialize(&self) -> Result<String, NdrError>
pub fn serialize(&self) -> Result<String, NdrError>
Serialize the invite to JSON for persistence.
Sourcepub fn accept(
&self,
invitee_pubkey_hex: String,
invitee_privkey_hex: String,
device_id: Option<String>,
) -> Result<InviteAcceptResult, NdrError>
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.
Sourcepub 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>
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.
Sourcepub fn set_purpose(&self, purpose: Option<String>)
pub fn set_purpose(&self, purpose: Option<String>)
Update the invite purpose (e.g. "link").
Sourcepub fn set_owner_pubkey_hex(
&self,
owner_pubkey_hex: Option<String>,
) -> Result<(), NdrError>
pub fn set_owner_pubkey_hex( &self, owner_pubkey_hex: Option<String>, ) -> Result<(), NdrError>
Update the owner pubkey embedded in invite URLs.
Sourcepub fn process_response(
&self,
event_json: String,
inviter_privkey_hex: String,
) -> Result<Option<InviteProcessResult>, NdrError>
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.
Sourcepub fn get_inviter_pubkey_hex(&self) -> String
pub fn get_inviter_pubkey_hex(&self) -> String
Get the inviter’s public key as hex.
Get the shared secret as hex.
Trait Implementations§
Source§impl<UT> LiftRef<UT> for InviteHandle
impl<UT> LiftRef<UT> for InviteHandle
type LiftType = Arc<InviteHandle>
Source§impl<UT> LowerError<UT> for InviteHandle
impl<UT> LowerError<UT> for InviteHandle
Source§fn lower_error(obj: Self) -> RustBuffer
fn lower_error(obj: Self) -> RustBuffer
Lower this value for scaffolding function return Read more
Source§impl<UT> LowerReturn<UT> for InviteHandle
impl<UT> LowerReturn<UT> for InviteHandle
Source§type ReturnType = <Arc<InviteHandle> as LowerReturn<UniFfiTag>>::ReturnType
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>
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>
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
impl<UT> TypeId<UT> for InviteHandle
Auto Trait Implementations§
impl !Freeze for InviteHandle
impl RefUnwindSafe for InviteHandle
impl Send for InviteHandle
impl Sync for InviteHandle
impl Unpin for InviteHandle
impl UnsafeUnpin for InviteHandle
impl UnwindSafe for InviteHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more