Documentation ¶
Index ¶
- func AppendArtifactsToFile(artifacts []Artifact) error
- func ComputeRoot(maxSize int64) ([]byte, error)
- func ComputeRootFromMemory(artifacts []Artifact) ([]byte, error)
- func FetchLeavesByRange(initSize, finalSize int64) error
- func GetLogEntryByIndex(logIndex int64, rekorClient *client.Rekor) (string, models.LogEntryAnon, error)
- func GetLogInfo() (*models.LogInfo, error)
- func GetPublicKey() (string, error)
- func NewClient() (*client.Rekor, error)
- func ParseEntry(uuid string, e models.LogEntryAnon) (getCmdOutput, error)
- func SaveTreeMetadata() error
- func UpdateMetadataByIndex(i int64) error
- func UpdateMetadataBySTH() error
- func VerifySignature(pub string) error
- type Artifact
- type TreeMetadata
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendArtifactsToFile ¶
consider loading filenames/paths from viper registry
func ComputeRoot ¶
func ComputeRootRecursive(maxSize int64) ([]byte, error) { return computeRootRecursive(0, maxSize) }
func computeRootRecursive(minSize, maxSize int64) ([]byte, error) { if minSize == maxSize-1 { artifact, err := ReadLeaveFromFile(minSize) if err != nil { return nil, err } str := artifact.MerkleTreeHash hash, err := hex.DecodeString(str) if err != nil { return nil, err } return hash, nil } else { separator := powerOfTwo(maxSize) leftHash, err := computeRootRecursive(minSize, separator) if err != nil { return nil, err } rightHash, err := computeRootRecursive(separator, maxSize) if err != nil { return nil, err } hash := rfc6962.DefaultHasher.HashChildren(leftHash, rightHash) return hash, nil } }
func ComputeRootFromMemory ¶
func FetchLeavesByRange ¶
FetchLeavesByRange fetches leaves by range and saves them into a file.
func GetLogEntryByIndex ¶
func GetLogEntryByIndex(logIndex int64, rekorClient *client.Rekor) (string, models.LogEntryAnon, error)
GetLogEntryByIndex returns an object with the log index, integratedTime, UUID, and body
logEntry := models.LogEntry{ hex.EncodeToString(leaf.MerkleLeafHash): models.LogEntryAnon{ LogIndex: &leaf.LeafIndex, Body: leaf.LeafValue, IntegratedTime: leaf.IntegrateTimestamp.AsTime().Unix(), }, }
func GetLogInfo ¶
GetLogInfo retrieves the root hash, the tree size, the key hint, log root, and signature of the log through the Rekor API.
func GetPublicKey ¶
GetPublicKey returns public key of entity that signed STH in string type.
func ParseEntry ¶
func ParseEntry(uuid string, e models.LogEntryAnon) (getCmdOutput, error)
this function also verifies the integrity of an entry.
func SaveTreeMetadata ¶
func SaveTreeMetadata() error
func UpdateMetadataByIndex ¶
func UpdateMetadataBySTH ¶
func UpdateMetadataBySTH() error
func VerifySignature ¶
VerifySignature verifies the integrity of the signed tree hash.
Types ¶
type Artifact ¶
type Artifact struct { Pk string `json:"pk,omitempty"` DataHash string `json:"data_hash,omitempty"` Sig string `json:"sig,omitempty"` MerkleTreeHash string `json:"merkle_tree_hash,omitempty"` }
func GetLogEntryData ¶
func ReadLeaveFromFile ¶
type TreeMetadata ¶
type TreeMetadata struct { PublicKey string `json:"public_key,omitempty"` LogInfo *models.LogInfo `json:"log_info,omitempty"` SavedMaxIndex int64 `json:"saved_max_index,omitempty"` }
func LoadTreeMetadata ¶
func LoadTreeMetadata() (TreeMetadata, error)
Click to show internal directories.
Click to hide internal directories.