Skip to content
Working with Secrets

Working with Secrets

Overview

Britive’s vault stores secrets such as passwords, API keys, and certificates. PyBritive lets you view and download secrets directly from your terminal without exposing them in a browser session.

What you’ll learn:

  • How to list secrets available to you
  • How to view a secret value in the terminal
  • How to download a secret to a file

Before You Begin

Note: Secret paths in this tutorial are from the Britive demo tenant. Use pybritive ls secrets to find your own secret paths.

View and Download Secrets

List available secrets

List the secrets available to your identity:

pybritive ls secrets

Secrets are identified by their vault path. Note the full path including the leading / — you will need it for view and download commands. For example:

/Britive Team Secrets/LearningSiteSecret

Note: The path does not include the root folder shown in the Britive UI. Start the path from the first subfolder — for example, use /Britive Team Secrets/LearningSiteSecret, not /Britive/Britive Team Secrets/LearningSiteSecret.

View a secret

Display the value of a secret in your terminal:

pybritive secret view "/Britive Team Secrets/LearningSiteSecret"

The secret value is printed to stdout.

Change the output format

Use the --format flag to change how the secret is displayed:

JSON:

pybritive secret view "/Britive Team Secrets/LearningSiteSecret" --format json

Table:

pybritive secret view "/Britive Team Secrets/LearningSiteSecret" --format table

Download a file-type secret

The secret download command is for secrets that have a file attached — such as certificates, PEM files, or configuration files. It does not work for key-value secrets like Username/Password pairs.

Save a file-type secret to your current directory:

pybritive secret download "/Cloud Secrets/AWS CLI VM Cert"

The file is saved with its original filename in the current directory.

To save to a specific location:

pybritive secret download "/Cloud Secrets/AWS CLI VM Cert" \
  --file ~/secrets/aws-cli-vm-cert.pem

To print the file contents to stdout instead of saving:

pybritive secret download "/Cloud Secrets/AWS CLI VM Cert" --file -

Troubleshoot

SymptomCauseFix
Secret not foundPath typo or missing leading /Run pybritive ls secrets and copy the exact path
Not authenticated errorSession expiredRun pybritive login and try again
No file found for secretSecret is a key-value type, not a file typeUse pybritive secret view for key-value secrets
Downloaded file is emptySecret has no file contentUse pybritive secret view instead of download

Next Steps

Last updated on