Commit 0e3802dc authored by Sietse Ringers's avatar Sietse Ringers
Browse files

refactor: reuse AttributeRequest.Satify() in irmaclient candidate attribute search algorithm

parent 585938ed
......@@ -477,17 +477,20 @@ outer:
var candidateSet []*irma.AttributeIdentifier
for _, cred := range s {
for _, attr := range con {
if attr.Type.CredentialTypeIdentifier() == cred.Type {
id := &irma.AttributeIdentifier{Type: attr.Type, CredentialHash: cred.Hash}
if attr.Value != nil {
attrs, _ := client.attributesByHash(cred.Hash)
val := attrs.UntranslatedAttribute(id.Type)
if val == nil || *attr.Value != *val {
continue outer
}
}
candidateSet = append(candidateSet, id)
if attr.Type.CredentialTypeIdentifier() != cred.Type {
continue
}
attrs, _ := client.attributesByHash(cred.Hash)
val := attrs.UntranslatedAttribute(attr.Type)
if !attr.Satisfy(attr.Type, val) {
// if the attribute in this credential instance has the wrong value, then we have
// to discard the entire candidate set
continue outer
}
candidateSet = append(candidateSet, &irma.AttributeIdentifier{
Type: attr.Type,
CredentialHash: cred.Hash,
})
}
}
result = append(result, candidateSet)
......
......@@ -50,8 +50,8 @@ type AttributeConDisCon []AttributeDisCon
type DisclosureRequest struct {
BaseRequest
Disclose AttributeConDisCon `json:"disclose"`
Labels map[int]TranslatedString `json:"labels"`
Disclose AttributeConDisCon `json:"disclose,omitempty"`
Labels map[int]TranslatedString `json:"labels,omitempty"`
}
// A SignatureRequest is a a request to sign a message with certain attributes. Construct new
......
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