Skip to content

Commit

Permalink
feat: expose commitment key fields in API (#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtrombetta authored Jan 23, 2025
1 parent 2a513f5 commit 51cd001
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/provider/hyperkzg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,35 @@ where
tau_H: <<E::GE as PairingGroup>::G2 as DlogGroup>::AffineGroupElement, // needed only for the verifier key
}

impl<E: Engine> CommitmentKey<E>
where
E::GE: PairingGroup,
{
/// Create a new commitment key
pub fn new(
ck: Vec<<E::GE as DlogGroup>::AffineGroupElement>,
h: <E::GE as DlogGroup>::AffineGroupElement,
tau_H: <<E::GE as PairingGroup>::G2 as DlogGroup>::AffineGroupElement,
) -> Self {
Self { ck, h, tau_H }
}

/// Returns a reference to the ck field
pub fn ck(&self) -> &[<E::GE as DlogGroup>::AffineGroupElement] {
&self.ck
}

/// Returns a reference to the h field
pub fn h(&self) -> &<E::GE as DlogGroup>::AffineGroupElement {
&self.h
}

/// Returns a reference to the tau_H field
pub fn tau_H(&self) -> &<<E::GE as PairingGroup>::G2 as DlogGroup>::AffineGroupElement {
&self.tau_H
}
}

impl<E: Engine> Len for CommitmentKey<E>
where
E::GE: PairingGroup,
Expand Down

0 comments on commit 51cd001

Please sign in to comment.