Trait Signer

Source
pub trait Signer:
    Debug
    + Send
    + Sync {
    // Required methods
    fn public_key(&self) -> PublicKey;
    fn encrypted_private_key(&self) -> Option<EncryptedPrivateKey>;
    fn sign_event<'life0, 'async_trait>(
        &'life0 self,
        input: PreEvent,
    ) -> Pin<Box<dyn Future<Output = Result<Event, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    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;
    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;
    fn key_security(&self) -> Result<KeySecurity, Error>;

    // Provided methods
    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 { ... }
    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 { ... }
    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 { ... }
    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 { ... }
    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 { ... }
}
Expand description

Signer operations

Required Methods§

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, input: 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

Provided Methods§

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

Implementors§