Methods use + unit tests update

This commit is contained in:
Jakub Lehotsky 2019-01-11 00:23:00 +01:00
parent 09d519e51e
commit b218f523af
15 changed files with 170 additions and 15 deletions

View file

@ -9,6 +9,7 @@ import (
"golang.org/x/crypto/openpgp"
)
// Use: ios/android only
// GetFingerprint get a armored public key fingerprint
func GetFingerprint(publicKey string) (string, error) {
rawPubKey, err := armor.Unarmor(publicKey)
@ -18,6 +19,7 @@ func GetFingerprint(publicKey string) (string, error) {
return GetFingerprintBinKey(rawPubKey)
}
// Use: ios/android only
// GetFingerprintBinKey get a unarmored public key fingerprint
func GetFingerprintBinKey(publicKey []byte) (string, error) {
pubKeyReader := bytes.NewReader(publicKey)

View file

@ -10,6 +10,7 @@ import (
"strings"
)
// Use: ios/android only
//CheckPassphrase check is private key passphrase ok
func CheckPassphrase(privateKey string, passphrase string) bool {
privKeyReader := strings.NewReader(privateKey)
@ -40,6 +41,7 @@ func CheckPassphrase(privateKey string, passphrase string) bool {
return true
}
// Use: ios/android only
// PublicKey get a public key from a private key
func PublicKey(privateKey string) (string, error) {
privKeyReader := strings.NewReader(privateKey)
@ -61,6 +63,7 @@ func PublicKey(privateKey string) (string, error) {
return outString, nil
}
// Use: ios/android only
// PublicKeyBinOut get a public key from a private key
func PublicKeyBinOut(privateKey string) ([]byte, error) {
privKeyReader := strings.NewReader(privateKey)