pub struct KeySigner { /* private fields */ }
Expand description
Signer with a local private key (and public key)
Implementations§
Source§impl KeySigner
impl KeySigner
Sourcepub fn from_locked_parts(epk: EncryptedPrivateKey, pk: PublicKey) -> Self
pub fn from_locked_parts(epk: EncryptedPrivateKey, pk: PublicKey) -> Self
Create a Signer from an EncryptedPrivateKey
Sourcepub fn from_private_key(
privk: PrivateKey,
password: &str,
log_n: u8,
) -> Result<Self, Error>
pub fn from_private_key( privk: PrivateKey, password: &str, log_n: u8, ) -> Result<Self, Error>
Create a Signer from a PrivateKey
Sourcepub fn from_encrypted_private_key(
epk: EncryptedPrivateKey,
pass: &str,
) -> Result<Self, Error>
pub fn from_encrypted_private_key( epk: EncryptedPrivateKey, pass: &str, ) -> Result<Self, Error>
Create a Signer from an EncryptedPrivateKey
and a password to unlock it
Trait Implementations§
Source§impl<'de> Deserialize<'de> for KeySigner
impl<'de> Deserialize<'de> for KeySigner
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
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 ExportableSigner for KeySigner
impl ExportableSigner for KeySigner
Source§fn export_private_key_in_hex<'life0, 'life1, 'async_trait>(
&'life0 self,
pass: &'life1 str,
log_n: u8,
) -> Pin<Box<dyn Future<Output = Result<(String, bool), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn export_private_key_in_hex<'life0, 'life1, 'async_trait>(
&'life0 self,
pass: &'life1 str,
log_n: u8,
) -> Pin<Box<dyn Future<Output = Result<(String, bool), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Export the private key in hex. Read more
Source§fn export_private_key_in_bech32<'life0, 'life1, 'async_trait>(
&'life0 self,
pass: &'life1 str,
log_n: u8,
) -> Pin<Box<dyn Future<Output = Result<(String, bool), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn export_private_key_in_bech32<'life0, 'life1, 'async_trait>(
&'life0 self,
pass: &'life1 str,
log_n: u8,
) -> Pin<Box<dyn Future<Output = Result<(String, bool), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Export the private key in bech32. Read more
Source§impl LockableSigner for KeySigner
impl LockableSigner for KeySigner
Source§impl Signer for KeySigner
impl Signer for KeySigner
Source§fn public_key(&self) -> PublicKey
fn public_key(&self) -> PublicKey
What is the signer’s public key?
Source§fn encrypted_private_key(&self) -> Option<EncryptedPrivateKey>
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,
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,
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,
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>
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,
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,
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,
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§impl SignerExt for KeySigner
impl SignerExt for KeySigner
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,
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,
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,
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
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,
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>
fn verify_delegation_signature( &self, delegated_pubkey: PublicKey, delegation_conditions: &DelegationConditions, signature: &Signature, ) -> Result<(), Error>
Verify delegation signature
Auto Trait Implementations§
impl !Freeze for KeySigner
impl RefUnwindSafe for KeySigner
impl Send for KeySigner
impl Sync for KeySigner
impl Unpin for KeySigner
impl UnwindSafe for KeySigner
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