Skip to content

armgit / ente

Public Imported from GitHub
0

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

zod type

Manav Rathib511aeb401c9
diff --git a/web/packages/base/types/credentials.ts b/web/packages/base/types/credentials.ts
index 483377d301..c077779462 100644
--- a/web/packages/base/types/credentials.ts
+++ b/web/packages/base/types/credentials.ts
@@ -2,7 +2,29 @@ import { nullToUndefined } from "@/utils/transform";
import { z } from "zod";
// TODO: Provide types
-export const KeyAttributes = z.object({}).passthrough();
+/**
+ * Zod schema for {@link KeyAttributes}.
+ */
+export const KeyAttributes = z.object({
+ kekSalt: z.string(),
+ encryptedKey: z.string(),
+ keyDecryptionNonce: z.string(),
+ publicKey: z.string(),
+ encryptedSecretKey: z.string(),
+ secretKeyDecryptionNonce: z.string(),
+ memLimit: z.number(),
+ opsLimit: z.number(),
+ masterKeyEncryptedWithRecoveryKey: z
+ .string()
+ .nullish()
+ .transform(nullToUndefined),
+ masterKeyDecryptionNonce: z.string().nullish().transform(nullToUndefined),
+ recoveryKeyEncryptedWithMasterKey: z
+ .string()
+ .nullish()
+ .transform(nullToUndefined),
+ recoveryKeyDecryptionNonce: z.string().nullish().transform(nullToUndefined),
+});
/**
* The result of a successful two factor verification (totp or passkey).
diff --git a/web/packages/shared/user/types.ts b/web/packages/shared/user/types.ts
index 3991b8ed3b..38608ecc87 100644
--- a/web/packages/shared/user/types.ts
+++ b/web/packages/shared/user/types.ts
@@ -1,3 +1,6 @@
+/**
+ * A structure containing the key related attributes for a user.
+ */
export interface KeyAttributes {
kekSalt: string;
encryptedKey: string;