Skip to content

armgit / ente

Public Imported from GitHub
0

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

Box variant

Manav Rathi94a40838a382
diff --git a/web/packages/base/crypto/libsodium.ts b/web/packages/base/crypto/libsodium.ts
index fb896c822f..d7145370a1 100644
--- a/web/packages/base/crypto/libsodium.ts
+++ b/web/packages/base/crypto/libsodium.ts
@@ -218,8 +218,8 @@ const encryptBox = async ({ data, keyB64 }: EncryptBytes) => {
};
/**
- * Encrypt the given data using stream APIs in one-shot mode, using the given
- * base64 encoded key.
+ * Encrypt the given data using secretstream APIs in one-shot mode, using the
+ * given base64 encoded key.
*
* Use {@link decryptBlob} to decrypt the result.
*
diff --git a/web/packages/base/crypto/types.ts b/web/packages/base/crypto/types.ts
index 245755c29d..bafff0165a 100644
--- a/web/packages/base/crypto/types.ts
+++ b/web/packages/base/crypto/types.ts
@@ -32,11 +32,34 @@ export interface EncryptJSON {
}
/**
- * The result of encryption using the stream APIs used in one-shot mode.
+ * The result of encryption using the secretbox APIs.
*
- * The encrypted data (bytes) and decryption header pair (base64 encoded
- * string). Both these values are needed to decrypt the data. The header does
- * not need to be secret.
+ * It contains the encrypted data (bytes) and nonce (base64 encoded string)
+ * pair. Both these values are needed to decrypt the data. The nonce does not
+ * need to be secret.
+ *
+ * See: [Note: 3 forms of encryption (Box | Blob | Stream)].
+ */
+export interface EncryptedBoxBytes {
+ /**
+ * A {@link Uint8Array} containing the encrypted data.
+ */
+ encryptedData: Uint8Array;
+ /**
+ * A base64 string containing the nonce used during encryption.
+ *
+ * A randomly generated nonce for this encryption. It does not need to be
+ * confidential, but it will be required to decrypt the data.
+ */
+ nonceB64: string;
+}
+
+/**
+ * The result of encryption using the secretstream APIs used in one-shot mode.
+ *
+ * It contains the encrypted data (bytes) and decryption header (base64 encoded
+ * string) pair. Both these values are needed to decrypt the data. The header
+ * does not need to be secret.
*
* See: [Note: 3 forms of encryption (Box | Blob | Stream)].
*/
@@ -55,8 +78,8 @@ export interface EncryptedBlobBytes {
}
/**
- * The result of encryption using the stream APIs used in one-shot mode, with
- * the encrypted data encoded as a base64 string.
+ * The result of encryption using the secretstream APIs used in one-shot mode,
+ * with the encrypted data encoded as a base64 string.
*
* This is a variant of {@link EncryptedBlobBytes}.
*/
@@ -77,7 +100,7 @@ export interface EncryptedBlobB64 {
/**
* A decryption request with the encrypted Blob's data as bytes.
*
- * This is a request to decrypt data that was encrypted using the stream APIs in
+ * This is a request to decrypt data encrypted using the secretstream APIs in
* one-shot mode. See: [Note: 3 forms of encryption (Box | Blob | Stream)].
*/
export interface DecryptBlobBytes {