did_utils/proof/traits.rs
1use serde_json::Value;
2
3use crate::crypto::Error;
4
5use super::model::Proof;
6
7/// A trait to be implemented by every crypto suite
8pub trait CryptoProof {
9 /// Create the proof value and add it to the proof object.
10 ///
11 /// The payload is the data to be signed without any proof entry.
12 /// Caller must make sure all existing proofs are removed prior to passing
13 /// the payload to this function.
14 ///
15 /// Returns the proof object with the proof value added.
16 fn proof(&self, payload: Value) -> Result<Proof, Error>;
17
18 /// Verifies that this proof is authenticates with the payload.
19 ///
20 /// The payload is the data to be verified without any proof entry.
21 /// Caller must make sure all existing proofs are removed prior to passing
22 /// the payload to this function.
23 fn verify(&self, payload: Value) -> Result<(), Error>;
24}