Commit 007f4d94 authored by Sietse Ringers's avatar Sietse Ringers
Browse files

fix: combined issuance-disclosure requests with two schemes one of which has a keyshare server

parent f8b269e7
Pipeline #30215 failed with stages
in 1 minute and 9 seconds
...@@ -59,6 +59,21 @@ func TestIssuanceSession(t *testing.T) { ...@@ -59,6 +59,21 @@ func TestIssuanceSession(t *testing.T) {
sessionHelper(t, request, "issue", nil) sessionHelper(t, request, "issue", nil)
} }
func TestIssuanceCombinedMultiSchemeSession(t *testing.T) {
id := irma.NewAttributeTypeIdentifier("test.test.mijnirma.email")
request := getCombinedIssuanceRequest(id)
sessionHelper(t, request, "issue", nil)
sessionHelper(t, irma.NewIssuanceRequest([]*irma.CredentialRequest{
{
CredentialTypeID: irma.NewCredentialTypeIdentifier("test.test.email"),
Attributes: map[string]string{
"email": "example@example.com",
},
},
}, irma.NewAttributeTypeIdentifier("irma-demo.RU.studentCard.studentID")), "issue", nil)
}
func TestMultipleIssuanceSession(t *testing.T) { func TestMultipleIssuanceSession(t *testing.T) {
request := getMultipleIssuanceRequest() request := getMultipleIssuanceRequest()
sessionHelper(t, request, "issue", nil) sessionHelper(t, request, "issue", nil)
......
...@@ -408,22 +408,28 @@ func (dr *DisclosureRequest) Disclosure() *DisclosureRequest { ...@@ -408,22 +408,28 @@ func (dr *DisclosureRequest) Disclosure() *DisclosureRequest {
return dr return dr
} }
func (dr *DisclosureRequest) identifiers() *IrmaIdentifierSet {
ids := &IrmaIdentifierSet{
SchemeManagers: map[SchemeManagerIdentifier]struct{}{},
Issuers: map[IssuerIdentifier]struct{}{},
CredentialTypes: map[CredentialTypeIdentifier]struct{}{},
PublicKeys: map[IssuerIdentifier][]int{},
}
_ = dr.Disclose.Iterate(func(a *AttributeRequest) error {
attr := a.Type
ids.SchemeManagers[attr.CredentialTypeIdentifier().IssuerIdentifier().SchemeManagerIdentifier()] = struct{}{}
ids.Issuers[attr.CredentialTypeIdentifier().IssuerIdentifier()] = struct{}{}
ids.CredentialTypes[attr.CredentialTypeIdentifier()] = struct{}{}
return nil
})
return ids
}
func (dr *DisclosureRequest) Identifiers() *IrmaIdentifierSet { func (dr *DisclosureRequest) Identifiers() *IrmaIdentifierSet {
if dr.ids == nil { if dr.ids == nil {
dr.ids = &IrmaIdentifierSet{ dr.ids = dr.identifiers()
SchemeManagers: map[SchemeManagerIdentifier]struct{}{},
Issuers: map[IssuerIdentifier]struct{}{},
CredentialTypes: map[CredentialTypeIdentifier]struct{}{},
PublicKeys: map[IssuerIdentifier][]int{},
}
_ = dr.Disclose.Iterate(func(a *AttributeRequest) error {
attr := a.Type
dr.ids.SchemeManagers[attr.CredentialTypeIdentifier().IssuerIdentifier().SchemeManagerIdentifier()] = struct{}{}
dr.ids.Issuers[attr.CredentialTypeIdentifier().IssuerIdentifier()] = struct{}{}
dr.ids.CredentialTypes[attr.CredentialTypeIdentifier()] = struct{}{}
return nil
})
} }
return dr.ids return dr.ids
} }
...@@ -545,7 +551,7 @@ func (ir *IssuanceRequest) Identifiers() *IrmaIdentifierSet { ...@@ -545,7 +551,7 @@ func (ir *IssuanceRequest) Identifiers() *IrmaIdentifierSet {
ir.ids.PublicKeys[issuer] = append(ir.ids.PublicKeys[issuer], credreq.KeyCounter) ir.ids.PublicKeys[issuer] = append(ir.ids.PublicKeys[issuer], credreq.KeyCounter)
} }
ir.ids.join(ir.DisclosureRequest.Identifiers()) ir.ids.join(ir.DisclosureRequest.identifiers())
} }
return ir.ids return ir.ids
} }
......
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