fix typo / improve documentatation

This commit is contained in:
William Gotti 2019-05-13 12:33:01 +00:00 committed by Daniel Huigens
parent 701dc26ab5
commit 5cdec38a18
16 changed files with 77 additions and 187 deletions

View file

@ -9,8 +9,7 @@ import (
"golang.org/x/crypto/openpgp"
)
// Use: ios/android only
// GetFingerprint get a armored public key fingerprint
// GetFingerprint gets an armored public key fingerprint
func GetFingerprint(publicKey string) (string, error) {
rawPubKey, err := armor.Unarmor(publicKey)
if err != nil {
@ -19,8 +18,7 @@ func GetFingerprint(publicKey string) (string, error) {
return GetFingerprintBinKey(rawPubKey)
}
// Use: ios/android only
// GetFingerprintBinKey get a unarmored public key fingerprint
// GetFingerprintBinKey gets an unarmored public key fingerprint
func GetFingerprintBinKey(publicKey []byte) (string, error) {
pubKeyReader := bytes.NewReader(publicKey)
pubKeyEntries, err := openpgp.ReadKeyRing(pubKeyReader)
@ -31,5 +29,5 @@ func GetFingerprintBinKey(publicKey []byte) (string, error) {
fp := e.PrimaryKey.Fingerprint
return hex.EncodeToString(fp[:]), nil
}
return "", errors.New("Can't find public key")
return "", errors.New("can't find public key")
}

View file

@ -11,8 +11,7 @@ import (
"strings"
)
// Use: ios/android only
//CheckPassphrase check is private key passphrase ok
// CheckPassphrase checks if private key passphrase ok
func CheckPassphrase(privateKey string, passphrase string) bool {
privKeyReader := strings.NewReader(privateKey)
entries, err := openpgp.ReadArmoredKeyRing(privKeyReader)
@ -42,8 +41,7 @@ func CheckPassphrase(privateKey string, passphrase string) bool {
return true
}
// Use: ios/android only
// PublicKey get a public key from a private key
// PublicKey gets a public key from a private key
func PublicKey(privateKey string) (string, error) {
privKeyReader := strings.NewReader(privateKey)
entries, err := openpgp.ReadArmoredKeyRing(privKeyReader)
@ -64,8 +62,7 @@ func PublicKey(privateKey string) (string, error) {
return outString, nil
}
// Use: ios/android only
// PublicKeyBinOut get a public key from a private key
// PublicKeyBinOut gets a public key from a private key
func PublicKeyBinOut(privateKey string) ([]byte, error) {
privKeyReader := strings.NewReader(privateKey)
entries, err := openpgp.ReadArmoredKeyRing(privKeyReader)