@nmshd/transport 2.8.2 → 5.0.0-alpha.10

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 (283) hide show
  1. package/dist/buildInformation.js +5 -5
  2. package/dist/core/CoreErrors.d.ts +7 -5
  3. package/dist/core/CoreErrors.d.ts.map +1 -1
  4. package/dist/core/CoreErrors.js +16 -10
  5. package/dist/core/CoreErrors.js.map +1 -1
  6. package/dist/core/ICacheable.js +1 -2
  7. package/dist/core/ICacheable.js.map +1 -1
  8. package/dist/core/Transport.d.ts +2 -5
  9. package/dist/core/Transport.d.ts.map +1 -1
  10. package/dist/core/Transport.js +0 -5
  11. package/dist/core/Transport.js.map +1 -1
  12. package/dist/core/backbone/BackboneIds.d.ts +0 -1
  13. package/dist/core/backbone/BackboneIds.d.ts.map +1 -1
  14. package/dist/core/backbone/BackboneIds.js +0 -1
  15. package/dist/core/backbone/BackboneIds.js.map +1 -1
  16. package/dist/core/backbone/Paginator.d.ts.map +1 -1
  17. package/dist/core/backbone/RESTClient.d.ts +0 -3
  18. package/dist/core/backbone/RESTClient.d.ts.map +1 -1
  19. package/dist/core/backbone/RESTClientAuthenticate.d.ts +0 -1
  20. package/dist/core/backbone/RESTClientAuthenticate.d.ts.map +1 -1
  21. package/dist/core/backbone/RequestError.d.ts +2 -2
  22. package/dist/core/backbone/RequestError.d.ts.map +1 -1
  23. package/dist/core/index.d.ts +0 -1
  24. package/dist/core/index.d.ts.map +1 -1
  25. package/dist/core/index.js +0 -1
  26. package/dist/core/index.js.map +1 -1
  27. package/dist/core/logging/logExecutionTime.js +2 -3
  28. package/dist/core/logging/logExecutionTime.js.map +1 -1
  29. package/dist/events/RelationshipDecomposedBySelfEvent.d.ts +10 -0
  30. package/dist/events/RelationshipDecomposedBySelfEvent.d.ts.map +1 -0
  31. package/dist/events/RelationshipDecomposedBySelfEvent.js +12 -0
  32. package/dist/events/RelationshipDecomposedBySelfEvent.js.map +1 -0
  33. package/dist/events/RelationshipReactivationCompletedEvent.d.ts +7 -0
  34. package/dist/events/RelationshipReactivationCompletedEvent.d.ts.map +1 -0
  35. package/dist/events/RelationshipReactivationCompletedEvent.js +12 -0
  36. package/dist/events/RelationshipReactivationCompletedEvent.js.map +1 -0
  37. package/dist/events/RelationshipReactivationRequestedEvent.d.ts +7 -0
  38. package/dist/events/RelationshipReactivationRequestedEvent.d.ts.map +1 -0
  39. package/dist/events/RelationshipReactivationRequestedEvent.js +12 -0
  40. package/dist/events/RelationshipReactivationRequestedEvent.js.map +1 -0
  41. package/dist/events/index.d.ts +3 -0
  42. package/dist/events/index.d.ts.map +1 -1
  43. package/dist/events/index.js +3 -0
  44. package/dist/events/index.js.map +1 -1
  45. package/dist/modules/accounts/AccountController.d.ts +8 -7
  46. package/dist/modules/accounts/AccountController.d.ts.map +1 -1
  47. package/dist/modules/accounts/AccountController.js +18 -17
  48. package/dist/modules/accounts/AccountController.js.map +1 -1
  49. package/dist/modules/accounts/IdentityController.d.ts +0 -2
  50. package/dist/modules/accounts/IdentityController.d.ts.map +1 -1
  51. package/dist/modules/accounts/IdentityController.js +0 -3
  52. package/dist/modules/accounts/IdentityController.js.map +1 -1
  53. package/dist/modules/accounts/IdentityDeletionProcessController.js.map +1 -1
  54. package/dist/modules/accounts/IdentityUtil.d.ts +2 -2
  55. package/dist/modules/accounts/IdentityUtil.d.ts.map +1 -1
  56. package/dist/modules/accounts/IdentityUtil.js +23 -26
  57. package/dist/modules/accounts/IdentityUtil.js.map +1 -1
  58. package/dist/modules/accounts/data/Identity.d.ts +0 -3
  59. package/dist/modules/accounts/data/Identity.d.ts.map +1 -1
  60. package/dist/modules/accounts/data/Identity.js +0 -6
  61. package/dist/modules/accounts/data/Identity.js.map +1 -1
  62. package/dist/modules/accounts/data/IdentitySecretCredentials.d.ts +0 -3
  63. package/dist/modules/accounts/data/IdentitySecretCredentials.d.ts.map +1 -1
  64. package/dist/modules/accounts/data/IdentitySecretCredentials.js +0 -6
  65. package/dist/modules/accounts/data/IdentitySecretCredentials.js.map +1 -1
  66. package/dist/modules/challenges/ChallengeController.d.ts.map +1 -1
  67. package/dist/modules/challenges/ChallengeController.js +3 -2
  68. package/dist/modules/challenges/ChallengeController.js.map +1 -1
  69. package/dist/modules/devices/DeviceController.d.ts +1 -0
  70. package/dist/modules/devices/DeviceController.d.ts.map +1 -1
  71. package/dist/modules/devices/DeviceController.js +6 -0
  72. package/dist/modules/devices/DeviceController.js.map +1 -1
  73. package/dist/modules/devices/backbone/BackboneUpdateDevice.d.ts +4 -0
  74. package/dist/modules/devices/backbone/BackboneUpdateDevice.d.ts.map +1 -0
  75. package/dist/modules/{relationships/backbone/BackboneGetRelationshipsChanges.js → devices/backbone/BackboneUpdateDevice.js} +1 -1
  76. package/dist/modules/devices/backbone/BackboneUpdateDevice.js.map +1 -0
  77. package/dist/modules/devices/backbone/DeviceAuthClient.d.ts +2 -0
  78. package/dist/modules/devices/backbone/DeviceAuthClient.d.ts.map +1 -1
  79. package/dist/modules/devices/backbone/DeviceAuthClient.js +3 -0
  80. package/dist/modules/devices/backbone/DeviceAuthClient.js.map +1 -1
  81. package/dist/modules/devices/local/Device.d.ts.map +1 -1
  82. package/dist/modules/devices/local/Device.js +3 -1
  83. package/dist/modules/devices/local/Device.js.map +1 -1
  84. package/dist/modules/files/FileController.d.ts.map +1 -1
  85. package/dist/modules/files/FileController.js +6 -1
  86. package/dist/modules/files/FileController.js.map +1 -1
  87. package/dist/modules/files/backbone/FileClient.d.ts +0 -1
  88. package/dist/modules/files/backbone/FileClient.d.ts.map +1 -1
  89. package/dist/modules/index.d.ts +12 -15
  90. package/dist/modules/index.d.ts.map +1 -1
  91. package/dist/modules/index.js +12 -17
  92. package/dist/modules/index.js.map +1 -1
  93. package/dist/modules/messages/MessageController.d.ts +3 -0
  94. package/dist/modules/messages/MessageController.d.ts.map +1 -1
  95. package/dist/modules/messages/MessageController.js +85 -17
  96. package/dist/modules/messages/MessageController.js.map +1 -1
  97. package/dist/modules/messages/local/CachedMessage.d.ts +3 -3
  98. package/dist/modules/messages/local/CachedMessage.d.ts.map +1 -1
  99. package/dist/modules/messages/local/CachedMessage.js +2 -2
  100. package/dist/modules/messages/local/CachedMessage.js.map +1 -1
  101. package/dist/modules/messages/local/CachedMessageRecipient.d.ts +19 -0
  102. package/dist/modules/messages/local/CachedMessageRecipient.d.ts.map +1 -0
  103. package/dist/modules/{relationships/transmission/changes/RelationshipChangeRequest.js → messages/local/CachedMessageRecipient.js} +23 -25
  104. package/dist/modules/messages/local/CachedMessageRecipient.js.map +1 -0
  105. package/dist/modules/messages/local/Message.d.ts +1 -3
  106. package/dist/modules/messages/local/Message.d.ts.map +1 -1
  107. package/dist/modules/messages/local/Message.js +1 -12
  108. package/dist/modules/messages/local/Message.js.map +1 -1
  109. package/dist/modules/relationshipTemplates/RelationshipTemplateController.d.ts +2 -0
  110. package/dist/modules/relationshipTemplates/RelationshipTemplateController.d.ts.map +1 -1
  111. package/dist/modules/relationshipTemplates/RelationshipTemplateController.js +21 -2
  112. package/dist/modules/relationshipTemplates/RelationshipTemplateController.js.map +1 -1
  113. package/dist/modules/relationshipTemplates/local/CachedRelationshipTemplate.js +2 -2
  114. package/dist/modules/relationshipTemplates/local/CachedRelationshipTemplate.js.map +1 -1
  115. package/dist/modules/relationships/RelationshipSecretController.d.ts +4 -5
  116. package/dist/modules/relationships/RelationshipSecretController.d.ts.map +1 -1
  117. package/dist/modules/relationships/RelationshipSecretController.js +8 -8
  118. package/dist/modules/relationships/RelationshipSecretController.js.map +1 -1
  119. package/dist/modules/relationships/RelationshipsController.d.ts +22 -23
  120. package/dist/modules/relationships/RelationshipsController.d.ts.map +1 -1
  121. package/dist/modules/relationships/RelationshipsController.js +272 -324
  122. package/dist/modules/relationships/RelationshipsController.js.map +1 -1
  123. package/dist/modules/relationships/backbone/BackboneGetRelationships.d.ts +2 -11
  124. package/dist/modules/relationships/backbone/BackboneGetRelationships.d.ts.map +1 -1
  125. package/dist/modules/relationships/backbone/BackbonePostRelationship.d.ts +7 -0
  126. package/dist/modules/relationships/backbone/BackbonePostRelationship.d.ts.map +1 -0
  127. package/dist/modules/relationships/backbone/{BackbonePostRelationshipsChanges.js → BackbonePostRelationship.js} +1 -1
  128. package/dist/modules/relationships/backbone/BackbonePostRelationship.js.map +1 -0
  129. package/dist/modules/relationships/backbone/BackbonePutRelationship.d.ts +6 -0
  130. package/dist/modules/relationships/backbone/BackbonePutRelationship.d.ts.map +1 -0
  131. package/dist/modules/relationships/backbone/BackbonePutRelationship.js +3 -0
  132. package/dist/modules/relationships/backbone/BackbonePutRelationship.js.map +1 -0
  133. package/dist/modules/relationships/backbone/BackboneRelationship.d.ts +14 -0
  134. package/dist/modules/relationships/backbone/BackboneRelationship.d.ts.map +1 -0
  135. package/dist/modules/relationships/backbone/BackboneRelationship.js +3 -0
  136. package/dist/modules/relationships/backbone/BackboneRelationship.js.map +1 -0
  137. package/dist/modules/relationships/backbone/RelationshipClient.d.ts +15 -12
  138. package/dist/modules/relationships/backbone/RelationshipClient.d.ts.map +1 -1
  139. package/dist/modules/relationships/backbone/RelationshipClient.js +23 -21
  140. package/dist/modules/relationships/backbone/RelationshipClient.js.map +1 -1
  141. package/dist/modules/relationships/local/CachedRelationship.d.ts +6 -4
  142. package/dist/modules/relationships/local/CachedRelationship.d.ts.map +1 -1
  143. package/dist/modules/relationships/local/CachedRelationship.js +10 -8
  144. package/dist/modules/relationships/local/CachedRelationship.js.map +1 -1
  145. package/dist/modules/relationships/local/Relationship.d.ts +3 -8
  146. package/dist/modules/relationships/local/Relationship.d.ts.map +1 -1
  147. package/dist/modules/relationships/local/Relationship.js +5 -35
  148. package/dist/modules/relationships/local/Relationship.js.map +1 -1
  149. package/dist/modules/relationships/local/RelationshipAuditLog.d.ts +6 -0
  150. package/dist/modules/relationships/local/RelationshipAuditLog.d.ts.map +1 -0
  151. package/dist/modules/relationships/local/RelationshipAuditLog.js +26 -0
  152. package/dist/modules/relationships/local/RelationshipAuditLog.js.map +1 -0
  153. package/dist/modules/relationships/local/RelationshipAuditLogEntry.d.ts +21 -0
  154. package/dist/modules/relationships/local/RelationshipAuditLogEntry.d.ts.map +1 -0
  155. package/dist/modules/relationships/local/RelationshipAuditLogEntry.js +63 -0
  156. package/dist/modules/relationships/local/RelationshipAuditLogEntry.js.map +1 -0
  157. package/dist/modules/relationships/local/SendRelationshipParameters.d.ts +2 -2
  158. package/dist/modules/relationships/local/SendRelationshipParameters.d.ts.map +1 -1
  159. package/dist/modules/relationships/local/SendRelationshipParameters.js +1 -1
  160. package/dist/modules/relationships/local/SendRelationshipParameters.js.map +1 -1
  161. package/dist/modules/relationships/transmission/RelationshipAuditLog.d.ts +24 -0
  162. package/dist/modules/relationships/transmission/RelationshipAuditLog.d.ts.map +1 -0
  163. package/dist/modules/relationships/transmission/RelationshipAuditLog.js +17 -0
  164. package/dist/modules/relationships/transmission/RelationshipAuditLog.js.map +1 -0
  165. package/dist/modules/relationships/transmission/RelationshipStatus.d.ts +2 -2
  166. package/dist/modules/relationships/transmission/RelationshipStatus.d.ts.map +1 -1
  167. package/dist/modules/relationships/transmission/RelationshipStatus.js +1 -1
  168. package/dist/modules/relationships/transmission/RelationshipStatus.js.map +1 -1
  169. package/dist/modules/relationships/transmission/requests/RelationshipCreationContentCipher.d.ts +13 -0
  170. package/dist/modules/relationships/transmission/requests/RelationshipCreationContentCipher.d.ts.map +1 -0
  171. package/dist/modules/relationships/transmission/requests/{RelationshipCreationChangeRequestCipher.js → RelationshipCreationContentCipher.js} +9 -9
  172. package/dist/modules/relationships/transmission/requests/RelationshipCreationContentCipher.js.map +1 -0
  173. package/dist/modules/relationships/transmission/requests/RelationshipCreationContentSigned.d.ts +14 -0
  174. package/dist/modules/relationships/transmission/requests/RelationshipCreationContentSigned.d.ts.map +1 -0
  175. package/dist/modules/relationships/transmission/requests/{RelationshipCreationChangeRequestSigned.js → RelationshipCreationContentSigned.js} +10 -10
  176. package/dist/modules/relationships/transmission/requests/RelationshipCreationContentSigned.js.map +1 -0
  177. package/dist/modules/relationships/transmission/requests/RelationshipCreationContentWrapper.d.ts +15 -0
  178. package/dist/modules/relationships/transmission/requests/RelationshipCreationContentWrapper.d.ts.map +1 -0
  179. package/dist/modules/relationships/transmission/requests/{RelationshipCreationChangeRequestContentWrapper.js → RelationshipCreationContentWrapper.js} +10 -10
  180. package/dist/modules/relationships/transmission/requests/RelationshipCreationContentWrapper.js.map +1 -0
  181. package/dist/modules/relationships/transmission/responses/RelationshipCreationResponseContentCipher.d.ts +13 -0
  182. package/dist/modules/relationships/transmission/responses/RelationshipCreationResponseContentCipher.d.ts.map +1 -0
  183. package/dist/modules/relationships/transmission/responses/{RelationshipCreationChangeResponseCipher.js → RelationshipCreationResponseContentCipher.js} +10 -10
  184. package/dist/modules/relationships/transmission/responses/RelationshipCreationResponseContentCipher.js.map +1 -0
  185. package/dist/modules/relationships/transmission/responses/RelationshipCreationResponseContentSigned.d.ts +14 -0
  186. package/dist/modules/relationships/transmission/responses/RelationshipCreationResponseContentSigned.d.ts.map +1 -0
  187. package/dist/modules/relationships/transmission/responses/{RelationshipCreationChangeResponseSigned.js → RelationshipCreationResponseContentSigned.js} +10 -10
  188. package/dist/modules/relationships/transmission/responses/RelationshipCreationResponseContentSigned.js.map +1 -0
  189. package/dist/modules/relationships/transmission/responses/RelationshipCreationResponseContentWrapper.d.ts +9 -0
  190. package/dist/modules/relationships/transmission/responses/RelationshipCreationResponseContentWrapper.d.ts.map +1 -0
  191. package/dist/modules/relationships/transmission/responses/{RelationshipCreationChangeResponseContentWrapper.js → RelationshipCreationResponseContentWrapper.js} +8 -13
  192. package/dist/modules/relationships/transmission/responses/RelationshipCreationResponseContentWrapper.js.map +1 -0
  193. package/dist/modules/sync/DatawalletModificationsProcessor.d.ts +1 -3
  194. package/dist/modules/sync/DatawalletModificationsProcessor.d.ts.map +1 -1
  195. package/dist/modules/sync/DatawalletModificationsProcessor.js +4 -14
  196. package/dist/modules/sync/DatawalletModificationsProcessor.js.map +1 -1
  197. package/dist/modules/sync/SyncController.d.ts +3 -4
  198. package/dist/modules/sync/SyncController.d.ts.map +1 -1
  199. package/dist/modules/sync/SyncController.js +32 -46
  200. package/dist/modules/sync/SyncController.js.map +1 -1
  201. package/dist/modules/sync/SynchronizedCollection.d.ts.map +1 -1
  202. package/dist/modules/sync/externalEventProcessors/ExternalEventProcessorRegistry.d.ts.map +1 -1
  203. package/dist/modules/sync/externalEventProcessors/ExternalEventProcessorRegistry.js +6 -4
  204. package/dist/modules/sync/externalEventProcessors/ExternalEventProcessorRegistry.js.map +1 -1
  205. package/dist/modules/sync/externalEventProcessors/{RelationshipChangeCompletedExternalEventProcessor.d.ts → RelationshipReactivationCompletedExternalEventProcessor.d.ts} +2 -2
  206. package/dist/modules/sync/externalEventProcessors/RelationshipReactivationCompletedExternalEventProcessor.d.ts.map +1 -0
  207. package/dist/modules/sync/externalEventProcessors/{RelationshipChangeCompletedExternalEventProcessor.js → RelationshipReactivationCompletedExternalEventProcessor.js} +11 -13
  208. package/dist/modules/sync/externalEventProcessors/RelationshipReactivationCompletedExternalEventProcessor.js.map +1 -0
  209. package/dist/modules/sync/externalEventProcessors/RelationshipReactivationRequestedExternalEventProcessor.d.ts +7 -0
  210. package/dist/modules/sync/externalEventProcessors/RelationshipReactivationRequestedExternalEventProcessor.d.ts.map +1 -0
  211. package/dist/modules/sync/externalEventProcessors/RelationshipReactivationRequestedExternalEventProcessor.js +33 -0
  212. package/dist/modules/sync/externalEventProcessors/RelationshipReactivationRequestedExternalEventProcessor.js.map +1 -0
  213. package/dist/modules/sync/externalEventProcessors/{RelationshipChangeCreatedExternalEventProcessor.d.ts → RelationshipStatusChangedExternalEventProcessor.d.ts} +2 -2
  214. package/dist/modules/sync/externalEventProcessors/{RelationshipChangeCreatedExternalEventProcessor.d.ts.map → RelationshipStatusChangedExternalEventProcessor.d.ts.map} +1 -1
  215. package/dist/modules/sync/externalEventProcessors/{RelationshipChangeCreatedExternalEventProcessor.js → RelationshipStatusChangedExternalEventProcessor.js} +10 -18
  216. package/dist/modules/sync/externalEventProcessors/RelationshipStatusChangedExternalEventProcessor.js.map +1 -0
  217. package/dist/modules/sync/externalEventProcessors/index.d.ts +3 -2
  218. package/dist/modules/sync/externalEventProcessors/index.d.ts.map +1 -1
  219. package/dist/modules/sync/externalEventProcessors/index.js +3 -2
  220. package/dist/modules/sync/externalEventProcessors/index.js.map +1 -1
  221. package/dist/modules/tokens/TokenController.d.ts +2 -1
  222. package/dist/modules/tokens/TokenController.d.ts.map +1 -1
  223. package/dist/modules/tokens/TokenController.js +13 -1
  224. package/dist/modules/tokens/TokenController.js.map +1 -1
  225. package/package.json +5 -5
  226. package/dist/core/ProgressReporter.d.ts +0 -19
  227. package/dist/core/ProgressReporter.d.ts.map +0 -1
  228. package/dist/core/ProgressReporter.js +0 -43
  229. package/dist/core/ProgressReporter.js.map +0 -1
  230. package/dist/modules/accounts/data/Realm.d.ts +0 -6
  231. package/dist/modules/accounts/data/Realm.d.ts.map +0 -1
  232. package/dist/modules/accounts/data/Realm.js +0 -10
  233. package/dist/modules/accounts/data/Realm.js.map +0 -1
  234. package/dist/modules/relationships/backbone/BackboneGetRelationshipsChanges.d.ts +0 -24
  235. package/dist/modules/relationships/backbone/BackboneGetRelationshipsChanges.d.ts.map +0 -1
  236. package/dist/modules/relationships/backbone/BackboneGetRelationshipsChanges.js.map +0 -1
  237. package/dist/modules/relationships/backbone/BackbonePostRelationshipsChanges.d.ts +0 -9
  238. package/dist/modules/relationships/backbone/BackbonePostRelationshipsChanges.d.ts.map +0 -1
  239. package/dist/modules/relationships/backbone/BackbonePostRelationshipsChanges.js.map +0 -1
  240. package/dist/modules/relationships/transmission/changes/RelationshipChange.d.ts +0 -27
  241. package/dist/modules/relationships/transmission/changes/RelationshipChange.d.ts.map +0 -1
  242. package/dist/modules/relationships/transmission/changes/RelationshipChange.js +0 -72
  243. package/dist/modules/relationships/transmission/changes/RelationshipChange.js.map +0 -1
  244. package/dist/modules/relationships/transmission/changes/RelationshipChangeRequest.d.ts +0 -20
  245. package/dist/modules/relationships/transmission/changes/RelationshipChangeRequest.d.ts.map +0 -1
  246. package/dist/modules/relationships/transmission/changes/RelationshipChangeRequest.js.map +0 -1
  247. package/dist/modules/relationships/transmission/changes/RelationshipChangeResponse.d.ts +0 -20
  248. package/dist/modules/relationships/transmission/changes/RelationshipChangeResponse.d.ts.map +0 -1
  249. package/dist/modules/relationships/transmission/changes/RelationshipChangeResponse.js +0 -53
  250. package/dist/modules/relationships/transmission/changes/RelationshipChangeResponse.js.map +0 -1
  251. package/dist/modules/relationships/transmission/changes/RelationshipChangeStatus.d.ts +0 -7
  252. package/dist/modules/relationships/transmission/changes/RelationshipChangeStatus.d.ts.map +0 -1
  253. package/dist/modules/relationships/transmission/changes/RelationshipChangeStatus.js +0 -11
  254. package/dist/modules/relationships/transmission/changes/RelationshipChangeStatus.js.map +0 -1
  255. package/dist/modules/relationships/transmission/changes/RelationshipChangeType.d.ts +0 -6
  256. package/dist/modules/relationships/transmission/changes/RelationshipChangeType.d.ts.map +0 -1
  257. package/dist/modules/relationships/transmission/changes/RelationshipChangeType.js +0 -10
  258. package/dist/modules/relationships/transmission/changes/RelationshipChangeType.js.map +0 -1
  259. package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestCipher.d.ts +0 -13
  260. package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestCipher.d.ts.map +0 -1
  261. package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestCipher.js.map +0 -1
  262. package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestContentWrapper.d.ts +0 -15
  263. package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestContentWrapper.d.ts.map +0 -1
  264. package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestContentWrapper.js.map +0 -1
  265. package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestSigned.d.ts +0 -14
  266. package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestSigned.d.ts.map +0 -1
  267. package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestSigned.js.map +0 -1
  268. package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseCipher.d.ts +0 -13
  269. package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseCipher.d.ts.map +0 -1
  270. package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseCipher.js.map +0 -1
  271. package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseContentWrapper.d.ts +0 -12
  272. package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseContentWrapper.d.ts.map +0 -1
  273. package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseContentWrapper.js.map +0 -1
  274. package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseSigned.d.ts +0 -14
  275. package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseSigned.d.ts.map +0 -1
  276. package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseSigned.js.map +0 -1
  277. package/dist/modules/sync/SyncCallback.d.ts +0 -18
  278. package/dist/modules/sync/SyncCallback.d.ts.map +0 -1
  279. package/dist/modules/sync/SyncCallback.js +0 -25
  280. package/dist/modules/sync/SyncCallback.js.map +0 -1
  281. package/dist/modules/sync/externalEventProcessors/RelationshipChangeCompletedExternalEventProcessor.d.ts.map +0 -1
  282. package/dist/modules/sync/externalEventProcessors/RelationshipChangeCompletedExternalEventProcessor.js.map +0 -1
  283. package/dist/modules/sync/externalEventProcessors/RelationshipChangeCreatedExternalEventProcessor.js.map +0 -1
