Skip to content

Commit

Permalink
fix linter errors
Browse files Browse the repository at this point in the history
Signed-off-by: Meredith Lancaster <malancas@github.com>
  • Loading branch information
malancas committed Nov 30, 2023
1 parent e7a7f1d commit fb69efc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions pkg/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ func NewAPI() (*API, error) {
return nil, errors.Wrap(err, "error getting hash")
}

config := signer.SignerConfig{
Scheme: signer.SignerScheme(viper.GetString("timestamp-signer")),
config := signer.Config{
Scheme: signer.Scheme(viper.GetString("timestamp-signer")),
CloudKMSKey: viper.GetString("kms-key-resource"),
TinkKMSKey: viper.GetString("tink-key-resource"),
TinkKeysetPath: viper.GetString("tink-keyset-path"),
Expand All @@ -64,7 +64,7 @@ func NewAPI() (*API, error) {
var certChain []*x509.Certificate

// KMS, Tink and File signers require a provided certificate chain
if signer.SignerScheme(viper.GetString("timestamp-signer")) != signer.MemoryScheme {
if signer.Scheme(viper.GetString("timestamp-signer")) != signer.MemoryScheme {
certChainPath := viper.GetString("certificate-chain-path")
data, err := os.ReadFile(filepath.Clean(certChainPath))
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/signer/memory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
func TestNewTimestampingCertWithChain(t *testing.T) {
ctx := context.Background()

config := SignerConfig{
config := Config{
Scheme: MemoryScheme,
}
signer, err := NewCryptoSigner(ctx, crypto.Hash(0), config)
Expand Down
16 changes: 8 additions & 8 deletions pkg/signer/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,22 @@ import (
_ "github.com/sigstore/sigstore/pkg/signature/kms/hashivault"
)

type SignerScheme string
type Scheme string

const (
KMSScheme SignerScheme = "kms"
TinkScheme SignerScheme = "tink"
MemoryScheme SignerScheme = "memory"
FileScheme SignerScheme = "file"
KMSScheme Scheme = "kms"
TinkScheme Scheme = "tink"
MemoryScheme Scheme = "memory"
FileScheme Scheme = "file"
)

type WrappedSigner interface {
crypto.Signer
HashFunc() crypto.Hash
}

type SignerConfig struct {
Scheme SignerScheme
type Config struct {
Scheme Scheme
CloudKMSKey string
TinkKMSKey string
TinkKeysetPath string
Expand All @@ -56,7 +56,7 @@ type SignerConfig struct {
FileSignerPasswd string
}

func NewCryptoSigner(ctx context.Context, hash crypto.Hash, config SignerConfig) (WrappedSigner, error) {
func NewCryptoSigner(ctx context.Context, hash crypto.Hash, config Config) (WrappedSigner, error) {
switch config.Scheme {
case MemoryScheme:
sv, _, err := signature.NewECDSASignerVerifier(elliptic.P256(), rand.Reader, crypto.SHA256)
Expand Down

0 comments on commit fb69efc

Please sign in to comment.