Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function for constructing randomizers for a zero-knowledge proof #40

Merged
merged 1 commit into from
Aug 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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