credential.go 541 Bytes
Newer Older
1
2
3
4
package irmago

import "github.com/mhe/gabi"

Sietse Ringers's avatar
Sietse Ringers committed
5
// credential represents an IRMA credential, whose zeroth attribute
6
// is always the secret key and the first attribute the metadata attribute.
Sietse Ringers's avatar
Sietse Ringers committed
7
type credential struct {
8
9
10
11
	*gabi.Credential
	*MetadataAttribute
}

Sietse Ringers's avatar
Sietse Ringers committed
12
13
func newCredential(gabicred *gabi.Credential) (cred *credential) {
	cred = &credential{}
14
15
	cred.Credential = gabicred
	cred.MetadataAttribute = MetadataFromInt(gabicred.Attributes[1])
16
	cred.Pk = MetaStore.PublicKey(cred.CredentialType().IssuerIdentifier(), cred.KeyCounter())
17
18
	return
}