Managing Identities
Identities represent who you are when interacting with the Internet Computer. This guide covers creating, importing, and using identities with icp-cli.
Understanding Identities
An identity consists of:
- A private key — Used to sign messages
- A principal — Your public identifier derived from the key
Identity data is stored in OS-specific locations:
- macOS:
~/Library/Application Support/org.dfinity.icp-cli/identity/ - Linux:
~/.local/share/icp-cli/identity/ - Windows:
%APPDATA%\icp-cli\data\identity\
Set ICP_HOME to use a custom base directory instead (e.g., ICP_HOME=/custom/path stores identities in /custom/path/identity/).
Creating an Identity
Create a new identity:
icp identity new my-identityThis generates a new key pair and stores it securely.
Saving the Seed Phrase
To back up your identity, save the seed phrase:
icp identity new my-identity --output-seed seed.txtStore seed.txt securely — it can restore your identity.
Listing Identities
View all available identities:
icp identity listSetting the Default Identity
Set which identity to use by default:
icp identity default my-identityCheck the current default:
icp identity defaultViewing Your Principal
Display the principal for the current identity:
icp identity principalFor a specific identity:
icp identity principal --identity other-identityImporting Identities
From a PEM File
icp identity import my-identity --from-pem ./key.pemFrom a Seed Phrase
icp identity import my-identity --from-seed-file ./seed.txtOr enter interactively:
icp identity import my-identity --read-seed-phraseStorage Options
When creating or importing, choose how to store the key:
Keyring (Default, Recommended)
Uses your system’s secure keyring:
icp identity new my-identity --storage keyringPassword-Protected
Encrypts the key with a password:
icp identity new my-identity --storage passwordYou’ll be prompted for the password when using this identity.
Plaintext (Not Recommended)
Stores the key unencrypted:
icp identity new my-identity --storage plaintextOnly use for testing or non-sensitive deployments.
Using Identities per Command
Override the default identity for a single command:
icp deploy --identity production-deployer -e icUsing Password Files
For automation, provide passwords via file:
icp deploy --identity my-identity --identity-password-file ./password.txtIdentity Best Practices
Development:
- Use a dedicated development identity
- Plaintext storage is acceptable for local testing
Production:
- Use keyring or password-protected storage
- Keep seed phrases in secure, offline storage
- Use separate identities for different environments
- Limit who has access to production identities
CI/CD:
- Store keys as secrets in your CI system
- Use password files for automated deployments
- Consider separate identities with limited permissions
Managing Controllers
Your identity’s principal can be a controller of canisters. View canister controllers:
icp canister settings show <canister-id> -n icAdd a controller:
icp canister settings update <canister-id> --add-controller <principal> -n icRemove a controller:
icp canister settings update <canister-id> --remove-controller <principal> -n icTroubleshooting
“Not a controller”
Your identity isn’t authorized to manage this canister. You need to be added as a controller by an existing controller.
“Password required”
The identity uses password-protected storage. Either enter the password when prompted or use --identity-password-file.
“Identity not found”
Check available identities:
icp identity listNext Steps
- Deploying to IC Mainnet — Use your identity to deploy