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

Add --format option and base32 support for otp set #49

Closed
wants to merge 4 commits into from

Conversation

robinkrahl
Copy link
Collaborator

No description provided.

This patch introduces the -f, --format options for the otp set
subcommand to specify the format of the OTP secret.  Previously, the
default format as hex and ASCII format could be selected using the
--ascii option.  The new --format option takes the argument hex or
ascii, defaulting to hex, and replaces the --ascii option.

This patch does not remove the --ascii option but marks it as
deprecated.  It may not be set together with --format, and a warning is
printed if it is set.  It should be deleted with the next minor release.

This patch prepares the addition of a new format, base32.
This patch refactors the prepare_secret function by renaming it to
prepare_ascii_secret and by moving the formatting of a bytes slice as a
hex string into the format_bytes function.  This prepares for adding a
the base32 format in a future patch.
To parse OTP secrets in base32 representation, we need a new dependency:
the base32 crate.
Many applications display OTP secrets in the base32 format (according to
RFC 4648).  This patch adds this base32 as possible value for the
--format option for the otp set subcommand.
@d-e-s-o
Copy link
Owner

d-e-s-o commented Jan 6, 2019

Thanks for implementing this functionality so quickly, Robin! I plan to look at this pull request first thing tomorrow.

@d-e-s-o d-e-s-o self-assigned this Jan 6, 2019
@d-e-s-o
Copy link
Owner

d-e-s-o commented Jan 6, 2019

Looks great as usual, @robinkrahl . Merged into devel.

@d-e-s-o d-e-s-o closed this Jan 6, 2019
@robinkrahl
Copy link
Collaborator Author

Thanks for merging and adding the dependencies!

@robinkrahl robinkrahl deleted the wip/format-option branch January 20, 2019 23:16
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