diff options
author | Bartkk <bartkk@bartkk.xyz> | 2024-04-03 08:35:49 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2024-04-03 11:16:53 +0200 |
commit | 4cbd116f034813216955540567f333f237de1bbe (patch) | |
tree | 1953750557b8438b86e622acb6f047f734fd260a /app/compose.go | |
parent | 28fde6118fca2b1f93457d493572a4401e8448ac (diff) | |
download | aerc-4cbd116f034813216955540567f333f237de1bbe.tar.gz |
gpg: add pgp-self-encrypt option
Add an option to encrypt outgoing messages to the sender or the key
specified in pgp-key-id.
Implements: https://todo.sr.ht/~rjarry/aerc/237
Changelog-added: New `pgp-self-encrypt` option in `accounts.conf`.
Signed-off-by: Bartkk <bartkk@bartkk.xyz>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'app/compose.go')
-rw-r--r-- | app/compose.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/compose.go b/app/compose.go index 6cdc3458..469f3c36 100644 --- a/app/compose.go +++ b/app/compose.go @@ -947,6 +947,15 @@ func (c *Composer) WriteMessage(header *mail.Header, writer io.Writer) error { if err != nil { return err } + + if c.acct.acct.PgpSelfEncrypt { + signer, err := c.Signer() + if err != nil { + return err + } + rcpts = append(rcpts, signer) + } + cleartext, err = CryptoProvider().Encrypt(&buf, rcpts, signer, DecryptKeys, header) if err != nil { return err |