@interop/was-client 0.69.0 → 0.70.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.
Files changed (65) hide show
  1. package/README.md +26 -0
  2. package/dist/Collection.d.ts.map +1 -1
  3. package/dist/Collection.js +2 -2
  4. package/dist/Collection.js.map +1 -1
  5. package/dist/Space.d.ts +8 -2
  6. package/dist/Space.d.ts.map +1 -1
  7. package/dist/Space.js +19 -4
  8. package/dist/Space.js.map +1 -1
  9. package/dist/WasClient.d.ts +4 -0
  10. package/dist/WasClient.d.ts.map +1 -1
  11. package/dist/WasClient.js +18 -6
  12. package/dist/WasClient.js.map +1 -1
  13. package/dist/edv/EdvCodec.d.ts +56 -74
  14. package/dist/edv/EdvCodec.d.ts.map +1 -1
  15. package/dist/edv/EdvCodec.js +12 -118
  16. package/dist/edv/EdvCodec.js.map +1 -1
  17. package/dist/edv/WasTransport.d.ts +1 -1
  18. package/dist/edv/WasTransport.d.ts.map +1 -1
  19. package/dist/edv/WasTransport.js +1 -1
  20. package/dist/edv/WasTransport.js.map +1 -1
  21. package/dist/edv/core.d.ts +81 -0
  22. package/dist/edv/core.d.ts.map +1 -0
  23. package/dist/edv/core.js +74 -0
  24. package/dist/edv/core.js.map +1 -0
  25. package/dist/edv/docCipher.d.ts.map +1 -1
  26. package/dist/edv/docCipher.js +16 -8
  27. package/dist/edv/docCipher.js.map +1 -1
  28. package/dist/edv/encryption.d.ts +71 -0
  29. package/dist/edv/encryption.d.ts.map +1 -0
  30. package/dist/edv/encryption.js +92 -0
  31. package/dist/edv/encryption.js.map +1 -0
  32. package/dist/edv/index.d.ts +17 -58
  33. package/dist/edv/index.d.ts.map +1 -1
  34. package/dist/edv/index.js +20 -51
  35. package/dist/edv/index.js.map +1 -1
  36. package/dist/edv/transportFactory.d.ts +17 -0
  37. package/dist/edv/transportFactory.d.ts.map +1 -0
  38. package/dist/edv/transportFactory.js +32 -0
  39. package/dist/edv/transportFactory.js.map +1 -0
  40. package/dist/index.d.ts +7 -1
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/internal/codec.js +2 -1
  43. package/dist/internal/codec.js.map +1 -1
  44. package/dist/internal/describe.d.ts +1 -43
  45. package/dist/internal/describe.d.ts.map +1 -1
  46. package/dist/internal/describe.js +23 -28
  47. package/dist/internal/describe.js.map +1 -1
  48. package/dist/internal/grant.d.ts +2 -0
  49. package/dist/internal/grant.d.ts.map +1 -1
  50. package/dist/internal/grant.js +11 -0
  51. package/dist/internal/grant.js.map +1 -1
  52. package/dist/internal/meta.d.ts +22 -0
  53. package/dist/internal/meta.d.ts.map +1 -1
  54. package/dist/internal/meta.js +40 -4
  55. package/dist/internal/meta.js.map +1 -1
  56. package/dist/internal/paths.d.ts +9 -2
  57. package/dist/internal/paths.d.ts.map +1 -1
  58. package/dist/internal/paths.js +9 -2
  59. package/dist/internal/paths.js.map +1 -1
  60. package/dist/internal/request.d.ts +8 -1
  61. package/dist/internal/request.d.ts.map +1 -1
  62. package/dist/internal/request.js.map +1 -1
  63. package/dist/paths.d.ts +1 -0
  64. package/dist/paths.d.ts.map +1 -1
  65. package/package.json +9 -3
@@ -0,0 +1,81 @@
1
+ /*!
2
+ * Copyright (c) 2026 Interop Alliance. All rights reserved.
3
+ */
4
+ /**
5
+ * The `@interop/was-client/edv/core` subpath entry: the offline half of
6
+ * encrypted (EDV-over-WAS) storage support. Everything here works on bytes and
7
+ * keys a caller already holds -- the codec, the doc ciphers, the key epochs,
8
+ * the recipient operations, `resourceDescriptorStore`, the log-governed
9
+ * descriptor stores and the blinding keys -- with no server in the graph. A
10
+ * consumer that opens archived bytes, derives keys, or decrypts rows it already
11
+ * has imports this entry and never evaluates a transport module. The one gated
12
+ * exception is `createEdvDocCipher({ spaceId })`, which loads the transport
13
+ * factory through `import()` for the chunked paths. A call that names no Space
14
+ * loads nothing.
15
+ *
16
+ * `@interop/was-client/edv` re-exports all of it and adds the online set on
17
+ * top (`WasTransport`, `createEdvEncryption`, `wasTransportFactory`,
18
+ * `collectionDescriptorStore`, descriptor acquisition and the refresh policy),
19
+ * so an online consumer keeps importing that one entry and nothing moves.
20
+ *
21
+ * Every encrypted collection carries a key-epoch roster from birth:
22
+ * `ensureFirstEpoch` installs epoch[0] at provision time (create-if-absent;
23
+ * the crypto-free `ensureSpaceAndCollection` only ensures the container), and
24
+ * `initRecipients` / `addRecipient` / `removeRecipient` manage the readers and
25
+ * rotate the epoch key, so the same key material transparently encrypts each
26
+ * write under the current epoch and decrypts any epoch a reader still holds.
27
+ * They mutate the descriptor through the descriptor-store seam: any
28
+ * `EncryptionDescriptorStore` -- e.g. `resourceDescriptorStore` for a
29
+ * descriptor hosted as a plain JSON Resource, or
30
+ * `logGovernedDescriptorStore` for one governed by a resource log.
31
+ *
32
+ * A collection provisioned with `ensureFirstEpoch({ blindedIndex: true })` also
33
+ * carries a blinded-index HMAC key, distributed to recipients exactly like an
34
+ * epoch key (see `hmacKey.ts`). It is installed at provisioning or never, and
35
+ * never rotates.
36
+ *
37
+ * `hasKeyEpochs` and `epochRostersEqual` are the crypto-free predicates over a
38
+ * descriptor: whether it carries a usable roster, and whether two descriptors
39
+ * carry the same epoch configuration (`scheme`, `version`, `currentEpoch`, and
40
+ * the ordered epoch ids; recipients and the `hmac` member deliberately
41
+ * excluded).
42
+ *
43
+ * `x25519RecipientFromDidKey` is the one rule for turning a grantee named only
44
+ * by its Ed25519 `did:key` controller into a `RecipientPublicKey`, so a
45
+ * recipient key is always derived from an identifier both sides already hold
46
+ * rather than transmitted. `didKeyResolver` is the reverse direction, the
47
+ * resolver the codec hands the cipher.
48
+ *
49
+ * A decrypt that finds no key raises one of two classes, and a caller scanning
50
+ * rows must tell them apart: `UnknownEpochError` when the envelope's epoch is
51
+ * not on the descriptor the reader holds (a re-read may fix it) and
52
+ * `KeyUnwrapError` when the epoch IS listed but this reader has no key for it
53
+ * (never a recipient, or removed and the epoch rotated since -- re-reading
54
+ * cannot help). Both ship from this entry beside the cipher that raises them,
55
+ * so a consumer classifying what a cipher threw need not reach for the package
56
+ * root. Both assign their `name` explicitly, and a consumer whose cipher
57
+ * arrives through an injected seam matches on that name rather than
58
+ * `instanceof`, since the seam may resolve to a second copy of this package:
59
+ * `isKeyUnwrapError` here, and `isUnknownEpochError` on `./sync`, are those
60
+ * matchers.
61
+ */
62
+ export { EdvCodec } from './EdvCodec.js';
63
+ export type { CodecTransportFactory, EdvKeys } from './EdvCodec.js';
64
+ export { EDV_SCHEME_VERSION, JOSE_CONTENT_TYPE } from './constants.js';
65
+ export { ensureFirstEpoch, initRecipients, addRecipient, removeRecipient, replaceRecipient } from './recipients.js';
66
+ export type { RecipientPublicKey } from './recipients.js';
67
+ export { isEd25519DidKey, x25519RecipientFromDidKey } from './didKeyRecipient.js';
68
+ export { resourceDescriptorStore } from './descriptorStore.js';
69
+ export type { EncryptionDescriptorStore } from './descriptorStore.js';
70
+ export { EPOCH_CONFIGURATION_STATE_TYPE, logGovernedCollectionDescriptorStore, logGovernedDescriptorStore, readGovernedEpochConfiguration, toEpochConfigurationState } from './logGovernedDescriptorStore.js';
71
+ export type { LogGovernedDescriptorStore } from './logGovernedDescriptorStore.js';
72
+ export { didKeyResolver, mintEpoch, epochKeyIdFor, unwrapEpochSecret, wrapEpochSecret } from './epochCrypto.js';
73
+ export { hasKeyEpochs, epochRostersEqual } from './epochRoster.js';
74
+ export { resolveEpochKeys } from './epochKeys.js';
75
+ export type { ResolvedEpochKeys } from './epochKeys.js';
76
+ export { HMAC_KEY_TYPE, mintHmacKey, hmacKeyFromSecret, resolveHmacKey } from './hmacKey.js';
77
+ export type { BlindingKey } from './hmacKey.js';
78
+ export { createEdvDocCipher, createEdvEncryptOnlyDocCipher, ownerRecipient, EncryptOnlyCipherError, KeyUnwrapError, UnknownEpochError, isEncryptedEnvelope } from './docCipher.js';
79
+ export type { DocCipher, EdvDocCipher } from './docCipher.js';
80
+ export { isKeyUnwrapError } from '../sync/predicates.js';
81
+ //# sourceMappingURL=core.d.ts.map
@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,cAAc,CAAA;AAC/C,OAAO,EACL,kBAAkB,EAClB,6BAA6B,EAC7B,cAAc,EACd,sBAAsB,EACtB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,gBAAgB,CAAA;AACvB,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA"}
@@ -0,0 +1,74 @@
1
+ /*!
2
+ * Copyright (c) 2026 Interop Alliance. All rights reserved.
3
+ */
4
+ /**
5
+ * The `@interop/was-client/edv/core` subpath entry: the offline half of
6
+ * encrypted (EDV-over-WAS) storage support. Everything here works on bytes and
7
+ * keys a caller already holds -- the codec, the doc ciphers, the key epochs,
8
+ * the recipient operations, `resourceDescriptorStore`, the log-governed
9
+ * descriptor stores and the blinding keys -- with no server in the graph. A
10
+ * consumer that opens archived bytes, derives keys, or decrypts rows it already
11
+ * has imports this entry and never evaluates a transport module. The one gated
12
+ * exception is `createEdvDocCipher({ spaceId })`, which loads the transport
13
+ * factory through `import()` for the chunked paths. A call that names no Space
14
+ * loads nothing.
15
+ *
16
+ * `@interop/was-client/edv` re-exports all of it and adds the online set on
17
+ * top (`WasTransport`, `createEdvEncryption`, `wasTransportFactory`,
18
+ * `collectionDescriptorStore`, descriptor acquisition and the refresh policy),
19
+ * so an online consumer keeps importing that one entry and nothing moves.
20
+ *
21
+ * Every encrypted collection carries a key-epoch roster from birth:
22
+ * `ensureFirstEpoch` installs epoch[0] at provision time (create-if-absent;
23
+ * the crypto-free `ensureSpaceAndCollection` only ensures the container), and
24
+ * `initRecipients` / `addRecipient` / `removeRecipient` manage the readers and
25
+ * rotate the epoch key, so the same key material transparently encrypts each
26
+ * write under the current epoch and decrypts any epoch a reader still holds.
27
+ * They mutate the descriptor through the descriptor-store seam: any
28
+ * `EncryptionDescriptorStore` -- e.g. `resourceDescriptorStore` for a
29
+ * descriptor hosted as a plain JSON Resource, or
30
+ * `logGovernedDescriptorStore` for one governed by a resource log.
31
+ *
32
+ * A collection provisioned with `ensureFirstEpoch({ blindedIndex: true })` also
33
+ * carries a blinded-index HMAC key, distributed to recipients exactly like an
34
+ * epoch key (see `hmacKey.ts`). It is installed at provisioning or never, and
35
+ * never rotates.
36
+ *
37
+ * `hasKeyEpochs` and `epochRostersEqual` are the crypto-free predicates over a
38
+ * descriptor: whether it carries a usable roster, and whether two descriptors
39
+ * carry the same epoch configuration (`scheme`, `version`, `currentEpoch`, and
40
+ * the ordered epoch ids; recipients and the `hmac` member deliberately
41
+ * excluded).
42
+ *
43
+ * `x25519RecipientFromDidKey` is the one rule for turning a grantee named only
44
+ * by its Ed25519 `did:key` controller into a `RecipientPublicKey`, so a
45
+ * recipient key is always derived from an identifier both sides already hold
46
+ * rather than transmitted. `didKeyResolver` is the reverse direction, the
47
+ * resolver the codec hands the cipher.
48
+ *
49
+ * A decrypt that finds no key raises one of two classes, and a caller scanning
50
+ * rows must tell them apart: `UnknownEpochError` when the envelope's epoch is
51
+ * not on the descriptor the reader holds (a re-read may fix it) and
52
+ * `KeyUnwrapError` when the epoch IS listed but this reader has no key for it
53
+ * (never a recipient, or removed and the epoch rotated since -- re-reading
54
+ * cannot help). Both ship from this entry beside the cipher that raises them,
55
+ * so a consumer classifying what a cipher threw need not reach for the package
56
+ * root. Both assign their `name` explicitly, and a consumer whose cipher
57
+ * arrives through an injected seam matches on that name rather than
58
+ * `instanceof`, since the seam may resolve to a second copy of this package:
59
+ * `isKeyUnwrapError` here, and `isUnknownEpochError` on `./sync`, are those
60
+ * matchers.
61
+ */
62
+ export { EdvCodec } from './EdvCodec.js';
63
+ export { EDV_SCHEME_VERSION, JOSE_CONTENT_TYPE } from './constants.js';
64
+ export { ensureFirstEpoch, initRecipients, addRecipient, removeRecipient, replaceRecipient } from './recipients.js';
65
+ export { isEd25519DidKey, x25519RecipientFromDidKey } from './didKeyRecipient.js';
66
+ export { resourceDescriptorStore } from './descriptorStore.js';
67
+ export { EPOCH_CONFIGURATION_STATE_TYPE, logGovernedCollectionDescriptorStore, logGovernedDescriptorStore, readGovernedEpochConfiguration, toEpochConfigurationState } from './logGovernedDescriptorStore.js';
68
+ export { didKeyResolver, mintEpoch, epochKeyIdFor, unwrapEpochSecret, wrapEpochSecret } from './epochCrypto.js';
69
+ export { hasKeyEpochs, epochRostersEqual } from './epochRoster.js';
70
+ export { resolveEpochKeys } from './epochKeys.js';
71
+ export { HMAC_KEY_TYPE, mintHmacKey, hmacKeyFromSecret, resolveHmacKey } from './hmacKey.js';
72
+ export { createEdvDocCipher, createEdvEncryptOnlyDocCipher, ownerRecipient, EncryptOnlyCipherError, KeyUnwrapError, UnknownEpochError, isEncryptedEnvelope } from './docCipher.js';
73
+ export { isKeyUnwrapError } from '../sync/predicates.js';
74
+ //# sourceMappingURL=core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/edv/core.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;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,EACjB,MAAM,iBAAiB,CAAA;AAExB,OAAO,EACL,eAAe,EACf,yBAAyB,EAC1B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAE9D,OAAO,EACL,8BAA8B,EAC9B,oCAAoC,EACpC,0BAA0B,EAC1B,8BAA8B,EAC9B,yBAAyB,EAC1B,MAAM,iCAAiC,CAAA;AAExC,OAAO,EACL,cAAc,EACd,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,eAAe,EAChB,MAAM,kBAAkB,CAA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6BG;AACH,wBAAsB,6BAA6B,CAAC,EAClD,YAAY,EACZ,YAAwB,EACxB,UAAU,EACX,EAAE;IACD,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAA;IACnC,UAAU,EAAE,oBAAoB,CAAA;CACjC,GAAG,OAAO,CAAC,SAAS,CAAC,CAsBrB"}
@@ -3,7 +3,7 @@ import { DECODER, storedResponse } from '../internal/content.js';
3
3
  import { EMPTY_INDEX_SCHEMA, readIndexSchema } from '../internal/indexSchema.js';
