Skip to content

Feature/open api - #720

Merged
bobsingor merged 8 commits into
mainfrom
feature/open-api
Aug 7, 2026
Merged

Feature/open api#720
bobsingor merged 8 commits into
mainfrom
feature/open-api

Conversation

@bobsingor

Copy link
Copy Markdown
Contributor

No description provided.

bobsingor and others added 7 commits August 7, 2026 10:16
Introduce a tenant-scoped admin operation registry and OpenAPI emitter (admin-api). Add generated openapi.json, emitter script, tsup entry and tests. Change admin SDK to TenantClient, make document APIs tenant-scoped, and require exactly one of apiToken/tenantToken in HttpClient. Server: add API-token support with constant-time matching, requireTenantAccess/requireApiToken guards, mount admin routes from the registry, and expose deployment license status as an api-token-only route. Implement keyset cursor pagination for documents (opaque v1.<base64> cursors), add DB index migrations for Postgres/SQLite, and update services, repos, routes, examples and tests accordingly.
Introduce full tenants lifecycle: OpenAPI endpoints, admin-api Zod schemas and adminOperations for tenants (create, list, get, delete). Add admin client Tenants and expose via CloudAdmin. Implement server-side routes, list cursor encoding/decoding, and tenant repo methods (ensure, ensureExplicit, list, deleteCascadeDb). Add DB migrations (Postgres/SQLite) and schema column/index auto_provisioned for provenance and keyset ordering. Wire auto-provision flag into DocumentLifecycleService and add end-to-end admin tests covering create, list, provenance, pagination and cascade delete.
Add POST /v1/tenants/{tenantId}/tokens to mint doc or tenant tokens and extend revoke flow. Introduce TenantTokens SDK, HttpClient.postEmpty, and server route handlers that log every issuance/revocation to a new security_events table. Add repository, schema entries and migrations for Postgres/SQLite. Replace old tenant scope `tokens.mint` with `tokens.issue-doc` and `tokens.revoke`, update OpenAPI, auth verifier types and many tests to exercise the new behavior. Also rename admin status paths to deployment status and adjust imports/tests (skip some stale engine-core wire tests).
Support API-token (root) access on the doc-plane and per-request X-Document-Password (base64) handling. Adds preHandler to synthesize tenant principal for API tokens and strict base64/UTF-8 decoding. Threads decoded docPassword into request/jwt contexts. Refactors DocumentService open/password flows: per-request authorization for api-token callers, canonical open singleflight retry, stateless password verification against open sessions, and password-verification cache lookup helper. Updates jwt-plugin types and test stub to simulate password failures. Adds comprehensive doc-plane API-token tests.
Add four .changeset files describing package version bumps and major feature changes:

- @cloudpdf/admin (major): tenant-scoped admin SDK, tenant lifecycle, tenant token issuance/revocation, document iterator, move shared schemas to @cloudpdf/contract.
- @cloudpdf/contract (major): full backend HTTP contract, Zod schemas, OpenAPI 3.1 emitter and generated openapi.json, contract tests.
- @cloudpdf/server (major): tenant-scoped server API, root API-token workflow, tenant lifecycle, pagination, migrations, and expanded tests.
- @embedpdf/engine-core (minor): export wireTemplates for shared document-plane route templates.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cloudpdf-com Ready Ready Preview Aug 7, 2026 11:24am
embed-pdf-snippet Error Error Aug 7, 2026 11:24am
embed-pdf-viewer-react-mui Error Error Aug 7, 2026 11:24am
embed-pdf-viewer-svelte-tailwind Error Error Aug 7, 2026 11:24am
embed-pdf-viewer-vue-vuetify Error Error Aug 7, 2026 11:24am
embed-pdf-website Error Error Aug 7, 2026 11:24am

Request Review

Comment thread cloudpdf/server/src/app/buildApp.ts Fixed
Comment thread cloudpdf/server/src/app/buildApp.ts Fixed
Comment thread cloudpdf/server/src/app/jwt-plugin.ts Fixed
Enforce production-secret validation for apiAuthTokens in buildApp and reject short root tokens for production licenses. Replace raw SHA-256 digests with a process-local HMAC-based matcher (random key) for constant-time API token comparisons. Add strict Base64 handling for X-Document-Password: max length, canonical padding rules, and round-trip verification to reject malformed inputs. Update related tests to cover unpadded base64, invalid padding, oversized headers, and production-token validation.
Comment thread cloudpdf/server/src/app/jwt-plugin.ts Dismissed
@bobsingor
bobsingor merged commit bcf54be into main Aug 7, 2026
11 of 22 checks passed
@bobsingor
bobsingor deleted the feature/open-api branch August 7, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants