Commit 190ea492 authored by Sietse Ringers's avatar Sietse Ringers
Browse files

Fix distributed issuance

parent fee714cb
...@@ -393,11 +393,12 @@ func (ks *keyshareSession) Finish(challenge *big.Int, responses map[SchemeManage ...@@ -393,11 +393,12 @@ 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
message, err := Manager.IssueCommitments(ks.session.(*IssuanceRequest)) list, err := gabi.BuildDistributedProofList(challenge, ks.builders, nil)
if err != nil { if err != nil {
ks.sessionHandler.KeyshareError(err) ks.sessionHandler.KeyshareError(err)
return return
} }
message := gabi.IssueCommitmentMessage{Proofs: list, Nonce2: ks.session.(*IssuanceRequest).state.nonce2}
for _, response := range responses { for _, response := range responses {
message.ProofPjwt = response message.ProofPjwt = response
break break
......
...@@ -242,19 +242,21 @@ func (session *session) KeyshareError(err error) { ...@@ -242,19 +242,21 @@ func (session *session) KeyshareError(err error) {
session.Handler.Failure(session.Action, &Error{ErrorCode: ErrorKeyshare, Err: err}) session.Handler.Failure(session.Action, &Error{ErrorCode: ErrorKeyshare, Err: err})
} }
type disclosureResponse string
func (session *session) sendResponse(message interface{}) { func (session *session) sendResponse(message interface{}) {
var err error var err error
switch session.Action { switch session.Action {
case ActionSigning: case ActionSigning:
fallthrough fallthrough
case ActionDisclosing: case ActionDisclosing:
var response string var response disclosureResponse
if err = session.transport.Post("proofs", &response, message); err != nil { if err = session.transport.Post("proofs", &response, message); err != nil {
session.Handler.Failure(session.Action, err.(*Error)) session.Handler.Failure(session.Action, err.(*Error))
return return
} }
if response != "VALID" { if response != "VALID" {
session.Handler.Failure(session.Action, &Error{ErrorCode: ErrorRejected, Info: response}) session.Handler.Failure(session.Action, &Error{ErrorCode: ErrorRejected, Info: string(response)})
return return
} }
case ActionIssuing: case ActionIssuing:
......
...@@ -194,7 +194,7 @@ func registerKeyshareServer(t *testing.T) { ...@@ -194,7 +194,7 @@ func registerKeyshareServer(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
} }
func dTestKeyshareSession(t *testing.T) { func TestKeyshareSession(t *testing.T) {
registerKeyshareServer(t) registerKeyshareServer(t)
expiry := Timestamp(NewMetadataAttribute().Expiry()) expiry := Timestamp(NewMetadataAttribute().Expiry())
......
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