Rename bridge_info::BridgeInfo to disambiguate
This commit is contained in:
parent
68137981fc
commit
5935d3d78c
|
@ -4,11 +4,9 @@ use lox_library::bridge_table::BridgeLine;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::collections::HashSet;
|
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
|
/// Information that needs to be known to verify a Troll Patrol report
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
pub struct BridgeInfo {
|
pub struct BridgeVerificationInfo {
|
||||||
/// BridgeLine for this bridge
|
/// BridgeLine for this bridge
|
||||||
pub bridge_line: BridgeLine,
|
pub bridge_line: BridgeLine,
|
||||||
|
|
||||||
|
@ -18,13 +16,3 @@ pub struct BridgeInfo {
|
||||||
/// Key used to verify bridge tokens
|
/// Key used to verify bridge tokens
|
||||||
pub pubkey: Option<VerifyingKey>,
|
pub pubkey: Option<VerifyingKey>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BridgeInfo {
|
|
||||||
pub fn new(bl: BridgeLine) -> Self {
|
|
||||||
BridgeInfo {
|
|
||||||
bridge_line: bl,
|
|
||||||
buckets: HashSet::<Scalar>::new(),
|
|
||||||
pubkey: None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -8,7 +8,7 @@ use std::{
|
||||||
io::BufReader,
|
io::BufReader,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub mod bridge_info;
|
pub mod bridge_verification_info;
|
||||||
pub mod extra_info;
|
pub mod extra_info;
|
||||||
pub mod negative_report;
|
pub mod negative_report;
|
||||||
pub mod positive_report;
|
pub mod positive_report;
|
||||||
|
|
|
@ -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 curve25519_dalek::scalar::Scalar;
|
||||||
use lox_library::{bridge_table::BridgeLine, cred::Lox};
|
use lox_library::{bridge_table::BridgeLine, cred::Lox};
|
||||||
|
@ -101,7 +103,7 @@ impl NegativeReport {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Verify the report
|
/// Verify the report
|
||||||
pub fn verify(self, bridge_info: &BridgeInfo) -> bool {
|
pub fn verify(self, bridge_info: &BridgeVerificationInfo) -> bool {
|
||||||
match self.bridge_pok {
|
match self.bridge_pok {
|
||||||
ProofOfBridgeKnowledge::HashOfBridgeLine(pok) => {
|
ProofOfBridgeKnowledge::HashOfBridgeLine(pok) => {
|
||||||
let hash = HashOfBridgeLine::new(&bridge_info.bridge_line);
|
let hash = HashOfBridgeLine::new(&bridge_info.bridge_line);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// For Lox-related code where points are uppercase and scalars are lowercase
|
// For Lox-related code where points are uppercase and scalars are lowercase
|
||||||
#![allow(non_snake_case)]
|
#![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 curve25519_dalek::ristretto::RistrettoBasepointTable;
|
||||||
use ed25519_dalek::{Signature, Signer, SigningKey, Verifier};
|
use ed25519_dalek::{Signature, Signer, SigningKey, Verifier};
|
||||||
|
@ -106,7 +106,7 @@ impl PositiveReport {
|
||||||
pub fn verify(
|
pub fn verify(
|
||||||
self,
|
self,
|
||||||
la: &mut BridgeAuth,
|
la: &mut BridgeAuth,
|
||||||
bridge_info: &BridgeInfo,
|
bridge_info: &BridgeVerificationInfo,
|
||||||
Htable: &RistrettoBasepointTable,
|
Htable: &RistrettoBasepointTable,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
// Verify bridge token
|
// Verify bridge token
|
||||||
|
|
Loading…
Reference in New Issue