Title: Interacts with 'Bitwarden Secrets Manager'
Version: 0.1.0
Description: Provides functions to securely retrieve secrets from a 'Bitwarden Secrets Manager' vault using the 'Bitwarden CLI', enabling secret and configuration management within R packages and workflows. For more information visit https://bitwarden.com/products/secrets-manager/.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.2
Suggests: knitr, rmarkdown, testthat (≥ 3.0.0), withr
Config/testthat/edition: 3
Imports: jsonlite, processx
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2025-04-08 09:58:55 UTC; esr316
Author: Hajo Bons [aut, cre], Tomer Iwan [aut]
Maintainer: Hajo Bons <h.b.bons@vu.nl>
Repository: CRAN
Date/Publication: 2025-04-09 08:10:02 UTC

Retrieve BWS Access Token from Environment

Description

Retrieves the BWS_ACCESS_TOKEN from environment variables. This token is used to authenticate with the Bitwarden Secrets Manager API.

Usage

get_bws_access_token()

Value

A character string containing the BWS access token.


Get a secret from your Bitwarden Secrets Manager vault

Description

This function retrieves the value of a secret stored in your Bitwarden Secrets Manager vault using the specified key.

Usage

get_bws_secret(
  key,
  bws_access_token = get_bws_access_token(),
  bws_server_url = get_bws_server_url()
)

Arguments

key

A character string representing the key of the secret.

bws_access_token

Optional. A character string representing the Bitwarden access token. Defaults to the value of the "BITWARDEN_ACCESS_TOKEN" environment variable.

bws_server_url

Optional. A character string representing the Bitwarden server URL. Defaults to the value of the "BWS_SERVER_URL" environment variable. For example "https://vault.bitwarden.eu".

Value

A character string containing the value of the secret.

Examples

## Not run: 
# Set environment variables for testing (example values)
Sys.setenv(BWS_ACCESS_TOKEN = "your_access_token_here")
Sys.setenv(BWS_SERVER_URL = "https://vault.bitwarden.eu")

# Retrieve a secret using a key (the key must exist in your vault)
my_secret <- get_bws_secret("my-secret-key")
print(my_secret)

## End(Not run)

Retrieve BWS Server URL from Environment

Description

Retrieves the BWS_SERVER_URL from environment variables. This URL is used to define the Bitwarden Secrets Manager server endpoint.

Usage

get_bws_server_url()

Value

A character string containing the BWS server URL.