Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

improvement(secret-sharing): overhaul sharing UX across surfaces (#8165)

Andrew Huang6b6b7676a076
diff --git a/frontend/src/components/v3/platform/ThemeProvider/auth-theme.ts b/frontend/src/components/v3/platform/ThemeProvider/auth-theme.ts
index 6a96fb6b58..f64a259328 100644
--- a/frontend/src/components/v3/platform/ThemeProvider/auth-theme.ts
+++ b/frontend/src/components/v3/platform/ThemeProvider/auth-theme.ts
@@ -1,4 +1,4 @@
export const isDarkAuthPath = (pathname: string) =>
- /^\/(?:login|signup|admin\/signup|signupinvite|requestnewinvite|email-not-verified|account-recovery|account-recovery-reset|password-setup|cli-redirect|mfa-session)(?:\/|$)/.test(
+ /^\/(?:login|signup|admin\/signup|signupinvite|requestnewinvite|email-not-verified|account-recovery|account-recovery-reset|password-setup|cli-redirect|mfa-session|shared)(?:\/|$)/.test(
pathname
);
diff --git a/frontend/src/const.ts b/frontend/src/const.ts
index a0897dfa37..8473d63916 100644
--- a/frontend/src/const.ts
+++ b/frontend/src/const.ts
@@ -25,6 +25,7 @@ export const publicPaths = [
"/login/provider/error",
"/admin/signup",
"/shared/secret/[id]",
+ "/shared/new",
"/secret-request/secret/[id]",
"/share-secret"
];
diff --git a/frontend/src/const/routes.ts b/frontend/src/const/routes.ts
index 95a2e83c6c..8188fef862 100644
--- a/frontend/src/const/routes.ts
+++ b/frontend/src/const/routes.ts
@@ -421,6 +421,7 @@ export const ROUTE_PATHS = Object.freeze({
)
},
Public: {
+ ShareSecretPage: setRoute("/shared/new", "/shared/new"),
ViewSharedSecretByIDPage: setRoute("/shared/secret/$secretId", "/shared/secret/$secretId"),
ViewSecretRequestByIDPage: setRoute(
"/secret-request/secret/$secretRequestId",
diff --git a/frontend/src/pages/organization/SecretSharingPage/SecretSharingPage.tsx b/frontend/src/pages/organization/SecretSharingPage/SecretSharingPage.tsx
index 5fb125b471..ea33738356 100644
--- a/frontend/src/pages/organization/SecretSharingPage/SecretSharingPage.tsx
+++ b/frontend/src/pages/organization/SecretSharingPage/SecretSharingPage.tsx
@@ -1,7 +1,7 @@
import { Helmet } from "react-helmet";
import { useTranslation } from "react-i18next";
-import { PageHeader } from "@app/components/v2";
+import { PageHeader } from "@app/components/v3";
import { ProjectType } from "@app/hooks/api/projects/types";
import { ShareSecretSection } from "./ShareSecretSection";
@@ -11,18 +11,21 @@ export const SecretSharingPage = () => {
return (
<>
<Helmet>
- <title>{t("common.head-title", { title: t("approval.title") })}</title>
+ <title>{t("common.head-title", { title: "Secret Sharing" })}</title>
<link rel="icon" href="/infisical.ico" />
<meta property="og:image" content="/images/message.png" />
- <meta property="og:title" content={String(t("approval.og-title"))} />
- <meta name="og:description" content={String(t("approval.og-description"))} />
+ <meta property="og:title" content="Secret Sharing" />
+ <meta
+ name="og:description"
+ content="Share sensitive information through secure, expiring links."
+ />
</Helmet>
<div className="h-full">
- <div className="mx-auto h-full w-full max-w-8xl bg-page text-foreground-inverse">
+ <div className="mx-auto flex h-full w-full max-w-8xl flex-col gap-8 bg-page text-foreground-inverse">
<PageHeader
scope={ProjectType.SecretManager}
title="Secret Sharing"
- description="Share secrets securely using a shareable link"
+ description="Send and request sensitive information through secure, expiring links."
/>
<ShareSecretSection />
</div>
diff --git a/frontend/src/pages/organization/SecretSharingPage/ShareSecretSection.tsx b/frontend/src/pages/organization/SecretSharingPage/ShareSecretSection.tsx
index e8e11f6c36..23a43d89ae 100644
--- a/frontend/src/pages/organization/SecretSharingPage/ShareSecretSection.tsx
+++ b/frontend/src/pages/organization/SecretSharingPage/ShareSecretSection.tsx
@@ -1,7 +1,6 @@
-import { Helmet } from "react-helmet";
import { useNavigate, useSearch } from "@tanstack/react-router";
-import { Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
+import { Tabs, TabsContent, TabsList, TabsTrigger } from "@app/components/v3";
import { ROUTE_PATHS } from "@app/const/routes";
import { useOrganization } from "@app/context";
@@ -53,27 +52,19 @@ export const ShareSecretSection = () => {
};
return (
- <div>
- <Helmet>
- <title>Secret Sharing</title>
- <link rel="icon" href="/infisical.ico" />
- <meta property="og:image" content="/images/message.png" />
- </Helmet>
-
- <Tabs value={activeTab} onValueChange={updateSelectedTab}>
- <TabList>
- {tabs.map(({ key, label }) => (
- <Tab variant="project" value={key} key={`tab-${key}`}>
- {label}
- </Tab>
- ))}
- </TabList>
- {tabs.map(({ key, component: Component }) => (
- <TabPanel value={key} key={`tab-panel-${key}`}>
- <Component />
- </TabPanel>
+ <Tabs value={activeTab} onValueChange={updateSelectedTab}>
+ <TabsList variant="project" aria-label="Secret sharing sections">
+ {tabs.map(({ key, label }) => (
+ <TabsTrigger value={key} key={`tab-${key}`}>
+ {label}
+ </TabsTrigger>
))}
- </Tabs>
- </div>
+ </TabsList>
+ {tabs.map(({ key, component: Component }) => (
+ <TabsContent value={key} key={`tab-panel-${key}`}>
+ <Component />
+ </TabsContent>
+ ))}
+ </Tabs>
);
};
diff --git a/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/AddSecretRequestModal.tsx b/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/AddSecretRequestModal.tsx
index 682826f617..f74204779a 100644
--- a/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/AddSecretRequestModal.tsx
+++ b/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/AddSecretRequestModal.tsx
@@ -29,7 +29,8 @@ export const AddSecretRequestModal = ({ popUp, handlePopUpToggle }: Props) => {
<DialogHeader>
<DialogTitle>Request a Secret</DialogTitle>
<DialogDescription>
- Securely request one off secrets from your team or people outside your organization.
+ Create a link that lets someone send you a secret without exposing it over chat or
+ email.
</DialogDescription>
</DialogHeader>
<RequestSecretForm />
diff --git a/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestSecretForm.tsx b/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestSecretForm.tsx
index dd796b2b31..30cf718483 100644
--- a/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestSecretForm.tsx
+++ b/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestSecretForm.tsx
@@ -2,17 +2,19 @@ import { useState } from "react";
import { Controller, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { useSearch } from "@tanstack/react-router";
-import { Check, Copy, Info, ReplyIcon } from "lucide-react";
+import { format } from "date-fns";
+import { CheckCircle2, Info, ReplyIcon } from "lucide-react";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import {
Button,
+ CopyButton,
Field,
FieldDescription,
FieldError,
+ FieldGroup,
FieldLabel,
- IconButton,
Input,
Select,
SelectContent,
@@ -23,8 +25,8 @@ import {
TooltipContent,
TooltipTrigger
} from "@app/components/v3";
-import { useTimedReset } from "@app/hooks";
import { SecretSharingAccessType, useCreateSecretRequest } from "@app/hooks/api/secretSharing";
+import { ms } from "@app/lib/fn/time";
const schema = z.object({
name: z.string().optional(),
@@ -36,8 +38,8 @@ const schema = z.object({
});
const expiresInOptions = [
- { label: "5 min", value: "5m" },
- { label: "30 min", value: "30m" },
+ { label: "5 minutes", value: "5m" },
+ { label: "30 minutes", value: "30m" },
{ label: "1 hour", value: "1h" },
{ label: "1 day", value: "1d" },
{ label: "7 days", value: "7d" },
@@ -45,13 +47,19 @@ const expiresInOptions = [
{ label: "30 days", value: "30d" }
];
+const formatExpiry = (expiresIn: string) => {
+ try {
+ return format(new Date(Date.now() + ms(expiresIn)), "MMM d, yyyy 'at' h:mm a");
+ } catch {
+ return null;
+ }
+};
+
export type FormData = z.infer<typeof schema>;
export const RequestSecretForm = () => {
const [secretLink, setSecretLink] = useState("");
- const [, isCopyingSecret, setCopyTextSecret] = useTimedReset<string>({
- initialState: "Copy to clipboard"
- });
+ const [linkExpiresAt, setLinkExpiresAt] = useState<string | null>(null);
const subOrganization = useSearch({
strict: false,
select: (el) => el?.subOrganization
@@ -63,7 +71,8 @@ export const RequestSecretForm = () => {
control,
reset,
handleSubmit,
- formState: { isSubmitting }
+ formState: { isSubmitting },
+ watch
} = useForm<FormData>({
resolver: zodResolver(schema),
defaultValues: {
@@ -71,6 +80,8 @@ export const RequestSecretForm = () => {
}
});
+ const resolvedExpiry = formatExpiry(watch("expiresIn"));
+
const onFormSubmit = async ({ name, accessType, expiresIn }: FormData) => {
const { id } = await createSecretRequest({
name,
@@ -84,133 +95,169 @@ export const RequestSecretForm = () => {
}
setSecretLink(link.toString());
+ setLinkExpiresAt(formatExpiry(expiresIn));
reset();
- navigator.clipboard.writeText(link.toString());
-
- createNotification({
- text: "Shared secret link copied to clipboard.",
- type: "success"
- });
+ try {
+ await navigator.clipboard.writeText(link.toString());
+ createNotification({
+ text: "Secret request link copied to clipboard.",
+ type: "success"
+ });
+ } catch {
+ createNotification({
+ text: "Request link created. Copy it below, your browser blocked clipboard access.",
+ type: "info"
+ });
+ }
};
- const hasSecretLink = Boolean(secretLink);
-
- return !hasSecretLink ? (
- <form onSubmit={handleSubmit(onFormSubmit)} className="flex flex-col gap-4">
- <Controller
- control={control}
- name="name"
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>
- Name <span className="text-xs text-muted italic">- Optional</span>
- </FieldLabel>
- <Input
- {...field}
- placeholder="API Key"
- type="text"
- isError={Boolean(error)}
- autoComplete="off"
- name="secret-request-name"
- />
- {error && <FieldError>{error.message}</FieldError>}
- </Field>
- )}
- />
-
- <Controller
- control={control}
- name="expiresIn"
- render={({ field: { onChange, ...field }, fieldState: { error } }) => (
- <Field>
- <FieldLabel>
- Expires In
- <Tooltip>
- <TooltipTrigger asChild>
- <Info className="size-3 cursor-help text-muted" />
- </TooltipTrigger>
- <TooltipContent className="max-w-xs">
- Select for how long someone is able to input the secret. If a secret is shared
- with you in time, it will remain available to you, even after the expiration.
- </TooltipContent>
- </Tooltip>
- </FieldLabel>
- <Select value={field.value} onValueChange={(e) => onChange(e)}>
- <SelectTrigger className="w-full">
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- {expiresInOptions.map(({ label, value: expiresInValue }) => (
- <SelectItem value={String(expiresInValue || "")} key={label}>
- {label}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- {error && <FieldError>{error.message}</FieldError>}
- </Field>
- )}
- />
-
- <Controller
- control={control}
- name="accessType"
- defaultValue={SecretSharingAccessType.Organization}
- render={({ field: { onChange, ...field }, fieldState: { error } }) => (
- <Field>
- <FieldLabel>
- General Access
- <Tooltip>
- <TooltipTrigger asChild>
- <Info className="size-3 cursor-help text-muted" />
- </TooltipTrigger>
- <TooltipContent>Select who is able to input the secret</TooltipContent>
- </Tooltip>
- </FieldLabel>
- <Select value={field.value} onValueChange={(e) => onChange(e)}>
- <SelectTrigger className="w-full">
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- <SelectItem value={SecretSharingAccessType.Anyone}>Anyone</SelectItem>
- <SelectItem value={SecretSharingAccessType.Organization}>
- People within your organization
- </SelectItem>
- </SelectContent>
- </Select>
- <FieldDescription>Controls who can provide the requested secret</FieldDescription>
- {error && <FieldError>{error.message}</FieldError>}
- </Field>
- )}
- />
- <div className="flex w-full justify-end">
- <Button variant="project" type="submit" isPending={isSubmitting} isDisabled={isSubmitting}>
- Create Request Link
- </Button>
- </div>
- </form>
- ) : (
- <>
- <div className="relative flex items-center justify-between rounded-md border border-border bg-container p-2 pr-5 pl-3 text-base text-label">
- <p className="mr-4 break-all">{secretLink}</p>
- <IconButton
- aria-label="copy icon"
- variant="ghost-muted"
- size="sm"
- className="absolute top-1 right-1"
+ if (secretLink) {
+ return (
+ <div className="flex flex-col gap-4">
+ <div className="flex items-start gap-2.5">
+ <CheckCircle2 className="mt-0.5 size-4 shrink-0 text-success" />
+ <div>
+ <p className="text-sm font-medium text-foreground">Request Link Created</p>
+ <p className="mt-0.5 text-xs text-accent">
+ Send this link to whoever holds the secret. The value they submit is encrypted and
+ only visible to your organization.
+ </p>
+ </div>
+ </div>
+
+ <div className="rounded-md border border-border bg-container">
+ <div className="flex items-start justify-between gap-2 p-3">
+ <p className="min-w-0 font-mono text-xs break-all text-label">{secretLink}</p>
+ <CopyButton value={secretLink} ariaLabel="Copy request link" size="sm" />
+ </div>
+ {linkExpiresAt && (
+ <div className="border-t border-border px-3 py-2 text-2xs text-muted">
+ Accepts a secret until {linkExpiresAt}
+ </div>
+ )}
+ </div>
+
+ <Button
+ variant="project"
+ size="lg"
+ isFullWidth
onClick={() => {
- navigator.clipboard.writeText(secretLink);
- setCopyTextSecret("Copied");
+ setSecretLink("");
+ setLinkExpiresAt(null);
}}
>
- {isCopyingSecret ? <Check className="size-4" /> : <Copy className="size-4" />}
- </IconButton>
+ Request Another Secret
+ <ReplyIcon />
+ </Button>
</div>
- <Button className="w-full" variant="project" size="lg" onClick={() => setSecretLink("")}>
- Request Another Secret
- <ReplyIcon />
- </Button>
- </>
+ );
+ }
+
+ return (
+ <form onSubmit={handleSubmit(onFormSubmit)}>
+ <FieldGroup>
+ <Controller
+ control={control}
+ name="name"
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel htmlFor="request-secret-name">
+ Name <span className="text-xs text-muted italic">- Optional</span>
+ </FieldLabel>
+ <Input
+ {...field}
+ id="request-secret-name"
+ name="secret-request-name"
+ autoComplete="off"
+ placeholder="API Key"
+ type="text"
+ isError={Boolean(error)}
+ />
+ <FieldDescription>
+ Only visible to your organization, never to the sender.
+ </FieldDescription>
+ {error && <FieldError>{error.message}</FieldError>}
+ </Field>
+ )}
+ />
+
+ <Controller
+ control={control}
+ name="expiresIn"
+ render={({ field: { onChange, ...field }, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel htmlFor="request-secret-expires-in">
+ Expires In
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Info className="size-3 cursor-help text-muted" />
+ </TooltipTrigger>
+ <TooltipContent className="max-w-xs">
+ Once the link expires no one can submit a secret through it. A secret submitted
+ before then stays available to you.
+ </TooltipContent>
+ </Tooltip>
+ </FieldLabel>
+ <Select value={field.value} onValueChange={(e) => onChange(e)}>
+ <SelectTrigger className="w-full" id="request-secret-expires-in">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {expiresInOptions.map(({ label, value: expiresInValue }) => (
+ <SelectItem value={String(expiresInValue || "")} key={label}>
+ {label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ {resolvedExpiry && (
+ <FieldDescription>
+ The link stops accepting a secret on {resolvedExpiry}.
+ </FieldDescription>
+ )}
+ {error && <FieldError>{error.message}</FieldError>}
+ </Field>
+ )}
+ />
+
+ <Controller
+ control={control}
+ name="accessType"
+ defaultValue={SecretSharingAccessType.Organization}
+ render={({ field: { onChange, ...field }, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel htmlFor="request-secret-access-type">Who Can Respond</FieldLabel>
+ <Select value={field.value} onValueChange={(e) => onChange(e)}>
+ <SelectTrigger className="w-full" id="request-secret-access-type">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value={SecretSharingAccessType.Anyone}>Anyone</SelectItem>
+ <SelectItem value={SecretSharingAccessType.Organization}>
+ People within your organization
+ </SelectItem>
+ </SelectContent>
+ </Select>
+ <FieldDescription>
+ Restricting to your organization requires the sender to sign in to Infisical.
+ </FieldDescription>
+ {error && <FieldError>{error.message}</FieldError>}
+ </Field>
+ )}
+ />
+
+ <div className="flex w-full justify-end">
+ <Button
+ variant="project"
+ type="submit"
+ isPending={isSubmitting}
+ isDisabled={isSubmitting}
+ >
+ Create Request Link
+ </Button>
+ </div>
+ </FieldGroup>
+ </form>
);
};
diff --git a/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestSecretTab.tsx b/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestSecretTab.tsx
index a3b131a60c..a988b0653a 100644
--- a/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestSecretTab.tsx
+++ b/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestSecretTab.tsx
@@ -55,7 +55,7 @@ export const RequestSecretTab = () => {
Secret Requests
<DocumentationLinkBadge href="https://infisical.com/docs/documentation/platform/secret-sharing" />
</CardTitle>
- <CardDescription>Request and manage secrets from your team</CardDescription>
+ <CardDescription>Manage links that let others send you a secret.</CardDescription>
<CardAction>
<Button
variant="project"
@@ -88,7 +88,9 @@ export const RequestSecretTab = () => {
</AlertDialogMedia>
<AlertDialogTitle>Delete secret request?</AlertDialogTitle>
<AlertDialogDescription>
- This action cannot be undone. The secret request link will no longer be accessible.
+ This action cannot be undone. The link for
+ {` ${popUp.deleteSecretRequestConfirmation.data?.name || "this request"} `}
+ will no longer accept a secret.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
diff --git a/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestedSecretsRow.tsx b/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestedSecretsRow.tsx
index 5eb3b43885..2e3e7bd33e 100644
--- a/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestedSecretsRow.tsx
+++ b/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestedSecretsRow.tsx
@@ -52,7 +52,9 @@ export const RequestedSecretsRow = ({
return (
<TableRow key={row.id}>
- <TableCell isTruncatable>{row.name || <span className="text-muted">&mdash;</span>}</TableCell>
+ <TableCell isTruncatable>
+ {row.name || <span className="text-muted">Unnamed request</span>}
+ </TableCell>
<TableCell>
<Tooltip>
<TooltipTrigger asChild>
@@ -77,7 +79,7 @@ export const RequestedSecretsRow = ({
{row.expiresAt ? (
format(new Date(row.expiresAt), "MMM d, yyyy h:mm a")
) : (
- <span className="text-muted">&mdash;</span>
+ <span className="text-muted">Never</span>
)}
</TableCell>
<TableCell>
@@ -113,31 +115,45 @@ export const RequestedSecretsRow = ({
)}
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <IconButton className="ml-auto" variant="ghost" size="xs" aria-label="actions">
+ <IconButton
+ className="ml-auto"
+ variant="ghost"
+ size="xs"
+ aria-label={`Actions for ${row.name || "secret request"}`}
+ >
<Ellipsis className="size-4" />
</IconButton>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
- <DropdownMenuItem
- isDisabled={Boolean(row.encryptedSecret) || isExpired}
- onClick={() => {
- navigator.clipboard.writeText(
- `${window.location.origin}/secret-request/secret/${row.id}`
- );
- createNotification({
- text: "Shared secret link copied to clipboard.",
- type: "success"
- });
- }}
- >
- <Copy />
- Copy Link
- </DropdownMenuItem>
+ {!row.encryptedSecret && (
+ <DropdownMenuItem
+ isDisabled={isExpired}
+ onClick={async () => {
+ try {
+ await navigator.clipboard.writeText(
+ `${window.location.origin}/secret-request/secret/${row.id}`
+ );
+ createNotification({
+ text: "Secret request link copied to clipboard.",
+ type: "success"
+ });
+ } catch {
+ createNotification({
+ text: "Could not copy the link. Your browser blocked clipboard access.",
+ type: "error"
+ });
+ }
+ }}
+ >
+ <Copy />
+ Copy Link
+ </DropdownMenuItem>
+ )}
<DropdownMenuItem
variant="danger"
onClick={() =>
handlePopUpOpen("deleteSecretRequestConfirmation", {
- name: "delete",
+ name: row.name || "this request",
id: row.id
})
}
diff --git a/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestedSecretsTable.tsx b/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestedSecretsTable.tsx
index 4b47f41195..b385b81f28 100644
--- a/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestedSecretsTable.tsx
+++ b/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestedSecretsTable.tsx
@@ -29,7 +29,7 @@ type Props = {
export const RequestedSecretsTable = ({ handlePopUpOpen }: Props) => {
const [page, setPage] = useState(1);
const [perPage, setPerPage] = useState(10);
- const { isPending, data } = useGetSecretRequests({
+ const { isPending, isError, data } = useGetSecretRequests({
offset: (page - 1) * perPage,
limit: perPage
});
@@ -38,14 +38,14 @@ export const RequestedSecretsTable = ({ handlePopUpOpen }: Props) => {
return (
<div>
- {(isPending || hasSecrets) && (
+ {(isPending || hasSecrets) && !isError && (
<Table>
<TableHeader>
<TableRow>
<TableHead className="w-1/4">Name</TableHead>
<TableHead>Access Type</TableHead>
- <TableHead>Created</TableHead>
- <TableHead>Expires</TableHead>
+ <TableHead>Created At</TableHead>
+ <TableHead>Expires At</TableHead>
<TableHead>Status</TableHead>
<TableHead aria-label="button" className="w-5" />
</TableRow>
@@ -70,20 +70,33 @@ export const RequestedSecretsTable = ({ handlePopUpOpen }: Props) => {
</TableBody>
</Table>
)}
- {hasSecrets && data.totalCount >= perPage && data.totalCount !== undefined && (
+ {hasSecrets && data.totalCount > perPage && (
<Pagination
count={data.totalCount}
page={page}
perPage={perPage}
onChangePage={(newPage) => setPage(newPage)}
- onChangePerPage={(newPerPage) => setPerPage(newPerPage)}
+ onChangePerPage={(newPerPage) => {
+ setPerPage(newPerPage);
+ setPage(1);
+ }}
/>
)}
- {!isPending && !data?.secrets?.length && (
+ {!isPending && isError && (
<Empty className="border">
<EmptyHeader>
- <EmptyTitle>No secrets requested yet</EmptyTitle>
- <EmptyDescription>Request a secret to get started</EmptyDescription>
+ <EmptyTitle>Could Not Load Secret Requests</EmptyTitle>
+ <EmptyDescription>Refresh the page to try again.</EmptyDescription>
+ </EmptyHeader>
+ </Empty>
+ )}
+ {!isPending && !isError && !data?.secrets?.length && (
+ <Empty className="border">
+ <EmptyHeader>
+ <EmptyTitle>No Secret Requests</EmptyTitle>
+ <EmptyDescription>
+ Create a link that lets someone send you a secret securely.
+ </EmptyDescription>
</EmptyHeader>
</Empty>
)}
diff --git a/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RevealSecretValueModal.tsx b/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RevealSecretValueModal.tsx
index 0764a98197..c9691deefe 100644
--- a/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RevealSecretValueModal.tsx
+++ b/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RevealSecretValueModal.tsx
@@ -1,5 +1,6 @@
-import { ClipboardCheckIcon, Copy } from "lucide-react";
+import { Check, Copy } from "lucide-react";
+import { createNotification } from "@app/components/notifications";
import {
Button,
Dialog,
@@ -7,13 +8,9 @@ import {
DialogDescription,
DialogFooter,
DialogHeader,
- DialogTitle,
- IconButton,
- Tooltip,
- TooltipContent,
- TooltipTrigger
+ DialogTitle
} from "@app/components/v3";
-import { useToggle } from "@app/hooks";
+import { useTimedReset } from "@app/hooks";
import { UsePopUpState } from "@app/hooks/usePopUp";
type Props = {
@@ -28,41 +25,39 @@ type ContentProps = {
};
const Content = ({ secretValue, onClose }: ContentProps) => {
- const [isSecretValueCopied, setIsSecretValueCopied] = useToggle(false);
+ const [, isSecretValueCopied, setCopyText] = useTimedReset<string>({
+ initialState: "Copy to clipboard"
+ });
return (
<>
- <div className="relative flex items-start justify-between rounded-md border border-border bg-container p-2 pr-5 pl-3 text-base text-label">
- <p className="mr-4 max-h-128 thin-scrollbar min-w-0 overflow-y-auto break-all">
+ <div className="rounded-md border border-border bg-container p-3 text-base text-label">
+ <p className="max-h-128 thin-scrollbar min-w-0 overflow-y-auto font-mono break-all whitespace-pre-wrap">
{secretValue}
</p>
- <Tooltip>
- <TooltipTrigger asChild>
- <IconButton
- aria-label="copy icon"
- variant="ghost"
- size="sm"
- className="absolute top-1 right-1"
- onClick={() => {
- navigator.clipboard.writeText(secretValue);
- setIsSecretValueCopied.on();
- }}
- >
- {isSecretValueCopied ? (
- <ClipboardCheckIcon className="size-4" />
- ) : (
- <Copy className="size-4" />
- )}
- </IconButton>
- </TooltipTrigger>
- <TooltipContent>Click to copy</TooltipContent>
- </Tooltip>
</div>
<DialogFooter>
- <Button variant="outline" onClick={onClose}>
+ <Button variant="ghost" onClick={onClose}>
Close
</Button>
+ <Button
+ variant="project"
+ onClick={async () => {
+ try {
+ await navigator.clipboard.writeText(secretValue);
+ setCopyText("Copied");
+ } catch {
+ createNotification({
+ text: "Could not copy the value. Your browser blocked clipboard access.",
+ type: "error"
+ });
+ }
+ }}
+ >
+ {isSecretValueCopied ? <Check /> : <Copy />}
+ {isSecretValueCopied ? "Copied" : "Copy Value"}
+ </Button>
</DialogFooter>
</>
);
@@ -77,12 +72,12 @@ export const RevealSecretValueModal = ({ isOpen, onOpenChange, popUp }: Props) =
<Dialog open={isOpen} onOpenChange={onOpenChange}>
<DialogContent className="max-w-xl">
<DialogHeader>
- <DialogTitle>Shared secret value</DialogTitle>
- {data?.secretRequestName && (
- <DialogDescription>
- Shared secret value for secret request {data.secretRequestName}
- </DialogDescription>
- )}
+ <DialogTitle>Requested Secret Value</DialogTitle>
+ <DialogDescription>
+ {data?.secretRequestName
+ ? `Submitted for ${data.secretRequestName}.`
+ : "Submitted through your secret request."}
+ </DialogDescription>
</DialogHeader>
<Content secretValue={data?.secretValue} onClose={() => onOpenChange?.(false)} />
</DialogContent>
diff --git a/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/AddShareSecretModal.tsx b/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/AddShareSecretModal.tsx
index 23368b043c..c56713cb10 100644
--- a/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/AddShareSecretModal.tsx
+++ b/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/AddShareSecretModal.tsx
@@ -1,11 +1,4 @@
-import {
- Dialog,
- DialogBody,
- DialogContent,
- DialogDescription,
- DialogHeader,
- DialogTitle
-} from "@app/components/v3";
+import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "@app/components/v3";
import { useOrganization } from "@app/context";
import { UsePopUpState } from "@app/hooks/usePopUp";
import { ShareSecretForm } from "@app/pages/public/ShareSecretPage/components";
@@ -21,18 +14,20 @@ type Props = {
export const AddShareSecretModal = ({ popUp, handlePopUpToggle }: Props) => {
const { currentOrg } = useOrganization();
return (
- <Dialog
+ <Sheet
open={popUp?.createSharedSecret?.isOpen}
onOpenChange={(isOpen) => {
handlePopUpToggle("createSharedSecret", isOpen);
}}
>
- <DialogContent className="max-w-xl">
- <DialogHeader>
- <DialogTitle>Share a Secret</DialogTitle>
- <DialogDescription>Securely share one off secrets with your team.</DialogDescription>
- </DialogHeader>
- <DialogBody>
+ <SheetContent className="w-full sm:max-w-xl">
+ <SheetHeader>
+ <SheetTitle>Share a Secret</SheetTitle>
+ <SheetDescription>
+ Create an encrypted link with controls for access, expiration, and delivery.
+ </SheetDescription>
+ </SheetHeader>
+ <div className="flex min-h-0 flex-1 flex-col overflow-y-auto p-4">
<ShareSecretForm
isPublic={false}
value={(popUp.createSharedSecret.data as { value?: string })?.value}
@@ -42,8 +37,8 @@ export const AddShareSecretModal = ({ popUp, handlePopUpToggle }: Props) => {
maxSharedSecretLifetime={currentOrg?.maxSharedSecretLifetime}
maxSharedSecretViewLimit={currentOrg?.maxSharedSecretViewLimit}
/>
- </DialogBody>
- </DialogContent>
- </Dialog>
+ </div>
+ </SheetContent>
+ </Sheet>
);
};
diff --git a/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretTab.tsx b/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretTab.tsx
index ee33b2f0ee..f558d4e9d0 100644
--- a/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretTab.tsx
+++ b/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretTab.tsx
@@ -37,7 +37,7 @@ export const ShareSecretTab = () => {
const deleteSecretShare = useDeleteSharedSecret();
const onDeleteApproved = async () => {
- deleteSecretShare.mutateAsync({
+ await deleteSecretShare.mutateAsync({
sharedSecretId: (popUp?.deleteSharedSecretConfirmation?.data as DeleteModalData)?.id
});
createNotification({
@@ -55,7 +55,7 @@ export const ShareSecretTab = () => {
Shared Secrets
<DocumentationLinkBadge href="https://infisical.com/docs/documentation/platform/secret-sharing" />
</CardTitle>
- <CardDescription>Manage and view your shared secrets</CardDescription>
+ <CardDescription>Manage active links, access limits, and expiration.</CardDescription>
<CardAction>
<Button
variant="project"
@@ -83,12 +83,18 @@ export const ShareSecretTab = () => {
</AlertDialogMedia>
<AlertDialogTitle>Delete shared secret?</AlertDialogTitle>
<AlertDialogDescription>
- This action cannot be undone. The shared secret link will no longer be accessible.
+ This action cannot be undone. The link for
+ {` ${(popUp.deleteSharedSecretConfirmation.data as DeleteModalData)?.name || "this secret"} `}
+ will no longer be accessible.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
- <AlertDialogAction variant="danger" onClick={onDeleteApproved}>
+ <AlertDialogAction
+ variant="danger"
+ onClick={onDeleteApproved}
+ isPending={deleteSecretShare.isPending}
+ >
Delete
</AlertDialogAction>
</AlertDialogFooter>
diff --git a/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretsRow.tsx b/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretsRow.tsx
index fc3a627f8a..51ec031dad 100644
--- a/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretsRow.tsx
+++ b/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretsRow.tsx
@@ -1,6 +1,8 @@
+import { useSearch } from "@tanstack/react-router";
import { format } from "date-fns";
-import { ClockAlertIcon, ClockIcon, Ellipsis, Mail, MailOpen, Trash2 } from "lucide-react";
+import { ClockAlertIcon, ClockIcon, Copy, Ellipsis, Mail, MailOpen, Trash2 } from "lucide-react";
+import { createNotification } from "@app/components/notifications";
import {
Badge,
DropdownMenu,
@@ -17,6 +19,18 @@ import {
import { TSharedSecret } from "@app/hooks/api/secretSharing";
import { UsePopUpState } from "@app/hooks/usePopUp";
+const getStatusLabel = ({
+ isTimeExpired,
+ isViewsExhausted
+}: {
+ isTimeExpired: boolean;
+ isViewsExhausted: boolean;
+}) => {
+ if (isViewsExhausted) return "Views Used";
+ if (isTimeExpired) return "Expired";
+ return "Active";
+};
+
export const ShareSecretsRow = ({
row,
handlePopUpOpen
@@ -33,18 +47,17 @@ export const ShareSecretsRow = ({
}
) => void;
}) => {
+ const subOrganization = useSearch({
+ strict: false,
+ select: (search) => search?.subOrganization
+ });
const lastViewedAt = row.lastViewedAt
? format(new Date(row.lastViewedAt), "MMM d, yyyy h:mm a")
: undefined;
- let isExpired = false;
- if (row.expiresAfterViews !== null && row.expiresAfterViews <= 0) {
- isExpired = true;
- }
-
- if (row.expiresAt !== null && new Date(row.expiresAt) < new Date()) {
- isExpired = true;
- }
+ const isViewsExhausted = row.expiresAfterViews !== null && row.expiresAfterViews <= 0;
+ const isTimeExpired = row.expiresAt !== null && new Date(row.expiresAt) < new Date();
+ const isExpired = isViewsExhausted || isTimeExpired;
return (
<TableRow key={row.id}>
@@ -52,9 +65,13 @@ export const ShareSecretsRow = ({
<Tooltip>
<TooltipTrigger asChild>
{lastViewedAt ? (
- <MailOpen className="size-4 text-accent" />
+ <span className="flex size-7 items-center justify-center rounded-md border border-info/10 bg-info/10">
+ <MailOpen className="size-4 text-info" />
+ </span>
) : (
- <Mail className="size-4 text-accent" />
+ <span className="flex size-7 items-center justify-center rounded-md border border-border bg-container">
+ <Mail className="size-4 text-muted opacity-70" />
+ </span>
)}
</TooltipTrigger>
<TooltipContent>
@@ -62,7 +79,7 @@ export const ShareSecretsRow = ({
</TooltipContent>
</Tooltip>
</TableCell>
- <TableCell>{row.name || <span className="text-muted">&mdash;</span>}</TableCell>
+ <TableCell>{row.name || <span className="text-muted">Unnamed secret</span>}</TableCell>
<TableCell>{format(new Date(row.createdAt), "MMM d, yyyy h:mm a")}</TableCell>
<TableCell>{format(new Date(row.expiresAt), "MMM d, yyyy h:mm a")}</TableCell>
@@ -70,28 +87,55 @@ export const ShareSecretsRow = ({
{row.expiresAfterViews !== null ? (
row.expiresAfterViews
) : (
- <span className="text-muted">&mdash;</span>
+ <span className="text-muted">Unlimited</span>
)}
</TableCell>
<TableCell>
<Badge variant={isExpired ? "danger" : "success"}>
{isExpired ? <ClockAlertIcon /> : <ClockIcon />}
- {isExpired ? "Expired" : "Active"}
+ {getStatusLabel({ isTimeExpired, isViewsExhausted })}
</Badge>
</TableCell>
<TableCell>
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <IconButton variant="ghost" size="xs" aria-label="actions">
+ <IconButton
+ variant="ghost"
+ size="xs"
+ aria-label={`Actions for ${row.name || "shared secret"}`}
+ >
<Ellipsis className="size-4" />
</IconButton>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
+ <DropdownMenuItem
+ onClick={async () => {
+ try {
+ const link = new URL(`${window.location.origin}/shared/secret/${row.id}`);
+ if (subOrganization) {
+ link.searchParams.set("subOrganization", subOrganization);
+ }
+ await navigator.clipboard.writeText(link.toString());
+ createNotification({
+ text: "Shared secret link copied to clipboard.",
+ type: "success"
+ });
+ } catch {
+ createNotification({
+ text: "Could not copy the link. Your browser blocked clipboard access.",
+ type: "error"
+ });
+ }
+ }}
+ >
+ <Copy />
+ Copy Link
+ </DropdownMenuItem>
<DropdownMenuItem
variant="danger"
onClick={() =>
handlePopUpOpen("deleteSharedSecretConfirmation", {
- name: "delete",
+ name: row.name || "this secret",
id: row.id
})
}
diff --git a/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretsTable.tsx b/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretsTable.tsx
index dbdc2e7b85..fcbdc36ea2 100644
--- a/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretsTable.tsx
+++ b/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretsTable.tsx
@@ -35,7 +35,7 @@ type Props = {
export const ShareSecretsTable = ({ handlePopUpOpen }: Props) => {
const [page, setPage] = useState(1);
const [perPage, setPerPage] = useState(10);
- const { isPending, data } = useGetSharedSecrets({
+ const { isPending, isError, data } = useGetSharedSecrets({
offset: (page - 1) * perPage,
limit: perPage
});
@@ -43,15 +43,15 @@ export const ShareSecretsTable = ({ handlePopUpOpen }: Props) => {
return (
<div>
- {(isPending || hasSecrets) && (
+ {(isPending || hasSecrets) && !isError && (
<Table>
<TableHeader>
<TableRow>
<TableHead className="w-5" />
<TableHead className="w-1/4">Name</TableHead>
- <TableHead>Created</TableHead>
- <TableHead>Expires</TableHead>
- <TableHead>Views Left</TableHead>
+ <TableHead>Created At</TableHead>
+ <TableHead>Expires At</TableHead>
+ <TableHead>Views Remaining</TableHead>
<TableHead>Status</TableHead>
<TableHead aria-label="button" className="w-5" />
</TableRow>
@@ -76,20 +76,33 @@ export const ShareSecretsTable = ({ handlePopUpOpen }: Props) => {
</TableBody>
</Table>
)}
- {hasSecrets && data.totalCount >= perPage && data.totalCount !== undefined && (
+ {hasSecrets && data.totalCount > perPage && (
<Pagination
count={data.totalCount}
page={page}
perPage={perPage}
onChangePage={(newPage) => setPage(newPage)}
- onChangePerPage={(newPerPage) => setPerPage(newPerPage)}
+ onChangePerPage={(newPerPage) => {
+ setPerPage(newPerPage);
+ setPage(1);
+ }}
/>
)}
- {!isPending && !data?.secrets?.length && (
+ {!isPending && isError && (
<Empty className="border">
<EmptyHeader>
- <EmptyTitle>No secrets shared yet</EmptyTitle>
- <EmptyDescription>Share a secret to get started</EmptyDescription>
+ <EmptyTitle>Could Not Load Shared Secrets</EmptyTitle>
+ <EmptyDescription>Refresh the page to try again.</EmptyDescription>
+ </EmptyHeader>
+ </Empty>
+ )}
+ {!isPending && !isError && !data?.secrets?.length && (
+ <Empty className="border">
+ <EmptyHeader>
+ <EmptyTitle>No Shared Secrets</EmptyTitle>
+ <EmptyDescription>
+ Create a secure link to share sensitive information.
+ </EmptyDescription>
</EmptyHeader>
</Empty>
)}
diff --git a/frontend/src/pages/public/ShareSecretPage/ShareSecretPage.tsx b/frontend/src/pages/public/ShareSecretPage/ShareSecretPage.tsx
index 3f38a3a244..dd9f111dd1 100644
--- a/frontend/src/pages/public/ShareSecretPage/ShareSecretPage.tsx
+++ b/frontend/src/pages/public/ShareSecretPage/ShareSecretPage.tsx
@@ -1,35 +1,41 @@
import { Helmet } from "react-helmet";
+import { LockKeyhole } from "lucide-react";
-import { AuthPageBackground } from "@app/components/auth/AuthPageBackground";
-import { AuthPageFooter } from "@app/components/auth/AuthPageFooter";
-import { AuthPageHeader } from "@app/components/auth/AuthPageHeader";
-import { Card, CardContent, CardHeader, CardTitle } from "@app/components/v3";
+import { AuthPageLayout } from "@app/components/auth/AuthPageLayout";
+import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@app/components/v3";
import { ShareSecretForm } from "./components";
export const ShareSecretPage = () => {
return (
- <div className="relative flex max-h-screen min-h-screen flex-col overflow-y-auto bg-linear-to-tr from-card via-page-deep to-card px-4">
- <AuthPageBackground />
+ <>
<Helmet>
<title>Securely Share Secrets | Infisical</title>
<link rel="icon" href="/infisical.ico" />
<meta property="og:image" content="/images/message.png" />
- <meta property="og:title" content="" />
- <meta name="og:description" content="" />
+ <meta property="og:title" content="Securely Share Secrets" />
+ <meta
+ name="og:description"
+ content="Create an encrypted, expiring link for sensitive information."
+ />
</Helmet>
- <AuthPageHeader />
-
- <Card className="z-50 m-auto w-full max-w-xl">
- <CardHeader>
- <CardTitle>Share a Secret</CardTitle>
- </CardHeader>
- <CardContent className="flex flex-col gap-y-4">
- <ShareSecretForm isPublic />
- </CardContent>
- </Card>
-
- <AuthPageFooter />
- </div>
+ <AuthPageLayout variant="focused" contentClassName="max-w-xl">
+ <Card>
+ <CardHeader>
+ <CardTitle>
+ <LockKeyhole className="size-4" />
+ Share a Secret
+ </CardTitle>
+ <CardDescription>
+ Create an encrypted link that expires on your terms. The secret stays masked by
+ default.
+ </CardDescription>
+ </CardHeader>
+ <CardContent className="flex flex-col gap-y-4">
+ <ShareSecretForm isPublic />
+ </CardContent>
+ </Card>
+ </AuthPageLayout>
+ </>
);
};
diff --git a/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx b/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx
index 08ebde58d2..8870212829 100644
--- a/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx
+++ b/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx
@@ -1,9 +1,19 @@
-import { useState } from "react";
+import { useMemo, useState } from "react";
import { Controller, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { useSearch } from "@tanstack/react-router";
-import { Check, ClipboardCheck, Copy, ForwardIcon, Info, Lock } from "lucide-react";
-import { twMerge } from "tailwind-merge";
+import { format } from "date-fns";
+import {
+ CalendarClock,
+ CheckCircle2,
+ Eye,
+ EyeOff,
+ ForwardIcon,
+ Info,
+ Lock,
+ MailCheck,
+ SlidersHorizontal
+} from "lucide-react";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
@@ -14,12 +24,19 @@ import {
AccordionTrigger,
Badge,
Button,
+ CopyButton,
Field,
FieldDescription,
FieldError,
+ FieldGroup,
FieldLabel,
- IconButton,
+ FieldLegend,
+ FieldSet,
Input,
+ InputGroup,
+ InputGroupAddon,
+ InputGroupButton,
+ InputGroupInput,
Select,
SelectContent,
SelectItem,
@@ -31,15 +48,14 @@ import {
TooltipContent,
TooltipTrigger
} from "@app/components/v3";
-import { useTimedReset } from "@app/hooks";
+import { useToggle } from "@app/hooks";
import { useCreatePublicSharedSecret, useCreateSharedSecret } from "@app/hooks/api";
import { SecretSharingAccessType } from "@app/hooks/api/secretSharing";
import { ms } from "@app/lib/fn/time";
-// values in ms
const expiresInOptions = [
- { label: "5 min", value: "5m" },
- { label: "30 min", value: "30m" },
+ { label: "5 minutes", value: "5m" },
+ { label: "30 minutes", value: "30m" },
{ label: "1 hour", value: "1h" },
{ label: "1 day", value: "1d" },
{ label: "7 days", value: "7d" },
@@ -47,15 +63,21 @@ const expiresInOptions = [
{ label: "30 days", value: "30d" }
];
-const viewLimitOptions = [
- { label: "Unlimited", value: false },
- { label: "Limited", value: true }
-];
+const MAX_RECIPIENTS = 100;
+const ABSOLUTE_VIEW_CEILING = 1000;
-const schema = z.object({
+const parseRecipients = (emails?: string) =>
+ emails
+ ? emails
+ .split(",")
+ .map((email) => email.trim())
+ .filter(Boolean)
+ : [];
+
+const baseSchema = z.object({
name: z.string().optional(),
password: z.string().optional(),
- secret: z.string().min(1),
+ secret: z.string().min(1, "Enter the value you want to share."),
expiresIn: z.string(),
viewLimit: z.string(),
shouldLimitView: z.boolean(),
@@ -65,22 +87,74 @@ const schema = z.object({
.optional()
.refine(
(val) => {
- if (!val) return true;
- const emails = val
- .split(",")
- .map((email) => email.trim())
- .filter((email) => email !== "");
- if (emails.length > 100) return false;
- return emails.every((email) => z.string().email().safeParse(email).success);
+ const recipients = parseRecipients(val);
+ if (recipients.length > MAX_RECIPIENTS) return false;
+ return recipients.every((email) => z.string().email().safeParse(email).success);
},
{
- message: "Must be a comma-separated list of valid emails (max 100) or empty."
+ message: `Enter up to ${MAX_RECIPIENTS} valid emails, separated by commas.`
}
),
allowExternalEmails: z.boolean().optional()
});
-export type FormData = z.infer<typeof schema>;
+export type FormData = z.infer<typeof baseSchema>;
+
+const buildSchema = (maxSharedSecretViewLimit?: number | null) =>
+ baseSchema.superRefine((data, ctx) => {
+ if (data.shouldLimitView) {
+ const views = Number(data.viewLimit);
+ const ceiling = maxSharedSecretViewLimit ?? ABSOLUTE_VIEW_CEILING;
+
+ if (!Number.isInteger(views) || views < 1) {
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ path: ["viewLimit"],
+ message: "Enter a whole number of views, 1 or greater."
+ });
+ } else if (views > ceiling) {
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ path: ["viewLimit"],
+ message: `Enter at most ${ceiling} view${ceiling === 1 ? "" : "s"}.`
+ });
+ }
+ }
+
+ if (data.allowExternalEmails && parseRecipients(data.emails).length > 0 && !data.password) {
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ path: ["password"],
+ message: "External recipients need a password to open the secret."
+ });
+ }
+ });
+
+type ShareResult =
+ | { kind: "link"; url: string; expiresAt: string; views: string }
+ | { kind: "email"; recipientCount: number; requiresAccount: boolean };
+
+const describeResult = (result: ShareResult) => {
+ if (result.kind === "link") {
+ return "Save the link below before leaving this page.";
+ }
+
+ const plural = result.recipientCount === 1 ? "" : "s";
+
+ if (result.requiresAccount) {
+ return `Sent to ${result.recipientCount} recipient${plural}. Only those with an Infisical account will receive a link.`;
+ }
+
+ return `Sent to ${result.recipientCount} recipient${plural}. Each one receives a unique link.`;
+};
+
+const formatExpiry = (expiresIn: string) => {
+ try {
+ return format(new Date(Date.now() + ms(expiresIn)), "MMM d, yyyy 'at' h:mm a");
+ } catch {
+ return null;
+ }
+};
type Props = {
isPublic: boolean; // whether or not this is a public (non-authenticated) secret sharing form
@@ -97,10 +171,8 @@ export const ShareSecretForm = ({
maxSharedSecretLifetime,
maxSharedSecretViewLimit
}: Props) => {
- const [secretLink, setSecretLink] = useState<string | null>(null);
- const [, isCopyingSecret, setCopyTextSecret] = useTimedReset<string>({
- initialState: "Copy to clipboard"
- });
+ const [result, setResult] = useState<ShareResult | null>(null);
+ const [isPasswordVisible, setIsPasswordVisible] = useToggle(false);
const subOrganization = useSearch({
strict: false,
select: (el) => el?.subOrganization
@@ -115,9 +187,15 @@ export const ShareSecretForm = ({
? expiresInOptions.filter((v) => ms(v.value) / 1000 <= maxSharedSecretLifetime)
: expiresInOptions;
+ const isLifetimeCapped = expiresInOptions.length !== filteredExpiresInOptions.length;
+ const isViewLimitEnforced = Boolean(maxSharedSecretViewLimit);
+
+ const schema = useMemo(() => buildSchema(maxSharedSecretViewLimit), [maxSharedSecretViewLimit]);
+
const {
control,
reset,
+ setValue,
handleSubmit,
formState: { isSubmitting },
watch
@@ -126,7 +204,8 @@ export const ShareSecretForm = ({
defaultValues: {
secret: value || "",
viewLimit: maxSharedSecretViewLimit?.toString() ?? "1",
- shouldLimitView: Boolean(maxSharedSecretViewLimit),
+ shouldLimitView: isViewLimitEnforced,
+ accessType: isPublic ? undefined : SecretSharingAccessType.Organization,
expiresIn:
filteredExpiresInOptions[Math.min(filteredExpiresInOptions.length - 1, 2)].value.toString()
}
@@ -135,10 +214,13 @@ export const ShareSecretForm = ({
const isLimitingView = watch("shouldLimitView");
const isAllowingExternalEmails = watch("allowExternalEmails");
const accessType = watch("accessType");
+ const selectedExpiresIn = watch("expiresIn");
const isOrgAccess =
accessType === SecretSharingAccessType.Organization || !allowSecretSharingOutsideOrganization;
+ const resolvedExpiry = formatExpiry(selectedExpiresIn);
+
const onFormSubmit = async ({
name,
password,
@@ -150,7 +232,7 @@ export const ShareSecretForm = ({
shouldLimitView,
allowExternalEmails
}: FormData) => {
- const processedEmails = emails ? emails.split(",").map((e) => e.trim()) : undefined;
+ const recipients = parseRecipients(emails);
const { id } = await createSharedSecret.mutateAsync({
name,
@@ -159,19 +241,19 @@ export const ShareSecretForm = ({
expiresIn,
maxViews: shouldLimitView ? Number(viewLimit) : undefined,
accessType: formAccessType,
- authorizedEmails: processedEmails,
+ authorizedEmails: recipients.length ? recipients : undefined,
allowExternalEmails
});
- if (processedEmails && processedEmails.length > 0) {
- setSecretLink("");
+ if (recipients.length > 0) {
+ const requiresAccount = !allowExternalEmails && !isOrgAccess;
- const showAccountRequiredMessage = !allowExternalEmails && !isOrgAccess;
+ setResult({ kind: "email", recipientCount: recipients.length, requiresAccount });
createNotification({
- text: showAccountRequiredMessage
- ? `If the provided ${processedEmails.length > 1 ? "emails are" : "email is"} associated with an Infisical account they will receive a link`
- : `Secret link has been sent to the provided ${processedEmails.length > 1 ? "emails" : "email"}`,
+ text: requiresAccount
+ ? `If the provided ${recipients.length > 1 ? "emails are" : "email is"} associated with an Infisical account they will receive a link`
+ : `Secret link has been sent to the provided ${recipients.length > 1 ? "emails" : "email"}`,
type: "success"
});
} else {
@@ -180,314 +262,418 @@ export const ShareSecretForm = ({
link.searchParams.set("subOrganization", subOrganization);
}
- setSecretLink(link.toString());
-
- navigator.clipboard.writeText(link.toString());
-
- createNotification({
- text: "Shared secret link copied to clipboard.",
- type: "success"
+ setResult({
+ kind: "link",
+ url: link.toString(),
+ expiresAt: formatExpiry(expiresIn) ?? "",
+ views: shouldLimitView ? viewLimit : "Unlimited"
});
+
+ try {
+ await navigator.clipboard.writeText(link.toString());
+ createNotification({
+ text: "Shared secret link copied to clipboard.",
+ type: "success"
+ });
+ } catch {
+ createNotification({
+ text: "Secret link created. Copy it below, your browser blocked clipboard access.",
+ type: "info"
+ });
+ }
}
reset();
};
- if (secretLink === null)
+ if (result !== null) {
return (
- <form onSubmit={handleSubmit(onFormSubmit)} className="flex flex-col gap-4">
- {!isPublic && (
+ <div className="flex flex-col gap-5 py-2">
+ <div className="flex flex-col items-center px-4 text-center">
+ <div className="mb-3 flex size-11 items-center justify-center rounded-full border border-success/20 bg-success/10">
+ {result.kind === "link" ? (
+ <CheckCircle2 className="size-5 text-success" />
+ ) : (
+ <MailCheck className="size-5 text-success" />
+ )}
+ </div>
+ <div className="max-w-sm">
+ <p className="text-lg font-semibold text-foreground">
+ {result.kind === "link" ? "Secret Link Created" : "Secret Link Sent"}
+ </p>
+ <p className="mt-1.5 text-sm leading-relaxed text-accent">{describeResult(result)}</p>
+ </div>
+ </div>
+
+ {result.kind === "link" && (
+ <div className="rounded-md border border-border bg-container">
+ <div className="flex items-center justify-between gap-3 p-3">
+ <p className="min-w-0 font-mono text-xs break-all text-foreground">{result.url}</p>
+ <CopyButton value={result.url} ariaLabel="Copy secret link" size="sm" />
+ </div>
+ {(result.expiresAt || result.views) && (
+ <div className="flex flex-wrap gap-x-4 gap-y-1 border-t border-border px-3 py-2 text-2xs text-muted">
+ {result.expiresAt && (
+ <span className="inline-flex items-center gap-1.5">
+ <CalendarClock className="size-3" /> Expires {result.expiresAt}
+ </span>
+ )}
+ <span className="inline-flex items-center gap-1.5">
+ {result.views === "Unlimited"
+ ? "Unlimited views"
+ : `${result.views} view${result.views === "1" ? "" : "s"}`}
+ </span>
+ </div>
+ )}
+ </div>
+ )}
+
+ <Button variant="project" size="lg" isFullWidth onClick={() => setResult(null)}>
+ Share Another Secret
+ <ForwardIcon />
+ </Button>
+ </div>
+ );
+ }
+
+ return (
+ <form onSubmit={handleSubmit(onFormSubmit)}>
+ <FieldGroup>
+ <FieldSet>
+ {!isPublic && (
+ <Controller
+ control={control}
+ name="name"
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel htmlFor="share-secret-name">
+ Name <span className="text-xs text-muted italic">- Optional</span>
+ </FieldLabel>
+ <Input
+ {...field}
+ id="share-secret-name"
+ placeholder="API Key"
+ type="text"
+ autoComplete="off"
+ autoCorrect="off"
+ spellCheck={false}
+ isError={Boolean(error)}
+ />
+ <FieldDescription>
+ Only visible to your organization, never to the recipient.
+ </FieldDescription>
+ {error && <FieldError>{error.message}</FieldError>}
+ </Field>
+ )}
+ />
+ )}
<Controller
control={control}
- name="name"
+ name="secret"
render={({ field, fieldState: { error } }) => (
<Field>
- <FieldLabel>
- Name <span className="text-xs text-muted italic">- Optional</span>
- </FieldLabel>
- <Input
+ <FieldLabel htmlFor="share-secret-value">Secret Value</FieldLabel>
+ <TextArea
+ placeholder="Enter sensitive data to share via an encrypted link"
{...field}
- placeholder="API Key"
- type="text"
- autoComplete="off"
- autoCorrect="off"
- spellCheck={false}
- isError={Boolean(error)}
+ id="share-secret-value"
+ disabled={value !== undefined}
+ aria-invalid={Boolean(error)}
/>
{error && <FieldError>{error.message}</FieldError>}
</Field>
)}
/>
- )}
- <Controller
- control={control}
- name="secret"
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>Your Secret</FieldLabel>
- <TextArea
- placeholder="Enter sensitive data to share via an encrypted link"
- {...field}
- className={twMerge("min-h-[70px] resize-y", isPublic ? "h-40" : "h-14")}
- disabled={value !== undefined}
- aria-invalid={Boolean(error)}
- />
- {error && <FieldError>{error.message}</FieldError>}
- </Field>
- )}
- />
- <Controller
- control={control}
- name="expiresIn"
- render={({ field: { onChange, ...field }, fieldState: { error } }) => (
- <Field>
- <FieldLabel>Expires In</FieldLabel>
- <Select value={field.value} onValueChange={(e) => onChange(e)}>
- <SelectTrigger className="w-full">
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- {expiresInOptions.map(({ label, value: expiresInValue }) => (
- <SelectItem
- value={String(expiresInValue || "")}
- key={label}
- disabled={!filteredExpiresInOptions.some((v) => v.label === label)}
- >
- {label}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- {expiresInOptions.length !== filteredExpiresInOptions.length && (
- <FieldDescription className="text-info">
- Limited to {filteredExpiresInOptions[filteredExpiresInOptions.length - 1].label}{" "}
- by organization
- </FieldDescription>
- )}
- {error && <FieldError>{error.message}</FieldError>}
- </Field>
- )}
- />
- <Controller
- control={control}
- name="password"
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>
- Password <span className="text-xs text-muted italic">- Optional</span>
- </FieldLabel>
- <Input
- {...field}
- placeholder="Password"
- type="password"
- autoComplete="new-password"
- autoCorrect="off"
- spellCheck={false}
- aria-autocomplete="none"
- data-form-type="other"
- isError={Boolean(error)}
- />
- {error && <FieldError>{error.message}</FieldError>}
- </Field>
- )}
- />
+ </FieldSet>
- {!isPublic && (
+ <FieldSet>
+ <FieldLegend variant="label">Expiration</FieldLegend>
<Controller
control={control}
- name="accessType"
- defaultValue={SecretSharingAccessType.Organization}
+ name="expiresIn"
render={({ field: { onChange, ...field }, fieldState: { error } }) => (
- <Field orientation="horizontal">
- <Toggle
- variant="project"
- checked={
- field.value === SecretSharingAccessType.Organization ||
- !allowSecretSharingOutsideOrganization
- }
- disabled={!allowSecretSharingOutsideOrganization}
- onCheckedChange={(v) =>
- onChange(
- v ? SecretSharingAccessType.Organization : SecretSharingAccessType.Anyone
- )
- }
- />
- <FieldLabel className="flex-auto">
- <span className="flex items-center">
- Limit access to people within organization
- {!allowSecretSharingOutsideOrganization && (
- <Tooltip>
- <TooltipTrigger asChild>
- <Lock className="ml-2 size-3 text-muted" />
- </TooltipTrigger>
- <TooltipContent>Enforced by your organization</TooltipContent>
- </Tooltip>
- )}
- </span>
- </FieldLabel>
+ <Field>
+ <FieldLabel htmlFor="share-secret-expires-in">Expires In</FieldLabel>
+ <Select value={field.value} onValueChange={(e) => onChange(e)}>
+ <SelectTrigger className="w-full" id="share-secret-expires-in">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {expiresInOptions.map(({ label, value: expiresInValue }) => {
+ const isAvailable = filteredExpiresInOptions.some((v) => v.label === label);
+
+ return (
+ <SelectItem
+ value={String(expiresInValue || "")}
+ key={label}
+ disabled={!isAvailable}
+ >
+ {label}
+ </SelectItem>
+ );
+ })}
+ </SelectContent>
+ </Select>
+ <FieldDescription>
+ {resolvedExpiry ? `The link stops working on ${resolvedExpiry}.` : null}
+ {isLifetimeCapped && (
+ <span className="mt-0.5 block text-info">
+ Your organization caps links at{" "}
+ {filteredExpiresInOptions[filteredExpiresInOptions.length - 1].label}.
+ </span>
+ )}
+ </FieldDescription>
{error && <FieldError>{error.message}</FieldError>}
</Field>
)}
/>
- )}
+ </FieldSet>
- {(!isPublic || maxSharedSecretViewLimit === null || isLimitingView) && (
- <Accordion type="single" collapsible variant="ghost">
- <AccordionItem value="advance-settings">
- <AccordionTrigger>Advanced Settings</AccordionTrigger>
- <AccordionContent className="flex flex-col gap-y-4">
- <div className="flex w-full items-end gap-2 overflow-visible">
- {maxSharedSecretViewLimit === null && (
- <Controller
- control={control}
- name="shouldLimitView"
- render={({ field: { onChange, ...field }, fieldState: { error } }) => (
- <Field className="flex-1">
- <FieldLabel>Max Views</FieldLabel>
- <Select
- value={field.value.toString()}
- onValueChange={(e) => onChange(e === "true")}
+ <Accordion type="single" collapsible>
+ <AccordionItem value="options">
+ <AccordionTrigger>
+ <span className="flex flex-1 items-center justify-between gap-3">
+ <span className="inline-flex items-center gap-2">
+ <SlidersHorizontal className="size-4 text-accent" />
+ More Options
+ </span>
+ <span className="text-xs font-normal text-muted">Password, views, delivery</span>
+ </span>
+ </AccordionTrigger>
+ <AccordionContent className="flex flex-col gap-6 p-5">
+ <FieldSet className="gap-4" aria-labelledby="share-secret-access-heading">
+ <FieldLabel
+ id="share-secret-access-heading"
+ className="w-full gap-3 text-sm font-medium text-foreground"
+ >
+ Access
+ <span className="h-px flex-1 bg-border" aria-hidden="true" />
+ </FieldLabel>
+
+ {!isViewLimitEnforced && (
+ <Controller
+ control={control}
+ name="shouldLimitView"
+ render={({ field: { onChange, value: isChecked, ...field } }) => (
+ <Field orientation="horizontal">
+ <Toggle
+ {...field}
+ variant="project"
+ id="share-secret-limit-views"
+ checked={isChecked}
+ onCheckedChange={onChange}
+ />
+ <FieldLabel htmlFor="share-secret-limit-views" className="flex-auto">
+ Limit how many times it can be viewed
+ </FieldLabel>
+ </Field>
+ )}
+ />
+ )}
+
+ {isLimitingView && (
+ <Controller
+ control={control}
+ name="viewLimit"
+ render={({ field: { onChange, ...field }, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel htmlFor="share-secret-view-limit">
+ Maximum Views
+ {isViewLimitEnforced && (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Lock className="size-3 text-muted" />
+ </TooltipTrigger>
+ <TooltipContent>Enforced by your organization</TooltipContent>
+ </Tooltip>
+ )}
+ </FieldLabel>
+ <Input
+ onChange={onChange}
+ {...field}
+ id="share-secret-view-limit"
+ min={1}
+ max={maxSharedSecretViewLimit ?? ABSOLUTE_VIEW_CEILING}
+ type="number"
+ isError={Boolean(error)}
+ />
+ {isViewLimitEnforced && (
+ <FieldDescription className="text-info">
+ Your organization caps links at {maxSharedSecretViewLimit} view
+ {maxSharedSecretViewLimit === 1 ? "" : "s"}.
+ </FieldDescription>
+ )}
+ {error && <FieldError>{error.message}</FieldError>}
+ </Field>
+ )}
+ />
+ )}
+
+ <Controller
+ control={control}
+ name="password"
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel htmlFor="share-secret-password">
+ Password <span className="text-xs text-muted italic">- Optional</span>
+ </FieldLabel>
+ <InputGroup>
+ <InputGroupInput
+ {...field}
+ id="share-secret-password"
+ name="shared-secret-passphrase"
+ placeholder="Password"
+ type={isPasswordVisible ? "text" : "password"}
+ autoComplete="off"
+ autoCorrect="off"
+ spellCheck={false}
+ aria-autocomplete="none"
+ data-form-type="other"
+ data-1p-ignore
+ data-lpignore="true"
+ aria-invalid={Boolean(error)}
+ />
+ <InputGroupAddon align="inline-end">
+ <InputGroupButton
+ onClick={setIsPasswordVisible.toggle}
+ aria-label={isPasswordVisible ? "Hide password" : "Show password"}
>
- <SelectTrigger className="w-full">
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- {viewLimitOptions.map(({ label, value: viewLimitValue }) => (
- <SelectItem
- value={viewLimitValue.toString()}
- key={viewLimitValue.toString()}
- >
- {label}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- {error && <FieldError>{error.message}</FieldError>}
- </Field>
- )}
- />
+ {isPasswordVisible ? <EyeOff /> : <Eye />}
+ </InputGroupButton>
+ </InputGroupAddon>
+ </InputGroup>
+ {error && <FieldError>{error.message}</FieldError>}
+ </Field>
)}
- {isLimitingView && (
- <Controller
- control={control}
- name="viewLimit"
- render={({ field: { onChange, ...field }, fieldState: { error } }) => (
- <Field className="flex-1">
- {maxSharedSecretViewLimit && <FieldLabel>Max Views</FieldLabel>}
- <Input
- onChange={onChange}
- {...field}
- min={1}
- max={maxSharedSecretViewLimit ?? 1000}
- type="number"
- isError={Boolean(error)}
- />
- {maxSharedSecretViewLimit && (
- <FieldDescription className="text-info">
- Limited to {maxSharedSecretViewLimit} view
- {maxSharedSecretViewLimit === 1 ? "" : "s"} by organization
- </FieldDescription>
+ />
+ </FieldSet>
+
+ {!isPublic && (
+ <FieldSet className="gap-4" aria-labelledby="share-secret-delivery-heading">
+ <FieldLabel
+ id="share-secret-delivery-heading"
+ className="w-full gap-3 text-sm font-medium text-foreground"
+ >
+ Delivery
+ <span className="h-px flex-1 bg-border" aria-hidden="true" />
+ </FieldLabel>
+ <Controller
+ control={control}
+ name="accessType"
+ render={({ field: { onChange, ...field }, fieldState: { error } }) => (
+ <Field orientation="horizontal">
+ <Toggle
+ variant="project"
+ id="share-secret-org-only"
+ checked={
+ field.value === SecretSharingAccessType.Organization ||
+ !allowSecretSharingOutsideOrganization
+ }
+ disabled={!allowSecretSharingOutsideOrganization}
+ onCheckedChange={(v) => {
+ if (v) {
+ setValue("allowExternalEmails", false, { shouldValidate: true });
+ }
+ onChange(
+ v
+ ? SecretSharingAccessType.Organization
+ : SecretSharingAccessType.Anyone
+ );
+ }}
+ />
+ <FieldLabel htmlFor="share-secret-org-only" className="flex-auto">
+ Limit access to people within organization
+ {!allowSecretSharingOutsideOrganization && (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Lock className="size-3 text-muted" />
+ </TooltipTrigger>
+ <TooltipContent>Enforced by your organization</TooltipContent>
+ </Tooltip>
)}
- {error && <FieldError>{error.message}</FieldError>}
- </Field>
- )}
- />
- )}
- </div>
- {!isPublic && (
- <>
- <Controller
- control={control}
- name="emails"
- render={({ field, fieldState: { error } }) => (
- <Field>
- <FieldLabel>
- Emails <span className="text-xs text-muted italic">- Optional</span>
+ </FieldLabel>
+ {error && <FieldError>{error.message}</FieldError>}
+ </Field>
+ )}
+ />
+
+ <Controller
+ control={control}
+ name="allowExternalEmails"
+ render={({
+ field: { onChange, value: isChecked, ...field },
+ fieldState: { error }
+ }) => (
+ <Field orientation="horizontal">
+ <Toggle
+ {...field}
+ variant="project"
+ id="share-secret-allow-external"
+ checked={isOrgAccess ? false : (isChecked ?? false)}
+ onCheckedChange={onChange}
+ disabled={isOrgAccess}
+ />
+ <FieldLabel htmlFor="share-secret-allow-external" className="flex-auto">
+ Allow recipients without an Infisical account
+ {!allowSecretSharingOutsideOrganization && (
<Tooltip>
<TooltipTrigger asChild>
- <Info className="size-3 cursor-help text-muted" />
+ <Lock className="size-3 text-muted" />
</TooltipTrigger>
- <TooltipContent className="max-w-sm">
- <p>
- Unique secret links will be emailed to each individual. The secret
- will only be accessible to those links.
- </p>
- <p className="mt-2">
- {isAllowingExternalEmails
- ? "External recipients (user without an Infisical account) will need the password to view the secret. Authorized recipients will also need a password if the secret is password-protected."
- : "Recipients must have an Infisical account to verify their identity."}
- </p>
+ <TooltipContent>
+ External sharing is disabled by your organization
</TooltipContent>
</Tooltip>
- </FieldLabel>
- <Input
- {...field}
- autoComplete="off"
- isError={Boolean(error)}
- />
- <FieldDescription>
- {isAllowingExternalEmails
- ? "All recipients will receive a link and need the password to access the secret. They don't need an Infisical account, but a password is mandatory in this case."
- : "Recipients must have an Infisical account to verify identity"}
- </FieldDescription>
- {error && <FieldError>{error.message}</FieldError>}
- </Field>
- )}
- />
- <Controller
- control={control}
- name="allowExternalEmails"
- render={({
- field: { onChange, value: isChecked, ...field },
- fieldState: { error }
- }) => (
- <Field orientation="horizontal">
- <Toggle
- variant="project"
- checked={isOrgAccess ? false : (isChecked ?? false)}
- onCheckedChange={onChange}
- disabled={isOrgAccess}
- id="allow-external-emails"
- {...field}
- />
- <FieldLabel className="flex-auto">
- <span className="flex items-center">
- Allow external recipients
- <Tooltip>
- <TooltipTrigger asChild>
- <Info className="ml-2 size-3 cursor-help text-muted" />
- </TooltipTrigger>
- <TooltipContent>
- When enabled, the defined emails will receive the secret link via
- email but will need the password to access the secret.
- </TooltipContent>
- </Tooltip>
- {!allowSecretSharingOutsideOrganization && (
- <Tooltip>
- <TooltipTrigger asChild>
- <Lock className="ml-2 size-3 text-muted" />
- </TooltipTrigger>
- <TooltipContent>
- External sharing is disabled by your organization
- </TooltipContent>
- </Tooltip>
- )}
- </span>
- </FieldLabel>
- {error && <FieldError>{error.message}</FieldError>}
- </Field>
- )}
- />
- </>
- )}
- </AccordionContent>
- </AccordionItem>
- </Accordion>
- )}
- <div className="flex w-full justify-end">
+ )}
+ </FieldLabel>
+ {error && <FieldError>{error.message}</FieldError>}
+ </Field>
+ )}
+ />
+
+ <Controller
+ control={control}
+ name="emails"
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel htmlFor="share-secret-emails">
+ Email Recipients{" "}
+ <span className="text-xs text-muted italic">- Optional</span>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Info className="size-3 cursor-help text-muted" />
+ </TooltipTrigger>
+ <TooltipContent className="max-w-sm">
+ Each recipient gets their own link. Leave this empty to get one link
+ you can share yourself.
+ </TooltipContent>
+ </Tooltip>
+ </FieldLabel>
+ <Input
+ {...field}
+ id="share-secret-emails"
+ autoComplete="off"
+ isError={Boolean(error)}
+ />
+ <FieldDescription>
+ {isAllowingExternalEmails
+ ? "Recipients do not need an Infisical account, but they do need the password above."
+ : "Recipients must sign in to Infisical so their identity can be verified."}
+ </FieldDescription>
+ {error && <FieldError>{error.message}</FieldError>}
+ </Field>
+ )}
+ />
+ </FieldSet>
+ )}
+ </AccordionContent>
+ </AccordionItem>
+ </Accordion>
+
+ <div className="flex w-full items-center justify-end gap-2">
{isPublic && (
- <Badge variant="ghost" className="mt-auto mr-auto">
+ <Badge variant="ghost" className="mr-auto">
<img
src="/images/logotransparent_trimmed.png"
alt="Infisical"
@@ -506,44 +692,7 @@ export const ShareSecretForm = ({
Create Secret Link
</Button>
</div>
- </form>
- );
-
- if (secretLink === "")
- return (
- <>
- <div className="relative flex items-center justify-center rounded-lg border border-border bg-container p-4 pr-6 text-foreground/85">
- <Check className="mr-2 size-4 text-success" />
- <span>Shared secret link has been emailed to select users.</span>
- </div>
- <Button className="w-full" variant="project" size="lg" onClick={() => setSecretLink(null)}>
- Share Another Secret
- <ForwardIcon />
- </Button>
- </>
- );
-
- return (
- <>
- <div className="relative flex items-center justify-between rounded-md border border-border bg-container p-2 pr-5 pl-3 text-base text-label">
- <p className="mr-4 break-all">{secretLink}</p>
- <IconButton
- aria-label="copy icon"
- variant="ghost-muted"
- size="sm"
- className="absolute top-1 right-1"
- onClick={() => {
- navigator.clipboard.writeText(secretLink || "");
- setCopyTextSecret("Copied");
- }}
- >
- {isCopyingSecret ? <ClipboardCheck className="size-4" /> : <Copy className="size-4" />}
- </IconButton>
- </div>
- <Button className="w-full" variant="project" size="lg" onClick={() => setSecretLink(null)}>
- Share Another Secret
- <ForwardIcon />
- </Button>
- </>
+ </FieldGroup>
+ </form>
);
};
diff --git a/frontend/src/pages/public/ShareSecretPage/legacy-route.tsx b/frontend/src/pages/public/ShareSecretPage/legacy-route.tsx
new file mode 100644
index 0000000000..3c18dcaa2f
--- /dev/null
+++ b/frontend/src/pages/public/ShareSecretPage/legacy-route.tsx
@@ -0,0 +1,7 @@
+import { createFileRoute, redirect } from "@tanstack/react-router";
+
+export const Route = createFileRoute("/share-secret")({
+ beforeLoad: () => {
+ throw redirect({ to: "/shared/new", replace: true });
+ }
+});
diff --git a/frontend/src/pages/public/ShareSecretPage/route.tsx b/frontend/src/pages/public/ShareSecretPage/route.tsx
index af7bfc55d8..07f719bcb1 100644
--- a/frontend/src/pages/public/ShareSecretPage/route.tsx
+++ b/frontend/src/pages/public/ShareSecretPage/route.tsx
@@ -15,6 +15,6 @@ const ShareSecretRoute = () => {
return <ShareSecretPage />;
};
-export const Route = createFileRoute("/share-secret")({
+export const Route = createFileRoute("/shared/new")({
component: ShareSecretRoute
});
diff --git a/frontend/src/pages/public/ViewSharedSecretByIDPage/ViewSharedSecretByIDPage.tsx b/frontend/src/pages/public/ViewSharedSecretByIDPage/ViewSharedSecretByIDPage.tsx
index eea16f3ea6..c55a057562 100644
--- a/frontend/src/pages/public/ViewSharedSecretByIDPage/ViewSharedSecretByIDPage.tsx
+++ b/frontend/src/pages/public/ViewSharedSecretByIDPage/ViewSharedSecretByIDPage.tsx
@@ -4,9 +4,7 @@ import { useNavigate, useParams } from "@tanstack/react-router";
import { AxiosError } from "axios";
import { addSeconds, formatISO } from "date-fns";
-import { AuthPageBackground } from "@app/components/auth/AuthPageBackground";
-import { AuthPageFooter } from "@app/components/auth/AuthPageFooter";
-import { AuthPageHeader } from "@app/components/auth/AuthPageHeader";
+import { AuthPageLayout } from "@app/components/auth/AuthPageLayout";
import { createNotification } from "@app/components/notifications";
import { Card, CardContent, CardHeader, CardTitle, PageLoader } from "@app/components/v3";
import { SessionStorageKeys } from "@app/const";
@@ -259,7 +257,7 @@ export const ViewSharedSecretByIDPage = () => {
}}
>
<h1 className="mb-5 text-lg font-semibold" style={{ color: brandingTheme?.textColor }}>
- View shared secret
+ View Shared Secret
</h1>
{secretContent}
</div>
@@ -270,22 +268,29 @@ export const ViewSharedSecretByIDPage = () => {
// Default: Infisical auth page layout
return (
- <div className="relative flex max-h-screen min-h-screen flex-col overflow-y-auto bg-page px-4 text-foreground scheme-dark">
- <AuthPageBackground />
+ <>
<Helmet>
<title>Securely Share Secrets | Infisical</title>
<meta property="og:image" content="/images/message.png" />
</Helmet>
- <AuthPageHeader />
- <div className="relative z-10 my-auto flex flex-col items-center py-10">
- <Card className="w-full max-w-xl">
- <CardHeader>
- <CardTitle>View shared secret</CardTitle>
- </CardHeader>
- <CardContent>{secretContent}</CardContent>
- </Card>
- </div>
- <AuthPageFooter />
- </div>
+ <AuthPageLayout variant="focused" contentClassName="max-w-xl">
+ <div className="flex flex-col items-center">
+ <Card className="w-full">
+ <CardHeader>
+ <CardTitle>View Shared Secret</CardTitle>
+ </CardHeader>
+ <CardContent>{secretContent}</CardContent>
+ </Card>
+ <a
+ href={ROUTE_PATHS.Public.ShareSecretPage.path}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="mt-4 text-xs text-muted underline-offset-4 transition-colors hover:text-foreground hover:underline"
+ >
+ Share your own secret
+ </a>
+ </div>
+ </AuthPageLayout>
+ </>
);
};
diff --git a/frontend/src/pages/public/ViewSharedSecretByIDPage/components/PasswordContainer.tsx b/frontend/src/pages/public/ViewSharedSecretByIDPage/components/PasswordContainer.tsx
index ba7dcb7668..5ee04e5d27 100644
--- a/frontend/src/pages/public/ViewSharedSecretByIDPage/components/PasswordContainer.tsx
+++ b/frontend/src/pages/public/ViewSharedSecretByIDPage/components/PasswordContainer.tsx
@@ -67,6 +67,7 @@ export const PasswordContainer = ({
render={({ field, fieldState: { error } }) => (
<Field style={brandingTheme ? { color: brandingTheme.textColor } : undefined}>
<FieldLabel
+ htmlFor="shared-secret-passphrase"
className={brandingTheme ? "text-[var(--muted-color)]" : ""}
style={
brandingTheme
@@ -79,9 +80,18 @@ export const PasswordContainer = ({
<div className="flex items-center gap-2">
<Input
{...field}
+ id="shared-secret-passphrase"
+ name="shared-secret-passphrase"
autoFocus
placeholder="Enter password to view secret"
type="password"
+ autoComplete="off"
+ autoCorrect="off"
+ spellCheck={false}
+ aria-autocomplete="none"
+ data-form-type="other"
+ data-1p-ignore
+ data-lpignore="true"
style={inputStyle}
className={twMerge(
"flex-1",
diff --git a/frontend/src/pages/public/ViewSharedSecretByIDPage/components/SecretContainer.tsx b/frontend/src/pages/public/ViewSharedSecretByIDPage/components/SecretContainer.tsx
index 3167f07fb4..a89fcdbdc2 100644
--- a/frontend/src/pages/public/ViewSharedSecretByIDPage/components/SecretContainer.tsx
+++ b/frontend/src/pages/public/ViewSharedSecretByIDPage/components/SecretContainer.tsx
@@ -1,4 +1,4 @@
-import { ClipboardCheckIcon, Copy, Eye, EyeOff, ForwardIcon } from "lucide-react";
+import { Check, Copy, Eye, EyeOff } from "lucide-react";
import { Button, IconButton } from "@app/components/v3";
import { useTimedReset, useToggle } from "@app/hooks";
@@ -12,14 +12,16 @@ type Props = {
brandingTheme?: BrandingTheme;
};
+// Fixed length so the mask never discloses how long the value is.
+const HIDDEN_SECRET = "••••••••••••••••";
+
export const SecretContainer = ({ secret, brandingTheme }: Props) => {
const [isVisible, setIsVisible] = useToggle(false);
+ const [hasCopyFailed, setHasCopyFailed] = useToggle(false);
const [, isCopyingSecret, setCopyTextSecret] = useTimedReset<string>({
initialState: "Copy to clipboard"
});
- const hiddenSecret = "*".repeat(secret.secretValue.length);
-
const panelStyle = brandingTheme
? {
backgroundColor: brandingTheme.panelBg,
@@ -35,64 +37,65 @@ export const SecretContainer = ({ secret, brandingTheme }: Props) => {
}
: undefined;
- const iconButtonStyle = brandingTheme
+ const primaryButtonStyle = brandingTheme
? {
- backgroundColor: brandingTheme.buttonBg,
+ backgroundColor: brandingTheme.inputBg,
+ borderColor: brandingTheme.panelBorder,
color: brandingTheme.textColor
}
: undefined;
+ const iconButtonStyle = brandingTheme ? { color: brandingTheme.textMutedColor } : undefined;
+
return (
<div style={panelStyle}>
<div
- className={`flex items-start justify-between rounded-md border p-2 pl-3 text-base ${
+ className={`relative rounded-md border p-3 ${
brandingTheme ? "" : "border-border bg-container text-label"
}`}
style={secretDisplayStyle}
>
- <p className="min-w-0 break-all whitespace-pre-wrap">
- {isVisible ? secret.secretValue : hiddenSecret}
- </p>
- <div className="ml-1 flex shrink-0 items-start gap-2 self-start">
- <IconButton
- aria-label="copy icon"
- variant="ghost"
- size="sm"
- onClick={() => {
- navigator.clipboard.writeText(secret.secretValue);
- setCopyTextSecret("Copied");
- }}
- style={iconButtonStyle}
- >
- {isCopyingSecret ? (
- <ClipboardCheckIcon className="size-4" />
- ) : (
- <Copy className="size-4" />
- )}
- </IconButton>
- <IconButton
- aria-label="toggle visibility"
- variant="ghost"
- size="sm"
- onClick={() => setIsVisible.toggle()}
- style={iconButtonStyle}
- >
- {isVisible ? <EyeOff className="size-4" /> : <Eye className="size-4" />}
- </IconButton>
- </div>
- </div>
- <SecretShareInfo secret={secret} brandingTheme={brandingTheme} />
- {!brandingTheme && (
- <Button
- className="mt-4 w-full"
- variant="project"
- size="lg"
- onClick={() => window.open("/share-secret", "_blank", "noopener")}
+ <pre className="max-h-80 min-h-20 thin-scrollbar overflow-x-auto overflow-y-auto pr-9 font-mono text-sm leading-relaxed wrap-break-word whitespace-pre-wrap">
+ {isVisible ? secret.secretValue : HIDDEN_SECRET}
+ </pre>
+ <IconButton
+ variant="ghost"
+ size="sm"
+ className="absolute top-1.5 right-1.5"
+ aria-label={isVisible ? "Hide value" : "Reveal value"}
+ onClick={() => setIsVisible.toggle()}
+ style={iconButtonStyle}
>
- Share Your Own Secret
- <ForwardIcon />
- </Button>
+ {isVisible ? <EyeOff className="size-4" /> : <Eye className="size-4" />}
+ </IconButton>
+ </div>
+
+ <Button
+ className="mt-3"
+ variant={brandingTheme ? "outline" : "project"}
+ size="lg"
+ isFullWidth
+ onClick={async () => {
+ try {
+ await navigator.clipboard.writeText(secret.secretValue);
+ setCopyTextSecret("Copied");
+ } catch {
+ setHasCopyFailed.on();
+ }
+ }}
+ style={primaryButtonStyle}
+ >
+ {isCopyingSecret ? <Check /> : <Copy />}
+ {isCopyingSecret ? "Copied" : "Copy Value"}
+ </Button>
+
+ {hasCopyFailed && (
+ <p className="mt-2 text-2xs text-danger">
+ Your browser blocked clipboard access. Reveal the value and copy it manually.
+ </p>
)}
+
+ <SecretShareInfo secret={secret} brandingTheme={brandingTheme} />
</div>
);
};
diff --git a/frontend/src/pages/public/ViewSharedSecretByIDPage/components/SecretShareInfo.tsx b/frontend/src/pages/public/ViewSharedSecretByIDPage/components/SecretShareInfo.tsx
index c8f53a2c71..7baae5e062 100644
--- a/frontend/src/pages/public/ViewSharedSecretByIDPage/components/SecretShareInfo.tsx
+++ b/frontend/src/pages/public/ViewSharedSecretByIDPage/components/SecretShareInfo.tsx
@@ -1,5 +1,5 @@
import { format } from "date-fns";
-import { Clock, Eye } from "lucide-react";
+import { CalendarClock, Eye } from "lucide-react";
import { TAccessSharedSecretResponse } from "@app/hooks/api/secretSharing";
@@ -33,7 +33,6 @@ export const SecretShareInfo = ({ secret, brandingTheme }: Props) => {
const infoStyle = brandingTheme
? {
- backgroundColor: brandingTheme.inputBg,
borderColor: brandingTheme.panelBorder,
color: brandingTheme.textMutedColor
}
@@ -43,25 +42,29 @@ export const SecretShareInfo = ({ secret, brandingTheme }: Props) => {
return (
<div
- className={`mt-4 flex flex-col gap-2 rounded-md border p-3 text-sm ${
- brandingTheme ? "" : "border-border bg-container text-label"
+ className={`mt-4 grid gap-3 border-t pt-4 text-sm sm:grid-cols-2 ${
+ brandingTheme ? "" : "border-border text-label"
}`}
style={infoStyle}
>
{timeRemaining && (
- <div className="flex items-center gap-2">
- <Clock className="size-3.5 shrink-0" style={iconStyle} />
- <span>Expires on {timeRemaining}</span>
+ <div className="flex items-start gap-2">
+ <CalendarClock className="mt-0.5 size-3.5 shrink-0" style={iconStyle} />
+ <div>
+ <p className="text-xs font-medium">Expires</p>
+ <p className="mt-0.5 text-xs opacity-80">{timeRemaining}</p>
+ </div>
</div>
)}
{viewsRemaining !== null && (
- <div className="flex items-center gap-2">
- <Eye className="size-3.5 shrink-0" style={iconStyle} />
- <span>
- {viewsRemaining === 0
- ? "This is the last time you can view this secret"
- : `${viewsRemaining} more view${viewsRemaining === 1 ? "" : "s"} remaining`}
- </span>
+ <div className="flex items-start gap-2">
+ <Eye className="mt-0.5 size-3.5 shrink-0" style={iconStyle} />
+ <div>
+ <p className="text-xs font-medium">Views Remaining</p>
+ <p className="mt-0.5 text-xs opacity-80">
+ {viewsRemaining === 0 ? "Last available view" : viewsRemaining}
+ </p>
+ </div>
</div>
)}
</div>
diff --git a/frontend/src/routeTree.gen.ts b/frontend/src/routeTree.gen.ts
index 77cbc69fa4..eab5ac3900 100644
--- a/frontend/src/routeTree.gen.ts
+++ b/frontend/src/routeTree.gen.ts
@@ -13,12 +13,13 @@ import { createFileRoute } from '@tanstack/react-router'
// Import Routes
import { Route as rootRoute } from './pages/root'
+import { Route as publicShareSecretPageLegacyRouteImport } from './pages/public/ShareSecretPage/legacy-route'
import { Route as middlewaresRestrictLoginSignupImport } from './pages/middlewares/restrict-login-signup'
import { Route as middlewaresAuthenticateImport } from './pages/middlewares/authenticate'
-import { Route as publicShareSecretPageRouteImport } from './pages/public/ShareSecretPage/route'
import { Route as authCliRedirectPageRouteImport } from './pages/auth/CliRedirectPage/route'
import { Route as indexImport } from './pages/index'
import { Route as middlewaresInjectOrgDetailsImport } from './pages/middlewares/inject-org-details'
+import { Route as publicShareSecretPageRouteImport } from './pages/public/ShareSecretPage/route'
import { Route as authSignUpInvitePageRouteImport } from './pages/auth/SignUpInvitePage/route'
import { Route as authRequestNewInvitePageRouteImport } from './pages/auth/RequestNewInvitePage/route'
import { Route as authEmailNotVerifiedPageRouteImport } from './pages/auth/EmailNotVerifiedPage/route'
@@ -412,6 +413,13 @@ const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsCertManager
// Create/Update Routes
+const publicShareSecretPageLegacyRouteRoute =
+ publicShareSecretPageLegacyRouteImport.update({
+ id: '/share-secret',
+ path: '/share-secret',
+ getParentRoute: () => rootRoute,
+ } as any)
+
const middlewaresRestrictLoginSignupRoute =
middlewaresRestrictLoginSignupImport.update({
id: '/_restrict-login-signup',
@@ -423,14 +431,6 @@ const middlewaresAuthenticateRoute = middlewaresAuthenticateImport.update({
getParentRoute: () => rootRoute,
} as any)
-const publicShareSecretPageRouteRoute = publicShareSecretPageRouteImport.update(
- {
- id: '/share-secret',
- path: '/share-secret',
- getParentRoute: () => rootRoute,
- } as any,
-)
-
const authCliRedirectPageRouteRoute = authCliRedirectPageRouteImport.update({
id: '/cli-redirect',
path: '/cli-redirect',
@@ -468,6 +468,14 @@ const middlewaresInjectOrgDetailsRoute =
getParentRoute: () => middlewaresAuthenticateRoute,
} as any)
+const publicShareSecretPageRouteRoute = publicShareSecretPageRouteImport.update(
+ {
+ id: '/shared/new',
+ path: '/shared/new',
+ getParentRoute: () => rootRoute,
+ } as any,
+)
+
const authSignUpInvitePageRouteRoute = authSignUpInvitePageRouteImport.update({
id: '/signupinvite',
path: '/signupinvite',
@@ -2673,13 +2681,6 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof authCliRedirectPageRouteImport
parentRoute: typeof rootRoute
}
- '/share-secret': {
- id: '/share-secret'
- path: '/share-secret'
- fullPath: '/share-secret'
- preLoaderRoute: typeof publicShareSecretPageRouteImport
- parentRoute: typeof rootRoute
- }
'/_authenticate': {
id: '/_authenticate'
path: ''
@@ -2694,6 +2695,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof middlewaresRestrictLoginSignupImport
parentRoute: typeof rootRoute
}
+ '/share-secret': {
+ id: '/share-secret'
+ path: '/share-secret'
+ fullPath: '/share-secret'
+ preLoaderRoute: typeof publicShareSecretPageLegacyRouteImport
+ parentRoute: typeof rootRoute
+ }
'/_authenticate/password-setup': {
id: '/_authenticate/password-setup'
path: '/password-setup'
@@ -2736,6 +2744,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof authSignUpInvitePageRouteImport
parentRoute: typeof middlewaresRestrictLoginSignupImport
}
+ '/shared/new': {
+ id: '/shared/new'
+ path: '/shared/new'
+ fullPath: '/shared/new'
+ preLoaderRoute: typeof publicShareSecretPageRouteImport
+ parentRoute: typeof rootRoute
+ }
'/_authenticate/_inject-org-details': {
id: '/_authenticate/_inject-org-details'
path: ''
@@ -6073,14 +6088,15 @@ const middlewaresRestrictLoginSignupRouteWithChildren =
export interface FileRoutesByFullPath {
'/': typeof indexRoute
'/cli-redirect': typeof authCliRedirectPageRouteRoute
- '/share-secret': typeof publicShareSecretPageRouteRoute
'': typeof organizationLayoutRouteWithChildren
+ '/share-secret': typeof publicShareSecretPageLegacyRouteRoute
'/password-setup': typeof authPasswordSetupPageRouteRoute
'/account-recovery': typeof authAccountRecoveryEmailPageRouteRoute
'/account-recovery-reset': typeof authAccountRecoveryResetPageRouteRoute
'/email-not-verified': typeof authEmailNotVerifiedPageRouteRoute
'/requestnewinvite': typeof authRequestNewInvitePageRouteRoute
'/signupinvite': typeof authSignUpInvitePageRouteRoute
+ '/shared/new': typeof publicShareSecretPageRouteRoute
'/personal-settings': typeof userLayoutRouteWithChildren
'/login': typeof RestrictLoginSignupLoginRouteWithChildren
'/signup': typeof RestrictLoginSignupSignupRouteWithChildren
@@ -6361,14 +6377,15 @@ export interface FileRoutesByFullPath {
export interface FileRoutesByTo {
'/': typeof indexRoute
'/cli-redirect': typeof authCliRedirectPageRouteRoute
- '/share-secret': typeof publicShareSecretPageRouteRoute
'': typeof organizationLayoutRouteWithChildren
+ '/share-secret': typeof publicShareSecretPageLegacyRouteRoute
'/password-setup': typeof authPasswordSetupPageRouteRoute
'/account-recovery': typeof authAccountRecoveryEmailPageRouteRoute
'/account-recovery-reset': typeof authAccountRecoveryResetPageRouteRoute
'/email-not-verified': typeof authEmailNotVerifiedPageRouteRoute
'/requestnewinvite': typeof authRequestNewInvitePageRouteRoute
'/signupinvite': typeof authSignUpInvitePageRouteRoute
+ '/shared/new': typeof publicShareSecretPageRouteRoute
'/personal-settings': typeof userPersonalSettingsPageRouteRoute
'/login': typeof authLoginPageRouteRoute
'/signup': typeof authSignUpPageRouteRoute
@@ -6623,15 +6640,16 @@ export interface FileRoutesById {
__root__: typeof rootRoute
'/': typeof indexRoute
'/cli-redirect': typeof authCliRedirectPageRouteRoute
- '/share-secret': typeof publicShareSecretPageRouteRoute
'/_authenticate': typeof middlewaresAuthenticateRouteWithChildren
'/_restrict-login-signup': typeof middlewaresRestrictLoginSignupRouteWithChildren
+ '/share-secret': typeof publicShareSecretPageLegacyRouteRoute
'/_authenticate/password-setup': typeof authPasswordSetupPageRouteRoute
'/_restrict-login-signup/account-recovery': typeof authAccountRecoveryEmailPageRouteRoute
'/_restrict-login-signup/account-recovery-reset': typeof authAccountRecoveryResetPageRouteRoute
'/_restrict-login-signup/email-not-verified': typeof authEmailNotVerifiedPageRouteRoute
'/_restrict-login-signup/requestnewinvite': typeof authRequestNewInvitePageRouteRoute
'/_restrict-login-signup/signupinvite': typeof authSignUpInvitePageRouteRoute
+ '/shared/new': typeof publicShareSecretPageRouteRoute
'/_authenticate/_inject-org-details': typeof middlewaresInjectOrgDetailsRouteWithChildren
'/_authenticate/personal-settings': typeof AuthenticatePersonalSettingsRouteWithChildren
'/_restrict-login-signup/login': typeof RestrictLoginSignupLoginRouteWithChildren
@@ -6924,14 +6942,15 @@ export interface FileRouteTypes {
fullPaths:
| '/'
| '/cli-redirect'
- | '/share-secret'
| ''
+ | '/share-secret'
| '/password-setup'
| '/account-recovery'
| '/account-recovery-reset'
| '/email-not-verified'
| '/requestnewinvite'
| '/signupinvite'
+ | '/shared/new'
| '/personal-settings'
| '/login'
| '/signup'
@@ -7211,14 +7230,15 @@ export interface FileRouteTypes {
to:
| '/'
| '/cli-redirect'
- | '/share-secret'
| ''
+ | '/share-secret'
| '/password-setup'
| '/account-recovery'
| '/account-recovery-reset'
| '/email-not-verified'
| '/requestnewinvite'
| '/signupinvite'
+ | '/shared/new'
| '/personal-settings'
| '/login'
| '/signup'
@@ -7471,15 +7491,16 @@ export interface FileRouteTypes {
| '__root__'
| '/'
| '/cli-redirect'
- | '/share-secret'
| '/_authenticate'
| '/_restrict-login-signup'
+ | '/share-secret'
| '/_authenticate/password-setup'
| '/_restrict-login-signup/account-recovery'
| '/_restrict-login-signup/account-recovery-reset'
| '/_restrict-login-signup/email-not-verified'
| '/_restrict-login-signup/requestnewinvite'
| '/_restrict-login-signup/signupinvite'
+ | '/shared/new'
| '/_authenticate/_inject-org-details'
| '/_authenticate/personal-settings'
| '/_restrict-login-signup/login'
@@ -7771,9 +7792,10 @@ export interface FileRouteTypes {
export interface RootRouteChildren {
indexRoute: typeof indexRoute
authCliRedirectPageRouteRoute: typeof authCliRedirectPageRouteRoute
- publicShareSecretPageRouteRoute: typeof publicShareSecretPageRouteRoute
middlewaresAuthenticateRoute: typeof middlewaresAuthenticateRouteWithChildren
middlewaresRestrictLoginSignupRoute: typeof middlewaresRestrictLoginSignupRouteWithChildren
+ publicShareSecretPageLegacyRouteRoute: typeof publicShareSecretPageLegacyRouteRoute
+ publicShareSecretPageRouteRoute: typeof publicShareSecretPageRouteRoute
publicViewSecretRequestByIDPageRouteRoute: typeof publicViewSecretRequestByIDPageRouteRoute
publicViewSharedSecretByIDPageRouteRoute: typeof publicViewSharedSecretByIDPageRouteRoute
}
@@ -7781,10 +7803,11 @@ export interface RootRouteChildren {
const rootRouteChildren: RootRouteChildren = {
indexRoute: indexRoute,
authCliRedirectPageRouteRoute: authCliRedirectPageRouteRoute,
- publicShareSecretPageRouteRoute: publicShareSecretPageRouteRoute,
middlewaresAuthenticateRoute: middlewaresAuthenticateRouteWithChildren,
middlewaresRestrictLoginSignupRoute:
middlewaresRestrictLoginSignupRouteWithChildren,
+ publicShareSecretPageLegacyRouteRoute: publicShareSecretPageLegacyRouteRoute,
+ publicShareSecretPageRouteRoute: publicShareSecretPageRouteRoute,
publicViewSecretRequestByIDPageRouteRoute:
publicViewSecretRequestByIDPageRouteRoute,
publicViewSharedSecretByIDPageRouteRoute:
@@ -7803,9 +7826,10 @@ export const routeTree = rootRoute
"children": [
"/",
"/cli-redirect",
- "/share-secret",
"/_authenticate",
"/_restrict-login-signup",
+ "/share-secret",
+ "/shared/new",
"/secret-request/secret/$secretRequestId",
"/shared/secret/$secretId"
]
@@ -7816,9 +7840,6 @@ export const routeTree = rootRoute
"/cli-redirect": {
"filePath": "auth/CliRedirectPage/route.tsx"
},
- "/share-secret": {
- "filePath": "public/ShareSecretPage/route.tsx"
- },
"/_authenticate": {
"filePath": "middlewares/authenticate.tsx",
"children": [
@@ -7844,6 +7865,9 @@ export const routeTree = rootRoute
"/_restrict-login-signup/admin/signup"
]
},
+ "/share-secret": {
+ "filePath": "public/ShareSecretPage/legacy-route.tsx"
+ },
"/_authenticate/password-setup": {
"filePath": "auth/PasswordSetupPage/route.tsx",
"parent": "/_authenticate"
@@ -7868,6 +7892,9 @@ export const routeTree = rootRoute
"filePath": "auth/SignUpInvitePage/route.tsx",
"parent": "/_restrict-login-signup"
},
+ "/shared/new": {
+ "filePath": "public/ShareSecretPage/route.tsx"
+ },
"/_authenticate/_inject-org-details": {
"filePath": "middlewares/inject-org-details.tsx",
"parent": "/_authenticate",
diff --git a/frontend/src/routes.ts b/frontend/src/routes.ts
index 62f173dc4c..e4fedd0532 100644
--- a/frontend/src/routes.ts
+++ b/frontend/src/routes.ts
@@ -455,8 +455,9 @@ const organizationRoutes = route("/organizations/$orgId", [
export const routes = rootRoute("root.tsx", [
index("index.tsx"),
route("/shared/secret/$secretId", "public/ViewSharedSecretByIDPage/route.tsx"),
+ route("/shared/new", "public/ShareSecretPage/route.tsx"),
route("/secret-request/secret/$secretRequestId", "public/ViewSecretRequestByIDPage/route.tsx"),
- route("/share-secret", "public/ShareSecretPage/route.tsx"),
+ route("/share-secret", "public/ShareSecretPage/legacy-route.tsx"),
route("/cli-redirect", "auth/CliRedirectPage/route.tsx"),
middleware("restrict-login-signup.tsx", [
route("/admin/signup", "admin/SignUpPage/route.tsx"),