Skip to content

Commit

Permalink
refactor: cleanup imports
Browse files Browse the repository at this point in the history
  • Loading branch information
natesales committed Jan 16, 2025
1 parent 8e587c8 commit 500a0d7
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 2 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func main() {

var codeMeasurements, enclaveMeasurements *attestation.Measurement

log.Printf("Fetching latest release for %s", *repo)
latestTag, eifHash, err := github.FetchLatestRelease(*repo)
if err != nil {
log.Fatalf("Failed to fetch latest release: %v", err)
Expand All @@ -34,6 +35,7 @@ func main() {
log.Printf("Latest release: %s", latestTag)
log.Printf("EIF hash: %s", eifHash)

log.Printf("Fetching sigstore bundle from %s for EIF %s", *repo, eifHash)
bundleBytes, err := github.FetchAttestationBundle(*repo, eifHash)
if err != nil {
log.Fatal(err)
Expand Down
3 changes: 1 addition & 2 deletions pkg/attestation/fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package attestation

import (
"encoding/json"
"log"
"net/http"
"net/url"
)
Expand All @@ -20,7 +19,7 @@ func Fetch(host string) (*Document, error) {

resp, err := http.Get(u.String())
if err != nil {
log.Fatal(err)
return nil, err
}
defer resp.Body.Close()

Expand Down
1 change: 1 addition & 0 deletions pkg/attestation/nitro.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package attestation
import (
"encoding/base64"
"encoding/hex"

"github.com/blocky/nitrite"
)

Expand Down
3 changes: 0 additions & 3 deletions pkg/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ package github
import (
"encoding/json"
"fmt"
"log"
"net/http"
"regexp"
)

// FetchLatestRelease gets the latest release and EIF hash of a repo
func FetchLatestRelease(repo string) (string, string, error) {
url := "https://api.github.com/repos/" + repo + "/releases/latest"
log.Printf("Fetching latest release for %s", repo)
releaseResponse, err := http.Get(url)
if err != nil {
return "", "", err
Expand All @@ -37,7 +35,6 @@ func FetchLatestRelease(repo string) (string, string, error) {
// FetchAttestationBundle fetches the sigstore bundle from a repo for a given repo and EIF hash
func FetchAttestationBundle(repo, digest string) ([]byte, error) {
url := "https://api.github.com/repos/" + repo + "/attestations/sha256:" + digest
log.Printf("Fetching sigstore bundle from %s for EIF %s", repo, digest)
bundleResponse, err := http.Get(url)
if err != nil {
return nil, err
Expand Down
1 change: 1 addition & 0 deletions pkg/sigstore/sigstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package sigstore
import (
"encoding/hex"
"fmt"

protobundle "github.com/sigstore/protobuf-specs/gen/pb-go/bundle/v1"
"github.com/sigstore/sigstore-go/pkg/bundle"
"github.com/sigstore/sigstore-go/pkg/root"
Expand Down

0 comments on commit 500a0d7

Please sign in to comment.