From 1813ab8a7a9ba63534ff1d01442117cd6b6f93d7 Mon Sep 17 00:00:00 2001 From: mrjoelkamp Date: Mon, 22 Apr 2024 12:47:14 -0500 Subject: [PATCH] feat: add exported constants --- internal/oci/oci.go | 5 +++-- internal/oci/types.go | 3 --- pkg/types/types.go | 7 +++++++ 3 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 pkg/types/types.go diff --git a/internal/oci/oci.go b/internal/oci/oci.go index 89af78c..0f50222 100644 --- a/internal/oci/oci.go +++ b/internal/oci/oci.go @@ -9,6 +9,7 @@ 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" @@ -71,11 +72,11 @@ func attestationManifestFromOCILayout(path string, platformStr string) (*Attesta } } for _, mf := range mfs2.Manifests { - if mf.Annotations[DockerReferenceType] != AttestationManifestType { + if mf.Annotations[types.DockerReferenceType] != types.AttestationManifestType { continue } - if mf.Annotations[DockerReferenceDigest] != imageDigest { + if mf.Annotations[types.DockerReferenceDigest] != imageDigest { continue } diff --git a/internal/oci/types.go b/internal/oci/types.go index 5af15eb..4f9367d 100644 --- a/internal/oci/types.go +++ b/internal/oci/types.go @@ -1,8 +1,5 @@ package oci const ( - DockerReferenceType = "vnd.docker.reference.type" - DockerReferenceDigest = "vnd.docker.reference.digest" - AttestationManifestType = "attestation-manifest" InTotoPredicateType = "in-toto.io/predicate-type" ) diff --git a/pkg/types/types.go b/pkg/types/types.go new file mode 100644 index 0000000..ee847f2 --- /dev/null +++ b/pkg/types/types.go @@ -0,0 +1,7 @@ +package types + +const ( + DockerReferenceType = "vnd.docker.reference.type" + DockerReferenceDigest = "vnd.docker.reference.digest" + AttestationManifestType = "attestation-manifest" +)