Skip to content

Commit

Permalink
Return helpful message if --module-path or COSIGN_PKCS11_MODULE_PATH …
Browse files Browse the repository at this point in the history
…is not set

Signed-off-by: Derek Burdick <derek-burdick@users.noreply.github.com>
  • Loading branch information
derek-burdick committed Mar 31, 2023
1 parent 0561176 commit c337724
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/cosign/cli/pkcs11cli/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ func GetKeysInfo(_ context.Context, modulePath string, slotID uint, pin string)
}

func ListTokensCmd(ctx context.Context, modulePath string) error {
if modulePath == "" {
return fmt.Errorf("please specify --module-path or set COSIGN_PKCS11_MODULE_PATH")
}
tokens, err := GetTokens(ctx, modulePath)
if err != nil {
return err
Expand All @@ -223,6 +226,9 @@ func ListTokensCmd(ctx context.Context, modulePath string) error {
}

func ListKeysUrisCmd(ctx context.Context, modulePath string, slotID uint, pin string) error {
if modulePath == "" {
return fmt.Errorf("please specify --module-path or set COSIGN_PKCS11_MODULE_PATH")
}
keysInfo, err := GetKeysInfo(ctx, modulePath, slotID, pin)
if err != nil {
return err
Expand Down

0 comments on commit c337724

Please sign in to comment.