.
This commit is contained in:
@@ -50,6 +50,8 @@ pub enum StateEvent {
|
||||
Connected,
|
||||
/// Creating the signer
|
||||
Creating,
|
||||
/// Show the identity dialog
|
||||
Show,
|
||||
/// A new signer has been set
|
||||
SignerSet,
|
||||
/// An error occurred
|
||||
@@ -151,6 +153,9 @@ impl NostrRegistry {
|
||||
// Create an identity if none exists
|
||||
if this.npubs.read(cx).is_empty() {
|
||||
this.create_identity(cx);
|
||||
} else {
|
||||
// Show the identity dialog
|
||||
cx.emit(StateEvent::Show);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -275,13 +280,17 @@ impl NostrRegistry {
|
||||
let app_keys = self.app_keys.clone();
|
||||
|
||||
if let Ok(payload) = std::fs::read_to_string(key_path) {
|
||||
cx.background_spawn(async move {
|
||||
let decrypted = app_keys.nip44_decrypt(&public_key, &payload).await?;
|
||||
let secret = SecretKey::parse(&decrypted)?;
|
||||
let keys = Keys::new(secret);
|
||||
if payload.starts_with("nsec1") || payload.starts_with("bunker://") {
|
||||
cx.background_spawn(async move {
|
||||
let decrypted = app_keys.nip44_decrypt(&public_key, &payload).await?;
|
||||
let secret = SecretKey::parse(&decrypted)?;
|
||||
let keys = Keys::new(secret);
|
||||
|
||||
Ok(keys.into_nostr_signer())
|
||||
})
|
||||
Ok(keys.into_nostr_signer())
|
||||
})
|
||||
} else {
|
||||
self.get_secret_keyring(&npub, cx)
|
||||
}
|
||||
} else {
|
||||
self.get_secret_keyring(&npub, cx)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user