import { UseSecureModuleReturn, SecurityViolation, SecurityNonce } from '../types'; /** * Hook for accessing module security context. * Provides content validation, sanitization, and security monitoring. * * @returns Security context and utilities * @throws Error if used outside a ModuleBoundary * * @example * ```tsx * function UserContent({ html }: { html: string }) { * const { * validateContent, * sanitize, * isSecure, * nonce, * violations, * } = useSecureModule(); * * // Validate before rendering * if (!validateContent(html)) { * return

Invalid content detected

; * } * * // Sanitize for safe rendering * const safeHtml = sanitize(html); * * return ( *
* {!isSecure && ( * Security violations detected: {violations.length} * )} *
*
* ); * } * ``` */ export declare function useSecureModule(): UseSecureModuleReturn; /** * Hook to get the security nonce. * @returns Security nonce or null */ export declare function useSecurityNonce(): SecurityNonce | null; /** * Hook to check if the module is in secure state. * @returns Whether module is secure */ export declare function useIsSecure(): boolean; /** * Hook to get a content sanitizer function. * @returns Sanitizer function * * @example * ```tsx * const sanitize = useSanitizer(); * const safeContent = sanitize(userInput); * ``` */ export declare function useSanitizer(): (content: string) => string; /** * Hook to get a content validator function. * @returns Validator function */ export declare function useContentValidator(): (content: string) => boolean; /** * Hook to get security violations. * @returns Array of violations */ export declare function useSecurityViolations(): ReadonlyArray; /** * Hook for safely rendering user-provided HTML. * @param html - Raw HTML string * @returns Safe HTML and validation state * * @example * ```tsx * function RichText({ content }: { content: string }) { * const { safeHtml, isValid, error } = useSafeHtml(content); * * if (!isValid) { * return

Invalid content: {error}

; * } * * return
; * } * ``` */ export declare function useSafeHtml(html: string): { safeHtml: string; isValid: boolean; error: string | null; }; /** * Hook for secure URL validation. * @param url - URL to validate * @returns Whether URL is safe * * @example * ```tsx * function Link({ href }: { href: string }) { * const isSafe = useSecureUrl(href); * * if (!isSafe) { * return {href}; * } * * return {href}; * } * ``` */ export declare function useSecureUrl(url: string): boolean; /** * Hook for CSP nonce injection in style tags. * @returns Props to spread on style elements * * @example * ```tsx * function InlineStyles() { * const styleProps = useSecureStyleProps(); * * return ( * * ); * } * ``` */ export declare function useSecureStyleProps(): { nonce?: string; }; /** * Hook for CSP nonce injection in script tags. * @returns Props to spread on script elements */ export declare function useSecureScriptProps(): { nonce?: string; }; /** * Hook for event permission checking. * @param eventName - Event name to check * @returns Whether event is allowed */ export declare function useIsEventAllowed(eventName: string): boolean; /** * Hook for secure cross-module messaging. * Validates and sanitizes messages before sending. * * @returns Secure messaging utilities * * @example * ```tsx * function SecureMessenger() { * const { sendSecure, onSecureMessage } = useSecureMessaging(); * * const handleSend = () => { * sendSecure('data:update', { value: 'safe data' }); * }; * * useEffect(() => { * return onSecureMessage('data:received', (payload) => { * console.log('Received:', payload); * }); * }, [onSecureMessage]); * * return ; * } * ``` */ export declare function useSecureMessaging(): { sendSecure: (eventName: string, payload: T) => boolean; onSecureMessage: (eventName: string, handler: (payload: T) => void) => () => void; };