token_analyzer/
lib.rs

1//! # Token Security Analyzer
2//!
3//! Fast, parallel token security analyzer for detecting exposed secrets,
4//! API keys, and sensitive tokens in your codebase.
5//!
6//! [![Crates.io](https://img.shields.io/crates/v/token-analyzer.svg)](https://crates.io/crates/token-analyzer)
7//! [![Documentation](https://docs.rs/token-analyzer/badge.svg)](https://docs.rs/token-analyzer)
8//! [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9//!
10//! ## Features
11//!
12//! - **🚀 Blazing fast**: Uses ripgrep's `ignore` crate for file walking
13//! - **⚡ Parallel**: Leverages `rayon` for multi-threaded file scanning
14//! - **🧠 Smart**: Respects `.gitignore` and common ignore patterns
15//! - **🔐 Security-focused**: Detects dangerous patterns (print, log, echo)
16//! - **📁 Context-aware**: Prioritizes sensitive files (.env, configs)
17//! - **🎯 Entropy detection**: Identifies high-entropy strings (real secrets)
18//! - **🏷️ Known prefixes**: Detects known token formats (AWS, GitHub, Slack...)
19//!
20//! ## Quick Start
21//!
22//! ### As a library
23//!
24//! ```rust
25//! use token_analyzer::{TokenSecurityAnalyzer, AnalyzerConfig};
26//! use std::path::PathBuf;
27//!
28//! let analyzer = TokenSecurityAnalyzer::new(AnalyzerConfig::default());
29//! let report = analyzer.analyze("API_KEY", &PathBuf::from(".")).unwrap();
30//!
31//! println!("Found {} calls in {} files", report.total_calls, report.files.len());
32//! for file in &report.files {
33//!     if file.has_exposure {
34//!         println!("⚠️  {} - EXPOSED! (risk: {:?})", file.path.display(), file.risk_level);
35//!     }
36//! }
37//! ```
38//!
39//! ### As a CLI tool
40//!
41//! ```bash
42//! # Install
43//! cargo install token-analyzer
44//!
45//! # Basic usage
46//! token-analyzer API_KEY ./my-project
47//!
48//! # Quick scan
49//! token-analyzer API_KEY ./my-project --fast
50//!
51//! # Thorough scan with JSON output
52//! token-analyzer API_KEY ./my-project --thorough --json
53//! ```
54//!
55//! ## Related Projects
56//!
57//! - [lazy-locker](https://github.com/WillIsback/lazy-locker) - Secure TUI secret manager
58//!   that uses token-analyzer for security audits
59//!
60//! ## License
61//!
62//! MIT License - see [LICENSE](LICENSE) for details.
63
64mod analyzer;
65
66pub use analyzer::*;