summaryrefslogtreecommitdiff
path: root/cli.go
AgeCommit message (Collapse)Author
2024-06-22all: implement command "export"Shulhan
The "export" command export all issuers to file or standard output, $ gotp export <FORMAT> [FILE] List of known supported FORMAT is: uri. If FILE is not defined it will print to standard output. The list of exported issuers are printed in order of its label.
2024-03-26all: replace module "share" with "pakakeh.go"Shulhan
The "share" module has been moved to moved from github, to sourcehut.
2024-02-21Convert base32 encoded hash to upper caseBalki
2024-01-30cli: ask for passphrase when removing or renaming labelShulhan
Even though rename does not read the encrypted secret, as long as the private key is in use, it should ask for passphrase. The remove operation allow only the one that know the private key can modify the issuer.
2024-01-30all: use [lib/crypto.LoadPrivateKeyInteractive]Shulhan
The lib/crypto.LoadPrivateKeyInteractive provides a simple way to read passphrase from stdin that also support SSH_ASKPASS. While at it, add test for Cli with passphrase.
2024-01-29cli: simplify ImportShulhan
Check for valid provider name and parse the imported file before loading private key.
2024-01-28all: make the path to private key staticShulhan
Instead of prompting user, make the private key static, located at "$XDG_CONFIG_DIR/gotp/gotp.key". Implements: https://todo.sr.ht/~shulhan/gotp/1
2023-10-06all: implement command "get"Shulhan
The "get" command get and print the issuer by its LABEL. This will print the issuer secret, unencrypted.
2023-10-06all: pass the configuration directory parameter to NewCliShulhan
Previously, the configuration directory initialized inside NewCli. This changes we make the NewCli accept the config directory so we can changes it during testing.
2023-10-06all: add task linter and fix all warningsShulhan
We use revive [1], fieldalignment [2], and shadow [3] as linters. [1] https://github.com/mgechev/revive [2] https://pkg.go.dev/golang.org/x/tools@v0.13.0/go/analysis/passes/fieldalignment/cmd/fieldalignment [3] https://pkg.go.dev/golang.org/x/tools@v0.13.0/go/analysis/passes/shadow/cmd/shadow
2023-05-19all: load private key only when neededShulhan
In case the configuration use private key with passphrase, the bash completion will hang due to the command ask for passphrase. This changes fix this issue by loading private key only when doing add, generate, import, or remote-private-key.
2023-05-16all: add command to remove the private keyShulhan
The remove-private-key decrypt the issuer's value back using previous private key and store it back to file as plain text.
2023-05-16all: add command to set private keyShulhan
The set-private-key command encrypt the issuer's value (hash:secret...) in the file using private key. The supported private key is RSA.
2023-05-15all: load the private key in loadConfigShulhan
This changes require the loadPrivateKey method detached from Cli and become function.
2023-05-15all: convert the README from asciidoc to markdownShulhan
I use two remote repositories: GitHub and SourceHut. GitHub support rendering README using asciidoc while SourceHut not. This cause the repository that use README.adoc rendered as text in SourceHut which make the repository page less readable. Also, the pkg.go.dev now render README but only support Markdown. Since we cannot control the SourceHut and go.dev, the only option is to support converting Markdown in ciigo so I can write README using Markdown and the rest of documentation using Asciidoc.
2022-08-27all: fix the go:embed reference to symbolic linkShulhan
Due to previous commit, where we rename the README.adoc to README, and change it to symbolic link, the build then failed when doing go:embed.
2022-08-07all: replace golang.org/x/crypto/ssh/terminal with golang.org/x/termShulhan
The golang.org/x/crypto/ssh/terminal has been deprecated.
2022-08-07all: clean up codeShulhan
Changes, * Replace variable declaration ":=" using explicit one * Use raw string literal whenever possible * Realign struct Config from 56 to 40 bytes (-16 bytes) * Realign struct Issuer from 88 to 72 bytes (-16 bytes)
2022-08-06all: fix base32 decoding on secretShulhan
The base32 decoding should be without padding otherwise it will return an error (for some base32 string): illegal base32 data at input byte 48
2022-03-14all: re-licensing gotp under GPL-3.0 or laterShulhan
See https://kilabit.info/journal/2022/gpl/ for more information.
2021-10-27gotp: command line interface for Time-based One Time Password (TOTP)Shulhan
The gotp currently has the following features, * add: add new TOTP issuer with their label and secret * gen: generate password * import: import TOTP from other provider, currently support Aegis * list: print all registered TOTP configuration by labels * remove: delete a TOTP configuration from file by label * rename: changes the TOTP configuration by its label