Cannot import PGP keys from Rust API

Hi again :wave:

So, I’m using deltachat-core-rust crate to implement a bot and I wan’t to import the PGP keys for its account but I think the API is not exporting some needed types.

The function I’m trying to use to import the keys is store_self_keypair but this function is getting a KeyPair as its second argument (see deltachat-core-rust/src/key.rs at cf16671d8d562b41957a16af491d68367a91324e · deltachat/deltachat-core-rust · GitHub) and that type is not exported from the crate.

Is it a bug in the API or am I doing anything wrong?

Thanks in advance :slight_smile:

1 Like

There is another API imex(context, ImexMode::ImportSelfKeys, filename, None) that you can use. This is what Delta Chat actually uses.

store_self_keypair should probably be made private.

1 Like

Thx, I’ll try that one.

That was fast, BTW :smiley:

There is also preconfigure_keypair in deltachat::key - Rust which takes keys from memory, but it is not used by Delta Chat itself outside of the test suite, so more likely to be changed or removed in the future.

Yeah, I saw that one, but since it says in the docs that it can only be used in tests I reached the same conclusion :+1:.