You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
551 B
19 lines
551 B
import { z } from "zod";
|
|
|
|
export const base64ConfigSchema = z.object({
|
|
maxInputLength: z.number().int().positive().max(1048576).default(102400),
|
|
});
|
|
|
|
export type Base64ToolConfig = z.infer<typeof base64ConfigSchema>;
|
|
|
|
export const DEFAULT_BASE64_CONFIG: Base64ToolConfig = {
|
|
maxInputLength: 102400,
|
|
};
|
|
|
|
export function parseBase64Config(raw: unknown): Base64ToolConfig {
|
|
const parsed = base64ConfigSchema.safeParse(raw);
|
|
if (!parsed.success) {
|
|
throw new Error(`Invalid base64 config: ${parsed.error.message}`);
|
|
}
|
|
return parsed.data;
|
|
}
|
|
|