summary refs log tree commit diff
path: root/gateway/src/util/SessionUtils.ts
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-02 20:20:15 +0200
committerGitHub <noreply@github.com>2021-09-02 20:20:15 +0200
commit6cd7d7230e8918ff292e7a48f1b7426d0e53e6ca (patch)
tree46fd326a827a2586428a8e4fca951e9f5366120a /gateway/src/util/SessionUtils.ts
parent:art: update openapi title (diff)
parent:sparkles: add editor config (diff)
downloadserver-6cd7d7230e8918ff292e7a48f1b7426d0e53e6ca.tar.xz
Merge pull request #306 from AlTech98/master
Gateway VOICE_STATE_UPDATE and sessions implementation, fix #210
Diffstat (limited to '')
-rw-r--r--gateway/src/util/SessionUtils.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/gateway/src/util/SessionUtils.ts b/gateway/src/util/SessionUtils.ts
new file mode 100644

index 00000000..c66c7e76 --- /dev/null +++ b/gateway/src/util/SessionUtils.ts
@@ -0,0 +1,11 @@ +export function genSessionId() { + return genRanHex(32); +} + +export function genVoiceToken() { + return genRanHex(16); +} + +function genRanHex(size: number) { + return [...Array(size)].map(() => Math.floor(Math.random() * 16).toString(16)).join(""); +}