Skip to content

Commit

Permalink
fix: CLI now returns 1 when signature verification fails in JSON mode
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre-Henri Symoneaux <[email protected]>
  • Loading branch information
phsym committed Nov 18, 2024
1 parent 8ae2bbc commit 20f9c76
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions cmd/okms/keys/sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,11 @@ SIGNATURE can also be passed from a file or stdin using '-' or '@'. Stdin can ho
valid := exit.OnErr2(common.Client().Verify(cmd.Context(), keyId, params.signatureAlgorithm.Alg(), true, data, signature))
if cmd.Flag("output").Value.String() == string(flagsmgmt.JSON_OUTPUT_FORMAT) {
output.JsonPrint(valid)
} else {
if valid {
fmt.Println("Signature is valid")
} else {
exit.OnErr(errors.New("Signature invalid"))
}
} else if valid {
fmt.Println("Signature is valid")
}
if !valid {
exit.OnErr(errors.New("Signature invalid"))
}
} else {
resp := exit.OnErr2(common.Client().GetServiceKey(cmd.Context(), keyId, utils.PtrTo(types.Jwk)))
Expand Down

0 comments on commit 20f9c76

Please sign in to comment.