Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
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";
/** Max length for OpenRouter API key name (sanity check; OpenRouter docs only require >=1 char). */
const OPEN_ROUTER_API_KEY_NAME_MAX_LENGTH = 100;
export const OpenRouterApiKeyRotationSchema = z
.object({
type: z.literal(SecretRotation.OpenRouterApiKey),
parameters: z.object({
name: z
.string()
.trim()
.min(1, "Key name required")
.max(
OPEN_ROUTER_API_KEY_NAME_MAX_LENGTH,
`Key name must be ${OPEN_ROUTER_API_KEY_NAME_MAX_LENGTH} characters or fewer`
),
workspaceId: z.string().trim().optional(),
limit: z.number().positive().optional().nullable(),
limitReset: z.nativeEnum(OpenRouterLimitReset).optional().nullable(),
includeByokInLimit: z.boolean().optional().nullable()
}),
secretsMapping: z.object({
apiKey: z.string().trim().min(1, "API Key secret name required")
})
})
.merge(BaseSecretRotationSchema);