@enbox/dwn-sdk-js 0.0.2 → 0.0.4

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 (601) hide show
  1. package/README.md +52 -301
  2. package/dist/bundles/dwn.js +19 -21
  3. package/dist/esm/generated/precompiled-validators.js +2764 -1773
  4. package/dist/esm/generated/precompiled-validators.js.map +1 -1
  5. package/dist/esm/src/core/dwn-error.js +27 -3
  6. package/dist/esm/src/core/dwn-error.js.map +1 -1
  7. package/dist/esm/src/core/message.js.map +1 -1
  8. package/dist/esm/src/core/messages-grant-authorization.js +17 -6
  9. package/dist/esm/src/core/messages-grant-authorization.js.map +1 -1
  10. package/dist/esm/src/core/protocol-authorization.js +245 -69
  11. package/dist/esm/src/core/protocol-authorization.js.map +1 -1
  12. package/dist/esm/src/core/resumable-task-manager.js +4 -4
  13. package/dist/esm/src/core/resumable-task-manager.js.map +1 -1
  14. package/dist/esm/src/dwn.js +10 -8
  15. package/dist/esm/src/dwn.js.map +1 -1
  16. package/dist/esm/src/enums/dwn-interface-method.js +4 -2
  17. package/dist/esm/src/enums/dwn-interface-method.js.map +1 -1
  18. package/dist/esm/src/event-stream/event-emitter-stream.js.map +1 -0
  19. package/dist/esm/src/handlers/messages-subscribe.js +1 -1
  20. package/dist/esm/src/handlers/messages-subscribe.js.map +1 -1
  21. package/dist/esm/src/handlers/messages-sync.js +116 -0
  22. package/dist/esm/src/handlers/messages-sync.js.map +1 -0
  23. package/dist/esm/src/handlers/protocols-configure.js +149 -16
  24. package/dist/esm/src/handlers/protocols-configure.js.map +1 -1
  25. package/dist/esm/src/handlers/protocols-query.js +2 -2
  26. package/dist/esm/src/handlers/protocols-query.js.map +1 -1
  27. package/dist/esm/src/handlers/records-count.js +143 -0
  28. package/dist/esm/src/handlers/records-count.js.map +1 -0
  29. package/dist/esm/src/handlers/records-query.js +4 -0
  30. package/dist/esm/src/handlers/records-query.js.map +1 -1
  31. package/dist/esm/src/handlers/records-read.js +4 -6
  32. package/dist/esm/src/handlers/records-read.js.map +1 -1
  33. package/dist/esm/src/handlers/records-write.js +17 -18
  34. package/dist/esm/src/handlers/records-write.js.map +1 -1
  35. package/dist/esm/src/index.js +9 -5
  36. package/dist/esm/src/index.js.map +1 -1
  37. package/dist/esm/src/interfaces/messages-read.js +2 -7
  38. package/dist/esm/src/interfaces/messages-read.js.map +1 -1
  39. package/dist/esm/src/interfaces/messages-subscribe.js +1 -0
  40. package/dist/esm/src/interfaces/messages-subscribe.js.map +1 -1
  41. package/dist/esm/src/interfaces/{messages-query.js → messages-sync.js} +11 -12
  42. package/dist/esm/src/interfaces/messages-sync.js.map +1 -0
  43. package/dist/esm/src/interfaces/protocols-configure.js +153 -30
  44. package/dist/esm/src/interfaces/protocols-configure.js.map +1 -1
  45. package/dist/esm/src/interfaces/protocols-query.js +1 -0
  46. package/dist/esm/src/interfaces/protocols-query.js.map +1 -1
  47. package/dist/esm/src/interfaces/records-count.js +91 -0
  48. package/dist/esm/src/interfaces/records-count.js.map +1 -0
  49. package/dist/esm/src/interfaces/records-read.js +15 -1
  50. package/dist/esm/src/interfaces/records-read.js.map +1 -1
  51. package/dist/esm/src/interfaces/records-write.js +64 -15
  52. package/dist/esm/src/interfaces/records-write.js.map +1 -1
  53. package/dist/esm/src/jose/algorithms/signing/ed25519.js.map +1 -1
  54. package/dist/esm/src/jose/algorithms/signing/signature-algorithms.js.map +1 -1
  55. package/dist/esm/src/jose/jws/general/builder.js.map +1 -1
  56. package/dist/esm/src/jose/jws/general/verifier.js.map +1 -1
  57. package/dist/esm/src/protocols/permission-grant.js +30 -0
  58. package/dist/esm/src/protocols/permission-grant.js.map +1 -1
  59. package/dist/esm/src/protocols/permission-request.js +24 -0
  60. package/dist/esm/src/protocols/permission-request.js.map +1 -1
  61. package/dist/esm/src/protocols/permissions.js +1 -1
  62. package/dist/esm/src/protocols/permissions.js.map +1 -1
  63. package/dist/esm/src/schema-validator.js +0 -1
  64. package/dist/esm/src/schema-validator.js.map +1 -1
  65. package/dist/esm/src/smt/smt-store-level.js +125 -0
  66. package/dist/esm/src/smt/smt-store-level.js.map +1 -0
  67. package/dist/esm/src/smt/smt-store-memory.js +67 -0
  68. package/dist/esm/src/smt/smt-store-memory.js.map +1 -0
  69. package/dist/esm/src/smt/smt-utils.js +146 -0
  70. package/dist/esm/src/smt/smt-utils.js.map +1 -0
  71. package/dist/esm/src/smt/sparse-merkle-tree.js +622 -0
  72. package/dist/esm/src/smt/sparse-merkle-tree.js.map +1 -0
  73. package/dist/esm/src/state-index/state-index-level.js +228 -0
  74. package/dist/esm/src/state-index/state-index-level.js.map +1 -0
  75. package/dist/esm/src/store/data-store-level.js +6 -6
  76. package/dist/esm/src/store/data-store-level.js.map +1 -1
  77. package/dist/esm/src/store/index-level.js +375 -17
  78. package/dist/esm/src/store/index-level.js.map +1 -1
  79. package/dist/esm/src/store/message-store-level.js +56 -0
  80. package/dist/esm/src/store/message-store-level.js.map +1 -1
  81. package/dist/esm/src/store/storage-controller.js +19 -16
  82. package/dist/esm/src/store/storage-controller.js.map +1 -1
  83. package/dist/esm/src/types/encryption-types.js +2 -0
  84. package/dist/esm/src/types/encryption-types.js.map +1 -0
  85. package/dist/esm/src/types/message-types.js.map +1 -1
  86. package/dist/esm/src/types/protocols-types.js +0 -2
  87. package/dist/esm/src/types/protocols-types.js.map +1 -1
  88. package/dist/esm/src/types/records-types.js +2 -0
  89. package/dist/esm/src/types/records-types.js.map +1 -1
  90. package/dist/esm/src/types/smt-types.js +5 -0
  91. package/dist/esm/src/types/smt-types.js.map +1 -0
  92. package/dist/esm/src/types/state-index.js +2 -0
  93. package/dist/esm/src/types/state-index.js.map +1 -0
  94. package/dist/esm/src/utils/cid.js +2 -1
  95. package/dist/esm/src/utils/cid.js.map +1 -1
  96. package/dist/esm/src/utils/data-stream.js +84 -29
  97. package/dist/esm/src/utils/data-stream.js.map +1 -1
  98. package/dist/esm/src/utils/encryption.js +22 -31
  99. package/dist/esm/src/utils/encryption.js.map +1 -1
  100. package/dist/esm/src/utils/hd-key.js +3 -3
  101. package/dist/esm/src/utils/hd-key.js.map +1 -1
  102. package/dist/esm/src/utils/jws.js +4 -4
  103. package/dist/esm/src/utils/jws.js.map +1 -1
  104. package/dist/esm/src/utils/private-key-signer.js +4 -3
  105. package/dist/esm/src/utils/private-key-signer.js.map +1 -1
  106. package/dist/esm/src/utils/protocols.js +82 -9
  107. package/dist/esm/src/utils/protocols.js.map +1 -1
  108. package/dist/esm/src/utils/records.js +82 -26
  109. package/dist/esm/src/utils/records.js.map +1 -1
  110. package/dist/esm/src/utils/secp256k1.js +4 -3
  111. package/dist/esm/src/utils/secp256k1.js.map +1 -1
  112. package/dist/esm/src/utils/secp256r1.js +3 -2
  113. package/dist/esm/src/utils/secp256r1.js.map +1 -1
  114. package/dist/esm/src/utils/time.js +1 -1
  115. package/dist/esm/src/utils/url.js +1 -1
  116. package/dist/esm/src/utils/url.js.map +1 -1
  117. package/dist/esm/tests/core/auth.spec.js +2 -2
  118. package/dist/esm/tests/core/auth.spec.js.map +1 -1
  119. package/dist/esm/tests/core/message-reply.spec.js +3 -3
  120. package/dist/esm/tests/core/message-reply.spec.js.map +1 -1
  121. package/dist/esm/tests/core/message.spec.js +13 -13
  122. package/dist/esm/tests/core/message.spec.js.map +1 -1
  123. package/dist/esm/tests/core/protocol-authorization.spec.js +3 -3
  124. package/dist/esm/tests/core/protocol-authorization.spec.js.map +1 -1
  125. package/dist/esm/tests/dwn.spec.js +27 -37
  126. package/dist/esm/tests/dwn.spec.js.map +1 -1
  127. package/dist/esm/tests/{event-log → event-stream}/event-emitter-stream.spec.js +14 -15
  128. package/dist/esm/tests/event-stream/event-emitter-stream.spec.js.map +1 -0
  129. package/dist/esm/tests/{event-log → event-stream}/event-stream.spec.js +13 -15
  130. package/dist/esm/tests/event-stream/event-stream.spec.js.map +1 -0
  131. package/dist/esm/tests/features/author-delegated-grant.spec.js +281 -135
  132. package/dist/esm/tests/features/author-delegated-grant.spec.js.map +1 -1
  133. package/dist/esm/tests/features/owner-delegated-grant.spec.js +57 -59
  134. package/dist/esm/tests/features/owner-delegated-grant.spec.js.map +1 -1
  135. package/dist/esm/tests/features/owner-signature.spec.js +32 -34
  136. package/dist/esm/tests/features/owner-signature.spec.js.map +1 -1
  137. package/dist/esm/tests/features/permissions.spec.js +73 -95
  138. package/dist/esm/tests/features/permissions.spec.js.map +1 -1
  139. package/dist/esm/tests/features/protocol-composition.spec.js +1645 -0
  140. package/dist/esm/tests/features/protocol-composition.spec.js.map +1 -0
  141. package/dist/esm/tests/features/protocol-create-action.spec.js +25 -27
  142. package/dist/esm/tests/features/protocol-create-action.spec.js.map +1 -1
  143. package/dist/esm/tests/features/protocol-delete-action.spec.js +42 -44
  144. package/dist/esm/tests/features/protocol-delete-action.spec.js.map +1 -1
  145. package/dist/esm/tests/features/protocol-update-action.spec.js +53 -55
  146. package/dist/esm/tests/features/protocol-update-action.spec.js.map +1 -1
  147. package/dist/esm/tests/features/records-prune.spec.js +126 -100
  148. package/dist/esm/tests/features/records-prune.spec.js.map +1 -1
  149. package/dist/esm/tests/features/records-tags.spec.js +272 -272
  150. package/dist/esm/tests/features/records-tags.spec.js.map +1 -1
  151. package/dist/esm/tests/features/resumable-tasks.spec.js +35 -37
  152. package/dist/esm/tests/features/resumable-tasks.spec.js.map +1 -1
  153. package/dist/esm/tests/handlers/messages-read.spec.js +112 -112
  154. package/dist/esm/tests/handlers/messages-read.spec.js.map +1 -1
  155. package/dist/esm/tests/handlers/messages-subscribe.spec.js +78 -76
  156. package/dist/esm/tests/handlers/messages-subscribe.spec.js.map +1 -1
  157. package/dist/esm/tests/handlers/messages-sync.spec.js +528 -0
  158. package/dist/esm/tests/handlers/messages-sync.spec.js.map +1 -0
  159. package/dist/esm/tests/handlers/protocols-configure.spec.js +545 -152
  160. package/dist/esm/tests/handlers/protocols-configure.spec.js.map +1 -1
  161. package/dist/esm/tests/handlers/protocols-query.spec.js +70 -72
  162. package/dist/esm/tests/handlers/protocols-query.spec.js.map +1 -1
  163. package/dist/esm/tests/handlers/records-count.spec.js +313 -0
  164. package/dist/esm/tests/handlers/records-count.spec.js.map +1 -0
  165. package/dist/esm/tests/handlers/records-delete.spec.js +106 -109
  166. package/dist/esm/tests/handlers/records-delete.spec.js.map +1 -1
  167. package/dist/esm/tests/handlers/records-query.spec.js +863 -463
  168. package/dist/esm/tests/handlers/records-query.spec.js.map +1 -1
  169. package/dist/esm/tests/handlers/records-read.spec.js +439 -209
  170. package/dist/esm/tests/handlers/records-read.spec.js.map +1 -1
  171. package/dist/esm/tests/handlers/records-subscribe.spec.js +292 -97
  172. package/dist/esm/tests/handlers/records-subscribe.spec.js.map +1 -1
  173. package/dist/esm/tests/handlers/records-write.spec.js +481 -483
  174. package/dist/esm/tests/handlers/records-write.spec.js.map +1 -1
  175. package/dist/esm/tests/interfaces/messages-get.spec.js +31 -11
  176. package/dist/esm/tests/interfaces/messages-get.spec.js.map +1 -1
  177. package/dist/esm/tests/interfaces/messages-subscribe.spec.js +5 -5
  178. package/dist/esm/tests/interfaces/messages-subscribe.spec.js.map +1 -1
  179. package/dist/esm/tests/interfaces/protocols-configure.spec.js +64 -134
  180. package/dist/esm/tests/interfaces/protocols-configure.spec.js.map +1 -1
  181. package/dist/esm/tests/interfaces/protocols-query.spec.js +4 -6
  182. package/dist/esm/tests/interfaces/protocols-query.spec.js.map +1 -1
  183. package/dist/esm/tests/interfaces/records-delete.spec.js +3 -5
  184. package/dist/esm/tests/interfaces/records-delete.spec.js.map +1 -1
  185. package/dist/esm/tests/interfaces/records-query.spec.js +9 -11
  186. package/dist/esm/tests/interfaces/records-query.spec.js.map +1 -1
  187. package/dist/esm/tests/interfaces/records-read.spec.js +76 -7
  188. package/dist/esm/tests/interfaces/records-read.spec.js.map +1 -1
  189. package/dist/esm/tests/interfaces/records-subscribe.spec.js +7 -9
  190. package/dist/esm/tests/interfaces/records-subscribe.spec.js.map +1 -1
  191. package/dist/esm/tests/interfaces/records-write.spec.js +244 -48
  192. package/dist/esm/tests/interfaces/records-write.spec.js.map +1 -1
  193. package/dist/esm/tests/jose/jws/general.spec.js +15 -18
  194. package/dist/esm/tests/jose/jws/general.spec.js.map +1 -1
  195. package/dist/esm/tests/protocols/permission-grant.spec.js +114 -0
  196. package/dist/esm/tests/protocols/permission-grant.spec.js.map +1 -0
  197. package/dist/esm/tests/protocols/permission-request.spec.js +43 -7
  198. package/dist/esm/tests/protocols/permission-request.spec.js.map +1 -1
  199. package/dist/esm/tests/protocols/permissions.spec.js +9 -11
  200. package/dist/esm/tests/protocols/permissions.spec.js.map +1 -1
  201. package/dist/esm/tests/scenarios/aggregator.spec.js +90 -92
  202. package/dist/esm/tests/scenarios/aggregator.spec.js.map +1 -1
  203. package/dist/esm/tests/scenarios/deleted-record.spec.js +17 -19
  204. package/dist/esm/tests/scenarios/deleted-record.spec.js.map +1 -1
  205. package/dist/esm/tests/scenarios/end-to-end-tests.spec.js +27 -29
  206. package/dist/esm/tests/scenarios/end-to-end-tests.spec.js.map +1 -1
  207. package/dist/esm/tests/scenarios/nested-roles.spec.js +37 -39
  208. package/dist/esm/tests/scenarios/nested-roles.spec.js.map +1 -1
  209. package/dist/esm/tests/scenarios/subscriptions.spec.js +163 -163
  210. package/dist/esm/tests/scenarios/subscriptions.spec.js.map +1 -1
  211. package/dist/esm/tests/smt/smt-store-level.spec.js +143 -0
  212. package/dist/esm/tests/smt/smt-store-level.spec.js.map +1 -0
  213. package/dist/esm/tests/smt/sparse-merkle-tree.spec.js +741 -0
  214. package/dist/esm/tests/smt/sparse-merkle-tree.spec.js.map +1 -0
  215. package/dist/esm/tests/state-index/state-index-level.spec.js +254 -0
  216. package/dist/esm/tests/state-index/state-index-level.spec.js.map +1 -0
  217. package/dist/esm/tests/store/blockstore-level.spec.js +136 -0
  218. package/dist/esm/tests/store/blockstore-level.spec.js.map +1 -0
  219. package/dist/esm/tests/store/blockstore-mock.spec.js +29 -28
  220. package/dist/esm/tests/store/blockstore-mock.spec.js.map +1 -1
  221. package/dist/esm/tests/store/data-store-level.spec.js +23 -25
  222. package/dist/esm/tests/store/data-store-level.spec.js.map +1 -1
  223. package/dist/esm/tests/store/index-level.spec.js +544 -194
  224. package/dist/esm/tests/store/index-level.spec.js.map +1 -1
  225. package/dist/esm/tests/store/message-store-level.spec.js +4 -4
  226. package/dist/esm/tests/store/message-store-level.spec.js.map +1 -1
  227. package/dist/esm/tests/store/message-store.spec.js +147 -73
  228. package/dist/esm/tests/store/message-store.spec.js.map +1 -1
  229. package/dist/esm/tests/store-dependent-tests.spec.js +1 -0
  230. package/dist/esm/tests/store-dependent-tests.spec.js.map +1 -1
  231. package/dist/esm/tests/test-stores.js +5 -5
  232. package/dist/esm/tests/test-stores.js.map +1 -1
  233. package/dist/esm/tests/test-suite.js +9 -8
  234. package/dist/esm/tests/test-suite.js.map +1 -1
  235. package/dist/esm/tests/utils/cid.spec.js +8 -11
  236. package/dist/esm/tests/utils/cid.spec.js.map +1 -1
  237. package/dist/esm/tests/utils/data-stream.spec.js +167 -13
  238. package/dist/esm/tests/utils/data-stream.spec.js.map +1 -1
  239. package/dist/esm/tests/utils/encryption-callbacks.spec.js +233 -0
  240. package/dist/esm/tests/utils/encryption-callbacks.spec.js.map +1 -0
  241. package/dist/esm/tests/utils/encryption.spec.js +34 -85
  242. package/dist/esm/tests/utils/encryption.spec.js.map +1 -1
  243. package/dist/esm/tests/utils/filters.spec.js +67 -69
  244. package/dist/esm/tests/utils/filters.spec.js.map +1 -1
  245. package/dist/esm/tests/utils/hd-key.spec.js +3 -3
  246. package/dist/esm/tests/utils/hd-key.spec.js.map +1 -1
  247. package/dist/esm/tests/utils/jws.spec.js +54 -3
  248. package/dist/esm/tests/utils/jws.spec.js.map +1 -1
  249. package/dist/esm/tests/utils/memory-cache.spec.js +6 -9
  250. package/dist/esm/tests/utils/memory-cache.spec.js.map +1 -1
  251. package/dist/esm/tests/utils/messages.spec.js +63 -29
  252. package/dist/esm/tests/utils/messages.spec.js.map +1 -1
  253. package/dist/esm/tests/utils/object.spec.js +3 -3
  254. package/dist/esm/tests/utils/object.spec.js.map +1 -1
  255. package/dist/esm/tests/utils/poller.js +1 -1
  256. package/dist/esm/tests/utils/poller.js.map +1 -1
  257. package/dist/esm/tests/utils/private-key-signer.spec.js +6 -6
  258. package/dist/esm/tests/utils/private-key-signer.spec.js.map +1 -1
  259. package/dist/esm/tests/utils/records.spec.js +37 -5
  260. package/dist/esm/tests/utils/records.spec.js.map +1 -1
  261. package/dist/esm/tests/utils/secp256k1.spec.js +7 -7
  262. package/dist/esm/tests/utils/secp256k1.spec.js.map +1 -1
  263. package/dist/esm/tests/utils/secp256r1.spec.js +7 -7
  264. package/dist/esm/tests/utils/secp256r1.spec.js.map +1 -1
  265. package/dist/esm/tests/utils/test-data-generator.js +47 -28
  266. package/dist/esm/tests/utils/test-data-generator.js.map +1 -1
  267. package/dist/esm/tests/utils/time.spec.js +7 -7
  268. package/dist/esm/tests/utils/time.spec.js.map +1 -1
  269. package/dist/esm/tests/utils/url.spec.js +25 -27
  270. package/dist/esm/tests/utils/url.spec.js.map +1 -1
  271. package/dist/esm/tests/validation/json-schemas/definitions.spec.js +4 -4
  272. package/dist/esm/tests/validation/json-schemas/definitions.spec.js.map +1 -1
  273. package/dist/esm/tests/validation/json-schemas/jwk/general-jwk.spec.js +15 -3
  274. package/dist/esm/tests/validation/json-schemas/jwk/general-jwk.spec.js.map +1 -1
  275. package/dist/esm/tests/validation/json-schemas/jwk/public-jwk.spec.js +8 -8
  276. package/dist/esm/tests/validation/json-schemas/jwk/public-jwk.spec.js.map +1 -1
  277. package/dist/esm/tests/validation/json-schemas/jwk-verification-method.spec.js +8 -18
  278. package/dist/esm/tests/validation/json-schemas/jwk-verification-method.spec.js.map +1 -1
  279. package/dist/esm/tests/validation/json-schemas/protocols/protocols-configure.spec.js +3 -3
  280. package/dist/esm/tests/validation/json-schemas/protocols/protocols-configure.spec.js.map +1 -1
  281. package/dist/esm/tests/validation/json-schemas/records/records-query.spec.js +9 -9
  282. package/dist/esm/tests/validation/json-schemas/records/records-query.spec.js.map +1 -1
  283. package/dist/esm/tests/validation/json-schemas/records/records-read.spec.js +106 -0
  284. package/dist/esm/tests/validation/json-schemas/records/records-read.spec.js.map +1 -0
  285. package/dist/esm/tests/validation/json-schemas/records/records-write.spec.js +18 -18
  286. package/dist/esm/tests/validation/json-schemas/records/records-write.spec.js.map +1 -1
  287. package/dist/esm/tests/vectors/protocol-definitions/email.json +1 -1
  288. package/dist/esm/tests/vectors/protocol-definitions/friend-role.json +2 -4
  289. package/dist/esm/tests/vectors/protocol-definitions/slack.json +2 -6
  290. package/dist/esm/tests/vectors/protocol-definitions/thread-role.json +2 -6
  291. package/dist/types/generated/precompiled-validators.d.ts +82 -64
  292. package/dist/types/generated/precompiled-validators.d.ts.map +1 -1
  293. package/dist/types/src/core/dwn-error.d.ts +27 -3
  294. package/dist/types/src/core/dwn-error.d.ts.map +1 -1
  295. package/dist/types/src/core/message-reply.d.ts +1 -1
  296. package/dist/types/src/core/message.d.ts +3 -3
  297. package/dist/types/src/core/message.d.ts.map +1 -1
  298. package/dist/types/src/core/messages-grant-authorization.d.ts +4 -4
  299. package/dist/types/src/core/messages-grant-authorization.d.ts.map +1 -1
  300. package/dist/types/src/core/protocol-authorization.d.ts +43 -2
  301. package/dist/types/src/core/protocol-authorization.d.ts.map +1 -1
  302. package/dist/types/src/core/records-grant-authorization.d.ts +2 -2
  303. package/dist/types/src/core/records-grant-authorization.d.ts.map +1 -1
  304. package/dist/types/src/core/resumable-task-manager.d.ts +1 -0
  305. package/dist/types/src/core/resumable-task-manager.d.ts.map +1 -1
  306. package/dist/types/src/dwn.d.ts +8 -8
  307. package/dist/types/src/dwn.d.ts.map +1 -1
  308. package/dist/types/src/enums/dwn-interface-method.d.ts +5 -3
  309. package/dist/types/src/enums/dwn-interface-method.d.ts.map +1 -1
  310. package/dist/types/src/event-stream/event-emitter-stream.d.ts.map +1 -0
  311. package/dist/types/src/handlers/messages-sync.d.ts +21 -0
  312. package/dist/types/src/handlers/messages-sync.d.ts.map +1 -0
  313. package/dist/types/src/handlers/protocols-configure.d.ts +24 -4
  314. package/dist/types/src/handlers/protocols-configure.d.ts.map +1 -1
  315. package/dist/types/src/handlers/protocols-query.d.ts.map +1 -1
  316. package/dist/types/src/handlers/records-count.d.ts +43 -0
  317. package/dist/types/src/handlers/records-count.d.ts.map +1 -0
  318. package/dist/types/src/handlers/records-query.d.ts.map +1 -1
  319. package/dist/types/src/handlers/records-read.d.ts.map +1 -1
  320. package/dist/types/src/handlers/records-write.d.ts +5 -5
  321. package/dist/types/src/handlers/records-write.d.ts.map +1 -1
  322. package/dist/types/src/index.d.ts +72 -37
  323. package/dist/types/src/index.d.ts.map +1 -1
  324. package/dist/types/src/interfaces/messages-read.d.ts +2 -2
  325. package/dist/types/src/interfaces/messages-read.d.ts.map +1 -1
  326. package/dist/types/src/interfaces/messages-subscribe.d.ts +2 -2
  327. package/dist/types/src/interfaces/messages-subscribe.d.ts.map +1 -1
  328. package/dist/types/src/interfaces/messages-sync.d.ts +16 -0
  329. package/dist/types/src/interfaces/messages-sync.d.ts.map +1 -0
  330. package/dist/types/src/interfaces/protocols-configure.d.ts +22 -2
  331. package/dist/types/src/interfaces/protocols-configure.d.ts.map +1 -1
  332. package/dist/types/src/interfaces/protocols-query.d.ts +2 -2
  333. package/dist/types/src/interfaces/protocols-query.d.ts.map +1 -1
  334. package/dist/types/src/interfaces/records-count.d.ts +27 -0
  335. package/dist/types/src/interfaces/records-count.d.ts.map +1 -0
  336. package/dist/types/src/interfaces/records-delete.d.ts +2 -2
  337. package/dist/types/src/interfaces/records-delete.d.ts.map +1 -1
  338. package/dist/types/src/interfaces/records-query.d.ts +2 -2
  339. package/dist/types/src/interfaces/records-query.d.ts.map +1 -1
  340. package/dist/types/src/interfaces/records-read.d.ts +4 -2
  341. package/dist/types/src/interfaces/records-read.d.ts.map +1 -1
  342. package/dist/types/src/interfaces/records-subscribe.d.ts +2 -2
  343. package/dist/types/src/interfaces/records-subscribe.d.ts.map +1 -1
  344. package/dist/types/src/interfaces/records-write.d.ts +37 -15
  345. package/dist/types/src/interfaces/records-write.d.ts.map +1 -1
  346. package/dist/types/src/jose/algorithms/signing/ed25519.d.ts.map +1 -1
  347. package/dist/types/src/jose/algorithms/signing/signature-algorithms.d.ts +5 -1
  348. package/dist/types/src/jose/algorithms/signing/signature-algorithms.d.ts.map +1 -1
  349. package/dist/types/src/jose/jws/general/builder.d.ts +3 -3
  350. package/dist/types/src/jose/jws/general/builder.d.ts.map +1 -1
  351. package/dist/types/src/protocols/permission-grant.d.ts +11 -0
  352. package/dist/types/src/protocols/permission-grant.d.ts.map +1 -1
  353. package/dist/types/src/protocols/permission-request.d.ts +11 -0
  354. package/dist/types/src/protocols/permission-request.d.ts.map +1 -1
  355. package/dist/types/src/protocols/permissions.d.ts +4 -4
  356. package/dist/types/src/protocols/permissions.d.ts.map +1 -1
  357. package/dist/types/src/schema-validator.d.ts +1 -1
  358. package/dist/types/src/schema-validator.d.ts.map +1 -1
  359. package/dist/types/src/smt/smt-store-level.d.ts +32 -0
  360. package/dist/types/src/smt/smt-store-level.d.ts.map +1 -0
  361. package/dist/types/src/smt/smt-store-memory.d.ts +22 -0
  362. package/dist/types/src/smt/smt-store-memory.d.ts.map +1 -0
  363. package/dist/types/src/smt/smt-utils.d.ts +58 -0
  364. package/dist/types/src/smt/smt-utils.d.ts.map +1 -0
  365. package/dist/types/src/smt/sparse-merkle-tree.d.ts +124 -0
  366. package/dist/types/src/smt/sparse-merkle-tree.d.ts.map +1 -0
  367. package/dist/types/src/state-index/state-index-level.d.ts +83 -0
  368. package/dist/types/src/state-index/state-index-level.d.ts.map +1 -0
  369. package/dist/types/src/store/data-store-level.d.ts +1 -2
  370. package/dist/types/src/store/data-store-level.d.ts.map +1 -1
  371. package/dist/types/src/store/index-level.d.ts +98 -2
  372. package/dist/types/src/store/index-level.d.ts.map +1 -1
  373. package/dist/types/src/store/level-wrapper.d.ts.map +1 -1
  374. package/dist/types/src/store/message-store-level.d.ts +5 -0
  375. package/dist/types/src/store/message-store-level.d.ts.map +1 -1
  376. package/dist/types/src/store/storage-controller.d.ts +7 -7
  377. package/dist/types/src/store/storage-controller.d.ts.map +1 -1
  378. package/dist/types/src/types/data-store.d.ts +2 -3
  379. package/dist/types/src/types/data-store.d.ts.map +1 -1
  380. package/dist/types/src/types/encryption-types.d.ts +48 -0
  381. package/dist/types/src/types/encryption-types.d.ts.map +1 -0
  382. package/dist/types/src/types/jose-types.d.ts +9 -40
  383. package/dist/types/src/types/jose-types.d.ts.map +1 -1
  384. package/dist/types/src/types/message-store.d.ts +5 -0
  385. package/dist/types/src/types/message-store.d.ts.map +1 -1
  386. package/dist/types/src/types/message-types.d.ts +19 -0
  387. package/dist/types/src/types/message-types.d.ts.map +1 -1
  388. package/dist/types/src/types/messages-types.d.ts +16 -11
  389. package/dist/types/src/types/messages-types.d.ts.map +1 -1
  390. package/dist/types/src/types/method-handler.d.ts +1 -2
  391. package/dist/types/src/types/method-handler.d.ts.map +1 -1
  392. package/dist/types/src/types/permission-types.d.ts +2 -2
  393. package/dist/types/src/types/permission-types.d.ts.map +1 -1
  394. package/dist/types/src/types/protocols-types.d.ts +49 -5
  395. package/dist/types/src/types/protocols-types.d.ts.map +1 -1
  396. package/dist/types/src/types/records-types.d.ts +23 -7
  397. package/dist/types/src/types/records-types.d.ts.map +1 -1
  398. package/dist/types/src/types/signer.d.ts +1 -1
  399. package/dist/types/src/types/signer.d.ts.map +1 -1
  400. package/dist/types/src/types/smt-types.d.ts +81 -0
  401. package/dist/types/src/types/smt-types.d.ts.map +1 -0
  402. package/dist/types/src/types/state-index.d.ts +90 -0
  403. package/dist/types/src/types/state-index.d.ts.map +1 -0
  404. package/dist/types/src/utils/cid.d.ts +1 -2
  405. package/dist/types/src/utils/cid.d.ts.map +1 -1
  406. package/dist/types/src/utils/data-stream.d.ts +14 -7
  407. package/dist/types/src/utils/data-stream.d.ts.map +1 -1
  408. package/dist/types/src/utils/encryption.d.ts +2 -3
  409. package/dist/types/src/utils/encryption.d.ts.map +1 -1
  410. package/dist/types/src/utils/hd-key.d.ts +4 -4
  411. package/dist/types/src/utils/hd-key.d.ts.map +1 -1
  412. package/dist/types/src/utils/jws.d.ts +7 -7
  413. package/dist/types/src/utils/jws.d.ts.map +1 -1
  414. package/dist/types/src/utils/private-key-signer.d.ts +4 -4
  415. package/dist/types/src/utils/private-key-signer.d.ts.map +1 -1
  416. package/dist/types/src/utils/protocols.d.ts +46 -3
  417. package/dist/types/src/utils/protocols.d.ts.map +1 -1
  418. package/dist/types/src/utils/records.d.ts +33 -6
  419. package/dist/types/src/utils/records.d.ts.map +1 -1
  420. package/dist/types/src/utils/secp256k1.d.ts +11 -11
  421. package/dist/types/src/utils/secp256k1.d.ts.map +1 -1
  422. package/dist/types/src/utils/secp256r1.d.ts +8 -8
  423. package/dist/types/src/utils/secp256r1.d.ts.map +1 -1
  424. package/dist/types/src/utils/time.d.ts +1 -1
  425. package/dist/types/tests/dwn.spec.d.ts.map +1 -1
  426. package/dist/types/tests/event-stream/event-emitter-stream.spec.d.ts.map +1 -0
  427. package/dist/types/tests/event-stream/event-stream.spec.d.ts.map +1 -0
  428. package/dist/types/tests/features/author-delegated-grant.spec.d.ts.map +1 -1
  429. package/dist/types/tests/features/owner-delegated-grant.spec.d.ts.map +1 -1
  430. package/dist/types/tests/features/owner-signature.spec.d.ts.map +1 -1
  431. package/dist/types/tests/features/permissions.spec.d.ts.map +1 -1
  432. package/dist/types/tests/features/protocol-composition.spec.d.ts +5 -0
  433. package/dist/types/tests/features/protocol-composition.spec.d.ts.map +1 -0
  434. package/dist/types/tests/features/protocol-create-action.spec.d.ts.map +1 -1
  435. package/dist/types/tests/features/protocol-delete-action.spec.d.ts.map +1 -1
  436. package/dist/types/tests/features/protocol-update-action.spec.d.ts.map +1 -1
  437. package/dist/types/tests/features/records-prune.spec.d.ts.map +1 -1
  438. package/dist/types/tests/features/records-tags.spec.d.ts.map +1 -1
  439. package/dist/types/tests/features/resumable-tasks.spec.d.ts.map +1 -1
  440. package/dist/types/tests/handlers/messages-read.spec.d.ts.map +1 -1
  441. package/dist/types/tests/handlers/messages-subscribe.spec.d.ts.map +1 -1
  442. package/dist/types/tests/handlers/messages-sync.spec.d.ts +2 -0
  443. package/dist/types/tests/handlers/messages-sync.spec.d.ts.map +1 -0
  444. package/dist/types/tests/handlers/protocols-configure.spec.d.ts.map +1 -1
  445. package/dist/types/tests/handlers/protocols-query.spec.d.ts.map +1 -1
  446. package/dist/types/tests/handlers/records-count.spec.d.ts +2 -0
  447. package/dist/types/tests/handlers/records-count.spec.d.ts.map +1 -0
  448. package/dist/types/tests/handlers/records-delete.spec.d.ts.map +1 -1
  449. package/dist/types/tests/handlers/records-query.spec.d.ts.map +1 -1
  450. package/dist/types/tests/handlers/records-read.spec.d.ts.map +1 -1
  451. package/dist/types/tests/handlers/records-subscribe.spec.d.ts.map +1 -1
  452. package/dist/types/tests/handlers/records-write.spec.d.ts.map +1 -1
  453. package/dist/types/tests/protocols/permission-grant.spec.d.ts +2 -0
  454. package/dist/types/tests/protocols/permission-grant.spec.d.ts.map +1 -0
  455. package/dist/types/tests/scenarios/deleted-record.spec.d.ts.map +1 -1
  456. package/dist/types/tests/scenarios/end-to-end-tests.spec.d.ts.map +1 -1
  457. package/dist/types/tests/scenarios/nested-roles.spec.d.ts.map +1 -1
  458. package/dist/types/tests/smt/smt-store-level.spec.d.ts +2 -0
  459. package/dist/types/tests/smt/smt-store-level.spec.d.ts.map +1 -0
  460. package/dist/types/tests/smt/sparse-merkle-tree.spec.d.ts +2 -0
  461. package/dist/types/tests/smt/sparse-merkle-tree.spec.d.ts.map +1 -0
  462. package/dist/types/tests/state-index/state-index-level.spec.d.ts +2 -0
  463. package/dist/types/tests/state-index/state-index-level.spec.d.ts.map +1 -0
  464. package/dist/types/tests/store/blockstore-level.spec.d.ts +2 -0
  465. package/dist/types/tests/store/blockstore-level.spec.d.ts.map +1 -0
  466. package/dist/types/tests/store/message-store.spec.d.ts.map +1 -1
  467. package/dist/types/tests/test-stores.d.ts +4 -4
  468. package/dist/types/tests/test-stores.d.ts.map +1 -1
  469. package/dist/types/tests/test-suite.d.ts +2 -2
  470. package/dist/types/tests/test-suite.d.ts.map +1 -1
  471. package/dist/types/tests/utils/encryption-callbacks.spec.d.ts +2 -0
  472. package/dist/types/tests/utils/encryption-callbacks.spec.d.ts.map +1 -0
  473. package/dist/types/tests/utils/test-data-generator.d.ts +31 -28
  474. package/dist/types/tests/utils/test-data-generator.d.ts.map +1 -1
  475. package/dist/types/tests/validation/json-schemas/records/records-read.spec.d.ts +2 -0
  476. package/dist/types/tests/validation/json-schemas/records/records-read.spec.d.ts.map +1 -0
  477. package/package.json +27 -46
  478. package/src/core/dwn-error.ts +27 -3
  479. package/src/core/message-reply.ts +1 -1
  480. package/src/core/message.ts +5 -5
  481. package/src/core/messages-grant-authorization.ts +22 -8
  482. package/src/core/protocol-authorization.ts +345 -68
  483. package/src/core/records-grant-authorization.ts +2 -2
  484. package/src/core/resumable-task-manager.ts +4 -5
  485. package/src/dwn.ts +25 -20
  486. package/src/enums/dwn-interface-method.ts +5 -3
  487. package/src/handlers/messages-subscribe.ts +1 -1
  488. package/src/handlers/messages-sync.ts +129 -0
  489. package/src/handlers/protocols-configure.ts +195 -17
  490. package/src/handlers/protocols-query.ts +7 -5
  491. package/src/handlers/records-count.ts +184 -0
  492. package/src/handlers/records-query.ts +4 -0
  493. package/src/handlers/records-read.ts +4 -8
  494. package/src/handlers/records-write.ts +20 -21
  495. package/src/index.ts +74 -37
  496. package/src/interfaces/messages-read.ts +6 -5
  497. package/src/interfaces/messages-subscribe.ts +7 -6
  498. package/src/interfaces/messages-sync.ts +59 -0
  499. package/src/interfaces/protocols-configure.ts +211 -33
  500. package/src/interfaces/protocols-query.ts +7 -6
  501. package/src/interfaces/records-count.ts +106 -0
  502. package/src/interfaces/records-delete.ts +2 -2
  503. package/src/interfaces/records-query.ts +2 -2
  504. package/src/interfaces/records-read.ts +26 -3
  505. package/src/interfaces/records-subscribe.ts +2 -2
  506. package/src/interfaces/records-write.ts +115 -46
  507. package/src/jose/algorithms/signing/ed25519.ts +13 -12
  508. package/src/jose/algorithms/signing/signature-algorithms.ts +6 -1
  509. package/src/jose/jws/general/builder.ts +3 -3
  510. package/src/jose/jws/general/verifier.ts +3 -3
  511. package/src/protocols/permission-grant.ts +51 -0
  512. package/src/protocols/permission-request.ts +37 -0
  513. package/src/protocols/permissions.ts +5 -5
  514. package/src/schema-validator.ts +11 -3
  515. package/src/smt/smt-store-level.ts +143 -0
  516. package/src/smt/smt-store-memory.ts +53 -0
  517. package/src/smt/smt-utils.ts +149 -0
  518. package/src/smt/sparse-merkle-tree.ts +698 -0
  519. package/src/state-index/state-index-level.ts +241 -0
  520. package/src/store/data-store-level.ts +8 -7
  521. package/src/store/index-level.ts +415 -19
  522. package/src/store/level-wrapper.ts +1 -1
  523. package/src/store/message-store-level.ts +62 -0
  524. package/src/store/storage-controller.ts +21 -19
  525. package/src/types/data-store.ts +2 -4
  526. package/src/types/encryption-types.ts +52 -0
  527. package/src/types/jose-types.ts +10 -42
  528. package/src/types/message-store.ts +11 -0
  529. package/src/types/message-types.ts +21 -0
  530. package/src/types/messages-types.ts +21 -15
  531. package/src/types/method-handler.ts +1 -2
  532. package/src/types/permission-types.ts +2 -2
  533. package/src/types/protocols-types.ts +55 -6
  534. package/src/types/records-types.ts +26 -7
  535. package/src/types/signer.ts +1 -1
  536. package/src/types/smt-types.ts +95 -0
  537. package/src/types/state-index.ts +100 -0
  538. package/src/utils/cid.ts +3 -4
  539. package/src/utils/data-stream.ts +75 -38
  540. package/src/utils/encryption.ts +24 -39
  541. package/src/utils/hd-key.ts +6 -6
  542. package/src/utils/jws.ts +9 -9
  543. package/src/utils/private-key-signer.ts +9 -8
  544. package/src/utils/protocols.ts +132 -6
  545. package/src/utils/records.ts +118 -29
  546. package/src/utils/secp256k1.ts +23 -21
  547. package/src/utils/secp256r1.ts +17 -15
  548. package/src/utils/time.ts +1 -1
  549. package/src/utils/url.ts +1 -1
  550. package/dist/cjs/index.js +0 -36749
  551. package/dist/cjs/package.json +0 -1
  552. package/dist/esm/src/event-log/event-emitter-stream.js.map +0 -1
  553. package/dist/esm/src/event-log/event-log-level.js +0 -63
  554. package/dist/esm/src/event-log/event-log-level.js.map +0 -1
  555. package/dist/esm/src/handlers/messages-query.js +0 -71
  556. package/dist/esm/src/handlers/messages-query.js.map +0 -1
  557. package/dist/esm/src/interfaces/messages-query.js.map +0 -1
  558. package/dist/esm/src/types/event-log.js +0 -2
  559. package/dist/esm/src/types/event-log.js.map +0 -1
  560. package/dist/esm/tests/event-log/event-emitter-stream.spec.js.map +0 -1
  561. package/dist/esm/tests/event-log/event-log-level.spec.js +0 -44
  562. package/dist/esm/tests/event-log/event-log-level.spec.js.map +0 -1
  563. package/dist/esm/tests/event-log/event-log.spec.js +0 -236
  564. package/dist/esm/tests/event-log/event-log.spec.js.map +0 -1
  565. package/dist/esm/tests/event-log/event-stream.spec.js.map +0 -1
  566. package/dist/esm/tests/handlers/messages-query.spec.js +0 -349
  567. package/dist/esm/tests/handlers/messages-query.spec.js.map +0 -1
  568. package/dist/esm/tests/interfaces/messagess-query.spec.js +0 -127
  569. package/dist/esm/tests/interfaces/messagess-query.spec.js.map +0 -1
  570. package/dist/esm/tests/scenarios/messages-query.spec.js +0 -395
  571. package/dist/esm/tests/scenarios/messages-query.spec.js.map +0 -1
  572. package/dist/types/src/event-log/event-emitter-stream.d.ts.map +0 -1
  573. package/dist/types/src/event-log/event-log-level.d.ts +0 -35
  574. package/dist/types/src/event-log/event-log-level.d.ts.map +0 -1
  575. package/dist/types/src/handlers/messages-query.d.ts +0 -17
  576. package/dist/types/src/handlers/messages-query.d.ts.map +0 -1
  577. package/dist/types/src/interfaces/messages-query.d.ts +0 -16
  578. package/dist/types/src/interfaces/messages-query.d.ts.map +0 -1
  579. package/dist/types/src/types/event-log.d.ts +0 -52
  580. package/dist/types/src/types/event-log.d.ts.map +0 -1
  581. package/dist/types/tests/event-log/event-emitter-stream.spec.d.ts.map +0 -1
  582. package/dist/types/tests/event-log/event-log-level.spec.d.ts +0 -2
  583. package/dist/types/tests/event-log/event-log-level.spec.d.ts.map +0 -1
  584. package/dist/types/tests/event-log/event-log.spec.d.ts +0 -2
  585. package/dist/types/tests/event-log/event-log.spec.d.ts.map +0 -1
  586. package/dist/types/tests/event-log/event-stream.spec.d.ts.map +0 -1
  587. package/dist/types/tests/handlers/messages-query.spec.d.ts +0 -2
  588. package/dist/types/tests/handlers/messages-query.spec.d.ts.map +0 -1
  589. package/dist/types/tests/interfaces/messagess-query.spec.d.ts +0 -2
  590. package/dist/types/tests/interfaces/messagess-query.spec.d.ts.map +0 -1
  591. package/dist/types/tests/scenarios/messages-query.spec.d.ts +0 -2
  592. package/dist/types/tests/scenarios/messages-query.spec.d.ts.map +0 -1
  593. package/src/event-log/event-log-level.ts +0 -72
  594. package/src/handlers/messages-query.ts +0 -67
  595. package/src/interfaces/messages-query.ts +0 -60
  596. package/src/types/event-log.ts +0 -52
  597. /package/dist/esm/src/{event-log → event-stream}/event-emitter-stream.js +0 -0
  598. /package/dist/types/src/{event-log → event-stream}/event-emitter-stream.d.ts +0 -0
  599. /package/dist/types/tests/{event-log → event-stream}/event-emitter-stream.spec.d.ts +0 -0
  600. /package/dist/types/tests/{event-log → event-stream}/event-stream.spec.d.ts +0 -0
  601. /package/src/{event-log → event-stream}/event-emitter-stream.ts +0 -0
