Skip to content

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

fix: adding support for open router key rotation

IgorHortad088c068e2c1
diff --git a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewOpenRouterApiKeyRotationGeneratedCredentials.tsx b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewOpenRouterApiKeyRotationGeneratedCredentials.tsx
new file mode 100644
index 0000000000..7fe719a793
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewOpenRouterApiKeyRotationGeneratedCredentials.tsx
@@ -0,0 +1,32 @@
+import { CredentialDisplay } from "@app/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/shared/CredentialDisplay";
+import { TOpenRouterApiKeyRotationGeneratedCredentialsResponse } from "@app/hooks/api/secretRotationsV2/types/open-router-api-key-rotation";
+
+import { ViewRotationGeneratedCredentialsDisplay } from "./shared";
+
+type Props = {
+ generatedCredentialsResponse: TOpenRouterApiKeyRotationGeneratedCredentialsResponse;
+};
+
+export const ViewOpenRouterApiKeyRotationGeneratedCredentials = ({
+ generatedCredentialsResponse: { generatedCredentials, activeIndex }
+}: Props) => {
+ const inactiveIndex = activeIndex === 0 ? 1 : 0;
+
+ const activeCredentials = generatedCredentials[activeIndex];
+ const inactiveCredentials = generatedCredentials[inactiveIndex];
+
+ return (
+ <ViewRotationGeneratedCredentialsDisplay
+ activeCredentials={
+ <CredentialDisplay isSensitive label="API Key">
+ {activeCredentials?.apiKey}
+ </CredentialDisplay>
+ }
+ inactiveCredentials={
+ <CredentialDisplay isSensitive label="API Key">
+ {inactiveCredentials?.apiKey}
+ </CredentialDisplay>
+ }
+ />
+ );
+};
diff --git a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx
index ec71f1d436..4f7894f8d4 100644
--- a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx
+++ b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx
@@ -24,6 +24,7 @@ import {
import { ViewSqlCredentialsRotationGeneratedCredentials } from "./shared";
import { ViewAwsIamUserSecretRotationGeneratedCredentials } from "./ViewAwsIamUserSecretRotationGeneratedCredentials";
import { ViewOktaClientSecretRotationGeneratedCredentials } from "./ViewOktaClientSecretRotationGeneratedCredentials";
+import { ViewOpenRouterApiKeyRotationGeneratedCredentials } from "./ViewOpenRouterApiKeyRotationGeneratedCredentials";
import { ViewRedisCredentialsRotationGeneratedCredentials } from "./ViewRedisCredentialsRotationGeneratedCredentials";
import { ViewUnixLinuxLocalAccountRotationGeneratedCredentials } from "./ViewUnixLinuxLocalAccountRotationGeneratedCredentials";
@@ -132,6 +133,13 @@ const Content = ({ secretRotation }: ContentProps) => {
/>
);
break;
+ case SecretRotation.OpenRouterApiKey:
+ Component = (
+ <ViewOpenRouterApiKeyRotationGeneratedCredentials
+ generatedCredentialsResponse={generatedCredentialsResponse}
+ />
+ );
+ break;
default:
throw new Error("Unhandled View Generated Credential Rotation Type");
}
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/OpenRouterApiKeyRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/OpenRouterApiKeyRotationParametersFields.tsx
new file mode 100644
index 0000000000..c186085a2f
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/OpenRouterApiKeyRotationParametersFields.tsx
@@ -0,0 +1,93 @@
+import { Controller, useFormContext } from "react-hook-form";
+
+import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
+import { FormControl, Input, Select, SelectItem } from "@app/components/v2";
+import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
+import { OpenRouterLimitReset } from "@app/hooks/api/secretRotationsV2/types/open-router-api-key-rotation";
+
+const NO_RESET_VALUE = "none";
+
+const LIMIT_RESET_OPTIONS = [
+ { label: "No Reset", value: NO_RESET_VALUE },
+ { label: "Daily", value: OpenRouterLimitReset.Daily },
+ { label: "Weekly", value: OpenRouterLimitReset.Weekly },
+ { label: "Monthly", value: OpenRouterLimitReset.Monthly }
+];
+
+export const OpenRouterApiKeyRotationParametersFields = () => {
+ const { control, watch } = useFormContext<
+ TSecretRotationV2Form & {
+ type: SecretRotation.OpenRouterApiKey;
+ }
+ >();
+
+ const limit = watch("parameters.limit");
+
+ return (
+ <>
+ <Controller
+ name="parameters.name"
+ control={control}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error)}
+ errorText={error?.message}
+ label="Key Name"
+ tooltipText="A descriptive name for the generated API key"
+ >
+ <Input value={value} onChange={onChange} placeholder="My Rotated API Key" />
+ </FormControl>
+ )}
+ />
+ <Controller
+ name="parameters.limit"
+ control={control}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error)}
+ errorText={error?.message}
+ label="Credit Limit (USD)"
+ isOptional
+ tooltipText="Optional spending limit in USD for the generated API key"
+ >
+ <Input
+ type="number"
+ value={value ?? ""}
+ onChange={(e) => {
+ const val = e.target.value;
+ onChange(val === "" ? null : Number(val));
+ }}
+ placeholder="Leave blank for unlimited"
+ />
+ </FormControl>
+ )}
+ />
+ <Controller
+ name="parameters.limitReset"
+ control={control}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error)}
+ errorText={error?.message}
+ label="Reset Limit Every"
+ isOptional
+ tooltipText="How often the spending limit resets (daily, weekly, or monthly). Resets happen at midnight UTC."
+ >
+ <Select
+ value={value ?? NO_RESET_VALUE}
+ onValueChange={(val) => onChange(val === NO_RESET_VALUE ? null : val)}
+ className="w-full"
+ isDisabled={!limit}
+ >
+ {LIMIT_RESET_OPTIONS.map((option) => (
+ <SelectItem key={option.value} value={option.value}>
+ {option.label}
+ </SelectItem>
+ ))}
+ </Select>
+ </FormControl>
+ )}
+ />
+ </>
+ );
+};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx
index 70654f2fe7..6b9ede0b27 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx
@@ -10,6 +10,7 @@ import { DatabricksServicePrincipalSecretRotationParametersFields } from "./Data
import { LdapPasswordRotationParametersFields } from "./LdapPasswordRotationParametersFields";
import { MongoRotationParametersFields } from "./MongoRotationParametersFields";
import { OktaClientSecretRotationParametersFields } from "./OktaClientSecretRotationParametersFields";
+import { OpenRouterApiKeyRotationParametersFields } from "./OpenRouterApiKeyRotationParametersFields";
import { RedisCredentialsRotationParametersFields } from "./RedisCredentialsRotationParametersFields";
import { SqlCredentialsRotationParametersFields } from "./shared";
import { UnixLinuxLocalAccountRotationParametersFields } from "./UnixLinuxLocalAccountRotationParametersFields";
@@ -28,7 +29,8 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {
[SecretRotation.MongoDBCredentials]: MongoRotationParametersFields,
[SecretRotation.DatabricksServicePrincipalSecret]:
DatabricksServicePrincipalSecretRotationParametersFields,
- [SecretRotation.UnixLinuxLocalAccount]: UnixLinuxLocalAccountRotationParametersFields
+ [SecretRotation.UnixLinuxLocalAccount]: UnixLinuxLocalAccountRotationParametersFields,
+ [SecretRotation.OpenRouterApiKey]: OpenRouterApiKeyRotationParametersFields
};
export const SecretRotationV2ParametersFields = () => {
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/OpenRouterApiKeyRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/OpenRouterApiKeyRotationReviewFields.tsx
new file mode 100644
index 0000000000..adc694d543
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/OpenRouterApiKeyRotationReviewFields.tsx
@@ -0,0 +1,42 @@
+import { useFormContext } from "react-hook-form";
+
+import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
+import { GenericFieldLabel } from "@app/components/v2";
+import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
+
+import { SecretRotationReviewSection } from "./shared";
+
+const LIMIT_RESET_LABELS: Record<string, string> = {
+ daily: "Daily",
+ weekly: "Weekly",
+ monthly: "Monthly"
+};
+
+export const OpenRouterApiKeyRotationReviewFields = () => {
+ const { watch } = useFormContext<
+ TSecretRotationV2Form & {
+ type: SecretRotation.OpenRouterApiKey;
+ }
+ >();
+
+ const [parameters, { apiKey }] = watch(["parameters", "secretsMapping"]);
+
+ return (
+ <>
+ <SecretRotationReviewSection label="Parameters">
+ <GenericFieldLabel label="Key Name">{parameters.name}</GenericFieldLabel>
+ {parameters.limit != null && (
+ <GenericFieldLabel label="Credit Limit">${parameters.limit} USD</GenericFieldLabel>
+ )}
+ {parameters.limitReset && (
+ <GenericFieldLabel label="Reset Limit">
+ {LIMIT_RESET_LABELS[parameters.limitReset] || parameters.limitReset}
+ </GenericFieldLabel>
+ )}
+ </SecretRotationReviewSection>
+ <SecretRotationReviewSection label="Secrets Mapping">
+ <GenericFieldLabel label="API Key">{apiKey}</GenericFieldLabel>
+ </SecretRotationReviewSection>
+ </>
+ );
+};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx
index e361156b13..f7b164d568 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx
@@ -12,6 +12,7 @@ import { AzureClientSecretRotationReviewFields } from "./AzureClientSecretRotati
import { DatabricksServicePrincipalSecretRotationReviewFields } from "./DatabricksServicePrincipalSecretRotationReviewFields";
import { LdapPasswordRotationReviewFields } from "./LdapPasswordRotationReviewFields";
import { OktaClientSecretRotationReviewFields } from "./OktaClientSecretRotationReviewFields";
+import { OpenRouterApiKeyRotationReviewFields } from "./OpenRouterApiKeyRotationReviewFields";
import { RedisCredentialsRotationReviewFields } from "./RedisCredentialsRotationReviewFields";
import { SqlCredentialsRotationReviewFields } from "./shared";
import { UnixLinuxLocalAccountRotationReviewFields } from "./UnixLinuxLocalAccountRotationReviewFields";
@@ -30,7 +31,8 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {
[SecretRotation.MongoDBCredentials]: SqlCredentialsRotationReviewFields,
[SecretRotation.DatabricksServicePrincipalSecret]:
DatabricksServicePrincipalSecretRotationReviewFields,
- [SecretRotation.UnixLinuxLocalAccount]: UnixLinuxLocalAccountRotationReviewFields
+ [SecretRotation.UnixLinuxLocalAccount]: UnixLinuxLocalAccountRotationReviewFields,
+ [SecretRotation.OpenRouterApiKey]: OpenRouterApiKeyRotationReviewFields
};
export const SecretRotationV2ReviewFields = () => {
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/OpenRouterApiKeyRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/OpenRouterApiKeyRotationSecretsMappingFields.tsx
new file mode 100644
index 0000000000..5589161347
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/OpenRouterApiKeyRotationSecretsMappingFields.tsx
@@ -0,0 +1,40 @@
+import { Controller, useFormContext } from "react-hook-form";
+
+import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
+import { FormControl, Input } from "@app/components/v2";
+import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";
+
+import { SecretsMappingTable } from "./shared";
+
+export const OpenRouterApiKeyRotationSecretsMappingFields = () => {
+ const { control } = useFormContext<
+ TSecretRotationV2Form & {
+ type: SecretRotation.OpenRouterApiKey;
+ }
+ >();
+
+ const { rotationOption } = useSecretRotationV2Option(SecretRotation.OpenRouterApiKey);
+
+ const items = [
+ {
+ name: "API Key",
+ input: (
+ <Controller
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl isError={Boolean(error)} errorText={error?.message}>
+ <Input
+ value={value}
+ onChange={onChange}
+ placeholder={rotationOption?.template.secretsMapping.apiKey}
+ />
+ </FormControl>
+ )}
+ control={control}
+ name="secretsMapping.apiKey"
+ />
+ )
+ }
+ ];
+
+ return <SecretsMappingTable items={items} />;
+};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx
index 1f8506a4af..33f404407a 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx
@@ -9,6 +9,7 @@ import { AzureClientSecretRotationSecretsMappingFields } from "./AzureClientSecr
import { DatabricksServicePrincipalSecretRotationSecretsMappingFields } from "./DatabricksServicePrincipalSecretRotationSecretsMappingFields";
import { LdapPasswordRotationSecretsMappingFields } from "./LdapPasswordRotationSecretsMappingFields";
import { OktaClientSecretRotationSecretsMappingFields } from "./OktaClientSecretRotationSecretsMappingFields";
+import { OpenRouterApiKeyRotationSecretsMappingFields } from "./OpenRouterApiKeyRotationSecretsMappingFields";
import { RedisCredentialsRotationSecretsMappingFields } from "./RedisCredentialsRotationSecretsMappingFields";
import { SqlCredentialsRotationSecretsMappingFields } from "./shared";
import { UnixLinuxLocalAccountRotationSecretsMappingFields } from "./UnixLinuxLocalAccountRotationSecretsMappingFields";
@@ -27,7 +28,8 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {
[SecretRotation.MongoDBCredentials]: SqlCredentialsRotationSecretsMappingFields,
[SecretRotation.DatabricksServicePrincipalSecret]:
DatabricksServicePrincipalSecretRotationSecretsMappingFields,
- [SecretRotation.UnixLinuxLocalAccount]: UnixLinuxLocalAccountRotationSecretsMappingFields
+ [SecretRotation.UnixLinuxLocalAccount]: UnixLinuxLocalAccountRotationSecretsMappingFields,
+ [SecretRotation.OpenRouterApiKey]: OpenRouterApiKeyRotationSecretsMappingFields
};
export const SecretRotationV2SecretsMappingFields = () => {
diff --git a/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts b/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts
index d7edf85bb5..c40d4e7bb0 100644
--- a/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts
+++ b/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts
@@ -14,6 +14,7 @@ import { LdapPasswordRotationMethod } from "@app/hooks/api/secretRotationsV2/typ
import { UnixLinuxLocalAccountRotationMethod } from "@app/hooks/api/secretRotationsV2/types/unix-linux-local-account-rotation";
import { OktaClientSecretRotationSchema } from "./okta-client-secret-rotation-schema";
+import { OpenRouterApiKeyRotationSchema } from "./open-router-api-key-rotation-schema";
import { OracleDBCredentialsRotationSchema } from "./oracledb-credentials-rotation-schema";
import { RedisCredentialsRotationSchema } from "./redis-credentials-rotation-schema";
import { UnixLinuxLocalAccountRotationSchema } from "./unix-linux-local-account-rotation-schema";
@@ -34,7 +35,8 @@ export const SecretRotationV2FormSchema = (isUpdate: boolean) =>
RedisCredentialsRotationSchema,
MongoDBCredentialsRotationSchema,
DatabricksServicePrincipalSecretRotationSchema,
- UnixLinuxLocalAccountRotationSchema
+ UnixLinuxLocalAccountRotationSchema,
+ OpenRouterApiKeyRotationSchema
]),
z.object({ id: z.string().optional() })
)
diff --git a/frontend/src/components/secret-rotations-v2/forms/schemas/open-router-api-key-rotation-schema.ts b/frontend/src/components/secret-rotations-v2/forms/schemas/open-router-api-key-rotation-schema.ts
new file mode 100644
index 0000000000..4c812a8283
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/forms/schemas/open-router-api-key-rotation-schema.ts
@@ -0,0 +1,19 @@
+import { z } from "zod";
+
+import { BaseSecretRotationSchema } from "@app/components/secret-rotations-v2/forms/schemas/base-secret-rotation-v2-schema";
+import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
+import { OpenRouterLimitReset } from "@app/hooks/api/secretRotationsV2/types/open-router-api-key-rotation";
+
+export const OpenRouterApiKeyRotationSchema = z
+ .object({
+ type: z.literal(SecretRotation.OpenRouterApiKey),
+ parameters: z.object({
+ name: z.string().trim().min(1, "Key name required"),
+ limit: z.number().positive().optional().nullable(),
+ limitReset: z.nativeEnum(OpenRouterLimitReset).optional().nullable()
+ }),
+ secretsMapping: z.object({
+ apiKey: z.string().trim().min(1, "API Key secret name required")
+ })
+ })
+ .merge(BaseSecretRotationSchema);
diff --git a/frontend/src/helpers/appConnections.ts b/frontend/src/helpers/appConnections.ts
index 9191a9015d..819a51510d 100644
--- a/frontend/src/helpers/appConnections.ts
+++ b/frontend/src/helpers/appConnections.ts
@@ -57,11 +57,11 @@ import { LaravelForgeConnectionMethod } from "@app/hooks/api/appConnections/type
import { NetlifyConnectionMethod } from "@app/hooks/api/appConnections/types/netlify-connection";
import { NorthflankConnectionMethod } from "@app/hooks/api/appConnections/types/northflank-connection";
import { OCIConnectionMethod } from "@app/hooks/api/appConnections/types/oci-connection";
+import { OpenRouterConnectionMethod } from "@app/hooks/api/appConnections/types/open-router-connection";
import { RailwayConnectionMethod } from "@app/hooks/api/appConnections/types/railway-connection";
import { RenderConnectionMethod } from "@app/hooks/api/appConnections/types/render-connection";
import { SshConnectionMethod } from "@app/hooks/api/appConnections/types/ssh-connection";
import { SupabaseConnectionMethod } from "@app/hooks/api/appConnections/types/supabase-connection";
-import { OpenRouterConnectionMethod } from "@app/hooks/api/appConnections/types/open-router-connection";
export const APP_CONNECTION_MAP: Record<
AppConnection,
diff --git a/frontend/src/helpers/secretRotationsV2.ts b/frontend/src/helpers/secretRotationsV2.ts
index 5b298b7596..e6f15b899a 100644
--- a/frontend/src/helpers/secretRotationsV2.ts
+++ b/frontend/src/helpers/secretRotationsV2.ts
@@ -69,6 +69,11 @@ export const SECRET_ROTATION_MAP: Record<
name: "Unix/Linux Local Account",
image: "SSH.png",
size: 50
+ },
+ [SecretRotation.OpenRouterApiKey]: {
+ name: "OpenRouter API Key",
+ image: "OpenRouter.png",
+ size: 50
}
};
@@ -85,7 +90,8 @@ export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnectio
[SecretRotation.RedisCredentials]: AppConnection.Redis,
[SecretRotation.MongoDBCredentials]: AppConnection.MongoDB,
[SecretRotation.DatabricksServicePrincipalSecret]: AppConnection.Databricks,
- [SecretRotation.UnixLinuxLocalAccount]: AppConnection.SSH
+ [SecretRotation.UnixLinuxLocalAccount]: AppConnection.SSH,
+ [SecretRotation.OpenRouterApiKey]: AppConnection.OpenRouter
};
// if a rotation can potentially have downtime due to rotating a single credential set this to false
@@ -102,7 +108,8 @@ export const IS_ROTATION_DUAL_CREDENTIALS: Record<SecretRotation, boolean> = {
[SecretRotation.RedisCredentials]: true,
[SecretRotation.MongoDBCredentials]: true,
[SecretRotation.DatabricksServicePrincipalSecret]: true,
- [SecretRotation.UnixLinuxLocalAccount]: false
+ [SecretRotation.UnixLinuxLocalAccount]: false,
+ [SecretRotation.OpenRouterApiKey]: true
};
export const getRotateAtLocal = ({ hours, minutes }: TSecretRotationV2["rotateAtUtc"]) => {
diff --git a/frontend/src/hooks/api/secretRotationsV2/enums.ts b/frontend/src/hooks/api/secretRotationsV2/enums.ts
index df26b40992..3b8b59af28 100644
--- a/frontend/src/hooks/api/secretRotationsV2/enums.ts
+++ b/frontend/src/hooks/api/secretRotationsV2/enums.ts
@@ -11,7 +11,8 @@ export enum SecretRotation {
RedisCredentials = "redis-credentials",
MongoDBCredentials = "mongodb-credentials",
DatabricksServicePrincipalSecret = "databricks-service-principal-secret",
- UnixLinuxLocalAccount = "unix-linux-local-account"
+ UnixLinuxLocalAccount = "unix-linux-local-account",
+ OpenRouterApiKey = "open-router-api-key"
}
export enum SecretRotationStatus {
diff --git a/frontend/src/hooks/api/secretRotationsV2/types/index.ts b/frontend/src/hooks/api/secretRotationsV2/types/index.ts
index 4b91324551..f64129c57f 100644
--- a/frontend/src/hooks/api/secretRotationsV2/types/index.ts
+++ b/frontend/src/hooks/api/secretRotationsV2/types/index.ts
@@ -50,6 +50,11 @@ import {
TOktaClientSecretRotationGeneratedCredentialsResponse,
TOktaClientSecretRotationOption
} from "./okta-client-secret-rotation";
+import {
+ TOpenRouterApiKeyRotation,
+ TOpenRouterApiKeyRotationGeneratedCredentialsResponse,
+ TOpenRouterApiKeyRotationOption
+} from "./open-router-api-key-rotation";
import {
TOracleDBCredentialsRotation,
TOracleDBCredentialsRotationGeneratedCredentialsResponse
@@ -79,6 +84,7 @@ export type TSecretRotationV2 = (
| TMongoDBCredentialsRotation
| TDatabricksServicePrincipalSecretRotation
| TUnixLinuxLocalAccountRotation
+ | TOpenRouterApiKeyRotation
) & {
secrets: (SecretV3RawSanitized | null)[];
};
@@ -93,7 +99,8 @@ export type TSecretRotationV2Option =
| TRedisCredentialsRotationOption
| TMongoDBCredentialsRotationOption
| TDatabricksServicePrincipalSecretRotationOption
- | TUnixLinuxLocalAccountRotationOption;
+ | TUnixLinuxLocalAccountRotationOption
+ | TOpenRouterApiKeyRotationOption;
export type TListSecretRotationV2Options = { secretRotationOptions: TSecretRotationV2Option[] };
@@ -112,7 +119,8 @@ export type TViewSecretRotationGeneratedCredentialsResponse =
| TRedisCredentialsRotationGeneratedCredentialsResponse
| TMongoDBCredentialsRotationGeneratedCredentialsResponse
| TDatabricksServicePrincipalSecretRotationGeneratedCredentialsResponse
- | TUnixLinuxLocalAccountRotationGeneratedCredentialsResponse;
+ | TUnixLinuxLocalAccountRotationGeneratedCredentialsResponse
+ | TOpenRouterApiKeyRotationGeneratedCredentialsResponse;
export type TCreateSecretRotationV2DTO = DiscriminativePick<
TSecretRotationV2,
@@ -169,6 +177,7 @@ export type TSecretRotationOptionMap = {
[SecretRotation.MongoDBCredentials]: TMongoDBCredentialsRotationOption;
[SecretRotation.DatabricksServicePrincipalSecret]: TDatabricksServicePrincipalSecretRotationOption;
[SecretRotation.UnixLinuxLocalAccount]: TUnixLinuxLocalAccountRotationOption;
+ [SecretRotation.OpenRouterApiKey]: TOpenRouterApiKeyRotationOption;
};
export type TSecretRotationGeneratedCredentialsResponseMap = {
@@ -185,6 +194,7 @@ export type TSecretRotationGeneratedCredentialsResponseMap = {
[SecretRotation.MongoDBCredentials]: TMongoDBCredentialsRotationGeneratedCredentialsResponse;
[SecretRotation.DatabricksServicePrincipalSecret]: TDatabricksServicePrincipalSecretRotationGeneratedCredentialsResponse;
[SecretRotation.UnixLinuxLocalAccount]: TUnixLinuxLocalAccountRotationGeneratedCredentialsResponse;
+ [SecretRotation.OpenRouterApiKey]: TOpenRouterApiKeyRotationGeneratedCredentialsResponse;
};
export type TReconcileUnixLinuxLocalAccountRotationDTO = {
diff --git a/frontend/src/hooks/api/secretRotationsV2/types/open-router-api-key-rotation.ts b/frontend/src/hooks/api/secretRotationsV2/types/open-router-api-key-rotation.ts
new file mode 100644
index 0000000000..893e8c9546
--- /dev/null
+++ b/frontend/src/hooks/api/secretRotationsV2/types/open-router-api-key-rotation.ts
@@ -0,0 +1,44 @@
+import { AppConnection } from "@app/hooks/api/appConnections/enums";
+import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
+import {
+ TSecretRotationV2Base,
+ TSecretRotationV2GeneratedCredentialsResponseBase
+} from "@app/hooks/api/secretRotationsV2/types/shared";
+
+export enum OpenRouterLimitReset {
+ Daily = "daily",
+ Weekly = "weekly",
+ Monthly = "monthly"
+}
+
+export type TOpenRouterApiKeyRotation = TSecretRotationV2Base & {
+ type: SecretRotation.OpenRouterApiKey;
+ parameters: {
+ name: string;
+ limit?: number | null;
+ limitReset?: OpenRouterLimitReset | null;
+ };
+ secretsMapping: {
+ apiKey: string;
+ };
+};
+
+export type TOpenRouterApiKeyRotationGeneratedCredentials = {
+ apiKey: string;
+ keyHash: string;
+};
+
+export type TOpenRouterApiKeyRotationGeneratedCredentialsResponse =
+ TSecretRotationV2GeneratedCredentialsResponseBase<
+ SecretRotation.OpenRouterApiKey,
+ TOpenRouterApiKeyRotationGeneratedCredentials
+ >;
+
+export type TOpenRouterApiKeyRotationOption = {
+ name: string;
+ type: SecretRotation.OpenRouterApiKey;
+ connection: AppConnection.OpenRouter;
+ template: {
+ secretsMapping: TOpenRouterApiKeyRotation["secretsMapping"];
+ };
+};