Code Monkey home page Code Monkey logo

gpg-tui's Introduction

Logo

GitHub Release Crate Release Coverage Continuous Integration Continuous Deployment Docker Builds Documentation

About

gpg-tui is a Terminal User Interface for GnuPG.

It aims to ease the key management operations such as listing/exporting/signing by providing an interface along with the command-line fallback for more complex operations. It is not trying to be a full-fledged interface for all the features that gpg provides but it tries to bring a more interactive approach to key management.

Demo

gpg-tui --style colored --splash --homedir /etc/pacman.d/gnupg
Table of Contents

Requirements

  • Rust: >=1.70.0
  • Core dependencies: gnupg, gpgme>=1.12.0, libgpg-error
  • Other dependencies: libxcb

Pleases note that the name of these dependencies (packages) might change depending on the distribution/platform.(*)

For installing these dependencies:

  • on Arch Linux, run pacman -S gpgme libx11
  • on Debian/Ubuntu, run apt-get install libgpgme-dev libx11-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev
  • on Fedora, run dnf install gpgme-devel libX11-devel
  • on Void Linux, run xbps-install -S gpgme-devel libxcb-devel libgpg-error-devel gnupg

Installation

Packaging status

Packaging status

Cargo

gpg-tui is available on crates.io:

cargo install gpg-tui

Arch Linux

Community

gpg-tui can be installed from the community repository using Pacman:

pacman -S gpg-tui

AUR

gpg-tui is also available on AUR and it can be installed with an AUR helper:

paru -S gpg-tui-git

Or if you prefer, you can clone the AUR packages and compile them with makepkg:

# clone the AUR repository
git clone https://aur.archlinux.org/gpg-tui-git.git && cd gpg-tui-git/

# build the package
makepkg -si

Alpine Linux

gpg-tui is available for Alpine Edge. It can be installed via apk after enabling the community repository.

apk add gpg-tui

Gentoo

Available in dm9pZCAq overlay

eselect repository enable dm9pZCAq
emerge --sync dm9pZCAq
emerge app-crypt/gpg-tui::dm9pZCAq

Homebrew

To install the Homebrew package, run:

brew install gpg-tui

To update, run:

brew upgrade gpg-tui

Docker

Docker Hub

See available tags.

docker pull orhunp/gpg-tui:[tag]

You can also use the following command for a quick launch:

docker run --rm -it -v "$HOME/.gnupg":/app/.gnupg --user 1000:1000 orhunp/gpg-tui --homedir /app/.gnupg

Using the Dockerfile

# clone the repository
git clone https://github.com/orhun/gpg-tui.git && cd gpg-tui/

# build the image
docker build -t gpg-tui .

# run the container
docker run -it gpg-tui

FreeBSD

All required dependencies are automatically fetched and installed independently of the installation method chosen.

Building from source

# using a port
cd /usr/ports/security/gpg-tui
make install
# alternative method using portmaster
portmaster security/gpg-tui

Binary releases

# update repository catalogue (if outdated)
pkg update

# fetch and install the package
pkg install gpg-tui

NetBSD

gpg-tui is available from the main pkgsrc branch.

Install using the package manager

pkgin install gpg-tui

Building from source

cd /usr/pkgsrc/security/gpg-tui
make install

Manually

Building from source

# clone the repository
git clone https://github.com/orhun/gpg-tui.git && cd gpg-tui/

# build and install
cargo install --root "$HOME/.cargo" --path .

Binary releases

See available releases that are automated by Continuous Deployment workflow.

Usage

gpg-tui [OPTIONS]
Options:
  -a, --armor                 Enables ASCII armored output
      --splash                Shows the splash screen on startup
      --config <path>         Sets the configuration file [env: GPG_TUI_CONFIG=]
      --homedir <dir>         Sets the GnuPG home directory [env: GNUPGHOME=]
  -o, --outdir <dir>          Sets the output directory [env: OUTDIR=]
      --outfile <path>        Sets the template for the output file name [env: OUTFILE=] [default: {type}_{query}.{ext}]
  -d, --default-key <key>     Sets the default key to sign with [env: DEFAULT_KEY=]
  -t, --tick-rate <ms>        Sets the tick rate of the terminal [env: TICK_RATE=] [default: 250]
  -c, --color <color>         Sets the accent color of the terminal [env: COLOR=] [default: gray]
  -s, --style <style>         Sets the style of the terminal [env: STYLE=] [default: colored] [possible values: plain, colored]
  -f, --file-explorer <app>   Sets the utility for file selection [env: FILE_EXPLORER=] [default: xplr]
      --detail-level <level>  Sets the detail level for the keys [env: DETAIL_LEVEL=] [default: minimum] [possible values: minimum, standard, full]
      --log-file <path>       Sets the file to save the logs [env: LOG_FILE=]
      --select <option>       Enables the selection mode [env: SELECT=] [possible values: row1, row2, key, key-id, key-fingerprint, user-id]
  -h, --help                  Print help (see more with '--help')
  -V, --version               Print version

Configuration

It is possible to override the command line arguments with a configuration file.

See gpg-tui.toml for the default configuration values.

The configuration file can be specified via --config argument or GPG_TUI_CONFIG environment variable. Also, it can be placed to a location where gpg-tui looks for:

  • <config_dir> / gpg-tui.toml
  • <config_dir> / gpg-tui/gpg-tui.toml
  • <config_dir> / gpg-tui/config

<config_dir> depends on the platform as shown in the following table:

Platform Value Example
Linux $XDG_CONFIG_HOME or $HOME/.config /home/alice/.config
macOS $HOME/Library/Application Support /Users/Alice/Library/Application Support
Windows {FOLDERID_RoamingAppData} C:\Users\Alice\AppData\Roaming

Key Bindings

User Interface

