aboutsummaryrefslogtreecommitdiff
path: root/pkg/requests/requests.go
blob: 26a5213f3675a13913265306e6d3c68b334ac9da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package requests

import (
	"io"

	"git.sigsum.org/sigsum-lib-go/pkg/ascii"
	"git.sigsum.org/sigsum-lib-go/pkg/types"
)

type Leaf struct {
	types.Statement
	Signature       types.Signature `ascii:"signature"`
	VerificationKey types.PublicKey `ascii:"verification_key"`
	DomainHint      string          `ascii:"domain_hint"`
}

type Leaves struct {
	StartSize uint64 `ascii:"start_size"`
	EndSize   uint64 `ascii:"end_size"`
}

type InclusionProof struct {
	LeafHash types.Hash `ascii:"leaf_hash"`
	TreeSize uint64     `ascii:"tree_size"`
}

type ConsistencyProof struct {
	NewSize uint64 `ascii:"new_size"`
	OldSize uint64 `ascii:"old_size"`
}

type Cosignature struct {
	Cosignature types.Signature `ascii:"cosignature"`
	KeyHash     types.Hash      `ascii:"key_hash"`
}

func (req *Leaf) ToASCII(w io.Writer) error {
	return ascii.StdEncoding.Serialize(w, req)
}

func (req *Leaves) ToASCII(w io.Writer) error {
	return ascii.StdEncoding.Serialize(w, req)
}

func (req *InclusionProof) ToASCII(w io.Writer) error {
	return ascii.StdEncoding.Serialize(w, req)
}

func (req *ConsistencyProof) ToASCII(w io.Writer) error {
	return ascii.StdEncoding.Serialize(w, req)
}

func (req *Cosignature) ToASCII(w io.Writer) error {
	return ascii.StdEncoding.Serialize(w, req)
}

func (req *Leaf) FromASCII(r io.Reader) error {
	return ascii.StdEncoding.Deserialize(r, req)
}

func (req *Leaves) FromASCII(r io.Reader) error {
	return ascii.StdEncoding.Deserialize(r, req)
}

func (req *InclusionProof) FromASCII(r io.Reader) error {
	return ascii.StdEncoding.Deserialize(r, req)
}

func (req *ConsistencyProof) FromASCII(r io.Reader) error {
	return ascii.StdEncoding.Deserialize(r, req)
}

func (req *Cosignature) FromASCII(r io.Reader) error {
	return ascii.StdEncoding.Deserialize(r, req)
}