feat: limit expiry to 1 month & minor ui fixes

This commit is contained in:
ShubhamPalriwala
2024-06-10 08:01:32 +05:30
parent 1a6b710138
commit f6e44463c4
3 changed files with 19 additions and 4 deletions
@@ -59,6 +59,14 @@ export const secretSharingServiceFactory = ({
throw new BadRequestError({ message: "Expiration date cannot be in the past" });
}
// Limit Expiry Time to 1 month
const expiryTime = new Date(expiresAt).getTime();
const currentTime = new Date().getTime();
const thirtyDays = 30 * 24 * 60 * 60 * 1000;
if (expiryTime - currentTime > thirtyDays) {
throw new BadRequestError({ message: "Expiration date cannot be more than 30 days currently." });
}
const newSharedSecret = await secretSharingDAL.create({
encryptedValue,
iv,