Maybe we should export both private and public key to a single file. Selecting a file on Android and similarly sandboxed platforms like Flatpak seems to be much less error-prone than selecting a folder, there are no failures like “granted access to the folder but not the files inside of it” possible.
gpg
itself does not allow to use both --export
and --export-secret-keys
though, so having such file with both keys concatenated is probably not common.
Maybe it is possible to drop the public key and reconstruct it from the private key, then there is no need to import/export the public key at all, or only allow to export it for publishing somewhere?
EDIT: Information Security Stack Exchange question suggests that private key export contains the public key as well. So exporting public key should not be necessary to transfer
And the import function in the core only needs the secret key file, because it extracts the public key from the secret key:
EDIT2: I made a PR to stop using public keys in the tests: refactor: ignore public key argument in dc_preconfigure_keypair() by link2xt · Pull Request #4701 · deltachat/deltachat-core-rust · GitHub
If this works out, we can do the same for import/export and import/export a single “secret” file, thus not dealing with the directories anymore.