Key Binding Action
? show help
o,space,enter show options
hjkl,arrows,pgkeys navigate
n switch to normal mode
v switch to visual mode
c switch to copy mode
p,C-v paste from clipboard
a toggle armored output
1,2,3 set detail level
t,tab toggle detail (all/selected)
` toggle table margin
m toggle table size
C-s toggle style
/ search
: run command
C-l,f2 show logs
r,f5 refresh application
q,C-c/d,escape quit application

Key Management

Key Binding Action
x export key
s sign key
e edit key
i import key(s)
f receive key
u send key
g generate key
d,backspace delete key
C-r refresh keys

Customization

Key bindings can be overridden/customized via using general.key_bindings setting in the configuration file. For example,

key_bindings = [
  { keys = [ "?", "h", "f1" ], command = ":help" },
  { keys = [ "C-s", "s" ], command = ":style colored" },
  { keys = [ "C-d", "C-c", "q" ], command = ":quit" },
]

keys array contains the keycodes which is either a single key (e.g. a), a key combination (e.g. Control-C: C-c, Alt-C: A-c), or a special key (e.g. Backspace, Enter). Available key codes can be found in the crossterm documentation.

Also, see the list of commands.

Approach

Available keys in the keyring (which can be specified via --homedir argument) are showed on a table. This table consists of 2 columns which are key information and user information.

The level of detail that an individual table row shows is determined by detail levels.

Detail Levels

  1. Minimum: shows only the primary key and user ID.
[sc--] rsa3072/B14085A20355B74DE0CE0FA1E19F76D037BD65B6  โ”‚  [u] Example Key <example@key>
  1. Standard: shows all the subkeys and user IDs.
[sc--] rsa3072/B14085A20355B74DE0CE0FA1E19F76D037BD65B6  โ”‚  [u] Example Key <example@key>
|      โ””โ”€(2021-05-14)                                    โ”‚   โ””โ”€[u] Other User ID <example@key>
[--e-] rsa3072/E56CAC142AE5A979BEECB00FB4F68595CAD4E7E5  โ”‚
       โ””โ”€(2021-05-14)
  1. Full: shows signatures and notations.
[sc--] rsa3072/B14085A20355B74DE0CE0FA1E19F76D037BD65B6  โ”‚  [u] Example Key <example@key>
|      โ””โ”€(2021-05-14)                                    โ”‚   โ”‚  โ””โ”€[13] selfsig (2021-05-16)
[--e-] rsa3072/E56CAC142AE5A979BEECB00FB4F68595CAD4E7E5  โ”‚   โ”‚     โ””โ”€[h] test@notation=xyz
       โ””โ”€(2021-05-14)                                    |   โ””โ”€[u] Other User ID <example@key>
                                                                   โ”œโ”€[13] selfsig (2021-05-16)
                                                                   โ””โ”€[10] 84C39331F6F85326 Other Signer Key <example@signer> (2021-05-16)

Detail level can be set using --detail-level argument or detail_level entry in the configuration file.

Key Information

An example table entry for the detail level full (which includes subkeys) is explained via reference numbers below.

[sc--]โฐ  rsa3072ยน/B14085A20355B74DE0CE0FA1E19F76D037BD65B6ยฒ
|ยณ       โ””โ”€(2021-05-14)โด
[--e-]โฐ*โถrsa3072ยน/E56CAC142AE5A979BEECB00FB4F68595CAD4E7E5ยฒ
         โ””โ”€(2021-05-14) -> (2021-05-16)โด [exp]โต

0: Key flags. Determines what the key can do.

  • s: sign
  • c: certify
  • e: encrypt
  • a: authenticate

1: Algorithm of the key.

2: Fingerprint of the key.

3: Indicates that the next key is a subkey.

4: Time information of the key:

  • creation time (Y-m-d)
  • expiration time (Y-m-d)

5: Is the key one of the following?

  • [exp]: expired
  • [rev]: revoked
  • [d]: disabled
  • [i]: invalid
  • [q]: qualified

6: Star symbol (*) is shown after key flags if the key is selected as the default signing key.

User Information

An example table entry for the detail level full (which includes other user IDs, signatures and notations) is explained via reference numbers below.

[u]โฐ Test Key <test@test>ยน
 โ”‚ยฒ  โ””โ”€[13]ยณ selfsigโด (2021-05-16)โถ
 โ”‚             โ””โ”€[h]โน test@notation=xyzโธ
 โ””โ”€[u]โฐ Test Key2 <test2@test2>ยน
        โ”œโ”€[13]ยณ selfsigโด (2021-05-16)โถ
        โ””โ”€[10]ยณ 84C39331F6F85326 Test Key 2 <[email protected]>โต (2021-05-16)โถ [!x]โท

0: Validity of the user.

  • [q]: undefined
  • [n]: never
  • [m]: marginal
  • [f]: full
  • [u]: ultimate
  • [?]: unknown

1: User ID. (name + email)

2: Indicates the next user ID.

3: Certification level of the signature.

  • [10]: no indication
  • [11]: personal belief but no verification
  • [12]: casual verification
  • [13]: extensive verification

4: Indicates that this is a self signature, whereby the users' own private key was used to sign their public key.

5: Key and user ID of the signer. (key + name + email)

6: Time information of the signature.

  • creation time (Y-m-d)
  • expiration time (Y-m-d)

7: Is the signature one of the following?

  • [exp]: expired
  • [rev]: revoked
  • [i]: invalid
  • [!x]: non-exportable

8: Notation data.

9: Flags associated with the notation data.

  • [h]: the notation data is in human readable form
  • [!]: the notation data is critical

Features

Press ? while running the terminal interface to see information about key bindings and GnuPG configuration.

User Interface

Scrolling

Use arrow or hjkl keys to scroll and navigate through lists/menus/tabs. Additionally, you can use Ctrl-Up/Down combinations or PageUp/PageDown keys to scroll to the top/bottom.

If rows are not fitting on the terminal interface, use Alt + arrow/hjkl keys to individually scroll them.

Options Menu

Most of the actions can be performed using the options menu. Simply press Enter and select what you want to do.

Copy / Paste

There's a copy mode for making it easier to copy particular values to the clipboard. To use this mode, press c followed by one of the key bindings:

  • x: Copy the exported key
  • i: Copy the key id
  • f: Copy the key fingerprint
  • u: Copy the user id
  • 1,2: Copy the content of the row

Then the value will be copied to the clipboard and the application mode will be reverted to normal.

Press ESC or n to cancel and switch to normal mode during this operation.

Instead of copying values with copy mode, you can use the visual mode which disables the mouse capture. It means that you can select/highlight the text on the interface and copy as you do normally.

visual mode can be used for other purposes such as scrolling via mouse.

Selection Mode

In the selection mode, key bindings that are responsible for showing the options menu (e.g. enter) are used for exiting the user interface and printing out the selection to the standard output. This is useful when you want to use gpg-tui in conjunction with shell commands/other tools.

For switching to the selection mode, use the --select argument as follows:

gpg-tui --select <option>

<option> might be one of the following:

  • key: Exported key
  • key-id: Key ID
  • key-fingerprint: Key fingerprint
  • user-id: User ID
  • row<n>: Contents of the nth row

For example, you can use the following shell function to encrypt a file for the selected recipient (key ID):

function encrypt() { gpg -e -r $(gpg-tui --select key-id) "$@"; }

Detailed View

Press Tab to toggle the detail level for the selected entry in the list. Number keys (e.g. 1, 2, 3) can be also used to set a specific level.

Press t to toggle the detail level for all entries in the list.

There are couple a of different modes for the size of the tables which changes the details that each entry shows. You can use the m key for switching to different modes.

Search

Press / to search for a value from the currently shown table.

File explorer

Some of the key management operations such as importing keys optionally use a file explorer utility. As default, gpg-tui uses xplr if the xplr binary is installed on the system. To change which utility is going to be used, --file-explorer argument can be used or it can be specified in the configuration file.

gpg-tui --file-explorer "fzf --color dark"

Show logs

To view the log messages, press ctrl-l. It will bring up a pane in the TUI for analyzing the logs:

This pane consists of two parts. Left is the target selector and on the right side the logging messages view scrolling up.

The target selector controls:

  • Capturing of log messages by the logger.
  • Selection of levels for display in the logging message view.

The two columns have the following meaning:

  • Code EWIDT: E stands for Error, W for Warn, and similarly Info, Debug and Trace.
    • Inverted characters (EWIDT) are enabled log levels in the view.
    • Normal characters show enabled capturing of a log level per target.
    • If any of EWIDT are not shown, then the respective log level is not captured.

This logger pane has the following key bindings and they are only activated while the logs are being shown:

Key Action
h toggles target selector widget hidden/visible
f toggle focus on the selected target only
up select previous target in target selector widget
down select next target in target selector widget
left reduce SHOWN (!) log messages by one level
right increase SHOWN (!) log messages by one level
- reduce CAPTURED (!) log messages by one level
+ increase CAPTURED (!) log messages by one level
pageup enter Page Mode and scroll approx. half page up in log history
pagedown only in page mode: scroll 10 events down in log history
escape exit page mode and go back to scrolling mode
space toggles hiding of targets, which have logfilter set to off

For saving the logs to a file, you can use the --log-file argument:

gpg-tui --log-file gpg-tui.log

RUST_LOG environment variable can be used to set the log level accordingly.

RUST_LOG=debug gpg-tui

Running commands

Every operation on the terminal interface is handled implicitly by the application-specific commands. So it's possible to do certain things by switching to command mode with pressing : and running commands. (similar to Vim)

For example,

  • :list pub -> list public keys
  • :set armor true -> enable armored output

A full list of commands can be found here.

Also you can switch between command mode and search by pressing Tab.

Key Management

List

Available keys in the keyring are listed on a table as default. They can be scrolled or the listing type (public/secret keys) can be changed by changing the tab via arrow keys.

See the approach section for more information about the meaning of the table rows.

Export

Press x to export the selected key to a file. The default output directory is $GNUPGHOME/out and can be changed by either using --homedir or --outdir argument.

Additionally, you can enable/disable armored output by pressing a.

Also, you can export the secret subkeys by using the options menu:

Sign

Press s to sign the selected key with the default secret key. This key can be specified with --default-key argument or using the options menu.

This feature uses gpg fallback and runs gpg --sign-key command.

Edit

Press e to edit the selected key.

This feature uses gpg fallback and runs gpg --edit-key command. It presents a menu that provides a list of options to change the key details. See the edit-key documentation for more information.

Import/Receive

Import operation uses a file explorer for selecting the key(s) to import. Press i to launch the file explorer (defaults to xplr), and select the key file(s) to import:

If a file explorer is not specified or installed, import operation is done by using the :import command. So press i to switch to command mode (which will automatically add the import command) and then give it your file(s) to import.

You can also import keys from clipboard using :import-clipboard command or the options menu.

Similar to import, receive operation is also done by using a command which is :receive. So press f (for fetching keys from a keyserver) and give it your key ID(s).

This feature uses gpg fallback and runs gpg --receive-keys command.

Send

Press u (for uploading to the keyserver) followed by y (for confirmation) to send the selected key to the default keyserver.

Generate

Press g to generate a new key pair.

This feature uses gpg fallback and runs gpg --full-generate-key command. It presents dialogs for all of the generation options.

Delete

Press Backspace followed by y (for confirmation) to delete the selected key from the keyring.

Refresh

Press Ctrl-y for refreshing the keyring.

This feature uses gpg fallback and runs gpg --refresh-keys command.

Styling

You can customize the look of gpg-tui to get rid of its boring and minimalistic vibe. (!)

Colors

To enable colors, you can specify a style with --style argument or press Ctrl-S while running for toggling the style. Currently, only one style is supported which is colored.

gpg-tui --style colored

If the default accent color of the interface causes problems with your theme or if you just want to change it to something more vivid, you can use --color argument to specify another color in HEX format.

gpg-tui --style colored --color 507030

To disable colors:

gpg-tui --style plain

Alternatively, you can set the NO_COLOR environment variable.

Splash screen

There is a splash screen that shows the project's logo for a couple of seconds if --splash flag is present. It's purely cosmetical.

gpg-tui --splash

To enable colors for the splash screen, use the colored style.

gpg-tui --splash --style colored

Roadmap

Platforms

gpg-tui is tested on Linux systems during the development phase. It should be tested on other platforms such as Microsoft Windows and macOS and found issues should be reported for future compatibility with these platforms.

Packaging

Packaging status

gpg-tui should be more and easily accessible for other platforms/distributions. Thus, it should be packaged for package managers such as Homebrew and APT. If you're a packager and want to contribute, feel free to submit an issue or start a discussion!

Command-Line Fallback

Some of the features of gpg-tui require the execution of the CLI program gpg in order to operate. This is due to the fact that designing a TUI for the menus that gpg already provides is redundant and time-consuming. Also, in case these menus will change in the future, it is better to rely on the gpg rather than implementing these options using GPGME. On the other hand, gpg has some commands that GPGME doesn't directly provide. (e.g --refresh-keys) So it is more convenient to utilize gpg for these cases.

The plan for the future of gpg-tui is utilizing gpg when it is necessary, depending on whether if it is more convenient for the user.

Key Management Only

gpg-tui only aims to do key management for now, although it can do much more utilizing GPGME and/or gpg. It's due to the design choice and also for setting the boundaries of the project.

Resources

About the project

External links

In the media

Contact

  • Join Matrix Room
  • Follow @gpg_tui
  • https://orhun.dev
    • Follow @orhun
    • Follow @orhunp_

Funding

If you find gpg-tui and/or other projects on my GitHub profile useful, consider supporting me on GitHub Sponsors or becoming a patron!

Support me on Patreon Support me on Patreon

License

The MIT License

Copyright

Copyright ยฉ 2021-2023, Orhun Parmaksฤฑz

gpg-tui's People

Contributors

0x61nas avatar croissong avatar dependabot[bot] avatar dm9pzcaq avatar giorgiberiashvili avatar kianmeng avatar nawok avatar orhun avatar piotrekb416 avatar pthorpe92 avatar stesser avatar timvisee avatar tonsv2 avatar torstein-eide avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gpg-tui's Issues

Allow options menu to be shown when there are no keys in the keyring

Describe the bug

It is not possible to view the options menu (with pressing Enter) when there are no keys in the keyring.

To Reproduce

Steps to reproduce the behavior:

  1. Run with --homedir $(mktemp -d) arguments
  2. Press Enter
  3. See that the options menu is not shown

Expected behavior

Options menu should be usable although there are no keys present in the keyring. (i.e. when no keys are selected)

Screenshots/Logs

None

System Information

  • OS: Arch Linux x86_64 5.14.15-arch1-1
  • Rust Version: rustc 1.58.0-nightly (ff0e14829 2021-10-31)
  • GPGME version: 1.16.0
  • GPGME engine version: 2.2.29
  • Project Version: gpg-tui 0.8.1

Additional context

Error: missing field `detail_level` for key `general` at line 25 column 1

Describe the bug

When I start gpg-tui I immediately get this message and it then exits

Error: missing field `detail_level` for key `general` at line 25 column 1

To Reproduce

Steps to reproduce the behavior:

  1. Run gpg-tui
  2. See error

Expected behavior

No error, GUI instead.

System Information

  • OS: macOS Ventura 13.2
  • Rust Version: 1.67.0
  • GPGME version: 1.18.0
  • GPGME engine version: 2.4.0
  • Project Version: 0.9.3

Update clap to v4

Is your feature request related to a problem? Please describe.

$ cargo outdated

Name           Project  Compat   Latest   Kind    Platform
----           -------  ------   ------   ----    --------
clap           3.2.23   ---      4.0.32   Normal  ---
clap_complete  3.2.5    ---      4.0.7    Normal  --

Describe the solution you'd like

Update clap and clap_complete to the latest version.

Describe alternatives you've considered
None.

Additional context
Changelog: https://github.com/clap-rs/clap/blob/master/CHANGELOG.md

Build error (failed to run custom build command)

Hi when building from source I get the following error:

[gpg-tui]$ cargo install --root "$HOME/.cargo" --path .
  Installing gpg-tui v0.8.0 (/home/jgart/gpg-tui)
    Updating crates.io index
   Compiling libgpg-error-sys v0.5.2
   Compiling libc v0.2.102
   Compiling proc-macro2 v1.0.29
   Compiling dlib v0.5.0
error: failed to run custom build command for `libgpg-error-sys v0.5.2`

Caused by:
  process didn't exit successfully: `/home/jgart/gpg-tui/target/release/build/libgpg-error-sys-73f08a0dc8fed024/build-script-build` (exit code: 1)
  --- stdout
  scanning file: /home/jgart/.cargo/registry/src/github.com-1ecc6299db9ec823/libgpg-error-sys-0.5.2/err-sources.h.in
  scanning file: /home/jgart/.cargo/registry/src/github.com-1ecc6299db9ec823/libgpg-error-sys-0.5.2/err-codes.h.in
  scanning file: /home/jgart/.cargo/registry/src/github.com-1ecc6299db9ec823/libgpg-error-sys-0.5.2/errnos.in
  cargo:generated=/home/jgart/gpg-tui/target/release/build/libgpg-error-sys-e4336f65699ff8ae/out
  cargo:rerun-if-env-changed=LIBGPG_ERROR_PREFIX
  cargo:rerun-if-env-changed=LIBGPG_ERROR_INCLUDE
  cargo:rerun-if-env-changed=LIBGPG_ERROR_LIB_DIR
  cargo:rerun-if-env-changed=LIBGPG_ERROR_LIBS
  cargo:rerun-if-env-changed=LIBGPG_ERROR_CONFIG

  --- stderr
  running: "sh" "-c" "gpg-error-config --version"
  sh: 1: gpg-error-config: not found
  command did not execute successfully, got: exit code: 127
  Error: ()
warning: build failed, waiting for other jobs to finish...
error: failed to compile `gpg-tui v0.8.0 (/home/jgart/gpg-tui)`, intermediate artifacts can be found at `/home/jgart/gpg-tui/target`

Caused by:
  build failed

Do you happen to know what I might be missing?

Allow partial configuration file where some configuration keys may be missing

Is your feature request related to a problem? Please describe.

If we create a partial configuration file where only some configuration options are defined, gpg-tui errors out on launch with a message similar to this:

Error: TOML parse error at line 1, column 1
  |
1 | [general]
  | ^^^^^^^^^
missing field `splash`

Gpg-tui currently doesn't accept a configuration file unless all configuration keys are defined.

Describe the solution you'd like

Here are some of the problems that arise from requiring the user to define all configuration keys:

  • A user might wish to retain the default configuration for most of configuration keys, and override just a few of them. It's a hassle to find out the appropriate values for every key.
    • The values identified by the user for a key may be wrong - even though they may not want to override it. This happened to me. I took default values from the man pages. However, gpg-tui was blank when it was launched. I'm still unable to figure out which key caused that.
  • If an update of gpg-tui adds a configuration key, the user will be forced to add it to the config file manually. The application won't launch without it.

The appropriate solution would be to assume default values for all keys and then allow the user to selectively override them in the config file.

Describe alternatives you've considered

One possibility is to define all the default values in a system-wide config file (somewhere in /etc or /usr/share). Read this file first. Then read the user config file (from ~/.config) and overwrite values for those variables that are defined in it.

Additional context

None

Customizable theme/colors

Is your feature request related to a problem? Please describe.

gpg-tui only supports plain and colored themes and colored theme has hardcoded colors which means they cannot be changed by the user.

Describe the solution you'd like

  • Make colors customizable with a configuration file
  • Support creating custom themes

Describe alternatives you've considered

#5 (comment)

define colorschemes using, for example, flavours.

Additional context

See #5

gpg-tui does not recognise '~" as alias for the user's home directory

Hello Orhun,

you were so kind to the feature of exporting the secret subkeys, thank you.

Trying this feature, I discovered what I deem to be a bug:
When I set a specfific homedir or outdir using something like
gpg-tui --outdir=~/anydir
I would expect gpg-tui to write the exported keys to
/home/myusername/anydir
however, it actually writes the files to
/home/myusername/~/anydir

It seems the commonly used alias '~' for /home/myusername is not "translated" as other programs do.

Regards,

failed to initialize clipboard, no suitable clipboard provider found

Describe the bug

When I use any copy command in gpg-tui, I get an error message (e) clipboard not available.
After closing gpg-tui, the following message is shown: failed to initialize clipboard, no suitable clipboard provider found

To Reproduce

Steps to reproduce the behavior:

  1. install dependencies on fedora
  2. cargo install gpg-tui
  3. start gpg-tui
  4. press c and f
  5. after the app quits: failed to initialize clipboard, no suitable clipboard provider found

Expected behavior

clipboard can be used

Screenshots/Logs

none

System Information

  • OS: Linux build38 6.6.13-100.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Jan 20 17:28:45 UTC 2024 x86_64 GNU/Linux
  • Rust Version: rustc 1.76.0 (07dca489a 2024-02-04)
  • GPGME version: 1.17.1
  • GPGME engine version: gpg (GnuPG) 2.4.0
  • Project Version: 0.10.0

Missing gpgme, package has been renamed

Describe the bug

Missing gpgme

Additional context

I believe in modern distributions, the package has been renamed to python-gpg and with it the executable file. It's no longer called gpgme. Perhaps the requirements listed are old?

RUSTSEC-2021-0119: Out-of-bounds write in nix::unistd::getgrouplist

Out-of-bounds write in nix::unistd::getgrouplist

Details
Package nix
Version 0.20.0
URL nix-rust/nix#1541
Date 2021-09-27
Patched versions ^0.20.2,^0.21.2,^0.22.2,>=0.23.0
Unaffected versions <0.16.0

On certain platforms, if a user has more than 16 groups, the
nix::unistd::getgrouplist function will call the libc getgrouplist
function with a length parameter greater than the size of the buffer it
provides, resulting in an out-of-bounds write and memory corruption.

The libc getgrouplist function takes an in/out parameter ngroups
specifying the size of the group buffer. When the buffer is too small to
hold all of the reqested user's group memberships, some libc
implementations, including glibc and Solaris libc, will modify ngroups
to indicate the actual number of groups for the user, in addition to
returning an error. The version of nix::unistd::getgrouplist in nix
0.16.0 and up will resize the buffer to twice its size, but will not
read or modify the ngroups variable. Thus, if the user has more than
twice as many groups as the initial buffer size of 8, the next call to
getgrouplist will then write past the end of the buffer.

The issue would require editing /etc/groups to exploit, which is usually
only editable by the root user.

See advisory page for additional details.

Sign/encrypt files

Is your feature request related to a problem? Please describe.

[...] I thought that there was an option to enter a file or directory within the TUI to have it encrypted. So I do think that that would be kind of neat, if somehow TUI file-managers or some option to browse files within a directory or to pass a path to the program (within the TUI) and have the option to encrypt or sign the file/directory that is entered.

[...] I think there could be some sort of configuration that would allow the user to provide a file manager that would only be used in selecting files to encrypt through gpg-tui. Incorporating fzf or something like it is also another option. Just any way to select files an encrypt them.

Describe the solution you'd like

Maybe instead of just giving the filename/path to sign/encrypt to gpg-tui, I can make this happen via options menu and use the selected key for this operation. For example, selecting an entry in the options menu like sign a file using this key will launch xplr for file selection (or any other file browsing utility, preferably specified with #5) and afterwards sign the selected file. An application command for this scenario will be present so it will be also possible to do this with the default key, without launching a file manager.

Additional context

See #27 (comment)

Support custom file name format for the exported keys

Is your feature request related to a problem? Please describe.

Right now gpg-tui uses a fixed file name for exported keys:

  • <key_type>_0x<key_id>.<ext>
    • pub_0xB928720AEC532117.asc

Making this configurable might be good in the future.

Describe the solution you'd like

Add a command-line argument for specifying the file format.

Describe alternatives you've considered

Add an entry to configuration file. (#5)

arch linux install: signature from "Orhun Parmaksฤฑz <[email protected]>" is unknown trust

Describe the bug

On installation using pacman error is recieved:
signature from "Orhun Parmaksฤฑz <[email protected]>" is unknown trust

To Reproduce

Steps to reproduce the behavior:

  1. $ sudo pacman -S gpg-tui

Expected behavior

Clean Install

Screenshots/Logs

[bdunbar@hilda ~]$ sudo pacman -S gpg-tui
resolving dependencies...
looking for conflicting packages...

Packages (1) gpg-tui-0.4.0-1

Total Installed Size: 1.59 MiB

:: Proceed with installation? [Y/n] y
:: Retrieving packages...
gpg-tui-0.4.0-1-x86_64 is up to date
(1/1) checking keys in keyring [################################################] 100%
(1/1) checking package integrity [################################################] 100%
error: gpg-tui: signature from "Orhun Parmaksฤฑz [email protected]" is unknown trust
:: File /var/cache/pacman/pkg/gpg-tui-0.4.0-1-x86_64.pkg.tar.zst is corrupted (invalid or corrupted package (PGP signature)).
Do you want to delete it? [Y/n] Y
error: failed to commit transaction (invalid or corrupted package (PGP signature))
Errors occurred, no packages were upgraded.
[bdunbar@hilda ~]$ sudo pacman -S gpg-tui
resolving dependencies...
looking for conflicting packages...

Packages (1) gpg-tui-0.4.0-1

Total Download Size: 0.62 MiB
Total Installed Size: 1.59 MiB

:: Proceed with installation? [Y/n] y
:: Retrieving packages...
gpg-tui-0.4.0-1-x86_64 637.8 KiB 1063 KiB/s 00:01 [################################################] 100%
(1/1) checking keys in keyring [################################################] 100%
(1/1) checking package integrity [################################################] 100%
error: gpg-tui: signature from "Orhun Parmaksฤฑz [email protected]" is unknown trust
:: File /var/cache/pacman/pkg/gpg-tui-0.4.0-1-x86_64.pkg.tar.zst is corrupted (invalid or corrupted package (PGP signature)).
Do you want to delete it? [Y/n] n
error: failed to commit transaction (invalid or corrupted package (PGP signature))
Errors occurred, no packages were upgraded.
[bdunbar@hilda ~]$

System Information

  • OS: [Linux 5.12.7-arch1-1 Arch LInux]

Add a configuration file

Is your feature request related to a problem? Please describe.

Having a configuration file for managing the application settings would be good in the future. (It looks like it's going to be needed anyways.)

Describe the solution you'd like

Implement a configuration file parser using config or rust-ini crates. Update the config values in the application after parsing this file.

alpinelinux UART serial - broken rendering

Describe the bug

rpi_zero:~# gpg-tui 
failed to initialize clipboard: XcbConn(ClosedParseErr)
[Nothing is shown - q closes program]

To Reproduce

run gpg-tui over the UART serial on the alpine linux version on a rpi zero.

Expected behavior

the same output after running it under tmux.

Screenshots/Logs

If applicable, add screenshots or logs to help explain your problem.

System Information

  • OS: [ alpine-rpi-3.14.0 210615]
  • Rust Version: [rustc 1.47.0]
  • GPGME version: [ gpgme-tool 1.15.1]
  • GPGME engine version: [gpg (GnuPG) 2.2.29]
  • Project Version: [e.g. 0.6.0-r0 edge repo]

Additional context

I run this on a rpi zero over the UART serial. Using tmux it works and the keys get shown.
tmux env:

TMUX=/tmp/tmux-0/default,4188,0
USER=root
SHLVL=2
HOME=/root
TERM_PROGRAM_VERSION=3.2
PAGER=less
PS1=\h:\w\$ 
LOGNAME=root
TERM=screen
LC_COLLATE=C
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.local/bin
LANG=C.UTF-8
TERM_PROGRAM=tmux
SHELL=/bin/ash
PWD=/root
CHARSET=UTF-8
TMUX_PANE=%0

env for the UART shell:

USER=root
SHLVL=1
HOME=/root
PAGER=less
PS1=\h:\w\$ 
LOGNAME=root
TERM=vt100
LC_COLLATE=C
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.local/bin
LANG=C.UTF-8
SHELL=/bin/ash
PWD=/root
CHARSET=UTF-8

Accent color got back to default value after deleting a key

Accent color got back to default value after deleting a key.

Steps to reproduce the behavior

  1. start gpg-tui
  2. select a pub key
  3. press d and y
[general]
splash = false
tick_rate = 250
color = "blue"
style = "plain"
file_explorer = "xplr"
detail_level = "minimum"
key_bindings = [
  { keys = [
    "?",
    "h",
    "f1",
  ], command = ":help" },
  { keys = [
    "C-d",
    "C-c",
    "q",
  ], command = ":quit" },
]

[gpg]
armor = false
homedir = "~/.gnupg"
outdir = "~/.gnupg/out"
outfile = "{type}_{query}.{ext}"
default_key = ""

System Information

  • OS: Arch Linux 6.0.17-hardened1-1-hardened
  • Rust Version: rustc 1.64.0-nightly (6dbae3ad1 2022-07-25)
  • gpg (GnuPG) 2.2.40
  • gpg-tui 0.9.2 (paru -S pgp-tui-git)

when editing a key, one cpu core is 100% with gpg-tui

Describe the bug

When using gpg-tui and editing a key (keybind e), then gpg-tui uses one core 100% at least until editing is done

To Reproduce

Steps to reproduce the behavior:

  1. i ran it with ./gpg-tui -a --style colored
  2. select an key (in my case it is this one, directly after import curl https://github.com/web-flow.gpg | gpg --import)
  3. press e to edit the key
    3.5. i dont know if it matters, but i saw the usage only after already having also enteredtrust (as seen in the screenshot)
  4. look at htop (in my case its btm) or whatever and see that gpg-tui uses one core to 100%
    4.5 after entering an trust level and saving (exiting gpg), gpg-tui cpu usage goes back to normal

Expected behavior

that gpg-tui does not use one core to 100%

Screenshots/Logs

btm:
Screenshot from 2021-07-20 12-37-41

gpg-tui:
Screenshot from 2021-07-20 12-43-05

System Information

  • OS: Linux Mint 20.2
  • Rust Version: rustc 1.53.0 (53cb7b09b 2021-06-17)
  • GPGME version: 1.13.1-unknown
  • GPG version: gpg (GnuPG) 2.2.19 libgcrypt 1.8.5
  • Project Version: gpg-tui 0.7.1 (git head e0df8602b83e1bb1f02dcbaeb101b09b43f5713d)
  • CPU: Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz

Additional context

Project was self compiled with e0df8602b83e1bb1f02dcbaeb101b09b43f5713d as git head and compiled with cargo build --release (nothing else modified)

Add a panic hook to reset terminal upon panic

Is your feature request related to a problem? Please describe.

When an unexpected error happens, the terminal is messed up.

Describe the solution you'd like

Add a custom panic hook. See: ratatui-org/templates#13

The code changes on this PR will add a panic hook, so if a problem happens and the program panics, before the program closes it will run the code inside the panic hook that will leave alternate screen and disable raw mode. This way, you won't have your terminal messed up if an unexpected error happens.

Describe alternatives you've considered

None.

Additional context

The implementation might be the same as the linked pull request above.

Problem building on Debian Testing

Describe the bug

Build fails on Debian Testing/Bookworm

To Reproduce

Steps to reproduce the behavior:

  1. git clone https://github.com/orhun/gpg-tui.git && cd gpg-tui
  2. cargo build
  3. Build finishes with error error: argument for `--edition` must be one of: 2015|2018. (instead was `2021`)

Expected behavior

Successfull build

System Information

  • OS: Debian Bookworm
  • Rust Version: rustc 1.50.0
  • GPGME version: 1.16.0-unknown
  • GPGME engine version: 2.2.27
  • Project Version: master

Additional context

I saw that the Rust edition of Debian Testing is not the edition inside Cargo.toml. However, when I change the edition inside Cargo.toml I get a compilation error:

   Compiling gpg-tui v0.8.1 (/home/sam/git/gpg-tui)
error[E0277]: `[&str; 2]` is not an iterator
 --> src/app/util.rs:8:10
  |
8 |             .args(["/C", cmd])
  |                   ^^^^^^^^^^^
  |                   |
  |                   expected an implementor of trait `IntoIterator`
  |                   help: consider borrowing here: `&["/C", cmd]`
  |
  = note: the trait bound `[&str; 2]: IntoIterator` is not satisfied
  = note: required because of the requirements on the impl of `IntoIterator` for `[&str; 2]`

error[E0277]: `[&str; 2]` is not an iterator
  --> src/app/util.rs:13:10
   |
13 |             .args(["-c", cmd])
   |                   ^^^^^^^^^^^
   |                   |
   |                   expected an implementor of trait `IntoIterator`
   |                   help: consider borrowing here: `&["-c", cmd]`
   |
   = note: the trait bound `[&str; 2]: IntoIterator` is not satisfied
   = note: required because of the requirements on the impl of `IntoIterator` for `[&str; 2]`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `gpg-tui` due to 2 previous errors

It would an advantage for the project it if would be buildable on a recent Debian Testing environment. I guess I could download the most recent rust compiler and try to build it again, but maybe there is an easier way? In any case appreciate the work on this tool, it removes a lot of googling gpg flags from my life, thanks ;)

Switch to `ratatui`

Is your feature request related to a problem? Please describe.

ratatui is the actively maintained fork of tui-rs and it would be nice to switch to it.

Describe the solution you'd like

Update Cargo.{toml,lock} according to the instructions.

Describe alternatives you've considered

None.

Additional context

ratatui had a new release recently and there is a bug fix release on the way. It would be nice to wait until ratatui-org/ratatui#110 is merged.

Support changing the default file explorer

Is your feature request related to a problem? Please describe.

It should be possible to change the file explorer utility (default: xplr) with using the configuration file.

Describe the solution you'd like

Add an option to configuration file for setting the command to run for file selection.

Describe alternatives you've considered

Add a command line argument, e.g. --file-explorer "xplr"

Additional context

See #5

Notation support

Is your feature request related to a problem? Please describe.

Notations are a way to add simple custom data to a key/signature. Keyoxide makes extensive use of them to add identity claims to OpenPGP keys (example). Currently, gpg-tui does not display notations or allow notaton management through its interface.

Describe the solution you'd like

It would be great if gpg-tui could display the notations stored inside keys and provide shortcuts to add/delete notations.

Describe alternatives you've considered

Not applicable.

Additional context

As maintainer of Keyoxide, I am always looking for ways/tools to make cryptographic key management easier. I will start recommending this project to people inexperienced with GPG. If this project were to support notations, that would make this great tool even greater for usage with Keyoxide.

RUSTSEC-2022-0048: xml-rs is Unmaintained

xml-rs is Unmaintained

Details
Status unmaintained
Package xml-rs
Version 0.8.4
URL https://github.com/netvl/xml-rs/issues
Date 2022-01-26

xml-rs is a XML parser has open issues around parsing including integer
overflows / panics that may or may not be an issue with untrusted data.

Together with these open issues with Unmaintained status xml-rs
may or may not be suited to parse untrusted data.

Alternatives

See advisory page for additional details.

Setting `gpg-tui --select key_id` to a variable doesn't load

Wanting to try and use gpg-tui in scripts or with neomutt and when attempting to do something like the following:

key=$(gpg-tui --select key_id)

The screen to select never loads. I can do this in either a script or just in the shell and it doesn't work. If I do not set it to a variable it works just fine.

Edit: If I do the same as above and set it to a variable, then I click enter (no screen present to select a key), the program quits stalling. Then when printing the variable it was set to does print out a key_id, I was just never able to visually select it.

System Information (if useful):

uname -a
Darwin void.local 20.5.0 Darwin Kernel Version 20.5.0: Sat May  8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64 x86_64 i386 MacBookPro14,1 Darwin

echo $SHELL
/usr/local/bin/zsh

echo $ZSH_VERSION
5.8

Terminal: iTerm2

RUSTSEC-2021-0019: Multiple soundness issues

Multiple soundness issues

Details
Package xcb
Version 0.9.0
URL rustsec/advisory-db#653
Date 2021-02-04

Calls std::str::from_utf8_unchecked() without any checks

The function xcb::xproto::GetAtomNameReply::name() calls
std::str::from_utf8_unchecked() on the raw bytes that were received from the
X11 server without any validity checks. The X11 server only prevents interior
null bytes, but otherwise allows any X11 client to create an atom for arbitrary
bytes.

This issue is tracked here: https://github.com/rtbo/rust-xcb/issues/96

xcb::xproto::GetPropertyReply::value() allows arbitrary return types

The function xcb::xproto::GetPropertyReply::value() returns a slice of type
T where T is an unconstrained type parameter. The raw bytes received from
the X11 server are interpreted as the requested type.

The users of the xcb crate are advised to only call this function with the
intended types. These are u8, u16, and u32.

This issue is tracked here: https://github.com/rtbo/rust-xcb/issues/95

Out of bounds read in xcb::xproto::change_property()

xcb::xproto::change_property has (among others) the arguments format: u8 and
data: &amp;[T]. The intended use is one of the following cases:

  • format = 8 and T = u8
  • format = 16 and T = u16
  • format = 32 and T = u32
    However, this constraint is not enforced. For example, it is possible to call
    the function with format = 32 and T = u8. In this case, a read beyond the
    end of the data slice is performed and the bytes are sent to the X11 server.

The users of the xcb crate are advised to only call this function with one of
the intended argument combinations.

This issue is tracked here: https://github.com/rtbo/rust-xcb/issues/94

'Safe' wrapper around std::mem::transmute()

The function xcb::base::cast_event() takes a reference to a
xcb::base::GenericEvent and returns a reference to an arbitrary type, as
requested by the caller (or found via type interference). The function is
implemented as a direct call to std::mem::transmute(). Since the return type
is not constrained, this allows transmution to an incorrect type or a type that
is larger than the X11 event that was passed in.

X11 events are mostly always 32 bytes large and this function works as intended.

Users are advised to only cast to the event structs provided by the xcb crate
(and hope for the best).

This issue is tracked here: https://github.com/rtbo/rust-xcb/issues/78

See advisory page for additional details.

Void linux dependency commands

Is your feature request related to a problem? Please describe.

No commands for void linux

Describe the solution you'd like

Adding the dependency install instructions like below.

xbps-install -S gpgme-devel libxcb-devel libgpg-error-devel gnupg

libgpg-error-config error during build()

Describe the bug

on arch, cannot build the git version, libgpg-error-config error during build()

Screenshots/Logs

   Compiling nom v7.1.1
   Compiling num-traits v0.2.15
   Compiling wayland-client v0.29.4
   Compiling wayland-protocols v0.29.4
error: failed to run custom build command for `libgpg-error-sys v0.5.2`

Caused by:
  process didn't exit successfully: `/home/pbo/.cache/yay/gpg-tui-git/src/gpg-tui/target/release/build/libgpg-error-sys-1a341c50b8a6f2da/build-script-build` (exit status: 1)
  --- stdout
  scanning file: /home/pbo/.cargo/registry/src/github.com-1ecc6299db9ec823/libgpg-error-sys-0.5.2/err-sources.h.in
  scanning file: /home/pbo/.cargo/registry/src/github.com-1ecc6299db9ec823/libgpg-error-sys-0.5.2/err-codes.h.in
  scanning file: /home/pbo/.cargo/registry/src/github.com-1ecc6299db9ec823/libgpg-error-sys-0.5.2/errnos.in
  cargo:generated=/home/pbo/.cache/yay/gpg-tui-git/src/gpg-tui/target/release/build/libgpg-error-sys-5be8d7e504f3697f/out
  cargo:rerun-if-env-changed=LIBGPG_ERROR_PREFIX
  cargo:rerun-if-env-changed=LIBGPG_ERROR_INCLUDE
  cargo:rerun-if-env-changed=LIBGPG_ERROR_LIB_DIR
  cargo:rerun-if-env-changed=LIBGPG_ERROR_LIBS
  cargo:rerun-if-env-changed=LIBGPG_ERROR_CONFIG

  --- stderr
  running: "sh" "-c" "gpg-error-config --version"
  sh: line 1: gpg-error-config: command not found
  command did not execute successfully, got: exit status: 127
  Error: ()
warning: build failed, waiting for other jobs to finish...
==> ERROR: A failure occurred in build().
    Aborting...
 -> error making: gpg-tui-git

System Information

  • OS: [e.g. Arch Linux x86_64 5.12.1-arch1-1]
    arch x86_64 6.0.10-zen2-1-zen
  • Rust Version: [e.g. 1.54.0-nightly]
    rustc 1.65.0 (Arch Linux rust 1:1.65.0-1)
  • GPGME version: [e.g 1.15.1]
    1.18.0
  • GPGME engine version: [e.g. 2.2.27]
    gpg (GnuPG) 2.2.40
    libgcrypt 1.10.1-unknown
  • Project Version: [e.g. 0.1.0]
    git

NIST, Brainpool, & secp algorithms display as unrecognized

Describe the bug

Keys that use any NIST, Brainpool, or secp as their algorithm display as "unrecog".

To Reproduce

Steps to reproduce the behavior:

  1. Run command gpg --full-gen-key --expert
  2. Press key '9'
  3. Select any NIST, Brainpool, or secp algorithm
  4. Follow key generation instructions untill gpg key is generated
  5. Open gpg-tui, see that the newly generated key has the algorithm set to "unrecog"

Expected behavior

gpg-tui should be displaying these key's algorithm, since they're supported by gpg (and gpg-tui does support curve25519)

Screenshots/Logs

image

System Information

  • OS: Arch Linux x86_64 6.5.9-arch2-1
  • Rust Version: rustc 1.71.1 (eb26296b5 2023-08-03)
  • GPGME version: I'm unable to install gpgme-config to check (idk why)
  • GPGME engine version: 2.2.41
  • Project Version: 0.10.0

Error installing via cargo: could not compile `anyhow`

Describe the bug

Error during installment via cargo

To Reproduce

Steps to reproduce the behavior:

  1. Install the dependencies as specified in the readme
  2. Run cargo install gpg-tui
  3. See error

Expected behavior

A correctly installed application

Screenshots/Logs

...
   Compiling dlib v0.4.2
   Compiling rust-embed-utils v5.1.0
   Compiling quote v1.0.9
error[E0433]: failed to resolve: could not find `addr_of` in `ptr`
   --> /home/maxime/.cargo/registry/src/github.com-1ecc6299db9ec823/anyhow-1.0.40/src/error.rs:606:14
    |
606 |         ptr::addr_of!((*unerased.as_ptr())._object) as *mut E,
    |              ^^^^^^^ could not find `addr_of` in `ptr`

error[E0433]: failed to resolve: could not find `addr_of` in `ptr`
   --> /home/maxime/.cargo/registry/src/github.com-1ecc6299db9ec823/anyhow-1.0.40/src/error.rs:647:22
    |
647 |                 ptr::addr_of!((*unerased.as_ptr())._object) as *mut E,
    |                      ^^^^^^^ could not find `addr_of` in `ptr`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0433`.
