aboutsummaryrefslogtreecommitdiff
path: root/types/serialize.go
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2021-05-25 11:29:29 +0200
committerLinus Nordberg <linus@nordberg.se>2021-05-25 11:29:29 +0200
commitf9aae584c787950e84cf3b098290a0c73330d8ac (patch)
treed3a018493954529794de3c21c9f4f6b0c846a925 /types/serialize.go
parent533f683ef1ae999c2fdc0086cbc3de4e675d1e33 (diff)
parent6a20aec8e8a93ce11f8b940659f49c889f94aef1 (diff)
Merge branch 'design' of github.com:system-transparency/stfe into design
Diffstat (limited to 'types/serialize.go')
-rw-r--r--types/serialize.go50
1 files changed, 0 insertions, 50 deletions
diff --git a/types/serialize.go b/types/serialize.go
deleted file mode 100644
index fd93336..0000000
--- a/types/serialize.go
+++ /dev/null
@@ -1,50 +0,0 @@
-package types
-
-import (
- "fmt"
-
- "github.com/google/certificate-transparency-go/tls"
-)
-
-const (
- HashSizeV1 = 32
-)
-
-// GetProofByHashV1 is a serializable get-proof-by-hash request
-type GetProofByHashV1 struct {
- Hash [HashSizeV1]byte
- TreeSize uint64
-}
-
-// GetConsistencyProofV1 is a serializable get-consistency-proof request
-type GetConsistencyProofV1 struct {
- First uint64
- Second uint64
-}
-
-// GetEntriesV1 is a serializable get-entries request
-type GetEntriesV1 struct {
- Start uint64
- End uint64
-}
-
-// Marshal marshals a TLS-encodable structure
-func Marshal(item interface{}) ([]byte, error) {
- serialized, err := tls.Marshal(item)
- if err != nil {
- return nil, fmt.Errorf("tls.Marshal: %v", err)
- }
- return serialized, nil
-}
-
-// Unmarshal unmarshals a TLS-encoded structure
-func Unmarshal(serialized []byte, out interface{}) error {
- extra, err := tls.Unmarshal(serialized, out)
- if err != nil {
- return fmt.Errorf("tls.Unmarshal: %v", err)
- }
- if len(extra) > 0 {
- return fmt.Errorf("tls.Unmarshal: extra data: %X", extra)
- }
- return nil
-}