diff options
author | Robin Jarry <robin@jarry.cc> | 2024-01-13 19:11:47 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2024-01-25 21:10:10 +0100 |
commit | bce77d8174f4698693af5e07f4c3697ba53bfae5 (patch) | |
tree | cb43323c7249c6071f29a73f2c599ef6dfac4f71 /app/compose.go | |
parent | 2d8b81f619fc3c8b5a36932e000a86fe111e5bb9 (diff) | |
download | aerc-bce77d8174f4698693af5e07f4c3697ba53bfae5.tar.gz |
compose: allow automatic attachment of signing key
Add a new pgp-attach-key boolean setting in accounts.conf. When set to
true, enabling message signing (either automatically via pgp-auto-sign
or manually with :sign) will imply attaching the (public) key that will
be used to sign the message before sending.
The automatically attached key can be unattached like any other
attachment with :detach.
Implements: https://todo.sr.ht/~rjarry/aerc/207
Changelog-added: Automatically attach signing key with `pgp-attach-key`
in `accounts.conf`.
Requested-by: Drew Devault <sir@cmpwn.com>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Thomas Böhler <witcher@wiredspace.de>
Reviewed-by: Thomas Böhler <witcher@wiredspace.de>
Diffstat (limited to 'app/compose.go')
-rw-r--r-- | app/compose.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/compose.go b/app/compose.go index a54f534b..56b8f350 100644 --- a/app/compose.go +++ b/app/compose.go @@ -326,6 +326,11 @@ func (c *Composer) Archive() string { } func (c *Composer) SetAttachKey(attach bool) error { + if c.crypto == nil { + if err := c.updateCrypto(); err != nil { + return err + } + } if !attach { name := c.crypto.signKey + ".asc" found := false @@ -397,6 +402,11 @@ func (c *Composer) SetSign(sign bool) error { c.sign = !sign return fmt.Errorf("Cannot sign message: %w", err) } + if c.acct.acct.PgpAttachKey { + if err := c.SetAttachKey(sign); err != nil { + return err + } + } return nil } |