Affinidi CLI
Affinidi CLI is a developer tool to easily manage your projects and integrate with Affinidi services using the command line. It empowers developers to use simple commands to improve developer experience when interacting with our different services.
Before you begin
- Set up Affinidi Vault account. Follow the guide below if you haven’t set it up yet.
Install NodeJS v18 or higher on your machine.
Install Git to generate a reference app using affinidi generate app command.
Installation
How do I use Affinidi CLI?
To access most features, such as creating a Login Configuration, you must authenticate using Affinidi Vault - a secure digital wallet for managing identity and credentials. Run the authentication command to begin.
affinidi startIf your session expires, re-run the same command to refresh it.
Understanding Commands
Commands in Affinidi CLI have the following structure:
affinidi <topic> <command> [flags]- All commands begin with
affinidi. - Topics represent Affinidi services or domains.
- Commands define the actions to perform.
- Flags provide the required parameters.
- Use
affinidi help <topic|command>to view detailed usage information.
Help
Each command and topic includes a help document with usage, descriptions, flags, and examples. You can access help in three ways:
Use the –help flag, for example: affinidi login create-config --help
Use the help root command: affinidi help login create-config
Search and select a command using: affinidi search
Flags
All commands support global flags:
--help displays help information.
--json outputs results in JSON format, useful for programmatic use.
--no-color disables coloured output, helpful for accessibility.
--no-input disables interactive prompts, ideal for automation and CI workflows.
Flags can be entered in multiple formats, all of which are valid:
affinidi login create-config --file="config.json"
affinidi login create-config --file "config.json"
affinidi login create-config --file=config.json
affinidi login create-config --file config.json
affinidi login create-config -f "config.json"
affinidi login create-config -f="config.json"
affinidi login create-config -f"config.json"
affinidi login create-config -f config.json
affinidi login create-config -f=config.json
affinidi login create-config -fconfig.jsonActive Project
Affinidi CLI uses the concept of an “Active Project” to simplify workflows. Commands under the login and iam topics operate within the active project. This avoids the need to specify the project and credentials each time.
To check the current active project, run: affinidi project get-active-project
To switch projects, use: affinidi project select-project
Session and Configuration Files
When you authenticate using affinidi start the CLI creates a credentials file in your home directory:
~/.affinidi/credentials-v2.json stores your session credentials. Keep this file secure, as it grants access to Affinidi services.
To end your session, run affinidi stop. This deletes your session data.
Affinidi CLI Project
The Affinidi CLI is an open-source project on GitHub. Visit the repository to contribute, share feedback, or report issues.
Explore CLI Topics and Commands
Glad to hear it! Please tell us how we can improve more.
Sorry to hear that. Please tell us how we can improve.
Thank you for sharing your feedback so we can improve your experience.


