Type: Package
Title: Password Entry Utilities for R, Git, and SSH
Version: 1.2.1
Description: Cross-platform utilities for prompting the user for credentials or a passphrase, for example to authenticate with a server or read a protected key. Includes native programs for MacOS and Windows, hence no 'tcltk' is required. Password entry can be invoked in two different ways: directly from R via the askpass() function, or indirectly as password-entry back-end for 'ssh-agent' or 'git-credential' via the SSH_ASKPASS and GIT_ASKPASS environment variables. Thereby the user can be prompted for credentials or a passphrase if needed when R calls out to git or ssh.
License: MIT + file LICENSE
URL: https://r-lib.r-universe.dev/askpass
BugReports: https://github.com/r-lib/askpass/issues
Encoding: UTF-8
Imports: sys (≥ 2.1)
RoxygenNote: 7.2.3
Suggests: testthat
Language: en-US
NeedsCompilation: yes
Packaged: 2024-10-03 14:12:09 UTC; jeroen
Author: Jeroen Ooms ORCID iD [aut, cre]
Maintainer: Jeroen Ooms <jeroenooms@gmail.com>
Repository: CRAN
Date/Publication: 2024-10-04 07:20:03 UTC

Password Prompt Utility

Description

Prompt the user for a password to authenticate or read a protected key. By default, this function automatically uses the most appropriate method based on the user platform and front-end. Users or IDEs can override this and set a custom password entry function via the askpass option.

Usage

askpass(prompt = "Please enter your password: ")

Arguments

prompt

the string printed when prompting the user for input.

Details

By default askpass() returns NULL in non-interactive sessions. (These include knitr runs and testthat tests.) If you want to force a password prompt in non-interactive sessions, set the rlib_interactive option to TRUE:

options(rlib_interactive = TRUE)

Examples


# Prompt user for passwd
pw <- askpass("Please enter your password")


ASKPASS CMD TOOL

Description

This returns the path to the native askpass executable which can be used by git-credential or ssh-agent. Most users don't have worry about this.

Usage

ssh_askpass()

Details

On Windows and MacOS the package automatically sets the SSH_ASKPASS and GIT_ASKPASS variables on load (if not already set). If these are set you should be able to run e.g. sys::exec_wait("ssh-add") and you should be prompted for a passphrase if your key is protected.