/// import type { PrivateKey } from "openpgp"; import { IncomingMessage, ServerResponse } from "http"; import { DateWithComment } from "./expires"; import { Field, FieldName, Value, ValueWithComment } from "./field"; import { Tags, TagsWithComment } from "./preferred-languages"; export declare type NextFunction = () => void; export declare type Middleware = (req: IncomingMessage, res: ServerResponse, next: NextFunction) => Promise; export interface FieldOptions { readonly order?: FieldName[]; readonly intro?: string; readonly outtro?: string; /** * This field indicates an address that researchers should use for * reporting security vulnerabilities such as an email address, a phone * number and/or a web page with contact information. The "Contact" * field MUST always be present in a "security.txt" file. */ readonly contacts: Value[] | ValueWithComment[]; /** * This field indicates the date and time after which the data contained * in the "security.txt" file is considered stale and should not be used. */ readonly expires: Date | DateWithComment; /** * This field indicates an encryption key that security researchers * should use for encrypted communication. Keys MUST NOT appear in this * field - instead the value of this field MUST be a URI pointing to a * location where the key can be retrieved. */ readonly encryptions?: Value[] | ValueWithComment[]; /** * This field indicates a link to a page where security researchers are * recognized for their reports. The page being referenced should list * security researchers that reported security vulnerabilities and * collaborated to remediate them. */ readonly acknowledgments?: Value[] | ValueWithComment[]; /** * This field can be used to indicate a set of natural languages that * are preferred when submitting security reports. */ readonly preferredLanguages?: Tags | TagsWithComment; /** * This field indicates the canonical URIs where the "security.txt" file * is located, which is usually something like "https://example.com/.well-known/security.txt". */ readonly canonical?: Value[] | ValueWithComment[]; /** * This field indicates a link to where the vulnerability disclosure * policy is located. This can help security researchers understand the * organization's vulnerability reporting practices. */ readonly policy?: Value[] | ValueWithComment[]; /** * The "Hiring" field is used for linking to the vendor's security- * related job positions. */ readonly hiring?: Value[] | ValueWithComment[]; } export interface SecurityTxtOptions extends FieldOptions { /** * @default /.well-known/security.txt */ readonly path?: string; readonly pathAlternative?: string; readonly privateKey?: PrivateKey; } export declare class SecurityTxt { readonly path: string; readonly headers: Record; readonly pathAlternative?: string; private readonly privateKey?; private readonly fields; private cachedText?; constructor(options: SecurityTxtOptions); match(path: string): boolean; isPathAlternative(path: string): boolean; middleware(): Middleware; render(): Promise; private signText; } export declare class OrderedFields { private readonly options; private readonly order; constructor(options: FieldOptions); values(): Field[]; }