Struct BunkerClient

Source
pub struct BunkerClient {
    pub remote_signer_pubkey: PublicKey,
    pub relay_url: RelayUrl,
    pub local_signer: Arc<KeySigner>,
    pub public_key: PublicKey,
    pub timeout: Duration,
    pub client: Client,
}
Expand description

This is a NIP-46 Bunker client

Fields§

§remote_signer_pubkey: PublicKey

The pubkey of the bunker

§relay_url: RelayUrl

The relay the bunker is listening at

§local_signer: Arc<KeySigner>

Our local identity

§public_key: PublicKey

User Public Key

§timeout: Duration

Timeout

§client: Client

Client

Implementations§

Source§

impl BunkerClient

Source

pub async fn from_stored_data( remote_signer_pubkey: PublicKey, relay_url: RelayUrl, keysigner: KeySigner, public_key: PublicKey, timeout: Duration, ) -> BunkerClient

Create a new BunkerClient from stored data. This will be in the locked state.

Source

pub fn is_locked(&self) -> bool

Is the signer locked?

Source

pub fn unlock(&self, password: &str) -> Result<(), Error>

Unlock (if locked)

Source

pub fn lock(&self)

Lock

Source

pub fn change_passphrase( &self, old: &str, new: &str, log_n: u8, ) -> Result<(), Error>

Change passphrase

Source

pub async fn call(&self, request: Nip46Request) -> Result<Nip46Response, Error>

Send a Nip46Request and wait for a Nip46Response (up to our timeout)

Source

pub async fn disconnect(&self) -> Result<(), Error>

Disconnect from the relay

Source

pub async fn disconnect_and_lock(&self) -> Result<(), Error>

Disconnect from the relay and lock

Trait Implementations§

Source§

impl Debug for BunkerClient

Source§

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

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

impl<'de> Deserialize<'de> for BunkerClient

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

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

impl Serialize for BunkerClient

Source§

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

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

impl Signer for BunkerClient

Source§

fn public_key(&self) -> PublicKey

What is the signer’s public key?
Source§

fn encrypted_private_key(&self) -> Option<EncryptedPrivateKey>

What is the signer’s encrypted private key?
Source§

fn sign_event<'life0, 'async_trait>( &'life0 self, pre_event: PreEvent, ) -> Pin<Box<dyn Future<Output = Result<Event, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sign an event
Source§

fn encrypt<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, other: &'life1 PublicKey, plaintext: &'life2 str, algo: ContentEncryptionAlgorithm, ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Encrypt
Source§

fn decrypt<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, other: &'life1 PublicKey, ciphertext: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Decrypt NIP-04 or NIP-44
Source§

fn key_security(&self) -> Result<KeySecurity, Error>

Get the security level of the private key
Source§

fn giftwrap<'life0, 'async_trait>( &'life0 self, input: PreEvent, pubkey: PublicKey, ) -> Pin<Box<dyn Future<Output = Result<Event, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Giftwrap an event
Source§

fn create_metadata_event<'life0, 'async_trait>( &'life0 self, input: PreEvent, metadata: Metadata, ) -> Pin<Box<dyn Future<Output = Result<Event, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Create an event that sets Metadata
Source§

fn create_zap_request_event<'life0, 'async_trait>( &'life0 self, recipient_pubkey: PublicKey, zapped_event: Option<Id>, millisatoshis: u64, relays: Vec<String>, content: String, ) -> Pin<Box<dyn Future<Output = Result<Event, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Create a ZapRequest event These events are not published to nostr, they are sent to a lnurl.
Source§

fn decrypt_event_contents<'life0, 'life1, 'async_trait>( &'life0 self, event: &'life1 Event, ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Decrypt the contents of an event
Source§

fn unwrap_giftwrap<'life0, 'life1, 'async_trait>( &'life0 self, event: &'life1 Event, ) -> Pin<Box<dyn Future<Output = Result<Rumor, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

If a gift wrap event, unwrap and return the inner Rumor

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<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

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

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

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

§

impl<T> MaybeSendSync for T