Skip to content

Commit

Permalink
Add function for constructing new randomizers for a zero-knowledge proof
Browse files Browse the repository at this point in the history
  • Loading branch information
sietseringers committed Aug 30, 2023
1 parent 921f90f commit e6a0755
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions prooflist.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ func (builders ProofBuilderList) ChallengeWithRandomizers(context, nonce *big.In
return createChallenge(context, nonce, commitmentValues, issig), nil
}

func (builders ProofBuilderList) Challenge(context, nonce *big.Int, issig bool) (*big.Int, error) {
// NewProofRandomizers constructs state necessary for constructing a zero-knowledge proof showing that
// (alongside whatever else the proof shows) several non-disclosed numbers have the same value.
// Currently used only for the secret key across multiple credentials.
func NewProofRandomizers() (map[string]*big.Int, error) {
// The secret key may be used across credentials supporting different attribute sizes.
// So we should take it, and hence also its commitment, to fit within the smallest size -
// otherwise it will be too big so that we cannot perform the range proof showing
Expand All @@ -142,7 +145,15 @@ func (builders ProofBuilderList) Challenge(context, nonce *big.Int, issig bool)
if err != nil {
return nil, err
}
return builders.ChallengeWithRandomizers(context, nonce, map[string]*big.Int{"secretkey": skRandomizer}, issig)
return map[string]*big.Int{"secretkey": skRandomizer}, nil
}

func (builders ProofBuilderList) Challenge(context, nonce *big.Int, issig bool) (*big.Int, error) {
randomizers, err := NewProofRandomizers()
if err != nil {
return nil, err
}
return builders.ChallengeWithRandomizers(context, nonce, randomizers, issig)
}

func (builders ProofBuilderList) BuildDistributedProofList(
Expand Down

0 comments on commit e6a0755

Please sign in to comment.