error: could not compile `anyhow`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: failed to compile `gpg-tui v0.1.4`, intermediate artifacts can be found at `/tmp/cargo-installCxoCzV`

Caused by:
  build failed

System Information

  • OS: Void Linux x86_64 5.11.22_1
  • rustc 1.51.0-nightly (6184f2395 2021-01-09)
  • GPGME version: 1.15.1
  • GPGME engine version: 2.2.27
  • Project Version: -

Add logging option

Is your feature request related to a problem? Please describe.

There may be the case, that the gpg setup or keyring causes problems within gpg-tui. Without any visible output such an issue can be difficult to pinpoint.
See for example #135

Describe the solution you'd like

An option or cli argument which enables some sort of logging. With this enabled gpg-tui provides information what it is doing behing the scenes and may help to pinpoint issues.

Possible implementation can look like this

Describe alternatives you've considered

There is no real alternative? STDERR output directly into the terminal isn't viable with a ncurses TUI.

RUSTSEC-2020-0071: Potential segfault in the time crate

Potential segfault in the time crate

Details
Package time
Version 0.1.44
URL time-rs/time#293
Date 2020-11-18
Patched versions >=0.2.23
Unaffected versions =0.2.0,=0.2.1,=0.2.2,=0.2.3,=0.2.4,=0.2.5,=0.2.6

