package opaprocessor

import (
	"context"

	"github.com/google/go-containerregistry/pkg/name"
	"github.com/sigstore/cosign/v3/pkg/cosign"
)

func has_signature(ctx context.Context, img string) bool {
	ref, err := name.ParseReference(img)
	if err != nil {
		return false
	}
	sins, err := cosign.FetchSignaturesForReference(ctx, ref)

	if err != nil {
		return false
	}

	return len(sins) > 0
}
