Skip to content

Commit ebfaabc

Browse files
committed
add into_nizk for Protocol as well.
1 parent a8e5a27 commit ebfaabc

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/composition.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ use sha3::Digest;
2424
use sha3::Sha3_256;
2525

2626
use crate::{
27+
codec::Shake128DuplexSponge,
2728
errors::Error,
29+
fiat_shamir::Nizk,
2830
linear_relation::LinearRelation,
2931
schnorr_protocol::SchnorrProof,
3032
serialization::{deserialize_scalars, serialize_scalars},
@@ -523,3 +525,23 @@ impl<G: PrimeGroup> SigmaProtocolSimulator for Protocol<G> {
523525
}
524526
}
525527
}
528+
529+
impl<G: PrimeGroup> Protocol<G> {
530+
/// Convert this Protocol into a non-interactive zero-knowledge proof
531+
/// using the Shake128DuplexSponge codec and a specified session identifier.
532+
///
533+
/// This method provides a convenient way to create a NIZK from a Protocol
534+
/// without exposing the specific codec type to the API caller.
535+
///
536+
/// # Parameters
537+
/// - `session_identifier`: Domain separator bytes for the Fiat-Shamir transform
538+
///
539+
/// # Returns
540+
/// A `Nizk` instance ready for proving and verification
541+
pub fn into_nizk(
542+
self,
543+
session_identifier: &[u8],
544+
) -> Nizk<Protocol<G>, Shake128DuplexSponge<G>> {
545+
Nizk::new(session_identifier, self)
546+
}
547+
}

0 commit comments

Comments
 (0)