Selaa lähdekoodia

Switch REQUIRE_BRIDGE_TOKEN back to constant for now

Vecna 2 kuukautta sitten
vanhempi
commit
58ab310a40
2 muutettua tiedostoa jossa 9 lisäystä ja 4 poistoa
  1. 1 1
      src/lib.rs
  2. 8 3
      src/positive_report.rs

+ 1 - 1
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)]

+ 8 - 3
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<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 == "" {