@rtorcato/js-common / security
security
Functions
sanitizeString()
sanitizeString(
str):string
Defined in: security/index.ts:8
Sanitizes a string by removing script tags and event handlers.
Parameters
str
string
The string to sanitize.
Returns
string
The sanitized string.
isStrongPassword()
isStrongPassword(
password):boolean
Defined in: security/index.ts:17
Checks if a password is strong (min 8 chars, upper, lower, number, special char).
Parameters
password
string
The password to check.
Returns
boolean
True if the password is strong, false otherwise.
generateSecureToken()
generateSecureToken(
length?):string
Defined in: security/index.ts:28
Generates a cryptographically secure random token (hex string).
Parameters
length?
number = 32
The number of bytes (not hex chars).
Returns
string
A random hex string.