Impact

Unix-like operating systems may segfault due to dereferencing a dangling pointer in specific circumstances. This requires an environment variable to be set in a different thread than the affected functions. This may occur without the user's knowledge, notably in a third-party library.

The affected functions from time 0.2.7 through 0.2.22 are:

  • time::UtcOffset::local_offset_at
  • time::UtcOffset::try_local_offset_at
  • time::UtcOffset::current_local_offset
  • time::UtcOffset::try_current_local_offset
  • time::OffsetDateTime::now_local
  • time::OffsetDateTime::try_now_local

The affected functions in time 0.1 (all versions) are:

  • at
  • at_utc
  • now

Non-Unix targets (including Windows and wasm) are unaffected.

Patches

Pending a proper fix, the internal method that determines the local offset has been modified to always return None on the affected operating systems. This has the effect of returning an Err on the try_* methods and UTC on the non-try_* methods.

Users and library authors with time in their dependency tree should perform cargo update, which will pull in the updated, unaffected code.

Users of time 0.1 do not have a patch and should upgrade to an unaffected version: time 0.2.23 or greater or the 0.3 series.

Workarounds

No workarounds are known.

References

time-rs/time#293

See advisory page for additional details.

Show keygrips

Discussed in #48

Originally posted by dievilz October 12, 2022
I would love to see the keygrips inside the TUI. That way, I think this program would be even more efficient than already is, at least for me ๐Ÿค˜๐Ÿป. And include the respective setting in the config. file too.
I don't think this feature is implemented and I don't know if it is out of scope, but still I'll make the request ๐Ÿ˜….
I would love to contribute and make a pull request but sadly I know nothing about Rust :c

