Regarding the generatePassword function, it uses Math.random:
|
newPassword += charset.charAt(Math.floor(Math.random() * charset.length)); |
See MDN:
Note: Math.random() does not provide cryptographically secure random numbers. Do not use them for anything related to security. Use the Web Crypto API instead, and more precisely the Crypto.getRandomValues() method.
See a this Svelte REPL for a secure implementation of Crypto.getRandomValues().
Regarding the
generatePasswordfunction, it usesMath.random:password/src/app/page.tsx
Line 42 in 171ced2
See MDN:
See a this Svelte REPL for a secure implementation of
Crypto.getRandomValues().