Skip to main content

ProofEngine

Struct ProofEngine 

Source
pub struct ProofEngine { /* private fields */ }
Expand description

Proof engine for zero-knowledge proofs

Implementations§

Source§

impl ProofEngine

Source

pub fn new() -> Self

Creates an engine with empty proof-system registry and fresh storage, verification, and performance-tracking subsystems.

Source

pub fn initialize(&mut self) -> Result<(), CryptographicError>

Initializes storage, verification engine, and performance optimizer.

Source

pub fn add_proof_system(&mut self, system: ProofSystem)

Register a proof system.

Source

pub fn get_proof_system(&self, system_id: &str) -> Option<&ProofSystem>

Look up a proof system by id.

Source

pub fn list_proof_systems(&self) -> impl Iterator<Item = &ProofSystem>

Iterate over all registered proof systems.

Source

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.

Source

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.

Source

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.

Source

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§

Blanket Implementations§

§

impl<S, A> Aggregate<Result<S, Error>> for A
where A: Aggregate<S>,

§

fn from_shares<T>(iter: T) -> Result<A, Error>
where T: IntoIterator<Item = Result<S, Error>>,

Aggregate shares in an MPC protocol.
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more