modality_utils/
passfile.rs

1use anyhow::Result;
2use std::path::PathBuf;
3
4use crate::keypair::Keypair;
5// use rpassword::read_password;
6
7#[derive(Clone)]
8pub struct Passfile {
9  pub filepath: PathBuf,
10  pub keypair: Keypair,
11}
12
13impl Passfile {
14  pub async fn load_file(filepath: PathBuf, _interactive: bool) -> Result<Self> {
15    // TODO if interactive ask for password if encrypted
16    let keypair = Keypair::from_json_file(filepath.to_str().unwrap())?;
17    Ok(Self { filepath, keypair })
18  }
19}