@crvouga/mockingbird-service-workos 0.1.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # Changelog — @crvouga/mockingbird-service-workos
2
+
3
+ ## 0.1.0 (2026-10-05)
4
+
5
+ Initial release.
package/DISCOVERY.md ADDED
@@ -0,0 +1,55 @@
1
+ # @crvouga/mockingbird-service-workos discovery
2
+
3
+ This is the installed-package index for coding agents and tooling. All relative links resolve
4
+ inside `node_modules/@crvouga/mockingbird-service-workos/`; no repository checkout is needed to discover the mock's
5
+ supported surface or documented behavior.
6
+
7
+ ## Capability and behavior sources
8
+
9
+ | Question | Authoritative file | What it contains |
10
+ | --- | --- | --- |
11
+ | Behaviour and integration | [`README.md`](README.md) | Routes, state transitions, auth, webhooks, controls, presets and deliberate omissions. |
12
+ | Exact capabilities | [`SUPPORT.md`](SUPPORT.md) | Supported, unsupported and parity-covered operations or commands, including reasons for gaps. |
13
+ | Wire contract | [`openapi.yaml`](openapi.yaml) | Machine-readable paths, methods, schemas, responses and parity annotations. |
14
+ | Public API | [`dist/index.d.ts`](dist/index.d.ts) | The installed package's exact TypeScript exports and signatures. |
15
+ | Package metadata | [`package.json`](package.json) | Runtime/entry-point claims, vendor links, parity scope/tier and `mockingbird.discovery`. |
16
+
17
+ Read these together: the contract/capability matrix says *what* is available, while the README
18
+ defines stateful behavior, lifecycle rules, test controls, and intentional oracle differences.
19
+ If prose and an executable surface disagree, report a parity mismatch instead of adding a
20
+ consumer-side workaround.
21
+
22
+ ## Parity and oracle
23
+
24
+ - Declared parity surface: **AuthKit codes, signed sessions, refresh and user pagination**.
25
+ - Parity tier: **cold** (the repository controls when live checks run).
26
+ - Oracle: **Live vendor API or sandbox**.
27
+ - Repository command: `bun run parity:service -- workos`.
28
+ - Evidence model: Run from a Mockingbird checkout; credentials come only from .env.local or GitHub Actions secrets. Missing credentials exit 2.
29
+
30
+ The npm package contains evidence summaries and the exact contract, not credentials or the
31
+ repository-only parity harness. Self-parity/property and acceptance tests run in the Mockingbird
32
+ repository; live parity is an additional oracle check, not a substitute for the packaged matrix.
33
+
34
+ ## Runtime introspection
35
+
36
+ - `GET /__admin/health`
37
+ - `GET /__admin`
38
+ - `GET /__admin/state`
39
+ - `GET /__admin/requests`
40
+ - `GET /__admin/metrics`
41
+ - `GET /__admin/faults/presets`
42
+ - `GET /__admin/ui`
43
+
44
+ For HTTP services, use `x-mockingbird-namespace` (or the documented credential/path carrier) so
45
+ parallel tests do not share state. Admin state, journal, metrics and fault-preset endpoints are
46
+ designed for assertions and diagnosis by consuming test suites.
47
+
48
+ ## Report a mismatch or missing capability
49
+
50
+ Follow the [agent reporting contract](https://github.com/crvouga/mockingbird/blob/main/docs/REPORTING_ISSUES.md). Include package version,
51
+ operation/command, a minimal redacted request, actual mock result, expected oracle result or vendor
52
+ documentation, and whether the mismatch appears in the matrix. Never include keys, tokens,
53
+ customer data, prompts, PHI, card data, or unredacted recordings.
54
+
55
+ Service key: `workos`.
package/README.md ADDED
@@ -0,0 +1,77 @@
1
+ # @crvouga/mockingbird-service-workos
2
+
3
+ > Familiar calls. Faithful echoes. Part of [Mockingbird](https://github.com/crvouga/mockingbird).
4
+
5
+ WIP WorkOS AuthKit mock: authorization redirects, single-use codes, signed JWT sessions,
6
+ rotating refresh tokens, user metadata and pagination. Synthetic fixtures only.
7
+
8
+ ## Install
9
+
10
+ ```sh
11
+ bun add -d @crvouga/mockingbird-service-workos
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ ```ts
17
+ import { createServer } from "@crvouga/mockingbird-service-workos/server"
18
+ const server = await createServer()
19
+ // Set AuthKit WORKOS_API_HOSTNAME/WORKOS_API_PORT from server.url and WORKOS_API_HTTPS=false.
20
+ // WORKOS_API_KEY=mock_workos_key, WORKOS_CLIENT_ID=client_mock.
21
+ // Register your callback in the clients seed and use a local WORKOS_COOKIE_PASSWORD.
22
+ await server.close()
23
+ ```
24
+
25
+ `createRuntime().fetch(Request)` supports in-process adapters. Raw user mirrors should use
26
+ the server URL in place of `https://api.workos.com`. The default registered callback is
27
+ `http://localhost:3000/callback`; authorization immediately chooses the client's seeded user.
28
+ The exact `@workos-inc/node@9.3.1` and `@workos-inc/authkit-nextjs@4.1.0` SDKs are tested
29
+ over HTTP, including PKCE, JWT signature validation and expired-session refresh.
30
+
31
+ ### Routes
32
+
33
+ - `GET /user_management/authorize`: registered callback, code, state, optional organization/PKCE.
34
+ - `POST /user_management/authenticate`: client secret with authorization_code or refresh_token.
35
+ - `GET /user_management/users`: bearer API key, limit/after and email filtering.
36
+ - `GET /sso/jwks/{clientId}`: public ephemeral RS256 verification key used by AuthKit.
37
+
38
+ ### State and controls
39
+
40
+ Seed `users`, `clients` and `memberships` with runtime options. Options `accessTtlMs`,
41
+ `refreshTtlMs` and `codeTtlMs` control expiry. The mock clock controls issued timestamps.
42
+ The standard `/__admin/state` collections expose users, clients, memberships, codes, sessions
43
+ and refreshTokens. Edit `sessions.revoked`, expiry fields or used flags for failure scenarios.
44
+ Private signing keys are ephemeral and never journaled; resetting state invalidates refresh
45
+ tokens, but offline JWT verification has no revocation lookup, just like the SDK.
46
+
47
+ Standard `/__admin` reset, Timeline snapshots/branches, clock, faults and request journal
48
+ are available. Journals store metadata, not client secrets or token request bodies.
49
+ Header (`x-mockingbird-namespace`), path (`/__admin/ns/<name>/…`) and bearer credential
50
+ namespaces isolate durable state. AuthKit applications should use one dedicated server per
51
+ test namespace so the SDK's JWKS URL and issuer remain consistent. Configure `adminPrefix`
52
+ to relocate the reserved tree. Presets: `auth_failure`, `rate_limited`, `server_error`,
53
+ `connection_drop`; generic faults also support deterministic latency.
54
+
55
+ ### Verification
56
+
57
+ `bun test` covers acceptance, independent OpenAPI walks, deliberate divergence and both
58
+ pinned SDKs. `WORKOS_API_KEY=… bun run parity` runs a safe list-users shape probe; it performs
59
+ no account mutations and prints no user data. Missing credentials exit 2.
60
+ Oracle references: [authentication](https://workos.com/docs/reference/authkit/authentication),
61
+ [users](https://workos.com/docs/reference/authkit/user), and the pinned official SDK sources.
62
+
63
+ ## Deliberately not modelled
64
+
65
+ Enterprise SAML, directory synchronization, passwords, MFA, hosted AuthKit pages, logout,
66
+ user mutations and webhooks. Authorization is a synthetic auto-login rather than a hosted UI.
67
+ No third-party identities, network federation, exact production refresh-grace policies or
68
+ distributed signing-key persistence. Error envelopes model common documented failures;
69
+ vendor-specific diagnostic strings and undocumented claims are not guaranteed.
70
+
71
+ ## API
72
+
73
+ Root runtime exports: `WorkOSAPI`, `WORKOS_NAMESPACE`, `DEFAULT_USERS`, `DEFAULT_CLIENTS`,
74
+ `createRuntime`, `WORKOS_PRESETS`, `document`, `operationIds`, `supportedOperationIds`.
75
+ Types include `WorkOSUser`, `WorkOSClient`, `Membership`, `WorkOSAPIOptions`,
76
+ `WorkOSRuntimeOptions`, `WorkOSRuntime`, `OperationId`, `SupportedOperationId`.
77
+ The `/server` entry exports `createServer`, `serveTarget`, `DEFAULT_PORT`.
package/SUPPORT.md ADDED
@@ -0,0 +1,14 @@
1
+ # WorkOS AuthKit mock — operation support
2
+
3
+ Generated from `openapi.yaml`; do not edit by hand.
4
+
5
+ - operations in spec: **4**
6
+ - supported by the mock: **4**
7
+ - parity enabled: **3**
8
+
9
+ | operationId | route | mock | parity | notes |
10
+ | --- | --- | --- | --- | --- |
11
+ | `Authorize` | `GET /user_management/authorize` | ✅ supported | ❌ disabled | Browser redirect requires registered client and callback |
12
+ | `Authenticate` | `POST /user_management/authenticate` | ✅ supported | ⚠️ unsafe (opt-in) | |
13
+ | `ListUsers` | `GET /user_management/users` | ✅ supported | ✅ | |
14
+ | `GetJwks` | `GET /sso/jwks/{clientId}` | ✅ supported | ✅ | |