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