Document sign key handling

This commit is contained in:
M66B 2019-07-18 17:45:00 +02:00
parent 99abbb9a1d
commit 00ef5e056a
3 changed files with 8 additions and 2 deletions

4
FAQ.md
View File

@ -449,6 +449,10 @@ First of all you need to install and configure [OpenKeychain](https://f-droid.or
To encrypt and send a message just check the menu *Encrypt* and the message will be encrypted on sending.
Similarly, to decrypt a received message, just select the menu *Decrypt* in the expanded message view.
The first time you send an encrypted message you might be asked for a sign key.
FairEmail will automatically store the sign key ID in the selected identity for the next time.
If you need to reset the sign key, just save the identity to clear the sign key ID again.
You can enable *Encrypt by default* in the identity settings, which replaces *Send* by *Encrypt and send*.
FairEmail will send the [Autocrypt](https://autocrypt.org/) headers for other email clients.

View File

@ -85,7 +85,7 @@ public interface DaoIdentity {
int setIdentityConnected(long id, long last_connected);
@Query("UPDATE identity SET sign_key = :sign_key WHERE id = :id")
int setIdentitySignKey(long id, long sign_key);
int setIdentitySignKey(long id, Long sign_key);
@Query("UPDATE identity SET error = :error WHERE id = :id")
int setIdentityError(long id, String error);

View File

@ -1486,11 +1486,13 @@ public class FragmentCompose extends FragmentBase {
return result.getParcelableExtra(OpenPgpApi.RESULT_INTENT);
case OpenPgpApi.RESULT_CODE_ERROR:
if (identity != null)
db.identity().setIdentitySignKey(identity.id, null);
OpenPgpError error = result.getParcelableExtra(OpenPgpApi.RESULT_ERROR);
if (error == null)
throw new IllegalArgumentException("Unknown error");
else
throw new IllegalArgumentException(error.getMessage());
throw new IllegalArgumentException(error.getMessage() + " (" + error.getErrorId() + ")");
default:
throw new IllegalArgumentException("Unknown result code=" + resultCode);