refactor: export oci

This commit is contained in:
mrjoelkamp
2024-04-22 12:51:10 -05:00
parent bf2dff9f66
commit 1b2f80d4c5
11 changed files with 15 additions and 13 deletions

View File

@@ -1,5 +0,0 @@
package oci
const (
InTotoPredicateType = "in-toto.io/predicate-type"
)

View File

@@ -5,7 +5,7 @@ import (
"os"
"testing"
"github.com/docker/attest/internal/oci"
"github.com/docker/attest/pkg/oci"
"github.com/docker/attest/pkg/policy"
"github.com/docker/attest/pkg/signerverifier"
"github.com/docker/attest/pkg/tlog"

View File

@@ -9,7 +9,6 @@ import (
"github.com/containerd/containerd/platforms"
"github.com/distribution/reference"
att "github.com/docker/attest/pkg/attestation"
"github.com/docker/attest/pkg/types"
"github.com/google/go-containerregistry/pkg/authn"
"github.com/google/go-containerregistry/pkg/name"
v1 "github.com/google/go-containerregistry/pkg/v1"
@@ -72,11 +71,11 @@ func attestationManifestFromOCILayout(path string, platformStr string) (*Attesta
}
}
for _, mf := range mfs2.Manifests {
if mf.Annotations[types.DockerReferenceType] != types.AttestationManifestType {
if mf.Annotations[DockerReferenceType] != AttestationManifestType {
continue
}
if mf.Annotations[types.DockerReferenceDigest] != imageDigest {
if mf.Annotations[DockerReferenceDigest] != imageDigest {
continue
}

8
pkg/oci/types.go Normal file
View File

@@ -0,0 +1,8 @@
package oci
const (
DockerReferenceType = "vnd.docker.reference.type"
DockerReferenceDigest = "vnd.docker.reference.digest"
AttestationManifestType = "attestation-manifest"
InTotoPredicateType = "in-toto.io/predicate-type"
)

View File

@@ -4,7 +4,7 @@ import (
"context"
"fmt"
"github.com/docker/attest/internal/oci"
"github.com/docker/attest/pkg/oci"
)
type policyEvaluatorCtxKeyType struct{}

View File

@@ -9,8 +9,8 @@ import (
"strings"
"github.com/distribution/reference"
"github.com/docker/attest/internal/oci"
"github.com/docker/attest/internal/util"
"github.com/docker/attest/pkg/oci"
"github.com/docker/attest/pkg/tuf"
goyaml "gopkg.in/yaml.v3"

View File

@@ -6,9 +6,9 @@ import (
"path/filepath"
"testing"
"github.com/docker/attest/internal/oci"
"github.com/docker/attest/internal/test"
"github.com/docker/attest/pkg/attestation"
"github.com/docker/attest/pkg/oci"
"github.com/docker/attest/pkg/policy"
"github.com/docker/attest/pkg/tuf"
"github.com/stretchr/testify/assert"

View File

@@ -7,8 +7,8 @@ import (
"os"
"path/filepath"
"github.com/docker/attest/internal/oci"
att "github.com/docker/attest/pkg/attestation"
"github.com/docker/attest/pkg/oci"
intoto "github.com/in-toto/in-toto-golang/in_toto"
"github.com/open-policy-agent/opa/ast"
"github.com/open-policy-agent/opa/rego"