From 51cd001d7bc8865df9312bd2980cb7a7498e740c Mon Sep 17 00:00:00 2001 From: Jacob Trombetta Date: Thu, 23 Jan 2025 18:32:16 -0500 Subject: [PATCH] feat: expose commitment key fields in API (#354) --- src/provider/hyperkzg.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/provider/hyperkzg.rs b/src/provider/hyperkzg.rs index 99bb7a3e..3880b497 100644 --- a/src/provider/hyperkzg.rs +++ b/src/provider/hyperkzg.rs @@ -43,6 +43,35 @@ where tau_H: <::G2 as DlogGroup>::AffineGroupElement, // needed only for the verifier key } +impl CommitmentKey +where + E::GE: PairingGroup, +{ + /// Create a new commitment key + pub fn new( + ck: Vec<::AffineGroupElement>, + h: ::AffineGroupElement, + tau_H: <::G2 as DlogGroup>::AffineGroupElement, + ) -> Self { + Self { ck, h, tau_H } + } + + /// Returns a reference to the ck field + pub fn ck(&self) -> &[::AffineGroupElement] { + &self.ck + } + + /// Returns a reference to the h field + pub fn h(&self) -> &::AffineGroupElement { + &self.h + } + + /// Returns a reference to the tau_H field + pub fn tau_H(&self) -> &<::G2 as DlogGroup>::AffineGroupElement { + &self.tau_H + } +} + impl Len for CommitmentKey where E::GE: PairingGroup,