4
4
  import { EncryptOnlyCipherError, KeyUnwrapError, requireResourceId, ValidationError } from '../errors.js';
5
5
  import { DEFAULT_CONTENT_TYPE } from './constants.js';
6
- import { buildEdvCodec, encryptOnlyEdvCodec, wasTransportFactory } from './EdvCodec.js';
6
+ import { buildEdvCodec, 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
@@ -87,6 +87,20 @@ export function ownerRecipient({ keyAgreementKey }) {
87
87
  * @returns {Promise<EdvDocCipher>}
88
88
  */
89
89
  export async function createEdvDocCipher({ keyAgreementKey, keyResolver, collectionId, spaceId, idDerivation = 'content', encryption, meta }) {
90
+ // Only a cipher told which Space its collection lives in has a server to
91
+ // address, and only the chunked-stream paths address one. Loading the
92
+ // factory here rather than at module scope keeps `WasTransport` out of an
93
+ // offline caller's import graph: a `createEdvDocCipher` call with no
94
+ // `spaceId` evaluates no transport module at all.
95
+ let transportFactory;
96
+ if (spaceId !== undefined) {
97
+ const { wasTransportFactory } = await import('./transportFactory.js');
98
+ transportFactory = wasTransportFactory({
99
+ spaceId,
100
+ collectionId,
101
+ contentType: DEFAULT_CONTENT_TYPE
102
+ });
103
+ }
90
104
  // One codec owns both axes. `buildEdvCodec` resolves this reader's per-epoch
91
105
  // keys from the descriptor: writes go under the descriptor's
92
106
  // `currentEpoch`, and reads pick the epoch key matching the envelope's
@@ -95,13 +109,7 @@ export async function createEdvDocCipher({ keyAgreementKey, keyResolver, collect
95
109
  try {
96
110
  codec = await buildEdvCodec({
97
111
  collectionId,
98
- ...(spaceId !== undefined && {
99
- transportFactory: wasTransportFactory({
100
- spaceId,
101
- collectionId,
102
- contentType: DEFAULT_CONTENT_TYPE
103
- })
104
- }),
112
+ ...(transportFactory !== undefined && { transportFactory }),
105
113
  encryption,
106
114
  keys: { keyAgreementKey, keyResolver },
107
115
  idDerivation
@@ -1 +1 @@
1
- {"version":3,"file":"docCipher.js","sourceRoot":"","sources":["../../src/edv/docCipher.ts"],"names":[],"mappings":"AA0DA,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,4BAA4B,CAAA;AAChF,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,iBAAiB,EACjB,eAAe,EAChB,MAAM,cAAc,CAAA;AAGrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,eAAe,CAAA;AAItB,8EAA8E;AAC9E,+EAA+E;AAC/E,6EAA6E;AAC7E,qEAAqE;AACrE,8EAA8E;AAC9E,iBAAiB;AACjB,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAEzD,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,iBAAiB,EAClB,MAAM,cAAc,CAAA;AAErB;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,cAAc,CAAC,EAC7B,eAAe,EAGhB;IACC,MAAM,EAAE,EAAE,EAAE,GAAG,eAAe,CAAA;IAC9B,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE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AAO,EAAE,aAAa,EAAE,GAAG,kBAAkB,CAAC;QACpD,KAAK;QACL,YAAY;KACb,CAAC,CAAA;IACF,OAAO;QACL,OAAO;QACP,aAAa;QACb,KAAK,CAAC,OAAO;YACX,MAAM,IAAI,sBAAsB,CAC9B,4CAA4C,YAAY,YAAY;gBAClE,kEAAkE;gBAClE,mDAAmD;gBACnD,wDAAwD,CAC3D,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,71 @@
1
+ /*!
2
+ * Copyright (c) 2026 Interop Alliance. All rights reserved.
3
+ */
4
+ /**
5
+ * `createEdvEncryption`: the EDV keystore for the handle seam, and the one
6
+ * {@link EncryptionProvider} in this package that points a codec at a server.
7
+ * It sits beside `wasTransportFactory` rather than beside the {@link EdvCodec}
8
+ * class, because it is the online half of the codec seam: a build with no
9
+ * server behind it (the local-replica doc cipher, `buildEdvCodec` and
10
+ * `encryptOnlyEdvCodec`) reaches the codec without evaluating this module or
11
+ * the transport behind it.
12
+ */
13
+ import type { EncryptionProvider } from '../codec.js';
14
+ import type { EdvKeys } from './EdvCodec.js';
15
+ /**
16
+ * Builds an {@link EncryptionProvider} for the `edv` scheme: a pure **keystore**
17
+ * that turns a collection's keys into an {@link EdvCodec}. Pass the result as
18
+ * `WasClient`'s `encryption` option.
19
+ *
20
+ * It does **not** decide which collections are encrypted -- that policy is the
21
+ * Collection's `encryption` descriptor (or a per-handle override). Core calls
22
+ * `codecFor` only for a collection already known to be encrypted; this provider
23
+ * then supplies the keys: the override-supplied `keys` when present, else
24
+ * `resolveKeys({ spaceId, collectionId })`. `resolveKeys` returning `null` means
25
+ * "I hold no keys for this collection", so core fails closed (it does **not**
26
+ * mean plaintext -- the descriptor/override already decided that). A non-`edv`
27
+ * scheme yields `null` (this provider does not handle it).
28
+ *
29
+ * @param options {object}
30
+ * @param options.resolveKeys {function} the keystore: returns the collection's
31
+ * `{ keyAgreementKey, keyResolver }`, or `null` if this client holds no keys
32
+ * for it (fail-closed -- not a plaintext signal)
33
+ * @param [options.contentType] {string} stored envelope content type;
34
+ * defaults to `application/json`. Pass `JOSE_CONTENT_TYPE`
35
+ * (`application/jose+json`) against a server that registers an
36
+ * `application/*+json` parser.
37
+ * @param [options.maxBlobBytes] {number} the size in raw bytes above which a
38
+ * binary `add()` is routed to the chunked-stream path instead of one document
39
+ * (default 512 KiB, sized so a single-document envelope stays under a
40
+ * server's ~1 MiB JSON body cap; raise it against a server with a larger
41
+ * limit). A routing threshold, not a hard cap.
42
+ * @param [options.chunkSize] {number} the size of each encrypted chunk a
43
+ * routed write emits, in bytes (default 1 MiB). Each chunk is one upload, so
44
+ * it must stay under the backend's `maxUploadBytes` constraint (the
45
+ * encrypted chunk is somewhat larger than `chunkSize`, so leave headroom).
46
+ * This is not checked client-side: the shared backend probe reads the
47
+ * descriptor's affordance tokens, not its `constraints`, so a chunk over the
48
+ * limit is rejected by the server with a `PayloadTooLargeError` (413) and
49
+ * the failed write's document stub is then cleaned up.
50
+ * @param [options.idDerivation] {string} how `add()` mints a document id.
51
+ * `'random'` (default) is the classic mutable-document model: a random
52
+ * `generateId()` id, updated in place via `sequence`. `'content'` derives the
53
+ * id from the encrypted envelope's JWE ciphertext
54
+ * (`EdvDocumentCipher.deriveId`), making documents content-addressed and
55
+ * therefore immutable (an "update" is delete-old + add-new) -- the model a
56
+ * replicating store wants, since the id is stable across replicas with no
57
+ * mapping table. Both formats pass the same EDV id check; the explicit-id
58
+ * `put(id, ...)` path is unaffected either way.
59
+ * @returns {EncryptionProvider}
60
+ */
61
+ export declare function createEdvEncryption({ resolveKeys, contentType, maxBlobBytes, chunkSize, idDerivation }: {
62
+ resolveKeys: (ref: {
63
+ spaceId: string;
64
+ collectionId: string;
65
+ }) => Promise<EdvKeys | null>;
66
+ contentType?: string;
67
+ maxBlobBytes?: number;
68
+ chunkSize?: number;
69
+ idDerivation?: 'random' | 'content';
70
+ }): EncryptionProvider;
71
+ //# sourceMappingURL=encryption.d.ts.map
@@ -0,0 +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;AAG5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,WAAW,EACX,WAAkC,EAClC,YAAqC,EACrC,SAAS,EACT,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,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;CACpC,GAAG,kBAAkB,CA2CrB"}
@@ -0,0 +1,92 @@
1
+ import { DEFAULT_CONTENT_TYPE } from './constants.js';
2
+ import { DEFAULT_MAX_BLOB_BYTES, EDV_SCHEME, buildEdvCodec, descriptorDefect, guardEncryptionDescriptor } from './EdvCodec.js';
3
+ import { wasTransportFactory } from './transportFactory.js';
4
+ /**
5
+ * Builds an {@link EncryptionProvider} for the `edv` scheme: a pure **keystore**
6
+ * that turns a collection's keys into an {@link EdvCodec}. Pass the result as
7
+ * `WasClient`'s `encryption` option.
8
+ *
9
+ * It does **not** decide which collections are encrypted -- that policy is the
10
+ * Collection's `encryption` descriptor (or a per-handle override). Core calls
11
+ * `codecFor` only for a collection already known to be encrypted; this provider
12
+ * then supplies the keys: the override-supplied `keys` when present, else
13
+ * `resolveKeys({ spaceId, collectionId })`. `resolveKeys` returning `null` means
14
+ * "I hold no keys for this collection", so core fails closed (it does **not**
15
+ * mean plaintext -- the descriptor/override already decided that). A non-`edv`
16
+ * scheme yields `null` (this provider does not handle it).
17
+ *
18
+ * @param options {object}
19
+ * @param options.resolveKeys {function} the keystore: returns the collection's
20
+ * `{ keyAgreementKey, keyResolver }`, or `null` if this client holds no keys
21
+ * for it (fail-closed -- not a plaintext signal)
22
+ * @param [options.contentType] {string} stored envelope content type;
23
+ * defaults to `application/json`. Pass `JOSE_CONTENT_TYPE`
24
+ * (`application/jose+json`) against a server that registers an
25
+ * `application/*+json` parser.
26
+ * @param [options.maxBlobBytes] {number} the size in raw bytes above which a
27
+ * binary `add()` is routed to the chunked-stream path instead of one document
28
+ * (default 512 KiB, sized so a single-document envelope stays under a
29
+ * server's ~1 MiB JSON body cap; raise it against a server with a larger
30
+ * limit). A routing threshold, not a hard cap.
31
+ * @param [options.chunkSize] {number} the size of each encrypted chunk a
32
+ * routed write emits, in bytes (default 1 MiB). Each chunk is one upload, so
33
+ * it must stay under the backend's `maxUploadBytes` constraint (the
34
+ * encrypted chunk is somewhat larger than `chunkSize`, so leave headroom).
35
+ * This is not checked client-side: the shared backend probe reads the
36
+ * descriptor's affordance tokens, not its `constraints`, so a chunk over the
37
+ * limit is rejected by the server with a `PayloadTooLargeError` (413) and
38
+ * the failed write's document stub is then cleaned up.
39
+ * @param [options.idDerivation] {string} how `add()` mints a document id.
40
+ * `'random'` (default) is the classic mutable-document model: a random
41
+ * `generateId()` id, updated in place via `sequence`. `'content'` derives the
42
+ * id from the encrypted envelope's JWE ciphertext
43
+ * (`EdvDocumentCipher.deriveId`), making documents content-addressed and
44
+ * therefore immutable (an "update" is delete-old + add-new) -- the model a
45
+ * replicating store wants, since the id is stable across replicas with no
46
+ * mapping table. Both formats pass the same EDV id check; the explicit-id
47
+ * `put(id, ...)` path is unaffected either way.
48
+ * @returns {EncryptionProvider}
49
+ */
50
+ export function createEdvEncryption({ resolveKeys, contentType = DEFAULT_CONTENT_TYPE, maxBlobBytes = DEFAULT_MAX_BLOB_BYTES, chunkSize, idDerivation = 'random' }) {
51
+ return {
52
+ canRoute({ scheme, encryption }) {
53
+ return scheme === EDV_SCHEME && descriptorDefect(encryption) === null;
54
+ },
55
+ async codecFor({ spaceId, collectionId, scheme, encryption, keys }) {
56
+ if (scheme !== EDV_SCHEME) {
57
+ return null;
58
+ }
59
+ // Guard the descriptor before consulting the keystore, so a collection
60
+ // whose descriptor cannot be opened reports THAT rather than the vaguer
61
+ // "holds no keys" the null return below would produce. `buildEdvCodec`
62
+ // guards again for callers that reach it directly; the guard is pure, so
63
+ // running it twice costs nothing.
64
+ guardEncryptionDescriptor({
65
+ label: `${spaceId}/${collectionId}`,
66
+ encryption
67
+ });
68
+ // Prefer override-supplied keys; otherwise consult the keystore.
69
+ const resolved = keys ??
70
+ (await resolveKeys({ spaceId, collectionId }));
71
+ if (!resolved) {
72
+ return null;
73
+ }
74
+ return buildEdvCodec({
75
+ label: `${spaceId}/${collectionId}`,
76
+ transportFactory: wasTransportFactory({
77
+ spaceId,
78
+ collectionId,
79
+ contentType
80
+ }),
81
+ collectionId,
82
+ encryption,
83
+ keys: resolved,
84
+ contentType,
85
+ maxBlobBytes,
86
+ ...(chunkSize !== undefined && { chunkSize }),
87
+ idDerivation
88
+ });
89
+ }
90
+ };
91
+ }
92
+ //# sourceMappingURL=encryption.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encryption.js","sourceRoot":"","sources":["../../src/edv/encryption.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EACL,sBAAsB,EACtB,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,yBAAyB,EAC1B,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,MAAM,UAAU,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/ `@interop/minimal-cipher` crypto graph
8
8
  * unless they opt in by importing this subpath.
9
9
  *
10
+ * This is the full encrypted surface, online and offline. It re-exports
11
+ * `@interop/was-client/edv/core` -- the codec, the doc ciphers, the key
12
+ * epochs, the recipient operations, `resourceDescriptorStore`, the log-governed
13
+ * descriptor stores and the blinding keys, none of which need a server -- and
14
+ * adds the modules that do talk to one, `collectionDescriptorStore` among
15
+ * them. A consumer working offline imports `./edv/core` instead and keeps every
16
+ * transport module out of its graph; everything this entry exported before
17
+ * that entry existed still resolves from here.
18
+ *
10
19
  * Two integration levels:
11
20
  *
12
21
  * - `createEdvEncryption` -- the EDV keystore for the handle seam. Pass its
@@ -17,45 +26,9 @@
17
26
  * - `WasTransport` -- the standalone `@interop/edv-client`
18
27
  * transport, for driving an `EdvClient` directly against WAS.
19
28
  *
20
- * Every encrypted collection carries a key-epoch roster from birth:
21
- * `ensureFirstEpoch` installs epoch[0] at provision time (create-if-absent;
22
- * the crypto-free `ensureSpaceAndCollection` only ensures the container), and
23
- * `initRecipients` / `addRecipient` / `removeRecipient` manage the readers and
24
- * rotate the epoch key, so the same `createEdvEncryption` provider
25
- * transparently encrypts each write under the current epoch and decrypts any
26
- * epoch a reader still holds.
27
- * They mutate the descriptor through the descriptor-store seam: the Collection
28
- * Description by default, or any `EncryptionDescriptorStore` -- e.g.
29
- * `resourceDescriptorStore` for a descriptor hosted as a plain JSON Resource.
30
- *
31
- * A collection provisioned with `ensureFirstEpoch({ blindedIndex: true })` also
32
- * carries a blinded-index HMAC key, distributed to recipients exactly like an
33
- * epoch key (see `hmacKey.ts`). It is installed at provisioning or never, and
34
- * never rotates.
35
- *
36
- * `hasKeyEpochs` and `epochRostersEqual` are the crypto-free predicates over a
37
- * descriptor: whether it carries a usable roster, and whether two descriptors
38
- * carry the same epoch configuration (`scheme`, `version`, `currentEpoch`, and
39
- * the ordered epoch ids; recipients and the `hmac` member deliberately
40
- * excluded).
41
- *
42
- * `x25519RecipientFromDidKey` is the one rule for turning a grantee named only
43
- * by its Ed25519 `did:key` controller into a `RecipientPublicKey`, so a
44
- * recipient key is always derived from an identifier both sides already hold
45
- * rather than transmitted.
46
- *
47
- * A decrypt that finds no key raises one of two classes, and a caller scanning
48
- * rows must tell them apart: `UnknownEpochError` when the envelope's epoch is
49
- * not on the descriptor the reader holds (a re-read may fix it) and
50
- * `KeyUnwrapError` when the epoch IS listed but this reader has no key for it
51
- * (never a recipient, or removed and the epoch rotated since -- re-reading
52
- * cannot help). Both ship from this subpath beside the cipher that raises
53
- * them, so a consumer classifying what a cipher threw need not reach for the
54
- * package root. Both assign their `name` explicitly, and a consumer whose
55
- * cipher arrives through an injected seam matches on that name rather than
56
- * `instanceof`, since the seam may resolve to a second copy of this package:
57
- * `isKeyUnwrapError` here, and `isUnknownEpochError` on `./sync`, are those
58
- * matchers.
29
+ * `collectionDescriptorStore` is the `EncryptionDescriptorStore` over a live
30
+ * `Collection` handle's Collection Description, the default the recipient
31
+ * operations use when a caller names a collection rather than a store.
59
32
  *
60
33
  * Which epoch a collection encrypts under, and when to ask again, is the
61
34
  * descriptor acquisition and refresh policy every consumer running an
@@ -83,28 +56,14 @@
83
56
  * re-reads the description, swaps itself, and retries exactly once per
84
57
  * instance.
85
58
  */
86
- export { createEdvEncryption, EdvCodec, wasTransportFactory } from './EdvCodec.js';
87
- export type { CodecTransportFactory, EdvKeys } from './EdvCodec.js';
59
+ export { EdvCodec, EDV_SCHEME_VERSION, JOSE_CONTENT_TYPE, ensureFirstEpoch, initRecipients, addRecipient, removeRecipient, replaceRecipient, isEd25519DidKey, x25519RecipientFromDidKey, resourceDescriptorStore, EPOCH_CONFIGURATION_STATE_TYPE, logGovernedCollectionDescriptorStore, logGovernedDescriptorStore, readGovernedEpochConfiguration, toEpochConfigurationState, didKeyResolver, mintEpoch, epochKeyIdFor, unwrapEpochSecret, wrapEpochSecret, hasKeyEpochs, epochRostersEqual, resolveEpochKeys, HMAC_KEY_TYPE, mintHmacKey, hmacKeyFromSecret, resolveHmacKey, createEdvDocCipher, createEdvEncryptOnlyDocCipher, ownerRecipient, EncryptOnlyCipherError, KeyUnwrapError, UnknownEpochError, isEncryptedEnvelope, isKeyUnwrapError } from './core.js';
60
+ export type { CodecTransportFactory, EdvKeys, RecipientPublicKey, EncryptionDescriptorStore, LogGovernedDescriptorStore, ResolvedEpochKeys, BlindingKey, DocCipher, EdvDocCipher } from './core.js';
61
+ export { createEdvEncryption } from './encryption.js';
62
+ export { wasTransportFactory } from './transportFactory.js';
88
63
  export { WasTransport } from './WasTransport.js';
89
- export { EDV_SCHEME_VERSION, JOSE_CONTENT_TYPE } from './constants.js';
90
- export { ensureFirstEpoch, initRecipients, addRecipient, removeRecipient, replaceRecipient } from './recipients.js';
91
- export type { RecipientPublicKey } from './recipients.js';
92
- export { isEd25519DidKey, x25519RecipientFromDidKey } from './didKeyRecipient.js';
93
- export { collectionDescriptorStore, resourceDescriptorStore } from './descriptorStore.js';
94
- export type { EncryptionDescriptorStore } from './descriptorStore.js';
95
- export { EPOCH_CONFIGURATION_STATE_TYPE, logGovernedCollectionDescriptorStore, logGovernedDescriptorStore, readGovernedEpochConfiguration, toEpochConfigurationState } from './logGovernedDescriptorStore.js';
96
- export type { LogGovernedDescriptorStore } from './logGovernedDescriptorStore.js';
97
- export { mintEpoch, epochKeyIdFor, unwrapEpochSecret, wrapEpochSecret } from './epochCrypto.js';
98
- export { hasKeyEpochs, epochRostersEqual } from './epochRoster.js';
99
- export { resolveEpochKeys } from './epochKeys.js';
100
- export type { ResolvedEpochKeys } from './epochKeys.js';
101
- export { HMAC_KEY_TYPE, mintHmacKey, hmacKeyFromSecret, resolveHmacKey } from './hmacKey.js';
102
- export type { BlindingKey } from './hmacKey.js';
103
- export { createEdvDocCipher, createEdvEncryptOnlyDocCipher, ownerRecipient, EncryptOnlyCipherError, KeyUnwrapError, UnknownEpochError, isEncryptedEnvelope } from './docCipher.js';
104
- export type { DocCipher, EdvDocCipher } from './docCipher.js';
64
+ export { collectionDescriptorStore } from './descriptorStore.js';
105
65
  export { acquireDescriptor, acquireDescriptors, wasDescriptorSource } from './acquire.js';
106
66
  export type { EncryptionDescriptorCache, EncryptionDescriptorSource } from './acquire.js';
107
67
  export { DescriptorRefreshPolicy } from './refresh.js';
108
68
  export { createRefreshingEdvDocCipher } from './refreshingDocCipher.js';
109
- export { isKeyUnwrapError } from '../sync/predicates.js';
110
69
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/edv/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiFG;AACH,OAAO,EACL,mBAAmB,EACnB,QAAQ,EACR,mBAAmB,EACpB,MAAM,eAAe,CAAA;AACtB,YAAY,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACtE,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,gBAAgB,EACjB,MAAM,iBAAiB,CAAA;AACxB,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EACL,eAAe,EACf,yBAAyB,EAC1B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,sBAAsB,CAAA;AAC7B,YAAY,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AACrE,OAAO,EACL,8BAA8B,EAC9B,oCAAoC,EACpC,0BAA0B,EAC1B,8BAA8B,EAC9B,yBAAyB,EAC1B,MAAM,iCAAiC,CAAA;AACxC,YAAY,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAA;AAC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0BAA0B,EAC1B,8BAA8B,EAC9B,yBAAyB,EACzB,cAAc,EACd,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,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,EACjB,MAAM,WAAW,CAAA;AAClB,YAAY,EACV,qBAAqB,EACrB,OAAO,EACP,kBAAkB,EAClB,yBAAyB,EACzB,0BAA0B,EAC1B,iBAAiB,EACjB,WAAW,EACX,SAAS,EACT,YAAY,EACb,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AAChE,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,cAAc,CAAA;AACrB,YAAY,EACV,yBAAyB,EACzB,0BAA0B,EAC3B,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AACtD,OAAO,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAA"}
package/dist/edv/index.js CHANGED
@@ -7,6 +7,15 @@
7
7
  * do not pull the `@interop/edv-client` / `@interop/minimal-cipher` crypto graph
8
8
  * unless they opt in by importing this subpath.
9
9
  *
10
+ * This is the full encrypted surface, online and offline. It re-exports
11
+ * `@interop/was-client/edv/core` -- the codec, the doc ciphers, the key
12
+ * epochs, the recipient operations, `resourceDescriptorStore`, the log-governed
13
+ * descriptor stores and the blinding keys, none of which need a server -- and
14
+ * adds the modules that do talk to one, `collectionDescriptorStore` among
15
+ * them. A consumer working offline imports `./edv/core` instead and keeps every
16
+ * transport module out of its graph; everything this entry exported before
17
+ * that entry existed still resolves from here.
18
+ *
10
19
  * Two integration levels:
11
20
  *
12
21
  * - `createEdvEncryption` -- the EDV keystore for the handle seam. Pass its
@@ -17,45 +26,9 @@
17
26
  * - `WasTransport` -- the standalone `@interop/edv-client`
18
27
  * transport, for driving an `EdvClient` directly against WAS.
19
28
  *
20
- * Every encrypted collection carries a key-epoch roster from birth:
21
- * `ensureFirstEpoch` installs epoch[0] at provision time (create-if-absent;
22
- * the crypto-free `ensureSpaceAndCollection` only ensures the container), and
23
- * `initRecipients` / `addRecipient` / `removeRecipient` manage the readers and
24
- * rotate the epoch key, so the same `createEdvEncryption` provider
25
- * transparently encrypts each write under the current epoch and decrypts any
26
- * epoch a reader still holds.
27
- * They mutate the descriptor through the descriptor-store seam: the Collection
28
- * Description by default, or any `EncryptionDescriptorStore` -- e.g.
29
- * `resourceDescriptorStore` for a descriptor hosted as a plain JSON Resource.
30
- *
31
- * A collection provisioned with `ensureFirstEpoch({ blindedIndex: true })` also
32
- * carries a blinded-index HMAC key, distributed to recipients exactly like an
33
- * epoch key (see `hmacKey.ts`). It is installed at provisioning or never, and
34
- * never rotates.
35
- *
36
- * `hasKeyEpochs` and `epochRostersEqual` are the crypto-free predicates over a
37
- * descriptor: whether it carries a usable roster, and whether two descriptors
38
- * carry the same epoch configuration (`scheme`, `version`, `currentEpoch`, and
39
- * the ordered epoch ids; recipients and the `hmac` member deliberately
40
- * excluded).
41
- *
42
- * `x25519RecipientFromDidKey` is the one rule for turning a grantee named only
43
- * by its Ed25519 `did:key` controller into a `RecipientPublicKey`, so a
44
- * recipient key is always derived from an identifier both sides already hold
45
- * rather than transmitted.
46
- *
47
- * A decrypt that finds no key raises one of two classes, and a caller scanning
48
- * rows must tell them apart: `UnknownEpochError` when the envelope's epoch is
49
- * not on the descriptor the reader holds (a re-read may fix it) and
50
- * `KeyUnwrapError` when the epoch IS listed but this reader has no key for it
51
- * (never a recipient, or removed and the epoch rotated since -- re-reading
52
- * cannot help). Both ship from this subpath beside the cipher that raises
53
- * them, so a consumer classifying what a cipher threw need not reach for the
54
- * package root. Both assign their `name` explicitly, and a consumer whose
55
- * cipher arrives through an injected seam matches on that name rather than
56
- * `instanceof`, since the seam may resolve to a second copy of this package:
57
- * `isKeyUnwrapError` here, and `isUnknownEpochError` on `./sync`, are those
58
- * matchers.
29
+ * `collectionDescriptorStore` is the `EncryptionDescriptorStore` over a live
30
+ * `Collection` handle's Collection Description, the default the recipient
31
+ * operations use when a caller names a collection rather than a store.
59
32
  *
60
33
  * Which epoch a collection encrypts under, and when to ask again, is the
61
34
  * descriptor acquisition and refresh policy every consumer running an
@@ -83,20 +56,16 @@
83
56
  * re-reads the description, swaps itself, and retries exactly once per
84
57
  * instance.
85
58
  */
86
- export { createEdvEncryption, EdvCodec, wasTransportFactory } from './EdvCodec.js';
59
+ // The offline half, named one export at a time rather than with `export *`.
60
+ // This entry is the one every online consumer imports, so its surface is
61
+ // stated here: an export added to `core.ts` widens `./edv/core` only, and
62
+ // widening `./edv` takes an edit to this list.
63
+ export { EdvCodec, EDV_SCHEME_VERSION, JOSE_CONTENT_TYPE, ensureFirstEpoch, initRecipients, addRecipient, removeRecipient, replaceRecipient, isEd25519DidKey, x25519RecipientFromDidKey, resourceDescriptorStore, EPOCH_CONFIGURATION_STATE_TYPE, logGovernedCollectionDescriptorStore, logGovernedDescriptorStore, readGovernedEpochConfiguration, toEpochConfigurationState, didKeyResolver, mintEpoch, epochKeyIdFor, unwrapEpochSecret, wrapEpochSecret, hasKeyEpochs, epochRostersEqual, resolveEpochKeys, HMAC_KEY_TYPE, mintHmacKey, hmacKeyFromSecret, resolveHmacKey, createEdvDocCipher, createEdvEncryptOnlyDocCipher, ownerRecipient, EncryptOnlyCipherError, KeyUnwrapError, UnknownEpochError, isEncryptedEnvelope, isKeyUnwrapError } from './core.js';
64
+ export { createEdvEncryption } from './encryption.js';
65
+ export { wasTransportFactory } from './transportFactory.js';
87
66
  export { WasTransport } from './WasTransport.js';
88
- export { EDV_SCHEME_VERSION, JOSE_CONTENT_TYPE } from './constants.js';
89
- export { ensureFirstEpoch, initRecipients, addRecipient, removeRecipient, replaceRecipient } from './recipients.js';
90
- export { isEd25519DidKey, x25519RecipientFromDidKey } from './didKeyRecipient.js';
91
- export { collectionDescriptorStore, resourceDescriptorStore } from './descriptorStore.js';
92
- export { EPOCH_CONFIGURATION_STATE_TYPE, logGovernedCollectionDescriptorStore, logGovernedDescriptorStore, readGovernedEpochConfiguration, toEpochConfigurationState } from './logGovernedDescriptorStore.js';
93
- export { mintEpoch, epochKeyIdFor, unwrapEpochSecret, wrapEpochSecret } from './epochCrypto.js';
94
- export { hasKeyEpochs, epochRostersEqual } from './epochRoster.js';
95
- export { resolveEpochKeys } from './epochKeys.js';
96
- export { HMAC_KEY_TYPE, mintHmacKey, hmacKeyFromSecret, resolveHmacKey } from './hmacKey.js';
97
- export { createEdvDocCipher, createEdvEncryptOnlyDocCipher, ownerRecipient, EncryptOnlyCipherError, KeyUnwrapError, UnknownEpochError, isEncryptedEnvelope } from './docCipher.js';
67
+ export { collectionDescriptorStore } from './descriptorStore.js';
98
68
  export { acquireDescriptor, acquireDescriptors, wasDescriptorSource } from './acquire.js';
99
69
  export { DescriptorRefreshPolicy } from './refresh.js';
100
70
  export { createRefreshingEdvDocCipher } from './refreshingDocCipher.js';
101
- export { isKeyUnwrapError } from '../sync/predicates.js';
102
71
  //# sourceMappingURL=index.js.map