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>
This commit is contained in:
parent
32a16dcd8d
commit
b57fceaad4
7 changed files with 174 additions and 3 deletions
commands/compose
32
commands/compose/attach-key.go
Normal file
32
commands/compose/attach-key.go
Normal file
|
@ -0,0 +1,32 @@
|
|||
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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue