Trait SignerExt

Source
pub trait SignerExt: Signer {
    // Required methods
    fn sign_id<'life0, 'async_trait>(
        &'life0 self,
        id: Id,
    ) -> Pin<Box<dyn Future<Output = Result<Signature, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn sign<'life0, 'life1, 'async_trait>(
        &'life0 self,
        message: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<Signature, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn nip44_conversation_key<'life0, 'life1, 'async_trait>(
        &'life0 self,
        other: &'life1 PublicKey,
    ) -> Pin<Box<dyn Future<Output = Result<[u8; 32], Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn generate_delegation_signature<'life0, 'life1, 'async_trait>(
        &'life0 self,
        delegated_pubkey: PublicKey,
        delegation_conditions: &'life1 DelegationConditions,
    ) -> Pin<Box<dyn Future<Output = Result<Signature, Error>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn verify_delegation_signature(
        &self,
        delegated_pubkey: PublicKey,
        delegation_conditions: &DelegationConditions,
        signature: &Signature,
    ) -> Result<(), Error> { ... }
    fn sign_event_with_pow<'life0, 'async_trait>(
        &'life0 self,
        input: PreEvent,
        zero_bits: u8,
        work_sender: Option<Sender<u8>>,
    ) -> Pin<Box<dyn Future<Output = Result<Event, Error>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Extended Signer operations

These enable NIP-26 delegation, signing an event with PoW, signing of anything (not just events) and access to the NIP44 conversation key. none of which is available using NIP-07 (browser) or NIP-46 (bunker) signers.

Required Methods§

Source

fn sign_id<'life0, 'async_trait>( &'life0 self, id: Id, ) -> Pin<Box<dyn Future<Output = Result<Signature, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sign a 32-bit hash asynchronously

Source

fn sign<'life0, 'life1, 'async_trait>( &'life0 self, message: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<Signature, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Sign a message asynchronously (this hashes with SHA-256 first internally)

Source

fn nip44_conversation_key<'life0, 'life1, 'async_trait>( &'life0 self, other: &'life1 PublicKey, ) -> Pin<Box<dyn Future<Output = Result<[u8; 32], Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get NIP-44 conversation key

Provided Methods§

Source

fn generate_delegation_signature<'life0, 'life1, 'async_trait>( &'life0 self, delegated_pubkey: PublicKey, delegation_conditions: &'life1 DelegationConditions, ) -> Pin<Box<dyn Future<Output = Result<Signature, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Generate delegation signature

Source

fn verify_delegation_signature( &self, delegated_pubkey: PublicKey, delegation_conditions: &DelegationConditions, signature: &Signature, ) -> Result<(), Error>

Verify delegation signature

Source

fn sign_event_with_pow<'life0, 'async_trait>( &'life0 self, input: PreEvent, zero_bits: u8, work_sender: Option<Sender<u8>>, ) -> Pin<Box<dyn Future<Output = Result<Event, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Sign an event with Proof-of-Work

Implementors§