pub fn new_password_store(pgp_key: &Path, path: Option<PathBuf>) -> anyhow::Result<PathBuf> {
    // Extract fingerprint from file
    let fingerprint = extract_fingerprint(pgp_key)?;

    // Create password store folder
    let password_store_path = get_password_store_path(&path)?;
    std::fs::create_dir_all(&password_store_path)?;

    // Display fingerprint in hex
    let content = format!("0x{:X}\n", fingerprint);

    // Construct path of `.gpg-id`
    let mut gpg_id_path = password_store_path.clone();
    gpg_id_path.push(".gpg-id");

    // Write file
    let mut file = File::create(&gpg_id_path)?;
    file.write_all(content.as_bytes())?;

    // sign `.gpg-id` with key ??

    println!(
        "Created new password store at location {}",
        password_store_path.display()
    );
    Ok(password_store_path)
}
/// Create new password store on path with provided pgp key
///
/// Returns path of new password store
Create new password store on path with provided pgp key
Returns path of new password store
Create new password store on path with provided pgp key Returns path of new password store
pub fn new_password_store(pgp_key: &Path, path: Option<PathBuf>) -> anyhow::Result<PathBuf> {
    // Extract fingerprint from file
    let fingerprint = extract_fingerprint(pgp_key)?;
    // Create password store folder
    let password_store_path = get_password_store_path(&path)?;
    std::fs::create_dir_all(&password_store_path)?;
    // Display fingerprint in hex
    let content = format!("0x{:X}\n", fingerprint);
    // Construct path of `.gpg-id`
    let mut gpg_id_path = password_store_path.clone();
    gpg_id_path.push(".gpg-id");
    // Write file
    let mut file = File::create(&gpg_id_path)?;
    file.write_all(content.as_bytes())?;
    // sign `.gpg-id` with key ??
    println!(
        "Created new password store at location {}",
        password_store_path.display()
    );
    Ok(password_store_path)
}
pub fn new_password_store ( pgp_key : & Path , path : Option < PathBuf > ) -> anyhow :: Result < PathBuf > { // Extract fingerprint from file let fingerprint = extract_fingerprint ( pgp_key ) ? ; // Create password store folder let password_store_path = get_password_store_path ( & path ) ? ; std :: fs :: create_dir_all ( & password_store_path ) ? ; // Display fingerprint in hex let content = format ! ( " \n " fingerprint ) ; // Construct path of `.gpg-id` let mut gpg_id_path = password_store_path . clone ( ) ; gpg_id_path . push ( " " ) ; // Write file let mut file = File :: create ( & gpg_id_path ) ? ; file . write_all ( content . as_bytes ( ) ) ? ; // sign `.gpg-id` with key ?? println ! ( " " password_store_path display ( ) ) ; Ok ( password_store_path ) }
Create new password store on path with provided pgp key
Returns path of new password store
Create new password store on path with provided pgp key Returns path of new password store
pgp_key
&Path
path
Option<PathBuf>
pgp_key
&Path
path
Option<PathBuf>