CLI Commands Reference
The Voidkey CLI provides a user-friendly interface for minting credentials from the command line.
Installation
Section titled “Installation”See the CLI Installation Guide for detailed installation instructions.
Global Options
Section titled “Global Options”These options are available for all commands:
voidkey [command] [flags]
Global Flags: --broker-url string Voidkey broker URL (env: VOIDKEY_BROKER_URL) --config string Config file path (default: ~/.voidkey/config.yaml) --debug Enable debug logging --help Show help for command --no-color Disable colored output --timeout duration Request timeout (default: 30s) --version Show version informationCommands
Section titled “Commands”voidkey mint
Section titled “voidkey mint”Mint temporary credentials from the broker.
Synopsis
Section titled “Synopsis”voidkey mint [flags]Description
Section titled “Description”The mint command requests temporary credentials from the Voidkey broker. You must provide an OIDC token (via environment variable or flag) and specify which keys to mint.
Flags: --all Mint all available keys --keys strings Comma-separated list of keys to mint --output string Output format: env, json, yaml (default: env) --token string OIDC token (env: VOIDKEY_OIDC_TOKEN) --token-file string Read OIDC token from fileExamples
Section titled “Examples”Mint specific keys with environment output:
# Set token via environmentexport VOIDKEY_OIDC_TOKEN="eyJhbGciOiJSUzI1NiIs..."
# Mint specific keysvoidkey mint --keys AWS_DEPLOY,GCP_READONLY
# Output:export AWS_ACCESS_KEY_ID="ASIATESTACCESSKEY"export AWS_SECRET_ACCESS_KEY="wJalrXUtnFEMI/K7MDENG/bPxRfiCY"export AWS_SESSION_TOKEN="FwoGZXIvYXdzEBYaD..."export GOOGLE_OAUTH_ACCESS_TOKEN="ya29.A0ARrdaM..."Mint all available keys:
voidkey mint --allUse JSON output format:
voidkey mint --keys AWS_DEPLOY --output json
# Output:{ "AWS_DEPLOY": { "AWS_ACCESS_KEY_ID": "ASIATESTACCESSKEY", "AWS_SECRET_ACCESS_KEY": "wJalrXUtnFEMI/K7MDENG/bPxRfiCY", "AWS_SESSION_TOKEN": "FwoGZXIvYXdzEBYaD..." }}Read token from file:
# Useful in CI/CD where token is written to filevoidkey mint --token-file /tmp/oidc-token --keys AWS_DEPLOYExport credentials directly:
# Evaluate the output to export variableseval "$(voidkey mint --keys AWS_DEPLOY)"
# Now use the credentialsaws s3 lsOutput Formats
Section titled “Output Formats”env (default)
export KEY_NAME="value"export ANOTHER_KEY="another_value"json
{ "KEY_SET": { "KEY_NAME": "value", "ANOTHER_KEY": "another_value" }}yaml
KEY_SET: KEY_NAME: value ANOTHER_KEY: another_valuevoidkey list-keys
Section titled “voidkey list-keys”List available keys for the current identity.
Synopsis
Section titled “Synopsis”voidkey list-keys [flags]Description
Section titled “Description”Shows all credential keys available to the authenticated identity.
Flags: --format string Output format: table, json, yaml (default: table) --token string OIDC token (env: VOIDKEY_OIDC_TOKEN)Examples
Section titled “Examples”List keys in table format:
voidkey list-keys
# Output:Available keys for subject: repo:myorg/myapp:ref:refs/heads/main
NAME PROVIDER MAX_DURATION DESCRIPTIONAWS_DEPLOY aws-prod 1h AWS deployment credentialsGCP_READONLY gcp-prod 2h GCP read-only accessMINIO_STORAGE minio 30m MinIO storage accessJSON output:
voidkey list-keys --format json
# Output:{ "subject": "repo:myorg/myapp:ref:refs/heads/main", "idp": "github-actions", "keys": [ { "name": "AWS_DEPLOY", "provider": "aws-prod", "maxDuration": 3600, "description": "AWS deployment credentials" } ]}voidkey validate
Section titled “voidkey validate”Validate OIDC token and show claims.
Synopsis
Section titled “Synopsis”voidkey validate [flags]Description
Section titled “Description”Validates the OIDC token and displays its claims. Useful for debugging authentication issues.
Flags: --token string OIDC token (env: VOIDKEY_OIDC_TOKEN) --verbose Show all token claimsExamples
Section titled “Examples”Basic validation:
voidkey validate
# Output:Token Status: VALIDSubject: repo:myorg/myapp:ref:refs/heads/mainIssuer: https://token.actions.githubusercontent.comExpires: 2024-01-15T11:30:00Z (in 14 minutes)Verbose output:
voidkey validate --verbose
# Output:Token Status: VALID
Claims: aud: ["https://github.com/myorg"] exp: 1705318200 iat: 1705314600 iss: "https://token.actions.githubusercontent.com" jti: "example-jti" nbf: 1705314600 ref: "refs/heads/main" repository: "myorg/myapp" repository_owner: "myorg" run_id: "7234567890" sub: "repo:myorg/myapp:ref:refs/heads/main"voidkey config
Section titled “voidkey config”Manage CLI configuration.
Synopsis
Section titled “Synopsis”voidkey config [subcommand] [flags]Subcommands
Section titled “Subcommands”voidkey config init
Initialize configuration file:
voidkey config init
# Creates ~/.voidkey/config.yaml with defaultsvoidkey config show
Display current configuration:
voidkey config show
# Output:broker_url: https://voidkey.example.comoutput_format: envtimeout: 30svoidkey config set
Set configuration values:
voidkey config set broker_url https://voidkey.example.comvoidkey config set output_format jsonvoidkey config set timeout 60svoidkey version
Section titled “voidkey version”Show version information.
Synopsis
Section titled “Synopsis”voidkey version [flags]Flags: --format string Output format: text, json (default: text)Examples
Section titled “Examples”voidkey version
# Output:voidkey version 0.8.0Built: 2024-01-15T10:00:00ZGo version: go1.21.5OS/Arch: darwin/arm64voidkey version --format json
# Output:{ "version": "0.8.0", "buildTime": "2024-01-15T10:00:00Z", "goVersion": "go1.21.5", "platform": "darwin/arm64"}Environment Variables
Section titled “Environment Variables”The CLI respects these environment variables:
| Variable | Description | Default |
|---|---|---|
VOIDKEY_BROKER_URL | Broker endpoint URL | - |
VOIDKEY_OIDC_TOKEN | OIDC authentication token | - |
VOIDKEY_OUTPUT_FORMAT | Default output format | env |
VOIDKEY_CONFIG_PATH | Configuration file path | ~/.voidkey/config.yaml |
VOIDKEY_DEBUG | Enable debug logging | false |
VOIDKEY_NO_COLOR | Disable colored output | false |
VOIDKEY_TIMEOUT | Request timeout | 30s |
Configuration File
Section titled “Configuration File”The CLI can be configured via YAML file:
broker_url: https://voidkey.example.comoutput_format: jsontimeout: 60sdebug: false
# Default keys to mint when --all is not specifieddefault_keys: - AWS_DEPLOY - GCP_READONLY
# Aliases for common key combinationsaliases: deploy: - AWS_DEPLOY - DOCKER_REGISTRY monitoring: - PROMETHEUS_READ - GRAFANA_READExit Codes
Section titled “Exit Codes”The CLI uses standard exit codes:
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Command line usage error |
| 3 | Configuration error |
| 4 | Authentication error |
| 5 | Authorization error |
| 6 | Network/timeout error |
| 7 | Server error |
Shell Completion
Section titled “Shell Completion”Generate shell completion scripts:
Bash:
voidkey completion bash > /etc/bash_completion.d/voidkeyZsh:
voidkey completion zsh > "${fpath[1]}/_voidkey"Fish:
voidkey completion fish > ~/.config/fish/completions/voidkey.fishPowerShell:
voidkey completion powershell | Out-String | Invoke-ExpressionAdvanced Usage
Section titled “Advanced Usage”CI/CD Integration
Section titled “CI/CD Integration”GitHub Actions:
- name: Configure AWS credentials run: | eval "$(voidkey mint --keys AWS_DEPLOY)" env: VOIDKEY_OIDC_TOKEN: ${{ steps.token.outputs.token }} VOIDKEY_BROKER_URL: ${{ vars.VOIDKEY_BROKER_URL }}GitLab CI:
deploy: script: - export VOIDKEY_OIDC_TOKEN="${CI_JOB_JWT_V2}" - eval "$(voidkey mint --keys AWS_DEPLOY)" - aws s3 sync ./dist s3://my-bucket/Scripting
Section titled “Scripting”Error handling in scripts:
#!/bin/bashset -e
# Mint credentials with error handlingif ! output=$(voidkey mint --keys AWS_DEPLOY 2>&1); then echo "Failed to mint credentials: $output" >&2 exit 1fi
# Export the credentialseval "$output"
# Use the credentialsaws s3 lsJSON parsing with jq:
# Get specific credential valueACCESS_KEY=$(voidkey mint --keys AWS_DEPLOY --output json | jq -r '.AWS_DEPLOY.AWS_ACCESS_KEY_ID')
# Check if key existsif voidkey list-keys --format json | jq -e '.keys[] | select(.name == "AWS_DEPLOY")' > /dev/null; then echo "AWS_DEPLOY key is available"fiTroubleshooting
Section titled “Troubleshooting”Common Issues
Section titled “Common Issues”“No OIDC token provided”
# Ensure token is setexport VOIDKEY_OIDC_TOKEN="your-token"# Or use --token flagvoidkey mint --token "your-token" --keys AWS_DEPLOY“Connection refused”
# Check broker URLvoidkey config show# Update if neededvoidkey config set broker_url https://correct-url.example.com“Key not found”
# List available keys firstvoidkey list-keys# Use exact key namevoidkey mint --keys EXACT_KEY_NAMEDebug Mode
Section titled “Debug Mode”Enable debug logging for troubleshooting:
# Via flagvoidkey --debug mint --keys AWS_DEPLOY
# Via environmentexport VOIDKEY_DEBUG=truevoidkey mint --keys AWS_DEPLOYDebug output includes:
- HTTP request/response details
- Token validation steps
- Configuration loading
- Error stack traces
Next Steps
Section titled “Next Steps”- CLI Installation - Installation guide
- CLI Configuration - Advanced configuration
- Examples - Real-world usage examples
- API Reference - REST API documentation