@wauth/sdk
Version:
Web2 auth sdk for Arweave
37 lines • 1.87 kB
TypeScript
import type { ModalTypes, ModalPayload, ModalResult } from "./index";
export declare class HTMLSanitizer {
/**
* Escapes HTML entities to prevent XSS attacks
* @param text - The text to escape
* @returns Escaped text safe for innerHTML
*/
static escapeHTML(text: string): string;
/**
* Creates a safe HTML string with basic formatting
* @param text - The text content
* @param allowedTags - Array of allowed HTML tags (default: ['br', 'strong', 'em'])
* @returns Sanitized HTML string
*/
static sanitizeHTML(text: string, allowedTags?: string[]): string;
/**
* Safely sets innerHTML with sanitization
* @param element - The DOM element
* @param html - The HTML content to set
* @param allowedTags - Array of allowed HTML tags
*/
static safeSetInnerHTML(element: HTMLElement, html: string, allowedTags?: string[]): void;
/**
* Creates a safe link element
* @param href - The URL (will be validated)
* @param text - The link text (will be escaped)
* @param target - Link target (default: '_blank')
* @returns HTMLAnchorElement
*/
static createSafeLink(href: string, text: string, target?: string): HTMLAnchorElement;
}
export declare function createModalContainer(): HTMLElement;
export declare function createModal(type: ModalTypes, payload: ModalPayload, onResult: (result: ModalResult) => void): HTMLDivElement;
export declare function createConfirmTxModal(payload: ModalPayload, onResult: (result: ModalResult) => void): HTMLDivElement;
export declare function createPasswordNewModal(payload: ModalPayload, onResult: (result: ModalResult) => void): HTMLDivElement;
export declare function createPasswordExistingModal(payload: ModalPayload, onResult: (result: ModalResult) => void): HTMLDivElement;
//# sourceMappingURL=modal-helper.d.ts.map