[][src]Crate pinentry

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(SecretString::new("a better passphrase than this".to_owned()))
}?;

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.")?;
};

Structs

ConfirmationDialog

A dialog for requesting a confirmation from the user.

GpgError

An uncommon or unexpected GPG error.

MessageDialog

A dialog for showing a message to the user.

PassphraseInput

A dialog for requesting a passphrase from the user.

Enums

Error

Errors that may be returned while interacting with pinentry binaries.

Type Definitions

Result

Result type for the pinentry crate.