@kentcdodds/tmp-remix-utils
Version:
This package contains simple utility functions to use with [Remix.run](https://remix.run).
40 lines (39 loc) • 1.22 kB
TypeScript
export interface HoneypotInputProps {
nameFieldName: string;
validFromFieldName: string | null;
encryptedValidFrom: string;
}
export interface HonetpotConfig {
randomizeNameFieldName?: boolean;
nameFieldName?: string;
validFromFieldName?: string | null;
encryptionSeed?: string;
}
export declare class SpamError extends Error {}
export declare class Honeypot {
protected config: HonetpotConfig;
private generatedEncryptionSeed;
constructor(config?: HonetpotConfig);
getInputProps({
validFromTimestamp,
}?: {
validFromTimestamp?: number | undefined;
}): HoneypotInputProps;
check(formData: FormData): void;
protected get nameFieldName(): string;
protected get validFromFieldName(): string | null;
protected get encryptionSeed(): string;
protected getRandomizedNameFieldName(
nameFieldName: string,
formData: FormData
): string | undefined;
protected shouldCheckHoneypot(
formData: FormData,
nameFieldName: string
): boolean;
protected randomValue(): string;
protected encrypt(value: string): string;
protected decrypt(value: string): string;
protected isFuture(timestamp: number): boolean;
protected isValidTimeStamp(timestampp: number): boolean;
}