@interop/was-client 0.26.0 → 0.27.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/dist/Collection.d.ts.map +1 -1
  2. package/dist/Collection.js +27 -66
  3. package/dist/Collection.js.map +1 -1
  4. package/dist/Resource.d.ts.map +1 -1
  5. package/dist/Resource.js +28 -6
  6. package/dist/Resource.js.map +1 -1
  7. package/dist/Space.d.ts.map +1 -1
  8. package/dist/Space.js +10 -25
  9. package/dist/Space.js.map +1 -1
  10. package/dist/WasClient.d.ts.map +1 -1
  11. package/dist/WasClient.js +9 -19
  12. package/dist/WasClient.js.map +1 -1
  13. package/dist/codec.d.ts +31 -5
  14. package/dist/codec.d.ts.map +1 -1
  15. package/dist/edv/EdvCodec.d.ts +9 -14
  16. package/dist/edv/EdvCodec.d.ts.map +1 -1
  17. package/dist/edv/EdvCodec.js +147 -71
  18. package/dist/edv/EdvCodec.js.map +1 -1
  19. package/dist/edv/WasTransport.d.ts +1 -2
  20. package/dist/edv/WasTransport.d.ts.map +1 -1
  21. package/dist/edv/WasTransport.js +19 -28
  22. package/dist/edv/WasTransport.js.map +1 -1
  23. package/dist/edv/constants.d.ts +11 -0
  24. package/dist/edv/constants.d.ts.map +1 -1
  25. package/dist/edv/constants.js +16 -4
  26. package/dist/edv/constants.js.map +1 -1
  27. package/dist/edv/docCipher.d.ts +10 -26
  28. package/dist/edv/docCipher.d.ts.map +1 -1
  29. package/dist/edv/docCipher.js +62 -135
  30. package/dist/edv/docCipher.js.map +1 -1
  31. package/dist/edv/epochCrypto.d.ts +0 -4
  32. package/dist/edv/epochCrypto.d.ts.map +1 -1
  33. package/dist/edv/epochCrypto.js +4 -4
  34. package/dist/edv/epochCrypto.js.map +1 -1
  35. package/dist/edv/epochKeys.d.ts.map +1 -1
  36. package/dist/edv/epochKeys.js +2 -4
  37. package/dist/edv/epochKeys.js.map +1 -1
  38. package/dist/edv/epochMac.d.ts +24 -1
  39. package/dist/edv/epochMac.d.ts.map +1 -1
  40. package/dist/edv/epochMac.js +43 -13
  41. package/dist/edv/epochMac.js.map +1 -1
  42. package/dist/edv/index.d.ts +6 -4
  43. package/dist/edv/index.d.ts.map +1 -1
  44. package/dist/edv/index.js +4 -3
  45. package/dist/edv/index.js.map +1 -1
  46. package/dist/edv/recipients.d.ts +29 -17
  47. package/dist/edv/recipients.d.ts.map +1 -1
  48. package/dist/edv/recipients.js +177 -112
  49. package/dist/edv/recipients.js.map +1 -1
  50. package/dist/errors.d.ts +29 -12
  51. package/dist/errors.d.ts.map +1 -1
  52. package/dist/errors.js +37 -65
  53. package/dist/errors.js.map +1 -1
  54. package/dist/index.d.ts +2 -2
  55. package/dist/index.d.ts.map +1 -1
  56. package/dist/internal/codec.d.ts +15 -12
  57. package/dist/internal/codec.d.ts.map +1 -1
  58. package/dist/internal/codec.js +4 -6
  59. package/dist/internal/codec.js.map +1 -1
  60. package/dist/internal/conditional.d.ts +9 -4
  61. package/dist/internal/conditional.d.ts.map +1 -1
  62. package/dist/internal/conditional.js +9 -2
  63. package/dist/internal/conditional.js.map +1 -1
  64. package/dist/internal/content.d.ts +28 -24
  65. package/dist/internal/content.d.ts.map +1 -1
  66. package/dist/internal/content.js +28 -13
  67. package/dist/internal/content.js.map +1 -1
  68. package/dist/internal/describe.d.ts +15 -2
  69. package/dist/internal/describe.d.ts.map +1 -1
  70. package/dist/internal/describe.js +17 -0
  71. package/dist/internal/describe.js.map +1 -1
  72. package/dist/internal/pagination.d.ts +20 -1
  73. package/dist/internal/pagination.d.ts.map +1 -1
  74. package/dist/internal/pagination.js +22 -0
  75. package/dist/internal/pagination.js.map +1 -1
  76. package/dist/internal/paths.d.ts +0 -11
  77. package/dist/internal/paths.d.ts.map +1 -1
  78. package/dist/internal/paths.js +20 -33
  79. package/dist/internal/paths.js.map +1 -1
  80. package/dist/internal/policy.d.ts.map +1 -1
  81. package/dist/internal/policy.js +2 -9
  82. package/dist/internal/policy.js.map +1 -1
  83. package/dist/internal/write.d.ts +50 -4
  84. package/dist/internal/write.d.ts.map +1 -1
  85. package/dist/internal/write.js +45 -0
  86. package/dist/internal/write.js.map +1 -1
  87. package/dist/sync/cid.d.ts.map +1 -1
  88. package/dist/sync/cid.js +8 -2
  89. package/dist/sync/cid.js.map +1 -1
  90. package/dist/sync/port.d.ts +9 -8
  91. package/dist/sync/port.d.ts.map +1 -1
  92. package/dist/sync/port.js +74 -70
  93. package/dist/sync/port.js.map +1 -1
  94. package/dist/sync/provisioning.d.ts +4 -1
  95. package/dist/sync/provisioning.d.ts.map +1 -1
  96. package/dist/sync/provisioning.js +11 -2
  97. package/dist/sync/provisioning.js.map +1 -1
  98. package/dist/sync/types.d.ts +7 -10
  99. package/dist/sync/types.d.ts.map +1 -1
  100. package/dist/types.d.ts +1 -1
  101. package/dist/types.d.ts.map +1 -1
  102. package/package.json +14 -14
@@ -39,10 +39,8 @@ export async function resolveEpochKeys({ encryption, keyAgreementKey }) {
39
39
  // server rejects via its revoked zcap anyway; selecting a deterministic
40
40
  // fallback here only keeps the local `writeEpoch`/`writeKey` well-defined
41
41
  // instead of assuming the `epochs` array is append-ordered newest-last.
42
- const currentEpoch = encryption.currentEpoch;
43
- const writeEpochEntry = (currentEpoch !== undefined &&
44
- namedEpochs.find(epoch => epoch.id === currentEpoch)) ||
45
- namedEpochs[namedEpochs.length - 1];
42
+ const writeEpochEntry = namedEpochs.find(epoch => epoch.id === encryption.currentEpoch) ??
43
+ namedEpochs.at(-1);
46
44
  // The write epoch is unwrapped eagerly: `writeKey` must be a full key pair the
47
45
  // EDV cipher can name recipients with and encrypt under right away. Its raw
48
46
  // secret is surfaced alongside so the epoch-configuration MAC can be verified.
@@ -1 +1 @@
1
- {"version":3,"file":"epochKeys.js","sourceRoot":"","sources":["../../src/edv/epochKeys.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAK7D,OAAO,EACL,aAA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AC,CAAA;IACD,OAAO;QACL,EAAE,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,KAAK,CAAC,YAAY,CAAC,OAA+B;YAChD,MAAM,GAAG,GAAG,MAAM,OAAO,EAAE,CAAA;YAC3B,OAAO,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;QAClC,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -1,4 +1,27 @@
1
- import type { CollectionEncryption, CollectionEncryptionEpochsMac } from '../types.js';
1
+ import type { CollectionEncryption, CollectionEncryptionEpochsMac, CollectionEncryptionEpochsSig } from '../types.js';
2
+ /**
3
+ * A caller-supplied signer for the `epochsSig` member: given the canonical
4
+ * signature payload bytes ({@link epochsSigPayload} over the descriptor being
5
+ * written), it returns the full signature member to stamp. The signing key --
6
+ * and the root of trust the reader resolves its `kid` against -- are entirely
7
+ * the caller's; this module only defines the payload and where the result
8
+ * lands.
9
+ */
10
+ export type EpochsSigner = (options: {
11
+ payload: Uint8Array;
12
+ }) => Promise<CollectionEncryptionEpochsSig>;
13
+ /**
14
+ * Builds the payload bytes an `epochsSig` signs: `UTF8(
15
+ * "was-epoch-config-sig/v1." + epochsConfigJson(descriptor))` -- the same
16
+ * epoch configuration the MAC covers, under its own domain-separation prefix.
17
+ * Exported so a signing caller and a verifying reader construct
18
+ * byte-identical input from the descriptor alone.
19
+ *
20
+ * @param descriptor {CollectionEncryption} the descriptor whose epoch
21
+ * configuration is being signed or verified
22
+ * @returns {Uint8Array}
23
+ */
24
+ export declare function epochsSigPayload(descriptor: CollectionEncryption): Uint8Array;
2
25
  /**
3
26
  * Computes the `epochsMac` field for a descriptor under the current epoch's
4
27
  * secret. Compute this over the exact descriptor state being written (member
@@ -1 +1 @@
1
- {"version":3,"file":"epochMac.d.ts","sourceRoot":"","sources":["../../src/edv/epochMac.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EACV,oBAAoB,EACpB,6BAA6B,EAC9B,MAAM,aAAa,CAAA;AAwEpB;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,UAAU,EACV,WAAW,EACZ,EAAE;IACD,UAAU,EAAE,oBAAoB,CAAA;IAChC,WAAW,EAAE,UAAU,CAAA;CACxB,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAYzC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,eAAe,CAAC,EACpC,UAAU,EACV,WAAW,EACZ,EAAE;IACD,UAAU,EAAE,oBAAoB,CAAA;IAChC,WAAW,EAAE,UAAU,CAAA;CACxB,GAAG,OAAO,CAAC,OAAO,CAAC,CAkBnB"}
1
+ {"version":3,"file":"epochMac.d.ts","sourceRoot":"","sources":["../../src/edv/epochMac.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EACV,oBAAoB,EACpB,6BAA6B,EAC7B,6BAA6B,EAC9B,MAAM,aAAa,CAAA;AAmBpB;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE;IACnC,OAAO,EAAE,UAAU,CAAA;CACpB,KAAK,OAAO,CAAC,6BAA6B,CAAC,CAAA;AAuE5C;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,oBAAoB,GAAG,UAAU,CAE7E;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,UAAU,EACV,WAAW,EACZ,EAAE;IACD,UAAU,EAAE,oBAAoB,CAAA;IAChC,WAAW,EAAE,UAAU,CAAA;CACxB,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAYzC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,eAAe,CAAC,EACpC,UAAU,EACV,WAAW,EACZ,EAAE;IACD,UAAU,EAAE,oBAAoB,CAAA;IAChC,WAAW,EAAE,UAAU,CAAA;CACxB,GAAG,OAAO,CAAC,OAAO,CAAC,CAkBnB"}
@@ -20,15 +20,21 @@
20
20
  * out of scope here.
21
21
  */
22
22
  import { base64urlnopad } from '@scure/base';
23
- const TEXT_ENCODER = new TextEncoder();
23
+ import { ENCODER } from '../internal/content.js';
24
24
  /**
25
25
  * The HKDF `info` string binding the derived key to this MAC construction.
26
26
  */
27
- const MAC_KEY_INFO = TEXT_ENCODER.encode('was-epoch-config-mac/v1');
27
+ const MAC_KEY_INFO = ENCODER.encode('was-epoch-config-mac/v1');
28
28
  /**
29
29
  * The domain-separation prefix prepended to the JSON payload before it is MACed.
30
30
  */
31
31
  const MAC_PAYLOAD_PREFIX = 'was-epoch-config/v1.';
32
+ /**
33
+ * The domain-separation prefix of the detached `epochsSig` signature payload --
34
+ * distinct from the MAC prefix so a signature can never be replayed as a MAC
35
+ * input or vice versa.
36
+ */
37
+ const SIG_PAYLOAD_PREFIX = 'was-epoch-config-sig/v1.';
32
38
  /**
33
39
  * Derives the HMAC-SHA256 key from a 32-byte epoch secret:
34
40
  * HKDF-SHA256(ikm = the epoch secret, salt = empty, info =
@@ -48,26 +54,50 @@ async function deriveMacKey(epochSecret) {
48
54
  }, ikm, { name: 'HMAC', hash: 'SHA-256', length: 256 }, false, ['sign', 'verify']);
49
55
  }
50
56
  /**
51
- * Builds the MACed payload bytes for a descriptor's epoch configuration:
52
- * `UTF8("was-epoch-config/v1." + JSON.stringify({ scheme, version,
53
- * currentEpoch, epochs }))`, with `version` normalized to `null` when absent
54
- * and `epochs` the ordered list of epoch id strings. The object member order is
57
+ * The canonical JSON text of a descriptor's epoch configuration -- the part
58
+ * both the MAC and the detached signature cover: `{ scheme, version,
59
+ * currentEpoch, epochs }`, with `version` normalized to `null` when absent and
60
+ * `epochs` the ordered list of epoch id strings. The object member order is
55
61
  * fixed so both sides serialize identically.
56
62
  *
57
- * @param descriptor {CollectionEncryption} the descriptor whose epoch configuration is
58
- * being authenticated
59
- * @returns {Uint8Array}
63
+ * @param descriptor {CollectionEncryption} the descriptor whose epoch
64
+ * configuration is being authenticated
65
+ * @returns {string}
60
66
  */
61
- function macPayload(descriptor) {
62
- const payload = {
67
+ function epochsConfigJson(descriptor) {
68
+ return JSON.stringify({
63
69
  scheme: descriptor.scheme,
64
70
  version: descriptor.version ?? null,
65
71
  currentEpoch: descriptor.currentEpoch,
66
72
  epochs: (descriptor.epochs ?? []).map(epoch => epoch.id)
67
- };
68
- const bytes = TEXT_ENCODER.encode(MAC_PAYLOAD_PREFIX + JSON.stringify(payload));
73
+ });
74
+ }
75
+ /**
76
+ * Builds the MACed payload bytes for a descriptor's epoch configuration:
77
+ * `UTF8("was-epoch-config/v1." + epochsConfigJson(descriptor))`.
78
+ *
79
+ * @param descriptor {CollectionEncryption} the descriptor whose epoch configuration is
80
+ * being authenticated
81
+ * @returns {ArrayBuffer}
82
+ */
83
+ function macPayload(descriptor) {
84
+ const bytes = ENCODER.encode(MAC_PAYLOAD_PREFIX + epochsConfigJson(descriptor));
69
85
  return bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
70
86
  }
87
+ /**
88
+ * Builds the payload bytes an `epochsSig` signs: `UTF8(
89
+ * "was-epoch-config-sig/v1." + epochsConfigJson(descriptor))` -- the same
90
+ * epoch configuration the MAC covers, under its own domain-separation prefix.
91
+ * Exported so a signing caller and a verifying reader construct
92
+ * byte-identical input from the descriptor alone.
93
+ *
94
+ * @param descriptor {CollectionEncryption} the descriptor whose epoch
95
+ * configuration is being signed or verified
96
+ * @returns {Uint8Array}
97
+ */
98
+ export function epochsSigPayload(descriptor) {
99
+ return ENCODER.encode(SIG_PAYLOAD_PREFIX + epochsConfigJson(descriptor));
100
+ }
71
101
  /**
72
102
  * Computes the `epochsMac` field for a descriptor under the current epoch's
73
103
  * secret. Compute this over the exact descriptor state being written (member
@@ -1 +1 @@
1
- {"version":3,"file":"epochMac.js","sourceRoot":"","sources":["../../src/edv/epochMac.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAM5C,MAAM,YAAY,GAAG,IAAI,WA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AC,CAAA;IAC3C,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CACzB,MAAM,EACN,GAAG,EACH,GAA6B,EAC7B,UAAU,CAAC,UAAU,CAAC,CACvB,CAAA;AACH,CAAC"}
@@ -32,14 +32,16 @@
32
32
  */
33
33
  export { createEdvEncryption, EdvCodec } from './EdvCodec.js';
34
34
  export type { EdvKeys } from './EdvCodec.js';
35
- export { WasTransport, JOSE_CONTENT_TYPE } from './WasTransport.js';
35
+ export { WasTransport } from './WasTransport.js';
36
+ export { EDV_SCHEME_VERSION, JOSE_CONTENT_TYPE } from './constants.js';
36
37
  export { initRecipients, addRecipient, removeRecipient, replaceRecipient } from './recipients.js';
37
- export type { OwnerKey, RecipientPublicKey } from './recipients.js';
38
+ export type { RecipientPublicKey } from './recipients.js';
38
39
  export { isEd25519DidKey, x25519RecipientFromDidKey } from './didKeyRecipient.js';
39
40
  export { collectionDescriptorStore, resourceDescriptorStore } from './descriptorStore.js';
40
41
  export type { EncryptionDescriptorStore } from './descriptorStore.js';
41
- export { mintEpoch, epochKeyIdFor, unwrapEpochSecret } from './epochCrypto.js';
42
- export { verifyEpochsMac } from './epochMac.js';
42
+ export { mintEpoch, epochKeyIdFor, unwrapEpochSecret, wrapEpochSecret } from './epochCrypto.js';
43
+ export { computeEpochsMac, epochsSigPayload, verifyEpochsMac } from './epochMac.js';
44
+ export type { EpochsSigner } from './epochMac.js';
43
45
  export { resolveEpochKeys } from './epochKeys.js';
44
46
  export type { ResolvedEpochKeys } from './epochKeys.js';
45
47
  export { createEdvDocCipher, ownerRecipient, UnknownEpochError, isEncryptedEnvelope } from './docCipher.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/edv/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC7D,YAAY,EAA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ACjB,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,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,eAAe,EAChB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EAChB,MAAM,eAAe,CAAA;AACtB,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACjD,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,gBAAgB,CAAA;AACvB,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA"}
package/dist/edv/index.js CHANGED
@@ -31,12 +31,13 @@
31
31
  * rather than transmitted.
32
32
  */
33
33
  export { createEdvEncryption, EdvCodec } from './EdvCodec.js';
34
- export { WasTransport, JOSE_CONTENT_TYPE } from './WasTransport.js';
34
+ export { WasTransport } from './WasTransport.js';
35
+ export { EDV_SCHEME_VERSION, JOSE_CONTENT_TYPE } from './constants.js';
35
36
  export { initRecipients, addRecipient, removeRecipient, replaceRecipient } from './recipients.js';
36
37
  export { isEd25519DidKey, x25519RecipientFromDidKey } from './didKeyRecipient.js';
37
38
  export { collectionDescriptorStore, resourceDescriptorStore } from './descriptorStore.js';
38
- export { mintEpoch, epochKeyIdFor, unwrapEpochSecret } from './epochCrypto.js';
39
- export { verifyEpochsMac } from './epochMac.js';
39
+ export { mintEpoch, epochKeyIdFor, unwrapEpochSecret, wrapEpochSecret } from './epochCrypto.js';
40
+ export { computeEpochsMac, epochsSigPayload, verifyEpochsMac } from './epochMac.js';
40
41
  export { resolveEpochKeys } from './epochKeys.js';
41
42
  export { createEdvDocCipher, ownerRecipient, UnknownEpochError, isEncryptedEnvelope } from './docCipher.js';
42
43
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/edv/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAE7D,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACnE,OAAO,EACL,cAAc,EACd,YAAY,EACZ,eAAe,EACf,gBAAgB,EACjB,MAAM,iBAAiB,CAAA;AAExB,OAAO,EACL,eAAe,EACf,yBAAyB,EAC1B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEjD,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/edv/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAE7D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACtE,OAAO,EACL,cAAc,EACd,YAAY,EACZ,eAAe,EACf,gBAAgB,EACjB,MAAM,iBAAiB,CAAA;AAExB,OAAO,EACL,eAAe,EACf,yBAAyB,EAC1B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EACL,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,eAAe,EAChB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EAChB,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEjD,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,gBAAgB,CAAA"}
@@ -35,15 +35,9 @@ import type { Collection } from '../Collection.js';
35
35
  import type { Space } from '../Space.js';
36
36
  import type { EncryptionDescriptorStore } from './descriptorStore.js';
37
37
  import type { CollectionEncryption, IDelegatedZcap } from '../types.js';
38
+ import type { EpochsSigner } from './epochMac.js';
38
39
  import type { RecipientPublicKey } from './epochCrypto.js';
39
40
  export type { RecipientPublicKey } from './epochCrypto.js';
40
- /**
41
- * The caller's own key material, used to unwrap existing epoch keys so they can
42
- * be re-wrapped to a newly added reader (escrow).
43
- */
44
- export interface OwnerKey {
45
- keyAgreementKey: IKeyAgreementKey;
46
- }
47
41
  /**
48
42
  * Initializes the first key epoch on a descriptor that has no epochs yet: mints
49
43
  * a fresh epoch key, wraps it to each initial recipient, and writes `epochs:
@@ -70,9 +64,12 @@ export interface OwnerKey {
70
64
  * whose epoch key already exists (e.g. a per-user key being enrolled into
71
65
  * its wrap-set roster). The `epochId` must be the key's did:key and `secret`
72
66
  * its raw 32-byte private key, exactly what {@link mintEpoch} returns.
67
+ * @param [options.signEpochs] {EpochsSigner} signs the epoch configuration
68
+ * being written, stamping the descriptor's `epochsSig` beside its
69
+ * `epochsMac`
73
70
  * @returns {Promise<CollectionEncryption>} the new descriptor
74
71
  */
75
- export declare function initRecipients({ collection, store, recipients, epoch: premintedEpoch }: {
72
+ export declare function initRecipients({ collection, store, recipients, epoch: premintedEpoch, signEpochs }: {
76
73
  collection?: Collection;
77
74
  store?: EncryptionDescriptorStore;
78
75
  recipients: RecipientPublicKey[];
@@ -80,6 +77,7 @@ export declare function initRecipients({ collection, store, recipients, epoch: p
80
77
  epochId: string;
81
78
  secret: Uint8Array;
82
79
  };
80
+ signEpochs?: EpochsSigner;
83
81
  }): Promise<CollectionEncryption>;
84
82
  /**
85
83
  * Adds a reader to a multi-recipient encrypted Collection. Escrow semantics: the
@@ -96,15 +94,18 @@ export declare function initRecipients({ collection, store, recipients, epoch: p
96
94
  * hosts the descriptor; exactly one of `collection` / `store`
97
95
  * @param [options.store] {EncryptionDescriptorStore} an explicit descriptor store
98
96
  * @param options.recipient {RecipientPublicKey} the new reader's public KAK
99
- * @param options.owner {OwnerKey} the caller's own key-agreement key, to
100
- * unwrap each epoch key for re-wrapping to the new reader
97
+ * @param options.owner {object} the caller's own key material
98
+ * @param options.owner.keyAgreementKey {IKeyAgreementKey} unwraps each epoch
99
+ * key for re-wrapping to the new reader
101
100
  * @returns {Promise<CollectionEncryption>} the new descriptor
102
101
  */
103
102
  export declare function addRecipient({ collection, store, recipient, owner }: {
104
103
  collection?: Collection;
105
104
  store?: EncryptionDescriptorStore;
106
105
  recipient: RecipientPublicKey;
107
- owner: OwnerKey;
106
+ owner: {
107
+ keyAgreementKey: IKeyAgreementKey;
108
+ };
108
109
  }): Promise<CollectionEncryption>;
109
110
  /**
110
111
  * Removes a reader from a multi-recipient encrypted Collection -- one
@@ -159,9 +160,12 @@ export declare function addRecipient({ collection, store, recipient, owner }: {
159
160
  * self-describing `did:key`. May resolve `null` to signal drop-this-kid:
160
161
  * the rotation then excludes that entry from the fresh epoch instead of
161
162
  * throwing (subject to the no-recipients-remaining guard).
163
+ * @param [options.signEpochs] {EpochsSigner} signs the rotated epoch
164
+ * configuration, stamping the descriptor's `epochsSig` beside its
165
+ * `epochsMac`
162
166
  * @returns {Promise<CollectionEncryption>} the new descriptor
163
167
  */
164
- export declare function removeRecipient({ collection, store, space, recipientId, revoke, pull, resolveRecipientKey }: {
168
+ export declare function removeRecipient({ collection, store, space, recipientId, revoke, pull, resolveRecipientKey, signEpochs }: {
165
169
  collection?: Collection;
166
170
  store?: EncryptionDescriptorStore;
167
171
  space?: Space;
@@ -169,6 +173,7 @@ export declare function removeRecipient({ collection, store, space, recipientId,
169
173
  revoke?: IDelegatedZcap | IDelegatedZcap[];
170
174
  pull?: () => Promise<void>;
171
175
  resolveRecipientKey?: (kid: string) => Promise<RecipientPublicKey | null>;
176
+ signEpochs?: EpochsSigner;
172
177
  }): Promise<CollectionEncryption>;
173
178
  /**
174
179
  * Replaces one reader (or several) with another in ONE descriptor write -- the
@@ -207,9 +212,10 @@ export declare function removeRecipient({ collection, store, space, recipientId,
207
212
  * dropped from the fresh epoch's roster
208
213
  * @param options.recipient {RecipientPublicKey} the incoming reader's public
209
214
  * key-agreement key, escrowed into every epoch and wrapped into the fresh one
210
- * @param options.owner {OwnerKey} the caller's own key-agreement key,
211
- * unwrapping each epoch key for the escrow -- it must be a recipient of
212
- * every epoch (a retiring key that was escrowed everywhere qualifies)
215
+ * @param options.owner {object} the caller's own key material
216
+ * @param options.owner.keyAgreementKey {IKeyAgreementKey} unwraps each epoch
217
+ * key for the escrow -- it must be a recipient of every epoch (a retiring
218
+ * key that was escrowed everywhere qualifies)
213
219
  * @param [options.revoke] {IDelegatedZcap | IDelegatedZcap[]} the default
214
220
  * pull axis, with `space`
215
221
  * @param [options.pull] {function} a caller-supplied pull action; mutually
@@ -218,17 +224,23 @@ export declare function removeRecipient({ collection, store, space, recipientId,
218
224
  * recipient's kid for the fresh epoch, `null` to drop it -- the
219
225
  * {@link removeRecipient} contract (the incoming recipient never routes
220
226
  * through it)
227
+ * @param [options.signEpochs] {EpochsSigner} signs the rotated epoch
228
+ * configuration, stamping the descriptor's `epochsSig` beside its
229
+ * `epochsMac` (an escrow-only write leaves both untouched)
221
230
  * @returns {Promise<CollectionEncryption>} the new descriptor
222
231
  */
223
- export declare function replaceRecipient({ collection, store, space, retire, recipient, owner, revoke, pull, resolveRecipientKey }: {
232
+ export declare function replaceRecipient({ collection, store, space, retire, recipient, owner, revoke, pull, resolveRecipientKey, signEpochs }: {
224
233
  collection?: Collection;
225
234
  store?: EncryptionDescriptorStore;
226
235
  space?: Space;
227
236
  retire: string | string[];
228
237
  recipient: RecipientPublicKey;
229
- owner: OwnerKey;
238
+ owner: {
239
+ keyAgreementKey: IKeyAgreementKey;
240
+ };
230
241
  revoke?: IDelegatedZcap | IDelegatedZcap[];
231
242
  pull?: () => Promise<void>;
232
243
  resolveRecipientKey?: (kid: string) => Promise<RecipientPublicKey | null>;
244
+ signEpochs?: EpochsSigner;
233
245
  }): Promise<CollectionEncryption>;
234
246
  //# sourceMappingURL=recipients.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"recipients.d.ts","sourceRoot":"","sources":["../../src/edv/recipients.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAGxC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AACrE,OAAO,KAAK,EACV,oBAAoB,EAEpB,cAAc,EACf,MAAM,aAAa,CAAA;AAQpB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAE1D,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAE1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