pub struct ProofEngine { /* private fields */ }Expand description
Proof engine for zero-knowledge proofs
Implementations§
Source§impl ProofEngine
impl ProofEngine
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates an engine with empty proof-system registry and fresh storage, verification, and performance-tracking subsystems.
Sourcepub fn initialize(&mut self) -> Result<(), CryptographicError>
pub fn initialize(&mut self) -> Result<(), CryptographicError>
Initializes storage, verification engine, and performance optimizer.
Sourcepub fn add_proof_system(&mut self, system: ProofSystem)
pub fn add_proof_system(&mut self, system: ProofSystem)
Register a proof system.
Sourcepub fn get_proof_system(&self, system_id: &str) -> Option<&ProofSystem>
pub fn get_proof_system(&self, system_id: &str) -> Option<&ProofSystem>
Look up a proof system by id.
Sourcepub fn list_proof_systems(&self) -> impl Iterator<Item = &ProofSystem>
pub fn list_proof_systems(&self) -> impl Iterator<Item = &ProofSystem>
Iterate over all registered proof systems.
Sourcepub fn generate_proof(
&mut self,
circuit_id: &str,
witness: &[Vec<u8>],
public_inputs: &[Vec<u8>],
) -> Result<Proof, CryptographicError>
pub fn generate_proof( &mut self, circuit_id: &str, witness: &[Vec<u8>], public_inputs: &[Vec<u8>], ) -> Result<Proof, CryptographicError>
Generates a proof for circuit_id over witness/public_inputs,
stores it, audit-logs the operation, and records proving metrics.
WARNING: only circuit_id == "deontic_access" (feature zk-culling)
produces a real Groth16 SNARK. All other circuits get a hash-commitment
blob stamped system_id: "zk_snarks" that is NOT a proof of knowledge
— see STUBS.md F31.
Sourcepub fn verify_proof(
&mut self,
proof: &Proof,
public_inputs: &[Vec<u8>],
) -> Result<bool, CryptographicError>
pub fn verify_proof( &mut self, proof: &Proof, public_inputs: &[Vec<u8>], ) -> Result<bool, CryptographicError>
Verifies proof against public_inputs, stores the verification
record, audit-logs, and records metrics.
WARNING: for non-Groth16 (tag 0x01) proof data this accepts any blob
with a matching H(public_inputs) and non-zero fields — it does NOT
verify witness knowledge (STUBS.md F31). Real verification only happens
for deontic_access proofs under zk-culling.
Sourcepub fn generate_commitment_proof_data(
circuit_id: &str,
witness: &[Vec<u8>],
public_inputs: &[Vec<u8>],
) -> Result<Vec<u8>, CryptographicError>
pub fn generate_commitment_proof_data( circuit_id: &str, witness: &[Vec<u8>], public_inputs: &[Vec<u8>], ) -> Result<Vec<u8>, CryptographicError>
Builds a 130-byte NIZK Schnorr proof of knowledge: deriving a secret scalar
from (circuit_id || witness), emitting its public commitment C_w = w·B (32B),
public input binding C_p = H(public_inputs) (32B), tag 0x01, flag 0x01,
and a 64-byte Ed25519 Schnorr signature over H(b"qualia_zk_commitment_proof" || C_p || C_w).
This proves knowledge of the secret witness scalar bound to the public inputs.
Sourcepub fn verify_commitment_proof_data(
proof_data: &[u8],
public_inputs: &[Vec<u8>],
) -> Result<bool, CryptographicError>
pub fn verify_commitment_proof_data( proof_data: &[u8], public_inputs: &[Vec<u8>], ) -> Result<bool, CryptographicError>
Soundly verifies a tag-0x01 NIZK Schnorr proof of knowledge blob:
verifies byte length (>= 130), tag/flag, H(public_inputs) equality with C_p,
parses C_w as a valid curve point (verifying key), parses the 64-byte signature (R, s),
and verifies the Schnorr relation s·B = R + e·C_w against H(b"qualia_zk_commitment_proof" || C_p || C_w).
Rejects any forged, incomplete, or invalid proofs.
Auto Trait Implementations§
impl Freeze for ProofEngine
impl RefUnwindSafe for ProofEngine
impl Send for ProofEngine
impl Sync for ProofEngine
impl Unpin for ProofEngine
impl UnsafeUnpin for ProofEngine
impl UnwindSafe for ProofEngine
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more