Commit 04112b93 authored by Sietse Ringers's avatar Sietse Ringers Committed by Sietse Ringers
Browse files

feat: add deprecation tags to credential types and issuers

parent b7b4715c
......@@ -49,6 +49,7 @@ type Issuer struct {
SchemeManagerID string `xml:"SchemeManager"`
ContactAddress string
ContactEMail string
DeprecatedSince Timestamp
XMLVersion int `xml:"version,attr"`
Valid bool `xml:"-"`
......@@ -68,6 +69,7 @@ type CredentialType struct {
XMLVersion int `xml:"version,attr"`
XMLName xml.Name `xml:"IssueSpecification"`
IssueURL TranslatedString `xml:"IssueURL"`
DeprecatedSince Timestamp
Valid bool `xml:"-"`
}
......
......@@ -2,6 +2,7 @@ package irma
import (
"encoding/json"
"encoding/xml"
"fmt"
"io/ioutil"
"strconv"
......@@ -652,6 +653,19 @@ func (t Timestamp) After(u Timestamp) bool {
return time.Time(t).After(time.Time(u))
}
func (t *Timestamp) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
return e.EncodeElement(t.String(), start)
}
func (t *Timestamp) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
var ts int64
if err := d.DecodeElement(&ts, &start); err != nil {
return err
}
*t = Timestamp(time.Unix(ts, 0))
return nil
}
// MarshalJSON marshals a timestamp.
func (t *Timestamp) MarshalJSON() ([]byte, error) {
return []byte(t.String()), nil
......
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