I am attempting to implement R interactivity with the 1Password CLI (https://support.1password.com/command-line-getting-started/). My short term objective is just trying to initialize and store an initial token that is generated by 1Password, so I can pull passwords from the vault down the line.
In the Windows Command prompt and also the RStudio Terminal, I am able to interact with the CLI. This is because I can interactively enter in the Secret Key and also Password when prompted:
> op signin <DOMAIN>.1password.com <email-address> --raw
Enter the Secret Key for <EMAIL> at <DOMAIN>.1password.com: (interactive entry)
Enter the password for <EMAIL> at <DOMAIN>.1password.com: (interactive entry)
abcdefghijklmnopqrstuvwxyz1234567890 (SESSION TOKEN TO BE SAVED)
However, I am struggling on how to do this in R. My initial approach has been trying to chain shell() or system() commands, but I can't quite seem to figure out how to do it within R.
This first example doesn't allow me to respond to the additional prompts - it automatically fails:
> system('op signin <DOMAIN>.1password.com <EMAIL>', intern = TRUE, invisible=FALSE, wait=FALSE)
[1] "Enter the Secret Key for <EMAIL> at <DOMAIN>.1password.com: [ERROR] invalid account key format length 0"
> shell('op signin <DOMAIN>.1password.com <EMAIL>')
Enter the Secret Key for <EMAIL> at <DOMAIN>.1password.com: [ERROR] invalid account key format length 0
Any form of chaining (whether using &, &&, ;) doesn't seem to allow additional responses after the initial command either. As an example:
> shell('op signin <DOMAIN>.1password.com <EMAIL> && <SECRET KEY>')
Enter the Secret Key for <EMAIL> at <DOMAIN>.1password.com: [ERROR] invalid account key format length 0
Does anyone have any suggestions on how to get R to respond to this interaction?