Commit 9c1216a6 authored by Sietse Ringers's avatar Sietse Ringers
Browse files

fix: erroneous MISSING_ATTRIBUTES error in some combined issuance sessions

In particular, combined issuance sessions in which 2 or more attributes are
requested from one particular credential type, due to a miscalculation during
verification of the attributes.

Fixes #36
parent c31a3ed9
......@@ -95,9 +95,10 @@ func (session *session) handlePostCommitments(commitments *irma.IssueCommitmentM
session.markAlive()
request := session.request.(*irma.IssuanceRequest)
discloseCount := len(request.Disclose)
if len(commitments.Proofs) != len(request.Credentials)+discloseCount {
return nil, session.fail(server.ErrorAttributesMissing, "")
discloseCount := len(commitments.Proofs) - len(request.Credentials)
if discloseCount < 0 {
return nil, session.fail(server.ErrorMalformedInput, "Received insufficient proofs")
}
// Compute list of public keys against which to verify the received proofs
......
......@@ -101,6 +101,37 @@ func TestRequestorIssuanceSession(t *testing.T) {
testRequestorIssuance(t, false)
}
func TestRequestorCombinedSessionMultipleAttributes(t *testing.T) {
var ir irma.IssuanceRequest
require.NoError(t, irma.UnmarshalValidate([]byte(`{
"type":"issuing",
"credentials": [
{
"credential":"irma-demo.MijnOverheid.root",
"attributes" : {
"BSN":"12345"
}
}
],
"disclose" : [
{
"label":"Initialen",
"attributes":["irma-demo.RU.studentCard.studentCardNumber"]
},
{
"label":"Achternaam",
"attributes" : ["irma-demo.RU.studentCard.studentID"]
},
{
"label":"Geboortedatum",
"attributes":["irma-demo.RU.studentCard.university"]
}
]
}`), &ir))
require.Equal(t, server.StatusDone, requestorSessionHelper(t, &ir).Status)
}
func testRequestorIssuance(t *testing.T, keyshare bool) {
attrid := irma.NewAttributeTypeIdentifier("irma-demo.RU.studentCard.studentID")
request := &irma.IssuanceRequest{
......
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