Skip to content

Commit

Permalink
Pass expiry to envelope-generator plugin
Browse files Browse the repository at this point in the history
Signed-off-by: Pritesh Bandi <[email protected]>
  • Loading branch information
Pritesh Bandi committed Nov 30, 2022
1 parent 86287b5 commit 44e1268
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
2 changes: 1 addition & 1 deletion cmd/notation/sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func prepareSigningContent(ctx context.Context, opts *signOpts) (ocispec.Descrip
return manifestDesc, notation.SignOptions{
ArtifactReference: opts.reference,
SignatureMediaType: mediaType,
Expiry: cmd.GetExpiry(opts.expiry),
ExpiryDuration: &opts.expiry,
PluginConfig: pluginConfig,
}, nil
}
9 changes: 0 additions & 9 deletions internal/cmd/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package cmd
import (
"context"
"errors"
"time"

"github.com/notaryproject/notation-go"
"github.com/notaryproject/notation-go/dir"
Expand Down Expand Up @@ -35,11 +34,3 @@ func GetSigner(opts *SignerFlagOpts) (notation.Signer, error) {
}
return nil, errors.New("unsupported key, either provide a local key and certificate file paths, or a key name in config.json, check [DOC_PLACEHOLDER] for details")
}

// GetExpiry returns the signature expiry according to the CLI context.
func GetExpiry(expiry time.Duration) time.Time {
if expiry == 0 {
return time.Time{}
}
return time.Now().Add(expiry)
}

0 comments on commit 44e1268

Please sign in to comment.