create-disposabl-app 0.9.1 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/disposabl.js +1 -1
  2. package/dist/index.js +2 -2
  3. package/dist/templates/default/.github/workflows/pipeline.yml +1 -1
  4. package/dist/templates/default/apps/web/src/router/_authenticated/dashboard.api-keys.tsx +1 -1
  5. package/dist/templates/default/bun.lock +77 -1397
  6. package/dist/templates/default/package.json +1 -2
  7. package/dist/templates/default/packages/backend/README.md +3 -1
  8. package/dist/templates/default/packages/backend/convex/_generated/api.d.ts +6 -0
  9. package/dist/templates/default/packages/backend/convex/_generated/server.d.ts +0 -2
  10. package/dist/templates/default/packages/backend/convex/auth.config.ts +2 -10
  11. package/dist/templates/default/packages/backend/convex/convex.config.ts +3 -14
  12. package/dist/templates/default/packages/backend/convex/mcpEnterprise/README.md +42 -0
  13. package/dist/templates/default/packages/backend/convex/mcpEnterprise/internal.ts +153 -0
  14. package/dist/templates/default/packages/backend/convex/mcpEnterprise/provision.ts +102 -0
  15. package/dist/templates/default/packages/backend/convex/mcpEnterprise/validator.ts +35 -0
  16. package/dist/templates/default/packages/backend/convex/schema.ts +18 -0
  17. package/dist/templates/default/packages/backend/package.json +0 -1
  18. package/dist/templates/default/packages/cli/README.md +9 -24
  19. package/dist/templates/default/packages/disposabl-kit/client/routes/_auth-pages/login.tsx +1 -1
  20. package/dist/templates/default/packages/disposabl-kit/client/routes/_auth-pages/signUp.tsx +1 -1
  21. package/dist/templates/default/packages/disposabl-kit/client/routes/consent.tsx +71 -13
  22. package/dist/templates/default/packages/disposabl-kit/package.json +4 -14
  23. package/dist/templates/default/packages/disposabl-kit/server/http.ts +19 -12
  24. package/dist/templates/default/packages/disposabl-kit/server/lib/functions.ts +12 -0
  25. package/dist/templates/default/packages/disposabl-kit/server/mcp/enterprise.ts +267 -0
  26. package/dist/templates/default/packages/disposabl-kit/server/mcp/identity.ts +33 -0
  27. package/dist/templates/default/vendor/README.md +30 -0
  28. package/dist/templates/default/vendor/convex-auth-6c0ebf3f.tgz +0 -0
  29. package/package.json +1 -1
  30. package/dist/templates/default/apps/web/src/components/connections/expo-connection.tsx +0 -97
  31. package/dist/templates/default/apps/web/src/components/connections/provider-logo.tsx +0 -44
  32. package/dist/templates/default/apps/web/src/components/connections/use-connection-setup.ts +0 -169
  33. package/dist/templates/default/packages/disposabl-kit/client/components/ui/accordion.tsx +0 -77
  34. package/dist/templates/default/packages/disposabl-kit/client/components/ui/alert-dialog.tsx +0 -185
  35. package/dist/templates/default/packages/disposabl-kit/client/components/ui/alert.tsx +0 -75
  36. package/dist/templates/default/packages/disposabl-kit/client/components/ui/aspect-ratio.tsx +0 -22
  37. package/dist/templates/default/packages/disposabl-kit/client/components/ui/attachment.tsx +0 -207
  38. package/dist/templates/default/packages/disposabl-kit/client/components/ui/avatar.tsx +0 -106
  39. package/dist/templates/default/packages/disposabl-kit/client/components/ui/badge.tsx +0 -51
  40. package/dist/templates/default/packages/disposabl-kit/client/components/ui/breadcrumb.tsx +0 -121
  41. package/dist/templates/default/packages/disposabl-kit/client/components/ui/bubble.tsx +0 -127
  42. package/dist/templates/default/packages/disposabl-kit/client/components/ui/button-group.tsx +0 -87
  43. package/dist/templates/default/packages/disposabl-kit/client/components/ui/calendar.tsx +0 -241
  44. package/dist/templates/default/packages/disposabl-kit/client/components/ui/carousel.tsx +0 -239
  45. package/dist/templates/default/packages/disposabl-kit/client/components/ui/chart.tsx +0 -368
  46. package/dist/templates/default/packages/disposabl-kit/client/components/ui/checkbox.tsx +0 -27
  47. package/dist/templates/default/packages/disposabl-kit/client/components/ui/code-block.tsx +0 -243
  48. package/dist/templates/default/packages/disposabl-kit/client/components/ui/collapsible.tsx +0 -19
  49. package/dist/templates/default/packages/disposabl-kit/client/components/ui/combobox.tsx +0 -300
  50. package/dist/templates/default/packages/disposabl-kit/client/components/ui/command.tsx +0 -194
  51. package/dist/templates/default/packages/disposabl-kit/client/components/ui/context-menu.tsx +0 -271
  52. package/dist/templates/default/packages/disposabl-kit/client/components/ui/dialog.tsx +0 -156
  53. package/dist/templates/default/packages/disposabl-kit/client/components/ui/direction.tsx +0 -4
  54. package/dist/templates/default/packages/disposabl-kit/client/components/ui/drawer.tsx +0 -224
  55. package/dist/templates/default/packages/disposabl-kit/client/components/ui/dropdown-menu.tsx +0 -269
  56. package/dist/templates/default/packages/disposabl-kit/client/components/ui/empty.tsx +0 -103
  57. package/dist/templates/default/packages/disposabl-kit/client/components/ui/hover-card.tsx +0 -50
  58. package/dist/templates/default/packages/disposabl-kit/client/components/ui/input-group.tsx +0 -158
  59. package/dist/templates/default/packages/disposabl-kit/client/components/ui/input-otp.tsx +0 -83
  60. package/dist/templates/default/packages/disposabl-kit/client/components/ui/item.tsx +0 -201
  61. package/dist/templates/default/packages/disposabl-kit/client/components/ui/kbd.tsx +0 -26
  62. package/dist/templates/default/packages/disposabl-kit/client/components/ui/marker.tsx +0 -70
  63. package/dist/templates/default/packages/disposabl-kit/client/components/ui/menubar.tsx +0 -284
  64. package/dist/templates/default/packages/disposabl-kit/client/components/ui/message-scroller.tsx +0 -128
  65. package/dist/templates/default/packages/disposabl-kit/client/components/ui/message.tsx +0 -91
  66. package/dist/templates/default/packages/disposabl-kit/client/components/ui/native-select.tsx +0 -64
  67. package/dist/templates/default/packages/disposabl-kit/client/components/ui/navigation-menu.tsx +0 -170
  68. package/dist/templates/default/packages/disposabl-kit/client/components/ui/pagination.tsx +0 -133
  69. package/dist/templates/default/packages/disposabl-kit/client/components/ui/popover.tsx +0 -87
  70. package/dist/templates/default/packages/disposabl-kit/client/components/ui/progress.tsx +0 -82
  71. package/dist/templates/default/packages/disposabl-kit/client/components/ui/questionnaire.tsx +0 -330
  72. package/dist/templates/default/packages/disposabl-kit/client/components/ui/radio-group.tsx +0 -35
  73. package/dist/templates/default/packages/disposabl-kit/client/components/ui/resizable.tsx +0 -49
  74. package/dist/templates/default/packages/disposabl-kit/client/components/ui/scroll-area.tsx +0 -51
  75. package/dist/templates/default/packages/disposabl-kit/client/components/ui/select.tsx +0 -201
  76. package/dist/templates/default/packages/disposabl-kit/client/components/ui/sheet.tsx +0 -132
  77. package/dist/templates/default/packages/disposabl-kit/client/components/ui/sidebar.tsx +0 -723
  78. package/dist/templates/default/packages/disposabl-kit/client/components/ui/skeleton.tsx +0 -13
  79. package/dist/templates/default/packages/disposabl-kit/client/components/ui/slider.tsx +0 -51
  80. package/dist/templates/default/packages/disposabl-kit/client/components/ui/switch.tsx +0 -31
  81. package/dist/templates/default/packages/disposabl-kit/client/components/ui/table.tsx +0 -113
  82. package/dist/templates/default/packages/disposabl-kit/client/components/ui/tabs.tsx +0 -81
  83. package/dist/templates/default/packages/disposabl-kit/client/components/ui/textarea.tsx +0 -17
  84. package/dist/templates/default/packages/disposabl-kit/client/components/ui/toast.tsx +0 -229
  85. package/dist/templates/default/packages/disposabl-kit/client/components/ui/toggle-group.tsx +0 -87
  86. package/dist/templates/default/packages/disposabl-kit/client/components/ui/toggle.tsx +0 -42
  87. package/dist/templates/default/packages/disposabl-kit/client/components/ui/tooltip.tsx +0 -65
  88. package/dist/templates/default/packages/disposabl-kit/client/components/ui/trace.tsx +0 -161
  89. package/dist/templates/default/packages/disposabl-kit/client/hooks/use-mobile.ts +0 -21
  90. package/dist/templates/default/patches/@convex-dev%2Fauth@2.0.0-beta.0.patch +0 -310
@@ -11,33 +11,23 @@
11
11
  "dependencies": {
12
12
  "@base-ui/react": "^1.9.0",
13
13
  "@fontsource-variable/inter": "^5.3.0",
14
- "@shadcn/react": "^0.3.1",
15
14
  "class-variance-authority": "^0.7.1",
16
- "cmdk": "^1.1.1",
17
15
  "cn": "^0.5.0",
18
- "date-fns": "^4.4.0",
19
- "embla-carousel-react": "^8.6.0",
20
- "input-otp": "^1.5.0",
21
16
  "lucide-react": "catalog:",
22
17
  "react": "catalog:",
23
- "react-day-picker": "^10.0.2",
24
18
  "react-dom": "catalog:",
25
- "react-resizable-panels": "^4.15.0",
26
- "recharts": "3.8.0",
27
19
  "shadcn": "^4.22.1",
28
- "shiki": "^4.5.0",
29
20
  "tw-animate-css": "^1.4.0",
30
- "zod": "^4.6.7",
31
21
  "convex": "catalog:",
32
22
  "@convex-dev/auth": "catalog:",
33
23
  "@convex-dev/mcp": "catalog:",
34
24
  "@convex-dev/static-hosting": "catalog:",
35
- "@tanstack/react-router": "latest"
25
+ "@tanstack/react-router": "latest",
26
+ "jose": "^6.2.15"
36
27
  },
