feat: secret sharing

This commit is contained in:
ShubhamPalriwala
2024-05-29 14:10:46 +05:30
parent 81b0c8bc12
commit 387981ea87
42 changed files with 1497 additions and 2 deletions
@@ -0,0 +1,32 @@
import { useQuery } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
import { TSharedSecret, TViewSharedSecretResponse } from "./types";
export const useGetSharedSecrets = (workspaceId: string) => {
return useQuery({
queryKey: ["sharedSecrets"],
queryFn: async () => {
const { data } = await apiRequest.get<TSharedSecret[]>(
`/api/v1/secret-sharing/${workspaceId}`
);
return data;
}
});
};
export const useGetActiveSharedSecretById = (id: string) => {
return useQuery<TViewSharedSecretResponse, [string]>({
queryFn: async () => {
const { data } = await apiRequest.get<TViewSharedSecretResponse>(
`/api/v1/secret-sharing/public/${id}`
);
return {
name: data.name,
signedValue: data.signedValue,
expiresAt: data.expiresAt
};
}
});
};