Snapcraft and keys

For a typical Snapcraft user there will be 1 or more keys that exist that are used when signing assertions.

Those keys will typically be found in ~/.snap/gnupg. You can operate on that directory using gpg as if it was your homedir like so:

gpg  --homedir ~/.snap/gnupg/ --export -a my-test-key

or

gpg  --homedir ~/.snap/gnupg/ --export -a my-test-key

or

gpg --homedir ~/.snap/gnupg/ --list-keys
  • if you never named a key but did create one then a “default” will exist
  • use --export-secret-keys to get the private key

Also, if during development you wanted to start over from a keys perspective you can just remove the ~/.snap/gnupg directory and it will be recreated.