decrypt_kc_pw: Get a generic password from macOS Keychain using the...

Description Usage Arguments Details Value Examples

View source: R/decrypt_kc_pw.R

Description

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

Usage

1
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

1
2
3
4
5
6
7
8
9
## 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)

keyringr documentation built on May 2, 2019, 9:17 a.m.