get_bws_secret: Get a secret from your Bitwarden Secrets Manager vault

View source: R/get_bws_secret.R

get_bws_secretR Documentation

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)

vvbitwarden documentation built on April 12, 2025, 1:15 a.m.