Skip to content

Commit

Permalink
fix: rekor test
Browse files Browse the repository at this point in the history
Signed-off-by: Vishal Choudhary <[email protected]>
  • Loading branch information
vishal-chdhry committed Sep 28, 2024
1 parent 501d71c commit 50f5a75
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 2 additions & 3 deletions pkg/tlog/entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,8 @@ func (entry *Entry) HasInclusionPromise() bool {
func (entry *Entry) HasInclusionProof() bool {
return entry.logEntryAnon.Verification != nil
}

func (entry *Entry) LogEntry() models.LogEntryAnon {
return entry.logEntryAnon
func (entry *Entry) Verification() *models.LogEntryAnonVerification {
return entry.logEntryAnon.Verification
}

func VerifyInclusion(entry *Entry, verifier signature.Verifier) error {
Expand Down
10 changes: 9 additions & 1 deletion pkg/verify/tlog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ package verify_test

import (
"encoding/base64"
"encoding/hex"
"errors"
"strings"
"testing"
"time"

"github.com/go-openapi/runtime"
"github.com/go-openapi/swag"
rekorGeneratedClient "github.com/sigstore/rekor/pkg/generated/client"
"github.com/sigstore/rekor/pkg/generated/client/entries"
"github.com/sigstore/rekor/pkg/generated/models"
Expand Down Expand Up @@ -275,7 +277,13 @@ func TestTlogVerification(t *testing.T) {

tlogEntry := tlogEntries[0]
var logEntry models.LogEntry = make(models.LogEntry)
logEntry["foo"] = tlogEntry.LogEntry()
logEntry["foo"] = models.LogEntryAnon{
Body: tlogEntry.Body(),
IntegratedTime: swag.Int64(tlogEntry.IntegratedTime().Unix()),
LogIndex: swag.Int64(tlogEntry.LogIndex()),
LogID: swag.String(hex.EncodeToString([]byte(tlogEntry.LogKeyID()))),
Verification: tlogEntry.Verification(),
}
mockRekor := &rekorGeneratedClient.Rekor{
Entries: &mockEntriesClient{
Entries: []*models.LogEntry{&logEntry},
Expand Down

0 comments on commit 50f5a75

Please sign in to comment.