Skip to content

fuyu0425/keepass-cli-rs

Repository files navigation

KeePass CLI with Emacs Integration

Why KeePass

  • I don’t want to pay for password managers anymore. Especially most of them are subscription-based. I argue that having a password manager is basic human right in 21st century, and it should be free and accessible to everybody.
  • GNU Pass is good, but it’s hard to interact with it outside of terminal.

Why New CLI

  • UI/UX of keepassxc-cli is not friendly.
    • keepassxc-cli can only list the title of entry. However, only showing the title might not be enough in some cases. Even worse, there might be entries with the exact same title.
  • Need to parse CLI output to get the information we want.
  • Above reasons make it really difficult to develop a good Emacs package to retrieve passwords.

Feature

  • List the entries with user-specified fields keepass-cli -d <DATABSE> ls -f title username
  • Server mode keepass-cli -d <DATABASE> server --emacs
  • Emacs integration uses pure completing-read, so you can use any completion engine you want.

Restriction/Warning

  • It’s read only! Please use official CLI to add/remove/edit entries/download icons.
  • It’s only used/tested by me now.

Note

The icon data is saved in the project directory, which is different between operating systems.

For example, on macOS, the directory is ~/Library/Application Support/keepass-cli.

The directory path is generate by the following code from directories crate. Please refer to it to find your path.

ProjectDirs::from("", "", "keepass-cli")

Goal

Download

git clone --recursive https://github.com/fuyu0425/keepass-cli-rs

Installation

CLI binary

cargo install --path .

Emacs integration

Required package: s, dash, hydra

(add-to-list 'load-path "/Users/fuyu0425/project/github/keepass-cli-rs/")
(require 'keepass)
(setq keepass-database "/Users/fuyu0425/keepass/keepass.kdbx")
(keepass-make-hydra-favorite
 ("t" "test")
 ("o" "totp seed"))
;; for spacemacs with SPC a k
(spacemacs/set-leader-keys
  "ak" 'keepass-inplace)

There are two functions: keepass and keepass-inplace. keepass will switch to a special buffer keepass:main. keepass-inplace will not.

Please refer to the source code to find what you can customize.

Screenshots for Emacs integration

Interface

./screenshots/keepass-inplace.png

Select Entries

./screenshots/keepass-select.png

Favorite Entries

./screenshots/keepass-favorite.png

Contribution

I have listed some TODOs in TODOs.org. Welcome PR and discussion.

Credit

About

KeePass client written in Rust with Emacs integration

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published