Skip to content

Commit

Permalink
fix: make password secure
Browse files Browse the repository at this point in the history
  • Loading branch information
supersonictw committed Jan 14, 2025
1 parent 7b6f869 commit 6dc3773
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/views/HomeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ const copyMessage = computed(
);
const generateRandomString = () => {
const randomNumberRaw = Math.random()**2;
const randomNumber = randomNumberRaw * (5000**2);
return randomNumber.toString(16);
const length = 16;
const bufferValue = new Uint8Array(length);
window.crypto.getRandomValues(bufferValue);
const retVal = String.fromCharCode.apply(null, bufferValue);
return btoa(retVal).substring(0, length);
};
const onClickGenerate = () => {
Expand Down

0 comments on commit 6dc3773

Please sign in to comment.