mirror of
https://github.com/samiyev/puaros.git
synced 2025-12-27 23:06:54 +05:00
- Add SessionConfigSchema with persistIndefinitely, maxHistoryMessages, saveInputHistory - Implement Session.truncateHistory() method for limiting message history - Update HandleMessage to support history truncation and input history toggle - Add config flow through useSession and App components - Add 19 unit tests for SessionConfigSchema - Update CHANGELOG.md and ROADMAP.md for v0.22.2
29 lines
694 B
TypeScript
29 lines
694 B
TypeScript
/**
|
|
* Validation utilities
|
|
*/
|
|
|
|
export function isValidEmail(email: string): boolean {
|
|
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
|
|
return emailRegex.test(email)
|
|
}
|
|
|
|
export function isStrongPassword(password: string): boolean {
|
|
// TODO: Add more sophisticated password validation
|
|
return password.length >= 8
|
|
}
|
|
|
|
export function sanitizeInput(input: string): string {
|
|
// FIXME: This is a basic implementation, needs XSS protection
|
|
return input.trim().replace(/[<>]/g, "")
|
|
}
|
|
|
|
export class ValidationError extends Error {
|
|
constructor(
|
|
message: string,
|
|
public field: string,
|
|
) {
|
|
super(message)
|
|
this.name = "ValidationError"
|
|
}
|
|
}
|