From 58ab310a40afda36d3064334138b1c2c147b67d0 Mon Sep 17 00:00:00 2001 From: Vecna Date: Fri, 15 Mar 2024 13:24:00 -0400 Subject: [PATCH] Switch REQUIRE_BRIDGE_TOKEN back to constant for now --- src/lib.rs | 2 +- src/positive_report.rs | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 645671b..82d449c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -20,7 +20,7 @@ use positive_report::*; #[derive(Debug, Deserialize)] pub struct Config { pub db: DbConfig, - require_bridge_token: bool, + //require_bridge_token: bool, } #[derive(Debug, Deserialize)] diff --git a/src/positive_report.rs b/src/positive_report.rs index 3f2e4a2..25b5a90 100644 --- a/src/positive_report.rs +++ b/src/positive_report.rs @@ -10,6 +10,8 @@ use serde::{Deserialize, Serialize}; use sha1::{Digest, Sha1}; use std::option::Option; +pub const REQUIRE_BRIDGE_TOKEN: bool = false; + #[derive(Debug)] pub enum PositiveReportError { DateInFuture, @@ -46,7 +48,8 @@ impl PositiveReport { lox_proof: lox_pr::Request, country: String, ) -> Self { - if CONFIG.require_bridge_token && bridge_token.is_none() { + //if CONFIG.require_bridge_token && bridge_token.is_none() { + if REQUIRE_BRIDGE_TOKEN && bridge_token.is_none() { panic!("Bridge tokens are required for positive reports."); } let mut hasher = Sha1::new(); @@ -110,7 +113,8 @@ impl PositiveReport { Htable: &RistrettoBasepointTable, ) -> bool { // Verify bridge token - if CONFIG.require_bridge_token { + //if CONFIG.require_bridge_token { + if REQUIRE_BRIDGE_TOKEN { let bridge_token = self.bridge_token.unwrap(); let bridge_key = bridge_info.pubkey; if bridge_key.is_none() { @@ -153,7 +157,8 @@ pub struct SerializablePositiveReport { impl SerializablePositiveReport { pub fn to_report(self) -> Result { // Check that fields are valid - if CONFIG.require_bridge_token && self.bridge_token.is_none() { + //if CONFIG.require_bridge_token && self.bridge_token.is_none() { + if REQUIRE_BRIDGE_TOKEN && self.bridge_token.is_none() { return Err(PositiveReportError::MissingBridgeToken); } if self.country == "" {