-
Notifications
You must be signed in to change notification settings - Fork 4
/
errors.go
34 lines (27 loc) · 1.02 KB
/
errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package pgpmail
import "fmt"
// A NoSignaturePrivateKeyError is returned when no private key
// can be found matching sender email address
type NoSignaturePrivateKeyError struct {
EmailAddress string
}
func (e NoSignaturePrivateKeyError) Error() string {
return "signature failed, no private key for address " + e.EmailAddress
}
// PassphraseNeededError is returned from a sign or decrypt operation if
// private key needed is locked with a passphrase.
type PassphraseNeededError struct {
KeyIds []uint64
}
func (e PassphraseNeededError) Error() string {
return "passphrase needed to unlock secret key needed for operation"
}
// PublicKeysNeededError is returned from encryption operations when
// public keys are not available for some or all message recipients.
// Addresses contains the email addresses of the recipients without keys.
type PublicKeysNeededError struct {
Addresses []string
}
func (e PublicKeysNeededError) Error() string {
return fmt.Sprintf("public keys needed for recipient addresses: %v", e.Addresses)
}