nuxt-security
Version:
🛡️ Security Module for Nuxt based on HTTP Headers and Middleware
38 lines (35 loc) • 1.93 kB
text/typescript
import { O as OptionKey, H as HeaderName, S as SecurityHeaders, C as ContentSecurityPolicyValue, a as StrictTransportSecurityValue, P as PermissionsPolicyValue } from '../shared/nuxt-security.D3Gn0bHZ.mjs';
/**
*
* Converts a valid OptionKey into its corresponding standard header name
*/
declare function getNameFromKey(key: OptionKey): HeaderName;
/**
*
* Converts a standard header name to its corresponding OptionKey name, or undefined if not found
*/
declare function getKeyFromName(headerName: string): OptionKey | undefined;
/**
*
* Gigen a valid OptionKey, converts a header object value into its corresponding string format
*/
declare function headerStringFromObject(optionKey: OptionKey, optionValue: Exclude<SecurityHeaders[OptionKey], undefined>): string;
/**
*
* Given a valid OptionKey, converts a header value string into its corresponding object format
*/
declare function headerObjectFromString(optionKey: OptionKey, headerValue: string): string | false | ContentSecurityPolicyValue | StrictTransportSecurityValue | PermissionsPolicyValue;
/**
* Extract the subset of security headers that apply to all resources
*/
declare function getHeadersApplicableToAllResources(headers: SecurityHeaders): Record<HeaderName, string> | undefined;
/**
* Convert standard headers string format to security headers object format, returning undefined if no valid security header is found
*/
declare function standardToSecurity(standardHeaders?: Record<string, any>): SecurityHeaders | undefined;
/**
*
* Ensure backwards compatibility with pre-rc1 syntax, returning undefined if no securityHeaders is passed
*/
declare function backwardsCompatibleSecurity(securityHeaders?: SecurityHeaders | false): SecurityHeaders | undefined;
export { backwardsCompatibleSecurity, getHeadersApplicableToAllResources, getKeyFromName, getNameFromKey, headerObjectFromString, headerStringFromObject, standardToSecurity };