12 releases (breaking)

0.8.0 Jan 3, 2026
0.6.2 Jan 3, 2026
0.6.0 Nov 3, 2024
0.5.0 Aug 28, 2021
0.1.0 Jan 30, 2020

#151 in Authentication

Download history 1006/week @ 2025-12-14 559/week @ 2025-12-21 436/week @ 2025-12-28 1335/week @ 2026-01-04 889/week @ 2026-01-11 869/week @ 2026-01-18 1422/week @ 2026-01-25 2626/week @ 2026-02-01 3364/week @ 2026-02-08 5094/week @ 2026-02-15 5659/week @ 2026-02-22 3862/week @ 2026-03-01 4980/week @ 2026-03-08 3664/week @ 2026-03-15 3471/week @ 2026-03-22 4372/week @ 2026-03-29

16,617 downloads per month
Used in 21 crates (14 directly)

MIT/Apache

39KB
667 lines

pinentry is a library for interacting with the pinentry binaries available on various platforms.

Examples

Request passphrase or PIN

use pinentry::PassphraseInput;
use secrecy::SecretString;

let passphrase = if let Some(mut input) = PassphraseInput::with_default_binary() {
    // pinentry binary is available!
    input
        .with_description("Enter new passphrase for FooBar")
        .with_prompt("Passphrase:")
        .with_confirmation("Confirm passphrase:", "Passphrases do not match")
        .interact()
} else {
    // Fall back to some other passphrase entry method.
    Ok("a better passphrase than this".to_owned().into())
}?;

Ask user for confirmation

use pinentry::ConfirmationDialog;

if let Some(mut input) = ConfirmationDialog::with_default_binary() {
    input
        .with_ok("Definitely!")
        .with_not_ok("No thanks")
        .with_cancel("Maybe later")
        .confirm("Would you like to play a game?")?;
};

Display a message

use pinentry::MessageDialog;

if let Some(mut input) = MessageDialog::with_default_binary() {
    input.with_ok("Got it!").show_message("This will be shown with a single button.")?;
};

pinentry

pinentry is a library for interacting with the pinentry binaries available on various platforms.

Usage

Add this line to your Cargo.toml:

pinentry = "0.6"

See the documentation for examples.

pinentry requires Rust version 1.70 or greater.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~1MB
~21K SLoC