Automatic key import / export + Expected monad
ClosedPublic

Authored by rnicole on Mar 8 2018, 4:16 PM.

Details

Summary

There are many things going on here (perhaps a bit much for a single patch):

  • When an attachment is of mime type "application/pgp-keys", a button is added to import the key to GPG
  • When sending a mail and crypto is enabled (encryption, signing or both), the public key of the first private key found is sent as an un-encrypted attachment (T6994)
  • The mailcrypto.{h,cpp} was, for the most part, rewritten
  • Introduction of the expected monad, inspired by what was proposed for C++ here, but not at all a strict implementation of this specification. We may want to add some more features of this standard later.

The rationale for some of the choices:

  • I found mailcrypto a bit hard to edit to add new features, and a great part was commented code to prepare for the support the SMIME crypto format, which would (in my current knowledge) not be used for sending emails.
  • One thing I found that may be missing in the code base was a standardized way of handling errors in C++ code. Since exceptions are disabled I think that the functional way is the way to go. After some research I found the Expected monad / tagged union / sum type, which seemed to suit the problem particularly well.

In the long run, I hope we would move the entire code base to use Expected to indicate if a function might fail.

Of course every choice made here is to be considered as a proposition for doing things / RFC, critics wholeheartedly accepted.

Diff Detail

Repository
R162 Kube
Lint
Lint Skipped
Unit
Unit Tests Skipped
rnicole updated this revision to Diff 29070.Mar 9 2018, 10:36 AM

Add the License header to the errors.h file and elaborate on the "placement new" code.

This revision was not accepted when it landed; it landed in state Needs Review.Mar 9 2018, 1:00 PM
This revision was automatically updated to reflect the committed changes.