Skip to content

Commit

Permalink
internal/pkg/cosign/ephemeral: remove dependency on pkg/errors
Browse files Browse the repository at this point in the history
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
  • Loading branch information
zchee committed May 16, 2022
1 parent bdb5b54 commit 45b4f88
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/pkg/cosign/ephemeral/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import (
"context"
"crypto"
"encoding/base64"
"fmt"
"io"

"github.com/pkg/errors"
icosign "github.com/sigstore/cosign/internal/pkg/cosign"
"github.com/sigstore/cosign/pkg/cosign"
"github.com/sigstore/cosign/pkg/oci"
Expand All @@ -39,7 +39,7 @@ var _ icosign.Signer = ephemeralSigner{}
func (ks ephemeralSigner) Sign(ctx context.Context, payload io.Reader) (oci.Signature, crypto.PublicKey, error) {
pub, err := ks.signer.PublicKey()
if err != nil {
return nil, nil, errors.Wrap(err, "retrieving the static public key somehow failed")
return nil, nil, fmt.Errorf("retrieving the static public key somehow failed: %w", err)
}

payloadBytes, err := io.ReadAll(payload)
Expand All @@ -65,11 +65,11 @@ func (ks ephemeralSigner) Sign(ctx context.Context, payload io.Reader) (oci.Sign
func NewSigner() (icosign.Signer, error) {
priv, err := cosign.GeneratePrivateKey()
if err != nil {
return nil, errors.Wrap(err, "generating cert")
return nil, fmt.Errorf("generating cert: %w", err)
}
s, err := signature.LoadECDSASignerVerifier(priv, crypto.SHA256)
if err != nil {
return nil, errors.Wrap(err, "creating a SignerVerifier from ephemeral key")
return nil, fmt.Errorf("creating a SignerVerifier from ephemeral key: %w", err)
}
return ephemeralSigner{
signer: s,
Expand Down

0 comments on commit 45b4f88

Please sign in to comment.