@semiont/backend 0.5.8 → 0.5.9

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.
package/dist/openapi.json CHANGED
@@ -174,42 +174,6 @@
174
174
  }
175
175
  }
176
176
  },
177
- "/api/tokens/mcp-generate": {
178
- "post": {
179
- "summary": "Generate MCP Token",
180
- "description": "Generate a short-lived token for MCP server",
181
- "tags": [
182
- "Authentication"
183
- ],
184
- "security": [
185
- {
186
- "bearerAuth": []
187
- }
188
- ],
189
- "responses": {
190
- "200": {
191
- "description": "MCP token generated",
192
- "content": {
193
- "application/json": {
194
- "schema": {
195
- "$ref": "#/components/schemas/MCPGenerateResponse"
196
- }
197
- }
198
- }
199
- },
200
- "401": {
201
- "description": "Unauthorized",
202
- "content": {
203
- "application/json": {
204
- "schema": {
205
- "$ref": "#/components/schemas/ErrorResponse"
206
- }
207
- }
208
- }
209
- }
210
- }
211
- }
212
- },
213
177
  "/api/tokens/media": {
214
178
  "post": {
215
179
  "summary": "Generate Media Token",
@@ -426,7 +390,7 @@
426
390
  "/api/users/logout": {
427
391
  "post": {
428
392
  "summary": "Logout",
429
- "description": "Logout the current user",
393
+ "description": "Log out the current user by revoking the per-user token epoch (SDK-AUTH-CORS Phase 2): the user's tokenVersion is incremented, so every outstanding access and refresh token for that user is rejected from here on. Returns 204 No Content — there is no session body to return.",
430
394
  "tags": [
431
395
  "Users"
432
396
  ],
@@ -436,15 +400,8 @@
436
400
  }
437
401
  ],
438
402
  "responses": {
439
- "200": {
440
- "description": "Logged out successfully",
441
- "content": {
442
- "application/json": {
443
- "schema": {
444
- "$ref": "#/components/schemas/AcceptTermsResponse"
445
- }
446
- }
447
- }
403
+ "204": {
404
+ "description": "Logged out — the user's tokens are revoked. No content."
448
405
  }
449
406
  }
450
407
  }
@@ -1168,66 +1125,6 @@
1168
1125
  }
1169
1126
  }
1170
1127
  },
1171
- "/api/tokens/mcp-setup": {
1172
- "get": {
1173
- "summary": "MCP Setup (browser-driven CLI handoff)",
1174
- "description": "Browser flow that generates a long-lived (30 day) MCP refresh token for the authenticated user and redirects to a localhost callback URL with the token as a query parameter. Used by CLI tooling (similar to Google's OAuth CLI flow).\n\nThe callback URL must match one of the localhost patterns (`http://localhost:<port>/...`, `http://127.0.0.1:<port>/...`, or `http://[::1]:<port>/...`).",
1175
- "tags": [
1176
- "Authentication"
1177
- ],
1178
- "security": [
1179
- {
1180
- "bearerAuth": []
1181
- }
1182
- ],
1183
- "parameters": [
1184
- {
1185
- "name": "callback",
1186
- "in": "query",
1187
- "required": true,
1188
- "description": "Localhost URL to redirect to with `?token=<refresh-token>` on success.",
1189
- "schema": {
1190
- "type": "string"
1191
- }
1192
- }
1193
- ],
1194
- "responses": {
1195
- "302": {
1196
- "description": "Redirect to the callback URL with the newly-issued refresh token appended as a `?token=` query parameter."
1197
- },
1198
- "400": {
1199
- "description": "Missing or non-localhost callback URL",
1200
- "content": {
1201
- "application/json": {
1202
- "schema": {
1203
- "$ref": "#/components/schemas/ErrorResponse"
1204
- }
1205
- }
1206
- }
1207
- },
1208
- "401": {
1209
- "description": "Authentication required",
1210
- "content": {
1211
- "application/json": {
1212
- "schema": {
1213
- "$ref": "#/components/schemas/ErrorResponse"
1214
- }
1215
- }
1216
- }
1217
- },
1218
- "500": {
1219
- "description": "Failed to generate refresh token",
1220
- "content": {
1221
- "application/json": {
1222
- "schema": {
1223
- "$ref": "#/components/schemas/ErrorResponse"
1224
- }
1225
- }
1226
- }
1227
- }
1228
- }
1229
- }
1230
- },
1231
1128
  "/bus/subscribe": {
1232
1129
  "get": {
1233
1130
  "summary": "Subscribe to the Semiont event bus (SSE)",
@@ -1600,7 +1497,7 @@
1600
1497
  "/api/resources/{id}": {
1601
1498
  "get": {
1602
1499
  "summary": "Get a resource's stored representation (browser-friendly alias)",
1603
- "description": "Identical pipe to GET /resources/{id} — verbatim bytes, stored media type in Content-Type, Accept never read. Exists only as the auth affordance for `<img>` / PDF.js / download links, which cannot carry Authorization headers: the `?token=` media token or the httpOnly semiont-token cookie ride along automatically.\n\nResponses carry `Cache-Control: public, max-age=31536000, immutable` — `public` is safe here, unlike the bearer-authenticated main route, because the `?token=` is part of the cache key.",
1500
+ "description": "Identical pipe to GET /resources/{id} — verbatim bytes, stored media type in Content-Type, Accept never read. Exists only as the auth affordance for `<img>` / PDF.js / download links, which cannot carry Authorization headers: the `?token=` media token rides along automatically.\n\nResponses carry `Cache-Control: public, max-age=31536000, immutable` — `public` is safe here, unlike the bearer-authenticated main route, because the `?token=` is part of the cache key.",
1604
1501
  "tags": [
1605
1502
  "Resources"
1606
1503
  ],
@@ -4007,17 +3904,6 @@
4007
3904
  }
4008
3905
  }
4009
3906
  },
4010
- "MCPGenerateResponse": {
4011
- "type": "object",
4012
- "properties": {
4013
- "refresh_token": {
4014
- "type": "string"
4015
- }
4016
- },
4017
- "required": [
4018
- "refresh_token"
4019
- ]
4020
- },
4021
3907
  "Motivation": {
4022
3908
  "type": "string",
4023
3909
  "enum": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@semiont/backend",
3
- "version": "0.5.8",
3
+ "version": "0.5.9",
4
4
  "type": "module",
5
5
  "description": "Semiont backend server - pre-built for npm consumption",
6
6
  "main": "dist/index.js",
@@ -29,9 +29,9 @@
29
29
  "@hono/swagger-ui": "^0.6.1",
30
30
  "@prisma/adapter-pg": "^7.8.0",
31
31
  "@prisma/client": "^7.8.0",
32
- "@semiont/core": "0.5.8",
33
- "@semiont/make-meaning": "0.5.8",
34
- "@semiont/observability": "0.5.8",
32
+ "@semiont/core": "0.5.9",
33
+ "@semiont/make-meaning": "0.5.9",
34
+ "@semiont/observability": "0.5.9",
35
35
  "ajv": "^8.20.0",
36
36
  "ajv-formats": "^3.0.1",
37
37
  "argon2": "^0.44.0",
@@ -0,0 +1,3 @@
1
+ -- AlterTable: per-user token revocation epoch (SDK-AUTH-CORS Phase 2).
2
+ -- Bumped on logout to invalidate every outstanding token for the user.
3
+ ALTER TABLE "users" ADD COLUMN "tokenVersion" INTEGER NOT NULL DEFAULT 0;
@@ -24,6 +24,7 @@ model User {
24
24
  isModerator Boolean @default(false) // Moderator role for content governance
25
25
  termsAcceptedAt DateTime? // When user accepted terms of service
26
26
  lastLogin DateTime?
27
+ tokenVersion Int @default(0) // bumped on logout to revoke all of this user's tokens (SDK-AUTH-CORS Phase 2)
27
28
  createdAt DateTime @default(now())
28
29
  updatedAt DateTime @updatedAt
29
30