Prechádzať zdrojové kódy

Rename bridge_info::BridgeInfo to disambiguate

Vecna 2 mesiacov pred
rodič
commit
5935d3d78c

+ 1 - 13
src/bridge_info.rs → src/bridge_verification_info.rs

@@ -4,11 +4,9 @@ use lox_library::bridge_table::BridgeLine;
 use serde::{Deserialize, Serialize};
 use std::collections::HashSet;
 
-// TODO: Rename this. We already have a different BridgeInfo in lib.rs.
-
 /// Information that needs to be known to verify a Troll Patrol report
 #[derive(Debug, Serialize, Deserialize)]
-pub struct BridgeInfo {
+pub struct BridgeVerificationInfo {
     /// BridgeLine for this bridge
     pub bridge_line: BridgeLine,
 
@@ -18,13 +16,3 @@ pub struct BridgeInfo {
     /// Key used to verify bridge tokens
     pub pubkey: Option<VerifyingKey>,
 }
-
-impl BridgeInfo {
-    pub fn new(bl: BridgeLine) -> Self {
-        BridgeInfo {
-            bridge_line: bl,
-            buckets: HashSet::<Scalar>::new(),
-            pubkey: None,
-        }
-    }
-}

+ 1 - 1
src/lib.rs

@@ -8,7 +8,7 @@ use std::{
     io::BufReader,
 };
 
-pub mod bridge_info;
+pub mod bridge_verification_info;
 pub mod extra_info;
 pub mod negative_report;
 pub mod positive_report;

+ 4 - 2
src/negative_report.rs

@@ -1,4 +1,6 @@
-use crate::{bridge_info::BridgeInfo, get_date, BridgeDistributor, COUNTRY_CODES};
+use crate::{
+    bridge_verification_info::BridgeVerificationInfo, get_date, BridgeDistributor, COUNTRY_CODES,
+};
 
 use curve25519_dalek::scalar::Scalar;
 use lox_library::{bridge_table::BridgeLine, cred::Lox};
@@ -101,7 +103,7 @@ impl NegativeReport {
     }
 
     /// Verify the report
-    pub fn verify(self, bridge_info: &BridgeInfo) -> bool {
+    pub fn verify(self, bridge_info: &BridgeVerificationInfo) -> bool {
         match self.bridge_pok {
             ProofOfBridgeKnowledge::HashOfBridgeLine(pok) => {
                 let hash = HashOfBridgeLine::new(&bridge_info.bridge_line);

+ 2 - 2
src/positive_report.rs

@@ -1,7 +1,7 @@
 // For Lox-related code where points are uppercase and scalars are lowercase
 #![allow(non_snake_case)]
 
-use crate::{bridge_info::BridgeInfo, get_date, CONFIG, COUNTRY_CODES};
+use crate::{bridge_verification_info::BridgeVerificationInfo, get_date, CONFIG, COUNTRY_CODES};
 
 use curve25519_dalek::ristretto::RistrettoBasepointTable;
 use ed25519_dalek::{Signature, Signer, SigningKey, Verifier};
@@ -106,7 +106,7 @@ impl PositiveReport {
     pub fn verify(
         self,
         la: &mut BridgeAuth,
-        bridge_info: &BridgeInfo,
+        bridge_info: &BridgeVerificationInfo,
         Htable: &RistrettoBasepointTable,
     ) -> bool {
         // Verify bridge token