Add TimestampTime() to ct.SignedTreeHead

This commit is contained in:
Andrew Ayer 2023-02-05 21:07:14 -05:00
parent 9b29ca93b8
commit fe4ef6b05d
1 changed files with 5 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import (
"encoding/base64"
"encoding/json"
"fmt"
"time"
)
const (
@ -289,6 +290,10 @@ type SignedTreeHead struct {
LogID SHA256Hash `json:"log_id"` // The SHA256 hash of the log's public key
}
func (sth *SignedTreeHead) TimestampTime() time.Time {
return time.Unix(int64(sth.Timestamp/1000), int64(sth.Timestamp%1000)*1_000_000).UTC()
}
// SignedCertificateTimestamp represents the structure returned by the
// add-chain and add-pre-chain methods after base64 decoding. (see RFC sections
// 3.2 ,4.1 and 4.2)