2021-10-05 22:42:42 -07:00
|
|
|
package cosign
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2021-10-29 11:24:26 +01:00
|
|
|
|
2021-10-05 22:42:42 -07:00
|
|
|
"github.com/google/go-containerregistry/pkg/name"
|
|
|
|
"github.com/sigstore/cosign/pkg/cosign"
|
2021-11-03 10:45:35 +03:00
|
|
|
"github.com/sigstore/cosign/pkg/oci"
|
2021-10-05 22:42:42 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
var client Cosign = &driver{}
|
|
|
|
|
|
|
|
type Cosign interface {
|
2022-01-27 21:13:23 -08:00
|
|
|
VerifyImageSignatures(ctx context.Context, signedImgRef name.Reference, co *cosign.CheckOpts) ([]oci.Signature, bool, error)
|
|
|
|
VerifyImageAttestations(ctx context.Context, signedImgRef name.Reference, co *cosign.CheckOpts) (checkedAttestations []oci.Signature, bundleVerified bool, err error)
|
2021-10-05 22:42:42 -07:00
|
|
|
}
|
|
|
|
|
2022-05-17 08:19:03 +02:00
|
|
|
type driver struct{}
|
2021-10-05 22:42:42 -07:00
|
|
|
|
2022-01-27 21:13:23 -08:00
|
|
|
func (d *driver) VerifyImageSignatures(ctx context.Context, signedImgRef name.Reference, co *cosign.CheckOpts) ([]oci.Signature, bool, error) {
|
|
|
|
return cosign.VerifyImageSignatures(ctx, signedImgRef, co)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (d *driver) VerifyImageAttestations(ctx context.Context, signedImgRef name.Reference, co *cosign.CheckOpts) (checkedAttestations []oci.Signature, bundleVerified bool, err error) {
|
|
|
|
return cosign.VerifyImageAttestations(ctx, signedImgRef, co)
|
2021-10-05 22:42:42 -07:00
|
|
|
}
|