@interop/was-client 0.10.0 → 0.12.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 +11 -4
- package/dist/Resource.d.ts +28 -7
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +37 -16
- package/dist/Resource.js.map +1 -1
- package/dist/codec.d.ts +38 -6
- package/dist/codec.d.ts.map +1 -1
- package/dist/edv/EdvCodec.d.ts +57 -9
- package/dist/edv/EdvCodec.d.ts.map +1 -1
- package/dist/edv/EdvCodec.js +91 -11
- package/dist/edv/EdvCodec.js.map +1 -1
- package/dist/internal/codec.d.ts +2 -1
- package/dist/internal/codec.d.ts.map +1 -1
- package/dist/internal/codec.js +9 -2
- package/dist/internal/codec.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -605,10 +605,17 @@ scope for now):
|
|
|
605
605
|
- **Ids.** `add()` mints an EDV id (a `z`-prefixed multibase value used verbatim
|
|
606
606
|
as the WAS resource id). `put(id, ...)` accepts only an EDV-format id; a
|
|
607
607
|
human-readable id is rejected (it would leak onto the URL) -- carry a
|
|
608
|
-
human-readable label inside the encrypted content instead.
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
608
|
+
human-readable label inside the encrypted content instead. By default the
|
|
609
|
+
minted id is random (the classic mutable-document model); pass
|
|
610
|
+
`createEdvEncryption({ idDerivation: 'content' })` to derive it from the
|
|
611
|
+
envelope's JWE ciphertext instead, making documents content-addressed -- the
|
|
612
|
+
id is then stable across replicas (no mapping table), at the cost of
|
|
613
|
+
immutability (an "update" is delete-old + add-new).
|
|
614
|
+
- **Metadata.** `resource.setName()` / `setTags()` / `setMeta()` work on an
|
|
615
|
+
encrypted collection: the user-writable `custom` (`name` / `tags`) is
|
|
616
|
+
encrypted into an envelope before it is sent, so the server never sees the
|
|
617
|
+
plaintext, and `meta()` decrypts it back for a keyed reader. The `/meta`
|
|
618
|
+
endpoint has its own ETag (`metaVersion`), independent of the content ETag.
|
|
612
619
|
- **Binary.** A small `Blob`/`Uint8Array` is encrypted as a single document;
|
|
613
620
|
larger binaries are rejected until chunked encrypted blobs land.
|
|
614
621
|
- **Raw reads.** `get()` decrypts; the `getText()` / `getBytes()` escape hatches
|
package/dist/Resource.d.ts
CHANGED
|
@@ -132,9 +132,14 @@ export declare class Resource {
|
|
|
132
132
|
* resource is missing or not visible to you (404 conflation caveat). A server
|
|
133
133
|
* without metadata support surfaces its 501 as `NotImplementedError`.
|
|
134
134
|
*
|
|
135
|
+
* On an encrypted collection the stored `custom` is an opaque envelope; this
|
|
136
|
+
* decodes it (decrypts, via the codec) so a caller always sees plaintext
|
|
137
|
+
* `{ name, tags }`. A resource with no user metadata reports `custom` as `{}`.
|
|
138
|
+
*
|
|
135
139
|
* Against a backend with the `conditional-writes` feature the result also
|
|
136
|
-
* carries the
|
|
137
|
-
* `
|
|
140
|
+
* carries the metadata's current `etag` (the `/meta` `metaVersion` validator)
|
|
141
|
+
* -- pass it as `setMeta(meta, { ifMatch })` for a lost-update-safe metadata
|
|
142
|
+
* update.
|
|
138
143
|
*
|
|
139
144
|
* @returns {Promise<(ResourceMetadata & { etag?: string }) | null>}
|
|
140
145
|
*/
|
|
@@ -148,17 +153,33 @@ export declare class Resource {
|
|
|
148
153
|
* metadata of a nonexistent resource throws `NotFoundError`. Servers without
|
|
149
154
|
* metadata support surface their 501 as `NotImplementedError`.
|
|
150
155
|
*
|
|
151
|
-
* On an encrypted collection
|
|
152
|
-
*
|
|
153
|
-
*
|
|
156
|
+
* On an encrypted collection `custom` is encrypted into an opaque envelope by
|
|
157
|
+
* the codec before it is sent, so `name` / `tags` are never stored as
|
|
158
|
+
* server-visible plaintext -- transparently, the same call works on plaintext
|
|
159
|
+
* and encrypted collections alike.
|
|
160
|
+
*
|
|
161
|
+
* Conditional metadata writes (the backend's `conditional-writes` feature):
|
|
162
|
+
* pass `ifMatch` (the `etag` from a prior `meta()`) for an
|
|
163
|
+
* update-if-unchanged, or `ifNoneMatch: true` for a write-only-if-no-metadata.
|
|
164
|
+
* A failed precondition throws `PreconditionFailedError` (412). The `/meta`
|
|
165
|
+
* ETag (`metaVersion`) is independent of the content ETag. Returns the new
|
|
166
|
+
* `etag`.
|
|
154
167
|
*
|
|
155
168
|
* @param meta {object}
|
|
156
169
|
* @param [meta.custom] {ResourceMetadataCustom} the user-writable properties
|
|
157
|
-
* @
|
|
170
|
+
* @param options {object}
|
|
171
|
+
* @param [options.ifMatch] {string} update only if the `/meta` ETag matches
|
|
172
|
+
* @param [options.ifNoneMatch] {boolean} write only if no metadata is set
|
|
173
|
+
* @returns {Promise<{ etag?: string }>} the metadata's new ETag
|
|
158
174
|
*/
|
|
159
175
|
setMeta(meta?: {
|
|
160
176
|
custom?: ResourceMetadataCustom;
|
|
161
|
-
}
|
|
177
|
+
}, options?: {
|
|
178
|
+
ifMatch?: string;
|
|
179
|
+
ifNoneMatch?: boolean;
|
|
180
|
+
}): Promise<{
|
|
181
|
+
etag?: string;
|
|
182
|
+
}>;
|
|
162
183
|
/**
|
|
163
184
|
* Sets the resource's human-readable `name` (the value surfaced in collection
|
|
164
185
|
* listings), preserving any existing `tags`. Convenience over `setMeta()`.
|
package/dist/Resource.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Resource.d.ts","sourceRoot":"","sources":["../src/Resource.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAU1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"Resource.d.ts","sourceRoot":"","sources":["../src/Resource.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAU1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,KAAK,EACV,kBAAkB,EAClB,KAAK,EACL,IAAI,EAC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AC;IAIhC;;;;OAIG;IACG,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;IAKlC;;;;;OAKG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;CAMnC"}
|
package/dist/Resource.js
CHANGED
|
@@ -5,7 +5,6 @@ import { CodecHolder, resolveCodec, readCollectionMarker } from './internal/code
|
|
|
5
5
|
import { writeHeaders, readEtag } from './internal/conditional.js';
|
|
6
6
|
import { sendEncodedWrite } from './internal/write.js';
|
|
7
7
|
import { readPolicy, writePolicy, deletePolicy } from './internal/policy.js';
|
|
8
|
-
import { ValidationError } from './errors.js';
|
|
9
8
|
export class Resource {
|
|
10
9
|
spaceId;
|
|
11
10
|
collectionId;
|
|
@@ -228,13 +227,19 @@ export class Resource {
|
|
|
228
227
|
* resource is missing or not visible to you (404 conflation caveat). A server
|
|
229
228
|
* without metadata support surfaces its 501 as `NotImplementedError`.
|
|
230
229
|
*
|
|
230
|
+
* On an encrypted collection the stored `custom` is an opaque envelope; this
|
|
231
|
+
* decodes it (decrypts, via the codec) so a caller always sees plaintext
|
|
232
|
+
* `{ name, tags }`. A resource with no user metadata reports `custom` as `{}`.
|
|
233
|
+
*
|
|
231
234
|
* Against a backend with the `conditional-writes` feature the result also
|
|
232
|
-
* carries the
|
|
233
|
-
* `
|
|
235
|
+
* carries the metadata's current `etag` (the `/meta` `metaVersion` validator)
|
|
236
|
+
* -- pass it as `setMeta(meta, { ifMatch })` for a lost-update-safe metadata
|
|
237
|
+
* update.
|
|
234
238
|
*
|
|
235
239
|
* @returns {Promise<(ResourceMetadata & { etag?: string }) | null>}
|
|
236
240
|
*/
|
|
237
241
|
async meta() {
|
|
242
|
+
const codec = await this._codec();
|
|
238
243
|
const response = await send(this._context, {
|
|
239
244
|
path: this._metaPath,
|
|
240
245
|
method: 'GET',
|
|
@@ -245,8 +250,12 @@ export class Resource {
|
|
|
245
250
|
return null;
|
|
246
251
|
}
|
|
247
252
|
const metadata = response.data;
|
|
253
|
+
// Decode the user-writable `custom` (decrypting it on an encrypted
|
|
254
|
+
// collection) so callers uniformly see plaintext `{ name, tags }`.
|
|
255
|
+
const custom = await codec.decodeMeta({ custom: metadata.custom });
|
|
256
|
+
const decoded = { ...metadata, custom };
|
|
248
257
|
const etag = readEtag(response);
|
|
249
|
-
return etag !== undefined ? { ...
|
|
258
|
+
return etag !== undefined ? { ...decoded, etag } : decoded;
|
|
250
259
|
}
|
|
251
260
|
/**
|
|
252
261
|
* Replaces the resource's user-writable metadata (`custom`). This is a full
|
|
@@ -255,27 +264,39 @@ export class Resource {
|
|
|
255
264
|
* metadata of a nonexistent resource throws `NotFoundError`. Servers without
|
|
256
265
|
* metadata support surface their 501 as `NotImplementedError`.
|
|
257
266
|
*
|
|
258
|
-
* On an encrypted collection
|
|
259
|
-
*
|
|
260
|
-
*
|
|
267
|
+
* On an encrypted collection `custom` is encrypted into an opaque envelope by
|
|
268
|
+
* the codec before it is sent, so `name` / `tags` are never stored as
|
|
269
|
+
* server-visible plaintext -- transparently, the same call works on plaintext
|
|
270
|
+
* and encrypted collections alike.
|
|
271
|
+
*
|
|
272
|
+
* Conditional metadata writes (the backend's `conditional-writes` feature):
|
|
273
|
+
* pass `ifMatch` (the `etag` from a prior `meta()`) for an
|
|
274
|
+
* update-if-unchanged, or `ifNoneMatch: true` for a write-only-if-no-metadata.
|
|
275
|
+
* A failed precondition throws `PreconditionFailedError` (412). The `/meta`
|
|
276
|
+
* ETag (`metaVersion`) is independent of the content ETag. Returns the new
|
|
277
|
+
* `etag`.
|
|
261
278
|
*
|
|
262
279
|
* @param meta {object}
|
|
263
280
|
* @param [meta.custom] {ResourceMetadataCustom} the user-writable properties
|
|
264
|
-
* @
|
|
281
|
+
* @param options {object}
|
|
282
|
+
* @param [options.ifMatch] {string} update only if the `/meta` ETag matches
|
|
283
|
+
* @param [options.ifNoneMatch] {boolean} write only if no metadata is set
|
|
284
|
+
* @returns {Promise<{ etag?: string }>} the metadata's new ETag
|
|
265
285
|
*/
|
|
266
|
-
async setMeta(meta = {}) {
|
|
286
|
+
async setMeta(meta = {}, options = {}) {
|
|
267
287
|
const codec = await this._codec();
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
'collection -- it would be stored as plaintext. Carry these values ' +
|
|
271
|
-
'inside the encrypted content instead.');
|
|
272
|
-
}
|
|
273
|
-
await send(this._context, {
|
|
288
|
+
const { custom } = await codec.encodeMeta({ custom: meta.custom ?? {} });
|
|
289
|
+
const response = await send(this._context, {
|
|
274
290
|
path: this._metaPath,
|
|
275
291
|
method: 'PUT',
|
|
276
292
|
capability: this._capability,
|
|
277
|
-
json: { custom
|
|
293
|
+
json: { custom },
|
|
294
|
+
headers: writeHeaders(undefined, {
|
|
295
|
+
ifMatch: options.ifMatch,
|
|
296
|
+
ifNoneMatch: options.ifNoneMatch
|
|
297
|
+
})
|
|
278
298
|
});
|
|
299
|
+
return { etag: readEtag(response) };
|
|
279
300
|
}
|
|
280
301
|
/**
|
|
281
302
|
* Sets the resource's human-readable `name` (the value surfaced in collection
|
package/dist/Resource.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Resource.js","sourceRoot":"","sources":["../src/Resource.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE1D,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAC5C,OAAO,EACL,WAAW,EACX,YAAY,EACZ,oBAAoB,EACrB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"Resource.js","sourceR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IACH,KAAK,CAAC,SAAS,CAAC,MAAsB;QACpC,OAAO,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE;YAChC,UAAU,EAAE,IAAI,CAAC,WAAW;YAC5B,MAAM;YACN,UAAU,EAAE,IAAI,CAAC,WAAW;SAC7B,CAAC,CAAA;IACJ,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,SAAS;QACb,MAAM,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAA;IACjD,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,QAAQ;QACZ,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,CAAA;QACrC,OAAO,MAAM,EAAE,IAAI,KAAK,eAAe,CAAA;IACzC,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,WAAW;QACf,OAAO,YAAY,CAAC,IAAI,CAAC,QAAQ,EAAE;YACjC,UAAU,EAAE,IAAI,CAAC,WAAW;YAC5B,UAAU,EAAE,IAAI,CAAC,WAAW;SAC7B,CAAC,CAAA;IACJ,CAAC;CACF"}
|
package/dist/codec.d.ts
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
* silently writing plaintext.
|
|
32
32
|
*/
|
|
33
33
|
import type { HttpResponse } from '@interop/http-client';
|
|
34
|
-
import type { Json, ResourceData } from './types.js';
|
|
34
|
+
import type { Json, ResourceData, ResourceMetadataCustom } from './types.js';
|
|
35
35
|
/**
|
|
36
36
|
* The result of {@link ResourceCodec.encode}: the stored representation of a
|
|
37
37
|
* write, plus the id to store it under.
|
|
@@ -72,12 +72,15 @@ export interface EncodedWrite {
|
|
|
72
72
|
*/
|
|
73
73
|
export interface ResourceCodec {
|
|
74
74
|
/**
|
|
75
|
-
*
|
|
76
|
-
* `
|
|
77
|
-
*
|
|
78
|
-
*
|
|
75
|
+
* How this codec stores a Resource's user-writable metadata (`custom`:
|
|
76
|
+
* `name` / `tags`, set via `resource.setName` / `setTags` / `setMeta`). The
|
|
77
|
+
* identity codec stores it as server-visible plaintext (`'plaintext'`); an
|
|
78
|
+
* encrypting codec stores it as an opaque envelope (`'encrypted'`) -- the same
|
|
79
|
+
* way it stores content -- so `name` / `tags` never reach the server in the
|
|
80
|
+
* clear. A mode rather than a boolean so a future scheme that stores metadata
|
|
81
|
+
* differently can extend the union.
|
|
79
82
|
*/
|
|
80
|
-
readonly
|
|
83
|
+
readonly metadataMode: 'plaintext' | 'encrypted';
|
|
81
84
|
/**
|
|
82
85
|
* Whether this codec drives optimistic-concurrency (conditional) writes. When
|
|
83
86
|
* `true`, the write path pre-reads the current stored resource and passes it
|
|
@@ -117,6 +120,35 @@ export interface ResourceCodec {
|
|
|
117
120
|
* @returns {Promise<Json | Blob>}
|
|
118
121
|
*/
|
|
119
122
|
decode(response: HttpResponse): Promise<Json | Blob>;
|
|
123
|
+
/**
|
|
124
|
+
* Transforms a caller's user-writable metadata (`custom`) into the value to
|
|
125
|
+
* store under `custom` on a `PUT .../meta` write. The identity codec returns
|
|
126
|
+
* `custom` unchanged (server-visible plaintext `{ name, tags }`); an
|
|
127
|
+
* encrypting codec returns an opaque encryption envelope, so `name` / `tags`
|
|
128
|
+
* are never server-visible.
|
|
129
|
+
*
|
|
130
|
+
* @param input {object}
|
|
131
|
+
* @param input.custom {ResourceMetadataCustom} the plaintext user metadata
|
|
132
|
+
* @returns {Promise<{ custom: object }>} the value to store under `custom`
|
|
133
|
+
*/
|
|
134
|
+
encodeMeta(input: {
|
|
135
|
+
custom: ResourceMetadataCustom;
|
|
136
|
+
}): Promise<{
|
|
137
|
+
custom: object;
|
|
138
|
+
}>;
|
|
139
|
+
/**
|
|
140
|
+
* Inverts {@link encodeMeta}: transforms the stored `custom` value read from
|
|
141
|
+
* `.../meta` back into the caller's plaintext `{ name, tags }`. The identity
|
|
142
|
+
* codec returns `stored.custom ?? {}` unchanged; an encrypting codec decrypts
|
|
143
|
+
* the envelope. An absent `custom` (no metadata written) decodes to `{}`.
|
|
144
|
+
*
|
|
145
|
+
* @param stored {object}
|
|
146
|
+
* @param [stored.custom] {unknown} the stored `custom` value from `/meta`
|
|
147
|
+
* @returns {Promise<ResourceMetadataCustom>}
|
|
148
|
+
*/
|
|
149
|
+
decodeMeta(stored: {
|
|
150
|
+
custom?: unknown;
|
|
151
|
+
}): Promise<ResourceMetadataCustom>;
|
|
120
152
|
}
|
|
121
153
|
/**
|
|
122
154
|
* The keystore + codec factory for encrypted collections. Injected into
|
package/dist/codec.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../src/codec.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../src/codec.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAE5E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI,CAAA;IACxB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED;;;;GAIG;AACH,MAAM,WAAW,aAA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. `put(id, ...)` accepts only an EDV-format id --
|
|
24
24
|
* a human-readable id is rejected (it would leak onto the URL). Carry a
|
|
25
|
-
* human-readable label inside the encrypted content instead.
|
|
26
|
-
*
|
|
25
|
+
* human-readable label inside the encrypted content instead. By default the
|
|
26
|
+
* minted id is random (`generateId()`, the classic mutable-document model);
|
|
27
|
+
* with `idDerivation: 'content'` it is content-derived instead -- encrypt
|
|
28
|
+
* first, then `deriveId()` a truncated SHA-256 of the JWE ciphertext and
|
|
29
|
+
* stamp it on the envelope -- making the document content-addressed (and so
|
|
30
|
+
* immutable: an "update" is delete-old + add-new). Both formats pass the same
|
|
31
|
+
* EDV id check and are indistinguishable on the wire.
|
|
27
32
|
* - **Inline non-JSON as a single JWE.** A `Blob`/`Uint8Array` under the size cap
|
|
28
33
|
* is encrypted as one document -- stored as a legible UTF-8 string for a
|
|
29
34
|
* text-family type (else base64) -- with the plaintext content type and the
|
|
@@ -38,39 +43,47 @@
|
|
|
38
43
|
* surfaces as a `PreconditionFailedError` (412) -- the lost-update guard --
|
|
39
44
|
* rather than the old advisory last-writer-wins. Against a backend that does
|
|
40
45
|
* not advertise `conditional-writes` (no ETag) it degrades to advisory.
|
|
41
|
-
* - **
|
|
42
|
-
* `
|
|
43
|
-
*
|
|
46
|
+
* - **Encrypted metadata.** `metadataMode` is `'encrypted'`, so a Resource's
|
|
47
|
+
* user-writable `custom` (`name`/`tags`, via `setName`/`setTags`/`setMeta`) is
|
|
48
|
+
* encrypted into an EDV Document envelope with the same `documentCipher` used
|
|
49
|
+
* for content and stored opaquely under `/meta`; the server never sees
|
|
50
|
+
* plaintext `name`/`tags`. A reader with the keys decrypts it back
|
|
51
|
+
* transparently via `meta()`.
|
|
44
52
|
*/
|
|
45
53
|
import { EdvClientCore } from '@interop/edv-client';
|
|
46
54
|
import type { HttpResponse } from '@interop/http-client';
|
|
47
55
|
import type { IKeyAgreementKey, IKeyResolver } from '@interop/data-integrity-core';
|
|
48
56
|
import type { EncodedWrite, EncryptionProvider, ResourceCodec } from '../codec.js';
|
|
49
|
-
import type { Json, ResourceData } from '../types.js';
|
|
57
|
+
import type { Json, ResourceData, ResourceMetadataCustom } from '../types.js';
|
|
50
58
|
/**
|
|
51
59
|
* A {@link ResourceCodec} that encrypts on write and decrypts on read using an
|
|
52
60
|
* `EdvClientCore`'s public `documentCipher`. One instance is bound per encrypted
|
|
53
61
|
* collection handle.
|
|
54
62
|
*/
|
|
55
63
|
export declare class EdvCodec implements ResourceCodec {
|
|
56
|
-
readonly
|
|
64
|
+
readonly metadataMode: "encrypted";
|
|
57
65
|
readonly conditionalWrites = true;
|
|
58
66
|
private readonly _edv;
|
|
59
67
|
private readonly _keyAgreementKey;
|
|
60
68
|
private readonly _contentType;
|
|
61
69
|
private readonly _maxBlobBytes;
|
|
70
|
+
private readonly _idDerivation;
|
|
62
71
|
/**
|
|
63
72
|
* @param options {object}
|
|
64
73
|
* @param options.edv {EdvClientCore} holds the cipher + key resolver
|
|
65
74
|
* @param options.keyAgreementKey {IKeyAgreementKey} the recipient/decrypt key
|
|
66
75
|
* @param options.contentType {string} stored envelope content type
|
|
67
76
|
* @param options.maxBlobBytes {number} single-document binary cap
|
|
77
|
+
* @param options.idDerivation {string} how `add()` mints a document
|
|
78
|
+
* id: `'random'` (classic `generateId()`) or `'content'` (derived from the
|
|
79
|
+
* JWE ciphertext, content-addressed)
|
|
68
80
|
*/
|
|
69
|
-
constructor({ edv, keyAgreementKey, contentType, maxBlobBytes }: {
|
|
81
|
+
constructor({ edv, keyAgreementKey, contentType, maxBlobBytes, idDerivation }: {
|
|
70
82
|
edv: EdvClientCore;
|
|
71
83
|
keyAgreementKey: IKeyAgreementKey;
|
|
72
84
|
contentType: string;
|
|
73
85
|
maxBlobBytes: number;
|
|
86
|
+
idDerivation: 'random' | 'content';
|
|
74
87
|
});
|
|
75
88
|
/**
|
|
76
89
|
* @inheritdoc
|
|
@@ -88,6 +101,31 @@ export declare class EdvCodec implements ResourceCodec {
|
|
|
88
101
|
data?: unknown;
|
|
89
102
|
json(): Promise<unknown>;
|
|
90
103
|
}): Promise<Json | Blob>;
|
|
104
|
+
/**
|
|
105
|
+
* @inheritdoc
|
|
106
|
+
*
|
|
107
|
+
* Encrypts the user-writable `custom` into an EDV Document envelope
|
|
108
|
+
* (`{ jwe, ... }`) with the same `documentCipher.encrypt` used for content --
|
|
109
|
+
* `custom` becomes the document `content`. The envelope's own `sequence` is
|
|
110
|
+
* inert (metadata concurrency is the server's plaintext `metaVersion`, not the
|
|
111
|
+
* envelope), so each write re-encrypts fresh with no `update`.
|
|
112
|
+
*/
|
|
113
|
+
encodeMeta({ custom }: {
|
|
114
|
+
custom: ResourceMetadataCustom;
|
|
115
|
+
}): Promise<{
|
|
116
|
+
custom: object;
|
|
117
|
+
}>;
|
|
118
|
+
/**
|
|
119
|
+
* @inheritdoc
|
|
120
|
+
*
|
|
121
|
+
* Decrypts the stored `custom` envelope back to plaintext `{ name, tags }`. An
|
|
122
|
+
* absent `custom` (no metadata written yet, or cleared) decodes to `{}`; a
|
|
123
|
+
* present value must be an EDV envelope (else {@link EncryptionError}, the
|
|
124
|
+
* `_assertEnvelope` guard), so a foreign plaintext `custom` fails closed.
|
|
125
|
+
*/
|
|
126
|
+
decodeMeta({ custom }: {
|
|
127
|
+
custom?: unknown;
|
|
128
|
+
}): Promise<ResourceMetadataCustom>;
|
|
91
129
|
/**
|
|
92
130
|
* Asserts that a document read from an encrypted collection is an EDV envelope
|
|
93
131
|
* (`{ jwe, ... }`) before it is handed to the cipher. A plaintext or foreign
|
|
@@ -176,14 +214,24 @@ export interface EdvKeys {
|
|
|
176
214
|
* `application/*+json` parser.
|
|
177
215
|
* @param [options.maxBlobBytes] {number} single-document binary cap (default
|
|
178
216
|
* 1 MiB)
|
|
217
|
+
* @param [options.idDerivation] {string} how `add()` mints a document id.
|
|
218
|
+
* `'random'` (default) is the classic mutable-document model: a random
|
|
219
|
+
* `generateId()` id, updated in place via `sequence`. `'content'` derives the
|
|
220
|
+
* id from the encrypted envelope's JWE ciphertext
|
|
221
|
+
* (`EdvDocumentCipher.deriveId`), making documents content-addressed and
|
|
222
|
+
* therefore immutable (an "update" is delete-old + add-new) -- the model a
|
|
223
|
+
* replicating store wants, since the id is stable across replicas with no
|
|
224
|
+
* mapping table. Both formats pass the same EDV id check; the explicit-id
|
|
225
|
+
* `put(id, ...)` path is unaffected either way.
|
|
179
226
|
* @returns {EncryptionProvider}
|
|
180
227
|
*/
|
|
181
|
-
export declare function createEdvEncryption({ resolveKeys, contentType, maxBlobBytes }: {
|
|
228
|
+
export declare function createEdvEncryption({ resolveKeys, contentType, maxBlobBytes, idDerivation }: {
|
|
182
229
|
resolveKeys: (ref: {
|
|
183
230
|
spaceId: string;
|
|
184
231
|
collectionId: string;
|
|
185
232
|
}) => Promise<EdvKeys | null>;
|
|
186
233
|
contentType?: string;
|
|
187
234
|
maxBlobBytes?: number;
|
|
235
|
+
idDerivation?: 'random' | 'content';
|
|
188
236
|
}): EncryptionProvider;
|
|
189
237
|
//# sourceMappingURL=EdvCodec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EdvCodec.d.ts","sourceRoot":"","sources":["../../src/edv/EdvCodec.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"EdvCodec.d.ts","sourceRoot":"","sources":["../../src/edv/EdvCodec.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAEV,gBAAgB,EAChB,YAAY,EACb,MAAM,8BAA8B,CAAA;AACrC,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACd,MAAM,aAAa,CAAA;AAQpB,OAAO,KAAK,EAAE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,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAmB/B;;;;;;;OAOG;IACG,UAAU,CAAC,EACf,MAAM,EACP,EAAE;QACD,MAAM,CAAC,EAAE,OAAO,CAAA;KACjB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAYnC;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,eAAe;IAkBvB;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;YACW,WAAW;IAoEzB;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,aAAa;CA+BtB;AAsBD;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,eAAe,EAAE,gBAAgB,CAAA;IACjC,WAAW,EAAE,YAAY,CAAA;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,WAAW,EACX,WAAkC,EAClC,YAAqC,EACrC,YAAuB,EACxB,EAAE;IACD,WAAW,EAAE,CAAC,GAAG,EAAE;QACjB,OAAO,EAAE,MAAM,CAAA;QACf,YAAY,EAAE,MAAM,CAAA;KACrB,KAAK,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAA;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,YAAY,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;CACpC,GAAG,kBAAkB,CA0BrB"}
|
package/dist/edv/EdvCodec.js
CHANGED
|
@@ -22,8 +22,13 @@
|
|
|
22
22
|
* - **Restrict-mode ids.** `add()` mints a 128-bit multibase EDV id; the WAS
|
|
23
23
|
* resource id IS that EDV id. `put(id, ...)` accepts only an EDV-format id --
|
|
24
24
|
* a human-readable id is rejected (it would leak onto the URL). Carry a
|
|
25
|
-
* human-readable label inside the encrypted content instead.
|
|
26
|
-
*
|
|
25
|
+
* human-readable label inside the encrypted content instead. By default the
|
|
26
|
+
* minted id is random (`generateId()`, the classic mutable-document model);
|
|
27
|
+
* with `idDerivation: 'content'` it is content-derived instead -- encrypt
|
|
28
|
+
* first, then `deriveId()` a truncated SHA-256 of the JWE ciphertext and
|
|
29
|
+
* stamp it on the envelope -- making the document content-addressed (and so
|
|
30
|
+
* immutable: an "update" is delete-old + add-new). Both formats pass the same
|
|
31
|
+
* EDV id check and are indistinguishable on the wire.
|
|
27
32
|
* - **Inline non-JSON as a single JWE.** A `Blob`/`Uint8Array` under the size cap
|
|
28
33
|
* is encrypted as one document -- stored as a legible UTF-8 string for a
|
|
29
34
|
* text-family type (else base64) -- with the plaintext content type and the
|
|
@@ -38,9 +43,12 @@
|
|
|
38
43
|
* surfaces as a `PreconditionFailedError` (412) -- the lost-update guard --
|
|
39
44
|
* rather than the old advisory last-writer-wins. Against a backend that does
|
|
40
45
|
* not advertise `conditional-writes` (no ETag) it degrades to advisory.
|
|
41
|
-
* - **
|
|
42
|
-
* `
|
|
43
|
-
*
|
|
46
|
+
* - **Encrypted metadata.** `metadataMode` is `'encrypted'`, so a Resource's
|
|
47
|
+
* user-writable `custom` (`name`/`tags`, via `setName`/`setTags`/`setMeta`) is
|
|
48
|
+
* encrypted into an EDV Document envelope with the same `documentCipher` used
|
|
49
|
+
* for content and stored opaquely under `/meta`; the server never sees
|
|
50
|
+
* plaintext `name`/`tags`. A reader with the keys decrypts it back
|
|
51
|
+
* transparently via `meta()`.
|
|
44
52
|
*/
|
|
45
53
|
import { EdvClientCore } from '@interop/edv-client';
|
|
46
54
|
import { EncryptionError, ValidationError } from '../errors.js';
|
|
@@ -102,24 +110,29 @@ function base64ToBytes(base64) {
|
|
|
102
110
|
* collection handle.
|
|
103
111
|
*/
|
|
104
112
|
export class EdvCodec {
|
|
105
|
-
|
|
113
|
+
metadataMode = 'encrypted';
|
|
106
114
|
conditionalWrites = true;
|
|
107
115
|
_edv;
|
|
108
116
|
_keyAgreementKey;
|
|
109
117
|
_contentType;
|
|
110
118
|
_maxBlobBytes;
|
|
119
|
+
_idDerivation;
|
|
111
120
|
/**
|
|
112
121
|
* @param options {object}
|
|
113
122
|
* @param options.edv {EdvClientCore} holds the cipher + key resolver
|
|
114
123
|
* @param options.keyAgreementKey {IKeyAgreementKey} the recipient/decrypt key
|
|
115
124
|
* @param options.contentType {string} stored envelope content type
|
|
116
125
|
* @param options.maxBlobBytes {number} single-document binary cap
|
|
126
|
+
* @param options.idDerivation {string} how `add()` mints a document
|
|
127
|
+
* id: `'random'` (classic `generateId()`) or `'content'` (derived from the
|
|
128
|
+
* JWE ciphertext, content-addressed)
|
|
117
129
|
*/
|
|
118
|
-
constructor({ edv, keyAgreementKey, contentType, maxBlobBytes }) {
|
|
130
|
+
constructor({ edv, keyAgreementKey, contentType, maxBlobBytes, idDerivation }) {
|
|
119
131
|
this._edv = edv;
|
|
120
132
|
this._keyAgreementKey = keyAgreementKey;
|
|
121
133
|
this._contentType = contentType;
|
|
122
134
|
this._maxBlobBytes = maxBlobBytes;
|
|
135
|
+
this._idDerivation = idDerivation;
|
|
123
136
|
}
|
|
124
137
|
/**
|
|
125
138
|
* @inheritdoc
|
|
@@ -130,7 +143,13 @@ export class EdvCodec {
|
|
|
130
143
|
'-- it would leak onto the URL. Use add() to mint an EDV document ' +
|
|
131
144
|
'id, or carry the human-readable label inside the encrypted content.');
|
|
132
145
|
}
|
|
133
|
-
|
|
146
|
+
// `add()` (no caller id): mint a random id up front, or -- in `'content'`
|
|
147
|
+
// mode -- leave it unset and stamp the content-derived id after encryption
|
|
148
|
+
// (the id is a function of the ciphertext, which does not exist yet).
|
|
149
|
+
let docId = id ??
|
|
150
|
+
(this._idDerivation === 'content'
|
|
151
|
+
? undefined
|
|
152
|
+
: (await this._edv.generateId()));
|
|
134
153
|
const { content, meta } = await this._toDocument(data, contentType, docId);
|
|
135
154
|
// When the write path pre-read a current envelope, advance `sequence` from
|
|
136
155
|
// its prior value (`encrypt({ update: true })` increments it) and pin the
|
|
@@ -147,7 +166,7 @@ export class EdvCodec {
|
|
|
147
166
|
const recipients = documentCipher.createDefaultRecipients(this._keyAgreementKey);
|
|
148
167
|
const encrypted = await documentCipher.encrypt({
|
|
149
168
|
doc: {
|
|
150
|
-
id: docId,
|
|
169
|
+
...(docId !== undefined && { id: docId }),
|
|
151
170
|
content,
|
|
152
171
|
// `content` and `meta` are both sealed inside the JWE; `meta` carries the
|
|
153
172
|
// plaintext content type and the inline-encoding discriminator, taken
|
|
@@ -160,6 +179,13 @@ export class EdvCodec {
|
|
|
160
179
|
hmac: undefined,
|
|
161
180
|
update: priorDoc !== null
|
|
162
181
|
});
|
|
182
|
+
if (docId === undefined) {
|
|
183
|
+
// Encrypt-then-stamp: the id lives in the cleartext envelope, outside the
|
|
184
|
+
// JWE, so deriving it from the ciphertext and setting it afterwards does
|
|
185
|
+
// not invalidate the envelope.
|
|
186
|
+
docId = await documentCipher.deriveId({ jwe: encrypted.jwe });
|
|
187
|
+
encrypted.id = docId;
|
|
188
|
+
}
|
|
163
189
|
return {
|
|
164
190
|
id: docId,
|
|
165
191
|
body: ENCODER.encode(JSON.stringify(encrypted)),
|
|
@@ -192,6 +218,50 @@ export class EdvCodec {
|
|
|
192
218
|
});
|
|
193
219
|
return this._fromDocument(decrypted.content, decrypted.meta);
|
|
194
220
|
}
|
|
221
|
+
/**
|
|
222
|
+
* @inheritdoc
|
|
223
|
+
*
|
|
224
|
+
* Encrypts the user-writable `custom` into an EDV Document envelope
|
|
225
|
+
* (`{ jwe, ... }`) with the same `documentCipher.encrypt` used for content --
|
|
226
|
+
* `custom` becomes the document `content`. The envelope's own `sequence` is
|
|
227
|
+
* inert (metadata concurrency is the server's plaintext `metaVersion`, not the
|
|
228
|
+
* envelope), so each write re-encrypts fresh with no `update`.
|
|
229
|
+
*/
|
|
230
|
+
async encodeMeta({ custom }) {
|
|
231
|
+
const { documentCipher } = this._edv;
|
|
232
|
+
const recipients = documentCipher.createDefaultRecipients(this._keyAgreementKey);
|
|
233
|
+
// The document needs an EDV id (the cipher asserts one on decrypt). It is
|
|
234
|
+
// opaque to the server -- carried inside the un-decryptable envelope -- and
|
|
235
|
+
// minted fresh each write, since the metadata envelope is never updated in
|
|
236
|
+
// place (concurrency is the server's plaintext `metaVersion`, Decision 3).
|
|
237
|
+
const id = (await this._edv.generateId());
|
|
238
|
+
const encrypted = await documentCipher.encrypt({
|
|
239
|
+
doc: { id, content: custom },
|
|
240
|
+
recipients,
|
|
241
|
+
keyResolver: this._edv.keyResolver,
|
|
242
|
+
hmac: undefined
|
|
243
|
+
});
|
|
244
|
+
return { custom: encrypted };
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* @inheritdoc
|
|
248
|
+
*
|
|
249
|
+
* Decrypts the stored `custom` envelope back to plaintext `{ name, tags }`. An
|
|
250
|
+
* absent `custom` (no metadata written yet, or cleared) decodes to `{}`; a
|
|
251
|
+
* present value must be an EDV envelope (else {@link EncryptionError}, the
|
|
252
|
+
* `_assertEnvelope` guard), so a foreign plaintext `custom` fails closed.
|
|
253
|
+
*/
|
|
254
|
+
async decodeMeta({ custom }) {
|
|
255
|
+
if (custom === undefined || custom === null) {
|
|
256
|
+
return {};
|
|
257
|
+
}
|
|
258
|
+
this._assertEnvelope(custom, 'read');
|
|
259
|
+
const decrypted = await this._edv.documentCipher.decrypt({
|
|
260
|
+
encryptedDoc: custom,
|
|
261
|
+
keyAgreementKey: this._keyAgreementKey
|
|
262
|
+
});
|
|
263
|
+
return (decrypted.content ?? {});
|
|
264
|
+
}
|
|
195
265
|
/**
|
|
196
266
|
* Asserts that a document read from an encrypted collection is an EDV envelope
|
|
197
267
|
* (`{ jwe, ... }`) before it is handed to the cipher. A plaintext or foreign
|
|
@@ -377,9 +447,18 @@ const EDV_SCHEME = 'edv';
|
|
|
377
447
|
* `application/*+json` parser.
|
|
378
448
|
* @param [options.maxBlobBytes] {number} single-document binary cap (default
|
|
379
449
|
* 1 MiB)
|
|
450
|
+
* @param [options.idDerivation] {string} how `add()` mints a document id.
|
|
451
|
+
* `'random'` (default) is the classic mutable-document model: a random
|
|
452
|
+
* `generateId()` id, updated in place via `sequence`. `'content'` derives the
|
|
453
|
+
* id from the encrypted envelope's JWE ciphertext
|
|
454
|
+
* (`EdvDocumentCipher.deriveId`), making documents content-addressed and
|
|
455
|
+
* therefore immutable (an "update" is delete-old + add-new) -- the model a
|
|
456
|
+
* replicating store wants, since the id is stable across replicas with no
|
|
457
|
+
* mapping table. Both formats pass the same EDV id check; the explicit-id
|
|
458
|
+
* `put(id, ...)` path is unaffected either way.
|
|
380
459
|
* @returns {EncryptionProvider}
|
|
381
460
|
*/
|
|
382
|
-
export function createEdvEncryption({ resolveKeys, contentType = DEFAULT_CONTENT_TYPE, maxBlobBytes = DEFAULT_MAX_BLOB_BYTES }) {
|
|
461
|
+
export function createEdvEncryption({ resolveKeys, contentType = DEFAULT_CONTENT_TYPE, maxBlobBytes = DEFAULT_MAX_BLOB_BYTES, idDerivation = 'random' }) {
|
|
383
462
|
return {
|
|
384
463
|
async codecFor({ spaceId, collectionId, scheme, keys }) {
|
|
385
464
|
if (scheme !== EDV_SCHEME) {
|
|
@@ -399,7 +478,8 @@ export function createEdvEncryption({ resolveKeys, contentType = DEFAULT_CONTENT
|
|
|
399
478
|
edv,
|
|
400
479
|
keyAgreementKey: resolved.keyAgreementKey,
|
|
401
480
|
contentType,
|
|
402
|
-
maxBlobBytes
|
|
481
|
+
maxBlobBytes,
|
|
482
|
+
idDerivation
|
|
403
483
|
});
|
|
404
484
|
}
|
|
405
485
|
};
|
package/dist/edv/EdvCodec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EdvCodec.js","sourceRoot":"","sources":["../../src/edv/EdvCodec.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"EdvCodec.js","sourceRoot":"","sources":["../../src/edv/EdvCodec.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH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a `PUT` and `add(...)`, with no id, stays
|
|
71
71
|
* a server-minting `POST`) and reuses `prepareBody` -- including the
|
|
72
72
|
* filename-extension content-type guess when an id is present. `decode` reuses
|
|
73
|
-
* `parseResource`.
|
|
73
|
+
* `parseResource`. `encodeMeta` / `decodeMeta` are the identity transform, so
|
|
74
|
+
* metadata round-trips as server-visible plaintext byte-for-byte.
|
|
74
75
|
*/
|
|
75
76
|
export declare const identityCodec: ResourceCodec;
|
|
76
77
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../src/internal/codec.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAgB,aAAa,EAAE,MAAM,aAAa,CAAA;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAIjD,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EAClB,KAAK,
|
|
1
|
+
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../src/internal/codec.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAgB,aAAa,EAAE,MAAM,aAAa,CAAA;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAIjD,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EAClB,KAAK,EAIN,MAAM,aAAa,CAAA;AAEpB;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAC1B;IAAE,QAAQ,EAAE,KAAK,CAAA;CAAE,GAAG;IAAE,QAAQ,EAAE,IAAI,CAAC;IAAC,UAAU,CAAC,EAAE,oBAAoB,CAAA;CAAE,CAAA;AAE7E;;;;;;;;;;;;;GAaG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,aAAa,EACtB,EACE,OAAO,EACP,YAAY,EACZ,UAAU,EACX,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,KAAK,CAAA;CAAE,GAC/D,OAAO,CAAC,gBAAgB,CAAC,CAS3B;AAED;;;;;;GAMG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,CAAwB;IACzC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA8B;IAEvD;;;OAGG;gBACS,OAAO,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC;IAIjD;;;;OAIG;IACH,GAAG,IAAI,OAAO,CAAC,aAAa,CAAC;IAiB7B;;;;OAIG;IACH,KAAK,IAAI,IAAI;CAGd;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,aAsC3B,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,aAAa,EACtB,EACE,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,UAAU,EACX,EAAE;IACD,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,kBAAkB,CAAA;IAC7B,UAAU,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAA;CAC5C,GACA,OAAO,CAAC,aAAa,CAAC,CA4CxB"}
|
package/dist/internal/codec.js
CHANGED
|
@@ -77,10 +77,11 @@ export class CodecHolder {
|
|
|
77
77
|
* caller's `id` (so `put(id, ...)` is a `PUT` and `add(...)`, with no id, stays
|
|
78
78
|
* a server-minting `POST`) and reuses `prepareBody` -- including the
|
|
79
79
|
* filename-extension content-type guess when an id is present. `decode` reuses
|
|
80
|
-
* `parseResource`.
|
|
80
|
+
* `parseResource`. `encodeMeta` / `decodeMeta` are the identity transform, so
|
|
81
|
+
* metadata round-trips as server-visible plaintext byte-for-byte.
|
|
81
82
|
*/
|
|
82
83
|
export const identityCodec = {
|
|
83
|
-
|
|
84
|
+
metadataMode: 'plaintext',
|
|
84
85
|
async encode({ id, data, contentType }) {
|
|
85
86
|
const prepared = prepareBody(data, { contentType, filename: id });
|
|
86
87
|
return {
|
|
@@ -92,6 +93,12 @@ export const identityCodec = {
|
|
|
92
93
|
},
|
|
93
94
|
async decode(response) {
|
|
94
95
|
return (await parseResource(response));
|
|
96
|
+
},
|
|
97
|
+
async encodeMeta({ custom }) {
|
|
98
|
+
return { custom };
|
|
99
|
+
},
|
|
100
|
+
async decodeMeta(stored) {
|
|
101
|
+
return (stored.custom ?? {});
|
|
95
102
|
}
|
|
96
103
|
};
|
|
97
104
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codec.js","sourceRoot":"","sources":["../../src/internal/codec.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"codec.js","sourceRoot":"","sources":["../../src/internal/codec.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAwB9C;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,OAAsB,EACtB,EACE,OAAO,EACP,YAAY,EACZ,UAAU,EACoD;IAEhE,MAAM,WAAW,GAAG,MAAM,kBAAkB,CAAC,OAAO,EAAE;QACpD,OAAO;QACP,YAAY;QACZ,UAAU;KACX,CAAC,CAAA;IACF,OAAO,WAAW,KAAK,IAAI;QACzB,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;QACrB,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,CAAC,UAAU,EAAE,CAAA;AAC5D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,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O,EAAE;QACnC,OAAO;QACP,YAAY;QACZ,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,MAAM;KACjC,CAAC,CAAA;AACJ,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,KAAK,UAAU,oBAAoB,CACjC,OAAsB,EACtB,EACE,OAAO,EACP,YAAY,EACZ,MAAM,EACN,IAAI,EACsE;IAE5E,MAAM,KAAK,GAAG,GAAG,OAAO,IAAI,YAAY,EAAE,CAAA;IAC1C,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QACxB,MAAM,IAAI,eAAe,CACvB,cAAc,KAAK,0BAA0B,MAAM,qBAAqB;YACtE,8DAA8D;YAC9D,sDAAsD,CACzD,CAAA;IACH,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC;QAC9C,OAAO;QACP,YAAY;QACZ,MAAM;QACN,IAAI;KACL,CAAC,CAAA;IACF,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,eAAe,CACvB,cAAc,KAAK,0BAA0B,MAAM,qBAAqB;YACtE,wEAAwE;YACxE,kEAAkE,CACrE,CAAA;IACH,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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.12.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "pnpm run clear && tsc",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@interop/data-integrity-core": "^8.1.0",
|
|
46
46
|
"@interop/ed25519-signature": "^7.1.3",
|
|
47
|
-
"@interop/edv-client": "^17.
|
|
47
|
+
"@interop/edv-client": "^17.4.0",
|
|
48
48
|
"@interop/ezcap": "^7.3.2",
|
|
49
49
|
"@interop/http-client": "^1.0.4",
|
|
50
|
-
"@interop/storage-core": "^0.3.
|
|
50
|
+
"@interop/storage-core": "^0.3.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@eslint/js": "^10.0.1",
|