feat(02-01): project scaffolding with Cargo, CLI skeleton, and key module
- Initialize Rust project with aes, cbc, hmac, sha2, flate2, clap, rand, anyhow dependencies - Add clap derive CLI with pack/unpack/inspect subcommands - Add hardcoded 32-byte AES-256 key constant - Create stub modules for format, crypto, compression, archive - All 7 source files in place, cargo build succeeds Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2
src/archive.rs
Normal file
2
src/archive.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
// Pack, unpack, and inspect archive orchestration.
|
||||
// Will be implemented in Plan 02-02.
|
||||
39
src/cli.rs
Normal file
39
src/cli.rs
Normal file
@@ -0,0 +1,39 @@
|
||||
use clap::{Parser, Subcommand};
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(name = "encrypted_archive")]
|
||||
#[command(about = "Custom encrypted archive tool")]
|
||||
pub struct Cli {
|
||||
#[command(subcommand)]
|
||||
pub command: Commands,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
pub enum Commands {
|
||||
/// Pack files into an encrypted archive
|
||||
Pack {
|
||||
/// Input files to archive
|
||||
#[arg(required = true)]
|
||||
files: Vec<PathBuf>,
|
||||
/// Output archive file
|
||||
#[arg(short, long)]
|
||||
output: PathBuf,
|
||||
/// Disable compression for specified file patterns
|
||||
#[arg(long)]
|
||||
no_compress: Vec<String>,
|
||||
},
|
||||
/// Unpack an encrypted archive
|
||||
Unpack {
|
||||
/// Archive file to unpack
|
||||
archive: PathBuf,
|
||||
/// Output directory
|
||||
#[arg(short, long, default_value = ".")]
|
||||
output_dir: PathBuf,
|
||||
},
|
||||
/// Inspect archive metadata without decrypting
|
||||
Inspect {
|
||||
/// Archive file to inspect
|
||||
archive: PathBuf,
|
||||
},
|
||||
}
|
||||
2
src/compression.rs
Normal file
2
src/compression.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
// Gzip compression/decompression and compression heuristic.
|
||||
// Will be implemented in Task 2.
|
||||
2
src/crypto.rs
Normal file
2
src/crypto.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
// Cryptographic operations: AES-256-CBC, HMAC-SHA-256, SHA-256.
|
||||
// Will be implemented in Task 2.
|
||||
2
src/format.rs
Normal file
2
src/format.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
// Binary format types and serialization/deserialization.
|
||||
// Will be implemented in Task 2.
|
||||
9
src/key.rs
Normal file
9
src/key.rs
Normal file
@@ -0,0 +1,9 @@
|
||||
/// Hardcoded 32-byte AES-256 key.
|
||||
/// Same key is used for AES-256-CBC encryption and HMAC-SHA-256 authentication (v1).
|
||||
/// v2 will derive separate subkeys using HKDF.
|
||||
pub const KEY: [u8; 32] = [
|
||||
0x7A, 0x35, 0xC1, 0xD9, 0x4F, 0xE8, 0x2B, 0x6A,
|
||||
0x91, 0x0D, 0xF3, 0x58, 0xBC, 0x74, 0xA6, 0x1E,
|
||||
0x42, 0x8F, 0xD0, 0x63, 0xE5, 0x17, 0x9B, 0x2C,
|
||||
0xFA, 0x84, 0x06, 0xCD, 0x3E, 0x79, 0xB5, 0x50,
|
||||
];
|
||||
43
src/main.rs
Normal file
43
src/main.rs
Normal file
@@ -0,0 +1,43 @@
|
||||
mod archive;
|
||||
mod cli;
|
||||
mod compression;
|
||||
mod crypto;
|
||||
mod format;
|
||||
mod key;
|
||||
|
||||
use clap::Parser;
|
||||
use cli::{Cli, Commands};
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
let cli = Cli::parse();
|
||||
|
||||
match cli.command {
|
||||
Commands::Pack {
|
||||
files,
|
||||
output,
|
||||
no_compress,
|
||||
} => {
|
||||
println!(
|
||||
"Pack: {} files -> {:?} (no_compress: {:?})",
|
||||
files.len(),
|
||||
output,
|
||||
no_compress
|
||||
);
|
||||
println!("Not implemented yet");
|
||||
Ok(())
|
||||
}
|
||||
Commands::Unpack {
|
||||
archive,
|
||||
output_dir,
|
||||
} => {
|
||||
println!("Unpack: {:?} -> {:?}", archive, output_dir);
|
||||
println!("Not implemented yet");
|
||||
Ok(())
|
||||
}
|
||||
Commands::Inspect { archive } => {
|
||||
println!("Inspect: {:?}", archive);
|
||||
println!("Not implemented yet");
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user