@interop/was-client 0.95.0 → 0.97.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/WasClient.js CHANGED
@@ -1,4 +1,4 @@
1
- import { collectionItemsUrl, parseSpaceTarget } from './internal/paths.js';
1
+ import { baseUrlOfSpacesUrl, collectionItemsUrl, parseSpaceTarget, spacesUrl } from './internal/paths.js';
2
2
  import { send, rawRequest, unsignedRequest } from './internal/request.js';
3
3
  import { createdId, parseResource, readJsonData } from './internal/content.js';
4
4
  import { buildPageWalk, collectPages, collectWalk, signedPageWalk, walkItems, walkPagesOrEmpty } from './internal/pagination.js';
@@ -6,19 +6,36 @@ import { delegateGrant } from './internal/grant.js';
6
6
  import { spaceIdOf, submitRevocation } from './internal/revoke.js';
7
7
  import { Memo } from './internal/memo.js';
8
8
  import { discoverService, selectServiceVersion } from './internal/service.js';
9
- import { NotSupportedError, ValidationError, WasServerError } from './errors.js';
9
+ import { IncompatibleServerError, NotSupportedError, ValidationError, WasServerError } from './errors.js';
10
10
  import { zcapClientForSigner } from './zcapClient.js';
11
11
  import { Space } from './Space.js';
12
12
  import { Collection } from './Collection.js';
13
13
  import { Resource } from './Resource.js';
