Commit 971f6373 authored by Sietse Ringers's avatar Sietse Ringers
Browse files

Include credential logo when present in CredentialInfo

parent 78d71579
......@@ -5,6 +5,8 @@ import (
"math/big"
"fmt"
"github.com/mhe/gabi"
)
......@@ -44,6 +46,15 @@ func NewCredentialInfo(ints []*big.Int, store *ConfigurationStore) *CredentialIn
attrs[i] = TranslatedString(map[string]string{"en": val, "nl": val})
}
path := fmt.Sprintf("%s/%s/%s/Issues/%s/logo.png", store.path, credtype.SchemeManagerID, credtype.IssuerID, credtype.ID)
exists, err := PathExists(path)
if err != nil {
return nil
}
if !exists {
path = ""
}
return &CredentialInfo{
ID: credtype.Identifier().String(),
SignedOn: Timestamp(meta.SigningDate()),
......@@ -52,7 +63,7 @@ func NewCredentialInfo(ints []*big.Int, store *ConfigurationStore) *CredentialIn
Issuer: store.Issuers[issid],
SchemeManager: store.SchemeManagers[issid.SchemeManagerIdentifier()],
Attributes: attrs,
Logo: "", // TODO
Logo: path,
Hash: NewAttributeListFromInts(ints, store).hash(),
}
}
......
......@@ -157,7 +157,7 @@ func (cm *CredentialManager) CredentialInfoList() CredentialInfoList {
for index, attrlist := range attrlistlist {
info := attrlist.Info()
info.Index = index
list = append(list, attrlist.Info())
list = append(list, info)
}
}
......
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