Snapcraft keys not imported on a new system when logged in

Hi, I created snapcraft keys on a system and registered them. But when i go to a new system and login. These keys are not transferred to the new system and i have to create the same key again on the new system. I think this is a bug.

When you register a key for your developer account, only the public key is uploaded to the Snap Store. The corresponding private key only exists on the system where it was created. So the Snap Store doesn’t have the information necessary to install the private key on your new system.

You’ve got a few options to resolve this:

  1. you can register multiple keys to your developer account, which seems to be what you’ve ended up doing.

  2. you could copy the ~/.snap/gnupg directory from your old development system to the new one. This is a standard GnuPG keyring storing the private keys.

    Note that if you already have a ~/.snap/gnupg keyring on the new system, overwriting it will cause you to lose any private keys that were on the system. There’s probably some gpg commands you can run to merge the two keyrings, but I don’t know them off the top of my head.