RUSTSEC-2021-0139: ansi_term is Unmaintained

ansi_term is Unmaintained

Details
Status unmaintained
Package ansi_term
Version 0.12.1
URL ogham/rust-ansi-term#72
Date 2021-08-18

The maintainer has adviced this crate is deprecated and will not
receive any maintenance.

The crate does not seem to have much dependencies and may or may not be ok to use as-is.

Last release seems to have been three years ago.

Possible Alternative(s)

The below list has not been vetted in any way and may or may not contain alternatives;

See advisory page for additional details.

Improve file selection

Is your feature request related to a problem? Please describe.

It's not really convenient to type in the filename in the prompt while e.g. importing keys.

Describe the solution you'd like

Integrating command-line tools like fzf or xplr would be good in this case since they can aid with the selection of a file.

Set default views in the config file

Discussed in #43

Originally posted by dievilz August 16, 2022
It would be nice if I could set in the config file, let's say, a detail level of 3 (full details) for all keys (not just the one selected) for both public and secret keys, as default every time I use the program.

TUI exits on gpg command abort

Describe the bug

rec

To Reproduce

Steps to reproduce the behavior:

  1. Run with any arguments
  2. Press g (generate key)
  3. When gpg is waiting for input, press Ctrl-C
  4. See that TUI is not resuming and exited

