Commit f4122790 authored by Sietse Ringers's avatar Sietse Ringers
Browse files

More consistency with CredentialTypeID name

parent 235c5e6b
...@@ -20,7 +20,7 @@ type credential struct { ...@@ -20,7 +20,7 @@ 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" CredentialTypeID string // e.g., "irma-demo.RU.studentCard"
Name string // e.g., "studentCard" Name string // e.g., "studentCard"
IssuerID string // e.g., "RU" IssuerID string // e.g., "RU"
SchemeManagerID string // e.g., "irma-demo" SchemeManagerID string // e.g., "irma-demo"
...@@ -55,7 +55,7 @@ func NewCredentialInfo(ints []*big.Int, store *ConfigurationStore) *CredentialIn ...@@ -55,7 +55,7 @@ func NewCredentialInfo(ints []*big.Int, store *ConfigurationStore) *CredentialIn
} }
return &CredentialInfo{ return &CredentialInfo{
ID: credtype.Identifier().String(), CredentialTypeID: credtype.Identifier().String(),
SignedOn: Timestamp(meta.SigningDate()), SignedOn: Timestamp(meta.SigningDate()),
Expires: Timestamp(meta.Expiry()), Expires: Timestamp(meta.Expiry()),
Attributes: attrs, Attributes: attrs,
......
...@@ -260,7 +260,7 @@ func (cm *CredentialManager) RemoveAllCredentials() error { ...@@ -260,7 +260,7 @@ func (cm *CredentialManager) RemoveAllCredentials() error {
removed := map[CredentialTypeIdentifier][]TranslatedString{} removed := map[CredentialTypeIdentifier][]TranslatedString{}
list := cm.CredentialInfoList() list := cm.CredentialInfoList()
for _, cred := range list { for _, cred := range list {
id := NewCredentialTypeIdentifier(cred.ID) id := NewCredentialTypeIdentifier(cred.CredentialTypeID)
removed[id] = cred.Attributes removed[id] = cred.Attributes
if err := cm.remove(id, cred.Index, false); err != nil { if err := cm.remove(id, cred.Index, false); err != nil {
return err return err
...@@ -488,7 +488,7 @@ func (cm *CredentialManager) IssuanceProofBuilders(request *IssuanceRequest) (ga ...@@ -488,7 +488,7 @@ func (cm *CredentialManager) IssuanceProofBuilders(request *IssuanceRequest) (ga
proofBuilders := gabi.ProofBuilderList([]gabi.ProofBuilder{}) proofBuilders := gabi.ProofBuilderList([]gabi.ProofBuilder{})
for _, futurecred := range request.Credentials { for _, futurecred := range request.Credentials {
var pk *gabi.PublicKey var pk *gabi.PublicKey
pk, err = cm.ConfigurationStore.PublicKey(futurecred.Credential.IssuerIdentifier(), futurecred.KeyCounter) pk, err = cm.ConfigurationStore.PublicKey(futurecred.CredentialTypeID.IssuerIdentifier(), futurecred.KeyCounter)
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
...@@ -58,7 +58,7 @@ type IssuanceRequest struct { ...@@ -58,7 +58,7 @@ type IssuanceRequest struct {
type CredentialRequest struct { type CredentialRequest struct {
Validity *Timestamp `json:"validity"` Validity *Timestamp `json:"validity"`
KeyCounter int `json:"keyCounter"` KeyCounter int `json:"keyCounter"`
Credential *CredentialTypeIdentifier `json:"credential"` CredentialTypeID *CredentialTypeIdentifier `json:"credential"`
Attributes map[string]string `json:"attributes"` Attributes map[string]string `json:"attributes"`
} }
...@@ -114,7 +114,7 @@ type issuanceState struct { ...@@ -114,7 +114,7 @@ type issuanceState struct {
func (cr *CredentialRequest) AttributeList(store *ConfigurationStore) (*AttributeList, error) { func (cr *CredentialRequest) AttributeList(store *ConfigurationStore) (*AttributeList, error) {
meta := NewMetadataAttribute() meta := NewMetadataAttribute()
meta.setKeyCounter(cr.KeyCounter) meta.setKeyCounter(cr.KeyCounter)
meta.setCredentialTypeIdentifier(cr.Credential.String()) meta.setCredentialTypeIdentifier(cr.CredentialTypeID.String())
meta.setSigningDate() meta.setSigningDate()
err := meta.setExpiryDate(cr.Validity) err := meta.setExpiryDate(cr.Validity)
if err != nil { if err != nil {
...@@ -122,7 +122,7 @@ func (cr *CredentialRequest) AttributeList(store *ConfigurationStore) (*Attribut ...@@ -122,7 +122,7 @@ func (cr *CredentialRequest) AttributeList(store *ConfigurationStore) (*Attribut
} }
attrs := make([]*big.Int, len(cr.Attributes)+1, len(cr.Attributes)+1) attrs := make([]*big.Int, len(cr.Attributes)+1, len(cr.Attributes)+1)
credtype := store.CredentialTypes[*cr.Credential] credtype := store.CredentialTypes[*cr.CredentialTypeID]
if credtype == nil { if credtype == nil {
return nil, errors.New("Unknown credential type") return nil, errors.New("Unknown credential type")
} }
...@@ -167,7 +167,7 @@ func (ir *IssuanceRequest) Distributed(store *ConfigurationStore) bool { ...@@ -167,7 +167,7 @@ func (ir *IssuanceRequest) Distributed(store *ConfigurationStore) bool {
func (ir *IssuanceRequest) SchemeManagers() []SchemeManagerIdentifier { func (ir *IssuanceRequest) SchemeManagers() []SchemeManagerIdentifier {
list := []SchemeManagerIdentifier{} list := []SchemeManagerIdentifier{}
for _, cred := range ir.Credentials { for _, cred := range ir.Credentials {
list = append(list, cred.Credential.IssuerIdentifier().SchemeManagerIdentifier()) list = append(list, cred.CredentialTypeID.IssuerIdentifier().SchemeManagerIdentifier())
} }
for _, disjunctions := range ir.Disclose { for _, disjunctions := range ir.Disclose {
for _, attr := range disjunctions.Attributes { for _, attr := range disjunctions.Attributes {
......
...@@ -159,7 +159,7 @@ func (session *session) start() { ...@@ -159,7 +159,7 @@ func (session *session) start() {
if session.Action == ActionIssuing { if session.Action == ActionIssuing {
// Store which public keys the server will use // Store which public keys the server will use
for _, credreq := range session.irmaSession.(*IssuanceRequest).Credentials { for _, credreq := range session.irmaSession.(*IssuanceRequest).Credentials {
credreq.KeyCounter = session.info.Keys[credreq.Credential.IssuerIdentifier()] credreq.KeyCounter = session.info.Keys[credreq.CredentialTypeID.IssuerIdentifier()]
} }
} }
......
...@@ -95,7 +95,7 @@ func getIssuanceJwt(name string, id AttributeTypeIdentifier) interface{} { ...@@ -95,7 +95,7 @@ func getIssuanceJwt(name string, id AttributeTypeIdentifier) interface{} {
Credentials: []*CredentialRequest{ Credentials: []*CredentialRequest{
{ {
Validity: &expiry, Validity: &expiry,
Credential: &credid1, CredentialTypeID: &credid1,
Attributes: map[string]string{ Attributes: map[string]string{
"university": "Radboud", "university": "Radboud",
"studentCardNumber": "3.14159265358979323846264338328", "studentCardNumber": "3.14159265358979323846264338328",
...@@ -104,7 +104,7 @@ func getIssuanceJwt(name string, id AttributeTypeIdentifier) interface{} { ...@@ -104,7 +104,7 @@ func getIssuanceJwt(name string, id AttributeTypeIdentifier) interface{} {
}, },
}, { }, {
Validity: &expiry, Validity: &expiry,
Credential: &credid2, CredentialTypeID: &credid2,
Attributes: map[string]string{ Attributes: map[string]string{
"BSN": "299792458", "BSN": "299792458",
}, },
...@@ -212,7 +212,7 @@ func TestKeyshareRegistrationAndSessions(t *testing.T) { ...@@ -212,7 +212,7 @@ func TestKeyshareRegistrationAndSessions(t *testing.T) {
jwt.(*IdentityProviderJwt).Request.Request.Credentials, jwt.(*IdentityProviderJwt).Request.Request.Credentials,
&CredentialRequest{ &CredentialRequest{
Validity: &expiry, Validity: &expiry,
Credential: &credid, CredentialTypeID: &credid,
Attributes: map[string]string{"email": "example@example.com"}, Attributes: map[string]string{"email": "example@example.com"},
}, },
) )
...@@ -255,7 +255,7 @@ func TestKeyshareSessions(t *testing.T) { ...@@ -255,7 +255,7 @@ func TestKeyshareSessions(t *testing.T) {
jwt.(*IdentityProviderJwt).Request.Request.Credentials, jwt.(*IdentityProviderJwt).Request.Request.Credentials,
&CredentialRequest{ &CredentialRequest{
Validity: &expiry, Validity: &expiry,
Credential: &credid, CredentialTypeID: &credid,
Attributes: map[string]string{"email": "example@example.com"}, Attributes: map[string]string{"email": "example@example.com"},
}, },
) )
......
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