Skip to content

Add key removal, configurable hash algorithms, and improve error handling - #42

Open
dgrieser wants to merge 3 commits into
rsc:masterfrom
dgrieser:feat/remove-key-and-hash-algo-support
Open

dgrieser wants to merge 3 commits into
rsc:masterfrom
dgrieser:feat/remove-key-and-hash-algo-support

Conversation

@dgrieser

Copy link
Copy Markdown

Love you tool, so I thought I contribute.

  • Add -hash flag to 2fa -add to select SHA-1, SHA-256, or SHA-512.
    The algorithm is stored in the keychain for generation.
  • Add -remove flag to delete keys from the keychain.
    Removal is implemented via atomic file rename to prevent corruption.
  • Update keychain parsing to handle optional hash algorithm field.
  • Add comprehensive tests for HOTP/TOTP with different hashes, keychain
    reading, and key removal.
  • Update vendor dependencies (clipboard) for Wayland and Termux support.

- Add `-remove` flag to delete keys from the keychain.
Removal is implemented via atomic file rename to prevent corruption.
- Add `-hash` flag to `2fa -add` to select SHA-1, SHA-256, or SHA-512.
The algorithm is stored in the keychain for generation.
- Update keychain parsing to handle optional hash algorithm field.
- Add comprehensive tests for HOTP/TOTP with different hashes, keychain
reading, and key removal.
- Update module path to github.com/dgrieser/2fa.
- Update vendor dependencies (clipboard) for Wayland and Termux support.
Update github.com/atotto/clipboard to v0.1.4. This version includes support for Plan 9, fixes Windows clipboard deadlocks by locking OS threads, and adds PowerShell support on Windows.

Replace deprecated ioutil functions in main.go with os package equivalents. Update module path to rsc.io/2fa.
- Handle errors from file chmod operations to prevent silent failures
- Ignore cleanup errors during removal to avoid masking primary failure logs
- Gracefully handle clipboard write errors instead of panicking
- Suppress binary write error return in HOTP generation as it is unlikely to fail
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.

1 participant