@getcirrus/space-conformance 0.0.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/dist/base-D8a-ZK57.d.ts +249 -0
- package/dist/base-D8a-ZK57.d.ts.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +373 -0
- package/dist/cli.js.map +1 -0
- package/dist/coverage-DhJZu8P8.js +1914 -0
- package/dist/coverage-DhJZu8P8.js.map +1 -0
- package/dist/full-D4ufJLcw.js +409 -0
- package/dist/full-D4ufJLcw.js.map +1 -0
- package/dist/full.d.ts +59 -0
- package/dist/full.d.ts.map +1 -0
- package/dist/full.js +4 -0
- package/dist/index.d.ts +178 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +114 -0
- package/dist/index.js.map +1 -0
- package/dist/operator-BErXCDow.js +923 -0
- package/dist/operator-BErXCDow.js.map +1 -0
- package/lexicons/MANIFEST.json +7 -0
- package/lexicons/simplespace/addMember.json +37 -0
- package/lexicons/simplespace/checkUserAccess.json +43 -0
- package/lexicons/simplespace/createSpace.json +74 -0
- package/lexicons/simplespace/defs.json +47 -0
- package/lexicons/simplespace/deleteSpace.json +32 -0
- package/lexicons/simplespace/getSpace.json +53 -0
- package/lexicons/simplespace/listMembers.json +65 -0
- package/lexicons/simplespace/removeMember.json +37 -0
- package/lexicons/simplespace/updateSpace.json +57 -0
- package/lexicons/space/applyWrites.json +163 -0
- package/lexicons/space/createRecord.json +79 -0
- package/lexicons/space/defs.json +38 -0
- package/lexicons/space/deleteRecord.json +51 -0
- package/lexicons/space/getBlob.json +54 -0
- package/lexicons/space/getDelegationToken.json +34 -0
- package/lexicons/space/getLatestCommit.json +57 -0
- package/lexicons/space/getRecord.json +76 -0
- package/lexicons/space/getRepo.json +41 -0
- package/lexicons/space/getSpaceCredential.json +67 -0
- package/lexicons/space/listBlobs.json +59 -0
- package/lexicons/space/listRecords.json +108 -0
- package/lexicons/space/listRepoOps.json +111 -0
- package/lexicons/space/listRepos.json +75 -0
- package/lexicons/space/listSpaces.json +65 -0
- package/lexicons/space/notifySpaceDeleted.json +24 -0
- package/lexicons/space/notifyWrite.json +38 -0
- package/lexicons/space/putRecord.json +75 -0
- package/lexicons/space/registerNotify.json +49 -0
- package/lexicons/space/unregisterNotify.json +29 -0
- package/package.json +53 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operator-BErXCDow.js","names":["runnable: Check[]","skipped: FilteredCatalog[\"skipped\"]","json: unknown","error: string | undefined","baseChecks: Check[]","cborDecode","json: unknown","error: string | undefined","operatorChecks: Check[]"],"sources":["../src/model.ts","../src/registry.ts","../src/http.ts","../src/checks/base.ts","../src/dpop.ts","../src/car.ts","../src/checks/operator.ts"],"sourcesContent":["/**\n * The check model.\n *\n * A check is a black-box probe of a live spaces implementation: an async\n * function over a transport, plus machine-readable metadata that says what\n * it tests, on whose authority, and what it needs from the harness.\n *\n * Tiers, and why they matter: a conformance suite that fails\n * implementations on its author's opinions poisons its own authority.\n * Every `must` check cites specified behavior — a lexicon shape, a\n * declared error name, a requirement in the proposal or the upstream PDS\n * design spec. `should` checks encode reference-implementation behavior\n * the spec leaves open, and are calibrated by running this suite against\n * the reference: a `should` the reference fails is stale by definition.\n * `info` checks report implementation choices and never fail anyone.\n */\n\nexport type Tier = \"must\" | \"should\" | \"info\";\n\n/** Where a check's claim comes from. Every `must` check needs at least one. */\nexport interface Citation {\n\t/** e.g. \"lexicon\", \"proposal\", \"pds-design-spec\", \"reference\" */\n\tsource: \"lexicon\" | \"proposal\" | \"pds-design-spec\" | \"reference\";\n\t/**\n\t * Locator within the source: a lexicon id (optionally `#def` or\n\t * `@error:Name`), a proposal section anchor, or a design-spec heading.\n\t * Lexicon locators are machine-checked by the coverage generator.\n\t */\n\tref: string;\n}\n\n/**\n * What the harness must supply for a check to run. A runner skips (and\n * reports as \"not testable\") any check whose needs it cannot meet.\n *\n * - `operator`: an authenticated session on the target (any full-access\n * scheme; how it was obtained is the harness's business).\n * - `oauth-session`: specifically an OAuth-granted session with `space:`\n * scopes — only harnesses that can drive the target's consent flow.\n * - `identities`: harness-controlled DIDs with resolvable documents and\n * held keys, for playing reader/writer roles.\n * - `syncer-inbox`: an HTTPS endpoint the harness controls that the\n * target can deliver notifications to.\n * - `pds-blobs`: the target is a full PDS implementing\n * `com.atproto.repo.uploadBlob` and `com.atproto.sync.getBlob` — needed\n * to prove a space blob is not served publicly. A standalone space host,\n * or an isolated space-routes fixture, does not provide it.\n * - `pds-delegation`: the target implements\n * `com.atproto.space.getDelegationToken`, so the operator can obtain a\n * credential for its own space (the bulletin self-flow) with no\n * harness-held reader key. A space-routes fixture does not provide it.\n * - `alpha-libs`: the transport can execute the alpha crypto libraries\n * (`@atproto/space`), whose bundle pulls node-only dependencies. Real\n * checks never declare it — importing the full entry implies it — but\n * the browser catalog's metadata stubs do, so a browser harness (which\n * never declares it) reports them \"not testable here\" instead of\n * running a stub.\n */\nexport type Capability =\n\t| \"operator\"\n\t| \"oauth-session\"\n\t| \"identities\"\n\t| \"syncer-inbox\"\n\t| \"pds-blobs\"\n\t| \"pds-delegation\"\n\t| \"alpha-libs\";\n\nexport type CheckStatus =\n\t| \"pass\"\n\t| \"fail\"\n\t| \"skipped\" // capability not available, or filtered out\n\t| \"error\"; // the check itself broke; distinct from a failing target\n\nexport interface CheckResult {\n\tid: string;\n\ttier: Tier;\n\tstatus: CheckStatus;\n\t/** One line: what was observed, or why skipped/errored. */\n\tdetail: string;\n\tcitations: Citation[];\n\t/** Optional request/response evidence for the report. */\n\tevidence?: unknown;\n\tdurationMs?: number;\n}\n\n/** An identity the harness controls: a resolvable DID plus its keys. */\nexport interface HarnessIdentity {\n\tdid: string;\n\t/** Sign bytes with the identity's atproto signing key (ES256K/ES256). */\n\tsign(bytes: Uint8Array): Promise<Uint8Array>;\n\t/** JWT `alg` for {@link sign}. */\n\tjwtAlg: string;\n}\n\n/** A DPoP key the harness controls (always ES256, per the proposal). */\nexport interface DpopKey {\n\tbareJwk: Record<string, unknown>;\n\t/** Algorithms the key supports; `[\"ES256\"]` for DPoP. */\n\talgorithms: readonly string[];\n\t/** RFC 7638 thumbprint of {@link bareJwk}. */\n\tjkt: string;\n\tcreateJwt(\n\t\theader: Record<string, unknown>,\n\t\tpayload: Record<string, unknown>,\n\t): Promise<string>;\n}\n\nexport interface IdentityProvider {\n\t/** Mint (or reuse) a harness identity by role label. */\n\tidentity(role: string): Promise<HarnessIdentity>;\n\t/** Mint a fresh DPoP key. */\n\tdpopKey(): Promise<DpopKey>;\n}\n\nexport interface SyncerInbox {\n\t/** The service identifier to register (did, optionally with #fragment). */\n\tservice: string;\n\t/** Wait for a delivery matching the predicate, or time out (null). */\n\twaitFor(\n\t\tpredicate: (delivery: InboxDelivery) => boolean,\n\t\ttimeoutMs: number,\n\t): Promise<InboxDelivery | null>;\n}\n\nexport interface InboxDelivery {\n\tlxm: string;\n\tbody: unknown;\n\tauthorization?: string;\n\treceivedAt: number;\n}\n\n/** Description of the implementation under test. */\nexport interface Target {\n\t/** Public origin, e.g. https://pds.example.com */\n\torigin: string;\n\t/** The DID whose repos / spaces the target serves. */\n\tdid: string;\n\t/** Free-form implementation label for the report (\"cirrus\", \"reference\"). */\n\timplementation?: string;\n}\n\nexport interface CheckContext {\n\ttarget: Target;\n\tfetch: typeof fetch;\n\t/**\n\t * Present when the harness has an authenticated session on the target.\n\t * Provide `authorize` when auth is plain header injection (a bearer\n\t * token), or `fetch` when each request must be individually signed — a\n\t * DPoP-bound OAuth session, where the proof depends on the method and\n\t * URL, cannot be expressed as headers alone. At least one is required;\n\t * `fetch` wins when both are present.\n\t */\n\toperator?: {\n\t\t/** Add auth to a request (header injection). */\n\t\tauthorize?(init: RequestInit & { headers: Headers }): Promise<void>;\n\t\t/** A fetch that carries the operator's credentials on every request. */\n\t\tfetch?: typeof fetch;\n\t\t/** True when this session came from an OAuth grant with space: scopes. */\n\t\toauth: boolean;\n\t};\n\tidentities?: IdentityProvider;\n\tsyncerInbox?: SyncerInbox;\n\t/**\n\t * Scratch space shared across checks in one run — e.g. the probe space\n\t * a setup check created, reused by later checks. Keys are namespaced by\n\t * convention (`\"probe.space.uri\"`).\n\t */\n\tstate: Map<string, unknown>;\n\t/** Structured logging into the run report. */\n\tlog(message: string): void;\n}\n\nexport interface Check {\n\tid: string;\n\ttitle: string;\n\ttier: Tier;\n\tcitations: Citation[];\n\tneeds: Capability[];\n\t/** Creates or deletes state on the target (probe spaces, records). */\n\tdestructive?: boolean;\n\t/** Depends on real time passing (expiry windows); excluded by default. */\n\tslow?: boolean;\n\trun(ctx: CheckContext): Promise<CheckOutcome>;\n}\n\n/** What a check's run() returns; the runner wraps it into a CheckResult. */\nexport interface CheckOutcome {\n\tstatus: \"pass\" | \"fail\";\n\tdetail: string;\n\tevidence?: unknown;\n}\n\nexport const pass = (detail: string, evidence?: unknown): CheckOutcome => ({\n\tstatus: \"pass\",\n\tdetail,\n\t...(evidence !== undefined ? { evidence } : {}),\n});\n\nexport const fail = (detail: string, evidence?: unknown): CheckOutcome => ({\n\tstatus: \"fail\",\n\tdetail,\n\t...(evidence !== undefined ? { evidence } : {}),\n});\n","/**\n * The check registry: catalog definition, validation and filtering.\n */\n\nimport type { Capability, Check, Tier } from \"./model.js\";\n\n/**\n * Define a check, enforcing the catalog's structural rules at\n * registration time rather than in review:\n *\n * - ids are `area.slug`, unique within a catalog;\n * - a `must` check carries at least one citation to specified behavior —\n * without one it is someone's opinion and belongs in `should` or `info`.\n */\nexport function defineCheck(check: Check): Check {\n\tif (!/^[a-z0-9-]+\\.[a-z0-9-]+$/.test(check.id)) {\n\t\tthrow new Error(`Check id must be \"area.slug\" (kebab-case): ${check.id}`);\n\t}\n\tif (check.tier === \"must\" && check.citations.length === 0) {\n\t\tthrow new Error(\n\t\t\t`Check ${check.id} is tier \"must\" but cites nothing. Cite the lexicon, proposal or design spec — or demote it.`,\n\t\t);\n\t}\n\treturn check;\n}\n\nexport interface CatalogFilter {\n\ttiers?: Tier[];\n\t/** Capabilities the harness can provide. */\n\tcapabilities?: Capability[];\n\t/** Include checks that create/delete state on the target. */\n\tdestructive?: boolean;\n\t/** Include checks that wait out real expiry windows. */\n\tslow?: boolean;\n\t/** Restrict to areas (the part of the id before the dot). */\n\tareas?: string[];\n\tids?: string[];\n}\n\nexport interface FilteredCatalog {\n\trunnable: Check[];\n\t/** Checks excluded with the reason, for honest reporting. */\n\tskipped: Array<{ check: Check; reason: string }>;\n}\n\nexport function buildCatalog(checks: Check[]): Check[] {\n\tconst seen = new Set<string>();\n\tfor (const check of checks) {\n\t\tif (seen.has(check.id)) {\n\t\t\tthrow new Error(`Duplicate check id: ${check.id}`);\n\t\t}\n\t\tseen.add(check.id);\n\t}\n\treturn checks;\n}\n\n/**\n * Partition a catalog into runnable and skipped for a given harness. A\n * skipped check is part of the report — \"not testable here\" must never\n * silently read as \"conformant\".\n */\nexport function filterCatalog(\n\tcatalog: Check[],\n\tfilter: CatalogFilter,\n): FilteredCatalog {\n\tconst capabilities = new Set(filter.capabilities ?? []);\n\tconst runnable: Check[] = [];\n\tconst skipped: FilteredCatalog[\"skipped\"] = [];\n\n\t// Treat empty scoping arrays as \"unset\". An empty ids/areas/tiers list\n\t// otherwise matches nothing and yields a run of zero checks that reads\n\t// as clean — the exact silent-pass this suite must never produce.\n\tconst ids = filter.ids?.length ? filter.ids : undefined;\n\tconst areas = filter.areas?.length ? filter.areas : undefined;\n\tconst tiers = filter.tiers?.length ? filter.tiers : undefined;\n\n\tfor (const check of catalog) {\n\t\tif (ids && !ids.includes(check.id)) continue;\n\t\tconst area = check.id.split(\".\")[0]!;\n\t\tif (areas && !areas.includes(area)) continue;\n\t\tif (tiers && !tiers.includes(check.tier)) {\n\t\t\tskipped.push({ check, reason: `tier ${check.tier} excluded` });\n\t\t\tcontinue;\n\t\t}\n\t\tif (check.destructive && !filter.destructive) {\n\t\t\tskipped.push({ check, reason: \"destructive checks not enabled\" });\n\t\t\tcontinue;\n\t\t}\n\t\tif (check.slow && !filter.slow) {\n\t\t\tskipped.push({ check, reason: \"slow checks not enabled\" });\n\t\t\tcontinue;\n\t\t}\n\t\tconst missing = check.needs.filter((need) => !capabilities.has(need));\n\t\tif (missing.length > 0) {\n\t\t\tskipped.push({\n\t\t\t\tcheck,\n\t\t\t\treason: `missing capabilities: ${missing.join(\", \")}`,\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\trunnable.push(check);\n\t}\n\treturn { runnable, skipped };\n}\n","/**\n * Small HTTP helpers shared by checks. Every check talks to the target\n * over `ctx.fetch`, so a target is anything with a `fetch` — an in-process\n * Hono app, a live origin, or a mock.\n */\n\nimport type { CheckContext } from \"./model.js\";\n\nexport function xrpcUrl(\n\torigin: string,\n\tnsid: string,\n\tparams?: Record<string, string | undefined>,\n): string {\n\tconst url = new URL(`${origin}/xrpc/${nsid}`);\n\tfor (const [key, value] of Object.entries(params ?? {})) {\n\t\tif (value !== undefined) url.searchParams.set(key, value);\n\t}\n\treturn url.toString();\n}\n\nexport interface XrpcResult {\n\tstatus: number;\n\t/** Parsed JSON body, or undefined for non-JSON responses. */\n\tjson?: unknown;\n\t/** The atproto `error` name, when the body carries one. */\n\terror?: string;\n\theaders: Headers;\n\tresponse: Response;\n}\n\nasync function toResult(response: Response): Promise<XrpcResult> {\n\tconst contentType = response.headers.get(\"Content-Type\") ?? \"\";\n\tlet json: unknown;\n\tlet error: string | undefined;\n\tif (contentType.includes(\"application/json\")) {\n\t\tjson = await response\n\t\t\t.clone()\n\t\t\t.json()\n\t\t\t.catch(() => undefined);\n\t\tif (json && typeof json === \"object\" && \"error\" in json) {\n\t\t\terror = String((json as { error: unknown }).error);\n\t\t}\n\t}\n\treturn {\n\t\tstatus: response.status,\n\t\tjson,\n\t\terror,\n\t\theaders: response.headers,\n\t\tresponse,\n\t};\n}\n\n/** GET an XRPC query. `headers` may carry auth. */\nexport async function xrpcGet(\n\tctx: CheckContext,\n\tnsid: string,\n\tparams?: Record<string, string | undefined>,\n\theaders?: HeadersInit,\n): Promise<XrpcResult> {\n\tconst response = await ctx.fetch(xrpcUrl(ctx.target.origin, nsid, params), {\n\t\tmethod: \"GET\",\n\t\theaders,\n\t});\n\treturn toResult(response);\n}\n\n/** POST an XRPC procedure with a JSON body. */\nexport async function xrpcPost(\n\tctx: CheckContext,\n\tnsid: string,\n\tbody: unknown,\n\theaders?: HeadersInit,\n): Promise<XrpcResult> {\n\tconst merged = new Headers(headers);\n\tmerged.set(\"Content-Type\", \"application/json\");\n\tconst response = await ctx.fetch(xrpcUrl(ctx.target.origin, nsid), {\n\t\tmethod: \"POST\",\n\t\theaders: merged,\n\t\tbody: JSON.stringify(body),\n\t});\n\treturn toResult(response);\n}\n\n/** Add the operator's auth to a headers object, if a session is present. */\nexport async function operatorHeaders(\n\tctx: CheckContext,\n\textra?: HeadersInit,\n): Promise<Headers> {\n\tconst headers = new Headers(extra);\n\tif (ctx.operator?.authorize) {\n\t\tawait ctx.operator.authorize({ headers });\n\t}\n\treturn headers;\n}\n\n/**\n * A fetch that carries the operator's credentials: the operator's own\n * signing fetch when it has one (a DPoP-bound OAuth session must sign each\n * request individually), otherwise the transport fetch with\n * `authorize`-injected headers. With no operator at all it falls back to\n * the plain transport — the runner skips operator-needing checks then, so\n * that path is only reached by checks that can also run anonymously.\n */\nexport function operatorFetch(ctx: CheckContext): typeof fetch {\n\tconst operator = ctx.operator;\n\tif (!operator) return ctx.fetch;\n\tif (operator.fetch) return operator.fetch;\n\tconst baseFetch = ctx.fetch;\n\treturn async (input, init) => {\n\t\tconst headers = new Headers(init?.headers);\n\t\tawait operator.authorize?.({ ...init, headers });\n\t\treturn baseFetch(input, { ...init, headers });\n\t};\n}\n\n/**\n * The same context with the operator's credentials on `fetch`, so a check\n * can write `xrpcGet(asOperator(ctx), …)` for authenticated calls while\n * keeping the bare `ctx` for requests that must stay anonymous.\n */\nexport function asOperator(ctx: CheckContext): CheckContext {\n\treturn { ...ctx, fetch: operatorFetch(ctx) };\n}\n","/**\n * Browser-safe checks: discovery and unauthenticated request shapes.\n *\n * These need only `fetch` — no token minting, no @atproto/space — so they\n * run in any transport including a browser bundle. Everything crypto-bound\n * lives in `../checks/full-checks.ts` behind the `./full` entry.\n */\n\nimport { defineCheck } from \"../registry.js\";\nimport { xrpcGet, xrpcPost } from \"../http.js\";\nimport { pass, fail, type Check } from \"../model.js\";\n\nconst SPACE_HOST_FRAGMENT = \"#atproto_space_host\";\n\nconst discoveryServiceEntry = defineCheck({\n\tid: \"discovery.space-host-service\",\n\ttitle: \"DID document advertises the space host service endpoint\",\n\ttier: \"must\",\n\tcitations: [{ source: \"proposal\", ref: \"0016#space-authority\" }],\n\tneeds: [],\n\tasync run(ctx) {\n\t\tconst res = await ctx.fetch(`${ctx.target.origin}/.well-known/did.json`);\n\t\tif (!res.ok) return fail(`did.json returned ${res.status}`);\n\t\tconst doc = (await res.json()) as {\n\t\t\tservice?: Array<{ id: string; type: string; serviceEndpoint: unknown }>;\n\t\t};\n\t\tconst entry = (doc.service ?? []).find((s) =>\n\t\t\ts.id.endsWith(SPACE_HOST_FRAGMENT),\n\t\t);\n\t\tif (!entry) {\n\t\t\treturn fail(\"no #atproto_space_host service entry\", doc.service);\n\t\t}\n\t\treturn pass(`serviceEndpoint ${String(entry.serviceEndpoint)}`, entry);\n\t},\n});\n\nconst discoveryVerificationKey = defineCheck({\n\tid: \"discovery.verification-key\",\n\ttitle: \"DID document exposes an atproto verification key\",\n\ttier: \"must\",\n\tcitations: [{ source: \"proposal\", ref: \"0016#space-authority\" }],\n\tneeds: [],\n\tasync run(ctx) {\n\t\tconst res = await ctx.fetch(`${ctx.target.origin}/.well-known/did.json`);\n\t\tif (!res.ok) return fail(`did.json returned ${res.status}`);\n\t\tconst doc = (await res.json()) as {\n\t\t\tverificationMethod?: Array<{ id: string }>;\n\t\t};\n\t\t// The proposal falls back to #atproto when #atproto_space is absent,\n\t\t// so at minimum #atproto must be present to verify space tokens.\n\t\tconst hasAtproto = (doc.verificationMethod ?? []).some((m) =>\n\t\t\tm.id.endsWith(\"#atproto\"),\n\t\t);\n\t\treturn hasAtproto\n\t\t\t? pass(\"#atproto verification method present\")\n\t\t\t: fail(\"no #atproto verification method\", doc.verificationMethod);\n\t},\n});\n\nconst authGetRecordRequiresAuth = defineCheck({\n\tid: \"auth.getrecord-unauthenticated-refused\",\n\ttitle: \"space.getRecord refuses an unauthenticated request\",\n\ttier: \"must\",\n\tcitations: [{ source: \"lexicon\", ref: \"com.atproto.space.getRecord\" }],\n\tneeds: [],\n\tasync run(ctx) {\n\t\t// A read with no credential and no session must be refused on the\n\t\t// authentication perimeter — a conformant host checks auth before it\n\t\t// checks whether the record exists. Only 401/403 proves that: a 404\n\t\t// would also be returned by a host that serves reads with no auth at\n\t\t// all (there's simply no record at this probe URI to leak), and a 5xx\n\t\t// is a server fault, not a refusal — neither demonstrates enforcement.\n\t\tconst res = await xrpcGet(ctx, \"com.atproto.space.getRecord\", {\n\t\t\tspace: `at://${ctx.target.did}/space/app.bsky.group/probe`,\n\t\t\trepo: ctx.target.did,\n\t\t\tcollection: \"app.bsky.feed.post\",\n\t\t\trkey: \"whatever\",\n\t\t});\n\t\tif (res.status === 401 || res.status === 403) {\n\t\t\treturn pass(`refused with ${res.status}`);\n\t\t}\n\t\treturn fail(\n\t\t\t`unauthenticated read was not refused with 401/403 (got ${res.status} ${res.error ?? \"\"})`,\n\t\t\tres.json,\n\t\t);\n\t},\n});\n\nconst authCredentialRequiresToken = defineCheck({\n\tid: \"auth.getspacecredential-untoken-refused\",\n\ttitle: \"space.getSpaceCredential refuses a request with no delegation token\",\n\ttier: \"must\",\n\tcitations: [\n\t\t{ source: \"lexicon\", ref: \"com.atproto.space.getSpaceCredential\" },\n\t],\n\tneeds: [],\n\tasync run(ctx) {\n\t\tconst res = await xrpcPost(ctx, \"com.atproto.space.getSpaceCredential\", {\n\t\t\tspace: `at://${ctx.target.did}/space/app.bsky.group/probe`,\n\t\t});\n\t\tif (res.status === 401 || res.status === 403 || res.status === 400) {\n\t\t\treturn pass(`refused with ${res.status} ${res.error ?? \"\"}`);\n\t\t}\n\t\treturn fail(\n\t\t\t`unexpected ${res.status} for a tokenless credential request`,\n\t\t\tres.json,\n\t\t);\n\t},\n});\n\nconst requestInvalidSpaceUri = defineCheck({\n\tid: \"request.invalid-space-uri-rejected\",\n\ttitle: \"A malformed space reference is rejected, not misread\",\n\ttier: \"must\",\n\tcitations: [{ source: \"lexicon\", ref: \"com.atproto.space.getLatestCommit\" }],\n\tneeds: [],\n\tasync run(ctx) {\n\t\tconst res = await xrpcGet(ctx, \"com.atproto.space.getLatestCommit\", {\n\t\t\tspace: \"not-a-space-uri\",\n\t\t\trepo: ctx.target.did,\n\t\t});\n\t\tif (res.status >= 400 && res.status < 500) {\n\t\t\treturn pass(`rejected with ${res.status} ${res.error ?? \"\"}`);\n\t\t}\n\t\treturn fail(\n\t\t\t`did not reject a malformed space uri (${res.status})`,\n\t\t\tres.json,\n\t\t);\n\t},\n});\n\n/** Checks that need no crypto and no session — safe in any transport. */\nexport const baseChecks: Check[] = [\n\tdiscoveryServiceEntry,\n\tdiscoveryVerificationKey,\n\tauthGetRecordRequiresAuth,\n\tauthCredentialRequiresToken,\n\trequestInvalidSpaceUri,\n];\n","/**\n * Browser-safe DPoP: WebCrypto ES256 keys and RFC 9449 proofs.\n *\n * This is deliberately dependency-free so the checks that only need a\n * DPoP-bound credential exchange — the operator's own delegation →\n * credential → read flow — can run in a browser bundle. The proof format\n * mirrors `@atproto/space`'s `createDpopProof` exactly (same claims, same\n * htu normalization, same `ath` hash), which the fixture adapters and the\n * reference matrix verify end-to-end: a proof the servers reject fails\n * those runs loudly.\n */\n\nimport type { DpopKey } from \"./model.js\";\n\nfunction b64url(bytes: Uint8Array): string {\n\tlet bin = \"\";\n\tfor (const b of bytes) bin += String.fromCharCode(b);\n\treturn btoa(bin).replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/, \"\");\n}\n\n/**\n * WebCrypto ES256 DPoP key implementing the minimal surface a DPoP proof\n * needs (`bareJwk`, `algorithms`, `createJwt`) plus the RFC 7638\n * thumbprint. Hand-rolled to avoid `@atproto/jwk-jose`, whose bundled jose\n * resolves to its Node build under the workers test pool and cannot sign.\n */\nexport async function createDpopKey(): Promise<DpopKey> {\n\tconst pair = await crypto.subtle.generateKey(\n\t\t{ name: \"ECDSA\", namedCurve: \"P-256\" },\n\t\ttrue,\n\t\t[\"sign\"],\n\t);\n\tconst jwk = await crypto.subtle.exportKey(\"jwk\", pair.publicKey);\n\t// Canonical JWK for an EC key, RFC 7638 member order.\n\tconst bareJwk = { crv: jwk.crv, kty: jwk.kty, x: jwk.x, y: jwk.y } as Record<\n\t\tstring,\n\t\tunknown\n\t>;\n\tconst thumbInput = new TextEncoder().encode(JSON.stringify(bareJwk));\n\tconst jkt = b64url(\n\t\tnew Uint8Array(await crypto.subtle.digest(\"SHA-256\", thumbInput)),\n\t);\n\tconst encode = (obj: unknown) =>\n\t\tb64url(new TextEncoder().encode(JSON.stringify(obj)));\n\treturn {\n\t\tbareJwk,\n\t\talgorithms: [\"ES256\"],\n\t\tjkt,\n\t\tasync createJwt(header, payload) {\n\t\t\tconst input = `${encode(header)}.${encode(payload)}`;\n\t\t\tconst sig = new Uint8Array(\n\t\t\t\tawait crypto.subtle.sign(\n\t\t\t\t\t{ name: \"ECDSA\", hash: \"SHA-256\" },\n\t\t\t\t\tpair.privateKey,\n\t\t\t\t\tnew TextEncoder().encode(input),\n\t\t\t\t),\n\t\t\t);\n\t\t\treturn `${input}.${b64url(sig)}`;\n\t\t},\n\t};\n}\n\n/**\n * An RFC 9449 DPoP proof over `key`, matching the reference verifier:\n * header `{alg, typ: \"dpop+jwt\", jwk}`; claims `jti` (random), `htm`,\n * `htu` (query and fragment stripped, RFC 9449 §4.2), `iat`, and — only\n * when presenting a credential — `ath`, the base64url SHA-256 of it.\n */\nexport async function createDpopProofJwt(\n\tkey: DpopKey,\n\topts: { htm: string; htu: string; credential?: string },\n): Promise<string> {\n\tconst htuUrl = new URL(opts.htu);\n\tconst jti = b64url(crypto.getRandomValues(new Uint8Array(16)));\n\tconst ath =\n\t\topts.credential !== undefined\n\t\t\t? b64url(\n\t\t\t\t\tnew Uint8Array(\n\t\t\t\t\t\tawait crypto.subtle.digest(\n\t\t\t\t\t\t\t\"SHA-256\",\n\t\t\t\t\t\t\tnew TextEncoder().encode(opts.credential),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t: undefined;\n\treturn key.createJwt(\n\t\t{ alg: \"ES256\", typ: \"dpop+jwt\", jwk: key.bareJwk },\n\t\t{\n\t\t\tjti,\n\t\t\thtm: opts.htm,\n\t\t\thtu: htuUrl.origin + htuUrl.pathname,\n\t\t\t...(ath !== undefined ? { ath } : {}),\n\t\t\tiat: Math.floor(Date.now() / 1000),\n\t\t},\n\t);\n}\n","/**\n * Just enough CARv1 reading to assert getRepo's declared shape: the\n * lexicon requires exactly two roots (the signed commit, then the index).\n * Reading the header needs only a varint and a dag-cbor decode — no CAR\n * library, no node streams — so it stays runnable anywhere the full entry\n * runs.\n */\n\nimport { decode as cborDecode } from \"@atproto/lex-cbor\";\n\nfunction readVarint(bytes: Uint8Array, offset: number): [number, number] {\n\tlet result = 0;\n\tlet shift = 0;\n\tlet pos = offset;\n\tfor (;;) {\n\t\tconst byte = bytes[pos];\n\t\tif (byte === undefined) throw new Error(\"truncated varint\");\n\t\tresult |= (byte & 0x7f) << shift;\n\t\tpos += 1;\n\t\tif ((byte & 0x80) === 0) break;\n\t\tshift += 7;\n\t}\n\treturn [result, pos];\n}\n\ninterface CarHeaderInfo {\n\tversion: number;\n\trootCount: number;\n}\n\n/** Parse just the CARv1 header block and report its version and root count. */\nexport function readCarHeader(bytes: Uint8Array): CarHeaderInfo {\n\tconst [headerLen, afterVarint] = readVarint(bytes, 0);\n\tconst headerBytes = bytes.subarray(afterVarint, afterVarint + headerLen);\n\tconst header = cborDecode(headerBytes) as {\n\t\tversion?: number;\n\t\troots?: unknown[];\n\t};\n\treturn {\n\t\tversion: header.version ?? 0,\n\t\trootCount: Array.isArray(header.roots) ? header.roots.length : 0,\n\t};\n}\n","/**\n * Operator checks: everything an authenticated session can prove with the\n * platform's own `fetch` and WebCrypto — no alpha crypto libs, no foreign\n * identities. They run wherever the base checks run, browsers included, as\n * long as the harness supplies an `operator` capability (and, for the\n * blob and credential checks, `pds-blobs` / `pds-delegation`).\n *\n * The split matters: checks live here or in `../full/checks.js` by what\n * they *actually import*, not by topic. A check that only makes authed\n * XRPC calls belongs here even if its subject is credentials — the\n * operator's own delegation → credential → read flow needs nothing but an\n * ES256 JWT the browser can mint.\n */\n\nimport { defineCheck } from \"../registry.js\";\nimport {\n\tasOperator,\n\toperatorFetch,\n\txrpcGet,\n\txrpcPost,\n\ttype XrpcResult,\n} from \"../http.js\";\nimport {\n\tfail,\n\tpass,\n\ttype Check,\n\ttype CheckContext,\n\ttype DpopKey,\n} from \"../model.js\";\nimport { createDpopKey, createDpopProofJwt } from \"../dpop.js\";\nimport { readCarHeader } from \"../car.js\";\n\n// A collection with no loaded lexicon, so record validation is\n// optimistic (fail-open) on any conformant target — the checks probe\n// space behaviour, not Bluesky schema validation.\nexport const POST = \"test.conformance.note\";\nexport const note = (text: string) => ({ $type: POST, text });\n\nconst PROBE_TYPE = \"app.bsky.group\";\n\nexport interface ProbeSpace {\n\turi: string;\n\ttype: string;\n\tskey: string;\n}\n\n/** A run-unique skey so probe spaces never collide with real ones. */\nfunction probeSkey(): string {\n\tconst rand = crypto.getRandomValues(new Uint8Array(8));\n\treturn `probe${Array.from(rand, (b) => b.toString(36))\n\t\t.join(\"\")\n\t\t.slice(0, 10)}`;\n}\n\n/**\n * Create a probe space owned by the target and cache it for the run.\n * Requires an operator session with space management authority.\n */\nexport async function createProbeSpace(\n\tctx: CheckContext,\n\tpolicy: Record<string, unknown> = {\n\t\t$type: \"com.atproto.simplespace.defs#memberListPolicy\",\n\t},\n\tappAccess: Record<string, unknown> = {\n\t\t$type: \"com.atproto.simplespace.defs#open\",\n\t},\n): Promise<ProbeSpace> {\n\tconst skey = probeSkey();\n\tconst res = await xrpcPost(\n\t\tasOperator(ctx),\n\t\t\"com.atproto.simplespace.createSpace\",\n\t\t{\n\t\t\ttype: PROBE_TYPE,\n\t\t\tskey,\n\t\t\tpolicy,\n\t\t\tappAccess,\n\t\t},\n\t);\n\tif (res.status !== 200) {\n\t\tthrow new Error(\n\t\t\t`createSpace failed: ${res.status} ${res.error ?? \"\"} ${JSON.stringify(res.json)}`,\n\t\t);\n\t}\n\tconst uri = (res.json as { uri: string }).uri;\n\treturn { uri, type: PROBE_TYPE, skey };\n}\n\n/** Delete a probe space, best-effort (cleanup). */\nexport async function deleteProbeSpace(\n\tctx: CheckContext,\n\tspace: string,\n): Promise<void> {\n\tawait xrpcPost(asOperator(ctx), \"com.atproto.simplespace.deleteSpace\", {\n\t\tspace,\n\t}).catch(() => {});\n}\n\n/** Operator creates a record in a space; returns the response. */\nexport async function operatorCreateRecord(\n\tctx: CheckContext,\n\tspace: string,\n\tcollection: string,\n\trkey: string,\n\trecord: Record<string, unknown>,\n): Promise<XrpcResult> {\n\treturn xrpcPost(asOperator(ctx), \"com.atproto.space.createRecord\", {\n\t\tspace,\n\t\trepo: ctx.target.did,\n\t\tcollection,\n\t\trkey,\n\t\trecord,\n\t});\n}\n\nexport interface Credential {\n\tcredential: string;\n\tdpopKey: DpopKey;\n}\n\n/**\n * Obtain a credential the way a real app does: ask the target's own\n * `getDelegationToken` (with the operator session) for a delegation token,\n * then exchange it at `getSpaceCredential`. This is the bulletin self-flow\n * — it needs no harness-held reader key, so it runs against any real PDS\n * (Cirrus, the reference) and exercises the target's own token minting.\n */\nexport async function obtainCredentialViaDelegation(\n\tctx: CheckContext,\n\tspace: string,\n): Promise<{\n\tresult: XrpcResult;\n\tcredential?: Credential;\n\tdelegation: XrpcResult;\n}> {\n\tconst delegation = await xrpcGet(\n\t\tasOperator(ctx),\n\t\t\"com.atproto.space.getDelegationToken\",\n\t\t{ space },\n\t);\n\tif (delegation.status !== 200) {\n\t\treturn { result: delegation, delegation };\n\t}\n\tconst token = (delegation.json as { token: string }).token;\n\t// The DPoP key is transport-owned (any ES256 key), not tied to a harness\n\t// identity — so this flow needs no identity provider.\n\tconst dpopKey = await createDpopKey();\n\tconst proof = await createDpopProofJwt(dpopKey, {\n\t\thtm: \"POST\",\n\t\thtu: `${ctx.target.origin}/xrpc/com.atproto.space.getSpaceCredential`,\n\t});\n\tconst result = await xrpcPost(\n\t\tctx,\n\t\t\"com.atproto.space.getSpaceCredential\",\n\t\t{ space },\n\t\t{ Authorization: `Bearer ${token}`, DPoP: proof },\n\t);\n\tif (result.status === 200) {\n\t\tconst credential = (result.json as { credential: string }).credential;\n\t\treturn { result, credential: { credential, dpopKey }, delegation };\n\t}\n\treturn { result, delegation };\n}\n\n/** A credential-authenticated GET, with a fresh proof bound to the request. */\nexport async function credentialGet(\n\tctx: CheckContext,\n\tcredential: Credential,\n\tnsid: string,\n\tparams: Record<string, string | undefined>,\n): Promise<XrpcResult> {\n\tconst url = new URL(`${ctx.target.origin}/xrpc/${nsid}`);\n\tfor (const [key, value] of Object.entries(params)) {\n\t\tif (value !== undefined) url.searchParams.set(key, value);\n\t}\n\tconst proof = await createDpopProofJwt(credential.dpopKey, {\n\t\thtm: \"GET\",\n\t\thtu: `${ctx.target.origin}/xrpc/${nsid}`,\n\t\tcredential: credential.credential,\n\t});\n\tconst response = await ctx.fetch(url.toString(), {\n\t\tmethod: \"GET\",\n\t\theaders: {\n\t\t\tAuthorization: `DPoP ${credential.credential}`,\n\t\t\tDPoP: proof,\n\t\t},\n\t});\n\tconst contentType = response.headers.get(\"Content-Type\") ?? \"\";\n\tlet json: unknown;\n\tlet error: string | undefined;\n\tif (contentType.includes(\"application/json\")) {\n\t\tjson = await response\n\t\t\t.clone()\n\t\t\t.json()\n\t\t\t.catch(() => undefined);\n\t\tif (json && typeof json === \"object\" && \"error\" in json) {\n\t\t\terror = String((json as { error: unknown }).error);\n\t\t}\n\t}\n\treturn {\n\t\tstatus: response.status,\n\t\tjson,\n\t\terror,\n\t\theaders: response.headers,\n\t\tresponse,\n\t};\n}\n\n// --- writes -----------------------------------------------------------\n\nconst writesCreateRead = defineCheck({\n\tid: \"writes.create-and-read\",\n\ttitle: \"Operator creates a record and reads it back\",\n\ttier: \"must\",\n\tcitations: [\n\t\t{ source: \"lexicon\", ref: \"com.atproto.space.createRecord\" },\n\t\t{ source: \"lexicon\", ref: \"com.atproto.space.getRecord\" },\n\t],\n\tneeds: [\"operator\"],\n\tdestructive: true,\n\tasync run(ctx) {\n\t\tconst space = await createProbeSpace(ctx);\n\t\ttry {\n\t\t\tconst created = await operatorCreateRecord(\n\t\t\t\tctx,\n\t\t\t\tspace.uri,\n\t\t\t\tPOST,\n\t\t\t\t\"rec1\",\n\t\t\t\tnote(\"hello\"),\n\t\t\t);\n\t\t\tif (created.status !== 200) {\n\t\t\t\treturn fail(\n\t\t\t\t\t`createRecord ${created.status} ${created.error ?? \"\"}`,\n\t\t\t\t\tcreated.json,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst read = await xrpcGet(\n\t\t\t\tasOperator(ctx),\n\t\t\t\t\"com.atproto.space.getRecord\",\n\t\t\t\t{\n\t\t\t\t\tspace: space.uri,\n\t\t\t\t\trepo: ctx.target.did,\n\t\t\t\t\tcollection: POST,\n\t\t\t\t\trkey: \"rec1\",\n\t\t\t\t},\n\t\t\t);\n\t\t\tif (read.status !== 200) {\n\t\t\t\treturn fail(`getRecord ${read.status} ${read.error ?? \"\"}`, read.json);\n\t\t\t}\n\t\t\tconst value = (read.json as { value?: { text?: string } }).value;\n\t\t\treturn value?.text === \"hello\"\n\t\t\t\t? pass(\"round-tripped the record value\")\n\t\t\t\t: fail(\"record value did not round-trip\", read.json);\n\t\t} finally {\n\t\t\tawait deleteProbeSpace(ctx, space.uri);\n\t\t}\n\t},\n});\n\nconst writesUnauthReadRefused = defineCheck({\n\tid: \"auth.existing-record-unauth-refused\",\n\ttitle: \"An existing space record is not readable without auth\",\n\ttier: \"must\",\n\tcitations: [{ source: \"lexicon\", ref: \"com.atproto.space.getRecord\" }],\n\tneeds: [\"operator\"],\n\tdestructive: true,\n\tasync run(ctx) {\n\t\t// The browser-safe auth.getrecord-unauthenticated-refused can only\n\t\t// probe a *nonexistent* space (it has no operator to create one), so on\n\t\t// its own it cannot distinguish a host that enforces auth from one that\n\t\t// 401s missing spaces but serves existing records to anyone. This is\n\t\t// the other half: put a real record there, then read it with no\n\t\t// credentials at all.\n\t\tconst space = await createProbeSpace(ctx);\n\t\ttry {\n\t\t\tconst created = await operatorCreateRecord(\n\t\t\t\tctx,\n\t\t\t\tspace.uri,\n\t\t\t\tPOST,\n\t\t\t\t\"private\",\n\t\t\t\tnote(\"not for you\"),\n\t\t\t);\n\t\t\tif (created.status !== 200) {\n\t\t\t\treturn fail(\n\t\t\t\t\t`createRecord ${created.status} ${created.error ?? \"\"}; cannot probe the unauth read`,\n\t\t\t\t\tcreated.json,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst res = await xrpcGet(ctx, \"com.atproto.space.getRecord\", {\n\t\t\t\tspace: space.uri,\n\t\t\t\trepo: ctx.target.did,\n\t\t\t\tcollection: POST,\n\t\t\t\trkey: \"private\",\n\t\t\t});\n\t\t\tif (res.status === 200) {\n\t\t\t\treturn fail(\n\t\t\t\t\t\"an existing space record was served with no auth\",\n\t\t\t\t\tres.json,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn res.status === 401 || res.status === 403\n\t\t\t\t? pass(`unauthenticated read of a real record refused (${res.status})`)\n\t\t\t\t: fail(\n\t\t\t\t\t\t`refused, but with ${res.status} ${res.error ?? \"\"} rather than 401/403`,\n\t\t\t\t\t\tres.json,\n\t\t\t\t\t);\n\t\t} finally {\n\t\t\tawait deleteProbeSpace(ctx, space.uri);\n\t\t}\n\t},\n});\n\nconst writesDuplicate = defineCheck({\n\tid: \"writes.duplicate-rejected\",\n\ttitle: \"A second create at the same key is refused with RecordAlreadyExists\",\n\ttier: \"must\",\n\tcitations: [\n\t\t{\n\t\t\tsource: \"lexicon\",\n\t\t\tref: \"com.atproto.space.createRecord@error:RecordAlreadyExists\",\n\t\t},\n\t],\n\tneeds: [\"operator\"],\n\tdestructive: true,\n\tasync run(ctx) {\n\t\tconst space = await createProbeSpace(ctx);\n\t\ttry {\n\t\t\tconst first = await operatorCreateRecord(\n\t\t\t\tctx,\n\t\t\t\tspace.uri,\n\t\t\t\tPOST,\n\t\t\t\t\"dup\",\n\t\t\t\tnote(\"one\"),\n\t\t\t);\n\t\t\tif (first.status !== 200) {\n\t\t\t\treturn fail(\n\t\t\t\t\t`first create failed (${first.status}); cannot test duplicates`,\n\t\t\t\t\tfirst.json,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst second = await operatorCreateRecord(\n\t\t\t\tctx,\n\t\t\t\tspace.uri,\n\t\t\t\tPOST,\n\t\t\t\t\"dup\",\n\t\t\t\tnote(\"two\"),\n\t\t\t);\n\t\t\tif (second.status === 200) return fail(\"duplicate create returned 200\");\n\t\t\treturn second.error === \"RecordAlreadyExists\"\n\t\t\t\t? pass(\"refused with RecordAlreadyExists\")\n\t\t\t\t: fail(\n\t\t\t\t\t\t`refused but error was ${second.error} (${second.status})`,\n\t\t\t\t\t\tsecond.json,\n\t\t\t\t\t);\n\t\t} finally {\n\t\t\tawait deleteProbeSpace(ctx, space.uri);\n\t\t}\n\t},\n});\n\nconst writesDeleteIdempotent = defineCheck({\n\tid: \"writes.delete-idempotent\",\n\ttitle: \"deleteRecord removes the record and is idempotent\",\n\ttier: \"must\",\n\tcitations: [\n\t\t{ source: \"lexicon\", ref: \"com.atproto.space.deleteRecord\" },\n\t\t{ source: \"lexicon\", ref: \"com.atproto.space.getRecord\" },\n\t],\n\tneeds: [\"operator\"],\n\tdestructive: true,\n\tasync run(ctx) {\n\t\tconst space = await createProbeSpace(ctx);\n\t\ttry {\n\t\t\tconst del = (rkey: string) =>\n\t\t\t\txrpcPost(asOperator(ctx), \"com.atproto.space.deleteRecord\", {\n\t\t\t\t\tspace: space.uri,\n\t\t\t\t\trepo: ctx.target.did,\n\t\t\t\t\tcollection: POST,\n\t\t\t\t\trkey,\n\t\t\t\t});\n\n\t\t\t// Effect first: a delete must actually remove the record. Without\n\t\t\t// this, a deleteRecord that is a complete no-op (200, nothing\n\t\t\t// happens) would pass on idempotency alone.\n\t\t\tconst created = await operatorCreateRecord(\n\t\t\t\tctx,\n\t\t\t\tspace.uri,\n\t\t\t\tPOST,\n\t\t\t\t\"doomed\",\n\t\t\t\tnote(\"bye\"),\n\t\t\t);\n\t\t\tif (created.status !== 200) {\n\t\t\t\treturn fail(\n\t\t\t\t\t`createRecord ${created.status} ${created.error ?? \"\"}; cannot test deletion`,\n\t\t\t\t\tcreated.json,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst removed = await del(\"doomed\");\n\t\t\tif (removed.status !== 200) {\n\t\t\t\treturn fail(\n\t\t\t\t\t`delete of an existing record returned ${removed.status} ${removed.error ?? \"\"}`,\n\t\t\t\t\tremoved.json,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst after = await xrpcGet(\n\t\t\t\tasOperator(ctx),\n\t\t\t\t\"com.atproto.space.getRecord\",\n\t\t\t\t{\n\t\t\t\t\tspace: space.uri,\n\t\t\t\t\trepo: ctx.target.did,\n\t\t\t\t\tcollection: POST,\n\t\t\t\t\trkey: \"doomed\",\n\t\t\t\t},\n\t\t\t);\n\t\t\tif (after.status === 200) {\n\t\t\t\treturn fail(\"a deleted record was still readable\", after.json);\n\t\t\t}\n\n\t\t\t// Then idempotency: deleting it again (and deleting a key that\n\t\t\t// never existed) both succeed.\n\t\t\tconst again = await del(\"doomed\");\n\t\t\tconst ghost = await del(\"ghost\");\n\t\t\tif (again.status !== 200 || ghost.status !== 200) {\n\t\t\t\treturn fail(\n\t\t\t\t\t`repeat delete returned ${again.status}, absent-key delete returned ${ghost.status}`,\n\t\t\t\t\t{ again: again.json, ghost: ghost.json },\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn pass(\"delete removed the record; repeat and absent deletes 200\");\n\t\t} finally {\n\t\t\tawait deleteProbeSpace(ctx, space.uri);\n\t\t}\n\t},\n});\n\nconst writesApplyWritesAtomic = defineCheck({\n\tid: \"writes.applywrites-atomic\",\n\ttitle: \"A failing applyWrites batch commits nothing\",\n\ttier: \"must\",\n\tcitations: [\n\t\t{ source: \"lexicon\", ref: \"com.atproto.space.applyWrites\" },\n\t\t{\n\t\t\tsource: \"lexicon\",\n\t\t\tref: \"com.atproto.space.applyWrites@error:RecordAlreadyExists\",\n\t\t},\n\t],\n\tneeds: [\"operator\"],\n\tdestructive: true,\n\tasync run(ctx) {\n\t\tconst space = await createProbeSpace(ctx);\n\t\tconst op = asOperator(ctx);\n\t\ttry {\n\t\t\tawait operatorCreateRecord(ctx, space.uri, POST, \"exists\", note(\"here\"));\n\n\t\t\t// Positive control: a non-colliding batch must commit both ops.\n\t\t\t// Without this, a target that has no applyWrites at all (404s the\n\t\t\t// method) would pass the rollback assertion below vacuously.\n\t\t\tconst ok = await xrpcPost(op, \"com.atproto.space.applyWrites\", {\n\t\t\t\tspace: space.uri,\n\t\t\t\trepo: ctx.target.did,\n\t\t\t\twrites: [\n\t\t\t\t\t{\n\t\t\t\t\t\t$type: \"com.atproto.space.applyWrites#create\",\n\t\t\t\t\t\tcollection: POST,\n\t\t\t\t\t\trkey: \"ok1\",\n\t\t\t\t\t\tvalue: note(\"1\"),\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t$type: \"com.atproto.space.applyWrites#create\",\n\t\t\t\t\t\tcollection: POST,\n\t\t\t\t\t\trkey: \"ok2\",\n\t\t\t\t\t\tvalue: note(\"2\"),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t});\n\t\t\tif (ok.status !== 200) {\n\t\t\t\treturn fail(\n\t\t\t\t\t`applyWrites did not accept a valid batch (${ok.status} ${ok.error ?? \"\"})`,\n\t\t\t\t\tok.json,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// A batch whose second op collides must fail with\n\t\t\t// RecordAlreadyExists and roll the first op back.\n\t\t\tconst batch = await xrpcPost(op, \"com.atproto.space.applyWrites\", {\n\t\t\t\tspace: space.uri,\n\t\t\t\trepo: ctx.target.did,\n\t\t\t\twrites: [\n\t\t\t\t\t{\n\t\t\t\t\t\t$type: \"com.atproto.space.applyWrites#create\",\n\t\t\t\t\t\tcollection: POST,\n\t\t\t\t\t\trkey: \"fresh\",\n\t\t\t\t\t\tvalue: note(\"new\"),\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t$type: \"com.atproto.space.applyWrites#create\",\n\t\t\t\t\t\tcollection: POST,\n\t\t\t\t\t\trkey: \"exists\",\n\t\t\t\t\t\tvalue: note(\"collide\"),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t});\n\t\t\tif (batch.status === 200) return fail(\"colliding batch returned 200\");\n\t\t\tif (batch.error !== \"RecordAlreadyExists\") {\n\t\t\t\treturn fail(\n\t\t\t\t\t`colliding batch refused with ${batch.error} (${batch.status}), expected RecordAlreadyExists`,\n\t\t\t\t\tbatch.json,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst check = await xrpcGet(op, \"com.atproto.space.getRecord\", {\n\t\t\t\tspace: space.uri,\n\t\t\t\trepo: ctx.target.did,\n\t\t\t\tcollection: POST,\n\t\t\t\trkey: \"fresh\",\n\t\t\t});\n\t\t\treturn check.status !== 200\n\t\t\t\t? pass(\"a failed batch committed nothing\")\n\t\t\t\t: fail(\"a failed batch left its first op committed\", check.json);\n\t\t} finally {\n\t\t\tawait deleteProbeSpace(ctx, space.uri);\n\t\t}\n\t},\n});\n\n// --- credential (self-flow) -------------------------------------------\n\nconst credentialSelfRoundTrip = defineCheck({\n\tid: \"credential.self-round-trip\",\n\ttitle:\n\t\t\"Operator obtains a credential for its own space via getDelegationToken and reads\",\n\ttier: \"must\",\n\tcitations: [\n\t\t{ source: \"lexicon\", ref: \"com.atproto.space.getDelegationToken\" },\n\t\t{ source: \"lexicon\", ref: \"com.atproto.space.getSpaceCredential\" },\n\t\t{ source: \"lexicon\", ref: \"com.atproto.space.getRecord\" },\n\t],\n\t// Needs the target's own getDelegationToken (pds-delegation) plus an\n\t// operator session. No harness identity — the operator is its own\n\t// reader — so this runs against any real PDS, unlike credential.round-trip.\n\tneeds: [\"operator\", \"pds-delegation\"],\n\tdestructive: true,\n\tasync run(ctx) {\n\t\tconst space = await createProbeSpace(ctx, {\n\t\t\t$type: \"com.atproto.simplespace.defs#publicPolicy\",\n\t\t});\n\t\ttry {\n\t\t\tawait operatorCreateRecord(ctx, space.uri, POST, \"self\", note(\"mine\"));\n\t\t\tconst { result, credential, delegation } =\n\t\t\t\tawait obtainCredentialViaDelegation(ctx, space.uri);\n\t\t\tif (delegation.status !== 200) {\n\t\t\t\treturn fail(\n\t\t\t\t\t`getDelegationToken ${delegation.status} ${delegation.error ?? \"\"}`,\n\t\t\t\t\tdelegation.json,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (!credential) {\n\t\t\t\treturn fail(\n\t\t\t\t\t`getSpaceCredential ${result.status} ${result.error ?? \"\"}`,\n\t\t\t\t\tresult.json,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst read = await credentialGet(\n\t\t\t\tctx,\n\t\t\t\tcredential,\n\t\t\t\t\"com.atproto.space.getRecord\",\n\t\t\t\t{\n\t\t\t\t\tspace: space.uri,\n\t\t\t\t\trepo: ctx.target.did,\n\t\t\t\t\tcollection: POST,\n\t\t\t\t\trkey: \"self\",\n\t\t\t\t},\n\t\t\t);\n\t\t\treturn read.status === 200\n\t\t\t\t? pass(\"delegation → credential → read round-trip works\")\n\t\t\t\t: fail(\n\t\t\t\t\t\t`credential read failed: ${read.status} ${read.error ?? \"\"}`,\n\t\t\t\t\t\tread.json,\n\t\t\t\t\t);\n\t\t} finally {\n\t\t\tawait deleteProbeSpace(ctx, space.uri);\n\t\t}\n\t},\n});\n\n// --- sync --------------------------------------------------------------\n\nconst syncGetRepoTwoRoots = defineCheck({\n\tid: \"sync.getrepo-two-roots\",\n\ttitle: \"getRepo returns a CAR declaring exactly two roots\",\n\ttier: \"must\",\n\tcitations: [{ source: \"lexicon\", ref: \"com.atproto.space.getRepo\" }],\n\tneeds: [\"operator\"],\n\tdestructive: true,\n\tasync run(ctx) {\n\t\tconst space = await createProbeSpace(ctx);\n\t\ttry {\n\t\t\tawait operatorCreateRecord(ctx, space.uri, POST, \"x\", note(\"car\"));\n\t\t\tconst res = await operatorFetch(ctx)(\n\t\t\t\t`${ctx.target.origin}/xrpc/com.atproto.space.getRepo?space=${encodeURIComponent(space.uri)}&repo=${encodeURIComponent(ctx.target.did)}`,\n\t\t\t);\n\t\t\tif (res.status !== 200) return fail(`getRepo ${res.status}`);\n\t\t\tconst contentType = res.headers.get(\"Content-Type\") ?? \"\";\n\t\t\tif (!contentType.includes(\"application/vnd.ipld.car\")) {\n\t\t\t\treturn fail(`getRepo content-type was ${contentType}`);\n\t\t\t}\n\t\t\tconst bytes = new Uint8Array(await res.arrayBuffer());\n\t\t\tconst header = readCarHeader(bytes);\n\t\t\treturn header.rootCount === 2\n\t\t\t\t? pass(`CAR v${header.version} with 2 roots`)\n\t\t\t\t: fail(`CAR declared ${header.rootCount} roots, expected 2`);\n\t\t} finally {\n\t\t\tawait deleteProbeSpace(ctx, space.uri);\n\t\t}\n\t},\n});\n\nconst syncListRecordsDescending = defineCheck({\n\tid: \"sync.listrecords-descending-default\",\n\ttitle: \"listRecords defaults to descending record order\",\n\ttier: \"should\",\n\tcitations: [\n\t\t{ source: \"reference\", ref: \"listRecords default order (descending)\" },\n\t\t{ source: \"lexicon\", ref: \"com.atproto.space.listRecords\" },\n\t],\n\tneeds: [\"operator\"],\n\tdestructive: true,\n\tasync run(ctx) {\n\t\tconst space = await createProbeSpace(ctx);\n\t\ttry {\n\t\t\tfor (const rkey of [\"aaa\", \"bbb\", \"ccc\"]) {\n\t\t\t\tawait operatorCreateRecord(ctx, space.uri, POST, rkey, note(rkey));\n\t\t\t}\n\t\t\tconst res = await xrpcGet(\n\t\t\t\tasOperator(ctx),\n\t\t\t\t\"com.atproto.space.listRecords\",\n\t\t\t\t{\n\t\t\t\t\tspace: space.uri,\n\t\t\t\t\trepo: ctx.target.did,\n\t\t\t\t\tcollection: POST,\n\t\t\t\t},\n\t\t\t);\n\t\t\tif (res.status !== 200) return fail(`listRecords ${res.status}`);\n\t\t\tconst rkeys = (\n\t\t\t\tres.json as { records: Array<{ rkey: string }> }\n\t\t\t).records.map((r) => r.rkey);\n\t\t\treturn rkeys.join(\",\") === \"ccc,bbb,aaa\"\n\t\t\t\t? pass(\"records returned descending by default\")\n\t\t\t\t: fail(`order was ${rkeys.join(\",\")}, reference is descending`);\n\t\t} finally {\n\t\t\tawait deleteProbeSpace(ctx, space.uri);\n\t\t}\n\t},\n});\n\n// --- host role ---------------------------------------------------------\n\nconst hostListReposNeedsCredential = defineCheck({\n\tid: \"host.listrepos-requires-credential\",\n\ttitle: \"listRepos requires a space credential\",\n\ttier: \"must\",\n\tcitations: [{ source: \"lexicon\", ref: \"com.atproto.space.listRepos\" }],\n\tneeds: [\"operator\"],\n\tdestructive: true,\n\tasync run(ctx) {\n\t\tconst space = await createProbeSpace(ctx);\n\t\ttry {\n\t\t\tconst res = await xrpcGet(ctx, \"com.atproto.space.listRepos\", {\n\t\t\t\tspace: space.uri,\n\t\t\t});\n\t\t\treturn res.status === 401 || res.status === 403\n\t\t\t\t? pass(`unauthenticated listRepos refused with ${res.status}`)\n\t\t\t\t: fail(`unauthenticated listRepos returned ${res.status}`, res.json);\n\t\t} finally {\n\t\t\tawait deleteProbeSpace(ctx, space.uri);\n\t\t}\n\t},\n});\n\n// --- simplespace -------------------------------------------------------\n\nconst simplespaceUnsupportedPolicy = defineCheck({\n\tid: \"simplespace.unsupported-policy-rejected\",\n\ttitle: \"createSpace rejects an unknown policy variant\",\n\ttier: \"must\",\n\tcitations: [\n\t\t{\n\t\t\tsource: \"lexicon\",\n\t\t\tref: \"com.atproto.simplespace.createSpace@error:UnsupportedPolicy\",\n\t\t},\n\t],\n\tneeds: [\"operator\"],\n\tasync run(ctx) {\n\t\tconst res = await xrpcPost(\n\t\t\tasOperator(ctx),\n\t\t\t\"com.atproto.simplespace.createSpace\",\n\t\t\t{\n\t\t\t\ttype: \"app.bsky.group\",\n\t\t\t\tpolicy: { $type: \"com.example.mysteryPolicy\" },\n\t\t\t\tappAccess: { $type: \"com.atproto.simplespace.defs#open\" },\n\t\t\t},\n\t\t);\n\t\tif (res.status === 200) {\n\t\t\tawait deleteProbeSpace(ctx, (res.json as { uri: string }).uri);\n\t\t\treturn fail(\"an unknown policy variant was accepted\");\n\t\t}\n\t\treturn res.error === \"UnsupportedPolicy\"\n\t\t\t? pass(\"rejected with UnsupportedPolicy\")\n\t\t\t: fail(\n\t\t\t\t\t`rejected with ${res.error} (${res.status}), expected UnsupportedPolicy`,\n\t\t\t\t\tres.json,\n\t\t\t\t);\n\t},\n});\n\nconst simplespaceGetSpace = defineCheck({\n\tid: \"simplespace.getspace-reflects-config\",\n\ttitle: \"getSpace reflects the created policy and appAccess\",\n\ttier: \"must\",\n\tcitations: [\n\t\t{ source: \"lexicon\", ref: \"com.atproto.simplespace.createSpace\" },\n\t\t{ source: \"lexicon\", ref: \"com.atproto.simplespace.getSpace\" },\n\t],\n\tneeds: [\"operator\"],\n\tdestructive: true,\n\tasync run(ctx) {\n\t\tconst space = await createProbeSpace(ctx, {\n\t\t\t$type: \"com.atproto.simplespace.defs#publicPolicy\",\n\t\t});\n\t\ttry {\n\t\t\tconst res = await xrpcGet(\n\t\t\t\tasOperator(ctx),\n\t\t\t\t\"com.atproto.simplespace.getSpace\",\n\t\t\t\t{\n\t\t\t\t\tspace: space.uri,\n\t\t\t\t},\n\t\t\t);\n\t\t\tif (res.status !== 200)\n\t\t\t\treturn fail(`getSpace ${res.status} ${res.error ?? \"\"}`, res.json);\n\t\t\tconst body = res.json as {\n\t\t\t\tpolicy?: { $type?: string };\n\t\t\t\tappAccess?: { $type?: string };\n\t\t\t};\n\t\t\tconst policyType = body.policy?.$type;\n\t\t\tif (policyType !== \"com.atproto.simplespace.defs#publicPolicy\") {\n\t\t\t\treturn fail(`getSpace policy was ${policyType}`, res.json);\n\t\t\t}\n\t\t\t// The title promises appAccess too — createProbeSpace passed #open.\n\t\t\tconst appAccessType = body.appAccess?.$type;\n\t\t\treturn appAccessType === \"com.atproto.simplespace.defs#open\"\n\t\t\t\t? pass(\"getSpace reported the public policy and open appAccess\")\n\t\t\t\t: fail(`getSpace appAccess was ${appAccessType}`, res.json);\n\t\t} finally {\n\t\t\tawait deleteProbeSpace(ctx, space.uri);\n\t\t}\n\t},\n});\n\n// --- blobs -------------------------------------------------------------\n\n/** Blob isolation (S6): a space blob is never public. */\nconst blobsSpaceNotPublic = defineCheck({\n\tid: \"blobs.space-blob-not-public\",\n\ttitle: \"A blob is not publicly served unless a public record references it\",\n\ttier: \"must\",\n\tcitations: [\n\t\t{ source: \"lexicon\", ref: \"com.atproto.space.getBlob\" },\n\t\t{ source: \"proposal\", ref: \"0016#blob-sync\" },\n\t],\n\t// uploadBlob and sync.getBlob are host-PDS endpoints, not space methods —\n\t// a standalone space host has neither, so gate on pds-blobs or this\n\t// check would false-fail wherever they are absent.\n\tneeds: [\"operator\", \"pds-blobs\"],\n\tdestructive: true,\n\tasync run(ctx) {\n\t\t// The principle under test is a positive gate, not cleanup: a blob must\n\t\t// never be publicly addressable until a *public* record references it.\n\t\t// Probe both slices of that — freshly uploaded (unreferenced), then\n\t\t// referenced only from a space. Serving either from the public\n\t\t// sync.getBlob leaks bytes the proposal says are fetched via the\n\t\t// credential-gated space.getBlob.\n\t\tconst space = await createProbeSpace(ctx);\n\t\ttry {\n\t\t\tconst bytes = crypto.getRandomValues(new Uint8Array(16));\n\t\t\tconst upload = await operatorFetch(ctx)(\n\t\t\t\t`${ctx.target.origin}/xrpc/com.atproto.repo.uploadBlob`,\n\t\t\t\t{\n\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\theaders: { \"Content-Type\": \"application/octet-stream\" },\n\t\t\t\t\tbody: bytes,\n\t\t\t\t},\n\t\t\t);\n\t\t\tif (upload.status !== 200) return fail(`uploadBlob ${upload.status}`);\n\t\t\tconst blob = (\n\t\t\t\t(await upload.json()) as { blob: { ref: { $link: string } } }\n\t\t\t).blob;\n\t\t\tconst cid = blob.ref.$link;\n\t\t\tconst publicUrl = `${ctx.target.origin}/xrpc/com.atproto.sync.getBlob?did=${encodeURIComponent(ctx.target.did)}&cid=${cid}`;\n\n\t\t\tconst stagedGet = await ctx.fetch(publicUrl);\n\t\t\tif (stagedGet.status === 200) {\n\t\t\t\treturn fail(\n\t\t\t\t\t\"an uploaded, unreferenced blob was served by the public sync.getBlob\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst write = await operatorCreateRecord(\n\t\t\t\tctx,\n\t\t\t\tspace.uri,\n\t\t\t\t\"test.conformance.withblob\",\n\t\t\t\t\"self\",\n\t\t\t\t{\n\t\t\t\t\t$type: \"test.conformance.withblob\",\n\t\t\t\t\tfile: blob,\n\t\t\t\t},\n\t\t\t);\n\t\t\tif (write.status !== 200)\n\t\t\t\treturn fail(\n\t\t\t\t\t`referencing write ${write.status} ${write.error ?? \"\"}`,\n\t\t\t\t\twrite.json,\n\t\t\t\t);\n\t\t\tconst publicGet = await ctx.fetch(publicUrl);\n\t\t\treturn publicGet.status === 200\n\t\t\t\t? fail(\"a space blob was served by the public sync.getBlob\")\n\t\t\t\t: pass(\n\t\t\t\t\t\t`public sync.getBlob refused the blob unreferenced (${stagedGet.status}) and space-referenced (${publicGet.status})`,\n\t\t\t\t\t);\n\t\t} finally {\n\t\t\tawait deleteProbeSpace(ctx, space.uri);\n\t\t}\n\t},\n});\n\n/**\n * The operator catalog: runnable anywhere the harness has an operator\n * session — browser included.\n */\nexport const operatorChecks: Check[] = [\n\twritesCreateRead,\n\twritesUnauthReadRefused,\n\twritesDuplicate,\n\twritesDeleteIdempotent,\n\twritesApplyWritesAtomic,\n\tcredentialSelfRoundTrip,\n\tsyncGetRepoTwoRoots,\n\tsyncListRecordsDescending,\n\thostListReposNeedsCredential,\n\tsimplespaceUnsupportedPolicy,\n\tsimplespaceGetSpace,\n\tblobsSpaceNotPublic,\n];\n"],"mappings":";;;AAgMA,MAAa,QAAQ,QAAgB,cAAsC;CAC1E,QAAQ;CACR;CACA,GAAI,aAAa,SAAY,EAAE,UAAU,GAAG,EAAE;CAC9C;AAED,MAAa,QAAQ,QAAgB,cAAsC;CAC1E,QAAQ;CACR;CACA,GAAI,aAAa,SAAY,EAAE,UAAU,GAAG,EAAE;CAC9C;;;;;;;;;;;;AC5LD,SAAgB,YAAY,OAAqB;AAChD,KAAI,CAAC,2BAA2B,KAAK,MAAM,GAAG,CAC7C,OAAM,IAAI,MAAM,8CAA8C,MAAM,KAAK;AAE1E,KAAI,MAAM,SAAS,UAAU,MAAM,UAAU,WAAW,EACvD,OAAM,IAAI,MACT,SAAS,MAAM,GAAG,8FAClB;AAEF,QAAO;;AAsBR,SAAgB,aAAa,QAA0B;CACtD,MAAM,uBAAO,IAAI,KAAa;AAC9B,MAAK,MAAM,SAAS,QAAQ;AAC3B,MAAI,KAAK,IAAI,MAAM,GAAG,CACrB,OAAM,IAAI,MAAM,uBAAuB,MAAM,KAAK;AAEnD,OAAK,IAAI,MAAM,GAAG;;AAEnB,QAAO;;;;;;;AAQR,SAAgB,cACf,SACA,QACkB;CAClB,MAAM,eAAe,IAAI,IAAI,OAAO,gBAAgB,EAAE,CAAC;CACvD,MAAMA,WAAoB,EAAE;CAC5B,MAAMC,UAAsC,EAAE;CAK9C,MAAM,MAAM,OAAO,KAAK,SAAS,OAAO,MAAM;CAC9C,MAAM,QAAQ,OAAO,OAAO,SAAS,OAAO,QAAQ;CACpD,MAAM,QAAQ,OAAO,OAAO,SAAS,OAAO,QAAQ;AAEpD,MAAK,MAAM,SAAS,SAAS;AAC5B,MAAI,OAAO,CAAC,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com/bluesky-social/atproto",
|
|
3
|
+
"branch": "permissioned-data-alpha",
|
|
4
|
+
"commit": "4c33457",
|
|
5
|
+
"vendoredAt": "2026-08-28",
|
|
6
|
+
"note": "Vendored verbatim from lexicons/com/atproto/{space,simplespace}. Re-vendored by the weekly sync; a diff here identifies affected checks via their citations."
|
|
7
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lexicon": 1,
|
|
3
|
+
"id": "com.atproto.simplespace.addMember",
|
|
4
|
+
"defs": {
|
|
5
|
+
"main": {
|
|
6
|
+
"type": "procedure",
|
|
7
|
+
"description": "Add a member to a space's member list. The member list is host-internal state consulted at credential-mint time when the space's policy is 'member-list'. It is not a synced protocol structure and is not enumerated to the network. Requires auth as the space owner.",
|
|
8
|
+
"input": {
|
|
9
|
+
"encoding": "application/json",
|
|
10
|
+
"schema": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"required": ["space", "did"],
|
|
13
|
+
"properties": {
|
|
14
|
+
"space": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"format": "space-ref",
|
|
17
|
+
"description": "Reference to the space."
|
|
18
|
+
},
|
|
19
|
+
"did": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"format": "did",
|
|
22
|
+
"description": "The DID of the member to add."
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"errors": [
|
|
28
|
+
{
|
|
29
|
+
"name": "SpaceNotFound"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "NotSpaceOwner"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lexicon": 1,
|
|
3
|
+
"id": "com.atproto.simplespace.checkUserAccess",
|
|
4
|
+
"defs": {
|
|
5
|
+
"main": {
|
|
6
|
+
"type": "query",
|
|
7
|
+
"description": "Ask a space's managing app whether to authorize a requesting user for a space credential. Served by the managingApp (not the PDS), called by the space authority at mint time when policy is 'managing-app'. Authenticated with service auth from the authority.",
|
|
8
|
+
"parameters": {
|
|
9
|
+
"type": "params",
|
|
10
|
+
"required": ["space", "user"],
|
|
11
|
+
"properties": {
|
|
12
|
+
"space": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"format": "space-ref",
|
|
15
|
+
"description": "Reference to the space."
|
|
16
|
+
},
|
|
17
|
+
"user": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"format": "did",
|
|
20
|
+
"description": "The DID of the requesting user."
|
|
21
|
+
},
|
|
22
|
+
"clientId": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"description": "The attested client_id, if a client attestation was presented."
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"output": {
|
|
29
|
+
"encoding": "application/json",
|
|
30
|
+
"schema": {
|
|
31
|
+
"type": "object",
|
|
32
|
+
"required": ["authorized"],
|
|
33
|
+
"properties": {
|
|
34
|
+
"authorized": {
|
|
35
|
+
"type": "boolean",
|
|
36
|
+
"description": "Whether the managing app authorizes the request."
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lexicon": 1,
|
|
3
|
+
"id": "com.atproto.simplespace.createSpace",
|
|
4
|
+
"defs": {
|
|
5
|
+
"main": {
|
|
6
|
+
"type": "procedure",
|
|
7
|
+
"description": "Create a new space managed by the simplespace implementation. The space is anchored on the authenticated user's DID, who becomes the space owner. Requires auth, implemented by PDS.",
|
|
8
|
+
"input": {
|
|
9
|
+
"encoding": "application/json",
|
|
10
|
+
"schema": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"required": ["type", "policy", "appAccess"],
|
|
13
|
+
"properties": {
|
|
14
|
+
"type": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"format": "nsid",
|
|
17
|
+
"description": "The NSID of the space type, describing the modality of the space (e.g. app.bsky.group, app.bsky.personal)."
|
|
18
|
+
},
|
|
19
|
+
"skey": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"format": "record-key",
|
|
22
|
+
"description": "The space key. Used to differentiate multiple spaces of the same type under the same owner. Same syntax requirements as a record key. If not provided, one will be auto-generated (TID)."
|
|
23
|
+
},
|
|
24
|
+
"policy": {
|
|
25
|
+
"type": "union",
|
|
26
|
+
"description": "How the authority decides whether to authorize a requesting user.",
|
|
27
|
+
"refs": [
|
|
28
|
+
"com.atproto.simplespace.defs#publicPolicy",
|
|
29
|
+
"com.atproto.simplespace.defs#memberListPolicy",
|
|
30
|
+
"com.atproto.simplespace.defs#managingAppPolicy"
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
"appAccess": {
|
|
34
|
+
"type": "union",
|
|
35
|
+
"description": "How the authority decides whether to authorize a requesting app.",
|
|
36
|
+
"refs": [
|
|
37
|
+
"com.atproto.simplespace.defs#open",
|
|
38
|
+
"com.atproto.simplespace.defs#allowList"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"output": {
|
|
45
|
+
"encoding": "application/json",
|
|
46
|
+
"schema": {
|
|
47
|
+
"type": "object",
|
|
48
|
+
"required": ["uri"],
|
|
49
|
+
"properties": {
|
|
50
|
+
"uri": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"format": "space-ref",
|
|
53
|
+
"description": "URI of the created space."
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"errors": [
|
|
59
|
+
{
|
|
60
|
+
"name": "SpaceAlreadyExists",
|
|
61
|
+
"description": "A space with this owner, type, and skey already exists. A space that was previously deleted may be created again."
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "UnsupportedPolicy",
|
|
65
|
+
"description": "The requested policy is not one the host implements."
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"name": "UnsupportedAppAccess",
|
|
69
|
+
"description": "The requested appAccess variant is not one the host implements. A host will not store an app access policy it cannot enforce."
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lexicon": 1,
|
|
3
|
+
"id": "com.atproto.simplespace.defs",
|
|
4
|
+
"defs": {
|
|
5
|
+
"publicPolicy": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"description": "User access policy: any user may access the space.",
|
|
8
|
+
"properties": {}
|
|
9
|
+
},
|
|
10
|
+
"memberListPolicy": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"description": "User access policy: only users on the space's member list may access it.",
|
|
13
|
+
"properties": {}
|
|
14
|
+
},
|
|
15
|
+
"managingAppPolicy": {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"description": "User access policy: the managing app is asked, via checkUserAccess, whether to authorize each user.",
|
|
18
|
+
"required": ["managingApp"],
|
|
19
|
+
"properties": {
|
|
20
|
+
"managingApp": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"description": "Service identifier of the managing app: a DID with an optional service fragment (e.g. 'did:web:example.com#forum')."
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"open": {
|
|
27
|
+
"type": "object",
|
|
28
|
+
"description": "App access policy: any app may access the space. No client attestation required.",
|
|
29
|
+
"properties": {}
|
|
30
|
+
},
|
|
31
|
+
"allowList": {
|
|
32
|
+
"type": "object",
|
|
33
|
+
"description": "App access policy: only the named clients may access the space, evaluated against the attested client_id.",
|
|
34
|
+
"required": ["allowed"],
|
|
35
|
+
"properties": {
|
|
36
|
+
"allowed": {
|
|
37
|
+
"type": "array",
|
|
38
|
+
"description": "The OAuth client IDs permitted to access the space.",
|
|
39
|
+
"items": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"description": "An OAuth client ID."
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lexicon": 1,
|
|
3
|
+
"id": "com.atproto.simplespace.deleteSpace",
|
|
4
|
+
"defs": {
|
|
5
|
+
"main": {
|
|
6
|
+
"type": "procedure",
|
|
7
|
+
"description": "Delete a space. The authenticated user must be the space owner. The authority's own repo in the space is deleted along with it, since the space host and the repo host are the same service here; other members' repos are flagged as belonging to a deleted space rather than erased. After deletion, all reads and writes against the space fail with SpaceNotFound, and getSpaceCredential answers SpaceDeleted so a syncer that missed the notification still learns to drop its copy. Idempotent. Requires auth, implemented by PDS.",
|
|
8
|
+
"input": {
|
|
9
|
+
"encoding": "application/json",
|
|
10
|
+
"schema": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"required": ["space"],
|
|
13
|
+
"properties": {
|
|
14
|
+
"space": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"format": "space-ref",
|
|
17
|
+
"description": "Reference to the space to delete."
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"errors": [
|
|
23
|
+
{
|
|
24
|
+
"name": "SpaceNotFound"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "NotSpaceOwner"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lexicon": 1,
|
|
3
|
+
"id": "com.atproto.simplespace.getSpace",
|
|
4
|
+
"defs": {
|
|
5
|
+
"main": {
|
|
6
|
+
"type": "query",
|
|
7
|
+
"description": "Describe a space managed by the simplespace implementation, including its configuration. Served by the space host. Requires either OAuth (for a caller with an account on this host) or a space credential (for a member hosted elsewhere); either way the caller must be authorized for the space.",
|
|
8
|
+
"parameters": {
|
|
9
|
+
"type": "params",
|
|
10
|
+
"required": ["space"],
|
|
11
|
+
"properties": {
|
|
12
|
+
"space": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"format": "space-ref",
|
|
15
|
+
"description": "Reference to the space."
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"output": {
|
|
20
|
+
"encoding": "application/json",
|
|
21
|
+
"schema": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"required": ["uri", "policy", "appAccess"],
|
|
24
|
+
"properties": {
|
|
25
|
+
"uri": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"format": "space-ref",
|
|
28
|
+
"description": "URI of the space."
|
|
29
|
+
},
|
|
30
|
+
"policy": {
|
|
31
|
+
"type": "union",
|
|
32
|
+
"description": "How the authority decides whether to authorize a requesting user.",
|
|
33
|
+
"refs": [
|
|
34
|
+
"com.atproto.simplespace.defs#publicPolicy",
|
|
35
|
+
"com.atproto.simplespace.defs#memberListPolicy",
|
|
36
|
+
"com.atproto.simplespace.defs#managingAppPolicy"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
"appAccess": {
|
|
40
|
+
"type": "union",
|
|
41
|
+
"description": "How the authority decides whether to authorize a requesting app.",
|
|
42
|
+
"refs": [
|
|
43
|
+
"com.atproto.simplespace.defs#open",
|
|
44
|
+
"com.atproto.simplespace.defs#allowList"
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"errors": [{ "name": "SpaceNotFound" }]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lexicon": 1,
|
|
3
|
+
"id": "com.atproto.simplespace.listMembers",
|
|
4
|
+
"defs": {
|
|
5
|
+
"main": {
|
|
6
|
+
"type": "query",
|
|
7
|
+
"description": "List the members in a space's host-internal member list. Must be called on the space authority's PDS. Requires OAuth with a covering read grant; a space credential is not sufficient, so members hosted elsewhere cannot enumerate the list. This reflects the simplespace member list, not a protocol-level reader set.",
|
|
8
|
+
"parameters": {
|
|
9
|
+
"type": "params",
|
|
10
|
+
"required": ["space"],
|
|
11
|
+
"properties": {
|
|
12
|
+
"space": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"format": "space-ref",
|
|
15
|
+
"description": "Reference to the space."
|
|
16
|
+
},
|
|
17
|
+
"limit": {
|
|
18
|
+
"type": "integer",
|
|
19
|
+
"minimum": 1,
|
|
20
|
+
"maximum": 1000,
|
|
21
|
+
"default": 100,
|
|
22
|
+
"description": "Maximum number of members to return."
|
|
23
|
+
},
|
|
24
|
+
"cursor": {
|
|
25
|
+
"type": "string"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"output": {
|
|
30
|
+
"encoding": "application/json",
|
|
31
|
+
"schema": {
|
|
32
|
+
"type": "object",
|
|
33
|
+
"required": ["members"],
|
|
34
|
+
"properties": {
|
|
35
|
+
"cursor": {
|
|
36
|
+
"type": "string"
|
|
37
|
+
},
|
|
38
|
+
"members": {
|
|
39
|
+
"type": "array",
|
|
40
|
+
"items": {
|
|
41
|
+
"type": "ref",
|
|
42
|
+
"ref": "#member"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"errors": [
|
|
49
|
+
{
|
|
50
|
+
"name": "SpaceNotFound"
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
"member": {
|
|
55
|
+
"type": "object",
|
|
56
|
+
"required": ["did"],
|
|
57
|
+
"properties": {
|
|
58
|
+
"did": {
|
|
59
|
+
"type": "string",
|
|
60
|
+
"format": "did"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lexicon": 1,
|
|
3
|
+
"id": "com.atproto.simplespace.removeMember",
|
|
4
|
+
"defs": {
|
|
5
|
+
"main": {
|
|
6
|
+
"type": "procedure",
|
|
7
|
+
"description": "Remove a member from a space's member list. The member list is host-internal state consulted at credential-mint time when the space's policy is 'member-list'. Requires auth as the space owner.",
|
|
8
|
+
"input": {
|
|
9
|
+
"encoding": "application/json",
|
|
10
|
+
"schema": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"required": ["space", "did"],
|
|
13
|
+
"properties": {
|
|
14
|
+
"space": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"format": "space-ref",
|
|
17
|
+
"description": "Reference to the space."
|
|
18
|
+
},
|
|
19
|
+
"did": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"format": "did",
|
|
22
|
+
"description": "The DID of the member to remove."
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"errors": [
|
|
28
|
+
{
|
|
29
|
+
"name": "SpaceNotFound"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "NotSpaceOwner"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lexicon": 1,
|
|
3
|
+
"id": "com.atproto.simplespace.updateSpace",
|
|
4
|
+
"defs": {
|
|
5
|
+
"main": {
|
|
6
|
+
"type": "procedure",
|
|
7
|
+
"description": "Update the configuration of a space. The authenticated user must be the space owner. Omitted fields are left unchanged. Requires auth, implemented by PDS.",
|
|
8
|
+
"input": {
|
|
9
|
+
"encoding": "application/json",
|
|
10
|
+
"schema": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"required": ["space"],
|
|
13
|
+
"properties": {
|
|
14
|
+
"space": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"format": "space-ref",
|
|
17
|
+
"description": "Reference to the space to update."
|
|
18
|
+
},
|
|
19
|
+
"policy": {
|
|
20
|
+
"type": "union",
|
|
21
|
+
"description": "How the authority decides whether to authorize a requesting user. When supplied, replaces the current policy wholesale.",
|
|
22
|
+
"refs": [
|
|
23
|
+
"com.atproto.simplespace.defs#publicPolicy",
|
|
24
|
+
"com.atproto.simplespace.defs#memberListPolicy",
|
|
25
|
+
"com.atproto.simplespace.defs#managingAppPolicy"
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"appAccess": {
|
|
29
|
+
"type": "union",
|
|
30
|
+
"description": "How the authority decides whether to authorize a requesting app. When supplied, replaces the current policy wholesale.",
|
|
31
|
+
"refs": [
|
|
32
|
+
"com.atproto.simplespace.defs#open",
|
|
33
|
+
"com.atproto.simplespace.defs#allowList"
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"errors": [
|
|
40
|
+
{
|
|
41
|
+
"name": "SpaceNotFound"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "NotSpaceOwner"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "UnsupportedPolicy",
|
|
48
|
+
"description": "The requested policy is not one the host implements."
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "UnsupportedAppAccess",
|
|
52
|
+
"description": "The requested appAccess variant is not one the host implements. A host will not store an app access policy it cannot enforce."
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|