@@ -23,18 +23,16 @@ const RelationshipTemplate_1 = require("../relationshipTemplates/local/Relations
23
23
  const RelationshipClient_1 = require("./backbone/RelationshipClient");
24
24
  const CachedRelationship_1 = require("./local/CachedRelationship");
25
25
  const Relationship_1 = require("./local/Relationship");
26
+ const RelationshipAuditLog_1 = require("./local/RelationshipAuditLog");
26
27
  const SendRelationshipParameters_1 = require("./local/SendRelationshipParameters");
27
- const RelationshipChange_1 = require("./transmission/changes/RelationshipChange");
28
- const RelationshipChangeResponse_1 = require("./transmission/changes/RelationshipChangeResponse");
29
- const RelationshipChangeStatus_1 = require("./transmission/changes/RelationshipChangeStatus");
30
- const RelationshipChangeType_1 = require("./transmission/changes/RelationshipChangeType");
28
+ const RelationshipAuditLog_2 = require("./transmission/RelationshipAuditLog");
31
29
  const RelationshipStatus_1 = require("./transmission/RelationshipStatus");
32
- const RelationshipCreationChangeRequestCipher_1 = require("./transmission/requests/RelationshipCreationChangeRequestCipher");
33
- const RelationshipCreationChangeRequestContentWrapper_1 = require("./transmission/requests/RelationshipCreationChangeRequestContentWrapper");
34
- const RelationshipCreationChangeRequestSigned_1 = require("./transmission/requests/RelationshipCreationChangeRequestSigned");
35
- const RelationshipCreationChangeResponseCipher_1 = require("./transmission/responses/RelationshipCreationChangeResponseCipher");
36
- const RelationshipCreationChangeResponseContentWrapper_1 = require("./transmission/responses/RelationshipCreationChangeResponseContentWrapper");
37
- const RelationshipCreationChangeResponseSigned_1 = require("./transmission/responses/RelationshipCreationChangeResponseSigned");
30
+ const RelationshipCreationContentCipher_1 = require("./transmission/requests/RelationshipCreationContentCipher");
31
+ const RelationshipCreationContentSigned_1 = require("./transmission/requests/RelationshipCreationContentSigned");
32
+ const RelationshipCreationContentWrapper_1 = require("./transmission/requests/RelationshipCreationContentWrapper");
33
+ const RelationshipCreationResponseContentCipher_1 = require("./transmission/responses/RelationshipCreationResponseContentCipher");
34
+ const RelationshipCreationResponseContentSigned_1 = require("./transmission/responses/RelationshipCreationResponseContentSigned");
35
+ const RelationshipCreationResponseContentWrapper_1 = require("./transmission/responses/RelationshipCreationResponseContentWrapper");
38
36
  class RelationshipsController extends core_1.TransportController {
39
37
  constructor(parent, secrets) {
40
38
  super(core_1.ControllerName.Relationships, parent);
@@ -48,7 +46,8 @@ class RelationshipsController extends core_1.TransportController {
48
46
  }
49
47
  async getRelationships(query) {
50
48
  const relationshipDocs = await this.relationships.find(query);
51
- return this.parseArray(relationshipDocs, Relationship_1.Relationship);
49
+ const relationships = this.parseArray(relationshipDocs, Relationship_1.Relationship);
50
+ return relationships;
52
51
  }
53
52
  async updateCache(ids) {
54
53
  if (ids.length < 1) {
@@ -57,7 +56,7 @@ class RelationshipsController extends core_1.TransportController {
57
56
  const resultItems = (await this.client.getRelationships({ ids })).value;
58
57
  const promises = [];
59
58
  for await (const resultItem of resultItems) {
60
- promises.push(this.updateCacheOfExistingRelationshipInDb(resultItem.id, resultItem));
59
+ promises.push(this.updateExistingRelationshipInDb(resultItem.id, resultItem));
61
60
  }
62
61
  return await Promise.all(promises);
63
62
  }
@@ -67,20 +66,26 @@ class RelationshipsController extends core_1.TransportController {
67
66
  const backboneRelationships = await (await this.client.getRelationships({ ids: ids.map((id) => id.id) })).value.collect();
68
67
  const decryptionPromises = backboneRelationships.map(async (r) => {
69
68
  const relationshipDoc = await this.relationships.read(r.id);
69
+ if (!relationshipDoc) {
70
+ this._log.error(`Relationship '${r.id}' not found in local database and the cache fetching was therefore skipped. This should not happen and might be a bug in the application logic.`);
71
+ return;
72
+ }
70
73
  const relationship = Relationship_1.Relationship.from(relationshipDoc);
71
74
  return {
72
75
  id: core_1.CoreId.from(r.id),
73
76
  cache: await this.decryptRelationship(r, relationship.relationshipSecretId)
74
77
  };
75
78
  });
76
- return await Promise.all(decryptionPromises);
79
+ const caches = await Promise.all(decryptionPromises);
80
+ return caches.filter((c) => c !== undefined);
77
81
  }
78
- async updateCacheOfExistingRelationshipInDb(id, response) {
82
+ async updateExistingRelationshipInDb(id, response) {
79
83
  const relationshipDoc = await this.relationships.read(id);
80
84
  if (!relationshipDoc)
81
85
  throw CoreErrors_1.CoreErrors.general.recordNotFound(Relationship_1.Relationship, id);
82
86
  const relationship = Relationship_1.Relationship.from(relationshipDoc);
83
87
  await this.updateCacheOfRelationship(relationship, response);
88
+ relationship.status = response.status;
84
89
  await this.relationships.update(relationshipDoc, relationship);
85
90
  return relationship;
86
91
  }
@@ -88,19 +93,15 @@ class RelationshipsController extends core_1.TransportController {
88
93
  const query = { peerAddress: address.toString() };
89
94
  if (status)
90
95
  query[`${(0, ts_simple_nameof_1.nameof)((r) => r.status)}`] = status;
91
- let relationshipDoc = await this.relationships.findOne(query);
92
- if (!relationshipDoc) {
93
- // If we don't find the relationship by peerAddress, we have to check again by peer.address
94
- // as the Relationship could have been created before the peerAddress was introduced
95
- const query = { [`${(0, ts_simple_nameof_1.nameof)((r) => r.peer)}.${(0, ts_simple_nameof_1.nameof)((r) => r.address)}`]: address.toString() };
96
- if (status)
97
- query[`${(0, ts_simple_nameof_1.nameof)((r) => r.status)}`] = status;
98
- relationshipDoc = await this.relationships.findOne(query);
99
- }
100
- if (!relationshipDoc) {
101
- return;
102
- }
103
- return Relationship_1.Relationship.from(relationshipDoc);
96
+ const relationships = await this.relationships.find(query);
97
+ if (relationships.length === 0)
98
+ return undefined;
99
+ if (relationships.length === 1)
100
+ return Relationship_1.Relationship.from(relationships[0]);
101
+ const newestRelationship = relationships.reduce((prev, current) => {
102
+ return prev.createdAt > current.createdAt ? prev : current;
103
+ });
104
+ return Relationship_1.Relationship.from(newestRelationship);
104
105
  }
105
106
  async getActiveRelationshipToIdentity(address) {
106
107
  return await this.getRelationshipToIdentity(address, RelationshipStatus_1.RelationshipStatus.Active);
@@ -110,7 +111,8 @@ class RelationshipsController extends core_1.TransportController {
110
111
  if (!relationshipDoc) {
111
112
  return;
112
113
  }
113
- return Relationship_1.Relationship.from(relationshipDoc);
114
+ const relationship = Relationship_1.Relationship.from(relationshipDoc);
115
+ return relationship;
114
116
  }
115
117
  async sign(relationship, content) {
116
118
  return await this.secrets.sign(relationship.relationshipSecretId, content);
@@ -128,9 +130,9 @@ class RelationshipsController extends core_1.TransportController {
128
130
  throw this.newCacheEmptyError(RelationshipTemplate_1.RelationshipTemplate, template.id.toString());
129
131
  }
130
132
  const secretId = await TransportIds_1.TransportIds.relationshipSecret.generate();
131
- const { requestCipher, requestContent } = await this.prepareRequest(secretId, template, parameters.content);
133
+ const creationContentCipher = await this.prepareCreationContent(secretId, template, parameters.creationContent);
132
134
  const result = await this.client.createRelationship({
133
- content: requestCipher.toBase64(),
135
+ creationContent: creationContentCipher.toBase64(),
134
136
  relationshipTemplateId: template.id.toString()
135
137
  });
136
138
  if (result.isError) {
@@ -140,7 +142,7 @@ class RelationshipsController extends core_1.TransportController {
140
142
  throw result.error;
141
143
  }
142
144
  const backboneResponse = result.value;
143
- const newRelationship = Relationship_1.Relationship.fromRequestSent(core_1.CoreId.from(backboneResponse.id), template, template.cache.identity, RelationshipChange_1.RelationshipChange.fromBackbone(backboneResponse.changes[0], requestContent.content), secretId);
145
+ const newRelationship = Relationship_1.Relationship.fromBackboneAndCreationContent(backboneResponse, template, template.cache.identity, parameters.creationContent, secretId);
144
146
  await this.relationships.create(newRelationship);
145
147
  this.eventBus.publish(new events_1.RelationshipChangedEvent(this.parent.identity.address.toString(), newRelationship));
146
148
  return newRelationship;
@@ -156,14 +158,113 @@ class RelationshipsController extends core_1.TransportController {
156
158
  await this.relationships.update(relationshipDoc, relationship);
157
159
  return relationship;
158
160
  }
159
- async acceptChange(change, content) {
160
- return await this.completeChange(RelationshipChangeStatus_1.RelationshipChangeStatus.Accepted, change, content);
161
+ async accept(relationshipId) {
162
+ const relationship = await this.getRelationshipWithCache(relationshipId);
163
+ this.assertRelationshipStatus(relationship, RelationshipStatus_1.RelationshipStatus.Pending);
164
+ const lastAuditLogEntry = relationship.cache.auditLog[relationship.cache.auditLog.length - 1];
165
+ if (!lastAuditLogEntry.createdBy.equals(relationship.peer.address)) {
166
+ throw CoreErrors_1.CoreErrors.relationships.operationOnlyAllowedForPeer(`Only your peer can accept the relationship ${relationshipId.toString()}`);
167
+ }
168
+ return await this.completeOperationWithBackboneCall(RelationshipAuditLog_2.RelationshipAuditLogEntryReason.AcceptanceOfCreation, relationshipId);
169
+ }
170
+ async reject(relationshipId) {
171
+ const relationship = await this.getRelationshipWithCache(relationshipId);
172
+ this.assertRelationshipStatus(relationship, RelationshipStatus_1.RelationshipStatus.Pending);
173
+ const lastAuditLogEntry = relationship.cache.auditLog[relationship.cache.auditLog.length - 1];
174
+ if (!lastAuditLogEntry.createdBy.equals(relationship.peer.address)) {
175
+ throw CoreErrors_1.CoreErrors.relationships.operationOnlyAllowedForPeer(`Only your peer can reject the relationship ${relationshipId.toString()}. Revoke the relationship instead.`);
176
+ }
177
+ return await this.completeOperationWithBackboneCall(RelationshipAuditLog_2.RelationshipAuditLogEntryReason.RejectionOfCreation, relationshipId);
178
+ }
179
+ async revoke(relationshipId) {
180
+ const relationship = await this.getRelationshipWithCache(relationshipId);
181
+ this.assertRelationshipStatus(relationship, RelationshipStatus_1.RelationshipStatus.Pending);
182
+ const lastAuditLogEntry = relationship.cache.auditLog[relationship.cache.auditLog.length - 1];
183
+ if (lastAuditLogEntry.createdBy.equals(relationship.peer.address)) {
184
+ throw CoreErrors_1.CoreErrors.relationships.operationOnlyAllowedForPeer(`Only your peer can revoke the relationship ${relationshipId.toString()}. Reject the relationship instead.`);
185
+ }
186
+ return await this.completeOperationWithBackboneCall(RelationshipAuditLog_2.RelationshipAuditLogEntryReason.RevocationOfCreation, relationshipId);
187
+ }
188
+ async terminate(relationshipId) {
189
+ const relationship = await this.getRelationshipWithCache(relationshipId);
190
+ this.assertRelationshipStatus(relationship, RelationshipStatus_1.RelationshipStatus.Active);
191
+ return await this.completeOperationWithBackboneCall(RelationshipAuditLog_2.RelationshipAuditLogEntryReason.Termination, relationshipId);
192
+ }
193
+ async requestReactivation(relationshipId) {
194
+ const relationship = await this.getRelationshipWithCache(relationshipId);
195
+ this.assertRelationshipStatus(relationship, RelationshipStatus_1.RelationshipStatus.Terminated);
196
+ const lastAuditLogEntry = relationship.cache.auditLog[relationship.cache.auditLog.length - 1];
197
+ if (lastAuditLogEntry.reason === RelationshipAuditLog_2.RelationshipAuditLogEntryReason.ReactivationRequested) {
198
+ if (lastAuditLogEntry.createdBy.equals(relationship.peer.address)) {
199
+ throw CoreErrors_1.CoreErrors.relationships.reactivationAlreadyRequested(`Your peer has already requested the reactivation of the relationship ${relationshipId.toString()}. You can accept the reactivation instead.`);
200
+ }
201
+ throw CoreErrors_1.CoreErrors.relationships.reactivationAlreadyRequested(`You have already requested the reactivation of the relationship ${relationshipId.toString()}.`);
202
+ }
203
+ return await this.completeOperationWithBackboneCall(RelationshipAuditLog_2.RelationshipAuditLogEntryReason.ReactivationRequested, relationshipId);
161
204
  }
162
- async rejectChange(change, content) {
163
- return await this.completeChange(RelationshipChangeStatus_1.RelationshipChangeStatus.Rejected, change, content);
205
+ async rejectReactivation(relationshipId) {
206
+ const relationship = await this.getRelationshipWithCache(relationshipId);
207
+ this.assertRelationshipStatus(relationship, RelationshipStatus_1.RelationshipStatus.Terminated);
208
+ const lastAuditLogEntry = relationship.cache.auditLog[relationship.cache.auditLog.length - 1];
209
+ if (lastAuditLogEntry.reason !== RelationshipAuditLog_2.RelationshipAuditLogEntryReason.ReactivationRequested) {
210
+ throw CoreErrors_1.CoreErrors.relationships.reactivationNotRequested(relationshipId.toString());
211
+ }
212
+ if (!lastAuditLogEntry.createdBy.equals(relationship.peer.address)) {
213
+ throw CoreErrors_1.CoreErrors.relationships.operationOnlyAllowedForPeer(`Only your peer can reject the reactivation of the relationship ${relationshipId.toString()}. Revoke the relationship reactivation instead.`);
214
+ }
215
+ return await this.completeOperationWithBackboneCall(RelationshipAuditLog_2.RelationshipAuditLogEntryReason.RejectionOfReactivation, relationshipId);
164
216
  }
165
- async revokeChange(change, content) {
166
- return await this.completeChange(RelationshipChangeStatus_1.RelationshipChangeStatus.Revoked, change, content);
217
+ async revokeReactivation(relationshipId) {
218
+ const relationship = await this.getRelationshipWithCache(relationshipId);
219
+ this.assertRelationshipStatus(relationship, RelationshipStatus_1.RelationshipStatus.Terminated);
220
+ const lastAuditLogEntry = relationship.cache.auditLog[relationship.cache.auditLog.length - 1];
221
+ if (lastAuditLogEntry.reason !== RelationshipAuditLog_2.RelationshipAuditLogEntryReason.ReactivationRequested) {
222
+ throw CoreErrors_1.CoreErrors.relationships.reactivationNotRequested(relationshipId.toString());
223
+ }
224
+ if (lastAuditLogEntry.createdBy.equals(relationship.peer.address)) {
225
+ throw CoreErrors_1.CoreErrors.relationships.operationOnlyAllowedForPeer(`Only your peer can revoke the reactivation of the relationship ${relationshipId.toString()}. Reject the relationship reactivation instead.`);
226
+ }
227
+ return await this.completeOperationWithBackboneCall(RelationshipAuditLog_2.RelationshipAuditLogEntryReason.RevocationOfReactivation, relationshipId);
228
+ }
229
+ async acceptReactivation(relationshipId) {
230
+ const relationship = await this.getRelationshipWithCache(relationshipId);
231
+ this.assertRelationshipStatus(relationship, RelationshipStatus_1.RelationshipStatus.Terminated);
232
+ const lastAuditLogEntry = relationship.cache.auditLog[relationship.cache.auditLog.length - 1];
233
+ if (lastAuditLogEntry.reason !== RelationshipAuditLog_2.RelationshipAuditLogEntryReason.ReactivationRequested) {
234
+ throw CoreErrors_1.CoreErrors.relationships.reactivationNotRequested(relationshipId.toString());
235
+ }
236
+ if (!lastAuditLogEntry.createdBy.equals(relationship.peer.address)) {
237
+ throw CoreErrors_1.CoreErrors.relationships.operationOnlyAllowedForPeer(`Only your peer can accept the reactivation of the relationship ${relationshipId.toString()}.`);
238
+ }
239
+ return await this.completeOperationWithBackboneCall(RelationshipAuditLog_2.RelationshipAuditLogEntryReason.AcceptanceOfReactivation, relationshipId);
240
+ }
241
+ async decompose(relationshipId) {
242
+ const relationship = await this.getRelationshipWithCache(relationshipId);
243
+ this.assertRelationshipStatus(relationship, RelationshipStatus_1.RelationshipStatus.Terminated, RelationshipStatus_1.RelationshipStatus.DeletionProposed);
244
+ const result = await this.client.decomposeRelationship(relationshipId.toString());
245
+ if (result.isError)
246
+ throw result.error;
247
+ const isSecretDeletionSuccessful = await this.secrets.deleteSecretForRelationship(relationship.relationshipSecretId);
248
+ if (!isSecretDeletionSuccessful) {
249
+ this._log.error("Decomposition failed to delete secrets");
250
+ }
251
+ await this.relationships.delete({ id: relationshipId });
252
+ this.eventBus.publish(new events_1.RelationshipDecomposedBySelfEvent(this.parent.identity.address.toString(), { relationshipId }));
253
+ }
254
+ async getRelationshipWithCache(id) {
255
+ const relationship = await this.getRelationship(id);
256
+ if (!relationship)
257
+ throw CoreErrors_1.CoreErrors.general.recordNotFound(Relationship_1.Relationship, id.toString());
258
+ if (!relationship.cache)
259
+ await this.updateCacheOfRelationship(relationship);
260
+ if (!relationship.cache)
261
+ throw this.newCacheEmptyError(Relationship_1.Relationship, id.toString());
262
+ return relationship;
263
+ }
264
+ assertRelationshipStatus(relationship, ...status) {
265
+ if (status.includes(relationship.status))
266
+ return;
267
+ throw CoreErrors_1.CoreErrors.relationships.wrongRelationshipStatus(relationship.id.toString(), relationship.status);
167
268
  }
168
269
  async updateCacheOfRelationship(relationship, response) {
169
270
  if (!response) {
@@ -173,322 +274,188 @@ class RelationshipsController extends core_1.TransportController {
173
274
  relationship.setCache(cachedRelationship);
174
275
  }
175
276
  async decryptRelationship(response, relationshipSecretId) {
277
+ if (!response.creationContent)
278
+ throw new core_1.TransportError("Creation content is missing");
176
279
  const templateId = core_1.CoreId.from(response.relationshipTemplateId);
177
280
  this._log.trace(`Parsing relationship template ${templateId} for ${response.id}...`);
178
281
  const template = await this.parent.relationshipTemplates.getRelationshipTemplate(templateId);
179
282
  if (!template) {
180
283
  throw CoreErrors_1.CoreErrors.general.recordNotFound(RelationshipTemplate_1.RelationshipTemplate, templateId.toString());
181
284
  }
182
- this._log.trace(`Parsing relationship changes of ${response.id}...`);
183
- const changesPromises = [];
184
- for (const change of response.changes) {
185
- switch (change.type) {
186
- case RelationshipChangeType_1.RelationshipChangeType.Creation:
187
- changesPromises.push(this.parseCreationChange(change, relationshipSecretId, templateId));
188
- break;
189
- default:
190
- break;
191
- }
192
- }
193
- const changes = await Promise.all(changesPromises);
285
+ this._log.trace(`Parsing relationship creation content of ${response.id}...`);
286
+ const creationContent = await this.decryptCreationContent(response.creationContent, core_1.CoreAddress.from(response.from), relationshipSecretId);
194
287
  const cachedRelationship = CachedRelationship_1.CachedRelationship.from({
195
- changes: changes,
196
- template: template
288
+ creationContent: creationContent.content,
289
+ template,
290
+ auditLog: RelationshipAuditLog_1.RelationshipAuditLog.fromBackboneAuditLog(response.auditLog)
197
291
  });
198
292
  return cachedRelationship;
199
293
  }
200
- async prepareRequest(relationshipSecretId, template, content) {
294
+ async prepareCreationContent(relationshipSecretId, template, content) {
201
295
  if (!template.cache) {
202
296
  throw this.newCacheEmptyError(RelationshipTemplate_1.RelationshipTemplate, template.id.toString());
203
297
  }
204
- const requestPublic = await this.secrets.createRequestorSecrets(template.cache, relationshipSecretId);
205
- const requestContent = RelationshipCreationChangeRequestContentWrapper_1.RelationshipCreationChangeRequestContentWrapper.from({
206
- content: content,
298
+ const publicCreationContentCrypto = await this.secrets.createRequestorSecrets(template.cache, relationshipSecretId);
299
+ const creationContent = RelationshipCreationContentWrapper_1.RelationshipCreationContentWrapper.from({
300
+ content,
207
301
  identity: this.parent.identity.identity,
208
302
  templateId: template.id
209
303
  });
210
- const serializedRequest = requestContent.serialize();
211
- const buffer = CoreUtil_1.CoreUtil.toBuffer(serializedRequest);
304
+ const serializedCreationContent = creationContent.serialize();
305
+ const buffer = CoreUtil_1.CoreUtil.toBuffer(serializedCreationContent);
212
306
  const [deviceSignature, relationshipSignature] = await Promise.all([this.parent.activeDevice.sign(buffer), this.secrets.sign(relationshipSecretId, buffer)]);
213
- const signedRequest = RelationshipCreationChangeRequestSigned_1.RelationshipCreationChangeRequestSigned.from({
214
- serializedRequest: serializedRequest,
215
- deviceSignature: deviceSignature,
216
- relationshipSignature: relationshipSignature
307
+ const signedCreationContent = RelationshipCreationContentSigned_1.RelationshipCreationContentSigned.from({
308
+ serializedCreationContent,
309
+ deviceSignature,
310
+ relationshipSignature
217
311
  });
218
- const cipher = await this.secrets.encryptRequest(relationshipSecretId, signedRequest);
219
- const requestCipher = RelationshipCreationChangeRequestCipher_1.RelationshipCreationChangeRequestCipher.from({
220
- cipher: cipher,
221
- publicRequestCrypto: requestPublic
312
+ const cipher = await this.secrets.encryptCreationContent(relationshipSecretId, signedCreationContent);
313
+ const creationContentCipher = RelationshipCreationContentCipher_1.RelationshipCreationContentCipher.from({
314
+ cipher,
315
+ publicCreationContentCrypto
222
316
  });
223
- return { requestCipher, requestContent };
224
- }
225
- async applyChangeById(changeId) {
226
- const relationshipChange = (await this.client.getRelationshipChange(changeId.toString())).value;
227
- return await this.applyChange(relationshipChange);
228
- }
229
- async applyChange(change) {
230
- switch (change.type) {
231
- case RelationshipChangeType_1.RelationshipChangeType.Creation:
232
- return await this.applyCreationChange(change);
233
- case RelationshipChangeType_1.RelationshipChangeType.Termination:
234
- case RelationshipChangeType_1.RelationshipChangeType.TerminationCancellation:
235
- default:
236
- throw CoreErrors_1.CoreErrors.general.notSupported();
237
- }
317
+ return creationContentCipher;
238
318
  }
239
- async applyCreationChange(change) {
240
- const relationshipDoc = await this.relationships.read(change.relationshipId);
241
- if (relationshipDoc) {
242
- // Incoming change from sync might still have an empty response
243
- // This could happen if we've processed the change before (duplicate)
244
- if (change.response) {
245
- return await this.updatePendingRelationshipWithPeerResponse(relationshipDoc, change);
246
- }
247
- // If we have a relationship already but no response, do nothing
248
- return undefined;
249
- }
250
- const newRelationship = await this.createNewRelationshipByIncomingCreationChange(change);
251
- if (change.response) {
252
- // The request was revoked before we fetched the creation,
253
- // thus the creation and revoke change is one
254
- const relationshipDoc = await this.relationships.read(change.relationshipId);
255
- return await this.updatePendingRelationshipWithPeerResponse(relationshipDoc, change);
256
- }
257
- return newRelationship;
319
+ async updateRelationshipWithPeerResponse(relationshipDoc) {
320
+ const relationship = Relationship_1.Relationship.from(relationshipDoc);
321
+ const backboneRelationship = (await this.client.getRelationship(relationship.id.toString())).value;
322
+ if (!(await this.secrets.hasCryptoRelationshipSecrets(relationship.relationshipSecretId)) && backboneRelationship.creationResponseContent) {
323
+ const creationResponseContent = backboneRelationship.creationResponseContent;
324
+ const cipher = RelationshipCreationResponseContentCipher_1.RelationshipCreationResponseContentCipher.fromBase64(creationResponseContent);
325
+ await this.secrets.convertSecrets(relationship.relationshipSecretId, cipher.publicCreationResponseContentCrypto);
326
+ }
327
+ relationship.cache.auditLog = RelationshipAuditLog_1.RelationshipAuditLog.fromBackboneAuditLog(backboneRelationship.auditLog);
328
+ relationship.status = backboneRelationship.status;
329
+ await this.relationships.update(relationshipDoc, relationship);
330
+ return relationship;
258
331
  }
259
- async parseCreationChange(change, relationshipSecretId, templateId) {
260
- if (change.type !== RelationshipChangeType_1.RelationshipChangeType.Creation)
261
- this.throwWrongChangeType(change.type);
262
- const promises = [];
263
- promises.push(this.decryptCreationChangeRequest(change.request, relationshipSecretId, templateId));
264
- const hasRelationshipSecret = await this.secrets.hasCryptoRelationshipSecrets(relationshipSecretId);
265
- if (change.response && hasRelationshipSecret) {
266
- promises.push(this.decryptCreationChangeResponse(change, relationshipSecretId));
267
- }
268
- const [requestContent, responseContent] = await Promise.all(promises);
269
- const creationChange = RelationshipChange_1.RelationshipChange.fromBackbone(change, requestContent.content, responseContent?.content);
270
- return creationChange;
271
- }
272
- async decryptCreationChangeRequest(change, secretId, templateId) {
273
- if (!change.content)
274
- throw this.newEmptyOrInvalidContentError();
275
- const isOwnChange = this.parent.identity.isMe(core_1.CoreAddress.from(change.createdBy));
276
- const requestCipher = RelationshipCreationChangeRequestCipher_1.RelationshipCreationChangeRequestCipher.fromBase64(change.content);
277
- const signedRequestBuffer = await this.secrets.decryptRequest(secretId, requestCipher.cipher);
278
- const signedRequest = RelationshipCreationChangeRequestSigned_1.RelationshipCreationChangeRequestSigned.deserialize(signedRequestBuffer.toUtf8());
332
+ async decryptCreationContent(backboneCreationContent, creationContentCreator, secretId) {
333
+ const isOwnContent = this.parent.identity.isMe(creationContentCreator);
334
+ const creationContentCipher = RelationshipCreationContentCipher_1.RelationshipCreationContentCipher.fromBase64(backboneCreationContent);
335
+ const signedCreationContentBuffer = await this.secrets.decryptCreationContent(secretId, creationContentCipher.cipher);
336
+ const signedCreationContent = RelationshipCreationContentSigned_1.RelationshipCreationContentSigned.deserialize(signedCreationContentBuffer.toUtf8());
279
337
  let relationshipSignatureValid;
280
- if (isOwnChange) {
281
- relationshipSignatureValid = await this.secrets.verifyOwn(secretId, crypto_1.CoreBuffer.fromUtf8(signedRequest.serializedRequest), signedRequest.relationshipSignature);
338
+ if (isOwnContent) {
339
+ relationshipSignatureValid = await this.secrets.verifyOwn(secretId, crypto_1.CoreBuffer.fromUtf8(signedCreationContent.serializedCreationContent), signedCreationContent.relationshipSignature);
282
340
  }
283
341
  else {
284
- relationshipSignatureValid = await this.secrets.verifyPeer(secretId, crypto_1.CoreBuffer.fromUtf8(signedRequest.serializedRequest), signedRequest.relationshipSignature);
342
+ relationshipSignatureValid = await this.secrets.verifyPeer(secretId, crypto_1.CoreBuffer.fromUtf8(signedCreationContent.serializedCreationContent), signedCreationContent.relationshipSignature);
285
343
  }
286
344
  if (!relationshipSignatureValid) {
287
- throw CoreErrors_1.CoreErrors.general.signatureNotValid("relationshipRequest");
288
- }
289
- const requestContent = RelationshipCreationChangeRequestContentWrapper_1.RelationshipCreationChangeRequestContentWrapper.deserialize(signedRequest.serializedRequest);
290
- if (!requestContent.templateId.equals(templateId)) {
291
- throw new core_1.TransportError("The relationship request contains a wrong template id.");
292
- }
293
- return requestContent;
294
- }
295
- async decryptCreationChangeResponse(change, relationshipSecretId) {
296
- if (!change.response)
297
- throw this.newChangeResponseMissingError(change.id);
298
- if (change.type !== RelationshipChangeType_1.RelationshipChangeType.Creation)
299
- this.throwWrongChangeType(change.type);
300
- if (!change.response.content) {
301
- throw this.newEmptyOrInvalidContentError(change);
302
- }
303
- const isOwnChange = this.parent.identity.isMe(core_1.CoreAddress.from(change.response.createdBy));
304
- const cipher = RelationshipCreationChangeResponseCipher_1.RelationshipCreationChangeResponseCipher.fromBase64(change.response.content);
305
- let signedResponseBuffer;
306
- if (change.status !== RelationshipChangeStatus_1.RelationshipChangeStatus.Revoked) {
307
- if (isOwnChange) {
308
- signedResponseBuffer = await this.secrets.decryptOwn(relationshipSecretId, cipher.cipher);
309
- }
310
- else {
311
- signedResponseBuffer = await this.secrets.decryptPeer(relationshipSecretId, cipher.cipher, true);
312
- }
313
- }
314
- else {
315
- signedResponseBuffer = await this.secrets.decryptRequest(relationshipSecretId, cipher.cipher);
316
- }
317
- const signedResponse = RelationshipCreationChangeResponseSigned_1.RelationshipCreationChangeResponseSigned.deserialize(signedResponseBuffer.toUtf8());
318
- let relationshipSignatureValid;
319
- if (isOwnChange) {
320
- relationshipSignatureValid = await this.secrets.verifyOwn(relationshipSecretId, crypto_1.CoreBuffer.fromUtf8(signedResponse.serializedResponse), signedResponse.relationshipSignature);
321
- }
322
- else {
323
- relationshipSignatureValid = await this.secrets.verifyPeer(relationshipSecretId, crypto_1.CoreBuffer.fromUtf8(signedResponse.serializedResponse), signedResponse.relationshipSignature);
324
- }
325
- if (!relationshipSignatureValid) {
326
- throw CoreErrors_1.CoreErrors.general.signatureNotValid("relationshipResponse");
327
- }
328
- const responseContent = RelationshipCreationChangeResponseContentWrapper_1.RelationshipCreationChangeResponseContentWrapper.deserialize(signedResponse.serializedResponse);
329
- if (!responseContent.relationshipId.equals(change.relationshipId)) {
330
- throw new core_1.TransportError("The relationship response contains a wrong relationship id.");
331
- }
332
- return responseContent;
333
- }
334
- async updatePendingRelationshipWithPeerResponse(relationshipDoc, change) {
335
- const relationship = Relationship_1.Relationship.from(relationshipDoc);
336
- if (relationship.status !== RelationshipStatus_1.RelationshipStatus.Pending) {
337
- this.log.debug("Trying to update non-pending relationship with creation change", change);
338
- return;
339
- }
340
- if (!relationship.cache) {
341
- await this.updateCacheOfRelationship(relationship, undefined);
345
+ throw CoreErrors_1.CoreErrors.general.signatureNotValid("relationshipCreationContent");
342
346
  }
343
- if (!change.response)
344
- throw this.newChangeResponseMissingError(change.id);
345
- if (!change.response.content) {
346
- throw this.newEmptyOrInvalidContentError(change);
347
- }
348
- const cipher = RelationshipCreationChangeResponseCipher_1.RelationshipCreationChangeResponseCipher.fromBase64(change.response.content);
349
- if (change.status !== RelationshipChangeStatus_1.RelationshipChangeStatus.Revoked) {
350
- if (!cipher.publicResponseCrypto) {
351
- throw new core_1.TransportError("The response crypto is missing.");
352
- }
353
- await this.secrets.convertSecrets(relationship.relationshipSecretId, cipher.publicResponseCrypto);
354
- }
355
- const responseContent = await this.decryptCreationChangeResponse(change, relationship.relationshipSecretId);
356
- const response = RelationshipChangeResponse_1.RelationshipChangeResponse.fromBackbone(change.response, responseContent.content);
357
- if (!relationship.cache) {
358
- throw this.newCacheEmptyError(Relationship_1.Relationship, relationship.id.toString());
359
- }
360
- relationship.cache.changes[0].status = change.status;
361
- switch (change.status) {
362
- case RelationshipChangeStatus_1.RelationshipChangeStatus.Accepted:
363
- relationship.toActive(response);
364
- break;
365
- case RelationshipChangeStatus_1.RelationshipChangeStatus.Rejected:
366
- relationship.toRejected(response);
367
- break;
368
- case RelationshipChangeStatus_1.RelationshipChangeStatus.Revoked:
369
- relationship.toRevoked(response);
370
- break;
371
- default:
372
- throw CoreErrors_1.CoreErrors.general.notSupported();
373
- }
374
- await this.relationships.update(relationshipDoc, relationship);
375
- return relationship;
347
+ const creationContent = RelationshipCreationContentWrapper_1.RelationshipCreationContentWrapper.deserialize(signedCreationContent.serializedCreationContent);
348
+ return creationContent;
376
349
  }
377
- async createNewRelationshipByIncomingCreationChange(change) {
378
- const backboneRelationship = (await this.client.getRelationship(change.relationshipId)).value;
350
+ async createNewRelationshipByIncomingCreation(relationshipId) {
351
+ const backboneRelationship = (await this.client.getRelationship(relationshipId)).value;
352
+ if (!backboneRelationship.creationContent)
353
+ throw new core_1.TransportError("Creation content is missing");
379
354
  const templateId = core_1.CoreId.from(backboneRelationship.relationshipTemplateId);
380
355
  const template = await this.parent.relationshipTemplates.getRelationshipTemplate(templateId);
381
356
  if (!template)
382
357
  throw CoreErrors_1.CoreErrors.general.recordNotFound(RelationshipTemplate_1.RelationshipTemplate, templateId.toString());
383
358
  if (!template.cache)
384
359
  throw this.newCacheEmptyError(RelationshipTemplate_1.RelationshipTemplate, template.id.toString());
385
- if (!change.request.content)
386
- throw this.newEmptyOrInvalidContentError(change);
387
360
  const secretId = await TransportIds_1.TransportIds.relationshipSecret.generate();
388
- const requestCipher = RelationshipCreationChangeRequestCipher_1.RelationshipCreationChangeRequestCipher.fromBase64(change.request.content);
389
- await this.secrets.createTemplatorSecrets(secretId, template.cache, requestCipher.publicRequestCrypto);
390
- const requestContent = await this.decryptCreationChangeRequest(backboneRelationship.changes[0].request, secretId, templateId);
391
- const relationshipChange = RelationshipChange_1.RelationshipChange.fromBackbone(change, requestContent.content);
392
- const relationship = Relationship_1.Relationship.fromCreationChangeReceived(backboneRelationship, template, requestContent.identity, relationshipChange, secretId);
361
+ const creationContentCipher = RelationshipCreationContentCipher_1.RelationshipCreationContentCipher.fromBase64(backboneRelationship.creationContent);
362
+ await this.secrets.createTemplatorSecrets(secretId, template.cache, creationContentCipher.publicCreationContentCrypto);
363
+ const creationContent = await this.decryptCreationContent(backboneRelationship.creationContent, core_1.CoreAddress.from(backboneRelationship.from), secretId);
364
+ const relationship = Relationship_1.Relationship.fromBackboneAndCreationContent(backboneRelationship, template, creationContent.identity, creationContent.content, secretId);
393
365
  await this.relationships.create(relationship);
394
366
  return relationship;
395
367
  }
396
- async completeChange(targetStatus, change, content) {
397
- const relationshipDoc = await this.relationships.read(change.relationshipId.toString());
368
+ async applyRelationshipChangedEvent(relationshipId) {
369
+ let relationshipDoc = await this.relationships.read(relationshipId);
398
370
  if (!relationshipDoc) {
399
- throw CoreErrors_1.CoreErrors.general.recordNotFound(Relationship_1.Relationship, change.relationshipId.toString());
371
+ const newRelationship = await this.createNewRelationshipByIncomingCreation(relationshipId);
372
+ if (newRelationship.status === RelationshipStatus_1.RelationshipStatus.Pending) {
373
+ return newRelationship;
374
+ }
375
+ // this path is for a revocation that is processed before its corresponding creation
376
+ relationshipDoc = await this.relationships.read(relationshipId);
377
+ }
378
+ return await this.updateRelationshipWithPeerResponse(relationshipDoc);
379
+ }
380
+ async prepareCreationResponseContent(relationship) {
381
+ const publicCreationResponseContentCrypto = await this.secrets.getPublicCreationResponseContentCrypto(relationship.relationshipSecretId);
382
+ const creationResponseContent = RelationshipCreationResponseContentWrapper_1.RelationshipCreationResponseContentWrapper.from({ relationshipId: relationship.id });
383
+ const serializedCreationResponseContent = creationResponseContent.serialize();
384
+ const buffer = CoreUtil_1.CoreUtil.toBuffer(serializedCreationResponseContent);
385
+ const [deviceSignature, relationshipSignature] = await Promise.all([this.parent.activeDevice.sign(buffer), this.secrets.sign(relationship.relationshipSecretId, buffer)]);
386
+ const signedCreationResponseContent = RelationshipCreationResponseContentSigned_1.RelationshipCreationResponseContentSigned.from({
387
+ serializedCreationResponseContent,
388
+ deviceSignature,
389
+ relationshipSignature
390
+ });
391
+ const cipher = await this.secrets.encrypt(relationship.relationshipSecretId, signedCreationResponseContent);
392
+ const creationResponseContentCipher = RelationshipCreationResponseContentCipher_1.RelationshipCreationResponseContentCipher.from({
393
+ cipher,
394
+ publicCreationResponseContentCrypto
395
+ });
396
+ return creationResponseContentCipher.toBase64();
397
+ }
398
+ async completeOperationWithBackboneCall(operation, id) {
399
+ const relationshipDoc = await this.relationships.read(id.toString());
400
+ if (!relationshipDoc) {
401
+ throw CoreErrors_1.CoreErrors.general.recordNotFound(Relationship_1.Relationship, id.toString());
400
402
  }
401
403
  const relationship = Relationship_1.Relationship.from(relationshipDoc);
402
404
  if (!relationship.cache) {
403
405
  await this.updateCacheOfRelationship(relationship);
404
406
  }
405
407
  if (!relationship.cache) {
406
- throw this.newCacheEmptyError(Relationship_1.Relationship, relationship.id.toString());
407
- }
408
- const queriedChange = relationship.cache.changes.find((r) => r.id.toString() === change.id.toString());
409
- if (!queriedChange) {
410
- throw CoreErrors_1.CoreErrors.general.recordNotFound(RelationshipChange_1.RelationshipChange, change.id.toString());
411
- }
412
- if (queriedChange.status !== RelationshipChangeStatus_1.RelationshipChangeStatus.Pending) {
413
- throw CoreErrors_1.CoreErrors.relationships.wrongChangeStatus(queriedChange.status);
414
- }
415
- let encryptedContent;
416
- if (content) {
417
- encryptedContent =
418
- targetStatus === RelationshipChangeStatus_1.RelationshipChangeStatus.Revoked
419
- ? await this.encryptRevokeContent(relationship, content)
420
- : await this.encryptAcceptRejectContent(relationship, content);
408
+ throw this.newCacheEmptyError(Relationship_1.Relationship, id.toString());
421
409
  }
422
410
  let backboneResponse;
423
- switch (targetStatus) {
424
- case RelationshipChangeStatus_1.RelationshipChangeStatus.Accepted:
425
- backboneResponse = (await this.client.acceptRelationshipChange(relationship.id.toString(), change.id.toString(), encryptedContent)).value;
411
+ switch (operation) {
412
+ case RelationshipAuditLog_2.RelationshipAuditLogEntryReason.AcceptanceOfCreation:
413
+ const encryptedContent = await this.prepareCreationResponseContent(relationship);
414
+ backboneResponse = (await this.client.acceptRelationship(id.toString(), { creationResponseContent: encryptedContent })).value;
415
+ break;
416
+ case RelationshipAuditLog_2.RelationshipAuditLogEntryReason.RejectionOfCreation:
417
+ backboneResponse = (await this.client.rejectRelationship(id.toString())).value;
418
+ break;
419
+ case RelationshipAuditLog_2.RelationshipAuditLogEntryReason.RevocationOfCreation:
420
+ backboneResponse = (await this.client.revokeRelationship(id.toString())).value;
421
+ break;
422
+ case RelationshipAuditLog_2.RelationshipAuditLogEntryReason.Termination:
423
+ backboneResponse = (await this.client.terminateRelationship(id.toString())).value;
426
424
  break;
427
- case RelationshipChangeStatus_1.RelationshipChangeStatus.Rejected:
428
- backboneResponse = (await this.client.rejectRelationshipChange(relationship.id.toString(), change.id.toString(), encryptedContent)).value;
425
+ case RelationshipAuditLog_2.RelationshipAuditLogEntryReason.ReactivationRequested:
426
+ backboneResponse = (await this.client.reactivateRelationship(id.toString())).value;
429
427
  break;
430
- case RelationshipChangeStatus_1.RelationshipChangeStatus.Revoked:
431
- backboneResponse = (await this.client.revokeRelationshipChange(relationship.id.toString(), change.id.toString(), encryptedContent)).value;
428
+ case RelationshipAuditLog_2.RelationshipAuditLogEntryReason.AcceptanceOfReactivation:
429
+ backboneResponse = (await this.client.acceptRelationshipReactivation(id.toString())).value;
430
+ break;
431
+ case RelationshipAuditLog_2.RelationshipAuditLogEntryReason.RejectionOfReactivation:
432
+ backboneResponse = (await this.client.rejectRelationshipReactivation(id.toString())).value;
433
+ break;
434
+ case RelationshipAuditLog_2.RelationshipAuditLogEntryReason.RevocationOfReactivation:
435
+ backboneResponse = (await this.client.revokeRelationshipReactivation(id.toString())).value;
432
436
  break;
433
437
  default:
434
- throw new core_1.TransportError("target change status not supported");
438
+ throw new core_1.TransportError("operation not supported");
435
439
  }
436
- const backboneChange = backboneResponse.changes[backboneResponse.changes.length - 1];
437
- queriedChange.response = RelationshipChangeResponse_1.RelationshipChangeResponse.fromBackbone(backboneResponse.changes[backboneResponse.changes.length - 1].response, content);
438
- queriedChange.status = backboneChange.status;
439
440
  relationship.status = backboneResponse.status;
441
+ relationship.cache.auditLog = RelationshipAuditLog_1.RelationshipAuditLog.fromBackboneAuditLog(backboneResponse.auditLog);
440
442
  await this.relationships.update(relationshipDoc, relationship);
441
- this.eventBus.publish(new events_1.RelationshipChangedEvent(this.parent.identity.address.toString(), relationship));
443
+ this.publishEventAfterCompletedOperation(operation, relationship);
442
444
  return relationship;
443
445
  }
444
- async encryptRevokeContent(relationship, content) {
445
- const responseContent = RelationshipCreationChangeResponseContentWrapper_1.RelationshipCreationChangeResponseContentWrapper.from({
446
- relationshipId: relationship.id,
447
- content: content
448
- });
449
- const serializedResponse = responseContent.serialize();
450
- const buffer = CoreUtil_1.CoreUtil.toBuffer(serializedResponse);
451
- const [deviceSignature, relationshipSignature] = await Promise.all([this.parent.activeDevice.sign(buffer), this.secrets.sign(relationship.relationshipSecretId, buffer)]);
452
- const signedResponse = RelationshipCreationChangeResponseSigned_1.RelationshipCreationChangeResponseSigned.from({
453
- serializedResponse: serializedResponse,
454
- deviceSignature: deviceSignature,
455
- relationshipSignature: relationshipSignature
456
- });
457
- const cipher = await this.secrets.encryptRequest(relationship.relationshipSecretId, signedResponse);
458
- const responseCipher = RelationshipCreationChangeResponseCipher_1.RelationshipCreationChangeResponseCipher.from({
459
- cipher: cipher
460
- });
461
- return responseCipher.toBase64();
462
- }
463
- async encryptAcceptRejectContent(relationship, content) {
464
- const publicResponseCrypto = await this.secrets.getPublicResponse(relationship.relationshipSecretId);
465
- const responseContent = RelationshipCreationChangeResponseContentWrapper_1.RelationshipCreationChangeResponseContentWrapper.from({
466
- relationshipId: relationship.id,
467
- content: content
468
- });
469
- const serializedResponse = responseContent.serialize();
470
- const buffer = CoreUtil_1.CoreUtil.toBuffer(serializedResponse);
471
- const [deviceSignature, relationshipSignature] = await Promise.all([this.parent.activeDevice.sign(buffer), this.secrets.sign(relationship.relationshipSecretId, buffer)]);
472
- const signedResponse = RelationshipCreationChangeResponseSigned_1.RelationshipCreationChangeResponseSigned.from({
473
- serializedResponse: serializedResponse,
474
- deviceSignature: deviceSignature,
475
- relationshipSignature: relationshipSignature
476
- });
477
- const cipher = await this.secrets.encrypt(relationship.relationshipSecretId, signedResponse);
478
- const responseCipher = RelationshipCreationChangeResponseCipher_1.RelationshipCreationChangeResponseCipher.from({
479
- cipher: cipher,
480
- publicResponseCrypto: publicResponseCrypto
481
- });
482
- return responseCipher.toBase64();
483
- }
484
- throwWrongChangeType(type) {
485
- throw new core_1.TransportError(`The relationship change has the wrong type (${type}) to run this operation`);
486
- }
487
- newChangeResponseMissingError(changeId) {
488
- return new core_1.TransportError(`The response of the relationship change (${changeId}) is missing`);
489
- }
490
- newEmptyOrInvalidContentError(change) {
491
- return new core_1.TransportError(`The content property of the relationship change ${change?.id} is missing or invalid`);
446
+ publishEventAfterCompletedOperation(operation, relationship) {
447
+ this.eventBus.publish(new events_1.RelationshipChangedEvent(this.parent.identity.address.toString(), relationship));
448
+ switch (operation) {
449
+ case RelationshipAuditLog_2.RelationshipAuditLogEntryReason.ReactivationRequested:
450
+ this.eventBus.publish(new events_1.RelationshipReactivationRequestedEvent(this.parent.identity.address.toString(), relationship));
451
+ break;
452
+ case RelationshipAuditLog_2.RelationshipAuditLogEntryReason.RevocationOfReactivation:
453
+ case RelationshipAuditLog_2.RelationshipAuditLogEntryReason.AcceptanceOfReactivation:
454
+ case RelationshipAuditLog_2.RelationshipAuditLogEntryReason.RejectionOfReactivation:
455
+ this.eventBus.publish(new events_1.RelationshipReactivationCompletedEvent(this.parent.identity.address.toString(), relationship));
456
+ break;
457
+ default:
458
+ }
492
459
  }
493
460
  }
494
461
  exports.RelationshipsController = RelationshipsController;
@@ -497,7 +464,7 @@ __decorate([
497
464
  __metadata("design:type", Function),
498
465
  __metadata("design:paramtypes", [String, Object]),
499
466
  __metadata("design:returntype", Promise)
500
- ], RelationshipsController.prototype, "updateCacheOfExistingRelationshipInDb", null);
467
+ ], RelationshipsController.prototype, "updateExistingRelationshipInDb", null);
501
468
  __decorate([
502
469
  (0, ts_utils_1.log)(),
503
470
  __metadata("design:type", Function),
@@ -509,42 +476,23 @@ __decorate([
509
476
  __metadata("design:type", Function),
510
477
  __metadata("design:paramtypes", [Object]),
511
478
  __metadata("design:returntype", Promise)
512
- ], RelationshipsController.prototype, "applyChange", null);
513
- __decorate([
514
- (0, ts_utils_1.log)(),
515
- __metadata("design:type", Function),
516
- __metadata("design:paramtypes", [Object, core_1.CoreId, core_1.CoreId]),
517
- __metadata("design:returntype", Promise)
518
- ], RelationshipsController.prototype, "parseCreationChange", null);
479
+ ], RelationshipsController.prototype, "updateRelationshipWithPeerResponse", null);
519
480
  __decorate([
520
481
  (0, ts_utils_1.log)(),
521
482
  __metadata("design:type", Function),
522
- __metadata("design:paramtypes", [Object, core_1.CoreId,
523
- core_1.CoreId]),
483
+ __metadata("design:paramtypes", [String, core_1.CoreAddress, core_1.CoreId]),
524
484
  __metadata("design:returntype", Promise)
525
- ], RelationshipsController.prototype, "decryptCreationChangeRequest", null);
485
+ ], RelationshipsController.prototype, "decryptCreationContent", null);
526
486
  __decorate([
527
487
  (0, ts_utils_1.log)(),
528
488
  __metadata("design:type", Function),
529
- __metadata("design:paramtypes", [Object, core_1.CoreId]),
530
- __metadata("design:returntype", Promise)
531
- ], RelationshipsController.prototype, "decryptCreationChangeResponse", null);
532
- __decorate([
533
- (0, ts_utils_1.log)(),
534
- __metadata("design:type", Function),
535
- __metadata("design:paramtypes", [Object, Object]),
536
- __metadata("design:returntype", Promise)
537
- ], RelationshipsController.prototype, "updatePendingRelationshipWithPeerResponse", null);
538
- __decorate([
539
- (0, ts_utils_1.log)(),
540
- __metadata("design:type", Function),
541
- __metadata("design:paramtypes", [Object]),
489
+ __metadata("design:paramtypes", [String]),
542
490
  __metadata("design:returntype", Promise)
543
- ], RelationshipsController.prototype, "createNewRelationshipByIncomingCreationChange", null);
491
+ ], RelationshipsController.prototype, "createNewRelationshipByIncomingCreation", null);
544
492
  __decorate([
545
493
  (0, ts_utils_1.log)(),
546
494
  __metadata("design:type", Function),
547
- __metadata("design:paramtypes", [String, RelationshipChange_1.RelationshipChange, Object]),
495
+ __metadata("design:paramtypes", [String, core_1.CoreId]),
548
496
  __metadata("design:returntype", Promise)
549
- ], RelationshipsController.prototype, "completeChange", null);
497
+ ], RelationshipsController.prototype, "completeOperationWithBackboneCall", null);
550
498
  //# sourceMappingURL=RelationshipsController.js.map