aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/gen-invite.js12
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
10if (command === "create") {
11 createInvite();
12} else {
13 console.log("requires an arg");
14}
15
16db.run(` 10db.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
19if (command === "create") {
20 createInvite();
21} else {
22 console.log("requires an arg");
23}
24
25function generateInviteToken() { 25function 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);