14
14
  export class WasClient {
15
+ /**
16
+ * The server's Spaces Repository URL, in canonical trailing-slash form
17
+ * (`https://host/spaces/`). Service discovery starts here.
18
+ */
15
19
  serverUrl;
20
+ /**
21
+ * The server base URL every Space path hangs off, without a trailing slash:
22
+ * the parent of {@link serverUrl} (`https://host`, or `https://host/was` on
23
+ * a sub-path mount). Zcap `invocationTarget`s are built beneath it.
24
+ */
25
+ baseUrl;
16
26
  zcapClient;
17
27
  encryption;
18
28
  /**
19
29
  * @param options {object}
20
- * @param options.serverUrl {string} base URL for both URL building and
21
- * zcap `invocationTarget`s
30
+ * @param options.serverUrl {string} the server's Spaces Repository URL
31
+ * (`https://host/spaces/`, or `https://host/was/spaces/` on a sub-path
32
+ * mount). The base URL for Space paths and zcap `invocationTarget`s is
33
+ * its parent. Service discovery starts from this URL rather than from the
34
+ * base, which is often a landing page with no `service` link. The value
35
+ * is normalized to canonical form; `baseUrlOfSpacesUrl` in `./paths`
36
+ * states what is accepted. The client is built from this URL only: a
37
+ * server with no Spaces Repository (the spec leaves the endpoint
38
+ * optional) has no URL this constructor accepts and is not supported.
22
39
  * @param options.zcapClient {ZcapClient} an ezcap client holding the signer
23
40
  * @param [options.encryption] {EncryptionProvider} the keystore that
24
41
  * supplies keys for collections declared encrypted (by their `encryption`
@@ -31,11 +48,20 @@ export class WasClient {
31
48
  * description the caller already holds (from a cache, say). The client
32
49
  * selects its version from this copy instead of discovering the document
33
50
  * from `serverUrl`, and still refuses it with `IncompatibleServerError` if
34
- * it names no version this client speaks. `service({ refresh: true })`
35
- * discards it and discovers afresh.
51
+ * it names no version this client speaks or advertises a Spaces Repository
52
+ * other than `serverUrl`. `service({ refresh: true })` discards it and
53
+ * discovers afresh.
54
+ * @throws {ValidationError} when `serverUrl` is not a Spaces Repository URL
36
55
  */
37
56
  constructor({ serverUrl, zcapClient, encryption, serviceDescription }) {
38
- this.serverUrl = serverUrl;
57
+ const baseUrl = baseUrlOfSpacesUrl(serverUrl);
58
+ if (baseUrl === null) {
59
+ throw new ValidationError(`serverUrl "${serverUrl}" is not a Spaces Repository URL. Pass the ` +
60
+ "server's `/spaces/` URL as an absolute URL, for example " +
61
+ '"https://host/spaces/".');
62
+ }
63
+ this.serverUrl = spacesUrl({ baseUrl });
64
+ this.baseUrl = baseUrl;
39
65
  this.zcapClient = zcapClient;
40
66
  this.encryption = encryption;
41
67
  this.#serviceDescription = serviceDescription;
@@ -79,16 +105,36 @@ export class WasClient {
79
105
  return signer.id.split('#')[0];
80
106
  }
81
107
  #serviceDescription;
82
- #service = new Memo(async () => this.#serviceDescription === undefined
83
- ? discoverService({ url: this.serverUrl })
84
- : selectServiceVersion(this.#serviceDescription));
108
+ #service = new Memo(async () => {
109
+ const info = this.#serviceDescription === undefined
110
+ ? await discoverService({ url: this.serverUrl })
111
+ : selectServiceVersion(this.#serviceDescription);
112
+ // Every Space path is built beneath the parent of `serverUrl`, so a server
113
+ // that advertises its Spaces Repository elsewhere would be addressed at
114
+ // the wrong mount. Refuse it by name rather than misroute. Both sides are
115
+ // compared in canonical base-URL form, so an advertised value that differs
116
+ // only in serialization (host case, default port, trailing slash) passes.
117
+ if (info.spacesUrl !== undefined) {
118
+ const advertisedBase = baseUrlOfSpacesUrl(info.spacesUrl);
119
+ if (advertisedBase !== this.baseUrl) {
120
+ const why = advertisedBase === null
121
+ ? `which is not a Spaces Repository URL (an absolute http(s) ` +
122
+ `URL ending in a "spaces" segment, with no query or fragment).`
123
+ : `but this client was given "${this.serverUrl}".`;
124
+ throw new IncompatibleServerError(`The server advertises its Spaces Repository at ` +
125
+ `"${info.spacesUrl}", ${why}`, { requestUrl: this.serverUrl });
126
+ }
127
+ }
128
+ return info;
129
+ });
85
130
  /**
86
131
  * Discovers the server's service description and the WAS version this
87
132
  * client speaks with it. Follows the `rel="service"` link on the response to
88
- * an unsigned `HEAD` of `serverUrl`, then reads the linked document with an
89
- * unsigned `GET`. No capability is invoked. The result is memoized for the
90
- * life of the client and shared by every handle; concurrent callers share
91
- * one discovery, and a failure is not memoized, so the next call retries.
133
+ * an unsigned `HEAD` of `serverUrl` (the Spaces Repository URL), then reads
134
+ * the linked document with an unsigned `GET`. No capability is invoked. The
135
+ * result is memoized for the life of the client and shared by every handle;
136
+ * concurrent callers share one discovery, and a failure is not memoized, so
137
+ * the next call retries.
92
138
  *
93
139
  * Every signed request waits on this discovery, so a caller rarely needs to
94
140
  * call it first. It is the way to read the server-wide affordances:
@@ -105,8 +151,9 @@ export class WasClient {
105
151
  * advertising
106
152
  * @returns {Promise<ServiceInfo>}
107
153
  * @throws {IncompatibleServerError} when the server's responses carry no
108
- * `service` link (it predates v0.5), the document is malformed, or it
109
- * lists no version this client speaks
154
+ * `service` link (it predates v0.5), the document is malformed, it lists
155
+ * no version this client speaks, or it advertises a Spaces Repository URL
156
+ * other than `serverUrl`
110
157
  */
111
158
  async service(options = {}) {
112
159
  if (options.refresh) {
@@ -116,30 +163,31 @@ export class WasClient {
116
163
  return this.#service.get();
117
164
  }
118
165
  /**
119
- * The Spaces Repository URL from the service description.
166
+ * Waits for discovery and refuses a server whose service description has no
167
+ * Spaces Repository. Discovery has already checked that an advertised
168
+ * `spaces` URL names `serverUrl`, so callers address `serverUrl` directly.
120
169
  *
121
- * @returns {Promise<string>}
170
+ * @returns {Promise<void>}
122
171
  * @throws {NotSupportedError} when the server does not implement the
123
172
  * Spaces Repository
124
173
  */
125
- async #spacesUrl() {
174
+ async #assertSpacesRepository() {
126
175
  const { spacesUrl, version } = await this.service();
127
176
  if (spacesUrl === undefined) {
128
- throw new NotSupportedError(`The server at "${this.serverUrl}" does not implement the Spaces ` +
177
+ throw new NotSupportedError(`The server at "${this.baseUrl}" does not implement the Spaces ` +
129
178
  `Repository: its WAS ${version} service description entry has no ` +
130
179
  '`spaces` URL.');
131
180
  }
132
- return spacesUrl;
133
181
  }
134
182
  #cachedContext;
135
183
  get #context() {
136
- // `serverUrl`, `zcapClient` and `encryption` are all constructor-fixed, so
184
+ // `baseUrl`, `zcapClient` and `encryption` are all constructor-fixed, so
137
185
  // the context is derived once and reused rather than reallocating the
138
186
  // object on every handle access.
139
187
  if (this.#cachedContext === undefined) {
140
188
  const readControllerDid = () => this.controllerDid;
141
189
  this.#cachedContext = {
142
- serverUrl: this.serverUrl,
190
+ baseUrl: this.baseUrl,
143
191
  zcapClient: this.zcapClient,
144
192
  // Read lazily, so building a handle costs nothing and a
145
193
  // delegation-only client (a `ZcapClient` with a delegation signer and
@@ -200,8 +248,9 @@ export class WasClient {
200
248
  ...(desc.name !== undefined && { name: desc.name }),
201
249
  ...(desc.type !== undefined && { type: desc.type })
202
250
  };
251
+ await this.#assertSpacesRepository();
203
252
  const response = await send(this.#context, {
204
- url: await this.#spacesUrl(),
253
+ url: this.serverUrl,
205
254
  method: 'POST',
206
255
  json: body
207
256
  });
@@ -229,9 +278,9 @@ export class WasClient {
229
278
  * @throws {NotSupportedError} when the server has no Spaces Repository
230
279
  */
231
280
  async listSpaces() {
232
- const spacesUrl = await this.#spacesUrl();
281
+ await this.#assertSpacesRepository();
233
282
  const walk = await signedPageWalk(this.#context, {
234
- firstUrl: spacesUrl
283
+ firstUrl: this.serverUrl
235
284
  });
236
285
  // The first page always carries the listing body (an unauthorized caller
237
286
  // still gets an empty `items` list, not an error), so a `null` walk is a
@@ -239,7 +288,7 @@ export class WasClient {
239
288
  // body did not parse as JSON. Report it as one, rather than as a
240
289
  // `TypeError` from destructuring `null`.
241
290
  if (walk === null) {
242
- throw new WasServerError(`The space listing at "${spacesUrl}" answered with no JSON body.`);
291
+ throw new WasServerError(`The space listing at "${this.serverUrl}" answered with no JSON body.`);
243
292
  }
244
293
  const listing = await collectPages(walk);
245
294
  // A paginating server omits `totalItems` on truncated pages; the walk has
@@ -353,8 +402,8 @@ export class WasClient {
353
402
  catch (err) {
354
403
  throw new ValidationError(`invocationTarget "${target}" is not a valid absolute URL.`, { cause: err });
355
404
  }
356
- // `parseSpaceTarget` owns the path grammar: it strips `serverUrl`'s base
357
- // path first (so a WAS mounted under a sub-path -- `https://host/was/` --
405
+ // `parseSpaceTarget` owns the path grammar: it strips `baseUrl`'s path
406
+ // first (so a WAS mounted under a sub-path -- `https://host/was/` --
358
407
  // classifies just as a bare-origin deployment does, which `parseSpacePath`
359
408
  // alone cannot) and percent-decodes each segment, since the path builders
360
409
  // re-encode every id. Classifying the full segment list -- rather than
@@ -362,10 +411,10 @@ export class WasClient {
362
411
  // (`/space/s/policy`, `/space/s/c/r/meta`, ...) from being silently
363
412
  // truncated to the nearest containment handle, whose derived URLs would
364
413
  // mismatch the capability's invocation target.
365
- const parsed = parseSpaceTarget({ serverUrl: this.serverUrl, target });
414
+ const parsed = parseSpaceTarget({ baseUrl: this.baseUrl, target });
366
415
  if (parsed === null) {
367
416
  throw new ValidationError(`Cannot derive a handle from invocationTarget "${target}": it does ` +
368
- `not address a resource on "${this.serverUrl}".`);
417
+ `not address a resource on "${this.baseUrl}".`);
369
418
  }
370
419
  if (parsed.kind === 'sub-resource') {
371
420
  throw new ValidationError(`invocationTarget "${target}" addresses a reserved ` +
@@ -428,7 +477,7 @@ export class WasClient {
428
477
  }
429
478
  /**
430
479
  * The signed escape hatch, mirroring ezcap's generic `request()`. Resolves
431
- * `path` against `serverUrl`, defaults `action` to `method`, and signs via the
480
+ * `path` against `baseUrl`, defaults `action` to `method`, and signs via the
432
481
  * wrapped client. Returns the raw `HttpResponse` and throws raw ky/ezcap
433
482
  * errors -- it does not apply the null-on-404 or typed-error conveniences.
434
483
  * Like every signed request it waits on {@link service} first, and rejects
@@ -1 +1 @@
1
- {"version":3,"file":"WasClient.js","sourceRoot":"","sources":["../src/WasClient.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAE1E,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACzE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAC9E,OAAO,EACL,aAAa,EACb,YAAY,EACZ,WAAW,EACX,cAAc,EACd,SAAS,EACT,gBAAgB,EACjB,MAAM,0BAA0B,CAAA;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AACzC,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAC7E,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAEr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Y;gBACjC,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,UAAU,EAAE,IAAI;aACjB,CAAC,CAAA;QACJ,CAAC;QACD,IAAI,MAAM,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;YACjC,OAAO,IAAI,UAAU,CAAC;gBACpB,OAAO;gBACP,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,YAAY,EAAE,MAAM,CAAC,YAAY;gBACjC,UAAU,EAAE,IAAI;aACjB,CAAC,CAAA;QACJ,CAAC;QACD,OAAO,IAAI,KAAK,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAA;IAC1E,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,KAAK,CAAC,OAAqB;QAC/B,OAAO,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAC9C,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,MAAM,CAAC,IAAoB;QAC/B,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAA;QAC7B,OAAO,gBAAgB,CAAC,OAAO,EAAE;YAC/B,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC;YACjC,IAAI;SACL,CAAC,CAAA;IACJ,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,OAAO,CAAC,OAAqB;QACjC,OAAO,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAC3C,CAAC;CACF"}
@@ -26,6 +26,15 @@ import type { IKeyAgreementKey, IKeyResolver } from '@interop/data-integrity-cor
26
26
  */
27
27
  export declare const BOOTSTRAP_HANDLE = "bootstrap";
28
28
  export declare const BOOTSTRAP_KEY_NAME = "bootstrap-key";
29
+ /**
30
+ * The key-agreement key a profile derivation hands out: the EDV cipher's
31
+ * `IKeyAgreementKey` contract plus the X25519 public key multibase
32
+ * (`z6LS...`) a caller publishes as the key's verification method, so a
33
+ * consumer reads the multibase off the key with no cast.
34
+ */
35
+ export type ProfileKeyAgreementKey = IKeyAgreementKey & {
36
+ publicKeyMultibase: string;
37
+ };
29
38
  /**
30
39
  * The agents derived from a controller secret or seed: the signing
31
40
  * CapabilityAgent / did:key, a ZcapClient for signing storage requests, and
@@ -35,7 +44,7 @@ export interface ProfileAgents {
35
44
  controllerDid: string;
36
45
  keyAgent: CapabilityAgent;
37
46
  zcapClient: ZcapClient;
38
- keyAgreementKey: IKeyAgreementKey;
47
+ keyAgreementKey: ProfileKeyAgreementKey;
39
48
  keyResolver: IKeyResolver;
40
49
  }
41
50
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/identity/agents.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE3C,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACb,MAAM,8BAA8B,CAAA;AAKrC;;;GAGG;AACH,eAAO,MAAM,gBAAgB,cAAc,CAAA;AAC3C,eAAO,MAAM,kBAAkB,kBAAkB,CAAA;AAEjD;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,eAAe,CAAA;IACzB,UAAU,EAAE,UAAU,CAAA;IACtB,eAAe,EAAE,gBAAgB,CAAA;IACjC,WAAW,EAAE,YAAY,CAAA;CAC1B;AAED;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAAC,EACnC,IAAI,EACL,EAAE;IACD,IAAI,EAAE,UAAU,CAAA;CACjB,GAAG,OAAO,CAAC,aAAa,CAAC,CAYzB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,MAAM,EACP,E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AAkB,CAAC,EACjC,QAAQ,EACT,EAAE;IACD,QAAQ,EAAE,eAAe,CAAA;CAC1B,GAAG,aAAa,CAqBhB"}
@@ -106,7 +106,8 @@ export function agentsFromKeyAgent({ keyAgent }) {
106
106
  keyAgent,
107
107
  zcapClient,
108
108
  // `id` is always set on the KAK here (a controller was supplied at
109
- // derivation), so it satisfies IKeyAgreementKey's required `id`.
109
+ // derivation), so it satisfies IKeyAgreementKey's required `id`; the
110
+ // conversion always sets `publicKeyMultibase`.
110
111
  keyAgreementKey: keyAgreementKey,
111
112
  keyResolver
112
113
  };
@@ -1 +1 @@
1
- {"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/identity/agents.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAA;AAK7E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAEpD;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,WAAW,CAAA;AAC3C,MAAM,CAAC,MAAM,kBAAkB,GAAG,eAAe,CAAA;AAejD;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,EACnC,IAAI,EAGL;IACC,IAAI,IAAI,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QACvB,MAAM,IAAI,eAAe,CACvB,gCAAgC,IAAI,CAAC,MAAM,SAAS,CACrD,CAAA;IACH,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,QAAQ,CAAC;QAC9C,IAAI;QACJ,MAAM,EAAE,gBAAgB;QACxB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,gBAAgB;QACxB,OAAO,EAAE,kBAAkB;KAC5B,CAAC,CAAA;IACF,OAAO,kBAAkB,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAA;AACzC,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,kBAAkB,CAAC,EACjC,QAAQ,EAGT;IACC,MAAM,MAAM,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAA;IACnC,sEAAsE;IACtE,WAAW;IACX,MAAM,UAAU,GAAG,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAA;IAElD,MAAM,eAAe,GAAG,yBAAyB,CAAC,WAAW,CAC3D,QAAQ,CAAC,sBAAsB,EAAE,CAClC,CAAA;IACD,MAAM,WAAW,GAAG,iBAAiB,CAAC,EAAE,eAAe,EAAE,CAAC,CAAA;IAE1D,OAAO;QACL,aAAa,EAAE,QAAQ,CAAC,EAAE;QAC1B,QAAQ;QACR,UAAU;QACV,mEAAmE;QACnE,qEAAqE;QACrE,+CAA+C;QAC/C,eAAe,EAAE,eAAyC;QAC1D,WAAW;KACZ,CAAA;AACH,CAAC"}
@@ -10,6 +10,6 @@
10
10
  * root.
11
11
  */
12
12
  export { BOOTSTRAP_HANDLE, BOOTSTRAP_KEY_NAME, agentsFromKeyAgent, agentsFromSecret, agentsFromSeed } from './agents.js';
13
- export type { ProfileAgents } from './agents.js';
13
+ export type { ProfileAgents, ProfileKeyAgreementKey } from './agents.js';
14
14
  export { singleKeyResolver } from './keyResolver.js';
15
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/identity/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;GAOG;AACH,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACf,MAAM,aAAa,CAAA;AACpB,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/identity/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;GAOG;AACH,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACf,MAAM,aAAa,CAAA;AACpB,YAAY,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA"}
@@ -12,16 +12,16 @@ import { ValidationError } from '../errors.js';
12
12
  * target -- hence the object form in `revoke.ts`.)
13
13
  *
14
14
  * @param options {object}
15
- * @param options.serverUrl {string} the client's server base URL
15
+ * @param options.baseUrl {string} the client's server base URL
16
16
  * @param options.target {string} the absolute grant target URL
17
17
  * @returns {string | undefined}
18
18
  */
19
- function spaceRootCapabilityId({ serverUrl, target }) {
20
- const parsed = parseSpaceTarget({ serverUrl, target });
19
+ function spaceRootCapabilityId({ baseUrl, target }) {
20
+ const parsed = parseSpaceTarget({ baseUrl, target });
21
21
  if (parsed === null) {
22
22
  return undefined;
23
23
  }
24
- const spaceUrl = toUrl({ serverUrl, path: spacePath(parsed.spaceId) });
24
+ const spaceUrl = toUrl({ baseUrl, path: spacePath(parsed.spaceId) });
25
25
  return rootCapabilityId(spaceUrl);
26
26
  }
27
27
  /**
@@ -48,7 +48,7 @@ export async function delegateGrant(context, { to, actions, expires, target, cap
48
48
  const parent = capability ??
49
49
  (target === undefined
50
50
  ? undefined
51
- : spaceRootCapabilityId({ serverUrl: context.serverUrl, target }));
51
+ : spaceRootCapabilityId({ baseUrl: context.baseUrl, target }));
52
52
  return context.zcapClient.delegate({
53
53
  controller: to,
54
54
  invocationTarget: target,
@@ -97,7 +97,7 @@ export function allowsAction({ zcap, action }) {
97
97
  export async function delegateGrantAt(context, { path, options, capability }) {
98
98
  return delegateGrant(context, {
99
99
  ...options,
100
- target: options.target ?? toUrl({ serverUrl: context.serverUrl, path }),
100
+ target: options.target ?? toUrl({ baseUrl: context.baseUrl, path }),
101
101
  capability: options.capability ?? capability
102
102
  });
103
103
  }
@@ -1 +1 @@
1
- {"version":3,"file":"grant.js","sourceRoot":"","sources":["../../src/internal/grant.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAG9C;;;;;;;;;;;;;;GAcG;AACH,SAAS,qBAAqB,CAAC,EAC7B,SAAS,EACT,MAAM,EAIP;IACC,MAAM,MAAM,GAAG,gBAAgB,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAA;IACtD,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,MAAM,QAAQ,GAAG,KAAK,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;IACtE,OAAO,gBAAgB,CAAC,QAAQ,CAAC,CAAA;AACnC,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,OAAsB,EACtB,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAgB;IAE1D,2EAA2E;IAC3E,6EAA6E;IAC7E,0EAA0E;IAC1E,2CAA2C;IAC3C,IAAI,MAAM,KAAK,SAAS,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QACrD,MAAM,IAAI,eAAe,CACvB,oEAAoE;YAClE,uEAAuE,CAC1E,CAAA;IACH,CAAC;IACD,MAAM,MAAM,GACV,UAAU;QACV,CAAC,MAAM,KAAK,SAAS;YACnB,CAAC,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,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,UAAU;KAC7C,CAAC,CAAA;AACJ,CAAC"}
@@ -147,21 +147,52 @@ export declare function resourcePolicy(spaceId: string, collectionId: string, re
147
147
  * @returns {string}
148
148
  */
149
149
  export declare function resourceChunkPath(spaceId: string, collectionId: string, resourceId: string, chunkIndex: number): string;
150
+ /**
151
+ * The Spaces Repository URL beneath a server base URL: the reserved `spaces`
152
+ * segment at the server root, in canonical trailing-slash form. This is the
153
+ * URL a `WasClient` is constructed with (its `serverUrl`), so a consumer that
154
+ * holds only a Space or Collection URL forms the client's `serverUrl` from the
155
+ * base `parseAbsoluteSpaceTarget` reads off it.
156
+ *
157
+ * @param options {object}
158
+ * @param options.baseUrl {string} the server base URL
159
+ * @returns {string}
160
+ */
161
+ export declare function spacesUrl({ baseUrl }: {
162
+ baseUrl: string;
163
+ }): string;
164
+ /**
165
+ * The server base URL a Spaces Repository URL sits beneath: everything before
166
+ * its final `spaces` segment, without a trailing slash, so
167
+ * `https://host/was/spaces/` yields `https://host/was` and
168
+ * `https://host/spaces/` yields `https://host`. A trailing run of slashes is
169
+ * collapsed first, so `https://host/spaces` and `https://host/spaces//` read
170
+ * the same. The result is in `URL` canonical form (lower-case host, default
171
+ * port dropped), so two serializations of one URL compare equal.
172
+ *
173
+ * Returns `null` when `url` is not an absolute `http(s)` URL, its last path
174
+ * segment is not `spaces`, it has an empty path segment (`https://host//spaces`),
175
+ * or it carries a query or fragment; the caller chooses the error.
176
+ *
177
+ * @param url {string} a Spaces Repository URL
178
+ * @returns {string | null}
179
+ */
180
+ export declare function baseUrlOfSpacesUrl(url: string): string | null;
150
181
  /**
151
182
  * Resolves a path against the server base URL, producing an absolute URL
152
183
  * string suitable for zcap `invocationTarget`s.
153
184
  *
154
- * The path is joined onto `serverUrl`'s base path rather than its origin, so a
155
- * WAS deployment mounted under a sub-path (e.g. `https://host/was/`) keeps that
156
- * prefix. A bare-origin `serverUrl` behaves as before.
185
+ * The path is joined onto `baseUrl`'s path rather than its origin, so a WAS
186
+ * deployment mounted under a sub-path (e.g. `https://host/was`) keeps that
187
+ * prefix. A bare-origin `baseUrl` behaves as before.
157
188
  *
158
189
  * @param options {object}
159
- * @param options.serverUrl {string} the server base URL
190
+ * @param options.baseUrl {string} the server base URL
160
191
  * @param options.path {string} a leading-slash path (e.g. `/space/x`)
161
192
  * @returns {string}
162
193
  */
163
- export declare function toUrl({ serverUrl, path }: {
164
- serverUrl: string;
194
+ export declare function toUrl({ baseUrl, path }: {
195
+ baseUrl: string;
165
196
  path: string;
166
197
  }): string;
167
198
  /**
@@ -200,21 +231,22 @@ export type ParsedSpacePath = {
200
231
  };
201
232
  /**
202
233
  * Classifies an absolute `target` URL that is expected to live on this server,
203
- * relative to `serverUrl`'s base path -- so a WAS mounted under a sub-path (e.g.
234
+ * relative to `baseUrl`'s base path -- so a WAS mounted under a sub-path (e.g.
204
235
  * `https://host/was/`) resolves just as a bare-origin deployment does, which
205
236
  * `parseSpacePath` alone cannot do (it would see a leading `was` segment).
206
237
  *
207
- * Returns `null` when `target` is not beneath `serverUrl` (another origin, or
208
- * another base path) or addresses something outside the `/space` tree (e.g.
209
- * `/kms`). The caller chooses whether that is an error.
238
+ * Returns `null` when `target` is not beneath `baseUrl` (another origin, or
239
+ * another base path), carries a query or fragment, or addresses something
240
+ * outside the `/space` tree (e.g. `/kms`). The caller chooses whether that is
241
+ * an error.
210
242
  *
211
243
  * @param options {object}
212
- * @param options.serverUrl {string} the client's server base URL
244
+ * @param options.baseUrl {string} the client's server base URL
213
245
  * @param options.target {string} an absolute URL on that server
214
246
  * @returns {ParsedSpacePath | null}
215
247
  */
216
- export declare function parseSpaceTarget({ serverUrl, target }: {
217
- serverUrl: string;
248
+ export declare function parseSpaceTarget({ baseUrl, target }: {
249
+ baseUrl: string;
218
250
  target: string;
219
251
  }): ParsedSpacePath | null;
220
252
  /**
@@ -226,16 +258,18 @@ export declare function parseSpaceTarget({ serverUrl, target }: {
226
258
  * beneath any other base). This is the one for a capability received from
227
259
  * another party, whose `invocationTarget` may name any host.
228
260
  *
229
- * Returns `null` when `target` is not an absolute URL or has no `space`
230
- * segment, and `null` from the path grammar for a path it cannot classify.
231
- * The caller chooses whether that is an error.
261
+ * Returns `null` when `target` is not an absolute `http(s)` URL, has no
262
+ * `space` segment, carries a query or fragment, or has an empty segment in
263
+ * the base before it (`https://host//was/space/x`); these are the rules
264
+ * `baseUrlOfSpacesUrl` applies too. Also `null` from the path grammar for a
265
+ * path it cannot classify. The caller chooses whether that is an error.
232
266
  *
233
267
  * @param target {string} an absolute WAS URL
234
- * @returns {{ serverUrl: string; path: ParsedSpacePath } | null} the server
268
+ * @returns {{ baseUrl: string; path: ParsedSpacePath } | null} the server
235
269
  * base URL (no trailing slash) and the parsed target beneath it
236
270
  */
237
271
  export declare function parseAbsoluteSpaceTarget(target: string): {
238
- serverUrl: string;
272
+ baseUrl: string;
239
273
  path: ParsedSpacePath;
240
274
  } | null;
241
275
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/internal/paths.ts"],"names":[],"mappings":"AA8GA;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE5E;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,M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