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 { ...@@ -49,6 +49,7 @@ type Issuer struct {
SchemeManagerID string `xml:"SchemeManager"` SchemeManagerID string `xml:"SchemeManager"`
ContactAddress string ContactAddress string
ContactEMail string ContactEMail string
DeprecatedSince Timestamp
XMLVersion int `xml:"version,attr"` XMLVersion int `xml:"version,attr"`
Valid bool `xml:"-"` Valid bool `xml:"-"`
...@@ -68,6 +69,7 @@ type CredentialType struct { ...@@ -68,6 +69,7 @@ type CredentialType struct {
XMLVersion int `xml:"version,attr"` XMLVersion int `xml:"version,attr"`
XMLName xml.Name `xml:"IssueSpecification"` XMLName xml.Name `xml:"IssueSpecification"`
IssueURL TranslatedString `xml:"IssueURL"` IssueURL TranslatedString `xml:"IssueURL"`
DeprecatedSince Timestamp
Valid bool `xml:"-"` Valid bool `xml:"-"`
} }
......
...@@ -2,6 +2,7 @@ package irma ...@@ -2,6 +2,7 @@ package irma
import ( import (
"encoding/json" "encoding/json"
"encoding/xml"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"strconv" "strconv"
...@@ -652,6 +653,19 @@ func (t Timestamp) After(u Timestamp) bool { ...@@ -652,6 +653,19 @@ func (t Timestamp) After(u Timestamp) bool {
return time.Time(t).After(time.Time(u)) 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. // MarshalJSON marshals a timestamp.
func (t *Timestamp) MarshalJSON() ([]byte, error) { func (t *Timestamp) MarshalJSON() ([]byte, error) {
return []byte(t.String()), nil return []byte(t.String()), nil
......
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