π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
EncString: Use base64 encoding
Neeraj Gupta8a26f13b76b2
diff --git a/pkg/model/enc_string.go b/pkg/model/enc_string.goindex d6ec410748..5187a04a55 100644--- a/pkg/model/enc_string.go+++ b/pkg/model/enc_string.go@@ -2,6 +2,7 @@ package modelimport ("cli-go/internal/crypto"+ "cli-go/utils""log")@@ -16,15 +17,15 @@ func MakeEncString(plainText string, key []byte) *EncString {log.Fatalf("failed to encrypt %s", err)}return &EncString{- CipherText: string(cipher),- Nonce: string(nonce),+ CipherText: utils.BytesToBase64(cipher),+ Nonce: utils.BytesToBase64(nonce),}}func (e *EncString) MustDecrypt(key []byte) string {- plainBytes, err := crypto.DecryptChaCha20poly1305([]byte(e.CipherText), key, []byte(e.Nonce))+ plainBytes, err := crypto.DecryptChaCha20poly1305(utils.Base64DecodeString(e.CipherText), key, utils.Base64DecodeString(e.Nonce))if err != nil {panic(err)}- return string(plainBytes)+ return utils.BytesToBase64(plainBytes)}