@@ -67,6 +67,11 @@ brew tap rrajesh1979/tap
6767brew install jwtc
6868```
6969
70+ For command auto completion, you can use the following command.
71+ ``` shell
72+ source jwtc_completion
73+ ````
74+
7075Once installed you can invoke jwtc with the file name and algorithm as shown below.
7176
7277Invoking the command displays the usage information as shown below. This is powered by Picocli.
@@ -78,27 +83,57 @@ Encode and decode JWT tokens.
7883 -V, --version Print version information and exit.
7984Commands:
8085 help Displays help information about the specified command
81- encode
82- decode
86+ encode Encode a JWT token
87+ decode Decode JWT token
88+ ` ` `
89+
90+ ` ` ` shell
91+ jwtc encode help
92+ Unmatched argument at index 1: ' help'
93+ Usage: jwtc encode [-iat] [-a=< alg> ] [-aud=< aud> ] [-i=< iss> ] [-p=< userInput> ]
94+ [-s=< sub> ] [-t=< ttlMillis> ] [-ty=< typ> ]
95+ -a, --algorithm=< alg> Algorithm to be used. Default is HS256. Supported
96+ algorithms are HS256, HS384, HS512, RS256, RS384,
97+ RS512, ES256, ES384, ES512
98+ -aud, --audience=< aud>
99+ Recipients the JWT is intended for.
100+ -i, --issuer=< iss> Principal that issued the JWT.
101+ -iat, --issuedAt Include issued at in JWT.
102+ -p, --userInput=< userInput>
103+ User provided payload in JSON format.
104+ -s, --subject=< sub> Subject of the JWT.
105+ -t, --ttl=< ttlMillis> Time to Live in Milliseconds.
106+ -ty, --typ=< typ> Token Type. Default is JWT.
107+ ` ` `
108+
109+ ` ` ` shell
110+ jwtc decode help
111+ Missing required options: ' --jwt=<jwt>' , ' --key=<key>'
112+ Usage: jwtc decode -j=< jwt> -k=< key>
113+ -j, --jwt=< jwt> JWT String to be decoded.
114+ -k, --key=< key> Key to be used for decoding.
83115` ` `
84116
85117Some valid commands are shown below.
86118` ` ` shell
87- mychecksum hello.txt
88- 11:09:40.116 [main] INFO org.rrajesh1979.demo.MyCheckSum - Hello from MyCheckSum
89- 11:09:40.137 [main] INFO org.rrajesh1979.demo.MyCheckSum - Checksum of file hello.txt, is : f0ef7081e1539ac00ef5b761b4fb01b3
119+ jwtc encode
120+ 16:17:48.928 [main] INFO org.rrajesh1979.tool.JWTCEncode - Starting JWTCEncode
121+ 16:17:48.955 [main] INFO org.rrajesh1979.tool.JWTCEncode - JWT: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJycmFqZXNoMTk3OSIsImV4cCI6MjYwNzMxMTE4MTM1MjU5fQ.5aa6651mlTOf8NOGrrugi3pvHoSYhDah67vlTVWw1fA
122+ 16:17:48.955 [main] INFO org.rrajesh1979.tool.JWTCEncode - Secret Key: QeQvvdxnvB9XEk0y0nnNh6w4V8BWfJ2uBwrNlnp84w0=
90123` ` `
91124
92125` ` ` shell
93- mychecksum hello.txt -a MD5
94- 11:09:50.123 [main] INFO org.rrajesh1979.demo.MyCheckSum - Hello from MyCheckSum
95- 11:09:50.151 [main] INFO org.rrajesh1979.demo.MyCheckSum - Checksum of file hello.txt, is : f0ef7081e1539ac00ef5b761b4fb01b3
126+ jwtc decode -j=" eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJKV1QgRW5jb2RlciIsImF1ZCI6IkhlbGxvIEpXVCIsIm5hbWUiOiJKb2UiLCJpc3MiOiJycmFqZXNoMTk3OSIsInBpY3R1cmUiOiJodHRwczovL2V4YW1wbGUuY29tL2ltYWdlLnBuZyJ9.l1j1JyW3nvWJ90De8taOe1tZ80sHHHDMaibYEPv78LfA3Bw-uGgCECy5MwkE6nY3hP7isup433X5VqS2xP22fw" -k=" mOYKXJKdhBYQFWNr9cHHsgGvHseKRR9Rw7E379oeUuzfG18MmlcO3c8i7tBMMufziy6xMoZZAiO7bNKxZl7Rfw=="
127+ 16:18:07.913 [main] INFO org.rrajesh1979.tool.JWTCDecode - Starting JWTCDecode
128+ 16:18:07.921 [main] INFO org.rrajesh1979.tool.JWTCDecode - Decoded JWT Header: {typ=JWT, alg=HS512}
129+ 16:18:07.922 [main] INFO org.rrajesh1979.tool.JWTCDecode - Decoded JWT Payload: {sub=JWT Encoder, aud=Hello JWT, name=Joe, iss=rrajesh1979, picture=https://example.com/image.png}
96130` ` `
97131
98132` ` ` shell
99- mychecksum hello.txt -a SHA-256
100- 11:10:10.578 [main] INFO org.rrajesh1979.demo.MyCheckSum - Hello from MyCheckSum
101- 11:10:10.591 [main] INFO org.rrajesh1979.demo.MyCheckSum - Checksum of file hello.txt, is : 1894a19c85ba153acbf743ac4e43fc004c891604b26f8c69e1e83ea2afc7c48f
133+ jwtc encode -a=" HS512" -aud=" Hello World" -i=" rrajesh1979" -iat=true -s=" Subject" --ttl=36000
134+ 16:21:10.986 [main] INFO org.rrajesh1979.tool.JWTCEncode - Starting JWTCEncode
135+ 16:21:11.015 [main] INFO org.rrajesh1979.tool.JWTCEncode - JWT: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJTdWJqZWN0IiwiYXVkIjoiSGVsbG8gV29ybGQiLCJpc3MiOiJycmFqZXNoMTk3OSIsImV4cCI6MjU3MzY5MjE1MDg0ODExLCJpYXQiOjI1NzMzMzIxNTA4MjM1OH0.Kcnk5qBEy0BajIFzRm6RhQxxuYvd7wXodM-OGS2QD6Sw19KHQ8tpU3KVa6Fk-JrlM9YDAiC5SvYMJmmMEeisOw
136+ 16:21:11.015 [main] INFO org.rrajesh1979.tool.JWTCEncode - Secret Key: XF+okDOyZc4HgA/cOgwb7Vday3ihlR/8XFtD8Vo/4FTBV2XWVC+quTDEYFNu93QkOCS8bqvMUd6oCuCqHaFHDQ==
102137` ` `
103138
104139# # How to use
0 commit comments