Skip to content

armgit / ente

Public Imported from GitHub
0

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

Doc

Manav Rathi3dbc33668782
diff --git a/web/packages/shared/user/types.ts b/web/packages/shared/user/types.ts
index ff684f00ec..c0b665a935 100644
--- a/web/packages/shared/user/types.ts
+++ b/web/packages/shared/user/types.ts
@@ -1,10 +1,21 @@
/**
- * A structure containing the key related attributes for a user.
+ * The user's various encrypted keys and their related attributes.
+ *
+ * - Attributes to derive the KEK, the (master) key encryption key.
+ * - Encrypted master key (with KEK)
+ * - Encrypted master key (with recovery key)
+ * - Encrypted recovery key (with master key).
+ * - Public key and encrypted private key (with master key).
+ *
+ * The various "key" attributes are base64 encoded representations of the
+ * underlying binary data.
*/
export interface KeyAttributes {
/**
* The user's master key encrypted with the key encryption key.
*
+ * Base 64 encoded.
+ *
* [Note: Key encryption key]
*
* The user's master key is encrypted with a "key encryption key" (lovingly
@@ -25,12 +36,16 @@ export interface KeyAttributes {
/**
* The nonce used during the encryption of the master key.
*
+ * Base 64 encoded.
+ *
* @see {@link encryptedKey}.
*/
keyDecryptionNonce: string;
/**
* The salt used during the derivation of the kek.
*
+ * Base 64 encoded.
+ *
* See: [Note: Key encryption key].
*/
kekSalt: string;
@@ -51,12 +66,29 @@ export interface KeyAttributes {
* See {@link opsLimit} for more details.
*/
memLimit: number;
+ /**
+ * The user's public key (part of their public-key keypair, the other half
+ * being the {@link encryptedSecretKey}).
+ *
+ * Base 64 encoded.
+ */
publicKey: string;
+ /**
+ * The user's private key (part of their public-key keypair, the other half
+ * being the {@link publicKey}) encrypted with their master key.
+ *
+ * Base 64 encoded.
+ */
encryptedSecretKey: string;
+ /**
+ * The nonce used during the encryption of {@link encryptedSecretKey}.
+ */
secretKeyDecryptionNonce: string;
/**
* The user's master key after being encrypted with their recovery key.
*
+ * Base 64 encoded.
+ *
* This allows the user to recover their master key if they forget their
* passphrase but still have their recovery key.
*
@@ -66,17 +98,23 @@ export interface KeyAttributes {
/**
* The nonce used during the encryption of
* {@link masterKeyEncryptedWithRecoveryKey}.
+ *
+ * Base 64 encoded.
*/
masterKeyDecryptionNonce?: string;
/**
* The user's recovery key after being encrypted with their master key.
*
+ * Base 64 encoded.
+ *
* Note: This value doesn't change after being initially created.
*/
recoveryKeyEncryptedWithMasterKey?: string;
/**
* The nonce used during the encryption of
* {@link recoveryKeyEncryptedWithMasterKey}.
+ *
+ * Base 64 encoded.
*/
recoveryKeyDecryptionNonce?: string;
}
@@ -89,4 +127,3 @@ export interface User {
isTwoFactorEnabled: boolean;
twoFactorSessionID: string;
}
-