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