1+ /**
2+ * Security Utilities
3+ * Provides input validation, error sanitization, and security helpers
4+ */
5+ /**
6+ * Sanitize error messages to prevent credential leakage
7+ * @param error - Error object or message
8+ * @returns Sanitized error message safe for logging
9+ */
10+ export declare function sanitizeError ( error : any ) : string ;
11+ /**
12+ * Sanitize object for logging (removes sensitive fields)
13+ */
14+ export declare function sanitizeObject ( obj : any ) : any ;
15+ /**
16+ * Validate identity ID format (64-character hex string)
17+ */
18+ export declare function validateIdentityId ( id : string ) : void ;
19+ /**
20+ * Validate DID format (did:zhtp:hexstring)
21+ */
22+ export declare function validateDid ( did : string ) : void ;
23+ /**
24+ * Validate contract ID format
25+ */
26+ export declare function validateContractId ( contractId : string ) : void ;
27+ /**
28+ * Validate guardian ID format
29+ */
30+ export declare function validateGuardianId ( guardianId : string ) : void ;
31+ /**
32+ * Validate recovery method enum
33+ */
34+ export declare function validateRecoveryMethod ( method : string ) : void ;
35+ /**
36+ * Validate wallet type enum
37+ */
38+ export declare function validateWalletType ( walletType : string ) : void ;
39+ /**
40+ * Validate proof type enum
41+ */
42+ export declare function validateProofType ( proofType : string ) : void ;
43+ /**
44+ * Validate domain name format (prevent SSRF)
45+ */
46+ export declare function validateDomainName ( domain : string ) : void ;
47+ /**
48+ * Validate passphrase strength with enhanced requirements
49+ * @param passphrase - Passphrase to validate
50+ * @param minLength - Minimum length (default 16)
51+ * @param minEntropy - Minimum entropy in bits (default 60)
52+ * @throws Error if passphrase doesn't meet requirements
53+ */
54+ export declare function validatePassphraseStrength ( passphrase : string , minLength ?: number , minEntropy ?: number ) : void ;
55+ /**
56+ * Client-side rate limiting for sensitive operations
57+ * @param key - Unique key for the operation (e.g., 'login:user123')
58+ * @param maxAttempts - Maximum attempts allowed
59+ * @param windowMs - Time window in milliseconds
60+ * @returns true if rate limit exceeded, false otherwise
61+ */
62+ export declare function isRateLimited ( key : string , maxAttempts : number , windowMs : number ) : boolean ;
63+ /**
64+ * Clear rate limit entry (useful for successful authentication)
65+ */
66+ export declare function clearRateLimit ( key : string ) : void ;
67+ /**
68+ * Safely construct URL with query parameters
69+ * @param base - Base URL or endpoint
70+ * @param params - Query parameters
71+ * @returns URL string with encoded parameters
72+ */
73+ export declare function constructUrl ( base : string , params ?: Record < string , string | number | boolean > ) : string ;
74+ //# sourceMappingURL=security-utils.d.ts.map
0 commit comments