Skip to content

armgit / ente

Public Imported from GitHub
0

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

Rearrange

Manav Rathi153be4990adb
diff --git a/web/packages/base/crypto/types.ts b/web/packages/base/crypto/types.ts
index e7ed032acb..9fde2fd388 100644
--- a/web/packages/base/crypto/types.ts
+++ b/web/packages/base/crypto/types.ts
@@ -1,3 +1,8 @@
+/**
+ * Data provided either as bytes ({@link Uint8Array}) or their base64 string representation.
+ */
+export type BytesOrB64 = Uint8Array | string;
+
/**
* An encryption request with the data to encrypt provided as bytes.
*/
@@ -43,6 +48,29 @@ export interface EncryptJSON {
keyB64: string;
}
+/**
+ * The result of encryption using the secretbox APIs.
+ *
+ * It contains an encrypted data and a randomly generated nonce that was used
+ * during encryption. 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 EncryptedBox2 {
+ /**
+ * The data to decrypt.
+ */
+ encryptedData: BytesOrB64;
+ /**
+ * The nonce that was used during encryption.
+ *
+ * The nonce is required to decrypt the data, but it does not need to be
+ * kept secret.
+ */
+ nonce: BytesOrB64;
+}
+
/**
* The result of encryption using the secretbox APIs.
*
@@ -149,30 +177,6 @@ export interface DecryptBoxBytes {
keyB64: string;
}
-/**
- * Data provided either as bytes ({@link Uint8Array}) or their base64 string representation.
- */
-export type BytesOrB64 = Uint8Array | string;
-
-/**
- * A decryption request to decrypt data encrypted using the secretbox APIs.
- *
- * See: [Note: 3 forms of encryption (Box | Blob | Stream)].
- */
-export interface EncryptedBox2 {
- /**
- * The data to decrypt.
- */
- encryptedData: BytesOrB64;
- /**
- * The nonce that was used during encryption.
- *
- * The nonce is required to decrypt the data, but it does not need to be
- * kept secret.
- */
- nonce: BytesOrB64;
-}
-
/**
* A variant of {@link DecryptBoxBytes} with the encrypted Blob's data as a
* base64 encoded string.