summaryrefslogtreecommitdiff
path: root/auth.js
diff options
context:
space:
mode:
Diffstat (limited to 'auth.js')
-rw-r--r--auth.js8
1 files changed, 2 insertions, 6 deletions
diff --git a/auth.js b/auth.js
index 872b4aa..8ee803d 100644
--- a/auth.js
+++ b/auth.js
@@ -2,8 +2,8 @@ export default {
async logIn(graffitiURL) {
// Generate a random client secret and state
- const clientSecret = this.randomString()
- const state = this.randomString()
+ const clientSecret = crypto.randomUUID()
+ const state = crypto.randomUUID()
// The client ID is the secret's hex hash
const clientID = await this.sha256(clientSecret)
@@ -114,10 +114,6 @@ export default {
return url
},
- randomString() {
- return Math.random().toString(36).substr(2)
- },
-
async sha256(input) {
const encoder = new TextEncoder()
const inputBytes = encoder.encode(input)