qzkp 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
qzkp-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,72 @@
1
+ Metadata-Version: 2.4
2
+ Name: qzkp
3
+ Version: 0.1.0
4
+ Classifier: Programming Language :: Rust
5
+ Classifier: Programming Language :: Python :: Implementation :: CPython
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: Topic :: Security :: Cryptography
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Summary: Quantum Zero-Knowledge Proof protocol with BB84 simulation and Aadhaar integration (Rust-powered)
10
+ Keywords: quantum,zero-knowledge-proof,bb84,aadhaar,cryptography
11
+ License: MIT
12
+ Requires-Python: >=3.8
13
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
14
+ Project-URL: Documentation, https://github.com/vrag99/QZKP-simulation#readme
15
+ Project-URL: Repository, https://github.com/vrag99/QZKP-simulation
16
+
17
+ # qzkp
18
+
19
+ Quantum Zero-Knowledge Proof protocol with BB84 simulation and Aadhaar identity verification -- powered by Rust.
20
+
21
+ ## Install
22
+
23
+ ```bash
24
+ pip install qzkp
25
+ ```
26
+
27
+ ## Quick start
28
+
29
+ ```python
30
+ from qzkp import QZKPProtocol, QAadhaarProtocol, ServiceProvider, BB84QKD
31
+
32
+ # QZKP proof: same secret => valid
33
+ proto = QZKPProtocol("shared_secret", "shared_secret", 32, 0.025)
34
+ result = proto.run_protocol()
35
+ print(result["verification_status"]) # True
36
+ print(result["qber"]) # ~0.02-0.09
37
+
38
+ # QZKP proof: different secrets => invalid
39
+ proto2 = QZKPProtocol("secret_a", "secret_b", 32, 0.025)
40
+ result2 = proto2.run_protocol()
41
+ print(result2["verification_status"]) # False
42
+
43
+ # Aadhaar authentication
44
+ aadhaar = QAadhaarProtocol(
45
+ aadhaar_id="1234-5678-9012",
46
+ master_secret="my_secret",
47
+ attributes={"name": "Alice", "age": "25"},
48
+ )
49
+ challenge = aadhaar.request_authentication("Gov Portal", "identity_verification")
50
+ proof, qzkp_result = aadhaar.generate_proof(challenge)
51
+
52
+ verifier = ServiceProvider("Gov Portal")
53
+ print(verifier.verify_proof(proof)) # True
54
+
55
+ # BB84 key distribution
56
+ bb84 = BB84QKD(100, 0.02)
57
+ keys = bb84.generate_key()
58
+ print(keys["error_rate"]) # < 0.11
59
+ ```
60
+
61
+ ## Reproducibility
62
+
63
+ All methods accept an optional `seed` parameter for deterministic results:
64
+
65
+ ```python
66
+ result = proto.run_protocol(seed=42)
67
+ ```
68
+
69
+ ## License
70
+
71
+ MIT
72
+
qzkp-0.1.0/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # qzkp
2
+
3
+ Quantum Zero-Knowledge Proof protocol with BB84 simulation and Aadhaar identity verification -- powered by Rust.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install qzkp
9
+ ```
10
+
11
+ ## Quick start
12
+
13
+ ```python
14
+ from qzkp import QZKPProtocol, QAadhaarProtocol, ServiceProvider, BB84QKD
15
+
16
+ # QZKP proof: same secret => valid
17
+ proto = QZKPProtocol("shared_secret", "shared_secret", 32, 0.025)
18
+ result = proto.run_protocol()
19
+ print(result["verification_status"]) # True
20
+ print(result["qber"]) # ~0.02-0.09
21
+
22
+ # QZKP proof: different secrets => invalid
23
+ proto2 = QZKPProtocol("secret_a", "secret_b", 32, 0.025)
24
+ result2 = proto2.run_protocol()
25
+ print(result2["verification_status"]) # False
26
+
27
+ # Aadhaar authentication
28
+ aadhaar = QAadhaarProtocol(
29
+ aadhaar_id="1234-5678-9012",
30
+ master_secret="my_secret",
31
+ attributes={"name": "Alice", "age": "25"},
32
+ )
33
+ challenge = aadhaar.request_authentication("Gov Portal", "identity_verification")
34
+ proof, qzkp_result = aadhaar.generate_proof(challenge)
35
+
36
+ verifier = ServiceProvider("Gov Portal")
37
+ print(verifier.verify_proof(proof)) # True
38
+
39
+ # BB84 key distribution
40
+ bb84 = BB84QKD(100, 0.02)
41
+ keys = bb84.generate_key()
42
+ print(keys["error_rate"]) # < 0.11
43
+ ```
44
+
45
+ ## Reproducibility
46
+
47
+ All methods accept an optional `seed` parameter for deterministic results:
48
+
49
+ ```python
50
+ result = proto.run_protocol(seed=42)
51
+ ```
52
+
53
+ ## License
54
+
55
+ MIT
@@ -0,0 +1,18 @@
1
+ # Rust
2
+ /target/
3
+ **/*.rs.bk
4
+ *.pdb
5
+
6
+ # Cargo
7
+ Cargo.lock
8
+
9
+ # IDE
10
+ .vscode/
11
+ .idea/
12
+ *.swp
13
+ *.swo
14
+ *~
15
+
16
+ # OS
17
+ .DS_Store
18
+ Thumbs.db
@@ -0,0 +1,26 @@
1
+ [package]
2
+ name = "qzkp"
3
+ version = "0.1.0"
4
+ edition = "2021"
5
+ description = "Quantum Zero-Knowledge Proof protocol with BB84 simulation and Aadhaar identity verification"
6
+ license = "MIT"
7
+ repository = "https://github.com/vrag99/QZKP-simulation"
8
+ homepage = "https://github.com/vrag99/QZKP-simulation"
9
+ documentation = "https://docs.rs/qzkp"
10
+ readme = "README.md"
11
+ keywords = ["quantum", "zero-knowledge-proof", "bb84", "aadhaar", "cryptography"]
12
+ categories = ["cryptography", "simulation"]
13
+ authors = ["Sahil Gill", "Garv Makkar"]
14
+
15
+ [lib]
16
+ name = "qzkp"
17
+ path = "src/lib.rs"
18
+
19
+ [[example]]
20
+ name = "demo"
21
+ path = "examples/demo.rs"
22
+
23
+ [dependencies]
24
+ rand = "0.8"
25
+ sha2 = "0.10"
26
+ num-complex = "0.4"
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sahil Gill, Garv Makkar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,101 @@
1
+ # qzkp
2
+
3
+ [![Crates.io](https://img.shields.io/crates/v/qzkp.svg)](https://crates.io/crates/qzkp)
4
+ [![docs.rs](https://docs.rs/qzkp/badge.svg)](https://docs.rs/qzkp)
5
+ [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
6
+
7
+ Quantum Zero-Knowledge Proof (QZKP) protocol implementation in Rust, featuring
8
+ BB84 quantum key distribution simulation and Aadhaar identity verification.
9
+
10
+ ## Features
11
+
12
+ - **Quantum simulation** -- single-qubit state-vector simulator with depolarizing
13
+ noise and amplitude damping channels
14
+ - **BB84 QKD** -- full BB84 protocol: encode, transmit, measure, sift, estimate
15
+ error rate
16
+ - **QZKP protocol** -- SHA-256 KDF, quantum state preparation, basis
17
+ reconciliation, QBER threshold verification
18
+ - **Aadhaar integration** -- challenge-response identity verification with masked
19
+ IDs, Merkle root over attributes, and proof generation/verification
20
+
21
+ ## Quick start
22
+
23
+ Add to your `Cargo.toml`:
24
+
25
+ ```toml
26
+ [dependencies]
27
+ qzkp = "0.1"
28
+ ```
29
+
30
+ ### QZKP proof verification
31
+
32
+ ```rust
33
+ use qzkp::qzkp::QZKPProtocol;
34
+
35
+ let protocol = QZKPProtocol::new(
36
+ "shared_secret".into(),
37
+ "shared_secret".into(),
38
+ 32,
39
+ 0.025,
40
+ );
41
+ let result = protocol.run_protocol(&mut rand::thread_rng());
42
+ assert!(result.verification_status);
43
+ assert!(result.qber < 0.11);
44
+ ```
45
+
46
+ ### Aadhaar authentication
47
+
48
+ ```rust
49
+ use std::collections::BTreeMap;
50
+ use qzkp::qaadhaar::{QAadhaarProtocol, ServiceProvider};
51
+
52
+ let mut attrs = BTreeMap::new();
53
+ attrs.insert("name".into(), "Alice".into());
54
+ attrs.insert("age".into(), "25".into());
55
+
56
+ let proto = QAadhaarProtocol::new(
57
+ "1234-5678-9012".into(),
58
+ "master_secret".into(),
59
+ attrs,
60
+ );
61
+
62
+ let mut rng = rand::thread_rng();
63
+ let challenge = proto.request_authentication("Gov Portal", "id_verify", &mut rng);
64
+ let (proof, result) = proto.generate_proof(&challenge, 0.025, &mut rng);
65
+
66
+ let verifier = ServiceProvider::new("Gov Portal".into());
67
+ assert!(verifier.verify_proof(&proof));
68
+ ```
69
+
70
+ ### BB84 key distribution
71
+
72
+ ```rust
73
+ use qzkp::bb84::BB84QKD;
74
+
75
+ let bb84 = BB84QKD::new(100, 0.02);
76
+ let (key_alice, key_bob, error_rate) = bb84.generate_key(&mut rand::thread_rng());
77
+ assert!(error_rate < 0.11);
78
+ ```
79
+
80
+ ## Modules
81
+
82
+ | Module | Description |
83
+ |--------|-------------|
84
+ | `quantum` | `QuantumState`, `QuantumCircuit` -- gates, noise, measurement |
85
+ | `bb84` | `BB84QKD` -- BB84 quantum key distribution |
86
+ | `qzkp` | `QZKPProtocol`, `ProtocolResult` -- full QZKP protocol |
87
+ | `qaadhaar` | `QAadhaarProtocol`, `AuthChallenge`, `AuthProof`, `ServiceProvider` |
88
+
89
+ ## Python bindings
90
+
91
+ A Python package wrapping this crate is available:
92
+
93
+ ```bash
94
+ pip install qzkp
95
+ ```
96
+
97
+ See [PyPI](https://pypi.org/project/qzkp/) for details.
98
+
99
+ ## License
100
+
101
+ MIT
@@ -0,0 +1,128 @@
1
+ use qzkp::bb84::BB84QKD;
2
+ use qzkp::qaadhaar::{QAadhaarProtocol, ServiceProvider};
3
+ use qzkp::qzkp::QZKPProtocol;
4
+ use rand::thread_rng;
5
+ use std::collections::BTreeMap;
6
+ use std::io::{self, Write};
7
+
8
+ fn main() {
9
+ let mut rng = thread_rng();
10
+
11
+ println!("\n### SCENARIO 1: Both parties share the same secret ###\n");
12
+ let qzkp1 = QZKPProtocol::new(
13
+ "quantum_secret_123".to_string(),
14
+ "quantum_secret_123".to_string(),
15
+ 32,
16
+ 0.03,
17
+ );
18
+ let result1 = qzkp1.run_protocol(&mut rng);
19
+
20
+ println!("\n\n");
21
+ print!("Press Enter to continue to Scenario 2...");
22
+ io::stdout().flush().unwrap();
23
+ let mut input = String::new();
24
+ io::stdin().read_line(&mut input).unwrap();
25
+ println!("\n\n");
26
+
27
+ println!("\n### SCENARIO 2: Parties have different secrets ###\n");
28
+ let qzkp2 = QZKPProtocol::new(
29
+ "quantum_secret_123".to_string(),
30
+ "different_secret_456".to_string(),
31
+ 32,
32
+ 0.03,
33
+ );
34
+ let result2 = qzkp2.run_protocol(&mut rng);
35
+
36
+ println!("\n\n");
37
+
38
+ println!("SIMULATION SUMMARY");
39
+
40
+ println!(
41
+ "Scenario 1 (Same secrets): QBER = {:.4}, Valid = {}",
42
+ result1.qber, result1.verification_status
43
+ );
44
+ println!(
45
+ "Scenario 2 (Different secrets): QBER = {:.4}, Valid = {}",
46
+ result2.qber, result2.verification_status
47
+ );
48
+ println!("{}", "=".repeat(70));
49
+
50
+ println!("\n");
51
+ print!("Would you like to see a standalone BB84 QKD demonstration? (y/n): ");
52
+ io::stdout().flush().unwrap();
53
+ let mut user_input = String::new();
54
+ io::stdin().read_line(&mut user_input).unwrap();
55
+
56
+ if user_input.trim().eq_ignore_ascii_case("y") {
57
+ println!("BB84 QUANTUM KEY DISTRIBUTION DEMONSTRATION");
58
+
59
+ let bb84 = BB84QKD::new(100, 0.05);
60
+ let (key_alice, key_bob, error_rate) = bb84.generate_key(&mut rng);
61
+
62
+ println!("\nBB84 Protocol Results:");
63
+ println!(" Initial qubits sent: 100");
64
+ println!(
65
+ " Final key length: {} bits (after basis reconciliation)",
66
+ key_alice.len()
67
+ );
68
+
69
+ let alice_key_str: String = key_alice.iter().map(|&b| b.to_string()).collect();
70
+ let bob_key_str: String = key_bob.iter().map(|&b| b.to_string()).collect();
71
+
72
+ if key_alice.len() > 20 {
73
+ println!(" Alice's key: {}...", &alice_key_str[..20]);
74
+ println!(" Bob's key: {}...", &bob_key_str[..20]);
75
+ } else {
76
+ println!(" Alice's key: {}", alice_key_str);
77
+ println!(" Bob's key: {}", bob_key_str);
78
+ }
79
+
80
+ println!(
81
+ " Error rate: {:.4} ({:.2}%)",
82
+ error_rate,
83
+ error_rate * 100.0
84
+ );
85
+ println!(" Keys match: {}", key_alice == key_bob);
86
+
87
+ if error_rate < 0.11 {
88
+ println!(" Error rate below threshold - communication is secure");
89
+ } else {
90
+ println!(" Error rate too high - possible eavesdropping!");
91
+ }
92
+ println!("{}", "=".repeat(70));
93
+ }
94
+
95
+ println!("QBER Verification");
96
+
97
+ let mut attributes = BTreeMap::new();
98
+ attributes.insert("name".to_string(), "Sahil Gill".to_string());
99
+ attributes.insert("state".to_string(), "Punjab".to_string());
100
+ attributes.insert("age".to_string(), "25".to_string());
101
+
102
+ let qaadhaar = QAadhaarProtocol::new(
103
+ "1234-5678-9012".to_string(),
104
+ "quantum_aadhaar_master_secret".to_string(),
105
+ attributes,
106
+ );
107
+
108
+ let challenge =
109
+ qaadhaar.request_authentication("Government Portal", "identity_verification", &mut rng);
110
+
111
+ let (proof, qzkp_result) = qaadhaar.generate_proof(&challenge, 0.025, &mut rng);
112
+
113
+ let verifier = ServiceProvider::new("Government Portal".to_string());
114
+ let access_granted = verifier.verify_proof(&proof);
115
+
116
+ println!("Challenge session: {}", challenge.session_id);
117
+ println!("Aadhaar (masked): {}", proof.aadhaar_id_partial);
118
+ println!("QBER: {:.4}", proof.qber);
119
+ println!(
120
+ "QZKP verification status: {}",
121
+ qzkp_result.verification_status
122
+ );
123
+ println!(
124
+ "QAadhaar authentication: {}",
125
+ if access_granted { "GRANTED" } else { "DENIED" }
126
+ );
127
+ println!("{}", "=".repeat(70));
128
+ }
@@ -0,0 +1,159 @@
1
+ //! BB84 quantum key distribution protocol simulation.
2
+ //!
3
+ //! Implements the core BB84 protocol: Alice encodes random bits in random bases,
4
+ //! Bob measures in random bases, they sift to matching bases, and estimate the
5
+ //! error rate on a sample to detect eavesdropping.
6
+
7
+ use crate::quantum::QuantumCircuit;
8
+ use rand::Rng;
9
+
10
+ /// BB84 quantum key distribution simulator.
11
+ ///
12
+ /// # Example
13
+ ///
14
+ /// ```
15
+ /// use qzkp::bb84::BB84QKD;
16
+ ///
17
+ /// let bb84 = BB84QKD::new(100, 0.02);
18
+ /// let (key_alice, key_bob, error_rate) = bb84.generate_key(&mut rand::thread_rng());
19
+ /// assert!(error_rate < 0.11);
20
+ /// ```
21
+ pub struct BB84QKD {
22
+ /// Number of qubits transmitted.
23
+ pub n_bits: usize,
24
+ /// Channel noise level (depolarizing error probability per qubit).
25
+ pub noise_level: f64,
26
+ }
27
+
28
+ impl BB84QKD {
29
+ /// Create a new BB84 instance.
30
+ ///
31
+ /// * `n_bits` -- number of qubits to transmit
32
+ /// * `noise_level` -- depolarizing noise probability per qubit
33
+ pub fn new(n_bits: usize, noise_level: f64) -> Self {
34
+ BB84QKD {
35
+ n_bits,
36
+ noise_level,
37
+ }
38
+ }
39
+
40
+ fn encode_bit(&self, bit: u8, basis: u8) -> QuantumCircuit {
41
+ let mut qc = QuantumCircuit::new(1, self.noise_level);
42
+ if bit == 1 {
43
+ qc.x(0);
44
+ }
45
+ if basis == 1 {
46
+ qc.h(0);
47
+ }
48
+ qc
49
+ }
50
+
51
+ fn measure_bit(&self, qc: &mut QuantumCircuit, basis: u8, rng: &mut impl Rng) -> u8 {
52
+ if basis == 1 {
53
+ qc.h(0);
54
+ }
55
+ qc.measure(0, rng)
56
+ }
57
+
58
+ /// Run the BB84 protocol and return `(alice_key, bob_key, error_rate)`.
59
+ ///
60
+ /// The returned keys are the sifted keys (after basis reconciliation and
61
+ /// error sampling). The error rate is estimated on half the sifted bits.
62
+ pub fn generate_key(&self, rng: &mut impl Rng) -> (Vec<u8>, Vec<u8>, f64) {
63
+ let alice_bits: Vec<u8> = (0..self.n_bits).map(|_| rng.gen_range(0..2)).collect();
64
+ let alice_bases: Vec<u8> = (0..self.n_bits).map(|_| rng.gen_range(0..2)).collect();
65
+ let bob_bases: Vec<u8> = (0..self.n_bits).map(|_| rng.gen_range(0..2)).collect();
66
+
67
+ let mut bob_results = Vec::new();
68
+ for i in 0..self.n_bits {
69
+ let mut qc = self.encode_bit(alice_bits[i], alice_bases[i]);
70
+ qc.apply_noise(rng);
71
+ let result = self.measure_bit(&mut qc, bob_bases[i], rng);
72
+ bob_results.push(result);
73
+ }
74
+
75
+ let mut sifted_key_alice = Vec::new();
76
+ let mut sifted_key_bob = Vec::new();
77
+ for i in 0..self.n_bits {
78
+ if alice_bases[i] == bob_bases[i] {
79
+ sifted_key_alice.push(alice_bits[i]);
80
+ sifted_key_bob.push(bob_results[i]);
81
+ }
82
+ }
83
+
84
+ let sample_size = sifted_key_alice.len() / 2;
85
+ let error_count = (0..sample_size)
86
+ .filter(|&i| sifted_key_alice[i] != sifted_key_bob[i])
87
+ .count();
88
+
89
+ let error_rate = if sample_size > 0 {
90
+ error_count as f64 / sample_size as f64
91
+ } else {
92
+ 0.0
93
+ };
94
+
95
+ let final_key_alice = sifted_key_alice[sample_size..].to_vec();
96
+ let final_key_bob = sifted_key_bob[sample_size..].to_vec();
97
+
98
+ (final_key_alice, final_key_bob, error_rate)
99
+ }
100
+ }
101
+
102
+ #[cfg(test)]
103
+ mod tests {
104
+ use super::*;
105
+ use rand::rngs::StdRng;
106
+ use rand::SeedableRng;
107
+
108
+ fn seeded_rng() -> StdRng {
109
+ StdRng::seed_from_u64(123)
110
+ }
111
+
112
+ #[test]
113
+ fn low_noise_yields_matching_keys() {
114
+ let bb84 = BB84QKD::new(200, 0.0);
115
+ let mut rng = seeded_rng();
116
+ let (key_a, key_b, error_rate) = bb84.generate_key(&mut rng);
117
+ assert_eq!(key_a, key_b, "zero-noise keys should match exactly");
118
+ assert!((error_rate - 0.0).abs() < 1e-10);
119
+ }
120
+
121
+ #[test]
122
+ fn keys_have_reasonable_length() {
123
+ let bb84 = BB84QKD::new(100, 0.02);
124
+ let mut rng = seeded_rng();
125
+ let (key_a, _key_b, _error_rate) = bb84.generate_key(&mut rng);
126
+ // ~50% basis match, then half used for sampling => ~25% of n_bits
127
+ assert!(key_a.len() >= 10, "sifted key too short: {}", key_a.len());
128
+ assert!(
129
+ key_a.len() <= 60,
130
+ "sifted key unexpectedly long: {}",
131
+ key_a.len()
132
+ );
133
+ }
134
+
135
+ #[test]
136
+ fn low_noise_error_rate_below_threshold() {
137
+ let bb84 = BB84QKD::new(200, 0.02);
138
+ let mut rng = seeded_rng();
139
+ let (_ka, _kb, error_rate) = bb84.generate_key(&mut rng);
140
+ assert!(
141
+ error_rate < 0.11,
142
+ "error rate {} too high for low noise",
143
+ error_rate
144
+ );
145
+ }
146
+
147
+ #[test]
148
+ fn high_noise_degrades_keys() {
149
+ let bb84 = BB84QKD::new(200, 0.3);
150
+ let mut rng = seeded_rng();
151
+ let (key_a, key_b, error_rate) = bb84.generate_key(&mut rng);
152
+ // With 30% noise, many bits should differ
153
+ let mismatches = key_a.iter().zip(&key_b).filter(|(a, b)| a != b).count();
154
+ assert!(
155
+ mismatches > 0 || error_rate > 0.05,
156
+ "high noise should cause errors"
157
+ );
158
+ }
159
+ }
@@ -0,0 +1,53 @@
1
+ //! # qzkp -- Quantum Zero-Knowledge Proof Protocol
2
+ //!
3
+ //! A Rust implementation of the QZKP protocol: a BB84-inspired quantum channel
4
+ //! simulation combined with QBER (Quantum Bit Error Rate) verification for
5
+ //! zero-knowledge identity proofs, with built-in Aadhaar integration.
6
+ //!
7
+ //! ## Overview
8
+ //!
9
+ //! The library provides four layers, each building on the one below:
10
+ //!
11
+ //! | Module | Purpose |
12
+ //! |--------|---------|
13
+ //! | [`quantum`] | Single-qubit state-vector simulator with noise models |
14
+ //! | [`bb84`] | BB84 quantum key distribution protocol |
15
+ //! | [`qzkp`] | Full QZKP proof protocol (KDF, quantum stage, QBER) |
16
+ //! | [`qaadhaar`] | Aadhaar identity verification on top of QZKP |
17
+ //!
18
+ //! ## Quick start
19
+ //!
20
+ //! ```rust
21
+ //! use qzkp::qzkp::QZKPProtocol;
22
+ //!
23
+ //! let protocol = QZKPProtocol::new(
24
+ //! "shared_secret".into(),
25
+ //! "shared_secret".into(),
26
+ //! 32,
27
+ //! 0.025,
28
+ //! );
29
+ //! let result = protocol.run_protocol(&mut rand::thread_rng());
30
+ //! assert!(result.verification_status);
31
+ //! ```
32
+ //!
33
+ //! ## Aadhaar authentication
34
+ //!
35
+ //! ```rust
36
+ //! use std::collections::BTreeMap;
37
+ //! use qzkp::qaadhaar::{QAadhaarProtocol, ServiceProvider};
38
+ //!
39
+ //! let mut attrs = BTreeMap::new();
40
+ //! attrs.insert("name".into(), "Alice".into());
41
+ //!
42
+ //! let proto = QAadhaarProtocol::new("1234-5678-9012".into(), "secret".into(), attrs);
43
+ //! let challenge = proto.request_authentication("Portal", "id_verify", &mut rand::thread_rng());
44
+ //! let (proof, result) = proto.generate_proof(&challenge, 0.025, &mut rand::thread_rng());
45
+ //!
46
+ //! let verifier = ServiceProvider::new("Portal".into());
47
+ //! assert!(verifier.verify_proof(&proof));
48
+ //! ```
49
+
50
+ pub mod bb84;
51
+ pub mod qaadhaar;
52
+ pub mod quantum;
53
+ pub mod qzkp;