UNPKG

@appwarden/middleware

Version:

Instantly shut off access your app deployed on Cloudflare or Vercel

69 lines (64 loc) 2.3 kB
export { B as Bindings } from './cloudflare-2PkEr25r.js'; export { C as CSPDirectivesSchema, a as CSPModeSchema, M as Middleware, u as useContentSecurityPolicy } from './use-content-security-policy-C89AROtC.js'; import { z } from 'zod'; declare const LOCKDOWN_TEST_EXPIRY_MS: number; declare const APPWARDEN_USER_AGENT: "Appwarden-Monitor"; declare const APPWARDEN_CACHE_KEY: "appwarden-lock"; /** * Extracts the Edge Config ID from a valid Edge Config URL * @param value The Edge Config URL * @returns The Edge Config ID or undefined if the URL is invalid */ declare const getEdgeConfigId: (value?: string) => string | undefined; /** * Checks if a URL is a valid cache URL (less strict validation) */ declare const isCacheUrl: { /** * Checks if a URL is a valid Edge Config URL (hostname check only) * @param value The URL to check * @returns True if the URL is a valid Edge Config URL, false otherwise */ edgeConfig: (value?: string) => boolean; /** * Checks if a URL is a valid Upstash URL (hostname check only) * @param value The URL to check * @returns True if the URL is a valid Upstash URL, false otherwise */ upstash: (value?: string) => boolean; }; /** * Performs strict validation of cache URLs */ declare const isValidCacheUrl: { /** * Strictly validates an Edge Config URL * @param value The URL to validate * @returns True if the URL is a valid Edge Config URL, false otherwise */ edgeConfig: (value?: string) => boolean; /** * Strictly validates an Upstash URL * @param value The URL to validate * @returns The password if the URL is valid, false otherwise */ upstash: (value?: string) => string | boolean; }; declare const LockValue: z.ZodObject<{ isLocked: z.ZodNumber; isLockedTest: z.ZodNumber; lastCheck: z.ZodNumber; code: z.ZodString; }, "strip", z.ZodTypeAny, { code: string; isLocked: number; isLockedTest: number; lastCheck: number; }, { code: string; isLocked: number; isLockedTest: number; lastCheck: number; }>; type LockValueType = z.infer<typeof LockValue>; export { APPWARDEN_CACHE_KEY, APPWARDEN_USER_AGENT, LOCKDOWN_TEST_EXPIRY_MS, type LockValueType, getEdgeConfigId, isCacheUrl, isValidCacheUrl };