mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-19 19:46:50 +00:00
Save keys after importing
This commit is contained in:
parent
dac14cceeb
commit
7d2985def1
@ -414,6 +414,15 @@ impl Overlord {
|
|||||||
signer.unlock_encrypted_private_key(&password)?;
|
signer.unlock_encrypted_private_key(&password)?;
|
||||||
}
|
}
|
||||||
password.zeroize();
|
password.zeroize();
|
||||||
|
|
||||||
|
// Save
|
||||||
|
let public_key = GLOBALS.signer.read().await.public_key().unwrap();
|
||||||
|
{
|
||||||
|
let mut settings = GLOBALS.settings.write().await;
|
||||||
|
settings.encrypted_private_key = Some(epk);
|
||||||
|
settings.public_key = Some(public_key);
|
||||||
|
settings.save().await?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
"import_hex" => {
|
"import_hex" => {
|
||||||
let (mut import_hex, mut password): (String, String) =
|
let (mut import_hex, mut password): (String, String) =
|
||||||
@ -427,6 +436,15 @@ impl Overlord {
|
|||||||
signer.unlock_encrypted_private_key(&password)?;
|
signer.unlock_encrypted_private_key(&password)?;
|
||||||
}
|
}
|
||||||
password.zeroize();
|
password.zeroize();
|
||||||
|
|
||||||
|
// Save
|
||||||
|
let public_key = GLOBALS.signer.read().await.public_key().unwrap();
|
||||||
|
{
|
||||||
|
let mut settings = GLOBALS.settings.write().await;
|
||||||
|
settings.encrypted_private_key = Some(epk);
|
||||||
|
settings.public_key = Some(public_key);
|
||||||
|
settings.save().await?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
},
|
},
|
||||||
|
@ -17,17 +17,19 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Fram
|
|||||||
};
|
};
|
||||||
|
|
||||||
ui.horizontal(|ui| {
|
ui.horizontal(|ui| {
|
||||||
ui.text_edit_multiline(&mut app.draft);
|
if GLOBALS.signer.blocking_read().is_ready() {
|
||||||
|
ui.text_edit_multiline(&mut app.draft);
|
||||||
|
|
||||||
if ui.button("Send").clicked() && !app.draft.is_empty() {
|
if ui.button("Send").clicked() && !app.draft.is_empty() {
|
||||||
info!("Would send: {}", app.draft);
|
info!("Would send: {}", app.draft);
|
||||||
|
|
||||||
// We need our private key
|
// We need our private key
|
||||||
// Then we need to create a TextNote event
|
// Then we need to create a TextNote event
|
||||||
// Then we need to send it to multiple relays
|
// Then we need to send it to multiple relays
|
||||||
// NOT a one-liner
|
// NOT a one-liner
|
||||||
|
|
||||||
app.draft = "".to_owned();
|
app.draft = "".to_owned();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.with_layout(Layout::right_to_left(Align::TOP), |ui| {
|
ui.with_layout(Layout::right_to_left(Align::TOP), |ui| {
|
||||||
|
Loading…
Reference in New Issue
Block a user