aerc/commands/compose/attach-key.go
Tim Culverhouse b57fceaad4 pgp: add attach key command
Add compose command ("attach-key") to attach the public key associated
with the sending account. Public key is attached in ascii armor format,
with the mimetype set according to RFC 3156 ("application/pgp-keys").

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Tested-by: Koni Marti <koni.marti@gmail.com>
2022-05-06 11:02:55 +02:00

32 lines
548 B
Go

package compose
import (
"errors"
"git.sr.ht/~rjarry/aerc/widgets"
)
type AttachKey struct{}
func init() {
register(AttachKey{})
}
func (AttachKey) Aliases() []string {
return []string{"attach-key"}
}
func (AttachKey) Complete(aerc *widgets.Aerc, args []string) []string {
return nil
}
func (AttachKey) Execute(aerc *widgets.Aerc, args []string) error {
if len(args) != 1 {
return errors.New("Usage: attach-key")
}
composer, _ := aerc.SelectedTab().(*widgets.Composer)
composer.SetAttachKey(!composer.AttachKey())
return nil
}