Commands for managing user authentication and tokens in the CLI. The wallet contains your cryptographic keys and DID (Decentralized Identifier) that are used throughout EBSI operations.
using user <algorithm> <didMethod> <privateKey> <did> <keyId>
Command to load a client in the CLI with one of the supported algorithms (ES256K, ES256, RS256, EdDSA).
Parameters:
- algorithm (optional): Algorithm. It must be ES256K (default), ES256, RS256, or EdDSA. Use "null" to remove the user.
- didMethod (optional): DID method version. It must be "did1" (default, legal entities), or "did2" (natural persons).
- privateKey (optional): Private key in hex string or JWK format. By default, it creates a random key. The hex string is only valid if the selected algorithm is ES256K or ES256. For hardware wallet connection, use the word "hardwarewallet".
- did (optional): DID of the client. It should start with "did:ebsi" (see DID Methods). By default, it defines a random DID.
- keyId (optional): Key identifier registered in the verification methods of the DID document.
Examples:
# Load user with ES256K algorithm
using user ES256K did1 f19863112d798add7c8df9a100a9ed961e7e7986c2e9042506840c8695e38800 did:ebsi:zkqR9GCLrLYbkubAjuqQZAz
# Create a user with ES256 algorithm for natural persons
using user ES256 did2
# Load user with ES256 algorithm using JWK format
using user ES256 did1 {"kty":"EC","crv":"P-256","x":"...","y":"...","d":"..."} did:ebsi:zkqR9GCLrLYbkubAjuqQZAz keys-2
# Load user with hardware wallet
using user ES256 did1 hardwarewallet
# Load user from saved variable
using user myUser
# Remove current user
using user null
Loading from Variables:
You can load a user that was previously saved in a variable:
# First, save a user to a variable
set myUser user
# Later, load the user from the variable
using user myUser
This is useful for:
- Switching between different user accounts
- Restoring a previously configured user
- Sharing user configurations across CLI sessions
Common Use Cases:
- ES256K: Used for blockchain operations and DID document management
- ES256: Used for signing verifiable credentials and presentations
- Hardware Wallet: Enhanced security for credential signing
- DID1: Legal entities (organizations, companies)
- DID2: Natural persons (individuals)
IMPORTANT: When generating new keys, save your private keys in a secure location immediately. These keys are required for all future operations and cannot be recovered if lost.
Security Best Practices:
- Store private keys in encrypted storage or a hardware security module
- Never share private keys with anyone
- Keep backups in multiple secure locations
- Consider using hardware wallets for enhanced security
using ethuser <privateKey> <did>
Command to call using user ES256K <didMethod> <privateKey> <did>
.
Parameters:
- privateKey: Private key in hex format
- did: DID of the client
using token <token>
Command to set up a bearer token for subsequent calls to the APIs. It's also possible to load a JWT previously saved in the CLI (see set var
) by referencing its name.
Parameters:
- token: JWT to set in the headers. Leave it empty to remove the token from the headers.
Examples:
using token eyJ0eXAiOiJ...
using token token1
using token # token removed
Wallet Setup Process
For a complete wallet setup, you typically need both ES256K and ES256 key pairs:
1. Generate ES256K Key Pair
The ES256K key pair is used for blockchain operations and DID document management:
using user ES256K
This command generates a new ES256K key pair and displays the generated information including your DID.
2. Generate ES256 Key Pair
The ES256 key pair is used for signing verifiable credentials and presentations:
using user ES256
This adds the ES256 key pair to your existing wallet.
3. Verify Your Setup
Confirm that your wallet is properly configured:
# Check your DID
view user.did
# Check your environment
env
# Verify both key pairs are loaded
view user.keys.ES256K.id
view user.keys.ES256.id
Viewing Wallet Information
You can view your current wallet information at any time:
# View your DID
view user.did
# View your complete wallet details
view user
# View specific key information
view user.keys.ES256K.id
view user.keys.ES256.id
For a detailed step-by-step wallet setup guide, see Setup your wallet in the onboarding tutorial.