sveltekit-password-protect
Version:
Simple utility to add a layer of protection to your websites, very useful for agencies and freelancers
33 lines (32 loc) • 855 B
TypeScript
import type { CacheAdapter } from './InMemoryCache.js';
export type DefaultOptions = {
sessionTTL: number;
csrfTokenTTL: number;
cookieName: string;
password: string;
title: string;
description: string;
theme: string;
redirect: string;
path: string;
cacheAdapter: CacheAdapter;
maxFailedCalls: number;
rateLimitTTL: number;
jwtSecret: string;
enableCSRF: boolean;
getPasswordFormPage: GetPasswordFormPage;
};
export type passwordProtectOptions = Partial<DefaultOptions> & {
password: string;
};
export type TemplatePageProps = {
title?: string;
description?: string;
redirect?: string;
csrfToken: string;
theme?: string;
path?: string;
error?: string;
defaultOptions: DefaultOptions;
};
export type GetPasswordFormPage = (props: TemplatePageProps) => string;