aboutsummaryrefslogtreecommitdiff
path: root/type.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-10-30 10:51:32 +0100
committerRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-10-30 10:51:32 +0100
commit43c8e9b1e44255ecc3d8a0077dc285739cfbb79d (patch)
treee0e7d93f8a9c5a0353a610ee3a4c56dc3826e1f0 /type.go
parentcf16cc04f72f477cdc7a99f17b00314a2f2fe922 (diff)
updated json output according to api doc
Diffstat (limited to 'type.go')
-rw-r--r--type.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/type.go b/type.go
index 7d505c7..060ce30 100644
--- a/type.go
+++ b/type.go
@@ -262,6 +262,14 @@ func StItemFromB64(s string) (StItem, error) {
return item, nil
}
+func StItemToB64(i StItem) (string, error) {
+ b, err := tls.Marshal(i)
+ if err != nil {
+ return "", fmt.Errorf("StItem(%v) tls marshal failed: %v", i.Format, err)
+ }
+ return base64.StdEncoding.EncodeToString(b), nil
+}
+
// Appendix is extra data that Trillian can store about a leaf
type Appendix struct {
Signature []byte `tls:"minlen:0,maxlen:16383"`