Changed "token" param to "hash" and used hex encoding for URL

This commit is contained in:
x032205
2025-05-19 10:48:58 -04:00
parent 9fd37ca456
commit 0401793d38
6 changed files with 21 additions and 21 deletions
@@ -16,7 +16,7 @@ export const secretSharingKeys = {
hashedHex: string | null;
password?: string;
email?: string;
token?: string;
hash?: string;
}) => ["shared-secret", arg],
getSecretRequestById: (arg: { id: string }) => ["secret-request", arg] as const
};
@@ -75,7 +75,7 @@ export const useGetActiveSharedSecretById = ({
hashedHex,
password,
email,
token
hash
}: {
sharedSecretId: string;
hashedHex: string | null;
@@ -83,7 +83,7 @@ export const useGetActiveSharedSecretById = ({
// For secrets shared to specific emails (optional)
email?: string;
token?: string;
hash?: string;
}) => {
return useQuery({
queryKey: secretSharingKeys.getSecretById({
@@ -91,7 +91,7 @@ export const useGetActiveSharedSecretById = ({
hashedHex,
password,
email,
token
hash
}),
queryFn: async () => {
const { data } = await apiRequest.post<TViewSharedSecretResponse>(
@@ -100,7 +100,7 @@ export const useGetActiveSharedSecretById = ({
...(hashedHex && { hashedHex }),
password,
email,
token
hash
}
);
@@ -42,9 +42,9 @@ export const ViewSharedSecretByIDPage = () => {
from: ROUTE_PATHS.Public.ViewSharedSecretByIDPage.id,
select: (el) => el.email
});
const token = useSearch({
const hash = useSearch({
from: ROUTE_PATHS.Public.ViewSharedSecretByIDPage.id,
select: (el) => el.token
select: (el) => el.hash
});
const [password, setPassword] = useState<string>();
const { hashedHex, key } = extractDetailsFromUrl(urlEncodedKey);
@@ -59,7 +59,7 @@ export const ViewSharedSecretByIDPage = () => {
hashedHex,
password,
email,
token
hash
});
const navigate = useNavigate();
@@ -9,7 +9,7 @@ import { ViewSharedSecretByIDPage } from "./ViewSharedSecretByIDPage";
const SharedSecretByIDPageQuerySchema = z.object({
key: z.string().catch(""),
email: z.string().optional(),
token: z.string().optional()
hash: z.string().optional()
});
export const Route = createFileRoute("/shared/secret/$secretId")({