diff options
author | Rasmus Dahlberg <rasmus@mullvad.net> | 2022-04-25 00:43:06 +0200 |
---|---|---|
committer | Rasmus Dahlberg <rasmus@mullvad.net> | 2022-04-25 00:43:06 +0200 |
commit | 528a53f7f76f08af5902f4cfa8235380b3434ba0 (patch) | |
tree | 662b7834d5ce15627554e9307a4e00f7364fba11 /pkg/types/proof.go | |
parent | 4fc0ff2ec2f48519ee245d6d7edee1921cb3b8bc (diff) |
drafty types refactor with simple ascii packagergdd/sketch
types.go compiles but that is about it, here be dragons. Pushing so
that we can get an idea of what this refactor would roughly look like.
Diffstat (limited to 'pkg/types/proof.go')
-rw-r--r-- | pkg/types/proof.go | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/pkg/types/proof.go b/pkg/types/proof.go deleted file mode 100644 index 8c1474e..0000000 --- a/pkg/types/proof.go +++ /dev/null @@ -1,46 +0,0 @@ -package types - -import ( - "io" - - "git.sigsum.org/sigsum-go/pkg/ascii" -) - -type InclusionProof struct { - TreeSize uint64 - LeafIndex uint64 `ascii:"leaf_index"` - Path []Hash `ascii:"inclusion_path"` -} - -type ConsistencyProof struct { - NewSize uint64 - OldSize uint64 - Path []Hash `ascii:"consistency_path"` -} - -func (p *InclusionProof) ToASCII(w io.Writer) error { - return ascii.StdEncoding.Serialize(w, p) -} - -func (p *InclusionProof) FromASCII(r io.Reader, treeSize uint64) error { - p.TreeSize = treeSize - return ascii.StdEncoding.Deserialize(r, p) -} - -func (p *InclusionProof) Verify(treeSize uint64) bool { - return false // TODO: verify inclusion proof -} - -func (p *ConsistencyProof) ToASCII(w io.Writer) error { - return ascii.StdEncoding.Serialize(w, p) -} - -func (p *ConsistencyProof) FromASCII(r io.Reader, oldSize, newSize uint64) error { - p.OldSize = oldSize - p.NewSize = newSize - return ascii.StdEncoding.Deserialize(r, p) -} - -func (p *ConsistencyProof) Verify(newRoot, oldRoot *Hash) bool { - return false // TODO: verify consistency proof -} |