@@ -23,8 +23,10 @@ import { FilterUtility } from '../utils/filter.js';
23
23
  import { PermissionsProtocol } from '../protocols/permissions.js';
24
24
  import { Records } from '../utils/records.js';
25
25
  import { RecordsWrite } from '../interfaces/records-write.js';
26
+ import { SortDirection } from '../types/query-types.js';
26
27
  import { DwnError, DwnErrorCode } from './dwn-error.js';
27
28
  import { DwnInterfaceName, DwnMethodName } from '../enums/dwn-interface-method.js';
29
+ import { getRuleSetAtPath, isCrossProtocolRef, parseCrossProtocolRef } from '../utils/protocols.js';
28
30
  import { ProtocolAction, ProtocolActor } from '../types/protocols-types.js';
29
31
  export class ProtocolAuthorization {
30
32
  /**
@@ -33,12 +35,17 @@ export class ProtocolAuthorization {
33
35
  */
34
36
  static validateReferentialIntegrity(tenant, incomingMessage, messageStore) {
35
37
  return __awaiter(this, void 0, void 0, function* () {
36
- // fetch the protocol definition
37
- const protocolDefinition = yield ProtocolAuthorization.fetchProtocolDefinition(tenant, incomingMessage.message.descriptor.protocol, messageStore);
38
- // verify declared protocol type exists in protocol and that it conforms to type specification
39
- ProtocolAuthorization.verifyType(incomingMessage.message, protocolDefinition.types);
38
+ // Determine the governing timestamp for protocol definition lookup.
39
+ // For an initial write, this is the message's own timestamp.
40
+ // For an update, this is the initial write's timestamp (the protocol version is locked at creation time).
41
+ const governingTimestamp = yield ProtocolAuthorization.getGoverningTimestamp(tenant, incomingMessage, messageStore);
42
+ // fetch the protocol definition that was active at the governing timestamp
43
+ const protocolDefinition = yield ProtocolAuthorization.fetchProtocolDefinition(tenant, incomingMessage.message.descriptor.protocol, messageStore, governingTimestamp);
44
+ // verify declared protocol type exists in protocol and that it conforms to type specification.
45
+ // For cross-protocol composition, the type may be defined in a referenced protocol.
46
+ yield ProtocolAuthorization.verifyTypeWithComposition(tenant, incomingMessage.message, protocolDefinition, messageStore, governingTimestamp);
40
47
  // validate `protocolPath`
41
- yield ProtocolAuthorization.verifyProtocolPathAndContextId(tenant, incomingMessage, messageStore);
48
+ yield ProtocolAuthorization.verifyProtocolPathAndContextId(tenant, incomingMessage, messageStore, governingTimestamp);
42
49
  // get the rule set for the inbound message
43
50
  const ruleSet = ProtocolAuthorization.getRuleSet(incomingMessage.message.descriptor.protocolPath, protocolDefinition);
44
51
  // Validate as a role record if the incoming message is writing a role record
@@ -66,14 +73,16 @@ export class ProtocolAuthorization {
66
73
  else {
67
74
  recordChain = yield ProtocolAuthorization.constructRecordChain(tenant, incomingMessage.message.recordId, messageStore);
68
75
  }
69
- // fetch the protocol definition
70
- const protocolDefinition = yield ProtocolAuthorization.fetchProtocolDefinition(tenant, incomingMessage.message.descriptor.protocol, messageStore);
76
+ // Determine the governing timestamp for protocol definition lookup.
77
+ const governingTimestamp = yield ProtocolAuthorization.getGoverningTimestamp(tenant, incomingMessage, messageStore);
78
+ // fetch the protocol definition that was active at the governing timestamp
79
+ const protocolDefinition = yield ProtocolAuthorization.fetchProtocolDefinition(tenant, incomingMessage.message.descriptor.protocol, messageStore, governingTimestamp);
71
80
  // get the rule set for the inbound message
72
81
  const ruleSet = ProtocolAuthorization.getRuleSet(incomingMessage.message.descriptor.protocolPath, protocolDefinition);
73
82
  // If the incoming message has `protocolRole` in the descriptor, validate the invoked role
74
- yield ProtocolAuthorization.verifyInvokedRole(tenant, incomingMessage, incomingMessage.message.descriptor.protocol, incomingMessage.message.contextId, protocolDefinition, messageStore);
83
+ yield ProtocolAuthorization.verifyInvokedRole(tenant, incomingMessage, incomingMessage.message.descriptor.protocol, incomingMessage.message.contextId, protocolDefinition, messageStore, governingTimestamp);
75
84
  // verify method invoked against the allowed actions in the rule set
76
- yield ProtocolAuthorization.authorizeAgainstAllowedActions(tenant, incomingMessage, ruleSet, recordChain, messageStore);
85
+ yield ProtocolAuthorization.authorizeAgainstAllowedActions(tenant, incomingMessage, ruleSet, recordChain, messageStore, protocolDefinition);
77
86
  });
78
87
  }
79
88
  /**
@@ -85,14 +94,20 @@ export class ProtocolAuthorization {
85
94
  return __awaiter(this, void 0, void 0, function* () {
86
95
  // fetch record chain
87
96
  const recordChain = yield ProtocolAuthorization.constructRecordChain(tenant, newestRecordsWrite.message.recordId, messageStore);
88
- // fetch the protocol definition
89
- const protocolDefinition = yield ProtocolAuthorization.fetchProtocolDefinition(tenant, newestRecordsWrite.message.descriptor.protocol, messageStore);
97
+ // Use the initial write's timestamp to determine the governing protocol definition.
98
+ // The protocol version is locked at the time the record was first created.
99
+ const initialWrite = yield ProtocolAuthorization.fetchInitialWrite(tenant, newestRecordsWrite.message.recordId, messageStore);
100
+ const governingTimestamp = initialWrite !== undefined
101
+ ? initialWrite.descriptor.messageTimestamp
102
+ : newestRecordsWrite.message.descriptor.messageTimestamp;
103
+ // fetch the protocol definition that was active when the record was created
104
+ const protocolDefinition = yield ProtocolAuthorization.fetchProtocolDefinition(tenant, newestRecordsWrite.message.descriptor.protocol, messageStore, governingTimestamp);
90
105
  // get the rule set for the inbound message
91
106
  const ruleSet = ProtocolAuthorization.getRuleSet(newestRecordsWrite.message.descriptor.protocolPath, protocolDefinition);
92
107
  // If the incoming message has `protocolRole` in the descriptor, validate the invoked role
93
- yield ProtocolAuthorization.verifyInvokedRole(tenant, incomingMessage, newestRecordsWrite.message.descriptor.protocol, newestRecordsWrite.message.contextId, protocolDefinition, messageStore);
108
+ yield ProtocolAuthorization.verifyInvokedRole(tenant, incomingMessage, newestRecordsWrite.message.descriptor.protocol, newestRecordsWrite.message.contextId, protocolDefinition, messageStore, governingTimestamp);
94
109
  // verify method invoked against the allowed actions in the rule set
95
- yield ProtocolAuthorization.authorizeAgainstAllowedActions(tenant, incomingMessage, ruleSet, recordChain, messageStore);
110
+ yield ProtocolAuthorization.authorizeAgainstAllowedActions(tenant, incomingMessage, ruleSet, recordChain, messageStore, protocolDefinition);
96
111
  });
97
112
  }
98
113
  static authorizeQueryOrSubscribe(tenant, incomingMessage, messageStore) {
@@ -108,7 +123,7 @@ export class ProtocolAuthorization {
108
123
  yield ProtocolAuthorization.verifyInvokedRole(tenant, incomingMessage, protocol, contextId, protocolDefinition, messageStore);
109
124
  // verify method invoked against the allowed actions in the rule set
110
125
  yield ProtocolAuthorization.authorizeAgainstAllowedActions(tenant, incomingMessage, ruleSet, [], // record chain is not relevant to queries or subscriptions
111
- messageStore);
126
+ messageStore, protocolDefinition);
112
127
  });
113
128
  }
114
129
  /**
@@ -119,20 +134,28 @@ export class ProtocolAuthorization {
119
134
  return __awaiter(this, void 0, void 0, function* () {
120
135
  // fetch record chain
121
136
  const recordChain = yield ProtocolAuthorization.constructRecordChain(tenant, incomingMessage.message.descriptor.recordId, messageStore);
122
- // fetch the protocol definition
123
- const protocolDefinition = yield ProtocolAuthorization.fetchProtocolDefinition(tenant, recordsWrite.message.descriptor.protocol, messageStore);
137
+ // Use the initial write's timestamp to determine the governing protocol definition.
138
+ const initialWrite = yield ProtocolAuthorization.fetchInitialWrite(tenant, incomingMessage.message.descriptor.recordId, messageStore);
139
+ const governingTimestamp = initialWrite !== undefined
140
+ ? initialWrite.descriptor.messageTimestamp
141
+ : recordsWrite.message.descriptor.messageTimestamp;
142
+ // fetch the protocol definition that was active when the record was created
143
+ const protocolDefinition = yield ProtocolAuthorization.fetchProtocolDefinition(tenant, recordsWrite.message.descriptor.protocol, messageStore, governingTimestamp);
124
144
  // get the rule set for the inbound message
125
145
  const ruleSet = ProtocolAuthorization.getRuleSet(recordsWrite.message.descriptor.protocolPath, protocolDefinition);
126
146
  // If the incoming message has `protocolRole` in the descriptor, validate the invoked role
127
- yield ProtocolAuthorization.verifyInvokedRole(tenant, incomingMessage, recordsWrite.message.descriptor.protocol, recordsWrite.message.contextId, protocolDefinition, messageStore);
147
+ yield ProtocolAuthorization.verifyInvokedRole(tenant, incomingMessage, recordsWrite.message.descriptor.protocol, recordsWrite.message.contextId, protocolDefinition, messageStore, governingTimestamp);
128
148
  // verify method invoked against the allowed actions in the rule set
129
- yield ProtocolAuthorization.authorizeAgainstAllowedActions(tenant, incomingMessage, ruleSet, recordChain, messageStore);
149
+ yield ProtocolAuthorization.authorizeAgainstAllowedActions(tenant, incomingMessage, ruleSet, recordChain, messageStore, protocolDefinition);
130
150
  });
131
151
  }
132
152
  /**
133
153
  * Fetches the protocol definition based on the protocol specified in the given message.
154
+ * When `messageTimestamp` is provided, returns the protocol definition that was active at that
155
+ * point in time — i.e. the ProtocolsConfigure with the greatest `messageTimestamp` that is <= the
156
+ * given timestamp. When not provided, returns the latest (current) protocol definition.
134
157
  */
135
- static fetchProtocolDefinition(tenant, protocolUri, messageStore) {
158
+ static fetchProtocolDefinition(tenant, protocolUri, messageStore, messageTimestamp) {
136
159
  return __awaiter(this, void 0, void 0, function* () {
137
160
  // if first-class protocol, return the definition from const object directly without going to data store
138
161
  if (protocolUri === PermissionsProtocol.uri) {
@@ -142,9 +165,17 @@ export class ProtocolAuthorization {
142
165
  const query = {
143
166
  interface: DwnInterfaceName.Protocols,
144
167
  method: DwnMethodName.Configure,
145
- protocol: protocolUri
168
+ protocol: protocolUri,
146
169
  };
147
- const { messages: protocols } = yield messageStore.query(tenant, [query]);
170
+ if (messageTimestamp !== undefined) {
171
+ // temporal lookup: find the protocol definition active at the given timestamp
172
+ query.messageTimestamp = { lte: messageTimestamp };
173
+ }
174
+ else {
175
+ // default: return only the latest protocol definition
176
+ query.isLatestBaseState = true;
177
+ }
178
+ const { messages: protocols } = yield messageStore.query(tenant, [query], { messageTimestamp: SortDirection.Descending }, { limit: 1 });
148
179
  if (protocols.length === 0) {
149
180
  throw new DwnError(DwnErrorCode.ProtocolAuthorizationProtocolNotFound, `unable to find protocol definition for ${protocolUri}`);
150
181
  }
@@ -205,7 +236,7 @@ export class ProtocolAuthorization {
205
236
  * Gets the rule set corresponding to the given protocolPath.
206
237
  */
207
238
  static getRuleSet(protocolPath, protocolDefinition) {
208
- const ruleSet = ProtocolAuthorization.getRuleSetAtProtocolPath(protocolPath, protocolDefinition);
239
+ const ruleSet = getRuleSetAtPath(protocolPath, protocolDefinition.structure);
209
240
  if (ruleSet === undefined) {
210
241
  throw new DwnError(DwnErrorCode.ProtocolAuthorizationMissingRuleSet, `No rule set defined for protocolPath ${protocolPath}`);
211
242
  }
@@ -213,11 +244,11 @@ export class ProtocolAuthorization {
213
244
  }
214
245
  /**
215
246
  * Verifies the `protocolPath` declared in the given message (if it is a RecordsWrite) matches the path of actual record chain.
247
+ * For cross-protocol composition, the parent record may belong to a different protocol (resolved via `$ref` in the composing protocol).
216
248
  * @throws {DwnError} if fails verification.
217
249
  */
218
- static verifyProtocolPathAndContextId(tenant, inboundMessage, messageStore) {
250
+ static verifyProtocolPathAndContextId(tenant, inboundMessage, messageStore, governingTimestamp) {
219
251
  return __awaiter(this, void 0, void 0, function* () {
220
- var _a;
221
252
  const declaredProtocolPath = inboundMessage.message.descriptor.protocolPath;
222
253
  const declaredTypeName = ProtocolAuthorization.getTypeName(declaredProtocolPath);
223
254
  const parentId = inboundMessage.message.descriptor.parentId;
@@ -228,19 +259,30 @@ export class ProtocolAuthorization {
228
259
  return;
229
260
  }
230
261
  // Else `parentId` is defined, so we need to verify both protocolPath and contextId
262
+ // Determine the protocol URI for the parent query.
263
+ // If the parent path segment has a `$ref` in the composing protocol, the parent lives in a different protocol.
264
+ const childProtocol = inboundMessage.message.descriptor.protocol;
265
+ const parentProtocolUri = yield ProtocolAuthorization.resolveParentProtocolUri(tenant, childProtocol, declaredProtocolPath, messageStore, governingTimestamp);
231
266
  // fetch the parent message
232
- const protocol = inboundMessage.message.descriptor.protocol;
233
267
  const query = {
234
268
  isLatestBaseState: true, // NOTE: this filter is critical, to ensure are are not returning a deleted parent
235
269
  interface: DwnInterfaceName.Records,
236
270
  method: DwnMethodName.Write,
237
- protocol,
271
+ protocol: parentProtocolUri,
238
272
  recordId: parentId
239
273
  };
240
274
  const { messages: parentMessages } = yield messageStore.query(tenant, [query]);
241
275
  const parentMessage = parentMessages[0];
276
+ if (parentMessage === undefined) {
277
+ // if this is a cross-protocol composition lookup, use a more descriptive error
278
+ if (parentProtocolUri !== childProtocol) {
279
+ throw new DwnError(DwnErrorCode.ProtocolAuthorizationCrossProtocolParentNotFound, `Could not find parent record '${parentId}' in protocol '${parentProtocolUri}' ` +
280
+ `for cross-protocol child at path '${declaredProtocolPath}'.`);
281
+ }
282
+ throw new DwnError(DwnErrorCode.ProtocolAuthorizationIncorrectProtocolPath, `Could not find matching parent record to verify declared protocol path '${declaredProtocolPath}'.`);
283
+ }
242
284
  // verifying protocolPath of incoming message is a child of the parent message's protocolPath
243
- const parentProtocolPath = (_a = parentMessage === null || parentMessage === void 0 ? void 0 : parentMessage.descriptor) === null || _a === void 0 ? void 0 : _a.protocolPath;
285
+ const parentProtocolPath = parentMessage.descriptor.protocolPath;
244
286
  const expectedProtocolPath = `${parentProtocolPath}/${declaredTypeName}`;
245
287
  if (expectedProtocolPath !== declaredProtocolPath) {
246
288
  throw new DwnError(DwnErrorCode.ProtocolAuthorizationIncorrectProtocolPath, `Could not find matching parent record to verify declared protocol path '${declaredProtocolPath}'.`);
@@ -253,39 +295,125 @@ export class ProtocolAuthorization {
253
295
  }
254
296
  });
255
297
  }
298
+ /**
299
+ * Resolves the protocol URI that should be used when querying for the parent record.
300
+ * For standard (non-composed) records, this is the same as the child's protocol.
301
+ * For cross-protocol composition, the parent may live in a different protocol
302
+ * (resolved via `$ref` in the composing protocol's definition).
303
+ *
304
+ * Logic: Given a child at protocolPath `a/b/c`, the parent is at `a/b`.
305
+ * Walk up the composing protocol's structure from root to `a/b`.
306
+ * If any segment along the way has a `$ref`, the parent (and its ancestors up to the `$ref` boundary)
307
+ * live in the referenced protocol. Specifically, the `$ref` at the topmost ancestor tells us
308
+ * the parent's protocol URI.
309
+ */
310
+ static resolveParentProtocolUri(tenant, childProtocolUri, childProtocolPath, messageStore, governingTimestamp) {
311
+ return __awaiter(this, void 0, void 0, function* () {
312
+ const segments = childProtocolPath.split('/');
313
+ // A root-level record (no `/` in path) has no parent or uses the same protocol
314
+ if (segments.length <= 1) {
315
+ return childProtocolUri;
316
+ }
317
+ // Fetch the composing protocol's definition at the governing timestamp
318
+ const composingDefinition = yield ProtocolAuthorization.fetchProtocolDefinition(tenant, childProtocolUri, messageStore, governingTimestamp);
319
+ // Walk the structure to find the parent's path segment
320
+ // The parent's position in the structure is at segments[0..n-2]
321
+ // We check if the first segment has a `$ref`, which means the parent is in a different protocol
322
+ const firstSegmentRuleSet = composingDefinition.structure[segments[0]];
323
+ if ((firstSegmentRuleSet === null || firstSegmentRuleSet === void 0 ? void 0 : firstSegmentRuleSet.$ref) !== undefined) {
324
+ const parsed = parseCrossProtocolRef(firstSegmentRuleSet.$ref);
325
+ if (parsed !== undefined && composingDefinition.uses !== undefined) {
326
+ const resolvedUri = composingDefinition.uses[parsed.alias];
327
+ if (resolvedUri !== undefined) {
328
+ // The parent path is within the `$ref` boundary — check if the parent IS the `$ref` node
329
+ // or is a descendant of it (which would still be in the composing protocol).
330
+ // If segments.length === 2, parent is at segments[0] which IS the $ref node → parent's protocol is the referenced one.
331
+ // If segments.length > 2, parent is at segments[0..n-2]. If segments[0] is $ref, the parent could be:
332
+ // - Still the $ref node itself (segments.length === 2) → referenced protocol
333
+ // - A child of the $ref node defined in the composing protocol (segments.length > 2) → composing protocol
334
+ if (segments.length === 2) {
335
+ // Parent is the $ref node itself (e.g., child is "thread/comment", parent is "thread")
336
+ return resolvedUri;
337
+ }
338
+ // else: parent is a deeper child defined in the composing protocol
339
+ return childProtocolUri;
340
+ }
341
+ }
342
+ }
343
+ return childProtocolUri;
344
+ });
345
+ }
346
+ /**
347
+ * Verifies the `dataFormat` and `schema` declared in the given message matches the type in the protocol.
348
+ * For cross-protocol composition, if the type is at a `$ref` position in the structure,
349
+ * the type definition is looked up in the referenced protocol's `types` map instead.
350
+ */
351
+ static verifyTypeWithComposition(tenant, inboundMessage, protocolDefinition, messageStore, governingTimestamp) {
352
+ return __awaiter(this, void 0, void 0, function* () {
353
+ const declaredProtocolPath = inboundMessage.descriptor.protocolPath;
354
+ const declaredTypeName = ProtocolAuthorization.getTypeName(declaredProtocolPath);
355
+ // Resolve which protocol types map to use.
356
+ // If the first path segment has `$ref`, this record's type might be defined in a referenced protocol.
357
+ const protocolTypes = yield ProtocolAuthorization.resolveProtocolTypesForPath(tenant, declaredProtocolPath, protocolDefinition, messageStore, governingTimestamp);
358
+ ProtocolAuthorization.verifyType(inboundMessage, protocolTypes, declaredTypeName);
359
+ });
360
+ }
361
+ /**
362
+ * Resolves the `ProtocolTypes` map that contains the type definition for the given protocol path.
363
+ * For non-composed records, this is the protocol definition's own `types` map.
364
+ * For records at a `$ref` position, this is the referenced protocol's `types` map.
365
+ */
366
+ static resolveProtocolTypesForPath(tenant, protocolPath, protocolDefinition, messageStore, governingTimestamp) {
367
+ return __awaiter(this, void 0, void 0, function* () {
368
+ const segments = protocolPath.split('/');
369
+ // Check if the first segment has a `$ref`
370
+ const firstSegmentRuleSet = protocolDefinition.structure[segments[0]];
371
+ if ((firstSegmentRuleSet === null || firstSegmentRuleSet === void 0 ? void 0 : firstSegmentRuleSet.$ref) !== undefined && segments.length === 1) {
372
+ // This record IS the $ref node itself — its type is defined in the referenced protocol
373
+ const parsed = parseCrossProtocolRef(firstSegmentRuleSet.$ref);
374
+ if (parsed !== undefined && protocolDefinition.uses !== undefined) {
375
+ const refProtocolUri = protocolDefinition.uses[parsed.alias];
376
+ if (refProtocolUri !== undefined) {
377
+ const refDefinition = yield ProtocolAuthorization.fetchProtocolDefinition(tenant, refProtocolUri, messageStore, governingTimestamp);
378
+ return refDefinition.types;
379
+ }
380
+ }
381
+ }
382
+ // Default: use the composing protocol's own types
383
+ return protocolDefinition.types;
384
+ });
385
+ }
256
386
  /**
257
387
  * Verifies the `dataFormat` and `schema` declared in the given message (if it is a RecordsWrite) matches dataFormat
258
388
  * and schema of the type in the given protocol.
259
389
  * @throws {DwnError} if fails verification.
260
390
  */
261
- static verifyType(inboundMessage, protocolTypes) {
391
+ static verifyType(inboundMessage, protocolTypes, typeName) {
392
+ const declaredTypeName = typeName !== null && typeName !== void 0 ? typeName : ProtocolAuthorization.getTypeName(inboundMessage.descriptor.protocolPath);
262
393
  const typeNames = Object.keys(protocolTypes);
263
- const declaredProtocolPath = inboundMessage.descriptor.protocolPath;
264
- const declaredTypeName = ProtocolAuthorization.getTypeName(declaredProtocolPath);
265
394
  if (!typeNames.includes(declaredTypeName)) {
266
395
  throw new DwnError(DwnErrorCode.ProtocolAuthorizationInvalidType, `record with type ${declaredTypeName} not allowed in protocol`);
267
396
  }
268
- const protocolPath = inboundMessage.descriptor.protocolPath;
269
- // existence of `protocolType` has already been verified
270
- const typeName = ProtocolAuthorization.getTypeName(protocolPath);
271
- const protocolType = protocolTypes[typeName];
397
+ const protocolType = protocolTypes[declaredTypeName];
272
398
  // no `schema` specified in protocol definition means that any schema is allowed
273
399
  const { schema } = inboundMessage.descriptor;
274
400
  if (protocolType.schema !== undefined && protocolType.schema !== schema) {
275
- throw new DwnError(DwnErrorCode.ProtocolAuthorizationInvalidSchema, `type '${typeName}' must have schema '${protocolType.schema}', \
401
+ throw new DwnError(DwnErrorCode.ProtocolAuthorizationInvalidSchema, `type '${declaredTypeName}' must have schema '${protocolType.schema}', \
276
402
  instead has '${schema}'`);
277
403
  }
278
404
  // no `dataFormats` specified in protocol definition means that all dataFormats are allowed
279
405
  const { dataFormat } = inboundMessage.descriptor;
280
406
  if (protocolType.dataFormats !== undefined && !protocolType.dataFormats.includes(dataFormat)) {
281
- throw new DwnError(DwnErrorCode.ProtocolAuthorizationIncorrectDataFormat, `type '${typeName}' must have data format in (${protocolType.dataFormats}), \
407
+ throw new DwnError(DwnErrorCode.ProtocolAuthorizationIncorrectDataFormat, `type '${declaredTypeName}' must have data format in (${protocolType.dataFormats}), \
282
408
  instead has '${dataFormat}'`);
283
409
  }
284
410
  }
285
411
  /**
286
412
  * Check if the incoming message is invoking a role. If so, validate the invoked role.
413
+ * For cross-protocol role invocation, the role record may live in a different protocol
414
+ * (resolved via the composing protocol's `uses` map).
287
415
  */
288
- static verifyInvokedRole(tenant, incomingMessage, protocolUri, contextId, protocolDefinition, messageStore) {
416
+ static verifyInvokedRole(tenant, incomingMessage, protocolUri, contextId, protocolDefinition, messageStore, governingTimestamp) {
289
417
  return __awaiter(this, void 0, void 0, function* () {
290
418
  var _a;
291
419
  const protocolRole = (_a = incomingMessage.signaturePayload) === null || _a === void 0 ? void 0 : _a.protocolRole;
@@ -293,20 +421,44 @@ export class ProtocolAuthorization {
293
421
  if (protocolRole === undefined) {
294
422
  return;
295
423
  }
296
- const roleRuleSet = ProtocolAuthorization.getRuleSetAtProtocolPath(protocolRole, protocolDefinition);
297
- if (roleRuleSet === undefined || !roleRuleSet.$role) {
298
- throw new DwnError(DwnErrorCode.ProtocolAuthorizationNotARole, `Protocol path ${protocolRole} does not match role record type.`);
424
+ // Determine the protocol URI and protocol path for the role record.
425
+ // For cross-protocol roles (e.g., "threads:thread/participant"), resolve the alias.
426
+ let roleProtocolUri = protocolUri;
427
+ let roleProtocolPath = protocolRole;
428
+ if (isCrossProtocolRef(protocolRole)) {
429
+ const parsed = parseCrossProtocolRef(protocolRole);
430
+ if (parsed === undefined) {
431
+ throw new DwnError(DwnErrorCode.ProtocolAuthorizationNotARole, `Cross-protocol role '${protocolRole}' could not be parsed as a valid 'alias:path' format.`);
432
+ }
433
+ if (protocolDefinition.uses === undefined || protocolDefinition.uses[parsed.alias] === undefined) {
434
+ throw new DwnError(DwnErrorCode.ProtocolAuthorizationNotARole, `Cross-protocol role alias '${parsed.alias}' in '${protocolRole}' does not exist in the protocol's 'uses' map.`);
435
+ }
436
+ roleProtocolUri = protocolDefinition.uses[parsed.alias];
437
+ roleProtocolPath = parsed.protocolPath;
438
+ // Fetch the referenced protocol's definition to validate the role exists
439
+ const refDefinition = yield ProtocolAuthorization.fetchProtocolDefinition(tenant, roleProtocolUri, messageStore, governingTimestamp);
440
+ const roleRuleSet = getRuleSetAtPath(roleProtocolPath, refDefinition.structure);
441
+ if (roleRuleSet === undefined || !roleRuleSet.$role) {
442
+ throw new DwnError(DwnErrorCode.ProtocolAuthorizationNotARole, `Cross-protocol role path ${protocolRole} does not match role record type.`);
443
+ }
444
+ }
445
+ else {
446
+ // Local role: validate in the composing protocol's definition
447
+ const roleRuleSet = getRuleSetAtPath(protocolRole, protocolDefinition.structure);
448
+ if (roleRuleSet === undefined || !roleRuleSet.$role) {
449
+ throw new DwnError(DwnErrorCode.ProtocolAuthorizationNotARole, `Protocol path ${protocolRole} does not match role record type.`);
450
+ }
299
451
  }
300
452
  // Construct a filter to fetch the invoked role record
301
453
  const roleRecordFilter = {
302
454
  interface: DwnInterfaceName.Records,
303
455
  method: DwnMethodName.Write,
304
- protocol: protocolUri,
305
- protocolPath: protocolRole,
456
+ protocol: roleProtocolUri,
457
+ protocolPath: roleProtocolPath,
306
458
  recipient: incomingMessage.author,
307
459
  isLatestBaseState: true,
308
460
  };
309
- const ancestorSegmentCountOfRolePath = protocolRole.split('/').length - 1;
461
+ const ancestorSegmentCountOfRolePath = roleProtocolPath.split('/').length - 1;
310
462
  if (contextId === undefined && ancestorSegmentCountOfRolePath > 0) {
311
463
  throw new DwnError(DwnErrorCode.ProtocolAuthorizationMissingContextId, 'Could not verify role because contextId is missing.');
312
464
  }
@@ -322,7 +474,7 @@ export class ProtocolAuthorization {
322
474
  }
323
475
  const { messages: matchingMessages } = yield messageStore.query(tenant, [roleRecordFilter]);
324
476
  if (matchingMessages.length === 0) {
325
- throw new DwnError(DwnErrorCode.ProtocolAuthorizationMatchingRoleRecordNotFound, `No matching role record found for protocol path ${protocolRole}`);
477
+ throw new DwnError(DwnErrorCode.ProtocolAuthorizationMatchingRoleRecordNotFound, `No matching role record found for protocol path ${roleProtocolPath}`);
326
478
  }
327
479
  });
328
480
  }
@@ -366,12 +518,14 @@ export class ProtocolAuthorization {
366
518
  }
367
519
  }
368
520
  return actionsThatWouldAuthorizeDelete;
521
+ case DwnMethodName.Count:
522
+ return [ProtocolAction.Read];
369
523
  case DwnMethodName.Query:
370
- return [ProtocolAction.Query];
524
+ return [ProtocolAction.Read];
371
525
  case DwnMethodName.Read:
372
526
  return [ProtocolAction.Read];
373
527
  case DwnMethodName.Subscribe:
374
- return [ProtocolAction.Subscribe];
528
+ return [ProtocolAction.Read];
375
529
  case DwnMethodName.Write:
376
530
  const incomingRecordsWrite = incomingMessage;
377
531
  if (yield incomingRecordsWrite.isInitialWrite()) {
@@ -402,9 +556,10 @@ export class ProtocolAuthorization {
402
556
  }
403
557
  /**
404
558
  * Verifies the given message is authorized by one of the action rules in the given protocol rule set.
559
+ * @param protocolDefinition Optional protocol definition for resolving cross-protocol `of` and `role` references.
405
560
  * @throws {Error} if action not allowed.
406
561
  */
407
- static authorizeAgainstAllowedActions(tenant, incomingMessage, ruleSet, recordChain, messageStore) {
562
+ static authorizeAgainstAllowedActions(tenant, incomingMessage, ruleSet, recordChain, messageStore, protocolDefinition) {
408
563
  return __awaiter(this, void 0, void 0, function* () {
409
564
  var _a;
410
565
  const incomingMessageMethod = incomingMessage.message.descriptor.method;
@@ -469,7 +624,7 @@ export class ProtocolAuthorization {
469
624
  }
470
625
  }
471
626
  // validate the actor is allowed by the current action rule
472
- const ancestorRuleSuccess = yield ProtocolAuthorization.checkActor(author, actionRule, recordChain);
627
+ const ancestorRuleSuccess = yield ProtocolAuthorization.checkActor(author, actionRule, recordChain, protocolDefinition);
473
628
  if (ancestorRuleSuccess) {
474
629
  return;
475
630
  }
@@ -561,33 +716,37 @@ export class ProtocolAuthorization {
561
716
  }
562
717
  });
563
718
  }
564
- static getRuleSetAtProtocolPath(protocolPath, protocolDefinition) {
565
- const protocolPathArray = protocolPath.split('/');
566
- let currentRuleSet = protocolDefinition.structure;
567
- let i = 0;
568
- while (i < protocolPathArray.length) {
569
- const currentTypeName = protocolPathArray[i];
570
- const nextRuleSet = currentRuleSet[currentTypeName];
571
- if (nextRuleSet === undefined) {
572
- return undefined;
573
- }
574
- currentRuleSet = nextRuleSet;
575
- i++;
576
- }
577
- return currentRuleSet;
578
- }
579
719
  /**
580
720
  * Checks if the `who: 'author' | 'recipient'` action rule has a matching record in the record chain.
721
+ * For cross-protocol `of` references (e.g., `"threads:thread"`), matches against both the protocol URI
722
+ * and the protocol path of the ancestor record.
581
723
  * @returns `true` if the action rule is satisfied; `false` otherwise.
582
724
  */
583
- static checkActor(author, actionRule, recordChain) {
725
+ static checkActor(author, actionRule, recordChain, composingDefinition) {
584
726
  return __awaiter(this, void 0, void 0, function* () {
585
- // find a message with matching protocolPath
586
- const ancestorRecordsWrite = recordChain.find((recordsWriteMessage) => recordsWriteMessage.descriptor.protocolPath === actionRule.of);
727
+ const ofValue = actionRule.of;
728
+ // `of` should always be defined when `checkActor` is called, but guard defensively
729
+ if (ofValue === undefined) {
730
+ return false;
731
+ }
732
+ let ancestorRecordsWrite;
733
+ if (isCrossProtocolRef(ofValue) && (composingDefinition === null || composingDefinition === void 0 ? void 0 : composingDefinition.uses) !== undefined) {
734
+ // Cross-protocol `of`: resolve alias to protocol URI and match by both protocol + protocolPath
735
+ const parsed = parseCrossProtocolRef(ofValue);
736
+ if (parsed !== undefined) {
737
+ const refProtocolUri = composingDefinition.uses[parsed.alias];
738
+ if (refProtocolUri !== undefined) {
739
+ ancestorRecordsWrite = recordChain.find((msg) => msg.descriptor.protocol === refProtocolUri && msg.descriptor.protocolPath === parsed.protocolPath);
740
+ }
741
+ }
742
+ }
743
+ else {
744
+ // Local `of`: match by protocolPath only (same protocol assumed)
745
+ ancestorRecordsWrite = recordChain.find((msg) => msg.descriptor.protocolPath === ofValue);
746
+ }
587
747
  if (ancestorRecordsWrite === undefined) {
588
- // If this is reached, there is likely an issue with the protocol definition.
589
- // The protocolPath to the actionRule should start with actionRule.of
590
- // consider moving this check to ProtocolsConfigure message ingestion
748
+ // No matching ancestor found in the record chain. Return false to allow the caller
749
+ // to continue evaluating other action rules that might authorize the request.
591
750
  return false;
592
751
  }
593
752
  if (actionRule.who === ProtocolActor.Recipient) {
@@ -601,6 +760,23 @@ export class ProtocolAuthorization {
601
760
  }
602
761
  });
603
762
  }
763
+ /**
764
+ * Determines the timestamp that governs which protocol definition version applies to the given RecordsWrite.
765
+ * For an update, this is the initial write's `messageTimestamp` (the protocol version is locked at creation time).
766
+ * For a new initial write, returns `undefined` — the latest protocol definition should be used because the
767
+ * record is being created now and must conform to the current protocol rules.
768
+ */
769
+ static getGoverningTimestamp(tenant, incomingMessage, messageStore) {
770
+ return __awaiter(this, void 0, void 0, function* () {
771
+ const existingInitialWrite = yield ProtocolAuthorization.fetchInitialWrite(tenant, incomingMessage.message.recordId, messageStore);
772
+ if (existingInitialWrite !== undefined) {
773
+ // update case: use the initial write's timestamp
774
+ return existingInitialWrite.descriptor.messageTimestamp;
775
+ }
776
+ // initial write case: validate against the latest protocol definition
777
+ return undefined;
778
+ });
779
+ }
604
780
  static getTypeName(protocolPath) {
605
781
  return protocolPath.split('/').slice(-1)[0];
606
782
  }
@@ -1 +1 @@
1
- {"version":3,"file":"protocol-authorization.js","sourceRoot":"","sources":["../../../../src/core/protocol-authorization.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AASA,OAAO,GAAG,MAAM,kBAAkB,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5E,MAAM,OAAO,qBAAqB;IAEhC;;;OAGG;IACI,MAAM,CAAO,4BAA4B,CAC9C,MAAc,EACd,eAA6B,EAC7B,YAA0B;;YAE1B,gCAAgC;YAChC,MAAM,kBAAkB,GAAG,MAAM,qBAAqB,CAAC,uBAAuB,CAC5E,MAAM,EACN,eAAe,CAAC,OAAO,CAAC,UAAU,CAAC,QAAS,EAC5C,YAAY,CACb,CAAC;YAEF,8FAA8F;YAC9F,qBAAqB,CAAC,UAAU,CAC9B,eAAe,CAAC,OAAO,EACvB,kBAAkB,CAAC,KAAK,CACzB,CAAC;YAEF,0BAA0B;YAC1B,MAAM,qBAAqB,CAAC,8BAA8B,CACxD,MAAM,EACN,eAAe,EACf,YAAY,CACb,CAAC;YAEF,2CAA2C;YAC3C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CAAC;YAC7B,CAAC,EAAE,CAAC;QACN,CAAC;QAED,OAAO,cAAc,CAAC;IACxB,CAAC;IAED;;;OAGG;IACK,MAAM,CAAO,UAAU,CAC7B,MAAc,EACd,UAA8B,EAC9B,WAAkC;;YAElC,4CAA4C;YAC5C,MAAM,oBAAoB,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,mBAAmB,EAAE,EAAE,CACpE,mBAAmB,CAAC,UAAU,CAAC,YAAY,KAAK,UAAU,CAAC,EAAG,CAC/D,CAAC;YAEF,IAAI,oBAAoB,KAAK,SAAS,EAAE,CAAC;gBACvC,6EAA6E;gBAC7E,qEAAqE;gBACrE,qEAAqE;gBACrE,OAAO,KAAK,CAAC;YACf,CAAC;YAED,IAAI,UAAU,CAAC,GAAG,KAAK,aAAa,CAAC,SAAS,EAAE,CAAC;gBAC/C,+EAA+E;gBAC/E,OAAO,MAAM,KAAK,oBAAoB,CAAC,UAAU,CAAC,SAAS,CAAC;YAC9D,CAAC;iBAAM,CAAC,CAAC,0CAA0C;gBACjD,4EAA4E;gBAC5E,MAAM,cAAc,GAAG,CAAC,MAAM,YAAY,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC,MAAM,CAAC;gBAC/E,OAAO,MAAM,KAAK,cAAc,CAAC;YACnC,CAAC;QACH,CAAC;KAAA;IAEO,MAAM,CAAC,WAAW,CAAC,YAAoB;QAC7C,OAAO,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9C,CAAC;CACF"}
1
+ {"version":3,"file":"protocol-authorization.js","sourceRoot":"","sources":["../../../../src/core/protocol-authorization.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAYA,OAAO,GAAG,MAAM,kBAAkB,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,C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