diff --git a/backend/src/ee/services/dynamic-secret/providers/models.ts b/backend/src/ee/services/dynamic-secret/providers/models.ts index f3b4dba29..d803aab5b 100644 --- a/backend/src/ee/services/dynamic-secret/providers/models.ts +++ b/backend/src/ee/services/dynamic-secret/providers/models.ts @@ -249,7 +249,11 @@ export const DynamicSecretTotpSchema = z.discriminatedUnion("configType", [ }), z.object({ configType: z.literal(TotpConfigType.MANUAL), - secret: z.string().min(1), + secret: z + .string() + .trim() + .min(1) + .transform((val) => val.replace(/\s+/g, "")), period: z.number().optional(), algorithm: z.nativeEnum(TotpAlgorithm).optional(), digits: z.number().optional() diff --git a/docs/documentation/platform/dynamic-secrets/totp.mdx b/docs/documentation/platform/dynamic-secrets/totp.mdx index 82dc9501d..ca9b6eae1 100644 --- a/docs/documentation/platform/dynamic-secrets/totp.mdx +++ b/docs/documentation/platform/dynamic-secrets/totp.mdx @@ -7,7 +7,7 @@ The Infisical TOTP dynamic secret allows you to generate time-based one-time pas ## Prerequisite -- Infisical requires the OTP url from the TOTP provider. +- Infisical requires either the OTP url or the secret key from the TOTP provider. ## Set up Dynamic Secrets with TOTP @@ -41,10 +41,10 @@ The Infisical TOTP dynamic secret allows you to generate time-based one-time pas Time interval in seconds between generating new TOTP codes. - + Number of digits to generate in each TOTP code. - + Hash algorithm to use when generating TOTP codes. The supported algorithms are sha1, sha256, and sha512. @@ -58,33 +58,13 @@ The Infisical TOTP dynamic secret allows you to generate time-based one-time pas Once you've successfully configured the dynamic secret, you're ready to generate on-demand TOTPs. - To do this, simply click on the 'Generate' button which appears when hovering over the dynamic secret item. - Alternatively, you can initiate the creation of a new lease by selecting 'New Lease' from the dynamic secret lease list section. + To do this, simply click on the 'Generate' button which appears when hovering over the dynamic secret item. ![Dynamic Secret](/images/platform/dynamic-secrets/dynamic-secret-generate.png) - ![Dynamic Secret](/images/platform/dynamic-secrets/dynamic-secret-lease-empty.png) - - Once you click the `Generate` or the `New Lease` button, a new secret lease will be generated and the TOTP will be shown to you. + Once you click the `Generate` button, a new secret lease will be generated and the TOTP will be shown to you. ![Provision Lease](/images/platform/dynamic-secrets/totp-lease-value.png) - -## Audit or Revoke Leases - -Once you have created one or more leases, you will be able to access them by clicking on the respective dynamic secret item on the dashboard. -This will allow you to see the lease details and delete the lease ahead of its expiration time. - -![Provision Lease](/images/platform/dynamic-secrets/lease-data.png) - -## Renew Leases - -To extend the life of the generated dynamic secret lease past its initial time to live, simply click on the **Renew** button as illustrated below. -![Provision Lease](/images/platform/dynamic-secrets/dynamic-secret-lease-renew.png) - - - Lease renewals cannot exceed the maximum TTL set when configuring the dynamic - secret. - diff --git a/docs/images/platform/dynamic-secrets/dynamic-secret-setup-modal-totp-manual.png b/docs/images/platform/dynamic-secrets/dynamic-secret-setup-modal-totp-manual.png index cdb82b8dd..788852d85 100644 Binary files a/docs/images/platform/dynamic-secrets/dynamic-secret-setup-modal-totp-manual.png and b/docs/images/platform/dynamic-secrets/dynamic-secret-setup-modal-totp-manual.png differ diff --git a/frontend/src/views/SecretMainPage/components/ActionBar/CreateDynamicSecretForm/TotpInputForm.tsx b/frontend/src/views/SecretMainPage/components/ActionBar/CreateDynamicSecretForm/TotpInputForm.tsx index 58e30d4ea..29f4282cc 100644 --- a/frontend/src/views/SecretMainPage/components/ActionBar/CreateDynamicSecretForm/TotpInputForm.tsx +++ b/frontend/src/views/SecretMainPage/components/ActionBar/CreateDynamicSecretForm/TotpInputForm.tsx @@ -39,7 +39,11 @@ const formSchema = z.object({ }), z.object({ configType: z.literal(ConfigType.MANUAL), - secret: z.string().min(1), + secret: z + .string() + .trim() + .min(1) + .transform((val) => val.replace(/\s+/g, "")), period: z.number().optional(), algorithm: z.nativeEnum(TotpAlgorithm).optional(), digits: z.number().optional() @@ -214,7 +218,7 @@ export const TotpInputForm = ({ )} /> -
+
+

+ The period, digits, and algorithm values can remain at their defaults unless + your TOTP provider specifies otherwise. +

)}
diff --git a/frontend/src/views/SecretMainPage/components/DynamicSecretListView/DynamicSecretListView.tsx b/frontend/src/views/SecretMainPage/components/DynamicSecretListView/DynamicSecretListView.tsx index 8953ab2bc..22057a90c 100644 --- a/frontend/src/views/SecretMainPage/components/DynamicSecretListView/DynamicSecretListView.tsx +++ b/frontend/src/views/SecretMainPage/components/DynamicSecretListView/DynamicSecretListView.tsx @@ -101,10 +101,20 @@ export const DynamicSecretListView = ({ role="button" tabIndex={0} onKeyDown={(evt) => { + // no lease view for TOTP because it's irrelevant + if (secret.type === DynamicSecretProviders.Totp) { + return; + } + if (evt.key === "Enter" && !isRevoking) handlePopUpOpen("dynamicSecretLeases", secret.id); }} onClick={() => { + // no lease view for TOTP because it's irrelevant + if (secret.type === DynamicSecretProviders.Totp) { + return; + } + if (!isRevoking) { handlePopUpOpen("dynamicSecretLeases", secret.id); } diff --git a/frontend/src/views/SecretMainPage/components/DynamicSecretListView/EditDynamicSecretForm/EditDynamicSecretTotpForm.tsx b/frontend/src/views/SecretMainPage/components/DynamicSecretListView/EditDynamicSecretForm/EditDynamicSecretTotpForm.tsx index 8a9127e89..07070ccea 100644 --- a/frontend/src/views/SecretMainPage/components/DynamicSecretListView/EditDynamicSecretForm/EditDynamicSecretTotpForm.tsx +++ b/frontend/src/views/SecretMainPage/components/DynamicSecretListView/EditDynamicSecretForm/EditDynamicSecretTotpForm.tsx @@ -40,7 +40,11 @@ const formSchema = z.object({ }), z.object({ configType: z.literal(ConfigType.MANUAL), - secret: z.string().min(1), + secret: z + .string() + .trim() + .min(1) + .transform((val) => val.replace(/\s+/g, "")), period: z.number().optional(), algorithm: z.nativeEnum(TotpAlgorithm).optional(), digits: z.number().optional() @@ -218,7 +222,7 @@ export const EditDynamicSecretTotpForm = ({ )} /> -
+