diff --git a/bun.lock b/bun.lock index 076db4d..790e5a0 100644 --- a/bun.lock +++ b/bun.lock @@ -23,6 +23,7 @@ "@radix-ui/react-separator": "^1.1.8", "@radix-ui/react-slot": "^1.2.4", "@radix-ui/react-tooltip": "^1.2.8", + "@types/bun": "^1.3.5", "@types/libsodium-wrappers": "^0.7.14", "better-auth": "1.4.10", "class-variance-authority": "^0.7.1", @@ -387,6 +388,8 @@ "@tailwindcss/postcss": ["@tailwindcss/postcss@4.1.18", "", { "dependencies": { "@alloc/quick-lru": "^5.2.0", "@tailwindcss/node": "4.1.18", "@tailwindcss/oxide": "4.1.18", "postcss": "^8.4.41", "tailwindcss": "4.1.18" } }, "sha512-Ce0GFnzAOuPyfV5SxjXGn0CubwGcuDB0zcdaPuCSzAa/2vII24JTkH+I6jcbXLb1ctjZMZZI6OjDaLPJQL1S0g=="], + "@types/bun": ["@types/bun@1.3.5", "", { "dependencies": { "bun-types": "1.3.5" } }, "sha512-RnygCqNrd3srIPEWBd5LFeUYG7plCoH2Yw9WaZGyNmdTEei+gWaHqydbaIRkIkcbXwhBT94q78QljxN0Sk838w=="], + "@types/cors": ["@types/cors@2.8.19", "", { "dependencies": { "@types/node": "*" } }, "sha512-mFNylyeyqN93lfe/9CSxOGREz8cpzAhH+E93xJ4xWQf62V8sQ/24reV2nyzUWM6H6Xji+GGHpkbLe7pVoUEskg=="], "@types/libsodium-wrappers": ["@types/libsodium-wrappers@0.7.14", "", {}, "sha512-5Kv68fXuXK0iDuUir1WPGw2R9fOZUlYlSAa0ztMcL0s0BfIDTqg9GXz8K30VJpPP3sxWhbolnQma2x+/TfkzDQ=="], @@ -413,6 +416,8 @@ "better-call": ["better-call@1.1.7", "", { "dependencies": { "@better-auth/utils": "^0.3.0", "@better-fetch/fetch": "^1.1.4", "rou3": "^0.7.10", "set-cookie-parser": "^2.7.1" }, "peerDependencies": { "zod": "^4.0.0" }, "optionalPeers": ["zod"] }, "sha512-6gaJe1bBIEgVebQu/7q9saahVzvBsGaByEnE8aDVncZEDiJO7sdNB28ot9I6iXSbR25egGmmZ6aIURXyQHRraQ=="], + "bun-types": ["bun-types@1.3.5", "", { "dependencies": { "@types/node": "*" } }, "sha512-inmAYe2PFLs0SUbFOWSVD24sg1jFlMPxOjOSSCYqUgn4Hsc3rDc7dFvfVYjFPNHtov6kgUeulV4SxbuIV/stPw=="], + "caniuse-lite": ["caniuse-lite@1.0.30001757", "", {}, "sha512-r0nnL/I28Zi/yjk1el6ilj27tKcdjLsNqAOZr0yVjWPrSQyHgKI2INaEWw21bAQSv2LXRt1XuCS/GomNpWOxsQ=="], "class-variance-authority": ["class-variance-authority@0.7.1", "", { "dependencies": { "clsx": "^2.1.1" } }, "sha512-Ka+9Trutv7G8M6WT6SeiRWz792K5qEqIGEGzXKhAE6xOWAY6pPH8U+9IY3oCMv6kqTmLsv7Xh/2w2RigkePMsg=="], diff --git a/convex/auth.ts b/convex/auth.ts index fa88315..be36fe4 100644 --- a/convex/auth.ts +++ b/convex/auth.ts @@ -31,6 +31,11 @@ export const createAuthOptions = (ctx: GenericCtx) => { requireEmailVerification: false, autoSignIn: true }, + trustedOrigins: [ + siteUrl, + "http://localhost:8081", + "https://sipher.tockanest.com" + ], user: { additionalFields: { metadata: { diff --git a/convex/betterAuth/olm/index.ts b/convex/betterAuth/olm/index.ts index 68bceea..8193ec5 100644 --- a/convex/betterAuth/olm/index.ts +++ b/convex/betterAuth/olm/index.ts @@ -53,7 +53,7 @@ export const consumeOTK = mutation({ keyId: v.string(), }, handler: async (ctx, args) => { - const olmAccount = await ctx.db.get<"olmAccount">(args.userId as Id<"olmAccount">); + const olmAccount = await ctx.db.query("olmAccount").withIndex("userId", (q) => q.eq("userId", args.userId)).first(); if (!olmAccount) throw new Error("User has no OLM account"); const oneTimeKeys = olmAccount.oneTimeKeys; @@ -61,7 +61,8 @@ export const consumeOTK = mutation({ if (keyIndex === -1) throw new Error("The key to be consumed was not found"); oneTimeKeys.splice(keyIndex, 1); - await ctx.db.patch<"olmAccount">(args.userId as Id<"olmAccount">, { + + await ctx.db.patch(olmAccount._id, { oneTimeKeys, }); diff --git a/package.json b/package.json index b6a6018..03edffa 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "@radix-ui/react-separator": "^1.1.8", "@radix-ui/react-slot": "^1.2.4", "@radix-ui/react-tooltip": "^1.2.8", + "@types/bun": "^1.3.5", "@types/libsodium-wrappers": "^0.7.14", "better-auth": "1.4.10", "class-variance-authority": "^0.7.1",