summaryrefslogtreecommitdiff
path: root/std/ws/mod.ts
diff options
context:
space:
mode:
authorSuguru Motegi <suguru.motegi@gmail.com>2020-02-24 13:37:15 -0800
committerGitHub <noreply@github.com>2020-02-24 16:37:15 -0500
commit79c6e052ed29b9b78c31f2e01da3b91f76b6a017 (patch)
tree8b69667d233fbf6841a55ec2d41bb9ae432e677e /std/ws/mod.ts
parentf4fd433e1aa6c8c086c38df39c39bec23c56a29c (diff)
fix: createSecKey logic (#4063)
Diffstat (limited to 'std/ws/mod.ts')
-rw-r--r--std/ws/mod.ts2
1 files changed, 1 insertions, 1 deletions
diff --git a/std/ws/mod.ts b/std/ws/mod.ts
index 5a8f0bd2e..3128a88b5 100644
--- a/std/ws/mod.ts
+++ b/std/ws/mod.ts
@@ -457,7 +457,7 @@ const kSecChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-.~_";
export function createSecKey(): string {
let key = "";
for (let i = 0; i < 16; i++) {
- const j = Math.round(Math.random() * kSecChars.length);
+ const j = Math.floor(Math.random() * kSecChars.length);
key += kSecChars[j];
}
return btoa(key);