Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow base64 encoded bytes as argument to --secret #144

Merged
merged 6 commits into from
Sep 28, 2021

Conversation

ceharris
Copy link
Contributor

@ceharris ceharris commented Sep 16, 2021

Summary

To simplify use in scripted applications, this PR adds a new b64: format prefix for the --secret argument, to allow the secret to be specified as base64-encoded bytes.

The same outcome can be achieved by writing the bytes of the key to a file and using --secret @filename, but directly supporting base64 avoids the need to write the key to a file.

Example

jwt encode --secret "b64:CFP7qWsQP/oHNj+i+mxpEf/iYzmlweFHwonE4nlUCtA="

N.B. -- this is my first experience contributing to a Rust-based project.

Copy link
Owner

@mike-engel mike-engel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ceharris Thanks for the PR, and congrats on your first contribution to a rust project! Just a few notes, otherwise I think this PR is a good addition!

src/main.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
@ceharris ceharris changed the title Provide option to allow --secret argument be interpreted as base64-encoded bytes Allow base64 encoded bytes as argument to --secret Sep 17, 2021
Copy link
Owner

@mike-engel mike-engel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the review delay @ceharris! Just a few notes for the tests, otherwise this looks great!

tests/jwt-cli.rs Outdated Show resolved Hide resolved
tests/jwt-cli.rs Outdated Show resolved Hide resolved
@mike-engel mike-engel merged commit 65afd8c into mike-engel:main Sep 28, 2021
@mike-engel
Copy link
Owner

Thanks again for this @ceharris! There are a few other breaking changes on main, and I'm discussing a few other open PRs with potentially breaking changes. Once those are resolved/merged, this will be released!

@ceharris ceharris deleted the base64-secret branch September 29, 2021 19:04
@ceharris
Copy link
Contributor Author

Thanks to you for making jwt-cli! Happy to contribute a little...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants