@enbox/dwn-sdk-js 0.4.4 → 0.4.6

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 (201) hide show
  1. package/dist/browser.mjs +15 -15
  2. package/dist/browser.mjs.map +4 -4
  3. package/dist/esm/generated/precompiled-validators.js +5406 -2391
  4. package/dist/esm/generated/precompiled-validators.js.map +1 -1
  5. package/dist/esm/json-schemas/definitions.json +18 -0
  6. package/dist/esm/src/core/constants.js +3 -3
  7. package/dist/esm/src/core/constants.js.map +1 -1
  8. package/dist/esm/src/core/dwn-error.js +29 -1
  9. package/dist/esm/src/core/dwn-error.js.map +1 -1
  10. package/dist/esm/src/core/messages-grant-authorization.js +20 -0
  11. package/dist/esm/src/core/messages-grant-authorization.js.map +1 -1
  12. package/dist/esm/src/core/protocol-authorization-validation.js +80 -3
  13. package/dist/esm/src/core/protocol-authorization-validation.js.map +1 -1
  14. package/dist/esm/src/core/recording-validation-state-reader.js +5 -0
  15. package/dist/esm/src/core/recording-validation-state-reader.js.map +1 -1
  16. package/dist/esm/src/core/replication-apply.js +163 -7
  17. package/dist/esm/src/core/replication-apply.js.map +1 -1
  18. package/dist/esm/src/core/validation-state-reader.js +20 -0
  19. package/dist/esm/src/core/validation-state-reader.js.map +1 -1
  20. package/dist/esm/src/dwn.js +19 -2
  21. package/dist/esm/src/dwn.js.map +1 -1
  22. package/dist/esm/src/handlers/messages-query.js +3 -5
  23. package/dist/esm/src/handlers/messages-query.js.map +1 -1
  24. package/dist/esm/src/handlers/protocols-configure.js +10 -4
  25. package/dist/esm/src/handlers/protocols-configure.js.map +1 -1
  26. package/dist/esm/src/handlers/records-write.js +1 -1
  27. package/dist/esm/src/handlers/records-write.js.map +1 -1
  28. package/dist/esm/src/index.js +2 -1
  29. package/dist/esm/src/index.js.map +1 -1
  30. package/dist/esm/src/interfaces/protocols-configure.js +23 -10
  31. package/dist/esm/src/interfaces/protocols-configure.js.map +1 -1
  32. package/dist/esm/src/interfaces/records-write-signing.js +2 -8
  33. package/dist/esm/src/interfaces/records-write-signing.js.map +1 -1
  34. package/dist/esm/src/interfaces/records-write.js +43 -65
  35. package/dist/esm/src/interfaces/records-write.js.map +1 -1
  36. package/dist/esm/src/protocols/encryption.js +411 -0
  37. package/dist/esm/src/protocols/encryption.js.map +1 -0
  38. package/dist/esm/src/protocols/permission-grant.js +0 -5
  39. package/dist/esm/src/protocols/permission-grant.js.map +1 -1
  40. package/dist/esm/src/types/message-types.js.map +1 -1
  41. package/dist/esm/src/types/permission-types.js.map +1 -1
  42. package/dist/esm/src/types/protocols-types.js.map +1 -1
  43. package/dist/esm/src/utils/encryption.js +156 -188
  44. package/dist/esm/src/utils/encryption.js.map +1 -1
  45. package/dist/esm/src/utils/hd-key.js +0 -1
  46. package/dist/esm/src/utils/hd-key.js.map +1 -1
  47. package/dist/esm/src/utils/permission-scope.js +9 -6
  48. package/dist/esm/src/utils/permission-scope.js.map +1 -1
  49. package/dist/esm/src/utils/protocols.js +12 -9
  50. package/dist/esm/src/utils/protocols.js.map +1 -1
  51. package/dist/esm/src/utils/records.js +54 -56
  52. package/dist/esm/src/utils/records.js.map +1 -1
  53. package/dist/esm/src/utils/replication.js +27 -4
  54. package/dist/esm/src/utils/replication.js.map +1 -1
  55. package/dist/esm/tests/core/replication-apply.spec.js +141 -1
  56. package/dist/esm/tests/core/replication-apply.spec.js.map +1 -1
  57. package/dist/esm/tests/core/replication-replay-property.spec.js +1 -0
  58. package/dist/esm/tests/core/replication-replay-property.spec.js.map +1 -1
  59. package/dist/esm/tests/core/validation-read-closure.spec.js +111 -0
  60. package/dist/esm/tests/core/validation-read-closure.spec.js.map +1 -1
  61. package/dist/esm/tests/core/validation-state-reader.spec.js +89 -0
  62. package/dist/esm/tests/core/validation-state-reader.spec.js.map +1 -1
  63. package/dist/esm/tests/features/protocol-composition.spec.js +30 -31
  64. package/dist/esm/tests/features/protocol-composition.spec.js.map +1 -1
  65. package/dist/esm/tests/fuzz/encryption.fuzz.spec.js +29 -121
  66. package/dist/esm/tests/fuzz/encryption.fuzz.spec.js.map +1 -1
  67. package/dist/esm/tests/handlers/messages-query.spec.js +71 -3
  68. package/dist/esm/tests/handlers/messages-query.spec.js.map +1 -1
  69. package/dist/esm/tests/handlers/messages-read.spec.js +2 -2
  70. package/dist/esm/tests/handlers/messages-read.spec.js.map +1 -1
  71. package/dist/esm/tests/handlers/records-read.spec.js +9 -135
  72. package/dist/esm/tests/handlers/records-read.spec.js.map +1 -1
  73. package/dist/esm/tests/handlers/records-write.spec.js +279 -19
  74. package/dist/esm/tests/handlers/records-write.spec.js.map +1 -1
  75. package/dist/esm/tests/interfaces/protocols-configure.spec.js +17 -22
  76. package/dist/esm/tests/interfaces/protocols-configure.spec.js.map +1 -1
  77. package/dist/esm/tests/interfaces/records-write.spec.js +170 -150
  78. package/dist/esm/tests/interfaces/records-write.spec.js.map +1 -1
  79. package/dist/esm/tests/protocols/encryption.spec.js +914 -0
  80. package/dist/esm/tests/protocols/encryption.spec.js.map +1 -0
  81. package/dist/esm/tests/scenarios/end-to-end-tests.spec.js +100 -100
  82. package/dist/esm/tests/scenarios/end-to-end-tests.spec.js.map +1 -1
  83. package/dist/esm/tests/store/message-store-level.spec.js +20 -2
  84. package/dist/esm/tests/store/message-store-level.spec.js.map +1 -1
  85. package/dist/esm/tests/utils/encryption-callbacks.spec.js +88 -125
  86. package/dist/esm/tests/utils/encryption-callbacks.spec.js.map +1 -1
  87. package/dist/esm/tests/utils/encryption.spec.js +121 -271
  88. package/dist/esm/tests/utils/encryption.spec.js.map +1 -1
  89. package/dist/esm/tests/utils/permission-scope.spec.js +5 -1
  90. package/dist/esm/tests/utils/permission-scope.spec.js.map +1 -1
  91. package/dist/esm/tests/utils/records.spec.js +15 -5
  92. package/dist/esm/tests/utils/records.spec.js.map +1 -1
  93. package/dist/esm/tests/utils/test-data-generator.js +7 -44
  94. package/dist/esm/tests/utils/test-data-generator.js.map +1 -1
  95. package/dist/esm/tests/validation/json-schemas/encryption/audience-key.spec.js +40 -0
  96. package/dist/esm/tests/validation/json-schemas/encryption/audience-key.spec.js.map +1 -0
  97. package/dist/esm/tests/validation/json-schemas/encryption/grant-key.spec.js +72 -0
  98. package/dist/esm/tests/validation/json-schemas/encryption/grant-key.spec.js.map +1 -0
  99. package/dist/types/generated/precompiled-validators.d.ts +140 -92
  100. package/dist/types/generated/precompiled-validators.d.ts.map +1 -1
  101. package/dist/types/src/core/constants.d.ts +2 -2
  102. package/dist/types/src/core/constants.d.ts.map +1 -1
  103. package/dist/types/src/core/core-protocol.d.ts +1 -1
  104. package/dist/types/src/core/core-protocol.d.ts.map +1 -1
  105. package/dist/types/src/core/dwn-error.d.ts +29 -1
  106. package/dist/types/src/core/dwn-error.d.ts.map +1 -1
  107. package/dist/types/src/core/messages-grant-authorization.d.ts +2 -0
  108. package/dist/types/src/core/messages-grant-authorization.d.ts.map +1 -1
  109. package/dist/types/src/core/protocol-authorization-validation.d.ts +2 -2
  110. package/dist/types/src/core/protocol-authorization-validation.d.ts.map +1 -1
  111. package/dist/types/src/core/recording-validation-state-reader.d.ts +9 -0
  112. package/dist/types/src/core/recording-validation-state-reader.d.ts.map +1 -1
  113. package/dist/types/src/core/replication-apply.d.ts +4 -3
  114. package/dist/types/src/core/replication-apply.d.ts.map +1 -1
  115. package/dist/types/src/core/validation-state-reader.d.ts +9 -0
  116. package/dist/types/src/core/validation-state-reader.d.ts.map +1 -1
  117. package/dist/types/src/dwn.d.ts +1 -0
  118. package/dist/types/src/dwn.d.ts.map +1 -1
  119. package/dist/types/src/handlers/messages-query.d.ts.map +1 -1
  120. package/dist/types/src/handlers/protocols-configure.d.ts.map +1 -1
  121. package/dist/types/src/index.d.ts +6 -5
  122. package/dist/types/src/index.d.ts.map +1 -1
  123. package/dist/types/src/interfaces/protocols-configure.d.ts +1 -1
  124. package/dist/types/src/interfaces/protocols-configure.d.ts.map +1 -1
  125. package/dist/types/src/interfaces/records-write-signing.d.ts +4 -8
  126. package/dist/types/src/interfaces/records-write-signing.d.ts.map +1 -1
  127. package/dist/types/src/interfaces/records-write.d.ts +10 -26
  128. package/dist/types/src/interfaces/records-write.d.ts.map +1 -1
  129. package/dist/types/src/protocols/encryption.d.ts +43 -0
  130. package/dist/types/src/protocols/encryption.d.ts.map +1 -0
  131. package/dist/types/src/protocols/permission-grant.d.ts +0 -7
  132. package/dist/types/src/protocols/permission-grant.d.ts.map +1 -1
  133. package/dist/types/src/types/encryption-types.d.ts +5 -38
  134. package/dist/types/src/types/encryption-types.d.ts.map +1 -1
  135. package/dist/types/src/types/message-types.d.ts +0 -13
  136. package/dist/types/src/types/message-types.d.ts.map +1 -1
  137. package/dist/types/src/types/permission-types.d.ts +0 -9
  138. package/dist/types/src/types/permission-types.d.ts.map +1 -1
  139. package/dist/types/src/types/protocols-types.d.ts +9 -14
  140. package/dist/types/src/types/protocols-types.d.ts.map +1 -1
  141. package/dist/types/src/types/records-types.d.ts +3 -3
  142. package/dist/types/src/types/records-types.d.ts.map +1 -1
  143. package/dist/types/src/types/validation-state-reader.d.ts +12 -0
  144. package/dist/types/src/types/validation-state-reader.d.ts.map +1 -1
  145. package/dist/types/src/utils/encryption.d.ts +61 -145
  146. package/dist/types/src/utils/encryption.d.ts.map +1 -1
  147. package/dist/types/src/utils/hd-key.d.ts +1 -1
  148. package/dist/types/src/utils/hd-key.d.ts.map +1 -1
  149. package/dist/types/src/utils/permission-scope.d.ts +4 -3
  150. package/dist/types/src/utils/permission-scope.d.ts.map +1 -1
  151. package/dist/types/src/utils/protocols.d.ts +3 -5
  152. package/dist/types/src/utils/protocols.d.ts.map +1 -1
  153. package/dist/types/src/utils/records.d.ts +5 -13
  154. package/dist/types/src/utils/records.d.ts.map +1 -1
  155. package/dist/types/src/utils/replication.d.ts +3 -0
  156. package/dist/types/src/utils/replication.d.ts.map +1 -1
  157. package/dist/types/tests/features/protocol-composition.spec.d.ts.map +1 -1
  158. package/dist/types/tests/handlers/messages-query.spec.d.ts.map +1 -1
  159. package/dist/types/tests/handlers/records-read.spec.d.ts.map +1 -1
  160. package/dist/types/tests/handlers/records-write.spec.d.ts.map +1 -1
  161. package/dist/types/tests/protocols/encryption.spec.d.ts +2 -0
  162. package/dist/types/tests/protocols/encryption.spec.d.ts.map +1 -0
  163. package/dist/types/tests/scenarios/end-to-end-tests.spec.d.ts.map +1 -1
  164. package/dist/types/tests/utils/test-data-generator.d.ts +0 -5
  165. package/dist/types/tests/utils/test-data-generator.d.ts.map +1 -1
  166. package/dist/types/tests/validation/json-schemas/encryption/audience-key.spec.d.ts +2 -0
  167. package/dist/types/tests/validation/json-schemas/encryption/audience-key.spec.d.ts.map +1 -0
  168. package/dist/types/tests/validation/json-schemas/encryption/grant-key.spec.d.ts +2 -0
  169. package/dist/types/tests/validation/json-schemas/encryption/grant-key.spec.d.ts.map +1 -0
  170. package/package.json +3 -3
  171. package/src/core/constants.ts +3 -3
  172. package/src/core/core-protocol.ts +1 -1
  173. package/src/core/dwn-error.ts +29 -1
  174. package/src/core/messages-grant-authorization.ts +27 -0
  175. package/src/core/protocol-authorization-validation.ts +145 -6
  176. package/src/core/recording-validation-state-reader.ts +13 -0
  177. package/src/core/replication-apply.ts +222 -8
  178. package/src/core/validation-state-reader.ts +30 -0
  179. package/src/dwn.ts +24 -2
  180. package/src/handlers/messages-query.ts +6 -5
  181. package/src/handlers/protocols-configure.ts +19 -3
  182. package/src/handlers/records-write.ts +1 -1
  183. package/src/index.ts +15 -5
  184. package/src/interfaces/protocols-configure.ts +39 -12
  185. package/src/interfaces/records-write-signing.ts +5 -12
  186. package/src/interfaces/records-write.ts +75 -92
  187. package/src/protocols/encryption.ts +649 -0
  188. package/src/protocols/permission-grant.ts +0 -6
  189. package/src/types/encryption-types.ts +9 -38
  190. package/src/types/message-types.ts +0 -13
  191. package/src/types/permission-types.ts +0 -10
  192. package/src/types/protocols-types.ts +9 -16
  193. package/src/types/records-types.ts +3 -3
  194. package/src/types/validation-state-reader.ts +13 -0
  195. package/src/utils/encryption.ts +258 -280
  196. package/src/utils/hd-key.ts +1 -1
  197. package/src/utils/permission-scope.ts +10 -6
  198. package/src/utils/protocols.ts +16 -15
  199. package/src/utils/records.ts +86 -71
  200. package/src/utils/replication.ts +30 -4
  201. package/dist/esm/tests/vectors/protocol-definitions/chat.json +0 -70
@@ -1,53 +1,24 @@
1
- import type { JweKeyUnwrapPayload } from '../utils/encryption.js';
2
1
  import type { KeyDerivationScheme } from '../utils/hd-key.js';
2
+ import type { KeyUnwrapPayload } from '../utils/encryption.js';
3
3
  import type { PublicKeyJwk } from './jose-types.js';
4
4
 
5
- /**
6
- * A callback interface for deriving HD public encryption keys.
7
- * The implementor performs HKDF key derivation and public key computation
8
- * internally — the private key never leaves the implementation boundary.
9
- *
10
- * Analogous to `MessageSigner` for signing operations.
11
- */
5
+ export type KeyDecrypterDerivationScheme = KeyDerivationScheme | 'roleAudience';
6
+
12
7
  export interface EncryptionKeyDeriver {
13
- /** Fully qualified key ID (e.g. did:example:alice#enc) */
14
8
  rootKeyId: string;
15
- /** The derivation scheme (e.g. KeyDerivationScheme.ProtocolPath) */
16
9
  derivationScheme: KeyDerivationScheme;
17
- /**
18
- * Derives an HD child public key for the given full derivation path.
19
- * The private key material stays within the implementor's boundary.
20
- *
21
- * @param fullDerivationPath - The complete HKDF path segments
22
- * (e.g. ['protocolPath', 'https://chat.example', 'thread', 'message'])
23
- * @returns The derived child public key as a JWK
24
- */
10
+
25
11
  derivePublicKey(fullDerivationPath: string[]): Promise<PublicKeyJwk>;
26
12
  }
27
13
 
28
- /**
29
- * A callback interface for decrypting JWE-wrapped Content Encryption Keys (CEKs).
30
- * The implementor performs HKDF key derivation, ECDH-ES key agreement, and AES Key Unwrap
31
- * internally — the private key never leaves the implementation boundary.
32
- *
33
- * Analogous to `MessageSigner` for signing operations.
34
- */
35
14
  export interface KeyDecrypter {
36
- /** Fully qualified key ID (e.g. did:example:alice#enc) */
37
15
  rootKeyId: string;
38
- /** The derivation scheme (e.g. KeyDerivationScheme.ProtocolPath) */
39
- derivationScheme: KeyDerivationScheme;
40
- /**
41
- * Unwraps a JWE-encrypted Content Encryption Key (CEK) after deriving the
42
- * leaf decryption key via HKDF through the given derivation path, then
43
- * performing ECDH-ES key agreement and AES-256 Key Unwrap.
44
- *
45
- * @param fullDerivationPath - The complete HKDF path to derive the leaf key
46
- * @param jweKeyUnwrapPayload - The wrapped CEK and ephemeral public key from the JWE recipient
47
- * @returns The unwrapped CEK bytes (typically 32 bytes for AES-256)
48
- */
16
+ derivationScheme: KeyDecrypterDerivationScheme;
17
+
18
+ derivePublicKey(fullDerivationPath: string[]): Promise<PublicKeyJwk>;
19
+
49
20
  decrypt(
50
21
  fullDerivationPath: string[],
51
- jweKeyUnwrapPayload: JweKeyUnwrapPayload,
22
+ keyUnwrapPayload: KeyUnwrapPayload,
52
23
  ): Promise<Uint8Array>;
53
24
  }
@@ -1,6 +1,5 @@
1
1
  import type { GeneralJws } from './jws-types.js';
2
2
  import type { ProgressToken } from './subscriptions.js';
3
- import type { PublicKeyJwk } from './jose-types.js';
4
3
  import type { DwnInterfaceName, DwnMethodName } from '../enums/dwn-interface-method.js';
5
4
  import type { PaginationCursor, SortDirection } from './query-types.js';
6
5
 
@@ -44,18 +43,6 @@ export type AuthorizationModel = {
44
43
  */
45
44
  ownerDelegatedGrant?: DelegatedGrantRecordsWriteMessage;
46
45
 
47
- /**
48
- * The author's ProtocolPath-derived public key for the key-delivery protocol's
49
- * `contextKey` path. Included by external authors on cross-DWN encrypted
50
- * protocol records so the DWN owner can encrypt a context key back to them
51
- * without needing to query the author's DWN.
52
- */
53
- authorKeyDeliveryPublicKey?: {
54
- /** Fully-qualified verification method ID (e.g. `did:example:bob#enc`). */
55
- rootKeyId: string;
56
- /** The author's ProtocolPath-derived public key in JWK format. */
57
- publicKeyJwk: PublicKeyJwk;
58
- };
59
46
  };
60
47
 
61
48
  export type DelegatedGrantRecordsWriteMessage = {
@@ -109,16 +109,6 @@ export type PermissionGrantData = {
109
109
 
110
110
  conditions?: PermissionConditions;
111
111
 
112
- /**
113
- * Optional delegate key-delivery metadata for cross-device context key delivery.
114
- * Contains the pre-derived ProtocolPath leaf public key that the owner uses
115
- * to encrypt contextKey records addressed to the delegate.
116
- */
117
- delegateKeyDelivery?: {
118
- rootKeyId: string;
119
- publicKeyJwk: Record<string, any>;
120
- };
121
-
122
112
  /** Optional metadata for the connect session that created this grant. */
123
113
  connectSession?: ConnectSessionMetadata;
124
114
  };
@@ -12,6 +12,7 @@ export type ProtocolsConfigureDescriptor = {
12
12
 
13
13
  export type ProtocolDefinition = {
14
14
  protocol: string;
15
+ $keyAgreement?: ProtocolKeyAgreement;
15
16
  /**
16
17
  * Denotes if this Protocol Definition can be returned by unauthenticated or unauthorized `ProtocolsQuery`.
17
18
  */
@@ -132,18 +133,9 @@ export type ProtocolActionRule = {
132
133
  can: (ProtocolAction | `${ProtocolAction}` | (string & {}))[];
133
134
  };
134
135
  /**
135
- * Config for protocol-path encryption scheme.
136
+ * Public key used for protocol-path content encryption.
136
137
  */
137
- export type ProtocolPathEncryption = {
138
-
139
- /**
140
- * The ID of the root key that derives the public key at this protocol path for encrypting the symmetric key used for data encryption.
141
- */
142
- rootKeyId: string;
143
-
144
- /**
145
- * Public key for encrypting the symmetric key used for data encryption.
146
- */
138
+ export type ProtocolKeyAgreement = {
147
139
  publicKeyJwk: PublicKeyJwk;
148
140
  };
149
141
 
@@ -224,6 +216,7 @@ export type ProtocolTagSchema = {
224
216
  exclusiveMaximum?: number;
225
217
  minLength?: number;
226
218
  maxLength?: number;
219
+ pattern?: string;
227
220
  minItems?: number;
228
221
  maxItems?: number;
229
222
  uniqueItems?: boolean;
@@ -234,13 +227,13 @@ export type ProtocolTagSchema = {
234
227
  /**
235
228
  * Union of all value types that can appear as properties of a `ProtocolRuleSet`.
236
229
  * This includes:
237
- * - `$`-prefixed directive values (`$encryption`, `$actions`, `$role`, `$ref`, `$size`, `$tags`, `$delivery`)
230
+ * - `$`-prefixed directive values (`$keyAgreement`, `$actions`, `$role`, `$ref`, `$size`, `$tags`, `$delivery`)
238
231
  * - Child `ProtocolRuleSet` entries (non-`$` keys)
239
232
  */
240
233
  type ProtocolRuleSetValue =
241
234
  | ProtocolRuleSet
242
235
  | ProtocolActionRule[]
243
- | ProtocolPathEncryption
236
+ | ProtocolKeyAgreement
244
237
  | ProtocolTagsDefinition
245
238
  | ProtocolSizeDefinition
246
239
  | ProtocolRecordLimitDefinition
@@ -251,9 +244,9 @@ type ProtocolRuleSetValue =
251
244
 
252
245
  export type ProtocolRuleSet = {
253
246
  /**
254
- * Encryption setting for objects that are in this protocol path.
247
+ * Key agreement setting for records at this protocol path.
255
248
  */
256
- $encryption?: ProtocolPathEncryption;
249
+ $keyAgreement?: ProtocolKeyAgreement;
257
250
  $actions?: ProtocolActionRule[];
258
251
 
259
252
  /**
@@ -268,7 +261,7 @@ export type ProtocolRuleSet = {
268
261
  * and `typePath` is the protocol path of the type in the external protocol's structure.
269
262
  *
270
263
  * A `$ref` node is a pure attachment point — it must NOT have `$actions`, `$role`, `$size`,
271
- * `$tags`, or `$encryption`. Authorization for the referenced type is governed by its own
264
+ * `$tags`, or `$keyAgreement`. Authorization for the referenced type is governed by its own
272
265
  * protocol. Only children defined under the `$ref` node get `$actions` from the composing protocol.
273
266
  *
274
267
  * Example:
@@ -1,5 +1,5 @@
1
+ import type { DwnEncryption } from '../utils/encryption.js';
1
2
  import type { GeneralJws } from './jws-types.js';
2
- import type { JweEncryption } from '../utils/encryption.js';
3
3
  import type { AuthorizationModel, GenericMessage, GenericMessageReply, GenericSignaturePayload, MessageSubscription, Pagination } from './message-types.js';
4
4
  import type { DwnInterfaceName, DwnMethodName } from '../enums/dwn-interface-method.js';
5
5
  import type { PaginationCursor, RangeCriterion, RangeFilter, StartsWithFilter } from './query-types.js';
@@ -60,7 +60,7 @@ export type InternalRecordsWriteMessage = GenericMessage & {
60
60
  contextId?: string;
61
61
  descriptor: RecordsWriteDescriptor;
62
62
  attestation?: GeneralJws;
63
- encryption?: JweEncryption;
63
+ encryption?: DwnEncryption;
64
64
  };
65
65
 
66
66
  export type RecordsWriteMessage = {
@@ -69,7 +69,7 @@ export type RecordsWriteMessage = {
69
69
  contextId: string;
70
70
  descriptor: RecordsWriteDescriptor;
71
71
  attestation?: GeneralJws;
72
- encryption?: JweEncryption;
72
+ encryption?: DwnEncryption;
73
73
  };
74
74
 
75
75
  /**
@@ -78,6 +78,19 @@ export interface ValidationStateReader {
78
78
  contextIdPrefix?: string;
79
79
  }): Promise<RecordsWriteMessage[]>;
80
80
 
81
+ /**
82
+ * Queries accepted audience epoch records in the Encryption Protocol.
83
+ * The optional `keyId` narrows the lookup to one published audience key.
84
+ */
85
+ queryAudienceEpochs(input: {
86
+ tenant: string;
87
+ protocol: string;
88
+ contextId: string;
89
+ role: string;
90
+ epoch: number;
91
+ keyId?: string;
92
+ }): Promise<RecordsWriteMessage[]>;
93
+
81
94
  /**
82
95
  * Fetches the permission grant with the given record ID, with its scope parsed from grant data.
83
96
  * @throws {DwnError} with `GrantAuthorizationGrantMissing` when the grant does not exist.