@@ -29,10 +29,32 @@ func createESDecodeCommand(_ /* alg */, use, short, long, example string, pubKey
2929 }
3030
3131 if privateKeyFile == "" && publicKeyFile == "" {
32- return fmt .Errorf ("private key file or public key file is mandatory\n \n %s" , cmd .UsageString ())
32+ //nolint:revive,staticcheck // User-facing error message with proper formatting
33+ return fmt .Errorf (`Error: key file is required
34+
35+ Provide either a public key file (recommended) or private key file in PEM format to verify the JWT token.
36+
37+ Example usage with public key (recommended):
38+ jwt-cli decode %s --token "eyJhbGci..." --public-key ./keys/ec-public.pem
39+
40+ Example usage with private key:
41+ jwt-cli decode %s --token "eyJhbGci..." --private-key ./keys/ec-private.pem
42+
43+ Tip: Use the public key for verification to follow asymmetric cryptography best practices.
44+ The key must match the one used to encode the token.
45+ ES256 uses P-256 curve, ES384 uses P-384, ES512 uses P-521.` , use , use )
3346 }
3447 if token == "" {
35- return fmt .Errorf ("token is mandatory\n \n %s" , cmd .UsageString ())
48+ //nolint:revive,staticcheck // User-facing error message with proper formatting
49+ return fmt .Errorf (`Error: token is required
50+
51+ Provide the JWT token string to decode and verify.
52+
53+ Example usage:
54+ jwt-cli decode %s --token "eyJhbGci..." --public-key ./keys/ec-public.pem
55+ jwt-cli decode %s --token "$TOKEN" --public-key ./keys/ec-public.pem
56+
57+ Tip: The token is the three-part string (header.payload.signature) produced by the encode command.` , use , use )
3658 }
3759
3860 var j cryptojwt.Decoder
0 commit comments