run cargo fmt
This commit is contained in:
parent
1745fab350
commit
3b98296dd6
5 changed files with 19 additions and 15 deletions
|
@ -1,4 +1,4 @@
|
|||
use crate::keystorage::{KeyStorage, KeyStorageType, Error};
|
||||
use crate::keystorage::{Error, KeyStorage, KeyStorageType};
|
||||
use nostr::Keys;
|
||||
|
||||
pub struct AccountManager {
|
||||
|
@ -52,4 +52,3 @@ impl KeyStorage for AccountManager {
|
|||
Self::get_platform_keystorage().remove_key(key)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use super::{KeyStorage, Error};
|
||||
use nostr::{Keys};
|
||||
use super::{Error, KeyStorage};
|
||||
use nostr::Keys;
|
||||
|
||||
pub struct LinuxKeyStorage {}
|
||||
|
||||
|
@ -30,7 +30,9 @@ struct BasicFileStorage {
|
|||
|
||||
impl BasicFileStorage {
|
||||
pub fn new() -> Self {
|
||||
BasicFileStorage { credentials_dir: ".credentials".to_string() }
|
||||
BasicFileStorage {
|
||||
credentials_dir: ".credentials".to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
fn write_private_key(&self, keypair: &Keys) -> Result<(), Error> {
|
||||
|
@ -55,7 +57,7 @@ impl BasicFileStorage {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn read_private_keys(&self) -> Result<Vec<Keys>, Error>{
|
||||
fn read_private_keys(&self) -> Result<Vec<Keys>, Error> {
|
||||
use std::fs::{self, File};
|
||||
use std::io::Read;
|
||||
use std::path::Path;
|
||||
|
@ -114,4 +116,3 @@ impl KeyStorage for BasicFileStorage {
|
|||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ mod linux;
|
|||
use linux::LinuxKeyStorage;
|
||||
|
||||
pub enum Error {
|
||||
IOError(std::io::Error)
|
||||
IOError(std::io::Error),
|
||||
}
|
||||
|
||||
impl From<std::io::Error> for Error {
|
||||
|
@ -38,7 +38,7 @@ impl KeyStorage for KeyStorageType {
|
|||
match self {
|
||||
Self::None => Ok(()),
|
||||
#[cfg(target_os = "linux")]
|
||||
Self::Linux => LinuxKeyStorage::new().add_key(key)
|
||||
Self::Linux => LinuxKeyStorage::new().add_key(key),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,11 +7,11 @@ use egui::{Align, FontId, Layout};
|
|||
use egui_extras::{Column, TableBuilder};
|
||||
use tracing::{debug, error, info, Level};
|
||||
|
||||
mod account_manager;
|
||||
mod error;
|
||||
mod keystorage;
|
||||
mod relay;
|
||||
mod ui;
|
||||
mod keystorage;
|
||||
mod account_manager;
|
||||
|
||||
fn main() -> Result<(), eframe::Error> {
|
||||
let (non_blocking, _guard) = tracing_appender::non_blocking(std::io::stdout()); // add log files in prod one day
|
||||
|
|
|
@ -45,16 +45,20 @@ impl OnboardingScreen {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
fn onboarding_new_keypair_generated(app: &mut Hoot, ui: &mut egui::Ui) {
|
||||
use nostr::ToBech32;
|
||||
use crate::keystorage::KeyStorage;
|
||||
use nostr::ToBech32;
|
||||
|
||||
let first_key = app.account_manager.loaded_keys[0].clone();
|
||||
ui.label(format!("New identity: {}", first_key.public_key().to_bech32().unwrap()));
|
||||
ui.label(format!(
|
||||
"New identity: {}",
|
||||
first_key.public_key().to_bech32().unwrap()
|
||||
));
|
||||
|
||||
if ui.button("OK, Save!").clicked() {
|
||||
app.account_manager.add_key(&first_key).expect("could not write key");
|
||||
app.account_manager
|
||||
.add_key(&first_key)
|
||||
.expect("could not write key");
|
||||
|
||||
app.current_page = Page::Inbox;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue