diff options
author | Akshay <[email protected]> | 2024-11-15 23:30:32 +0000 |
---|---|---|
committer | Akshay <[email protected]> | 2024-11-15 23:30:32 +0000 |
commit | b7ee18b41033424b180326c9077fcabe1ceab8de (patch) | |
tree | 68b45a3d519a68960707f448a605371a92889103 | |
parent | f8d93fabb90cd8cef888eb1c632eb3051c8ef9a6 (diff) |
fixy wixy
-rw-r--r-- | scripts/gen-invite.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/scripts/gen-invite.js b/scripts/gen-invite.js index 6b1e93d..4c0cbee 100644 --- a/scripts/gen-invite.js +++ b/scripts/gen-invite.js | |||
@@ -7,12 +7,6 @@ const db = new Database(dbPath, { | |||
7 | strict: true, | 7 | strict: true, |
8 | }); | 8 | }); |
9 | 9 | ||
10 | if (command === "create") { | ||
11 | createInvite(); | ||
12 | } else { | ||
13 | console.log("requires an arg"); | ||
14 | } | ||
15 | |||
16 | db.run(` | 10 | db.run(` |
17 | CREATE TABLE IF NOT EXISTS invites ( | 11 | CREATE TABLE IF NOT EXISTS invites ( |
18 | id INTEGER PRIMARY KEY AUTOINCREMENT, | 12 | id INTEGER PRIMARY KEY AUTOINCREMENT, |
@@ -22,6 +16,12 @@ db.run(` | |||
22 | ) | 16 | ) |
23 | `); | 17 | `); |
24 | 18 | ||
19 | if (command === "create") { | ||
20 | createInvite(); | ||
21 | } else { | ||
22 | console.log("requires an arg"); | ||
23 | } | ||
24 | |||
25 | function generateInviteToken() { | 25 | function generateInviteToken() { |
26 | const hasher = new Bun.CryptoHasher("sha256", "super-secret-invite-key"); | 26 | const hasher = new Bun.CryptoHasher("sha256", "super-secret-invite-key"); |
27 | return hasher.update(Math.random().toString()).digest("hex").slice(0, 10); | 27 | return hasher.update(Math.random().toString()).digest("hex").slice(0, 10); |