(length = 24)
| 42 | * @returns A new secure password string |
| 43 | */ |
| 44 | export function generatePassword(length = 24): string { |
| 45 | const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_-+=' |
| 46 | let result = '' |
| 47 | |
| 48 | for (let i = 0; i < length; i++) { |
| 49 | result += chars.charAt(randomInt(0, chars.length)) |
| 50 | } |
| 51 | |
| 52 | return result |
| 53 | } |
no test coverage detected