Switch REQUIRE_BRIDGE_TOKEN back to constant for now

This commit is contained in:
Vecna 2024-03-15 13:24:00 -04:00
parent 5935d3d78c
commit 58ab310a40
2 changed files with 9 additions and 4 deletions

View File

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

View File

@ -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<PositiveReport, PositiveReportError> {
// 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 == "" {