Procházet zdrojové kódy

One verify function for positive reports

Vecna před 1 rokem
rodič
revize
6448537c4b
2 změnil soubory, kde provedl 7 přidání a 12 odebrání
  1. 1 2
      src/negative_report.rs
  2. 6 10
      src/positive_report.rs

+ 1 - 2
src/negative_report.rs

@@ -85,8 +85,7 @@ impl NegativeReport {
         }
     }
 
-    /// Verify report. Caller must pass Some of the bridge knowledge proof type
-    /// in the report.
+    /// Verify the report
     pub fn verify(self, bridge_info: &BridgeInfo) -> bool {
         match self.bridge_pok {
             ProofOfBridgeKnowledge::HashOfBridgeLine(pok) => {

+ 6 - 10
src/positive_report.rs

@@ -5,7 +5,7 @@ use crate::{bridge_info::BridgeInfo, get_date, CONFIG, COUNTRY_CODES};
 
 use curve25519_dalek::ristretto::RistrettoBasepointTable;
 use ed25519_dalek::{Signature, Signer, SigningKey, Verifier};
-use lox_library::{cred::Lox, proto::positive_report as lox_pr, IssuerPubKey};
+use lox_library::{cred::Lox, proto::positive_report as lox_pr, BridgeAuth, IssuerPubKey};
 use serde::{Deserialize, Serialize};
 use sha1::{Digest, Sha1};
 use std::option::Option;
@@ -102,15 +102,10 @@ impl PositiveReport {
         }
     }
 
-    /// Verify everything except the Lox proof.
-    /// Parameters:
-    ///   - The bucket ID for the bucket containing this bridge
-    ///   - A basepoint table for computing multiples of H
-    ///   - The bridge verifying key for this bridge (if bridge token is required)
-    /// These parameters are assumed to be correct and are NOT checked against
-    /// the fingerprint listed in the report.
-    pub fn verify_excluding_lox_proof(
+    /// Verify report
+    pub fn verify(
         self,
+        la: &mut BridgeAuth,
         bridge_info: &BridgeInfo,
         Htable: &RistrettoBasepointTable,
     ) -> bool {
@@ -138,7 +133,8 @@ impl PositiveReport {
         if &bucket * Htable != BP {
             return false;
         }
-        true
+        // Verify Lox proof
+        la.handle_positive_report(self.lox_proof, &Htable).is_ok()
     }
 }