π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Variant
Manav Rathic8481fdb3e3b
diff --git a/web/packages/base/crypto/index.ts b/web/packages/base/crypto/index.tsindex 4ddada04c2..4e45558314 100644--- a/web/packages/base/crypto/index.ts+++ b/web/packages/base/crypto/index.ts@@ -78,7 +78,7 @@* Apart from these two, there are other secondary and one off types.** 1. "Regular" JavaScript strings. These are indicated by the *UTF8 suffix on- * the function that deals with them. These strings will be obtained by utf-8+ * the function that deals with them. These strings will be obtained by UTF-8* encoding (or decoding) the underlying bytes.** 2. Hex representations of the bytes. These are indicated by the *Hex suffixdiff --git a/web/packages/base/crypto/libsodium.ts b/web/packages/base/crypto/libsodium.tsindex 9bf37dd390..094a165400 100644--- a/web/packages/base/crypto/libsodium.ts+++ b/web/packages/base/crypto/libsodium.ts@@ -356,7 +356,7 @@ export const encryptBlob = async (/*** Encrypt the provided JSON value (using {@link encryptBlob}) after converting- * it to a JSON string (and utf-8 encoding it to obtain bytes).+ * it to a JSON string (and UTF-8 encoding it to obtain bytes).** Use {@link decryptMetadataJSON} to decrypt the result and convert it back to* a JSON value.@@ -521,7 +521,7 @@ export const decryptBox = (/*** Variant of {@link decryptBoxBytes} that returns the data after decoding the- * decrypted bytes as a utf-8 string.+ * decrypted bytes as a UTF-8 string.*/export const decryptBoxUTF8 = async (box: EncryptedBox,@@ -784,8 +784,25 @@ export const boxSeal = async (data: string, publicKey: string) => {/*** Decrypt the result of {@link boxSeal}.*- * All parameters, and the result, are base64 string representations of the- * underlying data.+ * All parameters are base64 string representations of the underlying data. The+ * result is the bytes obtained by decryption.+ */+export const boxSealOpenBytes = async (+ encryptedData: string,+ publicKey: string,+ secretKey: string,+) => {+ await sodium.ready;+ return sodium.crypto_box_seal_open(+ await fromB64(encryptedData),+ await fromB64(publicKey),+ await fromB64(secretKey),+ );+};++/**+ * A variant of {@link boxSealOpenBytes} that returns the result as a base64+ * string.*/export const boxSealOpen = async (encryptedData: string,