feat: create secret with password

This commit is contained in:
lemmyMwaura
2024-08-06 12:58:27 +03:00
parent f606e31b98
commit ce4ba24ef2
2 changed files with 6 additions and 1 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ export const SecretSharingSchema = z.object({
expiresAfterViews: z.number().nullable().optional(), expiresAfterViews: z.number().nullable().optional(),
accessType: z.string().default("anyone"), accessType: z.string().default("anyone"),
name: z.string().nullable().optional(), name: z.string().nullable().optional(),
password: z.string().optional(), password: z.string().nullable().optional(),
lastViewedAt: z.date().nullable().optional() lastViewedAt: z.date().nullable().optional()
}); });
@@ -36,6 +36,7 @@ export const secretSharingServiceFactory = ({
iv, iv,
tag, tag,
name, name,
password,
accessType, accessType,
expiresAt, expiresAt,
expiresAfterViews expiresAfterViews
@@ -62,6 +63,7 @@ export const secretSharingServiceFactory = ({
const newSharedSecret = await secretSharingDAL.create({ const newSharedSecret = await secretSharingDAL.create({
name, name,
password,
encryptedValue, encryptedValue,
hashedHex, hashedHex,
iv, iv,
@@ -77,6 +79,7 @@ export const secretSharingServiceFactory = ({
}; };
const createPublicSharedSecret = async ({ const createPublicSharedSecret = async ({
password,
encryptedValue, encryptedValue,
hashedHex, hashedHex,
iv, iv,
@@ -103,6 +106,7 @@ export const secretSharingServiceFactory = ({
} }
const newSharedSecret = await secretSharingDAL.create({ const newSharedSecret = await secretSharingDAL.create({
password,
encryptedValue, encryptedValue,
hashedHex, hashedHex,
iv, iv,
@@ -111,6 +115,7 @@ export const secretSharingServiceFactory = ({
expiresAfterViews, expiresAfterViews,
accessType accessType
}); });
return { id: newSharedSecret.id }; return { id: newSharedSecret.id };
}; };