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