url friendly random strings

This commit is contained in:
Julian Krauser 2024-09-15 10:48:01 +02:00
parent a0321905ce
commit 723f05bfca

View file

@ -9,6 +9,9 @@ export abstract class StringHelper {
// randomString += charSet.substring(randomPoz, randomPoz + 1);
// }
// return randomString;
return crypto.randomBytes(len).toString("base64");
return crypto
.randomBytes(len)
.toString("base64")
.replace(/[^a-zA-Z0-9]/g, "");
}
}