Methods use + unit tests update
This commit is contained in:
parent
09d519e51e
commit
b218f523af
15 changed files with 170 additions and 15 deletions
|
|
@ -11,16 +11,19 @@ import (
|
|||
"io/ioutil"
|
||||
)
|
||||
|
||||
// Use: ios/android only
|
||||
// ArmorKey make bytes input key to armor format
|
||||
func ArmorKey(input []byte) (string, error) {
|
||||
return ArmorWithType(input, PUBLIC_KEY_HEADER)
|
||||
}
|
||||
|
||||
// Use: go-pm-crypto, keyring.go
|
||||
// ArmorWithTypeBuffered take input from io.Writer and returns io.WriteCloser which can be read for armored code
|
||||
func ArmorWithTypeBuffered(w io.Writer, armorType string) (io.WriteCloser, error) {
|
||||
return armor.Encode(w, armorType, nil)
|
||||
}
|
||||
|
||||
// Use: go-pm-crypto
|
||||
// ArmorWithType make bytes input to armor format
|
||||
func ArmorWithType(input []byte, armorType string) (string, error) {
|
||||
var b bytes.Buffer
|
||||
|
|
@ -38,6 +41,7 @@ func ArmorWithType(input []byte, armorType string) (string, error) {
|
|||
return b.String(), nil
|
||||
}
|
||||
|
||||
// Use: go-pm-crypto, attachment.go, keyring.go, session.go, message.go
|
||||
// Unarmor an armored key to bytes key
|
||||
func Unarmor(input string) ([]byte, error) {
|
||||
b, err := internal.Unarmor(input)
|
||||
|
|
@ -47,6 +51,7 @@ func Unarmor(input string) ([]byte, error) {
|
|||
return ioutil.ReadAll(b.Body)
|
||||
}
|
||||
|
||||
// Use: ios/android only
|
||||
//ReadClearSignedMessage read clear message from a clearsign package (package containing cleartext and signature)
|
||||
func ReadClearSignedMessage(signedMessage string) (string, error) {
|
||||
modulusBlock, rest := clearsign.Decode([]byte(signedMessage))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue