@interop/was-client 0.51.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 +46 -2
- package/dist/Collection.d.ts +30 -9
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +110 -76
- 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 +6 -17
- 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 +104 -18
- package/dist/Space.js.map +1 -1
- package/dist/codec.d.ts +54 -12
- package/dist/codec.d.ts.map +1 -1
- package/dist/edv/EdvCodec.d.ts +9 -8
- package/dist/edv/EdvCodec.d.ts.map +1 -1
- package/dist/edv/EdvCodec.js +65 -33
- package/dist/edv/EdvCodec.js.map +1 -1
- package/dist/edv/descriptorStore.d.ts.map +1 -1
- package/dist/edv/descriptorStore.js +2 -0
- package/dist/edv/descriptorStore.js.map +1 -1
- package/dist/edv/docCipher.d.ts.map +1 -1
- package/dist/edv/docCipher.js +1 -1
- package/dist/edv/docCipher.js.map +1 -1
- package/dist/edv/index.d.ts +2 -0
- package/dist/edv/index.d.ts.map +1 -1
- package/dist/edv/index.js +1 -0
- package/dist/edv/index.js.map +1 -1
- package/dist/edv/logGovernedDescriptorStore.d.ts +164 -0
- package/dist/edv/logGovernedDescriptorStore.d.ts.map +1 -0
- package/dist/edv/logGovernedDescriptorStore.js +477 -0
- package/dist/edv/logGovernedDescriptorStore.js.map +1 -0
- package/dist/edv/recipients.d.ts.map +1 -1
- package/dist/edv/recipients.js +25 -82
- package/dist/edv/recipients.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/internal/cas.d.ts +95 -0
- package/dist/internal/cas.d.ts.map +1 -0
- package/dist/internal/cas.js +116 -0
- package/dist/internal/cas.js.map +1 -0
- package/dist/internal/codec.d.ts.map +1 -1
- package/dist/internal/codec.js +6 -6
- package/dist/internal/codec.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/meta.d.ts +9 -9
- package/dist/internal/meta.d.ts.map +1 -1
- package/dist/internal/meta.js +13 -14
- package/dist/internal/meta.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 +8 -5
- package/dist/log/logStore.d.ts.map +1 -1
- package/dist/log/logStore.js +30 -30
- 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 +147 -38
- package/dist/sync/provisioning.js.map +1 -1
- package/dist/types.d.ts +11 -12
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
// sync module does not pull the EDV crypto graph for one number.
|
|
3
3
|
import { EDV_SCHEME_VERSION } from '../edv/constants.js';
|
|
4
4
|
import { ValidationError, WasError } from '../errors.js';
|
|
5
|
+
import { compareAndSwap } from '../internal/cas.js';
|
|
6
|
+
import { isGovernedDescriptor } from '../internal/describe.js';
|
|
5
7
|
/**
|
|
6
8
|
* The Space display name applied at creation when the caller names none.
|
|
7
9
|
*/
|
|
@@ -31,10 +33,60 @@ function rethrowProvisioningFailure(err, context) {
|
|
|
31
33
|
}
|
|
32
34
|
throw new Error(context, { cause: err });
|
|
33
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
|
+
}
|
|
34
86
|
/**
|
|
35
87
|
* Ensures the controller's Space exists and one synced collection is
|
|
36
88
|
* configured, without overwriting anything already there. The Space is
|
|
37
|
-
* described first and
|
|
89
|
+
* described first and created only when absent -- an existing Space keeps
|
|
38
90
|
* its name AND its controller, so `controllerDid` is used only at creation
|
|
39
91
|
* (a joined client re-running this never rewrites the description). The
|
|
40
92
|
* collection likewise: when absent, an `'edv'` collection is created with the
|
|
@@ -42,16 +94,29 @@ function rethrowProvisioningFailure(err, context) {
|
|
|
42
94
|
* the server stores only ciphertext it can never decrypt and validates every
|
|
43
95
|
* write against the declared envelope wire format -- the same version the
|
|
44
96
|
* cipher binds into each envelope's AEAD-protected header, so descriptor and
|
|
45
|
-
* envelopes cannot drift; a `'plaintext'` collection is created
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
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
|
|
49
106
|
* gets the late in-place declaration (set-once on the server); one that
|
|
50
107
|
* already carries a descriptor -- possibly with appended key epochs -- is
|
|
51
|
-
* left untouched, epochs and display name included.
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
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.
|
|
55
120
|
*
|
|
56
121
|
* @param options {object}
|
|
57
122
|
* @param options.was {WasClient}
|
|
@@ -59,7 +124,14 @@ function rethrowProvisioningFailure(err, context) {
|
|
|
59
124
|
* @param options.controllerDid {string} the Space controller (e.g. `did:key`);
|
|
60
125
|
* used only when the Space does not exist yet
|
|
61
126
|
* @param options.collectionId {string} the WAS collection id
|
|
62
|
-
* @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`
|
|
63
135
|
* @param [options.isPublic] {boolean} grant collection-level world read
|
|
64
136
|
* @param [options.spaceName] {string} the Space display name, applied only at
|
|
65
137
|
* Space creation; defaults to `'WAS Space'`
|
|
@@ -91,28 +163,66 @@ export async function ensureSpaceAndCollection({ was, spaceId, controllerDid, co
|
|
|
91
163
|
}
|
|
92
164
|
try {
|
|
93
165
|
const collection = space.collection(collectionId);
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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'
|
|
171
|
+
? { name: collectionName, encryption: EDV_DESCRIPTOR }
|
|
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.');
|
|
103
183
|
}
|
|
104
|
-
|
|
184
|
+
if (!created && encryption === 'edv' && current.encryption === undefined) {
|
|
105
185
|
// The late in-place declaration: adding a descriptor to a collection
|
|
106
186
|
// that lacks one is allowed (set-once), while re-sending one over an
|
|
107
187
|
// existing descriptor would drop its appended key epochs -- which is
|
|
108
|
-
// exactly why an existing descriptor is never touched.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
188
|
+
// exactly why an existing descriptor is never touched. The write is
|
|
189
|
+
// compare-and-swapped against the description just read, so a rival
|
|
190
|
+
// declaration landing in between is re-read and adopted as-is rather
|
|
191
|
+
// than tripping `encryption-immutable` or being overwritten.
|
|
192
|
+
let reusable = read;
|
|
193
|
+
await compareAndSwap({
|
|
194
|
+
store: {
|
|
195
|
+
read: async () => {
|
|
196
|
+
const latest = reusable !== null ? reusable : await collection.describeWithEtag();
|
|
197
|
+
reusable = null;
|
|
198
|
+
if (latest === null) {
|
|
199
|
+
throw new ValidationError(`Collection "${collectionId}" in space "${spaceId}" vanished ` +
|
|
200
|
+
'while its encryption was being declared.');
|
|
201
|
+
}
|
|
202
|
+
return { value: latest.description, etag: latest.etag };
|
|
203
|
+
},
|
|
204
|
+
// Replace semantics: every writable field is carried forward.
|
|
205
|
+
replace: async (next, { ifMatch }) => {
|
|
206
|
+
await collection.replaceDescription({
|
|
207
|
+
name: next.name,
|
|
208
|
+
backend: next.backend,
|
|
209
|
+
encryption: next.encryption
|
|
210
|
+
}, { ifMatch });
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
operation: 'Encryption declaration',
|
|
214
|
+
mutate: latest => latest.encryption === undefined
|
|
215
|
+
? {
|
|
216
|
+
...latest,
|
|
217
|
+
name: latest.name ?? collectionName,
|
|
218
|
+
encryption: EDV_DESCRIPTOR
|
|
219
|
+
}
|
|
220
|
+
: null
|
|
113
221
|
});
|
|
114
222
|
}
|
|
115
|
-
|
|
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()))) {
|
|
116
226
|
await collection.setPublic();
|
|
117
227
|
}
|
|
118
228
|
}
|
|
@@ -125,11 +235,13 @@ export async function ensureSpaceAndCollection({ was, spaceId, controllerDid, co
|
|
|
125
235
|
* there -- the Space half of {@link ensureSpaceAndCollection}, split out so a
|
|
126
236
|
* caller provisioning SEVERAL collections into one Space pays for it once
|
|
127
237
|
* rather than once per collection. An existing Space keeps its name AND its
|
|
128
|
-
* 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.
|
|
129
241
|
*
|
|
130
|
-
* Costs one `GET` on a settled Space, and one `GET` plus one `PUT`
|
|
131
|
-
*
|
|
132
|
-
*
|
|
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.
|
|
133
245
|
*
|
|
134
246
|
* @param options {object}
|
|
135
247
|
* @param options.was {WasClient}
|
|
@@ -145,15 +257,12 @@ export async function ensureSpaceAndCollection({ was, spaceId, controllerDid, co
|
|
|
145
257
|
export async function ensureSpace({ was, spaceId, controllerDid, spaceName = DEFAULT_SPACE_NAME }) {
|
|
146
258
|
const space = was.space(spaceId);
|
|
147
259
|
try {
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
return await space.configure({
|
|
153
|
-
name: spaceName,
|
|
154
|
-
controller: controllerDid,
|
|
155
|
-
current
|
|
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.`
|
|
156
264
|
});
|
|
265
|
+
return value;
|
|
157
266
|
}
|
|
158
267
|
catch (err) {
|
|
159
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,kBA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,CACE,MAAM,KAAK,CAAC,kBAAkB,CAC5B,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,EAC9C,EAAE,WAAW,EAAE,IAAI,EAAE,CACtB,CACF,CAAC,WAAW;YACf,UAAU,EAAE,UAAU,OAAO,wCAAwC;SACtE,CAAC,CAAA;QACF,OAAO,KAAK,CAAA;IACd,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,0BAA0B,CACxB,GAAG,EACH,kCAAkC,OAAO,UAAU,aAAa,IAAI,CACrE,CAAA;IACH,CAAC;AACH,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -136,23 +136,22 @@ export interface FindPage {
|
|
|
136
136
|
* path that takes precedence over the Collection's declared `encryption`
|
|
137
137
|
* descriptor AND skips the descriptor-discovery round-trip:
|
|
138
138
|
*
|
|
139
|
-
* - `
|
|
140
|
-
* keys from the client's keystore.
|
|
141
|
-
*
|
|
142
|
-
* `{ scheme: 'edv' }` is refused fail-closed: routing needs the
|
|
143
|
-
* roster).
|
|
144
|
-
* -
|
|
145
|
-
* core; the encryption provider interprets it per
|
|
146
|
-
* keystore.
|
|
139
|
+
* - a `CollectionEncryption` descriptor -- treat the collection as encrypted
|
|
140
|
+
* under it, pulling keys from the client's keystore. The descriptor is
|
|
141
|
+
* forwarded whole to the provider, so pass the full epoch-bearing form (a
|
|
142
|
+
* bare `{ scheme: 'edv' }` is refused fail-closed: routing needs the
|
|
143
|
+
* key-epoch roster).
|
|
144
|
+
* - the same descriptor with `keys` -- additionally supply the key material
|
|
145
|
+
* inline (opaque to core; the encryption provider interprets it per
|
|
146
|
+
* `scheme`) instead of the keystore.
|
|
147
147
|
* - `'plaintext'` -- force plaintext even if a descriptor / keystore would encrypt.
|
|
148
148
|
*
|
|
149
149
|
* The non-`'plaintext'` forms require the `WasClient` to be constructed with an
|
|
150
|
-
* `encryption` provider (which turns a
|
|
150
|
+
* `encryption` provider (which turns a descriptor + keys into a codec).
|
|
151
151
|
*/
|
|
152
|
-
export type EncryptionOverride = {
|
|
153
|
-
scheme: string;
|
|
152
|
+
export type EncryptionOverride = (CollectionEncryption & {
|
|
154
153
|
keys?: unknown;
|
|
155
|
-
} | 'plaintext';
|
|
154
|
+
}) | 'plaintext';
|
|
156
155
|
/**
|
|
157
156
|
* Options accepted by every handle factory (`space()`, `collection()`,
|
|
158
157
|
* `resource()`). A bound `capability` is attached to every request the handle
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EACV,KAAK,EACL,cAAc,EACd,SAAS,EACV,MAAM,mCAAmC,CAAA;AAC1C,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAEjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA;AAE/D;;;;;GAKG;AACH,YAAY,EACV,MAAM,EACN,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,yBAAyB,EACzB,6BAA6B,EAC7B,cAAc,EACd,OAAO,EACP,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,uBAAuB,EACvB,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,EAClB,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACvB,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,gBAAgB,EACjB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,KAAK,EACV,gBAAgB,EAChB,oBAAoB,EACpB,sBAAs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
|
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",
|