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