@getcirrus/space-conformance 0.0.0 → 0.2.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-CGsQgOwR.d.ts +472 -0
- package/dist/base-CGsQgOwR.d.ts.map +1 -0
- package/dist/cli.js +26 -18
- package/dist/cli.js.map +1 -1
- package/dist/coverage-cK1NBo-P.js +2250 -0
- package/dist/coverage-cK1NBo-P.js.map +1 -0
- package/dist/descriptors-BUCV_BuG.js +4428 -0
- package/dist/descriptors-BUCV_BuG.js.map +1 -0
- package/dist/full-CKsHg6ox.js +852 -0
- package/dist/full-CKsHg6ox.js.map +1 -0
- package/dist/full.d.ts +44 -17
- package/dist/full.d.ts.map +1 -1
- package/dist/full.js +3 -3
- package/dist/index.d.ts +90 -28
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +115 -93
- package/dist/index.js.map +1 -1
- package/lexicons/MANIFEST.json +4 -4
- package/lexicons/managedspace/checkAccess.json +44 -0
- package/lexicons/managedspace/policy.json +22 -0
- package/lexicons/memberspace/defs.json +22 -0
- package/lexicons/{simplespace → memberspace}/listMembers.json +15 -17
- package/lexicons/memberspace/member.json +23 -0
- package/lexicons/memberspace/policy.json +40 -0
- package/lexicons/memberspace/putMembers.json +43 -0
- package/lexicons/memberspace/removeMembers.json +43 -0
- package/lexicons/personalspace/policy.json +11 -0
- package/lexicons/space/applyWrites.json +6 -11
- package/lexicons/space/authorizeSpaceSync.json +109 -0
- package/lexicons/space/clearRecords.json +34 -0
- package/lexicons/space/confirmRegistration.json +44 -0
- package/lexicons/space/createRecord.json +7 -14
- package/lexicons/space/createSpace.json +58 -0
- package/lexicons/space/defs.json +61 -16
- package/lexicons/space/deleteRecord.json +5 -9
- package/lexicons/space/deleteSpace.json +31 -0
- package/lexicons/space/exportSpaceMeta.json +31 -0
- package/lexicons/space/getBlob.json +4 -7
- package/lexicons/space/getDelegationToken.json +3 -5
- package/lexicons/space/getLatestCommit.json +8 -7
- package/lexicons/space/getRecord.json +9 -9
- package/lexicons/space/getRepo.json +8 -11
- package/lexicons/space/getSpace.json +43 -0
- package/lexicons/space/importRepo.json +27 -0
- package/lexicons/space/importSpaceMeta.json +25 -0
- package/lexicons/space/listBlobs.json +3 -10
- package/lexicons/space/listRecords.json +10 -16
- package/lexicons/space/listRepoOps.json +23 -23
- package/lexicons/space/listSpaces.json +30 -14
- package/lexicons/space/listWriters.json +66 -0
- package/lexicons/space/notifyCredentialsRevoked.json +30 -0
- package/lexicons/space/notifyRepoUpdate.json +44 -0
- package/lexicons/space/notifySpaceUpdate.json +53 -0
- package/lexicons/space/policy.json +26 -0
- package/lexicons/space/putRecord.json +7 -14
- package/lexicons/space/removeWriter.json +35 -0
- package/lexicons/space/updateSpace.json +43 -0
- package/package.json +11 -11
- package/dist/base-D8a-ZK57.d.ts +0 -249
- package/dist/base-D8a-ZK57.d.ts.map +0 -1
- package/dist/coverage-DhJZu8P8.js +0 -1914
- package/dist/coverage-DhJZu8P8.js.map +0 -1
- package/dist/full-D4ufJLcw.js +0 -409
- package/dist/full-D4ufJLcw.js.map +0 -1
- package/dist/operator-BErXCDow.js +0 -923
- package/dist/operator-BErXCDow.js.map +0 -1
- package/lexicons/simplespace/addMember.json +0 -37
- package/lexicons/simplespace/checkUserAccess.json +0 -43
- package/lexicons/simplespace/createSpace.json +0 -74
- package/lexicons/simplespace/defs.json +0 -47
- package/lexicons/simplespace/deleteSpace.json +0 -32
- package/lexicons/simplespace/getSpace.json +0 -53
- package/lexicons/simplespace/removeMember.json +0 -37
- package/lexicons/simplespace/updateSpace.json +0 -57
- package/lexicons/space/getSpaceCredential.json +0 -67
- package/lexicons/space/listRepos.json +0 -75
- package/lexicons/space/notifySpaceDeleted.json +0 -24
- package/lexicons/space/notifyWrite.json +0 -38
- package/lexicons/space/registerNotify.json +0 -49
- package/lexicons/space/unregisterNotify.json +0 -29
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
//#region src/model.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The check model.
|
|
4
|
+
*
|
|
5
|
+
* A check is a black-box probe of a live spaces implementation: an async
|
|
6
|
+
* function over a transport, plus machine-readable metadata that says what
|
|
7
|
+
* it tests, on whose authority, and what it needs from the harness.
|
|
8
|
+
*
|
|
9
|
+
* Tiers, and why they matter: a conformance suite that fails
|
|
10
|
+
* implementations on its author's opinions poisons its own authority.
|
|
11
|
+
* Every `must` check cites specified behavior — a lexicon shape, a
|
|
12
|
+
* declared error name, a requirement in the proposal or the upstream PDS
|
|
13
|
+
* design spec. `should` checks encode reference-implementation behavior
|
|
14
|
+
* the spec leaves open, and are calibrated by running this suite against
|
|
15
|
+
* the reference: a `should` the reference fails is stale by definition.
|
|
16
|
+
* `info` checks report implementation choices and never fail anyone.
|
|
17
|
+
*/
|
|
18
|
+
type Tier = "must" | "should" | "info";
|
|
19
|
+
/** Where a check's claim comes from. Every `must` check needs at least one. */
|
|
20
|
+
interface Citation {
|
|
21
|
+
/**
|
|
22
|
+
* - `lexicon`: a vendored lexicon (machine-checked by the coverage
|
|
23
|
+
* generator).
|
|
24
|
+
* - `proposal` / `pds-design-spec`: the upstream prose specs.
|
|
25
|
+
* - `changeset`: an upstream changeset (`.changeset/<name>.md` on the
|
|
26
|
+
* alpha branch). For alpha protocol mechanics no lexicon can express —
|
|
27
|
+
* the credential HTTP signature, the MAC exchange, key discovery — the
|
|
28
|
+
* changeset is the alpha's only normative prose, so it is a citable
|
|
29
|
+
* source for a `must`.
|
|
30
|
+
* - `reference`: what the reference implementation happens to do. Fine
|
|
31
|
+
* for a `should`; never enough on its own for a `must`.
|
|
32
|
+
*/
|
|
33
|
+
source: "lexicon" | "proposal" | "pds-design-spec" | "changeset" | "reference";
|
|
34
|
+
/**
|
|
35
|
+
* Locator within the source: a lexicon id (optionally `#def` or
|
|
36
|
+
* `@error:Name`), a proposal section anchor, a design-spec heading or a
|
|
37
|
+
* changeset name. Lexicon locators are machine-checked by the coverage
|
|
38
|
+
* generator.
|
|
39
|
+
*/
|
|
40
|
+
ref: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* What the harness must supply for a check to run. A runner skips (and
|
|
44
|
+
* reports as "not testable") any check whose needs it cannot meet.
|
|
45
|
+
*
|
|
46
|
+
* - `operator`: an authenticated session on the target (any full-access
|
|
47
|
+
* scheme; how it was obtained is the harness's business).
|
|
48
|
+
* - `oauth-session`: specifically an OAuth-granted session with `space:`
|
|
49
|
+
* scopes — only harnesses that can drive the target's consent flow.
|
|
50
|
+
* - `identities`: harness-controlled DIDs with resolvable documents and
|
|
51
|
+
* held keys, for playing reader/writer roles.
|
|
52
|
+
* - `syncer-inbox`: an endpoint the harness serves that the target can
|
|
53
|
+
* reach — registered as a syncer's `notify` endpoint, and named (through
|
|
54
|
+
* a resolvable `did#serviceId`) as a `managedspace` managing app.
|
|
55
|
+
* - `pds-blobs`: the target is a full PDS implementing
|
|
56
|
+
* `com.atproto.repo.uploadBlob` and `com.atproto.sync.getBlob` — needed
|
|
57
|
+
* to prove a space blob is not served publicly. A standalone space host,
|
|
58
|
+
* or an isolated space-routes fixture, does not provide it.
|
|
59
|
+
* - `pds-delegation`: the target implements
|
|
60
|
+
* `com.atproto.space.getDelegationToken`, so the operator can obtain a
|
|
61
|
+
* credential for its own non-public space (the self-flow) with no
|
|
62
|
+
* harness-held reader key. A space-routes fixture does not provide it.
|
|
63
|
+
* - `alpha-libs`: the transport can execute the alpha crypto libraries
|
|
64
|
+
* (`@atproto/space`), whose bundle pulls node-only dependencies. Real
|
|
65
|
+
* checks never declare it — importing the full entry implies it — but
|
|
66
|
+
* the browser catalog's metadata stubs do, so a browser harness (which
|
|
67
|
+
* never declares it) reports them "not testable here" instead of
|
|
68
|
+
* running a stub.
|
|
69
|
+
*/
|
|
70
|
+
type Capability = "operator" | "oauth-session" | "identities" | "syncer-inbox" | "pds-blobs" | "pds-delegation" | "alpha-libs";
|
|
71
|
+
type CheckStatus = "pass" | "fail" | "skipped" | "error";
|
|
72
|
+
interface CheckResult {
|
|
73
|
+
id: string;
|
|
74
|
+
tier: Tier;
|
|
75
|
+
status: CheckStatus;
|
|
76
|
+
/** One line: what was observed, or why skipped/errored. */
|
|
77
|
+
detail: string;
|
|
78
|
+
citations: Citation[];
|
|
79
|
+
/** Optional request/response evidence for the report. */
|
|
80
|
+
evidence?: unknown;
|
|
81
|
+
durationMs?: number;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* An identity the harness controls: a DID the target can resolve, plus the
|
|
85
|
+
* key behind its `#atproto` verification method. The harness signs as this
|
|
86
|
+
* party — delegation tokens as a reader, service auth as a writer's PDS,
|
|
87
|
+
* credentials and revocations as a foreign space authority.
|
|
88
|
+
*/
|
|
89
|
+
interface HarnessIdentity {
|
|
90
|
+
did: string;
|
|
91
|
+
/** Sign bytes with the identity's `#atproto` key (ES256K/ES256), compact. */
|
|
92
|
+
sign(bytes: Uint8Array): Promise<Uint8Array>;
|
|
93
|
+
/** JWT `alg` for {@link sign}. */
|
|
94
|
+
jwtAlg: string;
|
|
95
|
+
}
|
|
96
|
+
interface IdentityProvider {
|
|
97
|
+
/** Mint (or reuse) a harness identity by role label. */
|
|
98
|
+
identity(role: string): Promise<HarnessIdentity>;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* A syncer endpoint the harness serves: the `notify` target of
|
|
102
|
+
* `authorizeSpaceSync`, which the space host calls back with
|
|
103
|
+
* `com.atproto.space.confirmRegistration` and `notifySpaceUpdate`. The
|
|
104
|
+
* same endpoint doubles as a `managedspace` managing app answering
|
|
105
|
+
* `com.atproto.managedspace.checkAccess`.
|
|
106
|
+
*
|
|
107
|
+
* `createSyncerInbox()` implements all of this over a fetch-style handler;
|
|
108
|
+
* a harness only has to route requests for `endpoint` to it.
|
|
109
|
+
*/
|
|
110
|
+
interface SyncerInbox {
|
|
111
|
+
/** The base URL registered as `notify.endpoint` (`{endpoint}/xrpc/...`). */
|
|
112
|
+
endpoint: string;
|
|
113
|
+
/**
|
|
114
|
+
* A `did#serviceId` reference whose DID document routes that service to
|
|
115
|
+
* `endpoint`, for naming the inbox as a managing app. The target sends
|
|
116
|
+
* service auth addressed to it.
|
|
117
|
+
*/
|
|
118
|
+
service: string;
|
|
119
|
+
/**
|
|
120
|
+
* Issue a fresh notify token for `space`. The inbox confirms a
|
|
121
|
+
* registration (echoes the challenge) and accepts notifications only for
|
|
122
|
+
* tokens it issued for that space; anything else is refused with 400.
|
|
123
|
+
*/
|
|
124
|
+
issueToken(space: string): string;
|
|
125
|
+
/** Wait for a delivery matching the predicate, or time out (null). */
|
|
126
|
+
waitFor(predicate: (delivery: InboxDelivery) => boolean, timeoutMs: number): Promise<InboxDelivery | null>;
|
|
127
|
+
/**
|
|
128
|
+
* Answer queries for `lxm` (e.g. `com.atproto.managedspace.checkAccess`)
|
|
129
|
+
* with the handler's JSON body; pass undefined to stop answering. Queries
|
|
130
|
+
* are recorded as deliveries either way.
|
|
131
|
+
*/
|
|
132
|
+
respond(lxm: string, handler: ((delivery: InboxDelivery) => unknown) | undefined): void;
|
|
133
|
+
/**
|
|
134
|
+
* The client_id of an OAuth client the inbox publishes:
|
|
135
|
+
* `{endpoint}/client-metadata.json`, a client-metadata document (served
|
|
136
|
+
* by the inbox) whose `jwks` holds one ES256 key — what a space host
|
|
137
|
+
* fetches to verify a client attestation.
|
|
138
|
+
*/
|
|
139
|
+
clientId: string;
|
|
140
|
+
/**
|
|
141
|
+
* Mint a client attestation for {@link clientId} addressed to `aud`
|
|
142
|
+
* (`spaceHostAud(authority)`), signed by the published key: typ
|
|
143
|
+
* `atproto-client-attestation+jwt`, iss = sub = client_id, a fresh jti,
|
|
144
|
+
* 60 seconds of life.
|
|
145
|
+
*/
|
|
146
|
+
attest(aud: string): Promise<string>;
|
|
147
|
+
}
|
|
148
|
+
interface InboxDelivery {
|
|
149
|
+
lxm: string;
|
|
150
|
+
/** Parsed JSON body of a procedure. */
|
|
151
|
+
body: unknown;
|
|
152
|
+
/** Query parameters of a query. */
|
|
153
|
+
params?: Record<string, string>;
|
|
154
|
+
authorization?: string;
|
|
155
|
+
/** The HTTP status the inbox answered with. */
|
|
156
|
+
status: number;
|
|
157
|
+
receivedAt: number;
|
|
158
|
+
}
|
|
159
|
+
/** Description of the implementation under test. */
|
|
160
|
+
interface Target {
|
|
161
|
+
/** Public origin, e.g. https://pds.example.com */
|
|
162
|
+
origin: string;
|
|
163
|
+
/** The DID whose repos / spaces the target serves. */
|
|
164
|
+
did: string;
|
|
165
|
+
/** Free-form implementation label for the report ("cirrus", "reference"). */
|
|
166
|
+
implementation?: string;
|
|
167
|
+
/**
|
|
168
|
+
* The PLC directory did:plc identities resolve against (the target's own
|
|
169
|
+
* and the repos it reads). Defaults to https://plc.directory.
|
|
170
|
+
*/
|
|
171
|
+
plcDirectory?: string;
|
|
172
|
+
}
|
|
173
|
+
interface CheckContext {
|
|
174
|
+
target: Target;
|
|
175
|
+
fetch: typeof fetch;
|
|
176
|
+
/**
|
|
177
|
+
* Present when the harness has an authenticated session on the target.
|
|
178
|
+
* Provide `authorize` when auth is plain header injection (a bearer
|
|
179
|
+
* token), or `fetch` when each request must be individually signed — an
|
|
180
|
+
* OAuth session's DPoP proof depends on the method and URL, so it cannot
|
|
181
|
+
* be expressed as headers alone. At least one is required;
|
|
182
|
+
* `fetch` wins when both are present.
|
|
183
|
+
*/
|
|
184
|
+
operator?: {
|
|
185
|
+
/** Add auth to a request (header injection). */
|
|
186
|
+
authorize?(init: RequestInit & {
|
|
187
|
+
headers: Headers;
|
|
188
|
+
}): Promise<void>;
|
|
189
|
+
/** A fetch that carries the operator's credentials on every request. */
|
|
190
|
+
fetch?: typeof fetch;
|
|
191
|
+
/** True when this session came from an OAuth grant with space: scopes. */
|
|
192
|
+
oauth: boolean;
|
|
193
|
+
};
|
|
194
|
+
identities?: IdentityProvider;
|
|
195
|
+
syncerInbox?: SyncerInbox;
|
|
196
|
+
/**
|
|
197
|
+
* Resolve a DID document. Optional: by default the suite fetches did:web
|
|
198
|
+
* documents from their host and did:plc documents from
|
|
199
|
+
* `target.plcDirectory`, over `fetch`. An in-process fixture with its own
|
|
200
|
+
* resolution supplies this instead.
|
|
201
|
+
*/
|
|
202
|
+
resolveDid?(did: string): Promise<unknown>;
|
|
203
|
+
/**
|
|
204
|
+
* Scratch space shared across checks in one run — e.g. the probe space
|
|
205
|
+
* a setup check created, reused by later checks. Keys are namespaced by
|
|
206
|
+
* convention (`"probe.space.uri"`).
|
|
207
|
+
*/
|
|
208
|
+
state: Map<string, unknown>;
|
|
209
|
+
/** Structured logging into the run report. */
|
|
210
|
+
log(message: string): void;
|
|
211
|
+
}
|
|
212
|
+
interface Check {
|
|
213
|
+
id: string;
|
|
214
|
+
title: string;
|
|
215
|
+
tier: Tier;
|
|
216
|
+
citations: Citation[];
|
|
217
|
+
needs: Capability[];
|
|
218
|
+
/**
|
|
219
|
+
* Capabilities the check exercises when the harness supplies them but
|
|
220
|
+
* does not need: without one it still runs, and its detail says which
|
|
221
|
+
* side of the behaviour it could not check (e.g. a refusal whose success
|
|
222
|
+
* path needs a syncer inbox). Never a substitute for `needs` when the
|
|
223
|
+
* check proves nothing without the capability.
|
|
224
|
+
*/
|
|
225
|
+
uses?: Capability[];
|
|
226
|
+
/** Creates or deletes state on the target (probe spaces, records). */
|
|
227
|
+
destructive?: boolean;
|
|
228
|
+
/** Depends on real time passing (expiry windows); excluded by default. */
|
|
229
|
+
slow?: boolean;
|
|
230
|
+
/** Overrides the runner's per-check timeout (for slow checks). */
|
|
231
|
+
timeoutMs?: number;
|
|
232
|
+
run(ctx: CheckContext): Promise<CheckOutcome>;
|
|
233
|
+
}
|
|
234
|
+
/** What a check's run() returns; the runner wraps it into a CheckResult. */
|
|
235
|
+
interface CheckOutcome {
|
|
236
|
+
status: "pass" | "fail";
|
|
237
|
+
detail: string;
|
|
238
|
+
evidence?: unknown;
|
|
239
|
+
}
|
|
240
|
+
declare const pass: (detail: string, evidence?: unknown) => CheckOutcome;
|
|
241
|
+
declare const fail: (detail: string, evidence?: unknown) => CheckOutcome;
|
|
242
|
+
//#endregion
|
|
243
|
+
//#region src/space-auth.d.ts
|
|
244
|
+
declare function isP256DidKey(value: unknown): boolean;
|
|
245
|
+
/**
|
|
246
|
+
* A P-256 key a space credential is bound to (its `cnf.kid`). Each request
|
|
247
|
+
* presenting the credential is signed by it. Transport-owned: any fresh
|
|
248
|
+
* key will do, so it is never tied to a harness identity.
|
|
249
|
+
*/
|
|
250
|
+
interface CredentialKey {
|
|
251
|
+
/** The key as a P-256 did:key — what `credentialKid` carries. */
|
|
252
|
+
did: string;
|
|
253
|
+
/** Sign with ECDSA P-256/SHA-256, returning a 64-byte compact signature. */
|
|
254
|
+
sign(bytes: Uint8Array): Promise<Uint8Array>;
|
|
255
|
+
}
|
|
256
|
+
declare function createCredentialKey(): Promise<CredentialKey>;
|
|
257
|
+
declare const SPACE_CREDENTIAL_SCHEME = "Atproto-Space-Credential";
|
|
258
|
+
interface CredentialSigOptions {
|
|
259
|
+
authorization: string;
|
|
260
|
+
audience: string;
|
|
261
|
+
/** The signature's label. Hosts find it by tag, so any label works; default `sig`. */
|
|
262
|
+
label?: string;
|
|
263
|
+
/** Parameters after `tag` (e.g. `keyid`, `alg`, `created`), in order. */
|
|
264
|
+
params?: Array<[string, string | number]>;
|
|
265
|
+
/** Covered components; defaults to exactly the two the protocol requires. */
|
|
266
|
+
components?: string[];
|
|
267
|
+
/** Replace the tag (probing hosts that must ignore other tags). */
|
|
268
|
+
tag?: string;
|
|
269
|
+
}
|
|
270
|
+
/** One signature's `Signature-Input` and `Signature` dictionary members. */
|
|
271
|
+
declare function credentialSigMembers(key: Pick<CredentialKey, "sign">, opts: CredentialSigOptions): Promise<{
|
|
272
|
+
input: string;
|
|
273
|
+
signature: string;
|
|
274
|
+
}>;
|
|
275
|
+
/**
|
|
276
|
+
* The headers that present a space credential: the `Authorization` scheme,
|
|
277
|
+
* the audience DID (the service being called — the repo DID at a repo
|
|
278
|
+
* host, the authority DID at the space host) and an RFC 9421 signature by
|
|
279
|
+
* the credential's key covering exactly those two fields, tagged
|
|
280
|
+
* `atproto-space-credential`.
|
|
281
|
+
*/
|
|
282
|
+
declare function spaceSigHeaders(key: Pick<CredentialKey, "sign">, opts: CredentialSigOptions): Promise<Record<string, string>>;
|
|
283
|
+
declare const COMMIT_MAC_PROFILE = "atproto-space-commit";
|
|
284
|
+
declare const RECORD_MAC_PROFILE = "atproto-space-record";
|
|
285
|
+
type MacProfile = typeof COMMIT_MAC_PROFILE | typeof RECORD_MAC_PROFILE;
|
|
286
|
+
/** The response header each profile's MAC covers. */
|
|
287
|
+
declare const MAC_COVERED_HEADER: Record<MacProfile, string>;
|
|
288
|
+
/**
|
|
289
|
+
* One `Accept-Signature` member asking for a MAC under `profile`, keyed by
|
|
290
|
+
* the shared secret for `keyShare`:
|
|
291
|
+
* `mac=("atproto-space-commit";sf);keyid="did:key:…";tag="atproto-space-commit"`.
|
|
292
|
+
*/
|
|
293
|
+
declare function formatMacRequest(profile: MacProfile, keyShare: string, opts?: {
|
|
294
|
+
label?: string;
|
|
295
|
+
params?: Array<[string, string | number]>;
|
|
296
|
+
}): string;
|
|
297
|
+
/**
|
|
298
|
+
* Syncer side of the space KEM: HPKE secret export (RFC 9180 §6.2) in base
|
|
299
|
+
* mode with DHKEM(P-256, HKDF-SHA256), HKDF-SHA256 and the Export-only
|
|
300
|
+
* AEAD, `info = "atproto-mac"`, an empty exporter context and L = 32 —
|
|
301
|
+
* spelled out as the ECDH and HKDF steps it performs. The returned
|
|
302
|
+
* `keyShare` is HPKE's `enc`, as a compressed did:key. Use once per request.
|
|
303
|
+
*/
|
|
304
|
+
declare function encapsulate(authorKemDidKey: string): Promise<{
|
|
305
|
+
keyShare: string;
|
|
306
|
+
sharedSecret: Uint8Array;
|
|
307
|
+
}>;
|
|
308
|
+
//#endregion
|
|
309
|
+
//#region src/http.d.ts
|
|
310
|
+
declare function xrpcUrl(origin: string, nsid: string, params?: Record<string, string | undefined>): string;
|
|
311
|
+
interface XrpcResult {
|
|
312
|
+
status: number;
|
|
313
|
+
/** Parsed JSON body, or undefined for non-JSON responses. */
|
|
314
|
+
json?: unknown;
|
|
315
|
+
/** The atproto `error` name, when the body carries one. */
|
|
316
|
+
error?: string;
|
|
317
|
+
headers: Headers;
|
|
318
|
+
response: Response;
|
|
319
|
+
}
|
|
320
|
+
/** GET an XRPC query. `headers` may carry auth. */
|
|
321
|
+
declare function xrpcGet(ctx: CheckContext, nsid: string, params?: Record<string, string | undefined>, headers?: HeadersInit): Promise<XrpcResult>;
|
|
322
|
+
/** POST an XRPC procedure with a JSON body. */
|
|
323
|
+
declare function xrpcPost(ctx: CheckContext, nsid: string, body: unknown, headers?: HeadersInit): Promise<XrpcResult>;
|
|
324
|
+
/** Add the operator's auth to a headers object, if a session is present. */
|
|
325
|
+
declare function operatorHeaders(ctx: CheckContext, extra?: HeadersInit): Promise<Headers>;
|
|
326
|
+
//#endregion
|
|
327
|
+
//#region src/checks/probe.d.ts
|
|
328
|
+
type Policy = {
|
|
329
|
+
$type: string;
|
|
330
|
+
} & Record<string, unknown>;
|
|
331
|
+
declare const personalspace: () => Policy;
|
|
332
|
+
declare const memberspace: (config?: {
|
|
333
|
+
publicRead?: boolean;
|
|
334
|
+
publicWrite?: boolean;
|
|
335
|
+
allowedApps?: string[];
|
|
336
|
+
publishPolicy?: boolean;
|
|
337
|
+
publishMembers?: boolean;
|
|
338
|
+
}) => Policy;
|
|
339
|
+
declare const managedspace: (managingApp: string, config?: {
|
|
340
|
+
publishPolicy?: boolean;
|
|
341
|
+
}) => Policy;
|
|
342
|
+
/** A public-read memberspace: anyone may obtain a credential, no token needed. */
|
|
343
|
+
declare const publicRead: () => Policy;
|
|
344
|
+
interface ProbeSpace {
|
|
345
|
+
uri: string;
|
|
346
|
+
type: string;
|
|
347
|
+
skey: string;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Create a probe space owned by the target's operator. The default policy
|
|
351
|
+
* is a closed memberspace — only the authority can read it.
|
|
352
|
+
*/
|
|
353
|
+
declare function createProbeSpace(ctx: CheckContext, policy?: Policy, skey?: string): Promise<ProbeSpace>;
|
|
354
|
+
/** Delete a probe space, best-effort (cleanup). */
|
|
355
|
+
declare function deleteProbeSpace(ctx: CheckContext, space: string): Promise<void>;
|
|
356
|
+
/** Operator creates a record in a space; returns the response. */
|
|
357
|
+
declare function operatorCreateRecord(ctx: CheckContext, space: string, collection: string, rkey: string, record: Record<string, unknown>): Promise<XrpcResult>;
|
|
358
|
+
interface Credential {
|
|
359
|
+
credential: string;
|
|
360
|
+
key: CredentialKey;
|
|
361
|
+
/** The space it was issued for. */
|
|
362
|
+
space: string;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Ask the space's authority to authorise sync. Nothing authenticates the
|
|
366
|
+
* request itself: the body carries the key to bind, and optionally a
|
|
367
|
+
* delegation token (who the user is), a client attestation (which app)
|
|
368
|
+
* and a `notify` registration.
|
|
369
|
+
*/
|
|
370
|
+
declare function requestCredential(ctx: CheckContext, space: string, opts?: {
|
|
371
|
+
delegationToken?: string;
|
|
372
|
+
clientAttestation?: string;
|
|
373
|
+
credentialKey?: string;
|
|
374
|
+
key?: CredentialKey;
|
|
375
|
+
notify?: {
|
|
376
|
+
endpoint: string;
|
|
377
|
+
token: string;
|
|
378
|
+
};
|
|
379
|
+
}): Promise<{
|
|
380
|
+
result: XrpcResult;
|
|
381
|
+
credential?: Credential;
|
|
382
|
+
spaceRev?: string;
|
|
383
|
+
}>;
|
|
384
|
+
/** A tokenless credential for a public-read space; throws if refused. */
|
|
385
|
+
declare function obtainPublicCredential(ctx: CheckContext, space: string): Promise<Credential>;
|
|
386
|
+
/**
|
|
387
|
+
* Obtain a credential the way a real app does: ask the target's own
|
|
388
|
+
* `getDelegationToken` (with the operator session) for a delegation token,
|
|
389
|
+
* then exchange it at `authorizeSpaceSync`. It needs no harness-held
|
|
390
|
+
* reader key, so it runs against any real PDS and exercises the target's
|
|
391
|
+
* own token minting.
|
|
392
|
+
*/
|
|
393
|
+
declare function obtainCredentialViaDelegation(ctx: CheckContext, space: string): Promise<{
|
|
394
|
+
result: XrpcResult;
|
|
395
|
+
credential?: Credential;
|
|
396
|
+
delegation: XrpcResult;
|
|
397
|
+
}>;
|
|
398
|
+
interface CredentialCallOptions {
|
|
399
|
+
/** Query params (GET) — or omit and pass `body` for a procedure. */
|
|
400
|
+
params?: Record<string, string | undefined>;
|
|
401
|
+
body?: unknown;
|
|
402
|
+
/**
|
|
403
|
+
* The audience DID: the service being called. Defaults to the `repo`
|
|
404
|
+
* param (a repo-host read), else the space's authority (a space-host
|
|
405
|
+
* method).
|
|
406
|
+
*/
|
|
407
|
+
audience?: string;
|
|
408
|
+
/**
|
|
409
|
+
* The MAC to ask for. Defaults to the profile of what the method returns
|
|
410
|
+
* (commit or record) for the four MAC'd reads, nothing otherwise. `false`
|
|
411
|
+
* sends no `Accept-Signature`; an object requests the profile with a
|
|
412
|
+
* custom label or extra parameters; a function builds the whole header
|
|
413
|
+
* from a fresh key share (malformed-request probes).
|
|
414
|
+
*/
|
|
415
|
+
mac?: MacProfile | false | {
|
|
416
|
+
profile: MacProfile;
|
|
417
|
+
label?: string;
|
|
418
|
+
params?: Array<[string, string | number]>;
|
|
419
|
+
} | {
|
|
420
|
+
header: (keyShare: string) => string;
|
|
421
|
+
profile: MacProfile;
|
|
422
|
+
};
|
|
423
|
+
/** Authorization scheme spelling; defaults to `Atproto-Space-Credential`. */
|
|
424
|
+
scheme?: string;
|
|
425
|
+
/** Sign with this key instead of the credential's own. */
|
|
426
|
+
signWith?: CredentialKey;
|
|
427
|
+
/** Signature label, parameters, components or tag overrides. */
|
|
428
|
+
signature?: Omit<CredentialSigOptions, "authorization" | "audience">;
|
|
429
|
+
/** Replace the signature headers wholesale (e.g. two signatures). */
|
|
430
|
+
signatureHeaders?: (defaults: Record<string, string>) => Promise<Record<string, string>>;
|
|
431
|
+
/** Send no signature headers at all. */
|
|
432
|
+
unsigned?: boolean;
|
|
433
|
+
}
|
|
434
|
+
interface CredentialResult extends XrpcResult {
|
|
435
|
+
/** The MAC request's encapsulation, when a MAC was requested. */
|
|
436
|
+
keyShare?: string;
|
|
437
|
+
sharedSecret?: Uint8Array;
|
|
438
|
+
macProfile?: MacProfile;
|
|
439
|
+
}
|
|
440
|
+
/** Present a credential on one request: signature, audience, MAC request. */
|
|
441
|
+
declare function credentialCall(ctx: CheckContext, credential: Credential, nsid: string, opts?: CredentialCallOptions): Promise<CredentialResult>;
|
|
442
|
+
/** A credential-authenticated GET with the default audience and MAC request. */
|
|
443
|
+
declare function credentialGet(ctx: CheckContext, credential: Credential, nsid: string, params: Record<string, string | undefined>): Promise<CredentialResult>;
|
|
444
|
+
//#endregion
|
|
445
|
+
//#region src/inbox.d.ts
|
|
446
|
+
interface SyncerInboxHandle {
|
|
447
|
+
inbox: SyncerInbox;
|
|
448
|
+
/** Serve a request addressed to the inbox's endpoint. */
|
|
449
|
+
handle(request: Request): Promise<Response>;
|
|
450
|
+
/** Every delivery so far, oldest first. */
|
|
451
|
+
deliveries(): readonly InboxDelivery[];
|
|
452
|
+
}
|
|
453
|
+
declare function createSyncerInbox(opts: {
|
|
454
|
+
/** Base URL the target will call (`{endpoint}/xrpc/<nsid>`). */
|
|
455
|
+
endpoint: string;
|
|
456
|
+
/** A `did#serviceId` reference resolving to `endpoint` (managing app). */
|
|
457
|
+
service: string;
|
|
458
|
+
}): SyncerInboxHandle;
|
|
459
|
+
//#endregion
|
|
460
|
+
//#region src/checks/operator.d.ts
|
|
461
|
+
/**
|
|
462
|
+
* The operator catalog: runnable anywhere the harness has an operator
|
|
463
|
+
* session — browser included.
|
|
464
|
+
*/
|
|
465
|
+
declare const operatorChecks: Check[];
|
|
466
|
+
//#endregion
|
|
467
|
+
//#region src/checks/base.d.ts
|
|
468
|
+
/** Checks that need no crypto and no session — safe in any transport. */
|
|
469
|
+
declare const baseChecks: Check[];
|
|
470
|
+
//#endregion
|
|
471
|
+
export { fail as $, MAC_COVERED_HEADER as A, Capability as B, operatorHeaders as C, COMMIT_MAC_PROFILE as D, xrpcUrl as E, credentialSigMembers as F, CheckStatus as G, CheckContext as H, encapsulate as I, IdentityProvider as J, Citation as K, formatMacRequest as L, RECORD_MAC_PROFILE as M, SPACE_CREDENTIAL_SCHEME as N, CredentialKey as O, createCredentialKey as P, Tier as Q, isP256DidKey as R, XrpcResult as S, xrpcPost as T, CheckOutcome as U, Check as V, CheckResult as W, SyncerInbox as X, InboxDelivery as Y, Target as Z, obtainPublicCredential as _, Credential as a, publicRead as b, Policy as c, credentialCall as d, pass as et, credentialGet as f, obtainCredentialViaDelegation as g, memberspace as h, createSyncerInbox as i, MacProfile as j, CredentialSigOptions as k, ProbeSpace as l, managedspace as m, operatorChecks as n, CredentialCallOptions as o, deleteProbeSpace as p, HarnessIdentity as q, SyncerInboxHandle as r, CredentialResult as s, baseChecks as t, createProbeSpace as u, operatorCreateRecord as v, xrpcGet as w, requestCredential as x, personalspace as y, spaceSigHeaders as z };
|
|
472
|
+
//# sourceMappingURL=base-CGsQgOwR.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-CGsQgOwR.d.ts","names":[],"sources":["../src/model.ts","../src/space-auth.ts","../src/http.ts","../src/checks/probe.ts","../src/inbox.ts","../src/checks/operator.ts","../src/checks/base.ts"],"sourcesContent":[],"mappings":";;AAiBA;AAGA;AAwDA;AASA;AAMA;;;;;AAkBA;;;;;AAQA;AAeiB,KAnHL,IAAA,GAmHgB,MAAA,GAAA,QAAA,GAAA,MAAA;;AAmBhB,UAnIK,QAAA,CAmIL;EAAR;;;;AA0BJ;AAaA;AAcA;;;;;;EAeiB,MAAA,EAAA,SAAA,GAAA,UAAA,GAAA,iBAAA,GAAA,WAAA,GAAA,WAAA;EAIH;;;;;AAmBd;EAGO,GAAA,EAAA,MAAA;;;;;;;;AAqBP;AAMA;AAMA;;;;AC1JA;AAeA;;;;;AAOA;AAuEA;AAWA;AAcA;;;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EACR,OAAA,EAAA,MAAA;CACM,CAAA,EIxKX,iBJwKW;;;AA1Ef;;;;AA2BuB,cKjHV,cLiHU,EKjHM,KLiHN,EAAA;;;;AA9DX,cMmGC,UNnGD,EMmGa,KNnGb,EAAA"}
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
4
|
-
import { n as KeypairIdentityProvider, t as fullCatalog } from "./full-
|
|
2
|
+
import { dt as filterCatalog } from "./descriptors-BUCV_BuG.js";
|
|
3
|
+
import { a as renderReport, n as coverageReport, o as runChecks, s as ALPHA_BUILD } from "./coverage-cK1NBo-P.js";
|
|
4
|
+
import { n as KeypairIdentityProvider, t as fullCatalog } from "./full-CKsHg6ox.js";
|
|
5
5
|
import { parseArgs } from "node:util";
|
|
6
6
|
import { readFileSync, writeFileSync } from "node:fs";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
@@ -18,8 +18,6 @@ import { NodeOAuthClient } from "@atproto/oauth-client-node";
|
|
|
18
18
|
* bin so it can be driven in tests against an injected fetch without
|
|
19
19
|
* spawning a process.
|
|
20
20
|
*/
|
|
21
|
-
/** The alpha build the suite's verifiers are pinned to (from our deps). */
|
|
22
|
-
const ALPHA_BUILD = "0.0.0-spaces-alpha-20260818163953";
|
|
23
21
|
async function runConformance(options) {
|
|
24
22
|
const doFetch = options.fetch ?? fetch;
|
|
25
23
|
const origin = options.origin.replace(/\/+$/, "");
|
|
@@ -39,7 +37,8 @@ async function runConformance(options) {
|
|
|
39
37
|
target: {
|
|
40
38
|
origin,
|
|
41
39
|
did,
|
|
42
|
-
implementation: options.implementation
|
|
40
|
+
implementation: options.implementation,
|
|
41
|
+
...options.plcDirectory ? { plcDirectory: options.plcDirectory } : {}
|
|
43
42
|
},
|
|
44
43
|
fetch: doFetch,
|
|
45
44
|
...options.operatorFetch ? { operator: {
|
|
@@ -98,20 +97,25 @@ async function resolveDid(doFetch, origin) {
|
|
|
98
97
|
* OAuth loopback sign-in for the CLI — the `gh auth login` shape: start an
|
|
99
98
|
* ephemeral 127.0.0.1 callback server, register as an atproto loopback
|
|
100
99
|
* client, open the authorization URL in the user's browser, and exchange
|
|
101
|
-
* the callback for a
|
|
100
|
+
* the callback for a session.
|
|
102
101
|
*
|
|
103
102
|
* This is the auth path that involves no password at all and works against
|
|
104
|
-
* any PDS with an atproto OAuth server.
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
103
|
+
* any PDS with an atproto OAuth server. OAuth access tokens are DPoP-bound
|
|
104
|
+
* (RFC 9449 — unrelated to space credentials, which carry their own HTTP
|
|
105
|
+
* message signature), so the run authenticates through `operator.fetch`,
|
|
106
|
+
* with the client library signing every request (and handling nonce
|
|
107
|
+
* challenges) rather than a static header.
|
|
108
108
|
*/
|
|
109
109
|
/**
|
|
110
110
|
* The scope the conformance run signs in with: generic repo access (for
|
|
111
|
-
* uploadBlob) plus
|
|
112
|
-
*
|
|
111
|
+
* uploadBlob) plus every space action and management op on the probe space
|
|
112
|
+
* type. `authority=*` because the suite deliberately addresses spaces it
|
|
113
|
+
* does not own — NotSpaceOwner refusals, and writes into a foreign
|
|
114
|
+
* authority's space — and a `self`-only grant would turn those into scope
|
|
115
|
+
* refusals before the host's own check is reached. The grant is still
|
|
116
|
+
* confined to the probe type. Mirrors the web checker.
|
|
113
117
|
*/
|
|
114
|
-
const OAUTH_SCOPE = "atproto transition:generic space:
|
|
118
|
+
const OAUTH_SCOPE = "atproto transition:generic space:earth.cirrus.check.space?authority=*&collection=*&manage=create&manage=update&manage=delete";
|
|
115
119
|
/** How long to wait for the user to complete the browser flow. */
|
|
116
120
|
const CALLBACK_TIMEOUT_MS = 300 * 1e3;
|
|
117
121
|
/**
|
|
@@ -227,8 +231,9 @@ async function sessionSignOut(session) {
|
|
|
227
231
|
* space-conformance CLI.
|
|
228
232
|
*
|
|
229
233
|
* space-conformance run --target https://host [--did did:...] \
|
|
230
|
-
* [--handle alice.example.com] [--oauth]
|
|
231
|
-
* [--destructive] [--tier must,should]
|
|
234
|
+
* [--plc https://plc.directory] [--handle alice.example.com] [--oauth] \
|
|
235
|
+
* [--standalone-host] [--destructive] [--tier must,should] \
|
|
236
|
+
* [--report out.json] [--json]
|
|
232
237
|
* space-conformance coverage [--json]
|
|
233
238
|
*
|
|
234
239
|
* Operator auth (any one of):
|
|
@@ -293,11 +298,12 @@ async function main(argv) {
|
|
|
293
298
|
const report = coverageReport(fullCatalog);
|
|
294
299
|
if (values.json) process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
|
|
295
300
|
else {
|
|
296
|
-
process.stdout.write(`${report.covered.length}/${report.requirements.length} requirements covered, ${report.gaps.length} gaps\n`);
|
|
301
|
+
process.stdout.write(`${report.covered.length}/${report.requirements.length} requirements covered, ${report.exempt.length} exempt, ${report.gaps.length} gaps\n`);
|
|
297
302
|
for (const gap of report.gaps) process.stdout.write(` gap: ${gap.ref}\n`);
|
|
298
303
|
for (const d of report.danglingCitations) process.stdout.write(` dangling: ${d.checkId} → ${d.ref}\n`);
|
|
304
|
+
for (const e of report.staleExemptions) process.stdout.write(` stale exemption: ${e.ref}\n`);
|
|
299
305
|
}
|
|
300
|
-
return report.danglingCitations.length > 0 ? 1 : 0;
|
|
306
|
+
return report.danglingCitations.length > 0 || report.gaps.length > 0 || report.staleExemptions.length > 0 ? 1 : 0;
|
|
301
307
|
}
|
|
302
308
|
if (command === "run") {
|
|
303
309
|
const { values } = parseArgs({
|
|
@@ -305,6 +311,7 @@ async function main(argv) {
|
|
|
305
311
|
options: {
|
|
306
312
|
target: { type: "string" },
|
|
307
313
|
did: { type: "string" },
|
|
314
|
+
plc: { type: "string" },
|
|
308
315
|
implementation: { type: "string" },
|
|
309
316
|
"operator-token": { type: "string" },
|
|
310
317
|
handle: { type: "string" },
|
|
@@ -341,6 +348,7 @@ async function main(argv) {
|
|
|
341
348
|
const report = await runConformance({
|
|
342
349
|
origin,
|
|
343
350
|
did: values.did,
|
|
351
|
+
plcDirectory: values.plc,
|
|
344
352
|
implementation: values.implementation,
|
|
345
353
|
operatorToken,
|
|
346
354
|
operatorFetch: oauthOperator?.fetch,
|