Expected behavior

gpg-tui should continue working after aborting a gpg command.

System Information

  • OS: [e.g. Arch Linux x86_64 5.12.7-arch1-1]
  • Rust Version: [e.g. 1.54.0-nightly]
  • GPGME version: [e.g 1.15.1]
  • GPGME engine version: [e.g. 2.2.27]
  • Project Version: [e.g. 0.1.3]

Additional context

If you press e and see gpg --edit-key command is ran, you can abort gpg and resume TUI via typing q or quit.

Add `--select` option

Is your feature request related to a problem? Please describe.

It'd be nice to have an option such as --select for selecting a key using gpg-tui. It can be used in conjunction with other commands/tools.

e.g.

key=$(gpg-tui --select)

Describe the solution you'd like

When --select is used, print out the selected key on Enter key press instead of launching the options menu.

Describe alternatives you've considered

Maybe --select-key would be more explanatory for such a command-line argument.

Additional context

A menu entry can be created for selecting a key. But it will be only shown when --select is not present.

Support importing keys from the clipboard

Is your feature request related to a problem? Please describe.

Import operation requires a file that contains the keys. It should also support importing keys using the clipboard.

Describe the solution you'd like

We can add :import-clipboard command or something similar to get the clipboard contents and try to import it.

Describe alternatives you've considered

