import * as _homer0_jimple from '@homer0/jimple'; import { J as Jimpex, D as MiddlewareConnectFn } from '../../index-DAUqbQ6h.js'; import { ExpressMiddleware } from '../../types/express.js'; import '../../types/http.js'; import 'https'; import 'http'; import 'spdy'; import 'node-fetch'; import 'express'; import '../../types/utils.js'; import '@homer0/path-utils'; import '@homer0/simple-logger'; import '@homer0/simple-config'; import '@homer0/events-hub'; /** * The options to customize the HSTS header value. * * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security} * @group Middlewares/HSTS */ type HSTSMiddlewareOptions = { /** * The time, in seconds, that the browser should remember that a site is only to be * accessed using HTTPS. * * @default 31536000 */ maxAge: number; /** * Whether or not the rule should apply to all sub domains. * * @default true */ includeSubDomains: boolean; /** * Whether or not to include on the major browsers' * preload list. This directive is not part of the specification, for more information * about it, you should check the MDN documentation for the header. * * @default false */ preload: boolean; }; /** * A partial version of the {@link HSTSMiddlewareOptions}, to be used in the constructor * and the middleware creator. * * @group Middlewares/HSTS */ type HSTSMiddlewarePartialOptions = Partial; /** * The options for the middleware creator that will create the middleware, or not, * depending on the `enabled` option. * * @group Middlewares/HSTS */ type HSTSMiddlewareSettings = HSTSMiddlewarePartialOptions & { /** * If it's not `true`, it won't return the middleware. */ enabled?: boolean; }; /** * Generates a middleware that includes the HSTS header on the responses. * * @see {@link https://tools.ietf.org/html/rfc6797} * @group Middleware Classes * @group Middlewares/HSTS * @prettierignore */ declare class HSTS { /** * The customization options for the header. */ protected readonly _options: HSTSMiddlewareOptions; /** * The value of the header that will be included in the responses. */ protected readonly _header: string; /** * @param options The options to construct the class. */ constructor(options?: HSTSMiddlewarePartialOptions); /** * Generates the middleware that includes the HSTS header on the responses. */ getMiddleware(): ExpressMiddleware; /** * The customization options. */ get options(): Readonly; /** * The value of the header that will be included in the responses. */ get header(): string; /** * Creates the header value based on the customization options. */ protected _buildHeader(): string; } /** * Creates the middleware that includes the HSTS header on the responses. * * @group Middlewares * @group Middlewares/HSTS */ declare const hstsMiddleware: _homer0_jimple.ResourceCreator<"middleware", "connect", (options?: HSTSMiddlewareSettings) => (app: ContainerType) => ExpressMiddleware | undefined, MiddlewareConnectFn>; export { HSTS, type HSTSMiddlewareOptions, type HSTSMiddlewarePartialOptions, type HSTSMiddlewareSettings, hstsMiddleware };