Commit graph

5 commits

Author SHA1 Message Date
Robin Jarry
6b1afc3ae3 tests: fix errors after lint series
Fix the following test failures:

 FAIL: TestMessageInfoHandledError (0.00s)
 parse_test.go:53: could not parse envelope: date parsing failed:
 unrecognized date format:

 FAIL: TestReader (0.07s)
 gpg_test.go:27: using GNUPGHOME = /tmp/TestReader2384941142/001
 reader_test.go:108: Test case: Invalid Signature
 reader_test.go:112: gpg.Read() = gpgmail: failed to read PGP
 message: gpg: failed to run verification: exit status 1

Fixes: 5ca6022d00 ("lint: ensure errors are at least logged (errcheck)")
Fixes: 70bfcfef42 ("lint: work nicely with wrapped errors (errorlint)")
Signed-off-by: Robin Jarry <robin@jarry.cc>
Signed-off-by: Moritz Poldrack <moritz@poldrack.dev>
2022-08-04 22:52:40 +02:00
Moritz Poldrack
70bfcfef42 lint: work nicely with wrapped errors (errorlint)
Error wrapping as introduced in Go 1.13 adds some additional logic to
use for comparing errors and adding information to it.

Signed-off-by: Moritz Poldrack <moritz@poldrack.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-08-04 21:58:04 +02:00
Moritz Poldrack
5ca6022d00 lint: ensure errors are at least logged (errcheck)
Signed-off-by: Moritz Poldrack <moritz@poldrack.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-08-04 21:57:57 +02:00
Moritz Poldrack
80f90c0d41 gpg: fix panic when signing an unparsable message
Fix the following error:

panic()
	runtime/panic.go:838
bytes.(*Buffer).ReadFrom()
	bytes/buffer.go:204
io.copyBuffer()
	io/io.go:412
io.Copy()
	io/io.go:385
git.sr.ht/~rjarry/aerc/lib/crypto/gpg/gpgbin.Sign()
	git.sr.ht/~rjarry/aerc/lib/crypto/gpg/gpgbin/sign.go:25
git.sr.ht/~rjarry/aerc/lib/crypto/gpg.(*Signer).Close()
	git.sr.ht/~rjarry/aerc/lib/crypto/gpg/writer.go:52
git.sr.ht/~rjarry/aerc/lib/crypto/gpg.multiCloser.Close()
	git.sr.ht/~rjarry/aerc/lib/crypto/gpg/writer.go:92
git.sr.ht/~rjarry/aerc/widgets.(*Composer).WriteMessage()
	git.sr.ht/~rjarry/aerc/widgets/compose.go:601
git.sr.ht/~rjarry/aerc/commands/compose.Send.Execute.func1()
	git.sr.ht/~rjarry/aerc/commands/compose/send.go:127

Fixes: https://todo.sr.ht/~rjarry/aerc/53
Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
2022-07-02 18:36:40 +02:00
Tim Culverhouse
57699b1fa6 feat: add gpg integration
This commit adds gpg system integration. This is done through two new
packages: gpgbin, which handles the system calls and parsing; and gpg
which is mostly a copy of emersion/go-pgpmail with modifications to
interface with package gpgbin. gpg includes tests for many cases, and
by it's nature also tests package gpgbin. I separated these in case an
external dependency is ever used for the gpg sys-calls/parsing (IE we
mirror how go-pgpmail+openpgp currently are dependencies)

Two new config options are introduced:
* pgp-provider. If it is not explicitly set to "gpg", aerc will default to
it's internal pgp provider
* pgp-key-id: (Optionally) specify a key by short or long keyId

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-04-27 09:46:25 +02:00