Add an import mode and specify the way to import things. e.g. pressing i -> f will result in importing a key from a file while i -> p will use the clipboard. (similar to copy mode)

Add menu for `gpg --edit-key`

Is your feature request related to a problem? Please describe.

Having a menu similar to the options menu for gpg --edit-key can save us some time since it doesn't require typing out the operation name in the gpg menu.

Describe the solution you'd like

Look for the commands that have shortcuts in edit-key menu, create a menu for them which is displayed by pressing a key, and run the corresponding commands on selection.

e.g. gpg --show-photos

Add command/keyboard shortcut for --export-secret-subkeys

Part of my workflow is having 2 keyrings:

  • main keyring with all subkeys, used for signing other keys, only on a single machine.
  • keyring with primary secret subkey keys stripped, used for everyday things like en-/decrypting, signing mails etc.

All my own keys do have a 2nd subkey used for signing mails. A few keys of the 2nd keyring do end up being present more than one of my devices...

gpg supports this workflow with the --export-secret-subkeys command, exporting keys with secret part of the primary key stripped. It would be nice if that command would be added to gpg-tui, as well.

Regards,

Remappable key bindings

Is your feature request related to a problem? Please describe.

Making the key bindings configurable is always a plus for the user experience.

Describe the solution you'd like

First, create a struct for the key bindings and update the rest of the application to use this struct while handling the key presses.
Next, add a section to the configuration file (#5) for custom key bindings, and parse them into the struct that is mentioned earlier.

RUSTSEC-2020-0159: Potential segfault in `localtime_r` invocations

Potential segfault in localtime_r invocations

Details
Package chrono
Version 0.4.19
URL chronotope/chrono#499
Date 2020-11-10

Impact

Unix-like operating systems may segfault due to dereferencing a dangling pointer in specific circumstances. This requires an environment variable to be set in a different thread than the affected functions. This may occur without the user's knowledge, notably in a third-party library.

Workarounds

No workarounds are known.

References

See advisory page for additional details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.