Commit 67f14955 authored by Sietse Ringers's avatar Sietse Ringers
Browse files

Use new gabi.ProofBuilderList type

parent 190ea492
......@@ -26,7 +26,7 @@ type keyshareSessionHandler interface {
type keyshareSession struct {
session Session
builders []gabi.ProofBuilder
builders gabi.ProofBuilderList
transports map[SchemeManagerIdentifier]*HTTPTransport
sessionHandler keyshareSessionHandler
pinRequestor KeysharePinRequestor
......@@ -120,7 +120,7 @@ func (ks *keyshareServer) HashedPin(pin string) string {
// Error, blocked or success of the keyshare session is reported back to the keyshareSessionHandler.
func startKeyshareSession(
session Session,
builders []gabi.ProofBuilder,
builders gabi.ProofBuilderList,
sessionHandler keyshareSessionHandler,
pin KeysharePinRequestor,
) {
......@@ -317,7 +317,7 @@ func (ks *keyshareSession) GetCommitments() {
func (ks *keyshareSession) GetProofPs() {
_, issig := ks.session.(*SignatureRequest)
_, issuing := ks.session.(*IssuanceRequest)
challenge := gabi.DistributedChallenge(ks.session.GetContext(), ks.session.GetNonce(), ks.builders, issig)
challenge := ks.builders.Challenge(ks.session.GetContext(), ks.session.GetNonce(), issig)
kssChallenge := challenge
// In disclosure or signature sessions the challenge is Paillier encrypted.
......@@ -382,7 +382,7 @@ func (ks *keyshareSession) Finish(challenge *big.Int, responses map[SchemeManage
}
// Create merged proofs and finish protocol
list, err := gabi.BuildDistributedProofList(challenge, ks.builders, proofPs)
list, err := ks.builders.BuildDistributedProofList(challenge, proofPs)
if err != nil {
ks.sessionHandler.KeyshareError(err)
return
......@@ -393,7 +393,7 @@ func (ks *keyshareSession) Finish(challenge *big.Int, responses map[SchemeManage
// Calculate IssueCommitmentMessage, without merging in any of the received ProofP's:
// instead, include the keyshare server's JWT in the IssueCommitmentMessage for the
// issuance server to verify
list, err := gabi.BuildDistributedProofList(challenge, ks.builders, nil)
list, err := ks.builders.BuildDistributedProofList(challenge, nil)
if err != nil {
ks.sessionHandler.KeyshareError(err)
return
......
......@@ -237,13 +237,13 @@ type Session interface {
SchemeManagers() []SchemeManagerIdentifier
}
func (cm *CredentialManager) ProofBuilders(choice *DisclosureChoice) ([]gabi.ProofBuilder, error) {
func (cm *CredentialManager) ProofBuilders(choice *DisclosureChoice) (gabi.ProofBuilderList, error) {
todisclose, err := cm.groupCredentials(choice)
if err != nil {
return nil, err
}
builders := []gabi.ProofBuilder{}
builders := gabi.ProofBuilderList([]gabi.ProofBuilder{})
for id, list := range todisclose {
cred, err := cm.credentialByID(id)
if err != nil {
......@@ -260,17 +260,17 @@ func (cm *CredentialManager) Proofs(choice *DisclosureChoice, request Session, i
if err != nil {
return nil, err
}
return gabi.BuildProofList(request.GetContext(), request.GetNonce(), builders, issig), nil
return builders.BuildProofList(request.GetContext(), request.GetNonce(), issig), nil
}
func (cm *CredentialManager) IssuanceProofBuilders(request *IssuanceRequest) ([]gabi.ProofBuilder, error) {
func (cm *CredentialManager) IssuanceProofBuilders(request *IssuanceRequest) (gabi.ProofBuilderList, error) {
state, err := newIssuanceState()
if err != nil {
return nil, err
}
request.state = state
proofBuilders := []gabi.ProofBuilder{}
proofBuilders := gabi.ProofBuilderList([]gabi.ProofBuilder{})
for _, futurecred := range request.Credentials {
pk := MetaStore.PublicKey(futurecred.Credential.IssuerIdentifier(), futurecred.KeyCounter)
credBuilder := gabi.NewCredentialBuilder(pk, request.GetContext(), cm.secretkey, state.nonce2)
......@@ -293,7 +293,7 @@ func (cm *CredentialManager) IssueCommitments(request *IssuanceRequest) (*gabi.I
if err != nil {
return nil, err
}
list := gabi.BuildProofList(request.GetContext(), request.GetNonce(), proofBuilders, false)
list := proofBuilders.BuildProofList(request.GetContext(), request.GetNonce(), false)
return &gabi.IssueCommitmentMessage{Proofs: list, Nonce2: request.state.nonce2}, nil
}
......
......@@ -205,7 +205,7 @@ func (session *session) do(proceed bool) {
}
session.sendResponse(message)
} else {
var builders []gabi.ProofBuilder
var builders gabi.ProofBuilderList
var err error
switch session.Action {
case ActionSigning:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment