Rename bridge_info::BridgeInfo to disambiguate

This commit is contained in:
Vecna 2024-03-15 11:32:17 -04:00
parent 68137981fc
commit 5935d3d78c
4 changed files with 8 additions and 18 deletions

View File

@ -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,
}
}
}

View File

@ -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;

View File

@ -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);

View File

@ -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