decrypt_kc_pw {keyringr}R Documentation

Get a generic password from macOS Keychain using the 'security' cli

Description

Get a generic password from macOS Keychain using the 'security' cli

Usage

decrypt_kc_pw(label, type = "generic")

Arguments

label

Keychain password label

type

Leychain password type. Either "generic" or "internet".

Details

Passwords must be saved in Keychain prior to using the function.

macOS may require the user to grant access to "security" the first time the function is run for each password. It is important to select "Always allow", which will prevent similar dialogs in the future.

Value

Returns a decrypted password as an invisible string. Invisible means that the password won't be displayed in the console, but can be assigned to a variable or used inline.

Examples

## Not run: 
# First store a password in Keychain
# now return the password above to the R environment
x <- decrypt_kc_pw("label")

# function is best used in a connection string command:
ch <- odbcConnect("some dsn", uid = "user1", pwd = decrypt_kc_pw("mydb_myuser"))

## End(Not run)

[Package keyringr version 0.4.0 Index]