Skip to content

Commit 64b9b68

Browse files
committed
Removed cruft
1 parent c7dd5a7 commit 64b9b68

File tree

4 files changed

+8
-61
lines changed

4 files changed

+8
-61
lines changed

src/params.rs

+5-23
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
use crate::passport_info::{PersonalInfo, PersonalInfoVar};
22

33
use zkcreds::proof_data_structures::{
4-
ForestProof as ZeronymForestProof, ForestProvingKey as ZeronymForestPk,
5-
ForestVerifyingKey as ZeronymForestVk, PredProof as ZeronymPredProof,
6-
PredProvingKey as ZeronymPredPk, PredVerifyingKey as ZeronymPredVk,
7-
TreeProof as ZeronymTreeProof, TreeProvingKey as ZeronymTreePk,
8-
TreeVerifyingKey as ZeronymTreeVk,
4+
PredProof as ZeronymPredProof, PredProvingKey as ZeronymPredPk,
5+
PredVerifyingKey as ZeronymPredVk,
96
};
107

118
use ark_bls12_381::Bls12_381;
@@ -84,12 +81,9 @@ pub(crate) type PassportComSchemeG =
8481
zkcreds::compressed_pedersen::constraints::CommGadget<EdwardsParameters, FqVar, Window9x128>;
8582

8683
pub(crate) type ComTree = zkcreds::com_tree::ComTree<Fr, H, PassportComScheme>;
87-
pub(crate) type ComForest = zkcreds::com_forest::ComForest<Fr, H, PassportComScheme>;
88-
pub(crate) type ComTreePath = zkcreds::com_tree::ComTreePath<Fr, H, PassportComScheme>;
89-
pub(crate) type ComForestRoots = zkcreds::com_forest::ComForestRoots<Fr, H>;
9084

9185
/// Type aliases for Groth16 stuff
92-
pub(crate) type PredProvingKey = ZeronymPredPk<
86+
pub(crate) type PredProof = ZeronymPredProof<
9387
Bls12_381,
9488
PersonalInfo,
9589
PersonalInfoVar,
@@ -98,7 +92,7 @@ pub(crate) type PredProvingKey = ZeronymPredPk<
9892
H,
9993
HG,
10094
>;
101-
pub(crate) type PredVerifyingKey = ZeronymPredVk<
95+
pub(crate) type PredProvingKey = ZeronymPredPk<
10296
Bls12_381,
10397
PersonalInfo,
10498
PersonalInfoVar,
@@ -107,15 +101,7 @@ pub(crate) type PredVerifyingKey = ZeronymPredVk<
107101
H,
108102
HG,
109103
>;
110-
pub(crate) type TreeProvingKey =
111-
ZeronymTreePk<Bls12_381, PersonalInfo, PassportComScheme, PassportComSchemeG, H, HG>;
112-
pub(crate) type TreeVerifyingKey =
113-
ZeronymTreeVk<Bls12_381, PersonalInfo, PassportComScheme, PassportComSchemeG, H, HG>;
114-
pub(crate) type ForestProvingKey =
115-
ZeronymForestPk<Bls12_381, PersonalInfo, PassportComScheme, PassportComSchemeG, H, HG>;
116-
pub(crate) type ForestVerifyingKey =
117-
ZeronymForestVk<Bls12_381, PersonalInfo, PassportComScheme, PassportComSchemeG, H, HG>;
118-
pub(crate) type PredProof = ZeronymPredProof<
104+
pub(crate) type PredVerifyingKey = ZeronymPredVk<
119105
Bls12_381,
120106
PersonalInfo,
121107
PersonalInfoVar,
@@ -124,10 +110,6 @@ pub(crate) type PredProof = ZeronymPredProof<
124110
H,
125111
HG,
126112
>;
127-
pub(crate) type TreeProof =
128-
ZeronymTreeProof<Bls12_381, PersonalInfo, PassportComScheme, PassportComSchemeG, H, HG>;
129-
pub(crate) type ForestProof =
130-
ZeronymForestProof<Bls12_381, PersonalInfo, PassportComScheme, PassportComSchemeG, H, HG>;
131113

132114
// Set params
133115
lazy_static! {

src/passport_dump.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ pub struct PassportDump {
1616
#[serde(deserialize_with = "bytes_from_b64")]
1717
pub(crate) sig: Vec<u8>,
1818
#[serde(deserialize_with = "bytes_from_b64")]
19-
pub(crate) cert: Vec<u8>,
19+
pub(crate) _cert: Vec<u8>,
2020
#[serde(rename = "digest-alg")]
21-
pub(crate) digest_alg: String,
21+
pub(crate) _digest_alg: String,
2222
#[serde(rename = "sig-alg")]
23-
pub(crate) sig_alg: String,
23+
pub(crate) _sig_alg: String,
2424
}
2525

2626
impl PassportDump {

src/passport_info.rs

-27
Original file line numberDiff line numberDiff line change
@@ -111,29 +111,6 @@ fn date_to_u32(date: &[u8], not_after: u32) -> u32 {
111111
}
112112

113113
impl PersonalInfo {
114-
/// Constructs a new `PersonalInfo`, sampling a random nonce for commitment
115-
pub(crate) fn new<R: Rng>(
116-
rng: &mut R,
117-
nationality: [u8; STATE_ID_LEN],
118-
name: [u8; NAME_LEN],
119-
dob: u32,
120-
passport_expiry: u32,
121-
biometrics: Biometrics,
122-
) -> PersonalInfo {
123-
let nonce = ComNonce::<PassportComScheme>::rand(rng);
124-
let seed = Fr::rand(rng);
125-
126-
PersonalInfo {
127-
nonce,
128-
seed,
129-
nationality,
130-
name,
131-
dob,
132-
passport_expiry,
133-
biometrics,
134-
}
135-
}
136-
137114
/// Converts the given passport dump into a structured attribute struct. Requires `today` as an
138115
/// integer whose base-10 representation is of the form YYYYMMDD. `max_valid_years` is the
139116
/// longest that a passport can be valid, in years.
@@ -169,10 +146,6 @@ impl PersonalInfo {
169146

170147
info
171148
}
172-
173-
pub fn biometrics_hash(&self) -> [u8; HASH_LEN] {
174-
self.biometrics.hash()
175-
}
176149
}
177150

178151
impl Attrs<Fr, PassportComScheme> for PersonalInfo {

src/sig_verif.rs

-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
use crate::passport_dump::PassportDump;
21
use rsa::{padding::PaddingScheme, pkcs8::FromPublicKey, Hash, PublicKey, RsaPublicKey};
3-
use x509_parser::parse_x509_certificate;
42

53
// A PKCS#8 encoding of the US State Department's passport signing pubkey. This was a pain to
64
// extract. See the below link for instructions
@@ -23,12 +21,6 @@ pub fn load_usa_pubkey() -> IssuerPubkey {
2321
IssuerPubkey(pubkey)
2422
}
2523

26-
pub fn load_pubkey_from_dump(dump: &PassportDump) -> IssuerPubkey {
27-
let cert = (parse_x509_certificate(&dump.cert).unwrap()).1;
28-
let pubkey = RsaPublicKey::from_public_key_der(cert.public_key().raw).unwrap();
29-
IssuerPubkey(pubkey)
30-
}
31-
3224
impl IssuerPubkey {
3325
#[must_use]
3426
pub fn verify(&self, sig: &[u8], hash: &[u8]) -> bool {

0 commit comments

Comments
 (0)