1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//! # qzkp -- Quantum Zero-Knowledge Proof Protocol
//!
//! A Rust implementation of the QZKP protocol: a BB84-inspired quantum channel
//! simulation combined with QBER (Quantum Bit Error Rate) verification for
//! zero-knowledge identity proofs, with built-in Aadhaar integration.
//!
//! ## Overview
//!
//! The library provides four layers, each building on the one below:
//!
//! | Module | Purpose |
//! |--------|---------|
//! | [`quantum`] | Single-qubit state-vector simulator with noise models |
//! | [`bb84`] | BB84 quantum key distribution protocol |
//! | [`qzkp`] | Full QZKP proof protocol (KDF, quantum stage, QBER) |
//! | [`qaadhaar`] | Aadhaar identity verification on top of QZKP |
//!
//! ## Quick start
//!
//! ```rust
//! use qzkp::qzkp::QZKPProtocol;
//!
//! let protocol = QZKPProtocol::new(
//! "shared_secret".into(),
//! "shared_secret".into(),
//! 32,
//! 0.025,
//! );
//! let result = protocol.run_protocol(&mut rand::thread_rng());
//! assert!(result.verification_status);
//! ```
//!
//! ## Aadhaar authentication
//!
//! ```rust
//! use std::collections::BTreeMap;
//! use qzkp::qaadhaar::{QAadhaarProtocol, ServiceProvider};
//!
//! let mut attrs = BTreeMap::new();
//! attrs.insert("name".into(), "Alice".into());
//!
//! let proto = QAadhaarProtocol::new("1234-5678-9012".into(), "secret".into(), attrs);
//! let challenge = proto.request_authentication("Portal", "id_verify", &mut rand::thread_rng());
//! let (proof, result) = proto.generate_proof(&challenge, 0.025, &mut rand::thread_rng());
//!
//! let verifier = ServiceProvider::new("Portal".into());
//! assert!(verifier.verify_proof(&proof));
//! ```