Basic Commands
Useful basic commands available to access Affinidi services.
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.
Install NodeJS v18 or higher on your machine.
Install Git to generate a reference app using affinidi generate app command.
Accessing most Affinidi CLI features, like creating a Login Configuration, requires you to authenticate to Affinidi using Affinidi Vault. To do this, you can execute the following command:
affinidi start
If you received a session expired
error, just run the same command to refresh your session.
Commands in Affinidi CLI have the following structure:
affinidi <topic> <command> [flags]
affinidi
.affinidi help <topic|command>
to show the helpful details.All commands and topics have a help document with usage, descriptions, flags and examples.
View it with the help flag: affinidi login create-config --help
With the help root command: affinidi help login create-config
Or by searching and selecting a command: affinidi search
All commands have some global flags at their disposal.
--help
Prints the command’s help information.
--json
Enforce printing the output in json format. Useful for programmatic usage of CLI.
--no-color
Disables color in the output. Useful if you have trouble distinguishing colors.
--no-input
Disables all the interactive prompts. Useful for automation anc ci.
You can input flags in multiple ways. All of the following will work:
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.json
Affinidi CLI introduces a local concept of “Active Project” for convenience. Commands under the login
and iam
topics perform actions under the active project. In order to not have to ask for the project and create the necessary credentials each time you call one of these commands, we ask you to define the CLI’s working project once.
To check what is the current active project use the command affinidi project get-active-project
To switch the active project use the command affinidi project select-project
When you authenticate to Affinidi with affinidi start
the CLI will create a folder with a credentials file in your home directory.
~/.affinidi/credentials-v2.json
- Stores your current session credentials. Keep it secret as this allows you to call Affinidi services.
When you run affinidi stop
your session information is deleted.
The Affinidi CLI is an open-sourced project on GitHub. Explore the GitHub repo to learn more on how you can contribute to the project, provide your feedback, or to report an issue.
To view the latest changes to the Affinidi TDK, visit the Affinidi CLI Changelog page.
Useful basic commands available to access Affinidi services.
Manage projects and switch between them to create related resources.
Manage your Login Configuration, and user groups to integrate Affinidi Login.
Manage your Personal Access Token (PAT) to connect and perform actions on Affinidi services on the user’s behalf.
Manage your IAM policies to grant access to users and Personal Access Tokens (PATs).
Manage Affinidi Iota Framework configurations and data request queries.
Manage Credential Issuance configurations and integration.
Manage Affinidi Wallets for signing credentials and request token.
Generate sample apps using different programming languages, frameworks, and IAM solutions.
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.