@interop/was-client 0.99.0 → 0.100.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 +94 -71
- package/dist/Collection.d.ts +20 -8
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +89 -69
- package/dist/Collection.js.map +1 -1
- package/dist/Resource.d.ts +14 -3
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +38 -27
- package/dist/Resource.js.map +1 -1
- package/dist/Space.d.ts +18 -4
- package/dist/Space.d.ts.map +1 -1
- package/dist/Space.js +64 -61
- package/dist/Space.js.map +1 -1
- package/dist/WasClient.d.ts +105 -58
- package/dist/WasClient.d.ts.map +1 -1
- package/dist/WasClient.js +216 -142
- package/dist/WasClient.js.map +1 -1
- package/dist/codec.d.ts +3 -2
- package/dist/codec.d.ts.map +1 -1
- package/dist/edv/EdvCodec.d.ts.map +1 -1
- package/dist/edv/EdvCodec.js +37 -26
- package/dist/edv/EdvCodec.js.map +1 -1
- package/dist/edv/WasTransport.d.ts +7 -4
- package/dist/edv/WasTransport.d.ts.map +1 -1
- package/dist/edv/WasTransport.js +39 -20
- package/dist/edv/WasTransport.js.map +1 -1
- package/dist/edv/acquire.d.ts +3 -3
- package/dist/edv/acquire.d.ts.map +1 -1
- package/dist/edv/acquire.js +3 -3
- package/dist/edv/acquire.js.map +1 -1
- package/dist/edv/cipher.d.ts +7 -4
- package/dist/edv/cipher.d.ts.map +1 -1
- package/dist/edv/cipher.js +7 -4
- package/dist/edv/cipher.js.map +1 -1
- package/dist/edv/core.d.ts +1 -1
- package/dist/edv/core.d.ts.map +1 -1
- package/dist/edv/core.js +1 -1
- package/dist/edv/core.js.map +1 -1
- package/dist/edv/docCipher.d.ts +10 -7
- package/dist/edv/docCipher.d.ts.map +1 -1
- package/dist/edv/docCipher.js +12 -8
- package/dist/edv/docCipher.js.map +1 -1
- package/dist/edv/encryption.d.ts +2 -2
- package/dist/edv/encryption.d.ts.map +1 -1
- package/dist/edv/encryption.js +8 -6
- package/dist/edv/encryption.js.map +1 -1
- package/dist/edv/epochCrypto.d.ts +12 -4
- package/dist/edv/epochCrypto.d.ts.map +1 -1
- package/dist/edv/epochCrypto.js +37 -10
- package/dist/edv/epochCrypto.js.map +1 -1
- package/dist/edv/epochKeys.d.ts +6 -2
- package/dist/edv/epochKeys.d.ts.map +1 -1
- package/dist/edv/epochKeys.js +25 -14
- package/dist/edv/epochKeys.js.map +1 -1
- package/dist/edv/hmacKey.d.ts +7 -1
- package/dist/edv/hmacKey.d.ts.map +1 -1
- package/dist/edv/hmacKey.js +9 -3
- package/dist/edv/hmacKey.js.map +1 -1
- package/dist/edv/index.d.ts +1 -1
- package/dist/edv/index.d.ts.map +1 -1
- package/dist/edv/index.js +1 -1
- package/dist/edv/index.js.map +1 -1
- package/dist/edv/recipients.d.ts.map +1 -1
- package/dist/edv/recipients.js +2 -0
- package/dist/edv/recipients.js.map +1 -1
- package/dist/edv/refreshingDocCipher.d.ts +3 -3
- package/dist/edv/refreshingDocCipher.d.ts.map +1 -1
- package/dist/edv/refreshingDocCipher.js +3 -3
- package/dist/edv/refreshingDocCipher.js.map +1 -1
- package/dist/edv/transportFactory.d.ts +3 -3
- package/dist/edv/transportFactory.d.ts.map +1 -1
- package/dist/edv/transportFactory.js +3 -3
- package/dist/edv/transportFactory.js.map +1 -1
- package/dist/errors.d.ts +6 -4
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +6 -4
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/codec.d.ts +7 -7
- package/dist/internal/codec.d.ts.map +1 -1
- package/dist/internal/codec.js +19 -18
- package/dist/internal/codec.js.map +1 -1
- package/dist/internal/conditional.d.ts +3 -3
- package/dist/internal/conditional.d.ts.map +1 -1
- package/dist/internal/conditional.js +5 -5
- package/dist/internal/conditional.js.map +1 -1
- package/dist/internal/grant.d.ts +15 -26
- package/dist/internal/grant.d.ts.map +1 -1
- package/dist/internal/grant.js +95 -29
- package/dist/internal/grant.js.map +1 -1
- package/dist/internal/memo.d.ts +13 -4
- package/dist/internal/memo.d.ts.map +1 -1
- package/dist/internal/memo.js +18 -7
- package/dist/internal/memo.js.map +1 -1
- package/dist/internal/meta.d.ts +8 -8
- package/dist/internal/meta.d.ts.map +1 -1
- package/dist/internal/meta.js +13 -10
- package/dist/internal/meta.js.map +1 -1
- package/dist/internal/pagination.d.ts +30 -15
- package/dist/internal/pagination.d.ts.map +1 -1
- package/dist/internal/pagination.js +31 -17
- package/dist/internal/pagination.js.map +1 -1
- package/dist/internal/paths.d.ts +332 -195
- package/dist/internal/paths.d.ts.map +1 -1
- package/dist/internal/paths.js +400 -367
- package/dist/internal/paths.js.map +1 -1
- package/dist/internal/policy.d.ts +23 -23
- package/dist/internal/policy.d.ts.map +1 -1
- package/dist/internal/policy.js +20 -20
- package/dist/internal/policy.js.map +1 -1
- package/dist/internal/request.d.ts +17 -21
- package/dist/internal/request.d.ts.map +1 -1
- package/dist/internal/request.js +10 -21
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/revoke.d.ts +34 -13
- package/dist/internal/revoke.d.ts.map +1 -1
- package/dist/internal/revoke.js +97 -28
- package/dist/internal/revoke.js.map +1 -1
- package/dist/internal/service.d.ts +25 -7
- package/dist/internal/service.d.ts.map +1 -1
- package/dist/internal/service.js +49 -45
- package/dist/internal/service.js.map +1 -1
- package/dist/internal/write.d.ts +18 -18
- package/dist/internal/write.d.ts.map +1 -1
- package/dist/internal/write.js +27 -27
- package/dist/internal/write.js.map +1 -1
- package/dist/paths.d.ts +32 -25
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +32 -25
- package/dist/paths.js.map +1 -1
- package/dist/sync/index.d.ts +4 -2
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +4 -2
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/port.d.ts +3 -3
- package/dist/sync/port.d.ts.map +1 -1
- package/dist/sync/port.js +12 -12
- package/dist/sync/port.js.map +1 -1
- package/dist/sync/provisioning.d.ts +10 -9
- package/dist/sync/provisioning.d.ts.map +1 -1
- package/dist/sync/provisioning.js +19 -18
- package/dist/sync/provisioning.js.map +1 -1
- package/dist/sync/types.d.ts +2 -2
- package/dist/types.d.ts +13 -5
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/edv/acquire.d.ts
CHANGED
|
@@ -42,12 +42,12 @@ export interface EncryptionDescriptorCache {
|
|
|
42
42
|
*
|
|
43
43
|
* @param options {object}
|
|
44
44
|
* @param options.was {WasClient} a client whose signer can read the Space
|
|
45
|
-
* @param options.
|
|
45
|
+
* @param options.spaceUrl {string}
|
|
46
46
|
* @returns {EncryptionDescriptorSource}
|
|
47
47
|
*/
|
|
48
|
-
export declare function wasDescriptorSource({ was,
|
|
48
|
+
export declare function wasDescriptorSource({ was, spaceUrl }: {
|
|
49
49
|
was: WasClient;
|
|
50
|
-
|
|
50
|
+
spaceUrl: string;
|
|
51
51
|
}): EncryptionDescriptorSource;
|
|
52
52
|
/**
|
|
53
53
|
* Acquires one collection's descriptor: fetches it from the source, caching a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acquire.d.ts","sourceRoot":"","sources":["../../src/edv/acquire.ts"],"names":[],"mappings":"AAuDA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEhD;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,eAAe,CAAC,EAAE,IAAI,CAAA;IAC/B,oBAAoB,CAAC,OAAO,EAAE;QAC5B,YAAY,EAAE,MAAM,CAAA;KACrB,GAAG,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAAA;CAC9C;AAED;;;;GAIG;AACH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A0B,CAU7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,MAAM,EACN,KAAK,EACL,YAAY,EACZ,eAAe,EACf,YAAY,EACb,EAAE;IACD,MAAM,CAAC,EAAE,0BAA0B,CAAA;IACnC,KAAK,EAAE,yBAAyB,CAAA;IAChC,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;CACtE,GAAG,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAwC5C;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,MAAM,EACN,KAAK,EACL,aAAa,EACb,eAAe,EACf,YAAY,EACb,EAAE;IACD,MAAM,CAAC,EAAE,0BAA0B,CAAA;IACnC,KAAK,EAAE,yBAAyB,CAAA;IAChC,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;CACtE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAuBhD"}
|
package/dist/edv/acquire.js
CHANGED
|
@@ -61,14 +61,14 @@ import { isGovernedDescriptor } from '../internal/describe.js';
|
|
|
61
61
|
*
|
|
62
62
|
* @param options {object}
|
|
63
63
|
* @param options.was {WasClient} a client whose signer can read the Space
|
|
64
|
-
* @param options.
|
|
64
|
+
* @param options.spaceUrl {string}
|
|
65
65
|
* @returns {EncryptionDescriptorSource}
|
|
66
66
|
*/
|
|
67
|
-
export function wasDescriptorSource({ was,
|
|
67
|
+
export function wasDescriptorSource({ was, spaceUrl }) {
|
|
68
68
|
return {
|
|
69
69
|
async collectionEncryption({ collectionId }) {
|
|
70
70
|
const description = await was
|
|
71
|
-
.
|
|
71
|
+
.spaceAt(spaceUrl)
|
|
72
72
|
.collection(collectionId)
|
|
73
73
|
.describe();
|
|
74
74
|
return description?.encryption ?? undefined;
|
package/dist/edv/acquire.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acquire.js","sourceRoot":"","sources":["../../src/edv/acquire.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAwC9D;;;;;;;;;;GAUG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAClC,GAAG,EACH,
|
|
1
|
+
{"version":3,"file":"acquire.js","sourceRoot":"","sources":["../../src/edv/acquire.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAwC9D;;;;;;;;;;GAUG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAClC,GAAG,EACH,QAAQ,EAIT;IACC,OAAO;QACL,KAAK,CAAC,oBAAoB,CAAC,EAAE,YAAY,EAAE;YACzC,MAAM,WAAW,GAAG,MAAM,GAAG;iBAC1B,OAAO,CAAC,QAAQ,CAAC;iBACjB,UAAU,CAAC,YAAY,CAAC;iBACxB,QA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AAI,yBAAyB,CACjC,eAAe,YAAY,kCAAkC;YAC3D,gEAAgE;YAChE,oEAAoE;YACpE,iCAAiC,CACpC,CAAA;IACH,CAAC;IACD,MAAM,KAAK,CAAC,eAAe,CAAC,EAAE,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAA;IAClE,OAAO,OAAO,CAAA;AAChB,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,EACvC,MAAM,EACN,KAAK,EACL,aAAa,EACb,eAAe,EACf,YAAY,EAOb;IACC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,CAChC,aAAa,CAAC,GAAG,CACf,KAAK,EAAC,YAAY,EAAC,EAAE,CACnB;QACE,YAAY;QACZ,MAAM,iBAAiB,CAAC;YACtB,MAAM;YACN,KAAK;YACL,YAAY;YACZ,eAAe;YACf,YAAY;SACb,CAAC;KACM,CACb,CACF,CAAA;IACD,MAAM,WAAW,GAAyC,EAAE,CAAA;IAC5D,KAAK,MAAM,CAAC,YAAY,EAAE,UAAU,CAAC,IAAI,QAAQ,EAAE,CAAC;QAClD,IAAI,UAAU,EAAE,CAAC;YACf,WAAW,CAAC,YAAY,CAAC,GAAG,UAAU,CAAA;QACxC,CAAC;IACH,CAAC;IACD,OAAO,WAAW,CAAA;AACpB,CAAC"}
|
package/dist/edv/cipher.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* consumer that opens archived bytes, derives keys, or decrypts rows it
|
|
11
11
|
* already has imports this entry and evaluates no transport module and no
|
|
12
12
|
* `@interop/vh-resource-log` / `@interop/did-method-webvh` module. The one
|
|
13
|
-
* gated exception is `createEdvDocCipher({
|
|
13
|
+
* gated exception is `createEdvDocCipher({ spaceUrl })`, which loads the
|
|
14
14
|
* transport factory through `import()` for the chunked paths. A call that
|
|
15
15
|
* names no Space loads nothing.
|
|
16
16
|
*
|
|
@@ -61,7 +61,10 @@
|
|
|
61
61
|
* not on the descriptor the reader holds (a re-read may fix it) and
|
|
62
62
|
* `KeyUnwrapError` when the epoch IS listed but this reader has no key for it
|
|
63
63
|
* (never a recipient, or removed and the epoch rotated since -- re-reading
|
|
64
|
-
* cannot help).
|
|
64
|
+
* cannot help). A third class is not a no-key signal at all: `IntegrityError`
|
|
65
|
+
* when the reader's own recipient entry, or an envelope a held key unwrapped,
|
|
66
|
+
* fails its integrity check (tampering, not membership). All ship from this
|
|
67
|
+
* entry beside the cipher that raises them,
|
|
65
68
|
* so a consumer classifying what a cipher threw need not reach for the package
|
|
66
69
|
* root. Both assign their `name` explicitly, and a consumer whose cipher
|
|
67
70
|
* arrives through an injected seam matches on that name rather than
|
|
@@ -83,9 +86,9 @@ export { resolveEpochKeys } from './epochKeys.js';
|
|
|
83
86
|
export type { ResolvedEpochKeys } from './epochKeys.js';
|
|
84
87
|
export { HMAC_KEY_TYPE, mintHmacKey, hmacKeyFromSecret, resolveHmacKey } from './hmacKey.js';
|
|
85
88
|
export type { BlindingKey } from './hmacKey.js';
|
|
86
|
-
export { createEdvDocCipher, createEdvEncryptOnlyDocCipher, ownerRecipient, EncryptOnlyCipherError, KeyUnwrapError, UnknownEpochError, isEncryptedEnvelope } from './docCipher.js';
|
|
89
|
+
export { createEdvDocCipher, createEdvEncryptOnlyDocCipher, ownerRecipient, EncryptOnlyCipherError, IntegrityError, KeyUnwrapError, UnknownEpochError, isEncryptedEnvelope } from './docCipher.js';
|
|
87
90
|
export type { DocCipher, EdvDocCipher } from './docCipher.js';
|
|
88
|
-
export { isKeyUnwrapError } from '../sync/predicates.js';
|
|
91
|
+
export { isIntegrityError, isKeyUnwrapError } from '../sync/predicates.js';
|
|
89
92
|
export { edvIdFromBytes } from './edvId.js';
|
|
90
93
|
export { blobBytes } from '../internal/blob.js';
|
|
91
94
|
//# sourceMappingURL=cipher.d.ts.map
|
package/dist/edv/cipher.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cipher.d.ts","sourceRoot":"","sources":["../../src/edv/cipher.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"cipher.d.ts","sourceRoot":"","sources":["../../src/edv/cipher.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,YAAY,EAAE,WAAW,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAChF,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACtE,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,iBAAiB,CAAA;AACxB,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EACL,eAAe,EACf,yBAAyB,EAC1B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAC9D,YAAY,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AACrE,OAAO,EACL,cAAc,EACd,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,eAAe,EAChB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACf,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACjD,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,EACL,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,cAAc,EACf,MAAM,cAAc,CAAA;AACrB,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EACL,kBAAkB,EAClB,6BAA6B,EAC7B,cAAc,EACd,sBAAsB,EACtB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,gBAAgB,CAAA;AACvB,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7D,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA"}
|
package/dist/edv/cipher.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* consumer that opens archived bytes, derives keys, or decrypts rows it
|
|
11
11
|
* already has imports this entry and evaluates no transport module and no
|
|
12
12
|
* `@interop/vh-resource-log` / `@interop/did-method-webvh` module. The one
|
|
13
|
-
* gated exception is `createEdvDocCipher({
|
|
13
|
+
* gated exception is `createEdvDocCipher({ spaceUrl })`, which loads the
|
|
14
14
|
* transport factory through `import()` for the chunked paths. A call that
|
|
15
15
|
* names no Space loads nothing.
|
|
16
16
|
*
|
|
@@ -61,7 +61,10 @@
|
|
|
61
61
|
* not on the descriptor the reader holds (a re-read may fix it) and
|
|
62
62
|
* `KeyUnwrapError` when the epoch IS listed but this reader has no key for it
|
|
63
63
|
* (never a recipient, or removed and the epoch rotated since -- re-reading
|
|
64
|
-
* cannot help).
|
|
64
|
+
* cannot help). A third class is not a no-key signal at all: `IntegrityError`
|
|
65
|
+
* when the reader's own recipient entry, or an envelope a held key unwrapped,
|
|
66
|
+
* fails its integrity check (tampering, not membership). All ship from this
|
|
67
|
+
* entry beside the cipher that raises them,
|
|
65
68
|
* so a consumer classifying what a cipher threw need not reach for the package
|
|
66
69
|
* root. Both assign their `name` explicitly, and a consumer whose cipher
|
|
67
70
|
* arrives through an injected seam matches on that name rather than
|
|
@@ -78,8 +81,8 @@ export { didKeyResolver, mintEpoch, epochKeyIdFor, unwrapEpochSecret, wrapEpochS
|
|
|
78
81
|
export { hasKeyEpochs, epochRostersEqual, currentEpochOf } from './epochRoster.js';
|
|
79
82
|
export { resolveEpochKeys } from './epochKeys.js';
|
|
80
83
|
export { HMAC_KEY_TYPE, mintHmacKey, hmacKeyFromSecret, resolveHmacKey } from './hmacKey.js';
|
|
81
|
-
export { createEdvDocCipher, createEdvEncryptOnlyDocCipher, ownerRecipient, EncryptOnlyCipherError, KeyUnwrapError, UnknownEpochError, isEncryptedEnvelope } from './docCipher.js';
|
|
82
|
-
export { isKeyUnwrapError } from '../sync/predicates.js';
|
|
84
|
+
export { createEdvDocCipher, createEdvEncryptOnlyDocCipher, ownerRecipient, EncryptOnlyCipherError, IntegrityError, KeyUnwrapError, UnknownEpochError, isEncryptedEnvelope } from './docCipher.js';
|
|
85
|
+
export { isIntegrityError, isKeyUnwrapError } from '../sync/predicates.js';
|
|
83
86
|
export { edvIdFromBytes } from './edvId.js';
|
|
84
87
|
export { blobBytes } from '../internal/blob.js';
|
|
85
88
|
//# sourceMappingURL=cipher.js.map
|
package/dist/edv/cipher.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cipher.js","sourceRoot":"","sources":["../../src/edv/cipher.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"cipher.js","sourceRoot":"","sources":["../../src/edv/cipher.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACtE,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,iBAAiB,CAAA;AAExB,OAAO,EACL,eAAe,EACf,yBAAyB,EAC1B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAE9D,OAAO,EACL,cAAc,EACd,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,eAAe,EAChB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACf,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEjD,OAAO,EACL,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,cAAc,EACf,MAAM,cAAc,CAAA;AAErB,OAAO,EACL,kBAAkB,EAClB,6BAA6B,EAC7B,cAAc,EACd,sBAAsB,EACtB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA"}
|
package/dist/edv/core.d.ts
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* `collectionDescriptorStore`, descriptor acquisition and the refresh policy),
|
|
19
19
|
* so an online consumer keeps importing that one entry and nothing moves.
|
|
20
20
|
*/
|
|
21
|
-
export { EdvCodec, EDV_SCHEME_VERSION, JOSE_CONTENT_TYPE, ensureFirstEpoch, initRecipients, addRecipient, removeRecipient, replaceRecipient, trustRosterDidKeys, isEd25519DidKey, x25519RecipientFromDidKey, resourceDescriptorStore, didKeyResolver, mintEpoch, epochKeyIdFor, unwrapEpochSecret, wrapEpochSecret, hasKeyEpochs, epochRostersEqual, currentEpochOf, resolveEpochKeys, HMAC_KEY_TYPE, mintHmacKey, hmacKeyFromSecret, resolveHmacKey, createEdvDocCipher, createEdvEncryptOnlyDocCipher, ownerRecipient, EncryptOnlyCipherError, KeyUnwrapError, UnknownEpochError, isEncryptedEnvelope, isKeyUnwrapError, edvIdFromBytes, blobBytes } from './cipher.js';
|
|
21
|
+
export { EdvCodec, EDV_SCHEME_VERSION, JOSE_CONTENT_TYPE, ensureFirstEpoch, initRecipients, addRecipient, removeRecipient, replaceRecipient, trustRosterDidKeys, isEd25519DidKey, x25519RecipientFromDidKey, resourceDescriptorStore, didKeyResolver, mintEpoch, epochKeyIdFor, unwrapEpochSecret, wrapEpochSecret, hasKeyEpochs, epochRostersEqual, currentEpochOf, resolveEpochKeys, HMAC_KEY_TYPE, mintHmacKey, hmacKeyFromSecret, resolveHmacKey, createEdvDocCipher, createEdvEncryptOnlyDocCipher, ownerRecipient, EncryptOnlyCipherError, IntegrityError, KeyUnwrapError, UnknownEpochError, isEncryptedEnvelope, isIntegrityError, isKeyUnwrapError, edvIdFromBytes, blobBytes } from './cipher.js';
|
|
22
22
|
export type { ChunkSource, CodecTransportFactory, EdvKeys, RecipientPublicKey, EncryptionDescriptorStore, ResolvedEpochKeys, BlindingKey, DocCipher, EdvDocCipher } from './cipher.js';
|
|
23
23
|
export { EPOCH_CONFIGURATION_STATE_TYPE, logGovernedCollectionDescriptorStore, logGovernedDescriptorStore, readGovernedEpochConfiguration, toEpochConfigurationState } from './logGovernedDescriptorStore.js';
|
|
24
24
|
export type { LogGovernedDescriptorStore } from './logGovernedDescriptorStore.js';
|
package/dist/edv/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/edv/core.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EACL,QAAQ,EACR,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,yBAAyB,EACzB,uBAAuB,EACvB,cAAc,EACd,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,6BAA6B,EAC7B,cAAc,EACd,sBAAsB,EACtB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,SAAS,EACV,MAAM,aAAa,CAAA;AACpB,YAAY,EACV,WAAW,EACX,qBAAqB,EACrB,OAAO,EACP,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,SAAS,EACT,YAAY,EACb,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,8BAA8B,EAC9B,oCAAoC,EACpC,0BAA0B,EAC1B,8BAA8B,EAC9B,yBAAyB,EAC1B,MAAM,iCAAiC,CAAA;AACxC,YAAY,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAA"}
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/edv/core.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EACL,QAAQ,EACR,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,yBAAyB,EACzB,uBAAuB,EACvB,cAAc,EACd,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,6BAA6B,EAC7B,cAAc,EACd,sBAAsB,EACtB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,SAAS,EACV,MAAM,aAAa,CAAA;AACpB,YAAY,EACV,WAAW,EACX,qBAAqB,EACrB,OAAO,EACP,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EACX,SAAS,EACT,YAAY,EACb,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,8BAA8B,EAC9B,oCAAoC,EACpC,0BAA0B,EAC1B,8BAA8B,EAC9B,yBAAyB,EAC1B,MAAM,iCAAiC,CAAA;AACxC,YAAY,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAA"}
|
package/dist/edv/core.js
CHANGED
|
@@ -18,6 +18,6 @@
|
|
|
18
18
|
* `collectionDescriptorStore`, descriptor acquisition and the refresh policy),
|
|
19
19
|
* so an online consumer keeps importing that one entry and nothing moves.
|
|
20
20
|
*/
|
|
21
|
-
export { EdvCodec, EDV_SCHEME_VERSION, JOSE_CONTENT_TYPE, ensureFirstEpoch, initRecipients, addRecipient, removeRecipient, replaceRecipient, trustRosterDidKeys, isEd25519DidKey, x25519RecipientFromDidKey, resourceDescriptorStore, didKeyResolver, mintEpoch, epochKeyIdFor, unwrapEpochSecret, wrapEpochSecret, hasKeyEpochs, epochRostersEqual, currentEpochOf, resolveEpochKeys, HMAC_KEY_TYPE, mintHmacKey, hmacKeyFromSecret, resolveHmacKey, createEdvDocCipher, createEdvEncryptOnlyDocCipher, ownerRecipient, EncryptOnlyCipherError, KeyUnwrapError, UnknownEpochError, isEncryptedEnvelope, isKeyUnwrapError, edvIdFromBytes, blobBytes } from './cipher.js';
|
|
21
|
+
export { EdvCodec, EDV_SCHEME_VERSION, JOSE_CONTENT_TYPE, ensureFirstEpoch, initRecipients, addRecipient, removeRecipient, replaceRecipient, trustRosterDidKeys, isEd25519DidKey, x25519RecipientFromDidKey, resourceDescriptorStore, didKeyResolver, mintEpoch, epochKeyIdFor, unwrapEpochSecret, wrapEpochSecret, hasKeyEpochs, epochRostersEqual, currentEpochOf, resolveEpochKeys, HMAC_KEY_TYPE, mintHmacKey, hmacKeyFromSecret, resolveHmacKey, createEdvDocCipher, createEdvEncryptOnlyDocCipher, ownerRecipient, EncryptOnlyCipherError, IntegrityError, KeyUnwrapError, UnknownEpochError, isEncryptedEnvelope, isIntegrityError, isKeyUnwrapError, edvIdFromBytes, blobBytes } from './cipher.js';
|
|
22
22
|
export { EPOCH_CONFIGURATION_STATE_TYPE, logGovernedCollectionDescriptorStore, logGovernedDescriptorStore, readGovernedEpochConfiguration, toEpochConfigurationState } from './logGovernedDescriptorStore.js';
|
|
23
23
|
//# sourceMappingURL=core.js.map
|
package/dist/edv/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/edv/core.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EACL,QAAQ,EACR,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,yBAAyB,EACzB,uBAAuB,EACvB,cAAc,EACd,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,6BAA6B,EAC7B,cAAc,EACd,sBAAsB,EACtB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,SAAS,EACV,MAAM,aAAa,CAAA;AAYpB,OAAO,EACL,8BAA8B,EAC9B,oCAAoC,EACpC,0BAA0B,EAC1B,8BAA8B,EAC9B,yBAAyB,EAC1B,MAAM,iCAAiC,CAAA"}
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/edv/core.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EACL,QAAQ,EACR,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,yBAAyB,EACzB,uBAAuB,EACvB,cAAc,EACd,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,6BAA6B,EAC7B,cAAc,EACd,sBAAsB,EACtB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,SAAS,EACV,MAAM,aAAa,CAAA;AAYpB,OAAO,EACL,8BAA8B,EAC9B,oCAAoC,EACpC,0BAA0B,EAC1B,8BAA8B,EAC9B,yBAAyB,EAC1B,MAAM,iCAAiC,CAAA"}
|
package/dist/edv/docCipher.d.ts
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
* stay stable across a rotation.
|
|
34
34
|
*
|
|
35
35
|
* The cipher also reads a chunked envelope, in one of two ways. Given the
|
|
36
|
-
* Space the collection lives in (`
|
|
36
|
+
* Space the collection lives in (`spaceUrl`), `decrypt` fetches its chunk
|
|
37
37
|
* resources through the request context the caller passes
|
|
38
38
|
* (`collection.codecContext()`). Given a `chunkSource` instead, `decrypt`
|
|
39
39
|
* reads the chunks from bytes the caller already holds, such as an archive's
|
|
@@ -58,7 +58,7 @@ import type { ChunkSource } from './EdvCodec.js';
|
|
|
58
58
|
import type { RecipientPublicKey } from './recipients.js';
|
|
59
59
|
export { isEncryptedEnvelope } from '../sync/envelope.js';
|
|
60
60
|
export type { DocCipher } from '../sync/types.js';
|
|
61
|
-
export { EncryptOnlyCipherError, KeyUnwrapError, UnknownEpochError } from '../errors.js';
|
|
61
|
+
export { EncryptOnlyCipherError, IntegrityError, KeyUnwrapError, UnknownEpochError } from '../errors.js';
|
|
62
62
|
/**
|
|
63
63
|
* A wallet's own key-agreement key as a `RecipientPublicKey` -- the "recipient
|
|
64
64
|
* zero" entry a caller passes to `initRecipients` when it first makes a
|
|
@@ -108,7 +108,7 @@ export interface EdvDocCipher extends DocCipher {
|
|
|
108
108
|
/**
|
|
109
109
|
* {@link DocCipher.decrypt}, widened with `chunkSource`: a chunked envelope's
|
|
110
110
|
* chunks come from `context` (fetched from the server, on a cipher built
|
|
111
|
-
* with a `
|
|
111
|
+
* with a `spaceUrl`) or from `chunkSource` (bytes the caller holds, on any
|
|
112
112
|
* cipher). Passing both throws `ValidationError`. Passing neither throws
|
|
113
113
|
* `EncryptionError` for a chunked envelope. A chunk the source does not hold
|
|
114
114
|
* throws `NotFoundError`, and a chunk whose `was` binding differs from the
|
|
@@ -194,7 +194,9 @@ export interface EdvDocCipher extends DocCipher {
|
|
|
194
194
|
* The reader must be a recipient of every epoch on the descriptor (the owner is
|
|
195
195
|
* "recipient zero"). If it is a recipient of none, building the cipher
|
|
196
196
|
* throws {@link KeyUnwrapError}; this surfaces it with a clearer error rather
|
|
197
|
-
* than silently writing envelopes other recipients cannot read.
|
|
197
|
+
* than silently writing envelopes other recipients cannot read. An entry that
|
|
198
|
+
* names this reader but fails its key-wrap integrity check throws
|
|
199
|
+
* {@link IntegrityError} instead, and that propagates untouched.
|
|
198
200
|
*
|
|
199
201
|
* @param options {object}
|
|
200
202
|
* @param options.keyAgreementKey {IKeyAgreementKey}
|
|
@@ -203,7 +205,8 @@ export interface EdvDocCipher extends DocCipher {
|
|
|
203
205
|
* the real id, not a label: the collection's metadata envelope is
|
|
204
206
|
* AEAD-bound to it (`was.collection`), so `applyMeta` refuses an envelope
|
|
205
207
|
* bound elsewhere.
|
|
206
|
-
* @param [options.
|
|
208
|
+
* @param [options.spaceUrl] {string} the URL of the WAS Space holding the
|
|
209
|
+
* collection.
|
|
207
210
|
* It gives the codec a route to a chunked document's chunk resources, so a
|
|
208
211
|
* `decrypt` that also passes a request context reassembles a chunked
|
|
209
212
|
* envelope. Without it such a `decrypt` throws `NotSupportedError`; a
|
|
@@ -223,11 +226,11 @@ export interface EdvDocCipher extends DocCipher {
|
|
|
223
226
|
* as before.
|
|
224
227
|
* @returns {Promise<EdvDocCipher>}
|
|
225
228
|
*/
|
|
226
|
-
export declare function createEdvDocCipher({ keyAgreementKey, keyResolver, collectionId,
|
|
229
|
+
export declare function createEdvDocCipher({ keyAgreementKey, keyResolver, collectionId, spaceUrl, idDerivation, encryption, meta }: {
|
|
227
230
|
keyAgreementKey: IKeyAgreementKey;
|
|
228
231
|
keyResolver: IKeyResolver;
|
|
229
232
|
collectionId: string;
|
|
230
|
-
|
|
233
|
+
spaceUrl?: string;
|
|
231
234
|
idDerivation?: 'content' | 'random';
|
|
232
235
|
encryption: CollectionEncryption;
|
|
233
236
|
meta?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docCipher.d.ts","sourceRoot":"","sources":["../../src/edv/docCipher.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACb,MAAM,8BAA8B,CAAA;AACrC,OAAO,KAAK,EAAE,mBAAmB,EAAc,WAAW,EAAE,MAAM,aAAa,CAAA;AAU/E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAGvD,OAAO,KAAK,EACV,WAAW,EAGZ,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"docCipher.d.ts","sourceRoot":"","sources":["../../src/edv/docCipher.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;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vCodec, encryptOnlyEdvCodec } from './EdvCodec.js';
|
|
|
7
7
|
// `isEncryptedEnvelope` and the `DocCipher` interface live in the crypto-free
|
|
8
8
|
// `../sync` module, and the decrypt-routing signals (`UnknownEpochError` for a
|
|
9
9
|
// stale descriptor, `KeyUnwrapError` for a reader that is not a recipient of
|
|
10
|
-
// the envelope's epoch
|
|
10
|
+
// the envelope's epoch, `IntegrityError` for a kid-matched entry or envelope
|
|
11
|
+
// that fails its integrity check) in the errors module; re-exported here so an
|
|
11
12
|
// encrypted-collection consumer that imports this subpath gets them without a
|
|
12
13
|
// second import.
|
|
13
14
|
export { isEncryptedEnvelope } from '../sync/envelope.js';
|
|
14
|
-
export { EncryptOnlyCipherError, KeyUnwrapError, UnknownEpochError } from '../errors.js';
|
|
15
|
+
export { EncryptOnlyCipherError, IntegrityError, KeyUnwrapError, UnknownEpochError } from '../errors.js';
|
|
15
16
|
/**
|
|
16
17
|
* A wallet's own key-agreement key as a `RecipientPublicKey` -- the "recipient
|
|
17
18
|
* zero" entry a caller passes to `initRecipients` when it first makes a
|
|
@@ -58,7 +59,9 @@ export function ownerRecipient({ keyAgreementKey }) {
|
|
|
58
59
|
* The reader must be a recipient of every epoch on the descriptor (the owner is
|
|
59
60
|
* "recipient zero"). If it is a recipient of none, building the cipher
|
|
60
61
|
* throws {@link KeyUnwrapError}; this surfaces it with a clearer error rather
|
|
61
|
-
* than silently writing envelopes other recipients cannot read.
|
|
62
|
+
* than silently writing envelopes other recipients cannot read. An entry that
|
|
63
|
+
* names this reader but fails its key-wrap integrity check throws
|
|
64
|
+
* {@link IntegrityError} instead, and that propagates untouched.
|
|
62
65
|
*
|
|
63
66
|
* @param options {object}
|
|
64
67
|
* @param options.keyAgreementKey {IKeyAgreementKey}
|
|
@@ -67,7 +70,8 @@ export function ownerRecipient({ keyAgreementKey }) {
|
|
|
67
70
|
* the real id, not a label: the collection's metadata envelope is
|
|
68
71
|
* AEAD-bound to it (`was.collection`), so `applyMeta` refuses an envelope
|
|
69
72
|
* bound elsewhere.
|
|
70
|
-
* @param [options.
|
|
73
|
+
* @param [options.spaceUrl] {string} the URL of the WAS Space holding the
|
|
74
|
+
* collection.
|
|
71
75
|
* It gives the codec a route to a chunked document's chunk resources, so a
|
|
72
76
|
* `decrypt` that also passes a request context reassembles a chunked
|
|
73
77
|
* envelope. Without it such a `decrypt` throws `NotSupportedError`; a
|
|
@@ -87,17 +91,17 @@ export function ownerRecipient({ keyAgreementKey }) {
|
|
|
87
91
|
* as before.
|
|
88
92
|
* @returns {Promise<EdvDocCipher>}
|
|
89
93
|
*/
|
|
90
|
-
export async function createEdvDocCipher({ keyAgreementKey, keyResolver, collectionId,
|
|
94
|
+
export async function createEdvDocCipher({ keyAgreementKey, keyResolver, collectionId, spaceUrl, idDerivation = 'content', encryption, meta }) {
|
|
91
95
|
// Only a cipher told which Space its collection lives in has a server to
|
|
92
96
|
// address, and only the chunked-stream paths address one. Loading the
|
|
93
97
|
// factory here rather than at module scope keeps `WasTransport` out of an
|
|
94
98
|
// offline caller's import graph: a `createEdvDocCipher` call with no
|
|
95
|
-
// `
|
|
99
|
+
// `spaceUrl` evaluates no transport module at all.
|
|
96
100
|
let transportFactory;
|
|
97
|
-
if (
|
|
101
|
+
if (spaceUrl !== undefined) {
|
|
98
102
|
const { wasTransportFactory } = await import('./transportFactory.js');
|
|
99
103
|
transportFactory = wasTransportFactory({
|
|
100
|
-
|
|
104
|
+
spaceUrl,
|
|
101
105
|
collectionId,
|
|
102
106
|
contentType: DEFAULT_CONTENT_TYPE
|
|
103
107
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docCipher.js","sourceRoot":"","sources":["../../src/edv/docCipher.ts"],"names":[],"mappings":"AAyDA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAChE,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM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AO;YACX,MAAM,IAAI,sBAAsB,CAC9B,4CAA4C,YAAY,YAAY;gBAClE,kEAAkE;gBAClE,mDAAmD;gBACnD,wDAAwD,CAC3D,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/dist/edv/encryption.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ import type { EdvKeys } from './EdvCodec.js';
|
|
|
21
21
|
* Collection's `encryption` descriptor (or a per-handle override). Core calls
|
|
22
22
|
* `codecFor` only for a collection already known to be encrypted; this provider
|
|
23
23
|
* then supplies the keys: the override-supplied `keys` when present, else
|
|
24
|
-
* `resolveKeys({
|
|
24
|
+
* `resolveKeys({ spaceUrl, collectionId })`. `resolveKeys` returning `null` means
|
|
25
25
|
* "I hold no keys for this collection", so core fails closed (it does **not**
|
|
26
26
|
* mean plaintext -- the descriptor/override already decided that). A non-`edv`
|
|
27
27
|
* scheme yields `null` (this provider does not handle it).
|
|
@@ -60,7 +60,7 @@ import type { EdvKeys } from './EdvCodec.js';
|
|
|
60
60
|
*/
|
|
61
61
|
export declare function createEdvEncryption({ resolveKeys, contentType, maxBlobBytes, chunkSize, idDerivation }: {
|
|
62
62
|
resolveKeys: (ref: {
|
|
63
|
-
|
|
63
|
+
spaceUrl: string;
|
|
64
64
|
collectionId: string;
|
|
65
65
|
}) => Promise<EdvKeys | null>;
|
|
66
66
|
contentType?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../src/edv/encryption.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AASrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../src/edv/encryption.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AASrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAI5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,WAAW,EACX,WAAkC,EAClC,YAAqC,EACrC,SAAS,EACT,YAAuB,EACxB,EAAE;IACD,WAAW,EAAE,CAAC,GAAG,EAAE;QACjB,QAAQ,EAAE,MAAM,CAAA;QAChB,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,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;CACpC,GAAG,kBAAkB,CA4CrB"}
|
package/dist/edv/encryption.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_CONTENT_TYPE } from './constants.js';
|
|
2
2
|
import { DEFAULT_MAX_BLOB_BYTES, EDV_SCHEME, buildEdvCodec, descriptorDefect, guardEncryptionDescriptor } from './EdvCodec.js';
|
|
3
|
+
import { collectionUrl } from '../internal/paths.js';
|
|
3
4
|
import { wasTransportFactory } from './transportFactory.js';
|
|
4
5
|
/**
|
|
5
6
|
* Builds an {@link EncryptionProvider} for the `edv` scheme: a pure **keystore**
|
|
@@ -10,7 +11,7 @@ import { wasTransportFactory } from './transportFactory.js';
|
|
|
10
11
|
* Collection's `encryption` descriptor (or a per-handle override). Core calls
|
|
11
12
|
* `codecFor` only for a collection already known to be encrypted; this provider
|
|
12
13
|
* then supplies the keys: the override-supplied `keys` when present, else
|
|
13
|
-
* `resolveKeys({
|
|
14
|
+
* `resolveKeys({ spaceUrl, collectionId })`. `resolveKeys` returning `null` means
|
|
14
15
|
* "I hold no keys for this collection", so core fails closed (it does **not**
|
|
15
16
|
* mean plaintext -- the descriptor/override already decided that). A non-`edv`
|
|
16
17
|
* scheme yields `null` (this provider does not handle it).
|
|
@@ -52,7 +53,7 @@ export function createEdvEncryption({ resolveKeys, contentType = DEFAULT_CONTENT
|
|
|
52
53
|
canRoute({ scheme, encryption }) {
|
|
53
54
|
return scheme === EDV_SCHEME && descriptorDefect(encryption) === null;
|
|
54
55
|
},
|
|
55
|
-
async codecFor({
|
|
56
|
+
async codecFor({ spaceUrl, collectionId, scheme, encryption, keys }) {
|
|
56
57
|
if (scheme !== EDV_SCHEME) {
|
|
57
58
|
return null;
|
|
58
59
|
}
|
|
@@ -61,20 +62,21 @@ export function createEdvEncryption({ resolveKeys, contentType = DEFAULT_CONTENT
|
|
|
61
62
|
// "holds no keys" the null return below would produce. `buildEdvCodec`
|
|
62
63
|
// guards again for callers that reach it directly; the guard is pure, so
|
|
63
64
|
// running it twice costs nothing.
|
|
65
|
+
const label = collectionUrl({ spaceUrl, collectionId });
|
|
64
66
|
guardEncryptionDescriptor({
|
|
65
|
-
label
|
|
67
|
+
label,
|
|
66
68
|
encryption
|
|
67
69
|
});
|
|
68
70
|
// Prefer override-supplied keys; otherwise consult the keystore.
|
|
69
71
|
const resolved = keys ??
|
|
70
|
-
(await resolveKeys({
|
|
72
|
+
(await resolveKeys({ spaceUrl, collectionId }));
|
|
71
73
|
if (!resolved) {
|
|
72
74
|
return null;
|
|
73
75
|
}
|
|
74
76
|
return buildEdvCodec({
|
|
75
|
-
label
|
|
77
|
+
label,
|
|
76
78
|
transportFactory: wasTransportFactory({
|
|
77
|
-
|
|
79
|
+
spaceUrl,
|
|
78
80
|
collectionId,
|
|
79
81
|
contentType
|
|
80
82
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encryption.js","sourceRoot":"","sources":["../../src/edv/encryption.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AACr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ACvE,CAAC;QAED,KAAK,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE;YACjE,IAAI,MAAM,KAAK,UAAU,EAAE,CAAC;gBAC1B,OAAO,IAAI,CAAA;YACb,CAAC;YACD,uEAAuE;YACvE,wEAAwE;YACxE,uEAAuE;YACvE,yEAAyE;YACzE,kCAAkC;YAClC,MAAM,KAAK,GAAG,aAAa,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAA;YACvD,yBAAyB,CAAC;gBACxB,KAAK;gBACL,UAAU;aACX,CAAC,CAAA;YACF,iEAAiE;YACjE,MAAM,QAAQ,GACX,IAA4B;gBAC7B,CAAC,MAAM,WAAW,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAC,CAAA;YACjD,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,OAAO,IAAI,CAAA;YACb,CAAC;YACD,OAAO,aAAa,CAAC;gBACnB,KAAK;gBACL,gBAAgB,EAAE,mBAAmB,CAAC;oBACpC,QAAQ;oBACR,YAAY;oBACZ,WAAW;iBACZ,CAAC;gBACF,YAAY;gBACZ,UAAU;gBACV,IAAI,EAAE,QAAQ;gBACd,WAAW;gBACX,YAAY;gBACZ,GAAG,CAAC,SAAS,KAAK,SAAS,IAAI,EAAE,SAAS,EAAE,CAAC;gBAC7C,YAAY;aACb,CAAC,CAAA;QACJ,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -48,10 +48,18 @@ export declare function wrapEpochSecretTo({ epochSecret, recipients }: {
|
|
|
48
48
|
}): Promise<CollectionEncryptionRecipient[]>;
|
|
49
49
|
/**
|
|
50
50
|
* Unwraps an epoch secret from a descriptor `recipients` entry using the
|
|
51
|
-
* reader's own key-agreement key. Returns `null` when
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
51
|
+
* reader's own key-agreement key. Returns `null` when the entry is not
|
|
52
|
+
* addressed to this key (its `kid` is another reader's id) or is malformed (no
|
|
53
|
+
* usable `epk`, a non-base64url `encrypted_key`, a failed ECDH) -- never treat
|
|
54
|
+
* `null` as a key; try the next candidate entry or epoch, and fail with a
|
|
55
|
+
* typed error when nothing unwraps.
|
|
56
|
+
*
|
|
57
|
+
* Throws {@link IntegrityError} when the entry names this reader and is
|
|
58
|
+
* well-formed but its AES-KW integrity check fails. That cannot mean "not my
|
|
59
|
+
* entry": the entry is addressed to this reader and its wrapped bytes do not
|
|
60
|
+
* authenticate under the key they were wrapped to. It is the key-wrap
|
|
61
|
+
* counterpart of a content envelope whose AEAD tag fails for a kid-matched
|
|
62
|
+
* key, and it is reported the same way rather than as a membership decision.
|
|
55
63
|
*
|
|
56
64
|
* @param options {object}
|
|
57
65
|
* @param options.entry {CollectionEncryptionRecipient} the descriptor entry
|
|
@@ -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;AAGpE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAYhE;;;;;GAKG;AACH,eAAO,MAAM,cAAc,aAAa,CAAA;AAExC;;;;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;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,WAAW,EACX,UAAU,EACX,EAAE;IACD,WAAW,EAAE,UAAU,CAAA;IACvB,UAAU,EAAE,kBAAkB,EAAE,CAAA;CACjC,GAAG,OAAO,CAAC,6BAA6B,EAAE,CAAC,CAI3C;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;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,CA2D7B;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,6 +33,7 @@
|
|
|
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 { IntegrityError } from '../errors.js';
|
|
36
37
|
import { ENCODER } from '../internal/content.js';
|
|
37
38
|
/**
|
|
38
39
|
* The JOSE key-management algorithm for every epoch/recipient wrap.
|
|
@@ -101,10 +102,18 @@ export async function wrapEpochSecretTo({ epochSecret, recipients }) {
|
|
|
101
102
|
}
|
|
102
103
|
/**
|
|
103
104
|
* Unwraps an epoch secret from a descriptor `recipients` entry using the
|
|
104
|
-
* reader's own key-agreement key. Returns `null` when
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
105
|
+
* reader's own key-agreement key. Returns `null` when the entry is not
|
|
106
|
+
* addressed to this key (its `kid` is another reader's id) or is malformed (no
|
|
107
|
+
* usable `epk`, a non-base64url `encrypted_key`, a failed ECDH) -- never treat
|
|
108
|
+
* `null` as a key; try the next candidate entry or epoch, and fail with a
|
|
109
|
+
* typed error when nothing unwraps.
|
|
110
|
+
*
|
|
111
|
+
* Throws {@link IntegrityError} when the entry names this reader and is
|
|
112
|
+
* well-formed but its AES-KW integrity check fails. That cannot mean "not my
|
|
113
|
+
* entry": the entry is addressed to this reader and its wrapped bytes do not
|
|
114
|
+
* authenticate under the key they were wrapped to. It is the key-wrap
|
|
115
|
+
* counterpart of a content envelope whose AEAD tag fails for a kid-matched
|
|
116
|
+
* key, and it is reported the same way rather than as a membership decision.
|
|
108
117
|
*
|
|
109
118
|
* @param options {object}
|
|
110
119
|
* @param options.entry {CollectionEncryptionRecipient} the descriptor entry
|
|
@@ -113,6 +122,12 @@ export async function wrapEpochSecretTo({ epochSecret, recipients }) {
|
|
|
113
122
|
* @returns {Promise<Uint8Array | null>}
|
|
114
123
|
*/
|
|
115
124
|
export async function unwrapEpochSecret({ entry, keyAgreementKey }) {
|
|
125
|
+
if (entry.header.kid !== keyAgreementKey.id) {
|
|
126
|
+
// Another reader's entry: the KDF binds the wrap to the recipient's key
|
|
127
|
+
// id, so this key could never unwrap it, and a failure below would say
|
|
128
|
+
// nothing about the entry's integrity.
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
116
131
|
const epk = entry.header.epk;
|
|
117
132
|
if (!epk || typeof epk.x !== 'string') {
|
|
118
133
|
return null;
|
|
@@ -122,8 +137,8 @@ export async function unwrapEpochSecret({ entry, keyAgreementKey }) {
|
|
|
122
137
|
ephemeralPublicKey = base64urlnopad.decode(epk.x);
|
|
123
138
|
}
|
|
124
139
|
catch {
|
|
125
|
-
// A malformed (non-base64url) `epk.x` is the
|
|
126
|
-
//
|
|
140
|
+
// A malformed (non-base64url) `epk.x` is the malformed-entry class:
|
|
141
|
+
// honor the documented null contract.
|
|
127
142
|
return null;
|
|
128
143
|
}
|
|
129
144
|
let secret;
|
|
@@ -142,15 +157,27 @@ export async function unwrapEpochSecret({ entry, keyAgreementKey }) {
|
|
|
142
157
|
const consumerInfo = ENCODER.encode(keyAgreementKey.id);
|
|
143
158
|
const keyData = await deriveKey({ secret, producerInfo, consumerInfo });
|
|
144
159
|
const kek = await createKek({ keyData });
|
|
160
|
+
let unwrapped;
|
|
145
161
|
try {
|
|
146
|
-
|
|
162
|
+
unwrapped = await kek.unwrapKey({ wrappedKey: entry.encrypted_key });
|
|
147
163
|
}
|
|
148
164
|
catch {
|
|
149
|
-
// `unwrapKey`
|
|
150
|
-
// malformed
|
|
151
|
-
//
|
|
165
|
+
// `unwrapKey` throws on a malformed (non-base64url or wrong-length)
|
|
166
|
+
// `encrypted_key`: the malformed-entry class, so honor the documented
|
|
167
|
+
// null contract.
|
|
152
168
|
return null;
|
|
153
169
|
}
|
|
170
|
+
if (unwrapped === null) {
|
|
171
|
+
// `unwrapKey` returns null only when the bytes decoded and had a valid
|
|
172
|
+
// length but the AES-KW integrity check failed: the entry is addressed to
|
|
173
|
+
// this reader and does not authenticate under its key.
|
|
174
|
+
throw new IntegrityError(`This reader's recipient entry (kid "${entry.header.kid}") failed to ` +
|
|
175
|
+
'authenticate: its wrapped epoch key did not pass the AES-KW ' +
|
|
176
|
+
'integrity check. The entry names this reader, so this is not a ' +
|
|
177
|
+
'membership problem -- the stored entry is corrupt or has been ' +
|
|
178
|
+
'tampered with.');
|
|
179
|
+
}
|
|
180
|
+
return unwrapped;
|
|
154
181
|
}
|
|
155
182
|
/**
|
|
156
183
|
* Mints a fresh key epoch: a new random X25519 key pair whose `did:key` is the
|
|
@@ -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;AAE1C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAGhD;;GAEG;AACH,MAAM,YAAY,GAAG,gBAAgB,CAAA;AAErC;;GAEG;AACH,MAAM,WAAW,GAAG,2BAA2B,CAAA;AAE/C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAA;AAaxC;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,EACpC,WAAW,EACX,SAAS,EAIV;IACC,MAAM,SAAS,GAAG,MAAM,yBAAyB,CAAC,QAAQ,EAAE,CAAA;IAC5D,MAAM,kBAAkB,GAAG,eAAe,CACxC,4BAA4B,EAC5B,SAAS,CAAC,kBAAkB,CAC7B,CAAA;IACD,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,YAAY,CAAC;QAC1C,SAAS,EAAE,EAAE,kBAAkB,EAAE,SAAS,CAAC,kBA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AAM,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IACpC,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,MAAM,CAAA;IACf,CAAC;IACD,MAAM,IAAI,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAC5B,MAAM,QAAQ,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,CAAA;IACtD,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,sCAAsC,EAAE,IAAI,CAAC,CAAA;IAC/D,CAAC;IACD,4EAA4E;IAC5E,wCAAwC;IACxC,MAAM,OAAO,GAAG,yBAAyB,CAAC,eAAe,CAAC;QACxD,WAAW,EAAE,QAAQ;KACtB,CAAC,CAAA;IACF,OAAO,CAAC,iBAAiB,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,CAAA;IACpD,MAAM,QAAQ,GAAG;QACf,EAAE;QACF,IAAI,EAAE,WAAW;QACjB,kBAAkB,EAAE,OAAO,CAAC,kBAAkB;KAC/C,CAAA;IACD,aAAa,CAAC,GAAG,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAA;IAC/B,OAAO,QAAQ,CAAA;AACjB,CAAC"}
|
package/dist/edv/epochKeys.d.ts
CHANGED
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* a resource written under an older epoch stays readable). The write epoch is
|
|
11
11
|
* unwrapped eagerly; the other epochs' keys unwrap lazily on first decrypt
|
|
12
12
|
* naming them, so a write-only handle does not pay to unwrap history it never
|
|
13
|
-
* reads.
|
|
13
|
+
* reads. A lazy unwrap that fails its key-wrap check is remembered, so a run of
|
|
14
|
+
* resources under a damaged epoch pays for one unwrap, not one per resource.
|
|
14
15
|
*
|
|
15
16
|
* This is the read axis: holding an epoch key lets a reader decrypt resources
|
|
16
17
|
* written under it. A reader removed from a later epoch keeps the earlier epoch
|
|
@@ -55,7 +56,10 @@ export interface ResolvedEpochKeys {
|
|
|
55
56
|
* fail-closed before calling this). Throws {@link KeyUnwrapError} when the
|
|
56
57
|
* descriptor HAS epochs but this reader can unwrap none of them (it is not a
|
|
57
58
|
* recipient), so an encrypted collection is never silently read/written with
|
|
58
|
-
* the wrong key.
|
|
59
|
+
* the wrong key. Throws {@link IntegrityError} when the entry addressed to
|
|
60
|
+
* this reader fails its key-wrap integrity check: that is a tamper signal, not
|
|
61
|
+
* a membership decision, and it propagates untouched (eagerly for the write
|
|
62
|
+
* epoch, on first decrypt for a lazily-unwrapped read epoch).
|
|
59
63
|
*
|
|
60
64
|
* The write epoch is always the descriptor's current epoch, whether or not
|
|
61
65
|
* this reader is a recipient of it: a reader rotated off the current epoch
|