Improve documentation and naming
- Rename pmmime to gomime - Rename pmKeyObject to pgpKeyObject
This commit is contained in:
parent
30ee92e63b
commit
7d9930b8e0
13 changed files with 108 additions and 99 deletions
|
|
@ -25,19 +25,18 @@ import (
|
|||
)
|
||||
|
||||
// A keypair contains a private key and a public key.
|
||||
type pmKeyObject struct {
|
||||
type pgpKeyObject struct {
|
||||
ID string
|
||||
Version int
|
||||
Flags int
|
||||
Fingerprint string
|
||||
PublicKey string `json:",omitempty"`
|
||||
PrivateKey string
|
||||
//Activation string // Undocumented
|
||||
Primary int
|
||||
}
|
||||
|
||||
// PrivateKeyReader
|
||||
func (ko *pmKeyObject) PrivateKeyReader() io.Reader {
|
||||
func (ko *pgpKeyObject) PrivateKeyReader() io.Reader {
|
||||
return strings.NewReader(ko.PrivateKey)
|
||||
}
|
||||
|
||||
|
|
@ -61,7 +60,7 @@ type SignedString struct {
|
|||
Signed *Signature
|
||||
}
|
||||
|
||||
var errKeyringNotUnlocked = errors.New("pm-crypto: cannot sign message, key ring is not unlocked")
|
||||
var errKeyringNotUnlocked = errors.New("gopenpgp: cannot sign message, key ring is not unlocked")
|
||||
|
||||
// Err returns a non-nil error if the signature is invalid.
|
||||
func (s *Signature) Err() error {
|
||||
|
|
@ -377,7 +376,7 @@ func (kr *KeyRing) DecryptArmored(r io.Reader) (decrypted io.Reader, signed *Sig
|
|||
}
|
||||
|
||||
if block.Type != constants.PGPMessageHeader {
|
||||
err = errors.New("pm-crypto: not an armored PGP message")
|
||||
err = errors.New("gopenpgp: not an armored PGP message")
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -510,7 +509,7 @@ func (kr *KeyRing) readFrom(r io.Reader, armored bool) error {
|
|||
}
|
||||
|
||||
if len(entities) == 0 {
|
||||
return errors.New("pm-crypto: key ring doesn't contain any key")
|
||||
return errors.New("gopenpgp: key ring doesn't contain any key")
|
||||
}
|
||||
|
||||
kr.entities = append(kr.entities, entities...)
|
||||
|
|
@ -547,7 +546,7 @@ func (pgp *GopenPGP) BuildKeyRingArmored(key string) (kr *KeyRing, err error) {
|
|||
func (kr *KeyRing) UnmarshalJSON(b []byte) (err error) {
|
||||
kr.entities = nil
|
||||
|
||||
keyObjs := []pmKeyObject{}
|
||||
keyObjs := []pgpKeyObject{}
|
||||
if err = json.Unmarshal(b, &keyObjs); err != nil {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue