aboutsummaryrefslogtreecommitdiff
path: root/util.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus.dahlberg@kau.se>2021-06-07 00:19:40 +0200
committerRasmus Dahlberg <rasmus.dahlberg@kau.se>2021-06-07 00:19:40 +0200
commit932d29fd08c8ff401e471b4f764537493ccbd483 (patch)
treee840a4c62db92e84201fe9ceaa0594d99176792c /util.go
parentbdf7a53d61cf044e526cc9123ca296615f838288 (diff)
parent345fe658fa8a4306caa74f72a618e499343675c2 (diff)
Merge branch 'design' into main
Diffstat (limited to 'util.go')
-rw-r--r--util.go40
1 files changed, 0 insertions, 40 deletions
diff --git a/util.go b/util.go
deleted file mode 100644
index 847c3f7..0000000
--- a/util.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package stfe
-
-import (
- "fmt"
-
- "github.com/google/trillian"
- ttypes "github.com/google/trillian/types"
- "github.com/system-transparency/stfe/types"
-)
-
-func NewTreeHeadV1FromLogRoot(lr *ttypes.LogRootV1) *types.TreeHeadV1 {
- return &types.TreeHeadV1{
- Timestamp: uint64(lr.TimestampNanos / 1000 / 1000),
- TreeSize: uint64(lr.TreeSize),
- RootHash: types.NodeHash{
- Data: lr.RootHash,
- },
- Extension: make([]byte, 0),
- }
-}
-
-func NewNodePathFromHashPath(hashes [][]byte) []types.NodeHash {
- path := make([]types.NodeHash, 0, len(hashes))
- for _, hash := range hashes {
- path = append(path, types.NodeHash{hash})
- }
- return path
-}
-
-func NewStItemListFromLeaves(leaves []*trillian.LogLeaf) (*types.StItemList, error) {
- items := make([]types.StItem, 0, len(leaves))
- for _, leaf := range leaves {
- var item types.StItem
- if err := types.Unmarshal(leaf.LeafValue, &item); err != nil {
- return nil, fmt.Errorf("Unmarshal failed: %v", err)
- }
- items = append(items, item)
- }
- return &types.StItemList{items}, nil
-}