mirror of
https://github.com/spacebarchat/server.git
synced 2026-10-22 12:12:32 +00:00
Registration tokens
This commit is contained in:
1 parent
3227933f28
commit
ddd3c86043
6 files changed
+77
-12
No files matched your search
@@ -1,4 +1,8 @@
|
||||
import { Snowflake } from "@fosscord/util";
|
||||
import crypto from "crypto";
|
||||
|
||||
// TODO: 'random'? seriously? who named this?
|
||||
// And why is this even here? Just use cryto.randomBytes?
|
||||
|
||||
export function random(length = 6) {
|
||||
// Declare all characters
|
||||
@@ -8,7 +12,7 @@ export function random(length = 6) {
|
||||
// Pick characers randomly
|
||||
let str = "";
|
||||
for (let i = 0; i < length; i++) {
|
||||
str += chars.charAt(Math.floor(Math.random() * chars.length));
|
||||
str += chars.charAt(Math.floor(crypto.randomInt(chars.length)));
|
||||
}
|
||||
|
||||
return str;
|
||||
|
||||
Reference in new issue
Block a user