One verify function for positive reports

This commit is contained in:
Vecna 2024-02-28 16:06:58 -05:00
parent 4f88df6171
commit 6448537c4b
2 changed files with 7 additions and 12 deletions

View File

@ -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) => {

View File

@ -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()
}
}