Documentation ¶
Index ¶
- Constants
- func Hash(buf []byte) *[HashSize]byte
- func HashLeaf(buf []byte) *[HashSize]byte
- type ConsistencyProof
- type ConsistencyProofRequest
- type CosignatureRequest
- type Endpoint
- type InclusionProof
- type InclusionProofRequest
- type Leaf
- type LeafList
- type LeafRequest
- type LeavesRequest
- type Message
- type MessageASCII
- func (msg *MessageASCII) GetHash(key string) (*[HashSize]byte, error)
- func (msg *MessageASCII) GetSignature(key string) (*[SignatureSize]byte, error)
- func (msg *MessageASCII) GetString(key string) (string, error)
- func (msg *MessageASCII) GetStrings(key string) []string
- func (msg *MessageASCII) GetUint64(key string) (uint64, error)
- func (msg *MessageASCII) GetVerificationKey(key string) (*[VerificationKeySize]byte, error)
- func (msg *MessageASCII) NumField() int
- type SigIdent
- type SignedTreeHead
- type TreeHead
Constants ¶
const ( // Delim is a key-value separator Delim = "=" // EOL is a line sepator EOL = "\n" // NumField* is the number of unique keys in an incoming ASCII message NumFieldLeaf = 4 NumFieldSignedTreeHead = 5 NumFieldConsistencyProof = 3 NumFieldInclusionProof = 3 NumFieldLeavesRequest = 2 NumFieldInclusionProofRequest = 2 NumFieldConsistencyProofRequest = 2 NumFieldLeafRequest = 5 NumFieldCosignatureRequest = 2 // New leaf keys ShardHint = "shard_hint" Checksum = "checksum" SignatureOverMessage = "signature_over_message" VerificationKey = "verification_key" DomainHint = "domain_hint" // Inclusion proof keys LeafHash = "leaf_hash" LeafIndex = "leaf_index" InclusionPath = "inclusion_path" // Consistency proof keys NewSize = "new_size" OldSize = "old_size" ConsistencyPath = "consistency_path" // Range of leaves keys StartSize = "start_size" EndSize = "end_size" // Tree head keys Timestamp = "timestamp" TreeSize = "tree_size" RootHash = "root_hash" // Signature and signer-identity keys Signature = "signature" KeyHash = "key_hash" )
const ( // MessageSize is the number of bytes in a Trunnel-encoded leaf message MessageSize = 8 + HashSize // LeafSize is the number of bytes in a Trunnel-encoded leaf LeafSize = MessageSize + SignatureSize + HashSize )
const ( HashSize = sha256.Size SignatureSize = ed25519.SignatureSize VerificationKeySize = ed25519.PublicKeySize EndpointAddLeaf = Endpoint("add-leaf") EndpointAddCosignature = Endpoint("add-cosignature") EndpointGetTreeHeadLatest = Endpoint("get-tree-head-latest") EndpointGetTreeHeadToSign = Endpoint("get-tree-head-to-sign") EndpointGetTreeHeadCosigned = Endpoint("get-tree-head-cosigned") EndpointGetProofByHash = Endpoint("get-proof-by-hash") EndpointGetConsistencyProof = Endpoint("get-consistency-proof") EndpointGetLeaves = Endpoint("get-leaves") )
const (
LeafHashPrefix = 0x00
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConsistencyProof ¶
ConsistencyProof is a consistency proof that proves the log's append-only property.
func (*ConsistencyProof) MarshalASCII ¶
func (p *ConsistencyProof) MarshalASCII(w io.Writer) error
func (*ConsistencyProof) UnmarshalASCII ¶
func (p *ConsistencyProof) UnmarshalASCII(r io.Reader) error
func (*ConsistencyProof) Verify ¶
func (p *ConsistencyProof) Verify(oldTH, newTH *TreeHead) error
Verify checks if two tree heads are consistent
type ConsistencyProofRequest ¶
ConsistencyProofRequest is a get-consistency-proof request
func (*ConsistencyProofRequest) UnmarshalASCII ¶
func (req *ConsistencyProofRequest) UnmarshalASCII(r io.Reader) error
type CosignatureRequest ¶
type CosignatureRequest struct {
SigIdent
}
CosignatureRequest is an add-cosignature request
func (*CosignatureRequest) UnmarshalASCII ¶
func (req *CosignatureRequest) UnmarshalASCII(r io.Reader) error
type InclusionProof ¶
InclusionProof is an inclusion proof that proves a leaf is included in the log.
func (*InclusionProof) MarshalASCII ¶
func (p *InclusionProof) MarshalASCII(w io.Writer) error
func (*InclusionProof) UnmarshalASCII ¶
func (p *InclusionProof) UnmarshalASCII(r io.Reader) error
type InclusionProofRequest ¶
InclusionProofRequest is a get-proof-by-hash request
func (*InclusionProofRequest) UnmarshalASCII ¶
func (req *InclusionProofRequest) UnmarshalASCII(r io.Reader) error
type Leaf ¶
Leaf is the log's Merkle tree leaf.
func (*Leaf) MarshalASCII ¶
* * MarshalASCII wrappers for types that the log server outputs *
type LeafRequest ¶
type LeafRequest struct { Message Signature *[SignatureSize]byte VerificationKey *[VerificationKeySize]byte DomainHint string }
LeafRequest is an add-leaf request
func (*LeafRequest) UnmarshalASCII ¶
func (req *LeafRequest) UnmarshalASCII(r io.Reader) error
type LeavesRequest ¶
LeavesRequest is a get-leaves request
func (*LeavesRequest) UnmarshalASCII ¶
func (req *LeavesRequest) UnmarshalASCII(r io.Reader) error
type Message ¶
Message is composed of a shard hint and a checksum. The submitter selects these values to fit the log's shard interval and the opaque data in question.
type MessageASCII ¶
type MessageASCII struct {
// contains filtered or unexported fields
}
MessageASCI is a wrapper that manages ASCII key-value pairs
func NewMessageASCII ¶
func NewMessageASCII(r io.Reader, numFieldExpected int) (*MessageASCII, error)
NewMessageASCII unpacks an incoming ASCII message
func (*MessageASCII) GetHash ¶
func (msg *MessageASCII) GetHash(key string) (*[HashSize]byte, error)
GetHash unpacks a hash
func (*MessageASCII) GetSignature ¶
func (msg *MessageASCII) GetSignature(key string) (*[SignatureSize]byte, error)
GetSignature unpacks a signature
func (*MessageASCII) GetString ¶
func (msg *MessageASCII) GetString(key string) (string, error)
GetString unpacks a string
func (*MessageASCII) GetStrings ¶
func (msg *MessageASCII) GetStrings(key string) []string
GetStrings returns a list of strings
func (*MessageASCII) GetUint64 ¶
func (msg *MessageASCII) GetUint64(key string) (uint64, error)
GetUint64 unpacks an uint64
func (*MessageASCII) GetVerificationKey ¶
func (msg *MessageASCII) GetVerificationKey(key string) (*[VerificationKeySize]byte, error)
GetVerificationKey unpacks a verification key
func (*MessageASCII) NumField ¶
func (msg *MessageASCII) NumField() int
NumField returns the number of unique keys
type SigIdent ¶
type SigIdent struct { Signature *[SignatureSize]byte KeyHash *[HashSize]byte }
SigIdent is composed of a signature-signer pair. The signature is computed over the Trunnel-serialized leaf message. KeyHash identifies the signer.
type SignedTreeHead ¶
SignedTreeHead is composed of a tree head and a list of signature-signer pairs. Each signature is computed over the Trunnel-serialized tree head.
func (*SignedTreeHead) MarshalASCII ¶
func (sth *SignedTreeHead) MarshalASCII(w io.Writer) error
func (*SignedTreeHead) UnmarshalASCII ¶
func (sth *SignedTreeHead) UnmarshalASCII(r io.Reader) error
type TreeHead ¶
TreeHead is the log's tree head.
func (*TreeHead) Sign ¶
func (th *TreeHead) Sign(signer crypto.Signer) (*SignedTreeHead, error)
Sign signs the tree head using the log's signature scheme
func (*TreeHead) Verify ¶
func (th *TreeHead) Verify(vk *[VerificationKeySize]byte, sig *[SignatureSize]byte) error
Verify verifies the tree head signature using the log's signature scheme