@interop/was-client 0.52.0 → 0.53.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/README.md +23 -2
- package/dist/Collection.d.ts +11 -7
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +21 -23
- package/dist/Collection.js.map +1 -1
- package/dist/Resource.d.ts +15 -0
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +4 -15
- package/dist/Resource.js.map +1 -1
- package/dist/Space.d.ts +54 -0
- package/dist/Space.d.ts.map +1 -1
- package/dist/Space.js +89 -7
- package/dist/Space.js.map +1 -1
- package/dist/edv/logGovernedDescriptorStore.d.ts.map +1 -1
- package/dist/edv/logGovernedDescriptorStore.js +4 -3
- package/dist/edv/logGovernedDescriptorStore.js.map +1 -1
- package/dist/internal/content.d.ts +13 -0
- package/dist/internal/content.d.ts.map +1 -1
- package/dist/internal/content.js +16 -0
- package/dist/internal/content.js.map +1 -1
- package/dist/internal/describe.d.ts +16 -21
- package/dist/internal/describe.d.ts.map +1 -1
- package/dist/internal/describe.js +17 -25
- package/dist/internal/describe.js.map +1 -1
- package/dist/internal/request.d.ts +19 -0
- package/dist/internal/request.d.ts.map +1 -1
- package/dist/internal/request.js +26 -0
- package/dist/internal/request.js.map +1 -1
- package/dist/log/logStore.d.ts.map +1 -1
- package/dist/log/logStore.js +8 -20
- package/dist/log/logStore.js.map +1 -1
- package/dist/sync/provisioning.d.ts +43 -15
- package/dist/sync/provisioning.d.ts.map +1 -1
- package/dist/sync/provisioning.js +112 -38
- package/dist/sync/provisioning.js.map +1 -1
- package/package.json +2 -2
|
@@ -15,13 +15,19 @@
|
|
|
15
15
|
* every encrypted collection must carry before any read or write routes
|
|
16
16
|
* (epoch-from-birth) -- is installed by the EDV-bearing second step,
|
|
17
17
|
* `ensureFirstEpoch` in `@interop/was-client/edv`.
|
|
18
|
+
*
|
|
19
|
+
* Three collection modes: `'edv'` (the client-written encryption descriptor),
|
|
20
|
+
* `'plaintext'` (no descriptor), and `'governed'` (a Collection whose
|
|
21
|
+
* `encryption` member the server derives from its history log). A `'governed'`
|
|
22
|
+
* collection is created descriptor-less here and declared governed afterwards,
|
|
23
|
+
* by the caller's guarded create of the log.
|
|
18
24
|
*/
|
|
19
25
|
import type { SpaceDescription } from '../types.js';
|
|
20
26
|
import type { WasClient } from '../WasClient.js';
|
|
21
27
|
/**
|
|
22
28
|
* Ensures the controller's Space exists and one synced collection is
|
|
23
29
|
* configured, without overwriting anything already there. The Space is
|
|
24
|
-
* described first and
|
|
30
|
+
* described first and created only when absent -- an existing Space keeps
|
|
25
31
|
* its name AND its controller, so `controllerDid` is used only at creation
|
|
26
32
|
* (a joined client re-running this never rewrites the description). The
|
|
27
33
|
* collection likewise: when absent, an `'edv'` collection is created with the
|
|
@@ -29,16 +35,29 @@ import type { WasClient } from '../WasClient.js';
|
|
|
29
35
|
* the server stores only ciphertext it can never decrypt and validates every
|
|
30
36
|
* write against the declared envelope wire format -- the same version the
|
|
31
37
|
* cipher binds into each envelope's AEAD-protected header, so descriptor and
|
|
32
|
-
* envelopes cannot drift; a `'plaintext'` collection is created
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
38
|
+
* envelopes cannot drift; a `'plaintext'` or `'governed'` collection is created
|
|
39
|
+
* without one. Both creates are guarded (`If-None-Match: *`), so two clients
|
|
40
|
+
* booting at once cannot both create, and the loser adopts the winner's
|
|
41
|
+
* description instead of failing. Against a server that ignores the
|
|
42
|
+
* precondition the create is an unconditional upsert, and the loser of a race
|
|
43
|
+
* can overwrite the winner's display name; the server merges the rest of the
|
|
44
|
+
* winner's description forward.
|
|
45
|
+
*
|
|
46
|
+
* An existing collection that lacks the descriptor an `'edv'` spec calls for
|
|
36
47
|
* gets the late in-place declaration (set-once on the server); one that
|
|
37
48
|
* already carries a descriptor -- possibly with appended key epochs -- is
|
|
38
|
-
* left untouched, epochs and display name included.
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
49
|
+
* left untouched, epochs and display name included. An existing `'governed'`
|
|
50
|
+
* collection is never written to: the server refuses to govern a Description
|
|
51
|
+
* that carries a client-written descriptor (`encryption-immutable`), and a
|
|
52
|
+
* governed Collection's served `encryption` is the derived member, which a
|
|
53
|
+
* Description PUT may not carry (`encryption-history-log-governed`). So an
|
|
54
|
+
* existing collection whose descriptor is client-written (no `history`
|
|
55
|
+
* member) cannot become governed, and a `'governed'` spec over it throws
|
|
56
|
+
* `ValidationError` here rather than letting the caller's log create fail
|
|
57
|
+
* with the server's 409. A public collection gets the collection-level
|
|
58
|
+
* world-read grant (`setPublic`, what makes a resource URL in it resolve for
|
|
59
|
+
* anyone) only when its policy does not already say so. Runs full-tier -- the
|
|
60
|
+
* client invokes its own root authority.
|
|
42
61
|
*
|
|
43
62
|
* @param options {object}
|
|
44
63
|
* @param options.was {WasClient}
|
|
@@ -46,7 +65,14 @@ import type { WasClient } from '../WasClient.js';
|
|
|
46
65
|
* @param options.controllerDid {string} the Space controller (e.g. `did:key`);
|
|
47
66
|
* used only when the Space does not exist yet
|
|
48
67
|
* @param options.collectionId {string} the WAS collection id
|
|
49
|
-
* @param [options.encryption] {'edv' | 'plaintext'
|
|
68
|
+
* @param [options.encryption] {'edv' | 'plaintext' | 'governed'} how the
|
|
69
|
+
* collection's `encryption` member is settled; defaults to `'edv'`.
|
|
70
|
+
* `'edv'` declares the descriptor here, `'plaintext'` declares none, and
|
|
71
|
+
* `'governed'` leaves the member to the server, which derives it from the
|
|
72
|
+
* collection's history log. Declaring that governance is the caller's next
|
|
73
|
+
* step, through the log's guarded create --
|
|
74
|
+
* `logGovernedDescriptorStore(...).create` or
|
|
75
|
+
* `resourceLogStore({ collection }).create`
|
|
50
76
|
* @param [options.isPublic] {boolean} grant collection-level world read
|
|
51
77
|
* @param [options.spaceName] {string} the Space display name, applied only at
|
|
52
78
|
* Space creation; defaults to `'WAS Space'`
|
|
@@ -67,7 +93,7 @@ export declare function ensureSpaceAndCollection({ was, spaceId, controllerDid,
|
|
|
67
93
|
spaceId: string;
|
|
68
94
|
controllerDid: string;
|
|
69
95
|
collectionId: string;
|
|
70
|
-
encryption?: 'edv' | 'plaintext';
|
|
96
|
+
encryption?: 'edv' | 'plaintext' | 'governed';
|
|
71
97
|
isPublic?: boolean;
|
|
72
98
|
spaceName?: string;
|
|
73
99
|
collectionName?: string;
|
|
@@ -78,11 +104,13 @@ export declare function ensureSpaceAndCollection({ was, spaceId, controllerDid,
|
|
|
78
104
|
* there -- the Space half of {@link ensureSpaceAndCollection}, split out so a
|
|
79
105
|
* caller provisioning SEVERAL collections into one Space pays for it once
|
|
80
106
|
* rather than once per collection. An existing Space keeps its name AND its
|
|
81
|
-
* controller, so `controllerDid` is used only at creation.
|
|
107
|
+
* controller, so `controllerDid` is used only at creation. The create is
|
|
108
|
+
* guarded (`If-None-Match: *`), so a Space created concurrently keeps its
|
|
109
|
+
* `type` array (accepted at creation only) and is adopted by the loser.
|
|
82
110
|
*
|
|
83
|
-
* Costs one `GET` on a settled Space, and one `GET` plus one `PUT`
|
|
84
|
-
*
|
|
85
|
-
*
|
|
111
|
+
* Costs one `GET` on a settled Space, and one `GET` plus one guarded `PUT`
|
|
112
|
+
* (`If-None-Match: *`) on a fresh one; a lost create race costs one more `GET`
|
|
113
|
+
* to adopt the winner.
|
|
86
114
|
*
|
|
87
115
|
* @param options {object}
|
|
88
116
|
* @param options.was {WasClient}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provisioning.d.ts","sourceRoot":"","sources":["../../src/sync/provisioning.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"provisioning.d.ts","sourceRoot":"","sources":["../../src/sync/provisioning.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAyB,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAkGhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,wBAAsB,wBAAwB,CAAC,EAC7C,GAAG,EACH,OAAO,EACP,aAAa,EACb,YAAY,EACZ,UAAkB,EAClB,QAAgB,EAChB,SAA8B,EAC9B,cAA6B,EAC7B,gBAAgB,EACjB,EAAE;IACD,GAAG,EAAE,SAAS,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,KAAK,GAAG,WAAW,GAAG,UAAU,CAAA;IAC7C,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;CACpC,GAAG,OAAO,CAAC,IAAI,CAAC,CAuGhB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,WAAW,CAAC,EAChC,GAAG,EACH,OAAO,EACP,aAAa,EACb,SAA8B,EAC/B,EAAE;IACD,GAAG,EAAE,SAAS,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAqB5B"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { EDV_SCHEME_VERSION } from '../edv/constants.js';
|
|
4
4
|
import { ValidationError, WasError } from '../errors.js';
|
|
5
5
|
import { compareAndSwap } from '../internal/cas.js';
|
|
6
|
+
import { isGovernedDescriptor } from '../internal/describe.js';
|
|
6
7
|
/**
|
|
7
8
|
* The Space display name applied at creation when the caller names none.
|
|
8
9
|
*/
|
|
@@ -32,10 +33,60 @@ function rethrowProvisioningFailure(err, context) {
|
|
|
32
33
|
}
|
|
33
34
|
throw new Error(context, { cause: err });
|
|
34
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* The read-then-guarded-create both ensures share: the value is read and, when
|
|
38
|
+
* present, kept as-is; when absent, `create` runs the `If-None-Match: *` write,
|
|
39
|
+
* and when that fails for ANY reason the value is re-read, and a value now
|
|
40
|
+
* present is adopted as the winner of a create race instead of failing. The race is detected by the re-read rather than by the
|
|
41
|
+
* failure's status because the server answers a lost race with whatever check
|
|
42
|
+
* the rival's description trips first: a 412 from the precondition, but also
|
|
43
|
+
* a 400 or 409 from the encryption-descriptor transition rules when the rival
|
|
44
|
+
* already installed key epochs. When nothing can be read back, the create's
|
|
45
|
+
* own failure is rethrown, so a genuine failure keeps its type.
|
|
46
|
+
*
|
|
47
|
+
* A `create` that resolves `undefined` (a server that answered the create with
|
|
48
|
+
* no body) also falls through to the re-read; that value being unreadable is
|
|
49
|
+
* the one case reported as its own error.
|
|
50
|
+
*
|
|
51
|
+
* @param options {object}
|
|
52
|
+
* @param options.read {function} reads the value; `null` when absent
|
|
53
|
+
* @param options.create {function} the guarded write; resolves the created
|
|
54
|
+
* value, or `undefined` when the server echoed none
|
|
55
|
+
* @param options.unreadable {string} the error message when a create
|
|
56
|
+
* succeeded but the value cannot be read back
|
|
57
|
+
* @returns {Promise<{ value: T; created: boolean }>} the value now present
|
|
58
|
+
* and whether this call created it
|
|
59
|
+
*/
|
|
60
|
+
async function readOrCreate({ read, create, unreadable }) {
|
|
61
|
+
const current = await read();
|
|
62
|
+
if (current !== null) {
|
|
63
|
+
return { value: current, created: false };
|
|
64
|
+
}
|
|
65
|
+
let created = false;
|
|
66
|
+
let failure;
|
|
67
|
+
try {
|
|
68
|
+
const value = await create();
|
|
69
|
+
created = true;
|
|
70
|
+
if (value !== undefined) {
|
|
71
|
+
return { value, created };
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch (err) {
|
|
75
|
+
failure = err;
|
|
76
|
+
}
|
|
77
|
+
const latest = await read();
|
|
78
|
+
if (latest !== null) {
|
|
79
|
+
return { value: latest, created };
|
|
80
|
+
}
|
|
81
|
+
if (created) {
|
|
82
|
+
throw new ValidationError(unreadable);
|
|
83
|
+
}
|
|
84
|
+
throw failure;
|
|
85
|
+
}
|
|
35
86
|
/**
|
|
36
87
|
* Ensures the controller's Space exists and one synced collection is
|
|
37
88
|
* configured, without overwriting anything already there. The Space is
|
|
38
|
-
* described first and
|
|
89
|
+
* described first and created only when absent -- an existing Space keeps
|
|
39
90
|
* its name AND its controller, so `controllerDid` is used only at creation
|
|
40
91
|
* (a joined client re-running this never rewrites the description). The
|
|
41
92
|
* collection likewise: when absent, an `'edv'` collection is created with the
|
|
@@ -43,16 +94,29 @@ function rethrowProvisioningFailure(err, context) {
|
|
|
43
94
|
* the server stores only ciphertext it can never decrypt and validates every
|
|
44
95
|
* write against the declared envelope wire format -- the same version the
|
|
45
96
|
* cipher binds into each envelope's AEAD-protected header, so descriptor and
|
|
46
|
-
* envelopes cannot drift; a `'plaintext'` collection is created
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
97
|
+
* envelopes cannot drift; a `'plaintext'` or `'governed'` collection is created
|
|
98
|
+
* without one. Both creates are guarded (`If-None-Match: *`), so two clients
|
|
99
|
+
* booting at once cannot both create, and the loser adopts the winner's
|
|
100
|
+
* description instead of failing. Against a server that ignores the
|
|
101
|
+
* precondition the create is an unconditional upsert, and the loser of a race
|
|
102
|
+
* can overwrite the winner's display name; the server merges the rest of the
|
|
103
|
+
* winner's description forward.
|
|
104
|
+
*
|
|
105
|
+
* An existing collection that lacks the descriptor an `'edv'` spec calls for
|
|
50
106
|
* gets the late in-place declaration (set-once on the server); one that
|
|
51
107
|
* already carries a descriptor -- possibly with appended key epochs -- is
|
|
52
|
-
* left untouched, epochs and display name included.
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
108
|
+
* left untouched, epochs and display name included. An existing `'governed'`
|
|
109
|
+
* collection is never written to: the server refuses to govern a Description
|
|
110
|
+
* that carries a client-written descriptor (`encryption-immutable`), and a
|
|
111
|
+
* governed Collection's served `encryption` is the derived member, which a
|
|
112
|
+
* Description PUT may not carry (`encryption-history-log-governed`). So an
|
|
113
|
+
* existing collection whose descriptor is client-written (no `history`
|
|
114
|
+
* member) cannot become governed, and a `'governed'` spec over it throws
|
|
115
|
+
* `ValidationError` here rather than letting the caller's log create fail
|
|
116
|
+
* with the server's 409. A public collection gets the collection-level
|
|
117
|
+
* world-read grant (`setPublic`, what makes a resource URL in it resolve for
|
|
118
|
+
* anyone) only when its policy does not already say so. Runs full-tier -- the
|
|
119
|
+
* client invokes its own root authority.
|
|
56
120
|
*
|
|
57
121
|
* @param options {object}
|
|
58
122
|
* @param options.was {WasClient}
|
|
@@ -60,7 +124,14 @@ function rethrowProvisioningFailure(err, context) {
|
|
|
60
124
|
* @param options.controllerDid {string} the Space controller (e.g. `did:key`);
|
|
61
125
|
* used only when the Space does not exist yet
|
|
62
126
|
* @param options.collectionId {string} the WAS collection id
|
|
63
|
-
* @param [options.encryption] {'edv' | 'plaintext'
|
|
127
|
+
* @param [options.encryption] {'edv' | 'plaintext' | 'governed'} how the
|
|
128
|
+
* collection's `encryption` member is settled; defaults to `'edv'`.
|
|
129
|
+
* `'edv'` declares the descriptor here, `'plaintext'` declares none, and
|
|
130
|
+
* `'governed'` leaves the member to the server, which derives it from the
|
|
131
|
+
* collection's history log. Declaring that governance is the caller's next
|
|
132
|
+
* step, through the log's guarded create --
|
|
133
|
+
* `logGovernedDescriptorStore(...).create` or
|
|
134
|
+
* `resourceLogStore({ collection }).create`
|
|
64
135
|
* @param [options.isPublic] {boolean} grant collection-level world read
|
|
65
136
|
* @param [options.spaceName] {string} the Space display name, applied only at
|
|
66
137
|
* Space creation; defaults to `'WAS Space'`
|
|
@@ -92,20 +163,25 @@ export async function ensureSpaceAndCollection({ was, spaceId, controllerDid, co
|
|
|
92
163
|
}
|
|
93
164
|
try {
|
|
94
165
|
const collection = space.collection(collectionId);
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
// yet, so the re-read inside `configure` is the narrowest window
|
|
101
|
-
// available against a rival create landing in between (it would lose
|
|
102
|
-
// its `backend` to a merge from a stale `null`). This branch runs once
|
|
103
|
-
// per collection, so the extra request is a cold-path cost only.
|
|
104
|
-
await collection.configure(encryption === 'edv'
|
|
166
|
+
// A `'governed'` or `'plaintext'` collection takes the descriptor-less
|
|
167
|
+
// create: a governed `encryption` member is the server's to derive.
|
|
168
|
+
const { value: read, created } = await readOrCreate({
|
|
169
|
+
read: () => collection.describeWithEtag(),
|
|
170
|
+
create: () => collection.replaceDescription(encryption === 'edv'
|
|
105
171
|
? { name: collectionName, encryption: EDV_DESCRIPTOR }
|
|
106
|
-
: { name: collectionName,
|
|
172
|
+
: { name: collectionName }, { ifNoneMatch: true }),
|
|
173
|
+
unreadable: `Collection "${collectionId}" in space "${spaceId}" was ` +
|
|
174
|
+
'created but cannot be read back.'
|
|
175
|
+
});
|
|
176
|
+
const current = read.description;
|
|
177
|
+
if (encryption === 'governed' &&
|
|
178
|
+
current.encryption !== undefined &&
|
|
179
|
+
!isGovernedDescriptor(current.encryption)) {
|
|
180
|
+
throw new ValidationError(`Collection "${collectionId}" in space "${spaceId}" carries a ` +
|
|
181
|
+
'client-written encryption descriptor, so it cannot be governed by ' +
|
|
182
|
+
'a history log: the server keeps a declared descriptor immutable.');
|
|
107
183
|
}
|
|
108
|
-
|
|
184
|
+
if (!created && encryption === 'edv' && current.encryption === undefined) {
|
|
109
185
|
// The late in-place declaration: adding a descriptor to a collection
|
|
110
186
|
// that lacks one is allowed (set-once), while re-sending one over an
|
|
111
187
|
// existing descriptor would drop its appended key epochs -- which is
|
|
@@ -144,7 +220,9 @@ export async function ensureSpaceAndCollection({ was, spaceId, controllerDid, co
|
|
|
144
220
|
: null
|
|
145
221
|
});
|
|
146
222
|
}
|
|
147
|
-
|
|
223
|
+
// A collection this call just created has no policy document yet, so the
|
|
224
|
+
// read that would find it non-public is skipped.
|
|
225
|
+
if (isPublic && (created || !(await collection.isPublic()))) {
|
|
148
226
|
await collection.setPublic();
|
|
149
227
|
}
|
|
150
228
|
}
|
|
@@ -157,11 +235,13 @@ export async function ensureSpaceAndCollection({ was, spaceId, controllerDid, co
|
|
|
157
235
|
* there -- the Space half of {@link ensureSpaceAndCollection}, split out so a
|
|
158
236
|
* caller provisioning SEVERAL collections into one Space pays for it once
|
|
159
237
|
* rather than once per collection. An existing Space keeps its name AND its
|
|
160
|
-
* controller, so `controllerDid` is used only at creation.
|
|
238
|
+
* controller, so `controllerDid` is used only at creation. The create is
|
|
239
|
+
* guarded (`If-None-Match: *`), so a Space created concurrently keeps its
|
|
240
|
+
* `type` array (accepted at creation only) and is adopted by the loser.
|
|
161
241
|
*
|
|
162
|
-
* Costs one `GET` on a settled Space, and one `GET` plus one `PUT`
|
|
163
|
-
*
|
|
164
|
-
*
|
|
242
|
+
* Costs one `GET` on a settled Space, and one `GET` plus one guarded `PUT`
|
|
243
|
+
* (`If-None-Match: *`) on a fresh one; a lost create race costs one more `GET`
|
|
244
|
+
* to adopt the winner.
|
|
165
245
|
*
|
|
166
246
|
* @param options {object}
|
|
167
247
|
* @param options.was {WasClient}
|
|
@@ -177,18 +257,12 @@ export async function ensureSpaceAndCollection({ was, spaceId, controllerDid, co
|
|
|
177
257
|
export async function ensureSpace({ was, spaceId, controllerDid, spaceName = DEFAULT_SPACE_NAME }) {
|
|
178
258
|
const space = was.space(spaceId);
|
|
179
259
|
try {
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
// The create does not thread the `null` just read into `configure` (same
|
|
185
|
-
// reasoning as the collection create in `ensureSpaceAndCollection`): a
|
|
186
|
-
// Space created concurrently in the window would lose its `type` array,
|
|
187
|
-
// which the server accepts at creation only. Once per Space, cold path.
|
|
188
|
-
return await space.configure({
|
|
189
|
-
name: spaceName,
|
|
190
|
-
controller: controllerDid
|
|
260
|
+
const { value } = await readOrCreate({
|
|
261
|
+
read: () => space.describe(),
|
|
262
|
+
create: async () => (await space.replaceDescription({ name: spaceName, controller: controllerDid }, { ifNoneMatch: true })).description,
|
|
263
|
+
unreadable: `Space "${spaceId}" was created but cannot be read back.`
|
|
191
264
|
});
|
|
265
|
+
return value;
|
|
192
266
|
}
|
|
193
267
|
catch (err) {
|
|
194
268
|
rethrowProvisioningFailure(err, `Failed to configure WAS space "${spaceId}" for "${controllerDid}".`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provisioning.js","sourceRoot":"","sources":["../../src/sync/provisioning.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"provisioning.js","sourceRoot":"","sources":["../../src/sync/provisioning.ts"],"names":[],"mappings":"AA0BA,6EAA6E;AAC7E,iEAAiE;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAE9D;;GAEG;AACH,MAAM,kBAAkB,GAAG,WAAW,CAAA;AAEtC;;;GAGG;AACH,MAAM,cAAc,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAW,CAAA;AAE9E;;;;;;;;;;;;;GAaG;AACH,SAAS,0BAA0B,CAAC,GAAY,EAAE,OAAe;IAC/D,IAAI,GAAG,YAAY,QAAQ,EAAE,CAAC;QAC5B,MAAM,GAAG,CAAA;IACX,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;AAC1C,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,KA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1
1
|
{
|
|
2
2
|
"name": "@interop/was-client",
|
|
3
3
|
"description": "A developer-friendly client for Wallet Attached Storage (WAS) servers.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.53.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "pnpm run clear && tsc",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@interop/http-client": "^1.0.5",
|
|
69
69
|
"@interop/minimal-cipher": "^7.10.0",
|
|
70
70
|
"@interop/storage-core": "^0.11.0",
|
|
71
|
-
"@interop/vh-resource-log": "^0.4.
|
|
71
|
+
"@interop/vh-resource-log": "^0.4.2",
|
|
72
72
|
"@interop/x25519-key-agreement-key": "^5.3.0",
|
|
73
73
|
"@noble/hashes": "^2.3.0",
|
|
74
74
|
"@scure/base": "^2.3.0",
|