Files
spacedrive/apps/cli/src/main.rs
jake 355ac191b8 [ENG-440] Crypto Refactor (#2115)
* rebase: `crates/crypto` into current `main`

* refactor: remove `mnemonic` module

* feat: disable secure erase temporarily

* fix: tsc

* fix: tsc due to unused import

* fix: remove `cli` crypto info

* deps: update

* chore: remove dead comment

* refactor: remove `bincode` feature

* refactor: give `keyring` a dedicated feature so it's not reliant on `sys` as well

* fix: remove `aes-gcm` as it's no longer supported

* refactor: remove dead comment

* fix: update `keyring` imports

* refactor: change tests to `aes-256-gcm`

* feat: make `Key` a `Box<>` internally to ensure it's heap allocated (and fix tests)

* chore: clippy

* fix: hashing tests now that `const` keys aren't available

this will be cleaned up with test vectors and `include_bytes!()`

* chore: clippy

* refactor: remove dead code

* test: bring back `encrypt_with_invalid_nonce` test

* fix: secret service keyring

* fix: `zbus` build issues

* doc: update comment for clearer reasoning

* fix: cargo fmt

* fix: use bytes directly

* deps: update lockfile

* fix: secret service keyring

* fix: comment out windows keyring for now

* fix: use session keyring if no keyring backend

* fix: completely remove keyring module if no keyring is available for that OS

* fix: clippy

* fix: move iimport to correct conditional compilation

* fix: fmt
2024-03-07 08:00:37 +00:00

86 lines
2.3 KiB
Rust

use anyhow::Result;
// use clap::Parser;
// use indoc::printdoc;
// use sd_crypto::header::file::FileHeader;
// use std::path::PathBuf;
// use tokio::fs::File;
// #[derive(Parser)]
// struct Args {
// #[arg(help = "the file path to get details for")]
// path: PathBuf,
// }
#[tokio::main]
async fn main() -> Result<()> {
// let args = Args::parse();
// let mut reader = File::open(args.path).await.context("unable to open file")?;
// let (header, aad) = FileHeader::from_reader(&mut reader).await?;
// print_crypto_details(&header, &aad);
Ok(())
}
// fn print_crypto_details(header: &FileHeader, aad: &[u8]) {
// printdoc! {"
// Header version: {version}
// Encryption algorithm: {algorithm}
// AAD (hex): {hex}
// ",
// version = header.version,
// algorithm = header.algorithm,
// hex = hex::encode(aad)
// };
// header.keyslots.iter().enumerate().for_each(|(i, k)| {
// printdoc! {"
// Keyslot {index}:
// Version: {version}
// Algorithm: {algorithm}
// Hashing algorithm: {hashing_algorithm}
// Salt (hex): {salt}
// Master Key (hex, encrypted): {master}
// Master key nonce (hex): {nonce}
// ",
// index = i + i,
// version = k.version,
// algorithm = k.algorithm,
// hashing_algorithm = k.hashing_algorithm,
// salt = hex::encode(&*k.salt),
// master = hex::encode(&*k.master_key),
// nonce = hex::encode(k.nonce)
// };
// });
// header.metadata.iter().for_each(|m| {
// printdoc! {"
// Metadata:
// Version: {version}
// Algorithm: {algorithm}
// Encrypted size: {size}
// Nonce (hex): {nonce}
// ",
// version = m.version,
// algorithm = m.algorithm,
// size = m.metadata.len(),
// nonce = hex::encode(m.metadata_nonce)
// }
// });
// header.preview_media.iter().for_each(|p| {
// printdoc! {"
// Preview Media:
// Version: {version}
// Algorithm: {algorithm}
// Encrypted size: {size}
// Nonce (hex): {nonce}
// ",
// version = p.version,
// algorithm = p.algorithm,
// size = p.media.len(),
// nonce = hex::encode(p.media_nonce)
// };
// });
// }