feat: Add crypto, getRandomString

This commit is contained in:
BluJ
2023-05-04 17:15:29 -06:00
parent b9967023da
commit e32b768e5c
4 changed files with 117 additions and 108 deletions

View File

@@ -0,0 +1,11 @@
import { RandomString } from "../config/configTypes"
import { getRandomCharInSet } from "./getRandomCharInSet"
export function getRandomString(generator: RandomString): string {
let s = ""
for (let i = 0; i < generator.len; i++) {
s = s + getRandomCharInSet(generator.charset)
}
return s
}