feat: use hash as pw & move to symmetric encrpytion

This commit is contained in:
ShubhamPalriwala
2024-05-29 14:10:47 +05:30
parent b5b778e241
commit 286426b240
10 changed files with 89 additions and 119 deletions
@@ -16,15 +16,17 @@ export const useGetSharedSecrets = () => {
});
};
export const useGetActiveSharedSecretById = (id: string) => {
export const useGetActiveSharedSecretByIdAndHashedHex = (id: string, hashedHex: string) => {
return useQuery<TViewSharedSecretResponse, [string]>({
queryFn: async () => {
const { data } = await apiRequest.get<TViewSharedSecretResponse>(
`/api/v1/secret-sharing/public/${id}`
`/api/v1/secret-sharing/public/${id}?hashedHex=${hashedHex}`
);
return {
name: data.name,
signedValue: data.signedValue,
encryptedValue: data.encryptedValue,
iv: data.iv,
tag: data.tag,
expiresAt: data.expiresAt
};
}
+11 -3
View File
@@ -1,7 +1,10 @@
export type TSharedSecret = {
id: string;
name: string;
signedValue: string;
encryptedValue: string;
iv: string;
tag: string;
hashedHex: string;
userId: string;
expiresAt: Date;
createdAt: Date;
@@ -10,13 +13,18 @@ export type TSharedSecret = {
export type TCreateSharedSecretRequest = {
name: string;
signedValue: string;
encryptedValue: string;
iv: string;
tag: string;
hashedHex: string;
expiresAt: Date;
};
export type TViewSharedSecretResponse = {
name: string;
signedValue: string;
encryptedValue: string;
iv: string;
tag: string;
expiresAt: Date;
};