aboutsummaryrefslogtreecommitdiff
path: root/server/store/store.go
diff options
context:
space:
mode:
Diffstat (limited to 'server/store/store.go')
-rw-r--r--server/store/store.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/server/store/store.go b/server/store/store.go
index cf69225..f14e79f 100644
--- a/server/store/store.go
+++ b/server/store/store.go
@@ -1,6 +1,7 @@
package store
import (
+ "encoding/json"
"time"
"golang.org/x/crypto/ssh"
@@ -43,6 +44,20 @@ type CertRecord struct {
Raw string `json:"-" db:"raw_key"`
}
+func (c *CertRecord) MarshalJSON() ([]byte, error) {
+ type Alias CertRecord
+ f := "2006-01-02 15:04:05 -0700"
+ return json.Marshal(&struct {
+ *Alias
+ CreatedAt string `json:"created_at"`
+ Expires string `json:"expires"`
+ }{
+ Alias: (*Alias)(c),
+ CreatedAt: c.CreatedAt.Format(f),
+ Expires: c.Expires.Format(f),
+ })
+}
+
func parseTime(t uint64) time.Time {
return time.Unix(int64(t), 0)
}