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 ( *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: