---
phase: 12-user-key-input
plan: 01
subsystem: crypto
tags: [clap, hex, aes-256, key-management, cli]
# Dependency graph
requires:
- phase: 08-rust-directory-archiver
provides: "pack/unpack/inspect with hardcoded key"
provides:
- "CLI --key (hex) and --key-file (raw) key input for pack/unpack"
- "inspect works without key (header only) or with key (full TOC listing)"
- "KeySource enum and resolve_key() in key.rs"
- "All archive functions parameterized by user-provided key"
affects: [12-02-PLAN, kotlin-decoder]
# Tech tracking
tech-stack:
added: [hex 0.4]
patterns: [key-parameterized archive API, clap arg group for mutually exclusive key sources]
key-files:
created: []
modified:
- Cargo.toml
- src/cli.rs
- src/key.rs
- src/archive.rs
- src/main.rs
- src/crypto.rs
- tests/round_trip.rs
- tests/golden.rs
key-decisions:
- "KeyArgs as top-level clap flatten (not per-subcommand) so --key goes before subcommand"
- "inspect accepts optional key: without key shows header only, with key shows full TOC"
- "LEGACY_KEY kept as #[cfg(test)] constant for golden vectors"
- "Password option uses Option