@interop/was-client 0.26.0 → 0.27.2
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/Collection.d.ts.map +1 -1
- package/dist/Collection.js +27 -66
- package/dist/Collection.js.map +1 -1
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +28 -6
- package/dist/Resource.js.map +1 -1
- package/dist/Space.d.ts.map +1 -1
- package/dist/Space.js +10 -25
- package/dist/Space.js.map +1 -1
- package/dist/WasClient.d.ts.map +1 -1
- package/dist/WasClient.js +9 -19
- package/dist/WasClient.js.map +1 -1
- package/dist/codec.d.ts +31 -5
- package/dist/codec.d.ts.map +1 -1
- package/dist/edv/EdvCodec.d.ts +9 -14
- package/dist/edv/EdvCodec.d.ts.map +1 -1
- package/dist/edv/EdvCodec.js +147 -71
- package/dist/edv/EdvCodec.js.map +1 -1
- package/dist/edv/WasTransport.d.ts +1 -2
- package/dist/edv/WasTransport.d.ts.map +1 -1
- package/dist/edv/WasTransport.js +19 -28
- package/dist/edv/WasTransport.js.map +1 -1
- package/dist/edv/constants.d.ts +11 -0
- package/dist/edv/constants.d.ts.map +1 -1
- package/dist/edv/constants.js +16 -4
- package/dist/edv/constants.js.map +1 -1
- package/dist/edv/docCipher.d.ts +10 -26
- package/dist/edv/docCipher.d.ts.map +1 -1
- package/dist/edv/docCipher.js +62 -135
- package/dist/edv/docCipher.js.map +1 -1
- package/dist/edv/epochCrypto.d.ts +0 -4
- package/dist/edv/epochCrypto.d.ts.map +1 -1
- package/dist/edv/epochCrypto.js +4 -4
- package/dist/edv/epochCrypto.js.map +1 -1
- package/dist/edv/epochKeys.d.ts.map +1 -1
- package/dist/edv/epochKeys.js +2 -4
- package/dist/edv/epochKeys.js.map +1 -1
- package/dist/edv/epochMac.d.ts +24 -1
- package/dist/edv/epochMac.d.ts.map +1 -1
- package/dist/edv/epochMac.js +43 -13
- package/dist/edv/epochMac.js.map +1 -1
- package/dist/edv/index.d.ts +6 -4
- package/dist/edv/index.d.ts.map +1 -1
- package/dist/edv/index.js +4 -3
- package/dist/edv/index.js.map +1 -1
- package/dist/edv/recipients.d.ts +29 -17
- package/dist/edv/recipients.d.ts.map +1 -1
- package/dist/edv/recipients.js +177 -112
- package/dist/edv/recipients.js.map +1 -1
- package/dist/errors.d.ts +29 -12
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +37 -65
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/internal/codec.d.ts +15 -12
- package/dist/internal/codec.d.ts.map +1 -1
- package/dist/internal/codec.js +4 -6
- package/dist/internal/codec.js.map +1 -1
- package/dist/internal/conditional.d.ts +9 -4
- package/dist/internal/conditional.d.ts.map +1 -1
- package/dist/internal/conditional.js +9 -2
- package/dist/internal/conditional.js.map +1 -1
- package/dist/internal/content.d.ts +28 -24
- package/dist/internal/content.d.ts.map +1 -1
- package/dist/internal/content.js +28 -13
- package/dist/internal/content.js.map +1 -1
- package/dist/internal/describe.d.ts +15 -2
- package/dist/internal/describe.d.ts.map +1 -1
- package/dist/internal/describe.js +17 -0
- package/dist/internal/describe.js.map +1 -1
- package/dist/internal/pagination.d.ts +20 -1
- package/dist/internal/pagination.d.ts.map +1 -1
- package/dist/internal/pagination.js +22 -0
- package/dist/internal/pagination.js.map +1 -1
- package/dist/internal/paths.d.ts +0 -11
- package/dist/internal/paths.d.ts.map +1 -1
- package/dist/internal/paths.js +20 -33
- package/dist/internal/paths.js.map +1 -1
- package/dist/internal/policy.d.ts.map +1 -1
- package/dist/internal/policy.js +2 -9
- package/dist/internal/policy.js.map +1 -1
- package/dist/internal/write.d.ts +50 -4
- package/dist/internal/write.d.ts.map +1 -1
- package/dist/internal/write.js +45 -0
- package/dist/internal/write.js.map +1 -1
- package/dist/sync/cid.d.ts.map +1 -1
- package/dist/sync/cid.js +8 -2
- package/dist/sync/cid.js.map +1 -1
- package/dist/sync/port.d.ts +9 -8
- package/dist/sync/port.d.ts.map +1 -1
- package/dist/sync/port.js +74 -70
- package/dist/sync/port.js.map +1 -1
- package/dist/sync/provisioning.d.ts +4 -1
- package/dist/sync/provisioning.d.ts.map +1 -1
- package/dist/sync/provisioning.js +11 -2
- package/dist/sync/provisioning.js.map +1 -1
- package/dist/sync/types.d.ts +7 -10
- package/dist/sync/types.d.ts.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +14 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WasTransport.d.ts","sourceRoot":"","sources":["../../src/edv/WasTransport.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAE/C,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,kBAAkB,EACnB,MAAM,8BAA8B,CAAA;AACrC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"WasTransport.d.ts","sourceRoot":"","sources":["../../src/edv/WasTransport.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAE/C,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,kBAAkB,EACnB,MAAM,8BAA8B,CAAA;AACrC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAgChD;;;GAGG;AACH,KAAK,YAAY,GAAG,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;AAqD9C,qBAAa,YAAa,SAAQ,SAAS;;IACzC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ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E,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,SAAS,CAAC;CA6BrE"}
|
package/dist/edv/WasTransport.js
CHANGED
|
@@ -50,8 +50,7 @@ import { httpStatus } from '../errors.js';
|
|
|
50
50
|
import { BackendFeatures } from '../internal/features.js';
|
|
51
51
|
import { readJsonData } from '../internal/content.js';
|
|
52
52
|
import { collectionBackend, collectionQuery, resourceChunkPath, resourcePath } from '../internal/paths.js';
|
|
53
|
-
import { DEFAULT_CONTENT_TYPE, envelopeBytes
|
|
54
|
-
export { JOSE_CONTENT_TYPE };
|
|
53
|
+
import { DEFAULT_CONTENT_TYPE, envelopeBytes } from './constants.js';
|
|
55
54
|
/**
|
|
56
55
|
* The content type a serialized EDV chunk is stored under. Deliberately an
|
|
57
56
|
* opaque binary type (not `application/json`): the chunk is `PUT` as raw bytes
|
|
@@ -193,37 +192,29 @@ export class WasTransport extends Transport {
|
|
|
193
192
|
if (!encrypted) {
|
|
194
193
|
throw new TypeError('"encrypted" is required.');
|
|
195
194
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
},
|
|
206
|
-
409: {
|
|
207
|
-
name: 'DuplicateError',
|
|
208
|
-
message: DUPLICATE_ATTRIBUTE_MESSAGE
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
if (await this.#exists(encrypted.id)) {
|
|
215
|
-
throw namedError({
|
|
216
|
-
name: 'DuplicateError',
|
|
217
|
-
message: `A document with id "${encrypted.id}" already exists.`
|
|
218
|
-
});
|
|
195
|
+
const conditional = await this.#features.has('conditional-writes');
|
|
196
|
+
const duplicateId = {
|
|
197
|
+
name: 'DuplicateError',
|
|
198
|
+
message: `A document with id "${encrypted.id}" already exists.`
|
|
199
|
+
};
|
|
200
|
+
// Without the atomic precondition, fall back to the advisory (non-atomic)
|
|
201
|
+
// existence check.
|
|
202
|
+
if (!conditional && (await this.#exists(encrypted.id))) {
|
|
203
|
+
throw namedError(duplicateId);
|
|
219
204
|
}
|
|
220
205
|
try {
|
|
221
|
-
await this.#put(encrypted.id, encrypted);
|
|
206
|
+
await this.#put(encrypted.id, encrypted, conditional ? { 'if-none-match': '*' } : {});
|
|
222
207
|
}
|
|
223
208
|
catch (err) {
|
|
224
|
-
|
|
209
|
+
const mapping = {
|
|
225
210
|
409: { name: 'DuplicateError', message: DUPLICATE_ATTRIBUTE_MESSAGE }
|
|
226
|
-
}
|
|
211
|
+
};
|
|
212
|
+
// Only the conditional insert can trip a 412: its `If-None-Match: *`
|
|
213
|
+
// precondition failing IS "the document already exists".
|
|
214
|
+
if (conditional) {
|
|
215
|
+
mapping[412] = duplicateId;
|
|
216
|
+
}
|
|
217
|
+
mapTransportError(err, mapping);
|
|
227
218
|
}
|
|
228
219
|
}
|
|
229
220
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WasTransport.js","sourceRoot":"","sources":["../../src/edv/WasTransport.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAQ/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,YAAY,EACb,MAAM,sBAAsB,CAAA;AAC7B,OAAO,
|
|
1
|
+
{"version":3,"file":"WasTransport.js","sourceRoot":"","sources":["../../src/edv/WasTransport.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AC,OAAO,GAAG,EAAE,CAAC;YACb,iBAAiB,CAAC,GAAG,EAAE;gBACrB,GAAG,EAAE;oBACH,IAAI,EAAE,eAAe;oBACrB,OAAO,EAAE,SAAS,UAAU,iBAAiB,KAAK,cAAc;iBACjE;aACF,CAAC,CAAA;QACJ,CAAC;QACD,mEAAmE;QACnE,0EAA0E;QAC1E,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAc,CAAA;IACvD,CAAC;CACF"}
|
package/dist/edv/constants.d.ts
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The EDV-over-WAS scheme version: the version of the envelope wire format
|
|
3
|
+
* this package's cipher writes, as registered in the WAS spec's Encryption
|
|
4
|
+
* Scheme Registry (a positive integer with a total order, not a semantic
|
|
5
|
+
* version; an absent `version` on a descriptor means `1`). This is the ONLY
|
|
6
|
+
* place the number is declared: the collection `encryption` descriptor PUTs
|
|
7
|
+
* stamp it, and the cipher binds the same constant into every envelope's
|
|
8
|
+
* AEAD-protected `was.v` header parameter, so the descriptor and the envelopes
|
|
9
|
+
* can never disagree.
|
|
10
|
+
*/
|
|
11
|
+
export declare const EDV_SCHEME_VERSION = 1;
|
|
1
12
|
/**
|
|
2
13
|
* The content type used by default: plain JSON, which an unmodified WAS server
|
|
3
14
|
* accepts. The stored envelope is still self-identifying by its `jwe` field.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/edv/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/edv/constants.ts"],"names":[],"mappings":"AAYA;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,IAAI,CAAA;AAEnC;;;GAGG;AACH,eAAO,MAAM,oBAAoB,qBAAqB,CAAA;AAEtD;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,0BAA0B,CAAA;AAExD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAE1D"}
|
package/dist/edv/constants.js
CHANGED
|
@@ -2,12 +2,24 @@
|
|
|
2
2
|
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
-
* Shared EDV-over-WAS constants: the
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* of each declaring
|
|
5
|
+
* Shared EDV-over-WAS constants: the scheme version of the envelope wire
|
|
6
|
+
* format, the stored-envelope content types (the portable default and the
|
|
7
|
+
* preferred JOSE type), and the envelope byte serialization. Kept in one place
|
|
8
|
+
* so `WasTransport` and `EdvCodec` stay in lockstep instead of each declaring
|
|
9
|
+
* their own copy.
|
|
9
10
|
*/
|
|
10
11
|
import { ENCODER } from '../internal/content.js';
|
|
12
|
+
/**
|
|
13
|
+
* The EDV-over-WAS scheme version: the version of the envelope wire format
|
|
14
|
+
* this package's cipher writes, as registered in the WAS spec's Encryption
|
|
15
|
+
* Scheme Registry (a positive integer with a total order, not a semantic
|
|
16
|
+
* version; an absent `version` on a descriptor means `1`). This is the ONLY
|
|
17
|
+
* place the number is declared: the collection `encryption` descriptor PUTs
|
|
18
|
+
* stamp it, and the cipher binds the same constant into every envelope's
|
|
19
|
+
* AEAD-protected `was.v` header parameter, so the descriptor and the envelopes
|
|
20
|
+
* can never disagree.
|
|
21
|
+
*/
|
|
22
|
+
export const EDV_SCHEME_VERSION = 1;
|
|
11
23
|
/**
|
|
12
24
|
* The content type used by default: plain JSON, which an unmodified WAS server
|
|
13
25
|
* accepts. The stored envelope is still self-identifying by its `jwe` field.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/edv/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/edv/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;GAMG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAEhD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAA;AAEnC;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,kBAAkB,CAAA;AAEtD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,uBAAuB,CAAA;AAExD;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,QAAgB;IAC5C,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAA;AACjD,CAAC"}
|
package/dist/edv/docCipher.d.ts
CHANGED
|
@@ -23,9 +23,7 @@
|
|
|
23
23
|
*
|
|
24
24
|
* Rotation is prospective, never retroactive: appending an epoch does not
|
|
25
25
|
* rewrite existing resources, and because resource ids are content-derived they
|
|
26
|
-
* stay stable across a rotation.
|
|
27
|
-
* resources indefinitely -- an envelope encrypted straight to the key-agreement
|
|
28
|
-
* key (before any epoch existed) always decrypts through the single-key path.
|
|
26
|
+
* stay stable across a rotation.
|
|
29
27
|
*
|
|
30
28
|
* Runtime note (React Native): this exercises the cipher's AES-KW (with a
|
|
31
29
|
* pure-JS Hermes fallback) and `TextDecoder`; both must be present on the
|
|
@@ -37,22 +35,7 @@ import type { DocCipher } from '../sync/types.js';
|
|
|
37
35
|
import type { RecipientPublicKey } from './recipients.js';
|
|
38
36
|
export { isEncryptedEnvelope } from '../sync/envelope.js';
|
|
39
37
|
export type { DocCipher } from '../sync/types.js';
|
|
40
|
-
|
|
41
|
-
* Thrown by a {@link DocCipher.decrypt} when a stored envelope names a JWE
|
|
42
|
-
* recipient (`kid`) this cipher cannot route: neither the key-agreement key nor
|
|
43
|
-
* -- on an epoch-aware cipher -- any epoch this cipher knows about. It signals
|
|
44
|
-
* that the caller's cached Collection Description may be stale and should be
|
|
45
|
-
* re-read before retrying: an epoch rotation emits no change-feed entry, so a
|
|
46
|
-
* cipher built from a pre-rotation descriptor meets envelopes stamped with a
|
|
47
|
-
* newer epoch it has never seen. It also fires on a single-key cipher that
|
|
48
|
-
* meets an envelope encrypted to a different key-agreement key entirely.
|
|
49
|
-
*/
|
|
50
|
-
export declare class UnknownEpochError extends Error {
|
|
51
|
-
constructor({ collectionId, kids }: {
|
|
52
|
-
collectionId: string;
|
|
53
|
-
kids: string[];
|
|
54
|
-
});
|
|
55
|
-
}
|
|
38
|
+
export { UnknownEpochError } from '../errors.js';
|
|
56
39
|
/**
|
|
57
40
|
* A wallet's own key-agreement key as a `RecipientPublicKey` -- the "recipient
|
|
58
41
|
* zero" entry a caller passes to `initRecipients` when it first makes a
|
|
@@ -81,15 +64,16 @@ export declare function ownerRecipient({ keyAgreementKey }: {
|
|
|
81
64
|
* `encryptUpdate`).
|
|
82
65
|
*
|
|
83
66
|
* With no `encryption` descriptor (or a descriptor with no epochs) the cipher
|
|
84
|
-
* is single-
|
|
85
|
-
* With epochs on the descriptor the cipher
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
67
|
+
* is single-recipient: the key-agreement key encrypts and decrypts directly.
|
|
68
|
+
* With epochs on the descriptor the cipher is multi-recipient: it encrypts
|
|
69
|
+
* every write under the descriptor's `currentEpoch` and decrypts any epoch
|
|
70
|
+
* this reader still holds a key for. Either way one codec owns both axes --
|
|
71
|
+
* decrypt routing (matching an envelope's JWE recipient `kid`s against the
|
|
72
|
+
* reader's candidate keys, raising `UnknownEpochError` for an envelope no
|
|
73
|
+
* candidate can route) lives in the codec, not here.
|
|
90
74
|
*
|
|
91
75
|
* The reader must be a recipient of every epoch on the descriptor (the owner is
|
|
92
|
-
* "recipient zero"). If it is a recipient of none, building the
|
|
76
|
+
* "recipient zero"). If it is a recipient of none, building the cipher
|
|
93
77
|
* throws {@link KeyUnwrapError}; this surfaces it with a clearer error rather
|
|
94
78
|
* than silently writing envelopes other recipients cannot read.
|
|
95
79
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docCipher.d.ts","sourceRoot":"","sources":["../../src/edv/docCipher.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"docCipher.d.ts","sourceRoot":"","sources":["../../src/edv/docCipher.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACb,MAAM,8BAA8B,CAAA;AAGrC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAQ,MAAM,kBAAkB,CAAA;AAEvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAMzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACzD,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAEhD;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,EAC7B,eAAe,EAChB,EAAE;IACD,eAAe,EAAE,gBAAgB,CAAA;CAClC,GAAG,kBAAkB,CAcrB;AAmBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,eAAe,EACf,WAAW,EACX,YAAY,EACZ,YAAwB,EACxB,UAAU,EACX,EAAE;IACD,eAAe,EAAE,gBAAgB,CAAA;IACjC,WAAW,EAAE,YAAY,CAAA;IACzB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAA;IACnC,UAAU,CAAC,EAAE,oBAAoB,CAAA;CAClC,GAAG,OAAO,CAAC,SAAS,CAAC,CA0GrB"}
|
package/dist/edv/docCipher.js
CHANGED
|
@@ -1,30 +1,11 @@
|
|
|
1
1
|
import { KeyUnwrapError } from '../errors.js';
|
|
2
2
|
import { createEdvEncryption } from './EdvCodec.js';
|
|
3
|
-
import { epochKeyIdFor } from './epochCrypto.js';
|
|
4
3
|
// `isEncryptedEnvelope` and the `DocCipher` interface live in the crypto-free
|
|
5
|
-
// `../sync` module
|
|
6
|
-
//
|
|
4
|
+
// `../sync` module, and `UnknownEpochError` (thrown by the codec's decrypt
|
|
5
|
+
// routing) in the errors module; re-exported here so an encrypted-collection
|
|
6
|
+
// consumer that imports this subpath gets all three without a second import.
|
|
7
7
|
export { isEncryptedEnvelope } from '../sync/envelope.js';
|
|
8
|
-
|
|
9
|
-
* Thrown by a {@link DocCipher.decrypt} when a stored envelope names a JWE
|
|
10
|
-
* recipient (`kid`) this cipher cannot route: neither the key-agreement key nor
|
|
11
|
-
* -- on an epoch-aware cipher -- any epoch this cipher knows about. It signals
|
|
12
|
-
* that the caller's cached Collection Description may be stale and should be
|
|
13
|
-
* re-read before retrying: an epoch rotation emits no change-feed entry, so a
|
|
14
|
-
* cipher built from a pre-rotation descriptor meets envelopes stamped with a
|
|
15
|
-
* newer epoch it has never seen. It also fires on a single-key cipher that
|
|
16
|
-
* meets an envelope encrypted to a different key-agreement key entirely.
|
|
17
|
-
*/
|
|
18
|
-
export class UnknownEpochError extends Error {
|
|
19
|
-
constructor({ collectionId, kids }) {
|
|
20
|
-
super(`Cannot decrypt a resource in collection "${collectionId}": its ` +
|
|
21
|
-
`envelope names recipient key id(s) [${kids.join(', ')}] that match ` +
|
|
22
|
-
'neither the key-agreement key nor any known key epoch. The cached ' +
|
|
23
|
-
'Collection Description may be stale (an epoch rotation emits no ' +
|
|
24
|
-
'change-feed entry); re-read it and rebuild the cipher.');
|
|
25
|
-
this.name = 'UnknownEpochError';
|
|
26
|
-
}
|
|
27
|
-
}
|
|
8
|
+
export { UnknownEpochError } from '../errors.js';
|
|
28
9
|
/**
|
|
29
10
|
* A wallet's own key-agreement key as a `RecipientPublicKey` -- the "recipient
|
|
30
11
|
* zero" entry a caller passes to `initRecipients` when it first makes a
|
|
@@ -49,31 +30,20 @@ export function ownerRecipient({ keyAgreementKey }) {
|
|
|
49
30
|
return { id, publicKeyMultibase, type };
|
|
50
31
|
}
|
|
51
32
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
33
|
+
* Presents a locally-held envelope to the codec seam as the {@link
|
|
34
|
+
* ResponseLike} the seam is typed against. A replica's envelope never came
|
|
35
|
+
* from HTTP: the pre-parsed body, the `json()` fallback, and a headers stub
|
|
36
|
+
* (so an ETag lookup resolves to "no validator") are the whole surface.
|
|
37
|
+
*
|
|
38
|
+
* @param envelope {Json} the stored envelope
|
|
39
|
+
* @returns {ResponseLike}
|
|
56
40
|
*/
|
|
57
|
-
function
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return [];
|
|
64
|
-
}
|
|
65
|
-
const recipients = jwe.recipients;
|
|
66
|
-
if (!Array.isArray(recipients)) {
|
|
67
|
-
return [];
|
|
68
|
-
}
|
|
69
|
-
const kids = [];
|
|
70
|
-
for (const recipient of recipients) {
|
|
71
|
-
const kid = recipient?.header?.kid;
|
|
72
|
-
if (typeof kid === 'string') {
|
|
73
|
-
kids.push(kid);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return kids;
|
|
41
|
+
function envelopeResponse(envelope) {
|
|
42
|
+
return {
|
|
43
|
+
data: envelope,
|
|
44
|
+
json: async () => envelope,
|
|
45
|
+
headers: { get: () => null }
|
|
46
|
+
};
|
|
77
47
|
}
|
|
78
48
|
/**
|
|
79
49
|
* Builds a {@link DocCipher} for one encrypted collection from a reader's key
|
|
@@ -87,15 +57,16 @@ function envelopeRecipientKids(envelope) {
|
|
|
87
57
|
* `encryptUpdate`).
|
|
88
58
|
*
|
|
89
59
|
* With no `encryption` descriptor (or a descriptor with no epochs) the cipher
|
|
90
|
-
* is single-
|
|
91
|
-
* With epochs on the descriptor the cipher
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
60
|
+
* is single-recipient: the key-agreement key encrypts and decrypts directly.
|
|
61
|
+
* With epochs on the descriptor the cipher is multi-recipient: it encrypts
|
|
62
|
+
* every write under the descriptor's `currentEpoch` and decrypts any epoch
|
|
63
|
+
* this reader still holds a key for. Either way one codec owns both axes --
|
|
64
|
+
* decrypt routing (matching an envelope's JWE recipient `kid`s against the
|
|
65
|
+
* reader's candidate keys, raising `UnknownEpochError` for an envelope no
|
|
66
|
+
* candidate can route) lives in the codec, not here.
|
|
96
67
|
*
|
|
97
68
|
* The reader must be a recipient of every epoch on the descriptor (the owner is
|
|
98
|
-
* "recipient zero"). If it is a recipient of none, building the
|
|
69
|
+
* "recipient zero"). If it is a recipient of none, building the cipher
|
|
99
70
|
* throws {@link KeyUnwrapError}; this surfaces it with a clearer error rather
|
|
100
71
|
* than silently writing envelopes other recipients cannot read.
|
|
101
72
|
*
|
|
@@ -114,50 +85,35 @@ export async function createEdvDocCipher({ keyAgreementKey, keyResolver, collect
|
|
|
114
85
|
resolveKeys: async () => null,
|
|
115
86
|
idDerivation
|
|
116
87
|
});
|
|
117
|
-
//
|
|
118
|
-
//
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
88
|
+
// One codec owns both axes. With epochs on the descriptor, `codecFor`
|
|
89
|
+
// resolves this reader's per-epoch keys: writes go under the descriptor's
|
|
90
|
+
// `currentEpoch`, and reads pick the epoch key matching the envelope's
|
|
91
|
+
// recipient kid. Without epochs it is the single-recipient cipher keyed
|
|
92
|
+
// straight to the key-agreement key.
|
|
93
|
+
let resolved;
|
|
94
|
+
try {
|
|
95
|
+
resolved = await provider.codecFor({
|
|
96
|
+
spaceId: 'local',
|
|
97
|
+
collectionId,
|
|
98
|
+
scheme: 'edv',
|
|
99
|
+
encryption,
|
|
100
|
+
keys: { keyAgreementKey, keyResolver }
|
|
101
|
+
});
|
|
127
102
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
try {
|
|
136
|
-
epochCodec = await provider.codecFor({
|
|
137
|
-
spaceId: 'local',
|
|
138
|
-
collectionId,
|
|
139
|
-
scheme: 'edv',
|
|
140
|
-
encryption,
|
|
141
|
-
keys: { keyAgreementKey, keyResolver }
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
catch (err) {
|
|
145
|
-
if (err instanceof KeyUnwrapError) {
|
|
146
|
-
throw new Error(`Cannot build the multi-recipient EDV cipher for collection ` +
|
|
147
|
-
`"${collectionId}": the key-agreement key is not a recipient of any ` +
|
|
148
|
-
'key epoch on this collection. The owner must be a recipient of ' +
|
|
149
|
-
'every epoch (recipient zero) before writing, or it would encrypt ' +
|
|
150
|
-
'envelopes it cannot itself read.', { cause: err });
|
|
151
|
-
}
|
|
152
|
-
throw err;
|
|
153
|
-
}
|
|
154
|
-
if (!epochCodec) {
|
|
155
|
-
throw new Error(`Could not build the multi-recipient EDV cipher for collection ` +
|
|
156
|
-
`"${collectionId}".`);
|
|
103
|
+
catch (err) {
|
|
104
|
+
if (err instanceof KeyUnwrapError) {
|
|
105
|
+
throw new Error(`Cannot build the multi-recipient EDV cipher for collection ` +
|
|
106
|
+
`"${collectionId}": the key-agreement key is not a recipient of any ` +
|
|
107
|
+
'key epoch on this collection. The owner must be a recipient of ' +
|
|
108
|
+
'every epoch (recipient zero) before writing, or it would encrypt ' +
|
|
109
|
+
'envelopes it cannot itself read.', { cause: err });
|
|
157
110
|
}
|
|
111
|
+
throw err;
|
|
112
|
+
}
|
|
113
|
+
if (!resolved) {
|
|
114
|
+
throw new Error(`Could not build the EDV cipher for collection "${collectionId}".`);
|
|
158
115
|
}
|
|
159
|
-
const
|
|
160
|
-
const knownEpochKids = new Set((encryption?.epochs ?? []).map(epoch => epochKeyIdFor(epoch.id)));
|
|
116
|
+
const codec = resolved;
|
|
161
117
|
// Parses the codec's `EncodedWrite` (id + envelope body bytes) to the stored
|
|
162
118
|
// `{ id, envelope, epoch? }` shape. Shared by the create and update paths.
|
|
163
119
|
const readEncoded = (encoded) => {
|
|
@@ -165,7 +121,11 @@ export async function createEdvDocCipher({ keyAgreementKey, keyResolver, collect
|
|
|
165
121
|
!(encoded.body instanceof Uint8Array)) {
|
|
166
122
|
throw new Error(`EDV encrypt for collection "${collectionId}" returned no id/envelope body.`);
|
|
167
123
|
}
|
|
168
|
-
|
|
124
|
+
// Prefer the object form the codec already holds; parse the wire bytes only
|
|
125
|
+
// when a codec does not surface it.
|
|
126
|
+
const envelope = encoded.envelope !== undefined
|
|
127
|
+
? encoded.envelope
|
|
128
|
+
: JSON.parse(new TextDecoder().decode(encoded.body));
|
|
169
129
|
return {
|
|
170
130
|
id: encoded.id,
|
|
171
131
|
envelope,
|
|
@@ -176,9 +136,7 @@ export async function createEdvDocCipher({ keyAgreementKey, keyResolver, collect
|
|
|
176
136
|
async encrypt({ data }) {
|
|
177
137
|
// `encode` with no caller id is the add() path: encrypt, then either
|
|
178
138
|
// derive and stamp the content-hash id (`'content'`) or use the minted
|
|
179
|
-
// random id.
|
|
180
|
-
// cipher.
|
|
181
|
-
const codec = epochCodec ?? directCodec;
|
|
139
|
+
// random id.
|
|
182
140
|
const encoded = await codec.encode({
|
|
183
141
|
data: data
|
|
184
142
|
});
|
|
@@ -188,49 +146,18 @@ export async function createEdvDocCipher({ keyAgreementKey, keyResolver, collect
|
|
|
188
146
|
// The update path (mutable random-id head document): hand the codec the
|
|
189
147
|
// prior stored envelope so it advances `sequence` from it and re-encrypts
|
|
190
148
|
// under the same id.
|
|
191
|
-
const codec = epochCodec ?? directCodec;
|
|
192
|
-
const priorResponse = {
|
|
193
|
-
data: current,
|
|
194
|
-
json: async () => current,
|
|
195
|
-
headers: { get: () => null }
|
|
196
|
-
};
|
|
197
149
|
const encoded = await codec.encode({
|
|
198
150
|
id,
|
|
199
151
|
data: data,
|
|
200
|
-
current:
|
|
152
|
+
current: envelopeResponse(current)
|
|
201
153
|
});
|
|
202
154
|
return readEncoded(encoded);
|
|
203
155
|
},
|
|
204
156
|
async decrypt({ envelope }) {
|
|
205
|
-
//
|
|
206
|
-
//
|
|
207
|
-
//
|
|
208
|
-
|
|
209
|
-
// codec;
|
|
210
|
-
// 3. else UnknownEpochError: the descriptor is likely stale, or a single-key
|
|
211
|
-
// cipher met an envelope encrypted to a different key entirely.
|
|
212
|
-
const kids = envelopeRecipientKids(envelope);
|
|
213
|
-
const codec = selectCodec();
|
|
214
|
-
const response = {
|
|
215
|
-
data: envelope,
|
|
216
|
-
json: async () => envelope
|
|
217
|
-
};
|
|
218
|
-
return (await codec.decode(response));
|
|
219
|
-
function selectCodec() {
|
|
220
|
-
if (kids.some(kid => kid === vaultKid)) {
|
|
221
|
-
return directCodec;
|
|
222
|
-
}
|
|
223
|
-
if (epochCodec && kids.some(kid => knownEpochKids.has(kid))) {
|
|
224
|
-
return epochCodec;
|
|
225
|
-
}
|
|
226
|
-
// A malformed/empty-kid envelope falls through to the direct codec so it
|
|
227
|
-
// can surface its own decrypt error; a non-empty set of unroutable kids
|
|
228
|
-
// is the stale-descriptor signal.
|
|
229
|
-
if (kids.length === 0) {
|
|
230
|
-
return directCodec;
|
|
231
|
-
}
|
|
232
|
-
throw new UnknownEpochError({ collectionId, kids });
|
|
233
|
-
}
|
|
157
|
+
// Routing by the envelope's JWE recipient kids -- including the
|
|
158
|
+
// stale-descriptor `UnknownEpochError` for an envelope no candidate key
|
|
159
|
+
// routes -- is owned by the codec's decrypt.
|
|
160
|
+
return (await codec.decode(envelopeResponse(envelope)));
|
|
234
161
|
}
|
|
235
162
|
};
|
|
236
163
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docCipher.js","sourceRoot":"","sources":["../../src/edv/docCipher.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"docCipher.js","sourceRoot":"","sources":["../../src/edv/docCipher.ts"],"names":[],"mappings":"AAoCA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAG7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAGnD,8EAA8E;AAC9E,2EAA2E;AAC3E,6EAA6E;AAC7E,6EAA6E;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAEzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAEhD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,cAAc,CAAC,EAC7B,eAAe,EAGhB;IACC,MAAM,EAAE,EAAE,EAAE,GAAG,eAAe,CAAA;IAC9B,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAGpC,CAAA;IACD,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,OAAO,kBAAkB,KAAK,QAAQ,EAAE,CAAC;QACrE,MAAM,IAAI,KAAK,CACb,wEAAwE;YACtE,uEAAuE;YACvE,aAAa,CAChB,CAAA;IACH,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAA;AACzC,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,gBAAgB,CAAC,QAAc;IACtC,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,QAAQ;QAC1B,OAAO,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE;KAC7B,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,EACvC,eAAe,EACf,WAAW,EACX,YAAY,EACZ,YAAY,GAAG,SAAS,EACxB,UAAU,EAOX;IACC,MAAM,QAAQ,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C5B,CAAC,CAAE,IAAI,CAAC,KAAK,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAU,CAAA;QAClE,OAAO;YACL,EAAE,EAAE,OAAO,CAAC,EAAE;YACd,QAAQ;YACR,GAAG,CAAC,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;SACnE,CAAA;IACH,CAAC,CAAA;IAED,OAAO;QACL,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EAAkB;YACpC,qEAAqE;YACrE,uEAAuE;YACvE,aAAa;YACb,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC;gBACjC,IAAI,EAAE,IAA6B;aACpC,CAAC,CAAA;YACF,OAAO,WAAW,CAAC,OAAO,CAAC,CAAA;QAC7B,CAAC;QAED,KAAK,CAAC,aAAa,CAAC,EAClB,EAAE,EACF,IAAI,EACJ,OAAO,EAKR;YACC,wEAAwE;YACxE,0EAA0E;YAC1E,qBAAqB;YACrB,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC;gBACjC,EAAE;gBACF,IAAI,EAAE,IAA6B;gBACnC,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC;aACnC,CAAC,CAAA;YACF,OAAO,WAAW,CAAC,OAAO,CAAC,CAAA;QAC7B,CAAC;QAED,KAAK,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAsB;YAC5C,gEAAgE;YAChE,wEAAwE;YACxE,6CAA6C;YAC7C,OAAO,CAAC,MAAM,KAAK,CAAC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAS,CAAA;QACjE,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import type { IKeyAgreementKey } from '@interop/data-integrity-core';
|
|
2
2
|
import type { CollectionEncryptionRecipient } from '../types.js';
|
|
3
|
-
/**
|
|
4
|
-
* The JOSE key-management algorithm for every epoch/recipient wrap.
|
|
5
|
-
*/
|
|
6
|
-
export declare const KEY_WRAP_ALG = "ECDH-ES+A256KW";
|
|
7
3
|
/**
|
|
8
4
|
* A reader's public key-agreement key, as needed to wrap an epoch key to it:
|
|
9
5
|
* the recipient `id` (`kid`, which the reader's own key-agreement key must also
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"epochCrypto.d.ts","sourceRoot":"","sources":["../../src/edv/epochCrypto.ts"],"names":[],"mappings":"AAwCA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;
|
|
1
|
+
{"version":3,"file":"epochCrypto.d.ts","sourceRoot":"","sources":["../../src/edv/epochCrypto.ts"],"names":[],"mappings":"AAwCA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAEpE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAYhE;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,kBAAkB,EAAE,MAAM,CAAA;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CAAC,EACpC,WAAW,EACX,SAAS,EACV,EAAE;IACD,WAAW,EAAE,UAAU,CAAA;IACvB,SAAS,EAAE,kBAAkB,CAAA;CAC9B,GAAG,OAAO,CAAC,6BAA6B,CAAC,CA4BzC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,KAAK,EACL,eAAe,EAChB,EAAE;IACD,KAAK,EAAE,6BAA6B,CAAA;IACpC,eAAe,EAAE,gBAAgB,CAAA;CAClC,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAuC7B;AAED;;;;;;;GAOG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC;IACzC,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,UAAU,CAAA;CACnB,CAAC,CAQD;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,OAAO,EACP,MAAM,EACP,EAAE;IACD,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,UAAU,CAAA;CACnB,GAAG,gBAAgB,CASnB;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAErD;AA8BD;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAAC,EACnC,EAAE,EACH,EAAE;IACD,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ,GAAG,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,kBAAkB,EAAE,MAAM,CAAA;CAAE,CAAC,CA0BpE"}
|
package/dist/edv/epochCrypto.js
CHANGED
|
@@ -33,15 +33,15 @@
|
|
|
33
33
|
import { base64urlnopad } from '@scure/base';
|
|
34
34
|
import { createKek, deriveKey } from '@interop/minimal-cipher/algorithms';
|
|
35
35
|
import { X25519KeyAgreementKey2020, multibaseDecode, multibaseEncode, MULTICODEC_X25519_PUB_HEADER } from '@interop/x25519-key-agreement-key';
|
|
36
|
+
import { ENCODER } from '../internal/content.js';
|
|
36
37
|
/**
|
|
37
38
|
* The JOSE key-management algorithm for every epoch/recipient wrap.
|
|
38
39
|
*/
|
|
39
|
-
|
|
40
|
+
const KEY_WRAP_ALG = 'ECDH-ES+A256KW';
|
|
40
41
|
/**
|
|
41
42
|
* The X25519 suite tag used for the ephemeral and reconstructed key pairs.
|
|
42
43
|
*/
|
|
43
44
|
const X25519_TYPE = 'X25519KeyAgreementKey2020';
|
|
44
|
-
const TEXT_ENCODER = new TextEncoder();
|
|
45
45
|
/**
|
|
46
46
|
* Wraps a 32-byte epoch secret to one recipient's X25519 key-agreement key,
|
|
47
47
|
* producing the JWE `recipients` entry stored on the descriptor. Generates a
|
|
@@ -59,7 +59,7 @@ export async function wrapEpochSecret({ epochSecret, recipient }) {
|
|
|
59
59
|
publicKey: { publicKeyMultibase: recipient.publicKeyMultibase }
|
|
60
60
|
});
|
|
61
61
|
const producerInfo = ephemeralPublicKey;
|
|
62
|
-
const consumerInfo =
|
|
62
|
+
const consumerInfo = ENCODER.encode(recipient.id);
|
|
63
63
|
const keyData = await deriveKey({ secret, producerInfo, consumerInfo });
|
|
64
64
|
const kek = await createKek({ keyData });
|
|
65
65
|
const encryptedKey = await kek.wrapKey({ unwrappedKey: epochSecret });
|
|
@@ -118,7 +118,7 @@ export async function unwrapEpochSecret({ entry, keyAgreementKey }) {
|
|
|
118
118
|
return null;
|
|
119
119
|
}
|
|
120
120
|
const producerInfo = ephemeralPublicKey;
|
|
121
|
-
const consumerInfo =
|
|
121
|
+
const consumerInfo = ENCODER.encode(keyAgreementKey.id);
|
|
122
122
|
const keyData = await deriveKey({ secret, producerInfo, consumerInfo });
|
|
123
123
|
const kek = await createKek({ keyData });
|
|
124
124
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"epochCrypto.js","sourceRoot":"","sources":["../../src/edv/epochCrypto.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAA;AACzE,OAAO,EACL,yBAAyB,EACzB,eAAe,EACf,eAAe,EACf,4BAA4B,EAC7B,MAAM,mCAAmC,CAAA;
|
|
1
|
+
{"version":3,"file":"epochCrypto.js","sourceRoot":"","sources":["../../src/edv/epochCrypto.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,SAAS,E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QAAQ,CAAA;AACjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"epochKeys.d.ts","sourceRoot":"","sources":["../../src/edv/epochKeys.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAEpE,OAAO,KAAK,EACV,oBAAoB,EAErB,MAAM,aAAa,CAAA;AAQpB;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,QAAQ,EAAE,gBAAgB,CAAA;IAC1B;;;;OAIG;IACH,QAAQ,EAAE,gBAAgB,EAAE,CAAA;CAC7B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,UAAU,EACV,eAAe,EAChB,EAAE;IACD,UAAU,EAAE,oBAAoB,CAAA;IAChC,eAAe,EAAE,gBAAgB,CAAA;CAClC,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"epochKeys.d.ts","sourceRoot":"","sources":["../../src/edv/epochKeys.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAEpE,OAAO,KAAK,EACV,oBAAoB,EAErB,MAAM,aAAa,CAAA;AAQpB;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,QAAQ,EAAE,gBAAgB,CAAA;IAC1B;;;;OAIG;IACH,QAAQ,EAAE,gBAAgB,EAAE,CAAA;CAC7B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,UAAU,EACV,eAAe,EAChB,EAAE;IACD,UAAU,EAAE,oBAAoB,CAAA;IAChC,eAAe,EAAE,gBAAgB,CAAA;CAClC,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CA6FpC"}
|