Skip to content

S26-Distributed-Capstone/DSVClient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Distributed Secrets Vault Client

DSVClient is the command-line client for interacting with the Distributed Secrets Vault gateway.

Requirements

  • Python 3.10 or later
  • A running Distributed Secrets Vault server
  • curl and sh (for install/uninstall scripts)

Install

Install directly from GitHub (works whether your login shell is bash or zsh):

curl -fsSL https://raw.githubusercontent.com/S26-Distributed-Capstone/DSVClient/main/scripts/install.sh | sh

To download the script first instead of piping:

curl -fsSL https://raw.githubusercontent.com/S26-Distributed-Capstone/DSVClient/main/scripts/install.sh -o /tmp/install-dsvc.sh
sh /tmp/install-dsvc.sh

The installer:

  • Downloads cli.py, client.py, and config.py
  • Installs runtime files into ~/.local/share/dsvc
  • Installs dsvc into /usr/local/bin (if writable) or ~/.local/bin
  • Prompts for initial base_url and username
  • Writes config to ~/.dsv_client/config.json
  • When installing to ~/.local/bin, adds it to your shell config (~/.zshrc, ~/.bashrc, or ~/.profile) if needed

If dsvc is not found after install, reload your shell config (for example source ~/.zshrc) or open a new terminal.

Usage

Run command help:

dsvc help

Authentication commands

dsvc login <username>
dsvc logout

Notes:

  • You must be logged in before running API commands.
  • You must run logout before logging in as a different user.

API commands

dsvc ping
dsvc create <secretName> <secretValue>
dsvc get <secretName>
dsvc get <secretName> --all
dsvc get <secretName> --version <versionNumber>
dsvc update <secretName> <updatedValue>
dsvc delete <secretName>
dsvc env <envFile>

Examples:

dsvc login alice
dsvc ping
dsvc create db-password hunter2
dsvc get db-password
dsvc get db-password --all
dsvc get db-password --version 1
dsvc update db-password new-value
dsvc delete db-password
dsvc env secrets.env
dsvc logout

Get command options

The get command supports retrieving secret versions:

  • dsvc get <secretName> - Retrieve the current version of a secret
  • dsvc get <secretName> --all - Retrieve all versions of a secret
  • dsvc get <secretName> --version <versionNumber> - Retrieve a specific version of a secret

Examples:

# Get the current version
dsvc get db-password

# Get all versions (returns a list)
dsvc get db-password --all

# Get a specific version
dsvc get db-password --version 2

With no arguments, dsvc prints help and exits.

.env file command

Use env to process a .env file containing secret operations:

dsvc env secrets.env

Example secrets.env:

Key1=new:{val}
Key2=update:{val}
Key3=delete
Key4=get
Key5=get:{version}

The server rejects files containing duplicate keys.

Batch mode

Use --script <file> to run commands from a file:

dsvc --script commands.txt

Rules:

  • One command per line
  • Blank lines are ignored
  • Lines starting with # are ignored

Example commands.txt:

# start session
login alice

# health check
ping

# create a secret
create db-password hunter2

# retrieve it
get db-password

# update it
update db-password new-value

# remove it
delete db-password

# end session
logout

Configuration

~/.dsv_client/config.json stores:

  • base_url: gateway base URL
  • username: current logged-in username

HTTP timeout, retry, and debug behavior are hardcoded in the client with internal defaults.

Run tests

From the repo root:

python3 -m unittest tests/test_cli.py

Or discover all tests under tests/:

python3 -m unittest discover -s tests -p "test_*.py"

Uninstall

curl -fsSL https://raw.githubusercontent.com/S26-Distributed-Capstone/DSVClient/main/scripts/uninstall.sh | sh

The uninstall script removes:

  • dsvc launcher symlink
  • Installed runtime directory
  • Client config file (~/.dsv_client/config.json)

About

Client and CLI for interacting with Distributed Secrets Vault main server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors