From e6a0755a98b653d609caca5ef2bfc3e50d460693 Mon Sep 17 00:00:00 2001 From: Sietse Ringers Date: Tue, 29 Aug 2023 08:50:52 +0200 Subject: [PATCH] Add function for constructing new randomizers for a zero-knowledge proof --- prooflist.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/prooflist.go b/prooflist.go index 3043295..21430df 100644 --- a/prooflist.go +++ b/prooflist.go @@ -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 @@ -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(