Documentation ¶
Index ¶
- Variables
- func CreateAndInitTree(ctx context.Context, adminClient trillian.TrillianAdminClient, ...) (*trillian.Tree, error)
- func CreateAndSignCheckpoint(cfg *config.CMConfig, ctx context.Context, hostname string, treeID int64, ...) ([]byte, error)
- func CreateEntry(redis radix.Client, ctx context.Context, api *API, cfg *config.CMConfig, ...) (cclient.Entry, error)
- func GetEntryByIndex(ctx context.Context, api *API, cfg *config.CMConfig, logIndex int64) (cclient.Entry, error)
- func GetEntryByRecord(ctx context.Context, api *API, cfg *config.CMConfig, entryID string) (cclient.Entry, error)
- func GetLatestCheckpoint(tc TrillianClient, tl trillian.TrillianLogClient, treeID int64, ...) (*tlog.Checkpoint, error)
- type API
- type Checkpoint
- type Response
- type SignedCheckpoint
- type SignedNote
- type Signer
- type TrillianClient
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("grpc returned 0 leaves with success code")
Trillian ERRORS
Functions ¶
func CreateAndInitTree ¶
func CreateAndInitTree(ctx context.Context, adminClient trillian.TrillianAdminClient, logClient trillian.TrillianLogClient) (*trillian.Tree, error)
func CreateAndSignCheckpoint ¶
func CreateAndSignCheckpoint(cfg *config.CMConfig, ctx context.Context, hostname string, treeID int64, root *types.LogRootV1) ([]byte, error)
Create and sign checkpoint
func CreateEntry ¶
func CreateEntry(redis radix.Client, ctx context.Context, api *API, cfg *config.CMConfig, report signature.Report, signedReport signature.SignerBlob, saveToIPFS bool) (cclient.Entry, error)
Create Entries
func GetEntryByIndex ¶
func GetEntryByIndex(ctx context.Context, api *API, cfg *config.CMConfig, logIndex int64) (cclient.Entry, error)
Get entry by index
func GetEntryByRecord ¶
func GetEntryByRecord(ctx context.Context, api *API, cfg *config.CMConfig, entryID string) (cclient.Entry, error)
Get trillian log entry by record id
func GetLatestCheckpoint ¶
func GetLatestCheckpoint(tc TrillianClient, tl trillian.TrillianLogClient, treeID int64, ctx context.Context) (*tlog.Checkpoint, error)
Get latest checkpoint
Types ¶
type Checkpoint ¶
type Checkpoint struct { // Origin is the unique identifier/version string Origin string // Size is the number of entries in the log at this checkpoint. Size uint64 // Hash is the hash which commits to the contents of the entire log. Hash []byte // OtherContent is any additional data to be included in the signed payload; each element is assumed to be one line OtherContent []string }
func (Checkpoint) MarshalCheckpoint ¶
func (c Checkpoint) MarshalCheckpoint() ([]byte, error)
MarshalText returns the common format representation of this Checkpoint.
func (Checkpoint) String ¶
func (c Checkpoint) String() string
String returns the String representation of the Checkpoint
func (*Checkpoint) UnmarshalCheckpoint ¶
func (c *Checkpoint) UnmarshalCheckpoint(data []byte) error
UnmarshalText parses the common formatted checkpoint data and stores the result in the Checkpoint.
The supplied data is expected to begin with the following 3 lines of text, each followed by a newline: <ecosystem/version string> <decimal representation of log size> <base64 representation of root hash> <optional non-empty line of other content>... <optional non-empty line of other content>...
This will discard any content found after the checkpoint (including signatures)
type Response ¶
type Response struct { Status codes.Code `json:"status"` Err error `json:"err"` GetAddResult *trillian.QueueLeafResponse `json:"getAddResult"` GetProofResult *trillian.GetInclusionProofByHashResponse `json:"getProofResult"` GetLeafAndProofResult *trillian.GetEntryAndProofResponse `json:"getLeafAndProofResult"` GetLatestResult *trillian.GetLatestSignedLogRootResponse `json:"getLatestResult"` GetConsistencyProofResult *trillian.GetConsistencyProofResponse `json:"getConsistencyProofResult"` }
type SignedCheckpoint ¶
type SignedCheckpoint struct { Checkpoint SignedNote }
func CreateSignedCheckpoint ¶
func CreateSignedCheckpoint(c Checkpoint) (*SignedCheckpoint, error)
Create signed checkpoint
func (*SignedCheckpoint) GetTimestamp ¶
func (r *SignedCheckpoint) GetTimestamp() uint64
func (*SignedCheckpoint) SetTimestamp ¶
func (r *SignedCheckpoint) SetTimestamp(timestamp uint64)
func (*SignedCheckpoint) UnmarshalText ¶
func (r *SignedCheckpoint) UnmarshalText(data []byte) error
type SignedNote ¶
type SignedNote struct { // Textual representation of a note to sign. Note string // Signatures are one or more signature lines covering the payload Signatures []note.Signature }
func (SignedNote) MarshalText ¶
func (s SignedNote) MarshalText() ([]byte, error)
MarshalText returns the common format representation of this SignedNote.
func (*SignedNote) Sign ¶
Sign adds a signature to a SignedCheckpoint object The signature is added to the signature array as well as being directly returned to the caller
func (SignedNote) String ¶
func (s SignedNote) String() string
String returns the String representation of the SignedNote
func (*SignedNote) UnmarshalText ¶
func (s *SignedNote) UnmarshalText(data []byte) error
UnmarshalText parses the common formatted signed note data and stores the result in the SignedNote. THIS DOES NOT VERIFY SIGNATURES INSIDE THE CONTENT!
The supplied data is expected to contain a single Note, followed by a single line with no comment, followed by one or more lines with the following format:
\u2014 name signature
- name is the string associated with the signer
- signature is a base64 encoded string; the first 4 bytes of the decoded value is a hint to the public key; it is a big-endian encoded uint32 representing the first 4 bytes of the sha512 hash of the public key
type Signer ¶
type Signer struct { // Signer is the signer to use for signing checkpoints Signer ed25519.PrivateKey // PublicKey is the public key of the signer PublicKey ed25519.PublicKey }
type TrillianClient ¶
type TrillianClient struct { Client trillian.TrillianLogClient LogID int64 Context context.Context }
func NewTrillianClient ¶
func NewTrillianClient(ctx context.Context, api API) TrillianClient
func NewTrillianClientFromTreeID ¶
func NewTrillianClientFromTreeID(ctx context.Context, treeID int64, api *API) TrillianClient