diff --git a/pkg/pki/pgp/pgp.go b/pkg/pki/pgp/pgp.go index 19501bc1d..0914db227 100644 --- a/pkg/pki/pgp/pgp.go +++ b/pkg/pki/pgp/pgp.go @@ -28,7 +28,7 @@ import ( "io" "net/http" - validator "github.com/go-playground/validator/v10" + "github.com/asaskevich/govalidator" //TODO: https://github.com/sigstore/rekor/issues/286 "golang.org/x/crypto/openpgp" //nolint:staticcheck @@ -295,9 +295,7 @@ func (k PublicKey) EmailAddresses() []string { // Extract from cert for _, entity := range k.key { for _, identity := range entity.Identities { - validate := validator.New() - errs := validate.Var(identity.UserId.Email, "required,email") - if errs == nil { + if govalidator.IsEmail(identity.UserId.Email) { names = append(names, identity.UserId.Email) } } diff --git a/pkg/pki/x509/x509.go b/pkg/pki/x509/x509.go index 2589849c4..b8d0148ee 100644 --- a/pkg/pki/x509/x509.go +++ b/pkg/pki/x509/x509.go @@ -28,7 +28,7 @@ import ( "io" "strings" - validator "github.com/go-playground/validator/v10" + "github.com/asaskevich/govalidator" "github.com/sigstore/rekor/pkg/pki/identity" "github.com/sigstore/sigstore/pkg/cryptoutils" sigsig "github.com/sigstore/sigstore/pkg/signature" @@ -184,10 +184,8 @@ func (k PublicKey) EmailAddresses() []string { cert = k.certs[0] } if cert != nil { - validate := validator.New() for _, name := range cert.EmailAddresses { - errs := validate.Var(name, "required,email") - if errs == nil { + if govalidator.IsEmail(name) { names = append(names, strings.ToLower(name)) } }