mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-31 12:43:38 +00:00
feat: Add crypto, getRandomString
This commit is contained in:
11
lib/util/getRandomString.ts
Normal file
11
lib/util/getRandomString.ts
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user