Commit 2e3036ca authored by Sietse Ringers's avatar Sietse Ringers
Browse files

Change CredentialInfo struct

parent da1cdfe6
...@@ -20,16 +20,16 @@ type credential struct { ...@@ -20,16 +20,16 @@ type credential struct {
// CredentialInfo contains all information of an IRMA credential. // CredentialInfo contains all information of an IRMA credential.
type CredentialInfo struct { type CredentialInfo struct {
ID string // e.g., "irma-demo.RU.studentCard" ID string // e.g., "irma-demo.RU.studentCard"
Index int // This is the Index-th credential instance of this type Name string // e.g., "studentCard"
SignedOn Timestamp // Unix timestamp IssuerID string // e.g., "RU"
Expires Timestamp // Unix timestamp SchemeManagerID string // e.g., "irma-demo"
Type *CredentialType // Credential information from ConfigurationStore Index int // This is the Index-th credential instance of this type
Issuer *Issuer // Issuer information from ConfigurationStore SignedOn Timestamp // Unix timestamp
SchemeManager *SchemeManager // Scheme manager information from ConfigurationStore Expires Timestamp // Unix timestamp
Attributes []TranslatedString // Human-readable rendered attributes Attributes []TranslatedString // Human-readable rendered attributes
Logo string // Path to logo on storage Logo string // Path to logo on storage
Hash string // SHA256 hash over the attributes Hash string // SHA256 hash over the attributes
} }
// A CredentialInfoList is a list of credentials (implements sort.Interface). // A CredentialInfoList is a list of credentials (implements sort.Interface).
...@@ -38,7 +38,6 @@ type CredentialInfoList []*CredentialInfo ...@@ -38,7 +38,6 @@ type CredentialInfoList []*CredentialInfo
func NewCredentialInfo(ints []*big.Int, store *ConfigurationStore) *CredentialInfo { func NewCredentialInfo(ints []*big.Int, store *ConfigurationStore) *CredentialInfo {
meta := MetadataFromInt(ints[0], store) meta := MetadataFromInt(ints[0], store)
credtype := meta.CredentialType() credtype := meta.CredentialType()
issid := credtype.IssuerIdentifier()
attrs := make([]TranslatedString, len(credtype.Attributes)) attrs := make([]TranslatedString, len(credtype.Attributes))
for i := range credtype.Attributes { for i := range credtype.Attributes {
...@@ -56,15 +55,12 @@ func NewCredentialInfo(ints []*big.Int, store *ConfigurationStore) *CredentialIn ...@@ -56,15 +55,12 @@ func NewCredentialInfo(ints []*big.Int, store *ConfigurationStore) *CredentialIn
} }
return &CredentialInfo{ return &CredentialInfo{
ID: credtype.Identifier().String(), ID: credtype.Identifier().String(),
SignedOn: Timestamp(meta.SigningDate()), SignedOn: Timestamp(meta.SigningDate()),
Expires: Timestamp(meta.Expiry()), Expires: Timestamp(meta.Expiry()),
Type: credtype, Attributes: attrs,
Issuer: store.Issuers[issid], Logo: path,
SchemeManager: store.SchemeManagers[issid.SchemeManagerIdentifier()], Hash: NewAttributeListFromInts(ints, store).hash(),
Attributes: attrs,
Logo: path,
Hash: NewAttributeListFromInts(ints, store).hash(),
} }
} }
......
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