Switch REQUIRE_BRIDGE_TOKEN back to constant for now
This commit is contained in:
parent
5935d3d78c
commit
58ab310a40
|
@ -20,7 +20,7 @@ use positive_report::*;
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub db: DbConfig,
|
pub db: DbConfig,
|
||||||
require_bridge_token: bool,
|
//require_bridge_token: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
|
|
|
@ -10,6 +10,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use sha1::{Digest, Sha1};
|
use sha1::{Digest, Sha1};
|
||||||
use std::option::Option;
|
use std::option::Option;
|
||||||
|
|
||||||
|
pub const REQUIRE_BRIDGE_TOKEN: bool = false;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum PositiveReportError {
|
pub enum PositiveReportError {
|
||||||
DateInFuture,
|
DateInFuture,
|
||||||
|
@ -46,7 +48,8 @@ impl PositiveReport {
|
||||||
lox_proof: lox_pr::Request,
|
lox_proof: lox_pr::Request,
|
||||||
country: String,
|
country: String,
|
||||||
) -> Self {
|
) -> 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.");
|
panic!("Bridge tokens are required for positive reports.");
|
||||||
}
|
}
|
||||||
let mut hasher = Sha1::new();
|
let mut hasher = Sha1::new();
|
||||||
|
@ -110,7 +113,8 @@ impl PositiveReport {
|
||||||
Htable: &RistrettoBasepointTable,
|
Htable: &RistrettoBasepointTable,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
// Verify bridge token
|
// 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_token = self.bridge_token.unwrap();
|
||||||
let bridge_key = bridge_info.pubkey;
|
let bridge_key = bridge_info.pubkey;
|
||||||
if bridge_key.is_none() {
|
if bridge_key.is_none() {
|
||||||
|
@ -153,7 +157,8 @@ pub struct SerializablePositiveReport {
|
||||||
impl SerializablePositiveReport {
|
impl SerializablePositiveReport {
|
||||||
pub fn to_report(self) -> Result<PositiveReport, PositiveReportError> {
|
pub fn to_report(self) -> Result<PositiveReport, PositiveReportError> {
|
||||||
// Check that fields are valid
|
// 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);
|
return Err(PositiveReportError::MissingBridgeToken);
|
||||||
}
|
}
|
||||||
if self.country == "" {
|
if self.country == "" {
|
||||||
|
|
Loading…
Reference in New Issue