Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

EncString: Use base64 encoding

Neeraj Gupta8a26f13b76b2
diff --git a/pkg/model/enc_string.go b/pkg/model/enc_string.go
index d6ec410748..5187a04a55 100644
--- a/pkg/model/enc_string.go
+++ b/pkg/model/enc_string.go
@@ -2,6 +2,7 @@ package model
import (
"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)
}