Is there a way to convert my Principal ID back to my Identity name?
The reason why I ask is e.g the following scenario.
When I deploy a canister to the IC-mainnet, my Principal Id is set as controller by my cycles wallet. Let’s imaging sometimes later I have forgotten the identity name which belongs to my deployed Prinzipal Id.
How can I found out which Identity name belongs to that particular Principal ID to find the right private key again?
Your identity names are just named directories within ~/.config/dfx/identity, these directories are where your private keys are stored.
You can run
dfx identity list to see all of your identities, then
dfx identity use my_identity_name
dfx identity get-principal
to see the principal for each of them.
Thanks for that, but this is clear.
My question is, what if I have only the Principal ID and I want to know what is the correspond Identity name for that particular Principal ID, as I have questioned in my original post.
The names are unrelated to the principals or private keys, they’re just local names for your convenience and you can change them freely.
The important part is the .pem file within each directory, which contains your private key. You can move these .pem files to other machines, rename the directories etc. and as long as you have the .pem file you will always have control of the identity, regardless of the name of the directory it sits in (your identity name).
thanks a lot to make this clear, I think I got it now.