Trait commit_verify::ConvolveCommitProof
source · pub trait ConvolveCommitProof<Msg, Source, Protocol>where
Self: Sized + VerifyEq,
Source: ConvolveCommit<Msg, Self, Protocol>,
Msg: CommitEncode,
Protocol: CommitmentProtocol,{
type Suppl;
// Required methods
fn restore_original(&self, commitment: &Source::Commitment) -> Source;
fn extract_supplement(&self) -> &Self::Suppl;
// Provided method
fn verify(
&self,
msg: &Msg,
commitment: &Source::Commitment
) -> Result<bool, Source::CommitError>
where Self: VerifyEq { ... }
}
Expand description
Proof type used by ConvolveCommit
protocol.
Required Associated Types§
Required Methods§
sourcefn restore_original(&self, commitment: &Source::Commitment) -> Source
fn restore_original(&self, commitment: &Source::Commitment) -> Source
Restores the original source before the commitment from the supplement
(the self
) and commitment.
sourcefn extract_supplement(&self) -> &Self::Suppl
fn extract_supplement(&self) -> &Self::Suppl
Extract supplement from the proof.
Provided Methods§
sourcefn verify(
&self,
msg: &Msg,
commitment: &Source::Commitment
) -> Result<bool, Source::CommitError>where
Self: VerifyEq,
fn verify(
&self,
msg: &Msg,
commitment: &Source::Commitment
) -> Result<bool, Source::CommitError>where
Self: VerifyEq,
Verifies commitment using proof (the self
) against the message.
Default implementation repeats ConvolveCommit::convolve_commit
procedure, restoring the original value out of proof data, checking
that the resulting commitment matches the provided one in the
commitment
parameter.
Errors if the commitment can’t be created, i.e. the
ConvolveCommit::convolve_commit
procedure for the original,
restored from the proof, can’t be performed. This means that the
verification has failed and the commitment and/or the proof are
invalid. The function returns error in this case (ano not simply
false
) since this usually means the software error in managing
container and proof data, or selection of a different commitment
protocol parameters comparing to the ones used during commitment
creation. In all these cases we’d like to provide devs with more
information for debugging.
The proper way of using the function in a well-debugged software should
be if commitment.verify(...).expect("proof managing system") { .. }
.
However if the proofs are provided by some sort of user/network input
from an untrusted party, a proper form would be
if commitment.verify(...).unwrap_or(false) { .. }
.