mike-engel / jwt-cli

A super fast CLI tool to decode and encode JWTs built in Rust
MIT License
1.11k stars 68 forks source link

Add support for TTL when generating JWTs #268

Closed stephent closed 1 year ago

stephent commented 1 year ago

Thanks for this tool! It would be great to be able to use a --ttl option, instead of -exp, to specify the number of seconds in which the new token should expire relative to current system time, e.g.

jwt encode '{ "tokenIsvalidFor": "15 minutes }' --ttl=900 --secret=[SECRET]
rostamn739 commented 1 year ago

You mean something like this?

https://github.com/mike-engel/jwt-cli/compare/main...rostamn739:jwt-cli:main

rostamn739 commented 1 year ago

Or you could just give a valid 'duration' string to the exp аrgument as with current code, it will work

stephent commented 1 year ago

Ah ok - didn't get that from the docs, but that's perfect.