Skip to content

Commit

Permalink
refactor: cleanup logging
Browse files Browse the repository at this point in the history
  • Loading branch information
natesales committed Nov 20, 2024
1 parent 59f7790 commit 102669b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ var (

func gitHubAttestation(digest string) ([]byte, error) {
url := "https://api.github.com/repos/" + *repo + "/attestations/sha256:" + digest
log.Printf("Fetching sigstore attestation from %s", url)
log.Printf("Fetching sigstore bundle from %s", url)
bundleResponse, err := http.Get(url)
if err != nil {
return nil, err
}
if bundleResponse.StatusCode != 200 {
return nil, fmt.Errorf("failed to fetch attestation: %s", bundleResponse.Status)
return nil, fmt.Errorf("failed to fetch sigstore bundle: %s", bundleResponse.Status)
}

var responseJSON struct {
Expand Down Expand Up @@ -76,7 +76,7 @@ func main() {
if err != nil {
panic(err)
}
fmt.Println("Sigstore", sigstoreMeasurements)
log.Println("Sigstore", sigstoreMeasurements)
}

var nitroMeasurements *models.Measurements
Expand Down Expand Up @@ -106,10 +106,14 @@ func main() {
if err != nil {
panic(err)
}
fmt.Println("Nitro", nitroMeasurements)
log.Println("Nitro", nitroMeasurements)
}

if sigstoreMeasurements != nil && nitroMeasurements != nil {
fmt.Println("Match?", sigstoreMeasurements.Equals(nitroMeasurements))
if sigstoreMeasurements.Equals(nitroMeasurements) {
log.Println("PCR values match! Verification success")
} else {
log.Println("PCR register mismatch. Verification failed")
}
}
}

0 comments on commit 102669b

Please sign in to comment.