Skip to content

Commit

Permalink
Drop strfmt.Base64 from pkg/oci. (#1083)
Browse files Browse the repository at this point in the history
* Drop `strfmt.Base64` from `pkg/oci`.

I noticed that vendoring `pkg/oci` was pulling in stuff from `mongodb`, and pulling the thread it seems to come from this line.

`Base64` is an alias of `[]byte`, so this should have a relatively low migration cost.

Signed-off-by: Matt Moore <mattmoor@chainguard.dev>

* Remove upconvert

Signed-off-by: Matt Moore <mattmoor@chainguard.dev>
  • Loading branch information
mattmoor committed Nov 19, 2021
1 parent f8f0f6d commit e1acd18
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/cosign/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ func VerifyBundle(sig oci.Signature) (bool, error) {
return false, errors.Wrap(err, "pem to ecdsa")
}

if err := VerifySET(bundle.Payload, []byte(bundle.SignedEntryTimestamp), rekorPubKey); err != nil {
if err := VerifySET(bundle.Payload, bundle.SignedEntryTimestamp, rekorPubKey); err != nil {
return false, err
}

Expand Down
3 changes: 1 addition & 2 deletions pkg/oci/signatures.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package oci
import (
"crypto/x509"

"github.com/go-openapi/strfmt"
v1 "github.com/google/go-containerregistry/pkg/v1"
)

Expand Down Expand Up @@ -64,7 +63,7 @@ type Signature interface {
// Bundle holds metadata about recording a Signature's ephemeral key to
// a Rekor transparency log.
type Bundle struct {
SignedEntryTimestamp strfmt.Base64
SignedEntryTimestamp []byte
Payload BundlePayload
}

Expand Down
5 changes: 3 additions & 2 deletions pkg/oci/static/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"reflect"
"testing"

"github.com/google/go-cmp/cmp"
"github.com/google/go-containerregistry/pkg/v1/types"
"github.com/sigstore/cosign/pkg/oci"
ctypes "github.com/sigstore/cosign/pkg/types"
Expand Down Expand Up @@ -86,7 +87,7 @@ func TestOptions(t *testing.T) {
LayerMediaType: ctypes.SimpleSigningMediaType,
ConfigMediaType: types.OCIConfigJSON,
Annotations: map[string]string{
BundleAnnotationKey: "{\"SignedEntryTimestamp\":\"\",\"Payload\":{\"body\":null,\"integratedTime\":0,\"logIndex\":0,\"logID\":\"\"}}",
BundleAnnotationKey: "{\"SignedEntryTimestamp\":null,\"Payload\":{\"body\":null,\"integratedTime\":0,\"logIndex\":0,\"logID\":\"\"}}",
},
Bundle: bundle,
},
Expand All @@ -100,7 +101,7 @@ func TestOptions(t *testing.T) {
}

if !reflect.DeepEqual(got, test.want) {
t.Errorf("makeOptions() = %#v, wanted %#v", got, test.want)
t.Errorf("makeOptions() = %s", cmp.Diff(got, test.want))
}
})
}
Expand Down

0 comments on commit e1acd18

Please sign in to comment.