Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the loginfo command a bit more future/backwards proof. #718

Merged
merged 1 commit into from
Mar 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions cmd/rekor-cli/app/log_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type logInfoCmdOutput struct {
func (l *logInfoCmdOutput) String() string {
// Verification is always successful if we return an object.
ts := time.Unix(0, int64(l.TimestampNanos)).UTC().Format(time.RFC3339)

return fmt.Sprintf(`Verification Successful!
Tree Size: %v
Root Hash: %s
Expand Down Expand Up @@ -112,11 +113,18 @@ var logInfoCmd = &cobra.Command{
return nil, errors.New("signature on tree head did not verify")
}

pToInt := func(p *int64) int64 {
if p == nil {
return 0
}
return *p
}

cmdOutput := &logInfoCmdOutput{
TreeSize: *logInfo.TreeSize,
TreeSize: pToInt(logInfo.TreeSize),
RootHash: *logInfo.RootHash,
TimestampNanos: sth.GetTimestamp(),
TreeID: *logInfo.TreeID,
TreeID: pToInt(logInfo.TreeID),
}

oldState := state.Load(serverURL)
Expand Down