37
28
  "devDependencies": {
38
29
  "@tailwindcss/vite": "^4",
39
30
  "@tanstack/eslint-config": "latest",
40
- "@turbo/gen": "^2.11.10",
41
31
  "@types/node": "^22",
42
32
  "@types/react": "^19",
43
33
  "@types/react-dom": "^19",
@@ -53,14 +43,14 @@
53
43
  "./client/styles/globals.css": "./client/styles/globals.css",
54
44
  "./client/lib/*": "./client/lib/*.ts",
55
45
  "./client/components/ui/*": "./client/components/ui/*.tsx",
56
- "./client/hooks/*": "./client/hooks/*.ts",
57
46
  "./server/http": "./server/http.ts",
58
47
  "./server/lib/functions": "./server/lib/functions.ts",
59
48
  "./client/vite.config": "./client/vite.config.ts",
60
49
  "./platforms": "./platforms.ts",
61
50
  "./mobile": "./mobile/index.ts",
62
51
  "./features": "./features.ts",
63
- "./mobile/expo-plugin": "./mobile/expo-plugin.cjs"
52
+ "./mobile/expo-plugin": "./mobile/expo-plugin.cjs",
53
+ "./server/mcp/identity": "./server/mcp/identity.ts"
64
54
  },
65
55
  "peerDependencies": {
66
56
  "expo": "~58.0.19",
@@ -1,5 +1,6 @@
1
- import { getAuthUserId } from "@convex-dev/auth/server";
1
+ import { getSessionUserId } from "./lib/functions";
2
2
  import { McpServer } from "@convex-dev/mcp";
3
+ import { EnterpriseMcpServer } from "./mcp/enterprise";
3
4
  import { httpActionGeneric, httpRouter } from "convex/server";
4
5
  import { components } from "../../backend/convex/_generated/api";
5
6
  import { env } from "../../backend/convex/_generated/server";
@@ -27,16 +28,22 @@ if (
27
28
  export const platformSpec = platforms.spec;
28
29
 
29
30
  const enabled = validatePlatforms(config.platforms);
30
- const mcp = enabled.some((platform) => platform === "mcp" || platform === "api")
31
- ? new McpServer(components.mcp, {
32
- name: "disposabl",
33
- title: "Disposabl",
34
- version: "1.0.0",
35
- siteUrl: env.CONVEX_SITE_URL,
36
- consentUrl: `${env.CONVEX_SITE_URL}/consent`,
37
- scopes: {},
38
- tools: platforms.tools,
39
- })
31
+ const mcp: McpServer | undefined = enabled.some(
32
+ (platform) => platform === "mcp" || platform === "api",
33
+ )
34
+ ? new (enabled.includes("mcp") ? EnterpriseMcpServer : McpServer)(
35
+ components.mcp,
36
+ {
37
+ name: "disposabl",
38
+ title: "Disposabl",
39
+ version: "1.0.0",
40
+ siteUrl: env.CONVEX_SITE_URL,
41
+ consentUrl: `${env.CONVEX_SITE_URL}/consent`,
42
+ scopes: {},
43
+ clientMetadataDocumentHosts: ["claude.ai"],
44
+ tools: platforms.tools,
45
+ },
46
+ )
40
47
  : undefined;
41
48
 
42
49
  // Keep the enabled API types for consumers; disabled exports are absent at runtime.
@@ -47,7 +54,7 @@ export const {
47
54
  revokeConnection,
48
55
  createApiKey,
49
56
  } =
50
- mcp?.api({ getUserId: getAuthUserId }) ??
57
+ mcp?.api({ getUserId: getSessionUserId }) ??
51
58
  ({} as ReturnType<McpServer["api"]>);
52
59
 
53
60
  export default function createHttpRouter() {
@@ -1,3 +1,5 @@
1
+ import { getAuthUserId } from "@convex-dev/auth/server";
2
+ import type { Auth } from "convex/server";
1
3
  import {
2
4
  v,
3
5
  type GenericValidator,
@@ -35,3 +37,13 @@ const withPlatforms = <TDefinition, TResult extends object>(
35
37
  export const internalQuery = withPlatforms(nativeQuery);
36
38
  export const internalMutation = withPlatforms(nativeMutation);
37
39
  export const internalAction = withPlatforms(nativeAction);
40
+
41
+ // The MCP alpha types its callback as auth-only; Convex Auth reboot also
42
+ // checks the live session via runQuery. Actual Convex function contexts have it.
43
+ export async function getSessionUserId(ctx: { auth: Auth }) {
44
+ if (!("runQuery" in ctx) || typeof ctx.runQuery !== "function")
45
+ throw new Error(
46
+ "Session authentication requires a Convex function context.",
47
+ );
48
+ return getAuthUserId(ctx as Parameters<typeof getAuthUserId>[0]);
49
+ }
@@ -0,0 +1,267 @@
1
+ import { McpServer, type McpUser, type ToolCtx } from "@convex-dev/mcp";
2
+ import { httpActionGeneric, httpRouter, type HttpRouter } from "convex/server";
3
+ import { createLocalJWKSet, decodeJwt, jwtVerify } from "jose";
4
+ import { internal } from "../../../backend/convex/_generated/api";
5
+ import {
6
+ claudeIssuer,
7
+ CLAUDE_CLIENT_ID,
8
+ ID_JAG_PROFILE,
9
+ JWT_GRANT,
10
+ TOKEN_PREFIX,
11
+ tokenHash,
12
+ } from "./identity";
13
+
14
+ const headers = {
15
+ "Cache-Control": "no-store",
16
+ Pragma: "no-cache",
17
+ "Access-Control-Allow-Origin": "*",
18
+ };
19
+ const json = (body: unknown, status = 200) =>
20
+ Response.json(body, { status, headers });
21
+ const invalid = () => json({ error: "invalid_grant" }, 400);
22
+
23
+ // Only Anthropic's identity host is fetched. Neither JWT headers nor an
24
+ // untrusted issuer can supply a URL, and redirects are never followed.
25
+ async function identityDocument(
26
+ address: string,
27
+ ): Promise<Record<string, unknown>> {
28
+ const url = new URL(address);
29
+ if (
30
+ url.origin !== "https://identity.anthropic.com" ||
31
+ url.username ||
32
+ url.password ||
33
+ url.hash
34
+ )
35
+ throw new Error("Invalid identity document URL");
36
+ const response = await fetch(url, {
37
+ redirect: "error",
38
+ signal: AbortSignal.timeout(5000),
39
+ });
40
+ if (!response.ok || !response.body)
41
+ throw new Error("Identity document unavailable");
42
+ const reader = response.body.getReader();
43
+ const chunks: Uint8Array[] = [];
44
+ let size = 0;
45
+ try {
46
+ for (;;) {
47
+ const { done, value } = await reader.read();
48
+ if (done) break;
49
+ size += value.byteLength;
50
+ if (size > 262144) throw new Error("Identity document too large");
51
+ chunks.push(value);
52
+ }
53
+ } finally {
54
+ await reader.cancel();
55
+ }
56
+ const bytes = new Uint8Array(size);
57
+ let offset = 0;
58
+ for (const chunk of chunks) {
59
+ bytes.set(chunk, offset);
60
+ offset += chunk.length;
61
+ }
62
+ const value: unknown = JSON.parse(new TextDecoder().decode(bytes));
63
+ if (!value || typeof value !== "object" || Array.isArray(value))
64
+ throw new Error("Invalid identity document");
65
+ return value as Record<string, unknown>;
66
+ }
67
+
68
+ export class EnterpriseMcpServer extends McpServer {
69
+ override authorizationServerMetadata() {
70
+ const metadata = super.authorizationServerMetadata();
71
+ return {
72
+ ...metadata,
73
+ grant_types_supported: [...metadata.grant_types_supported, JWT_GRANT],
74
+ authorization_grant_profiles_supported: [ID_JAG_PROFILE],
75
+ };
76
+ }
77
+
78
+ override registerRoutes(http: HttpRouter) {
79
+ const routes = httpRouter();
80
+ super.registerRoutes(routes);
81
+ for (const [path, method, handler] of routes.getRoutes()) {
82
+ // Convex's router invokes this runtime method too; its public declaration
83
+ // strips runtime-only members. Keep the compatibility boundary here.
84
+ const original = handler as typeof handler & {
85
+ invokeHttpAction: (request: Request) => Promise<Response>;
86
+ };
87
+ if (
88
+ method !== "POST" ||
89
+ ![`${this.path}/oauth/token`, `${this.path}/oauth/revoke`].includes(
90
+ path,
91
+ )
92
+ ) {
93
+ http.route({ path, method, handler });
94
+ continue;
95
+ }
96
+ http.route({
97
+ path,
98
+ method,
99
+ handler: httpActionGeneric(async (ctx, request) => {
100
+ // Parse a clone so normal OAuth/device requests retain their original body.
101
+ if (
102
+ !request.headers
103
+ .get("Content-Type")
104
+ ?.startsWith("application/x-www-form-urlencoded")
105
+ )
106
+ return original.invokeHttpAction(request);
107
+ const text = await request.clone().text();
108
+ if (text.length > 32768)
109
+ return json({ error: "invalid_request" }, 400);
110
+ const form = new URLSearchParams(text);
111
+ if (path.endsWith("/token") && form.get("grant_type") === JWT_GRANT) {
112
+ for (const key of new Set(form.keys()))
113
+ if (form.getAll(key).length !== 1)
114
+ return json({ error: "invalid_request" }, 400);
115
+ return this.exchangeAssertion(ctx, form);
116
+ }
117
+ const token = form.get("token");
118
+ if (path.endsWith("/revoke") && token?.startsWith(TOKEN_PREFIX)) {
119
+ await ctx.runMutation(internal.mcpEnterprise.internal.revoke, {
120
+ hash: await tokenHash(token),
121
+ });
122
+ return json({});
123
+ }
124
+ return original.invokeHttpAction(request);
125
+ }),
126
+ });
127
+ }
128
+ }
129
+
130
+ override async authenticate(
131
+ ctx: ToolCtx,
132
+ request: Request,
133
+ ): Promise<McpUser | null> {
134
+ const token = request.headers
135
+ .get("Authorization")
136
+ ?.match(/^Bearer\s+(\S+)$/i)?.[1];
137
+ if (!token?.startsWith(TOKEN_PREFIX))
138
+ return super.authenticate(ctx, request);
139
+ // Enterprise grants authorize this MCP resource only, never the HTTP API.
140
+ if (
141
+ new URL(request.url).pathname !== this.path ||
142
+ !/^mcp_ema_[0-9a-f]{64}$/.test(token)
143
+ )
144
+ return null;
145
+ return ctx.runQuery(internal.mcpEnterprise.internal.verify, {
146
+ hash: await tokenHash(token),
147
+ now: Date.now(),
148
+ });
149
+ }
150
+
151
+ private async exchangeAssertion(
152
+ ctx: ToolCtx,
153
+ form: URLSearchParams,
154
+ ): Promise<Response> {
155
+ try {
156
+ const assertion = form.get("assertion");
157
+ if (
158
+ !assertion ||
159
+ assertion.length > 16384 ||
160
+ form.get("client_id") !== CLAUDE_CLIENT_ID ||
161
+ form.has("client_secret") ||
162
+ form.has("client_assertion")
163
+ )
164
+ return invalid();
165
+ if (form.has("resource") && form.get("resource") !== this.resource)
166
+ return invalid();
167
+ const issuer = claudeIssuer(decodeJwt(assertion).iss ?? "");
168
+ const organization = await ctx.runQuery(
169
+ internal.mcpEnterprise.internal.organization,
170
+ { issuer },
171
+ );
172
+ if (!organization) return invalid();
173
+ const discovery = await identityDocument(
174
+ `${issuer}/.well-known/openid-configuration`,
175
+ );
176
+ if (discovery.issuer !== issuer || typeof discovery.jwks_uri !== "string")
177
+ return invalid();
178
+ const jwks = await identityDocument(discovery.jwks_uri);
179
+ if (!Array.isArray(jwks.keys)) return invalid();
180
+ const { payload } = await jwtVerify(
181
+ assertion,
182
+ createLocalJWKSet({ keys: jwks.keys }),
183
+ {
184
+ issuer,
185
+ audience: this.issuer,
186
+ typ: "oauth-id-jag+jwt",
187
+ algorithms: ["RS256", "ES256"],
188
+ requiredClaims: ["sub", "jti", "iat", "exp", "client_id"],
189
+ maxTokenAge: "10 minutes",
190
+ },
191
+ );
192
+ const now = Date.now() / 1000;
193
+ if (
194
+ payload.client_id !== CLAUDE_CLIENT_ID ||
195
+ !payload.sub ||
196
+ payload.sub.length > 512 ||
197
+ !payload.jti ||
198
+ payload.jti.length > 512 ||
199
+ !payload.exp ||
200
+ !payload.iat ||
201
+ payload.exp - payload.iat > 600 ||
202
+ payload.iat > now ||
203
+ payload.aud !== this.issuer
204
+ )
205
+ return invalid();
206
+ if (payload.resource !== undefined && payload.resource !== this.resource)
207
+ return invalid();
208
+ if (
209
+ payload.tenant !== undefined &&
210
+ payload.tenant !== organization.tenantId
211
+ )
212
+ return invalid();
213
+ if (payload.email !== undefined && typeof payload.email !== "string")
214
+ return invalid();
215
+ if (payload.scope !== undefined && typeof payload.scope !== "string")
216
+ return invalid();
217
+ // No default-to-all scopes. Both the signed grant and tenant policy bound access.
218
+ const scopes =
219
+ typeof payload.scope === "string"
220
+ ? [...new Set(payload.scope.split(/\s+/).filter(Boolean))]
221
+ : [];
222
+ const requested =
223
+ form.get("scope")?.split(/\s+/).filter(Boolean) ?? scopes;
224
+ if (
225
+ requested.some(
226
+ (scope) =>
227
+ !scopes.includes(scope) ||
228
+ !organization.scopes.includes(scope) ||
229
+ !(scope in (this.options.scopes ?? {})),
230
+ )
231
+ )
232
+ return json({ error: "invalid_scope" }, 400);
233
+ const random = crypto.getRandomValues(new Uint8Array(32));
234
+ const token =
235
+ TOKEN_PREFIX +
236
+ Array.from(random, (byte) => byte.toString(16).padStart(2, "0")).join(
237
+ "",
238
+ );
239
+ const result = await ctx.runMutation(
240
+ internal.mcpEnterprise.internal.exchange,
241
+ {
242
+ issuer,
243
+ revision: organization.revision,
244
+ subject: payload.sub,
245
+ ...(typeof payload.email === "string"
246
+ ? { email: payload.email }
247
+ : {}),
248
+ jti: payload.jti,
249
+ assertionExpiresAt: payload.exp * 1000,
250
+ scopes: requested,
251
+ hash: await tokenHash(token),
252
+ },
253
+ );
254
+ return result
255
+ ? json({
256
+ access_token: token,
257
+ token_type: "Bearer",
258
+ expires_in: result.expiresIn,
259
+ scope: requested.join(" "),
260
+ })
261
+ : invalid();
262
+ } catch {
263
+ // Never log assertions, emails, or tokens, or disclose membership on errors.
264
+ return invalid();
265
+ }
266
+ }
267
+ }
@@ -0,0 +1,33 @@
1
+ /** Claude publishes this public client with token_endpoint_auth_method: none. */
2
+ export const CLAUDE_CLIENT_ID =
3
+ "https://claude.ai/oauth/mcp-oauth-client-metadata";
4
+ export const JWT_GRANT = "urn:ietf:params:oauth:grant-type:jwt-bearer";
5
+ export const ID_JAG_PROFILE = "urn:ietf:params:oauth:grant-profile:id-jag";
6
+ export const TOKEN_PREFIX = "mcp_ema_";
7
+
8
+ export function claudeIssuer(value: string) {
9
+ if (
10
+ !/^https:\/\/identity\.anthropic\.com\/issuers\/[A-Za-z0-9_-]+$/.test(value)
11
+ )
12
+ throw new Error(
13
+ "Use the exact Claude organization issuer URL, without a trailing slash.",
14
+ );
15
+ return value;
16
+ }
17
+
18
+ export function normalizeEmail(value: string) {
19
+ const email = value.trim().toLowerCase();
20
+ if (email.length > 254 || !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email))
21
+ throw new Error("A verified email is required.");
22
+ return email;
23
+ }
24
+
25
+ export async function tokenHash(value: string) {
26
+ const bytes = await crypto.subtle.digest(
27
+ "SHA-256",
28
+ new TextEncoder().encode(value),
29
+ );
30
+ return Array.from(new Uint8Array(bytes), (byte) =>
31
+ byte.toString(16).padStart(2, "0"),
32
+ ).join("");
33
+ }
@@ -0,0 +1,30 @@
1
+ # Convex Auth reboot snapshot
2
+
3
+ `convex-auth-6c0ebf3f.tgz` contains `@convex-dev/auth` built from [convex/convex-auth](https://github.com/convex/convex-auth) commit [`6c0ebf3f1403e95cbc67536aa32e4fb03280be23`](https://github.com/convex/convex-auth/commit/6c0ebf3f1403e95cbc67536aa32e4fb03280be23), on the `reboot` branch, checked on 2026-11-04.
4
+
5
+ The package version is `2.0.0-beta.0-reboot.6c0ebf3f` to distinguish it from the published beta. Source code is unchanged. The archive includes the Apache 2.0 license declared by upstream.
6
+
7
+ SHA-256: `16b88c41043d948d2c04325283eb7532461c5defa50837984b337ec77f509a57`.
8
+
9
+ The root catalog references this archive, and the generator includes it in new apps. Builds install this exact snapshot without depending on a moving branch or executing an upstream Git prepare hook.
10
+
11
+ ## Rebuild
12
+
13
+ Check out the exact commit in a separate directory. Install its pinned workspace dependencies with `pnpm install --frozen-lockfile`. Run the core package's `build` command, which produces both public and internal declaration files. Change only the core package version to the snapshot version above, include the Apache 2.0 LICENSE, and use `npm pack --ignore-scripts` in `packages/core`. Review and record the resulting archive checksum before updating it here. The archive includes source and compiled output.
14
+
15
+ ## Existing deployments need a migration
16
+
17
+ Fresh apps need no session migration. Existing deployments must perform the migration below before deploying this snapshot.
18
+
19
+ Upstream removed fields from both `auth/sessions` and `auth/refreshTokens`, changed the JWT subject to the session ID, moved signing to Convex deployment-issued JWTs, and changed the audience to `convex-auth`. The app now uses `convexAuthProvider()` and no longer generates or binds `AUTH_PRIVATE_KEY` and `AUTH_JWKS`.
20
+
21
+ Before upgrading an existing deployment:
22
+
23
+ 1. Back up that deployment, including authentication components.
24
+ 2. Schedule a sign-out window and obtain approval to invalidate all sessions.
25
+ 3. Follow upstream's migration requirement to clear only the auth component's sessions and refreshTokens tables, then deploy the new package and auth configuration together. This signs everyone out. Do not delete users, credentials, other auth components, or app data.
26
+ 4. Verify sign-in, refresh, sign-out, authenticated queries, and existing account access on the deployed app.
27
+
28
+ Do not apply the upgrade to production automatically. Old deployment environment keys can remain until the migration succeeds; this change does not delete them.
29
+
30
+ Upstream migration notes: [session schema change](https://github.com/convex/convex-auth/commit/0fdc1bac), [refresh-token schema change](https://github.com/convex/convex-auth/commit/07911f86230f86ff61655559e8fd278a843ca084).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-disposabl-app",
3
- "version": "0.9.1",
3
+ "version": "0.10.1",
4
4
  "description": "Create a Disposabl app",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,97 +0,0 @@
1
- import { useState } from "react";
2
- import { useAction } from "convex/react";
3
- import { api } from "../../../../../packages/backend/convex/_generated/api";
4
- import { Button } from "@disposabl/disposabl-kit/client/components/ui/button";
5
- import { Input } from "@disposabl/disposabl-kit/client/components/ui/input";
6
-
7
- export function ExpoConnection({
8
- busy,
9
- run,
10
- onConnected,
11
- }: {
12
- busy: boolean;
13
- run: (action: () => Promise<void>) => Promise<void>;
14
- onConnected: () => void;
15
- }) {
16
- const expoAccounts = useAction(api.connections.index.expoAccounts);
17
- const connectExpo = useAction(api.connections.index.connectExpo);
18
- const [token, setToken] = useState("");
19
- const [accounts, setAccounts] = useState<Array<{ id: string; name: string }>>(
20
- [],
21
- );
22
- const [accountId, setAccountId] = useState("");
23
- return (
24
- <form
25
- className="mt-5 space-y-4 border-t pt-5"
26
- onSubmit={(event) => {
27
- event.preventDefault();
28
- void run(async () => {
29
- if (!accounts.length) {
30
- const result = await expoAccounts({ token });
31
- if (!result.length)
32
- throw new Error("No Expo accounts were found for this token.");
33
- setAccounts(result);
34
- setAccountId(result[0]?.id ?? "");
35
- } else {
36
- await connectExpo({ token, accountId });
37
- setToken("");
38
- setAccounts([]);
39
- setAccountId("");
40
- onConnected();
41
- }
42
- });
43
- }}
44
- >
45
- <p className="text-sm text-muted-foreground">
46
- Verify an Expo access token, then choose the account to save.
47
- </p>
48
- <label className="block space-y-2 text-sm font-medium">
49
- Access token
50
- <Input
51
- type="password"
52
- autoComplete="off"
53
- required
54
- value={token}
55
- onChange={(event) => {
56
- setToken(event.target.value);
57
- setAccounts([]);
58
- setAccountId("");
59
- }}
60
- />
61
- </label>
62
- <a
63
- className="inline-block text-sm underline underline-offset-4"
64
- href="https://expo.dev/settings/access-tokens"
65
- target="_blank"
66
- rel="noreferrer"
67
- >
68
- Create an Expo access token
69
- </a>
70
- {accounts.length > 0 && (
71
- <label className="block space-y-2 text-sm font-medium">
72
- Expo account
73
- <select
74
- className="block min-h-11 w-full rounded-md border bg-background px-3"
75
- value={accountId}
76
- onChange={(event) => setAccountId(event.target.value)}
77
- >
78
- {accounts.map((account) => (
79
- <option key={account.id} value={account.id}>
80
- {account.name}
81
- </option>
82
- ))}
83
- </select>
84
- </label>
85
- )}
86
- <div>
87
- <Button
88
- type="submit"
89
- className="min-h-11"
90
- disabled={busy || !token.trim()}
91
- >
92
- {accounts.length ? "Save account" : "Verify token"}
93
- </Button>
94
- </div>
95
- </form>
96
- );
97
- }
@@ -1,44 +0,0 @@
1
- export function ProviderLogo({
2
- provider,
3
- }: {
4
- provider: "github" | "convex" | "expo" | "blacksmith";
5
- }) {
6
- if (provider === "blacksmith")
7
- return (
8
- <span aria-hidden="true" className="font-mono text-xl font-bold">
9
- B
10
- </span>
11
- );
12
- if (provider === "github")
13
- return (
14
- <svg
15
- viewBox="0 0 24 24"
16
- fill="currentColor"
17
- aria-hidden="true"
18
- className="size-6"
19
- >
20
- <path d="M12 .5a12 12 0 0 0-3.79 23.39c.6.11.82-.26.82-.58v-2.23c-3.34.73-4.04-1.42-4.04-1.42-.55-1.39-1.33-1.76-1.33-1.76-1.09-.75.08-.73.08-.73 1.2.08 1.83 1.23 1.83 1.23 1.07 1.83 2.8 1.3 3.49.99.1-.77.42-1.3.76-1.6-2.67-.31-5.47-1.34-5.47-5.93 0-1.31.47-2.38 1.23-3.22-.12-.3-.53-1.52.12-3.17 0 0 1-.32 3.3 1.23a11.5 11.5 0 0 1 6 0c2.29-1.55 3.29-1.23 3.29-1.23.65 1.65.24 2.87.12 3.17.77.84 1.23 1.91 1.23 3.22 0 4.6-2.8 5.62-5.48 5.92.43.37.81 1.1.81 2.22v3.3c0 .32.22.7.83.58A12 12 0 0 0 12 .5Z" />
21
- </svg>
22
- );
23
- if (provider === "expo")
24
- return (
25
- <svg
26
- viewBox="0 0 24 24"
27
- fill="currentColor"
28
- aria-hidden="true"
29
- className="size-6"
30
- >
31
- <path d="M12 2c-.9 0-1.37.24-1.76.84-1.1 1.67-6.42 10.95-7.2 12.34-.52.92-.67 1.5-.45 2.19.31.96 1.26 1.65 2.18 1.65.66 0 1.11-.3 1.61-.98 1.07-1.47 3.43-5.61 4.74-7.47.28-.4.53-.61.88-.61s.6.21.88.61c1.31 1.86 3.67 6 4.74 7.47.5.68.95.98 1.61.98.92 0 1.87-.69 2.18-1.65.22-.69.07-1.27-.45-2.19-.78-1.39-6.1-10.67-7.2-12.34C13.37 2.24 12.9 2 12 2Z" />
32
- </svg>
33
- );
34
- return (
35
- <svg
36
- viewBox="0 0 24 24"
37
- fill="#EE342F"
38
- aria-hidden="true"
39
- className="size-7"
40
- >
41
- <path d="M15.09 18.916c3.488-.387 6.776-2.246 8.586-5.348-.857 7.673-9.247 12.522-16.095 9.545a3.47 3.47 0 0 1-1.547-1.314c-1.539-2.417-2.044-5.492-1.318-8.282 2.077 3.584 6.3 5.78 10.374 5.399m-10.501-7.65c-1.414 3.266-1.475 7.092.258 10.24-6.1-4.59-6.033-14.41-.074-18.953a3.44 3.44 0 0 1 1.893-.707c2.825-.15 5.695.942 7.708 2.977-4.09.04-8.073 2.66-9.785 6.442m11.757-5.437C14.283 2.951 11.053.992 7.515.933c6.84-3.105 15.253 1.929 16.17 9.37a3.6 3.6 0 0 1-.334 2.02c-1.278 2.594-3.647 4.607-6.416 5.352 2.029-3.763 1.778-8.36-.589-11.847" />
42
- </svg>
43
- );
44
- }