@icure/api 8.2.3 → 8.2.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 (337) hide show
  1. package/icc-api/api/IccAuthApi.js +1 -1
  2. package/icc-api/api/IccAuthApi.js.map +1 -1
  3. package/icc-api/api/IccDocumentApi.js.map +1 -1
  4. package/icc-api/api/IccFormApi.js.map +1 -1
  5. package/icc-api/api/IccReceiptApi.js.map +1 -1
  6. package/icc-api/api/IccRestApiPath.js +1 -2
  7. package/icc-api/api/IccRestApiPath.js.map +1 -1
  8. package/icc-api/api/XHR.js +17 -8
  9. package/icc-api/api/XHR.js.map +1 -1
  10. package/icc-api/model/Address.js +1 -1
  11. package/icc-api/model/Address.js.map +1 -1
  12. package/icc-api/model/Amp.js +1 -1
  13. package/icc-api/model/Amp.js.map +1 -1
  14. package/icc-api/model/AmpComponent.js +1 -1
  15. package/icc-api/model/AmpComponent.js.map +1 -1
  16. package/icc-api/model/Ampp.js +1 -1
  17. package/icc-api/model/Ampp.js.map +1 -1
  18. package/icc-api/model/AmppComponent.js +1 -1
  19. package/icc-api/model/AmppComponent.js.map +1 -1
  20. package/icc-api/model/CareTeamMember.js +1 -1
  21. package/icc-api/model/CareTeamMember.js.map +1 -1
  22. package/icc-api/model/CareTeamMembership.js +1 -1
  23. package/icc-api/model/CareTeamMembership.js.map +1 -1
  24. package/icc-api/model/Code.js +1 -1
  25. package/icc-api/model/Code.js.map +1 -1
  26. package/icc-api/model/Contact.js.map +1 -1
  27. package/icc-api/model/Content.js.map +1 -1
  28. package/icc-api/model/DataOwnerTypeEnum.js +1 -1
  29. package/icc-api/model/DataOwnerTypeEnum.js.map +1 -1
  30. package/icc-api/model/DataOwnerWithType.js +1 -1
  31. package/icc-api/model/DataOwnerWithType.js.map +1 -1
  32. package/icc-api/model/DatabaseSynchronization.js +1 -1
  33. package/icc-api/model/DatabaseSynchronization.js.map +1 -1
  34. package/icc-api/model/Dmpp.js +1 -1
  35. package/icc-api/model/Dmpp.js.map +1 -1
  36. package/icc-api/model/Document.js +1 -1
  37. package/icc-api/model/Document.js.map +1 -1
  38. package/icc-api/model/DocumentTemplate.d.ts +1 -1
  39. package/icc-api/model/DocumentTemplate.js +1 -1
  40. package/icc-api/model/DocumentTemplate.js.map +1 -1
  41. package/icc-api/model/Editor.js +1 -1
  42. package/icc-api/model/Editor.js.map +1 -1
  43. package/icc-api/model/EfactInvoice.js +1 -1
  44. package/icc-api/model/EfactInvoice.js.map +1 -1
  45. package/icc-api/model/EmailOrSmsMessage.js +1 -1
  46. package/icc-api/model/EmailOrSmsMessage.js.map +1 -1
  47. package/icc-api/model/FlatRateTarification.js +1 -1
  48. package/icc-api/model/FlatRateTarification.js.map +1 -1
  49. package/icc-api/model/Formula.js +1 -1
  50. package/icc-api/model/Formula.js.map +1 -1
  51. package/icc-api/model/FrontEndMigration.js +1 -1
  52. package/icc-api/model/FrontEndMigration.js.map +1 -1
  53. package/icc-api/model/HealthElement.js +1 -1
  54. package/icc-api/model/HealthElement.js.map +1 -1
  55. package/icc-api/model/HealthcareParty.js +1 -1
  56. package/icc-api/model/HealthcareParty.js.map +1 -1
  57. package/icc-api/model/HealthcarePartyHistoryStatus.js +1 -1
  58. package/icc-api/model/HealthcarePartyHistoryStatus.js.map +1 -1
  59. package/icc-api/model/Ingredient.js +1 -1
  60. package/icc-api/model/Ingredient.js.map +1 -1
  61. package/icc-api/model/Invoice.js +1 -1
  62. package/icc-api/model/Invoice.js.map +1 -1
  63. package/icc-api/model/InvoiceItem.js +1 -1
  64. package/icc-api/model/InvoiceItem.js.map +1 -1
  65. package/icc-api/model/InvoicingCode.js +1 -1
  66. package/icc-api/model/InvoicingCode.js.map +1 -1
  67. package/icc-api/model/MaintenanceTask.js +1 -1
  68. package/icc-api/model/MaintenanceTask.js.map +1 -1
  69. package/icc-api/model/Measure.js.map +1 -1
  70. package/icc-api/model/MedicalHouseContract.js +1 -1
  71. package/icc-api/model/MedicalHouseContract.js.map +1 -1
  72. package/icc-api/model/ModelHelper.js +9 -10
  73. package/icc-api/model/ModelHelper.js.map +1 -1
  74. package/icc-api/model/Partnership.js +1 -1
  75. package/icc-api/model/Partnership.js.map +1 -1
  76. package/icc-api/model/Patient.js +1 -1
  77. package/icc-api/model/Patient.js.map +1 -1
  78. package/icc-api/model/PatientByHcPartyGenderEducationProfession.js +1 -1
  79. package/icc-api/model/PatientByHcPartyGenderEducationProfession.js.map +1 -1
  80. package/icc-api/model/PatientHealthCareParty.js +1 -1
  81. package/icc-api/model/PatientHealthCareParty.js.map +1 -1
  82. package/icc-api/model/Payment.js +1 -1
  83. package/icc-api/model/Payment.js.map +1 -1
  84. package/icc-api/model/PermissionCriterion.js +1 -1
  85. package/icc-api/model/PermissionCriterion.js.map +1 -1
  86. package/icc-api/model/PermissionItem.js +1 -1
  87. package/icc-api/model/PermissionItem.js.map +1 -1
  88. package/icc-api/model/PersonName.js +1 -1
  89. package/icc-api/model/PersonName.js.map +1 -1
  90. package/icc-api/model/PropertyTypeStub.js +1 -1
  91. package/icc-api/model/PropertyTypeStub.js.map +1 -1
  92. package/icc-api/model/Reimbursement.js +1 -1
  93. package/icc-api/model/Reimbursement.js.map +1 -1
  94. package/icc-api/model/RoleSourceEnum.js +1 -1
  95. package/icc-api/model/RoleSourceEnum.js.map +1 -1
  96. package/icc-api/model/SecureDelegation.js +1 -1
  97. package/icc-api/model/SecureDelegation.js.map +1 -1
  98. package/icc-api/model/Service.js.map +1 -1
  99. package/icc-api/model/StandardSubstance.js +1 -1
  100. package/icc-api/model/StandardSubstance.js.map +1 -1
  101. package/icc-api/model/SumehrValidity.js +1 -1
  102. package/icc-api/model/SumehrValidity.js.map +1 -1
  103. package/icc-api/model/Tarification.js +1 -1
  104. package/icc-api/model/Tarification.js.map +1 -1
  105. package/icc-api/model/Telecom.js +1 -1
  106. package/icc-api/model/Telecom.js.map +1 -1
  107. package/icc-api/model/Topic.js +1 -1
  108. package/icc-api/model/Topic.js.map +1 -1
  109. package/icc-api/model/TypedValueObject.js +1 -1
  110. package/icc-api/model/TypedValueObject.js.map +1 -1
  111. package/icc-api/model/User.js +1 -1
  112. package/icc-api/model/User.js.map +1 -1
  113. package/icc-api/model/UserTypeEnum.js +1 -1
  114. package/icc-api/model/UserTypeEnum.js.map +1 -1
  115. package/icc-api/model/VirtualIngredient.js +1 -1
  116. package/icc-api/model/VirtualIngredient.js.map +1 -1
  117. package/icc-api/model/internal/RecoveryData.js +1 -1
  118. package/icc-api/model/internal/RecoveryData.js.map +1 -1
  119. package/icc-api/model/requests/EntityBulkShareResult.js.map +1 -1
  120. package/icc-api/model/requests/EntityShareOrMetadataUpdateRequest.js.map +1 -1
  121. package/icc-api/model/requests/EntityShareRequest.js +1 -1
  122. package/icc-api/model/requests/EntityShareRequest.js.map +1 -1
  123. package/icc-api/model/requests/EntitySharedMetadataUpdateRequest.js +1 -1
  124. package/icc-api/model/requests/EntitySharedMetadataUpdateRequest.js.map +1 -1
  125. package/icc-x-api/auth/AuthenticationProvider.js.map +1 -1
  126. package/icc-x-api/auth/BasicAuthService.js.map +1 -1
  127. package/icc-x-api/auth/EnsembleAuthService.js.map +1 -1
  128. package/icc-x-api/auth/JwtAuthService.js.map +1 -1
  129. package/icc-x-api/auth/JwtBridgedAuthService.d.ts +1 -1
  130. package/icc-x-api/auth/JwtBridgedAuthService.js +1 -1
  131. package/icc-x-api/auth/JwtBridgedAuthService.js.map +1 -1
  132. package/icc-x-api/auth/JwtUtils.js +3 -4
  133. package/icc-x-api/auth/JwtUtils.js.map +1 -1
  134. package/icc-x-api/auth/NoAuthService.js.map +1 -1
  135. package/icc-x-api/auth/SmartAuthProvider.d.ts +1 -1
  136. package/icc-x-api/auth/SmartAuthProvider.js +1 -1
  137. package/icc-x-api/auth/SmartAuthProvider.js.map +1 -1
  138. package/icc-x-api/crypto/AES.js.map +1 -1
  139. package/icc-x-api/crypto/AccessControlKeysHeadersProvider.js.map +1 -1
  140. package/icc-x-api/crypto/AccessControlSecretUtils.js.map +1 -1
  141. package/icc-x-api/crypto/BaseExchangeDataManager.js +10 -10
  142. package/icc-x-api/crypto/BaseExchangeDataManager.js.map +1 -1
  143. package/icc-x-api/crypto/BaseExchangeKeysManager.js +4 -4
  144. package/icc-x-api/crypto/BaseExchangeKeysManager.js.map +1 -1
  145. package/icc-x-api/crypto/CryptoStrategies.d.ts +5 -7
  146. package/icc-x-api/crypto/CryptoStrategies.js.map +1 -1
  147. package/icc-x-api/crypto/DelegationsDeAnonymization.js +1 -1
  148. package/icc-x-api/crypto/DelegationsDeAnonymization.js.map +1 -1
  149. package/icc-x-api/crypto/ExchangeDataManager.js +7 -8
  150. package/icc-x-api/crypto/ExchangeDataManager.js.map +1 -1
  151. package/icc-x-api/crypto/ExchangeDataMapManager.js.map +1 -1
  152. package/icc-x-api/crypto/ExchangeKeysManager.js +1 -1
  153. package/icc-x-api/crypto/ExchangeKeysManager.js.map +1 -1
  154. package/icc-x-api/crypto/ExtendedApisUtilsImpl.js +11 -10
  155. package/icc-x-api/crypto/ExtendedApisUtilsImpl.js.map +1 -1
  156. package/icc-x-api/crypto/HMACUtils.js.map +1 -1
  157. package/icc-x-api/crypto/KeyRecovery.js +5 -5
  158. package/icc-x-api/crypto/KeyRecovery.js.map +1 -1
  159. package/icc-x-api/crypto/NativeCryptoPrimitivesBridge.js +3 -3
  160. package/icc-x-api/crypto/NativeCryptoPrimitivesBridge.js.map +1 -1
  161. package/icc-x-api/crypto/RSA.js +4 -4
  162. package/icc-x-api/crypto/RSA.js.map +1 -1
  163. package/icc-x-api/crypto/RecoveryDataEncryption.js +1 -1
  164. package/icc-x-api/crypto/RecoveryDataEncryption.js.map +1 -1
  165. package/icc-x-api/crypto/SecretIdUseOption.js +1 -1
  166. package/icc-x-api/crypto/SecretIdUseOption.js.map +1 -1
  167. package/icc-x-api/crypto/SecureDelegationsEncryption.js +4 -4
  168. package/icc-x-api/crypto/SecureDelegationsEncryption.js.map +1 -1
  169. package/icc-x-api/crypto/SecureDelegationsManager.js +1 -1
  170. package/icc-x-api/crypto/SecureDelegationsManager.js.map +1 -1
  171. package/icc-x-api/crypto/SecurityMetadataDecryptor.d.ts +1 -1
  172. package/icc-x-api/crypto/SecurityMetadataDecryptor.js +9 -9
  173. package/icc-x-api/crypto/SecurityMetadataDecryptor.js.map +1 -1
  174. package/icc-x-api/crypto/ShamirKeysManager.js.map +1 -1
  175. package/icc-x-api/crypto/ShareMetadataBehaviour.js +1 -1
  176. package/icc-x-api/crypto/ShareMetadataBehaviour.js.map +1 -1
  177. package/icc-x-api/crypto/TransferKeysManager.js +1 -1
  178. package/icc-x-api/crypto/TransferKeysManager.js.map +1 -1
  179. package/icc-x-api/crypto/UserEncryptionKeysManager.js +2 -2
  180. package/icc-x-api/crypto/UserEncryptionKeysManager.js.map +1 -1
  181. package/icc-x-api/crypto/shamir.d.ts +2 -2
  182. package/icc-x-api/crypto/shamir.js +4 -4
  183. package/icc-x-api/crypto/shamir.js.map +1 -1
  184. package/icc-x-api/crypto/utils.js +14 -15
  185. package/icc-x-api/crypto/utils.js.map +1 -1
  186. package/icc-x-api/icc-accesslog-x-api.js +10 -10
  187. package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
  188. package/icc-x-api/icc-bekmehr-x-api.js.map +1 -1
  189. package/icc-x-api/icc-calendar-item-x-api.js +7 -7
  190. package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
  191. package/icc-x-api/icc-classification-x-api.js +5 -5
  192. package/icc-x-api/icc-classification-x-api.js.map +1 -1
  193. package/icc-x-api/icc-code-x-api.js.map +1 -1
  194. package/icc-x-api/icc-contact-x-api.js +12 -12
  195. package/icc-x-api/icc-contact-x-api.js.map +1 -1
  196. package/icc-x-api/icc-data-owner-x-api.js.map +1 -1
  197. package/icc-x-api/icc-device-x-api.js +2 -2
  198. package/icc-x-api/icc-device-x-api.js.map +1 -1
  199. package/icc-x-api/icc-doctemplate-x-api.js.map +1 -1
  200. package/icc-x-api/icc-document-x-api.js +15 -15
  201. package/icc-x-api/icc-document-x-api.js.map +1 -1
  202. package/icc-x-api/icc-form-x-api.js +7 -7
  203. package/icc-x-api/icc-form-x-api.js.map +1 -1
  204. package/icc-x-api/icc-hcparty-x-api.js +4 -4
  205. package/icc-x-api/icc-hcparty-x-api.js.map +1 -1
  206. package/icc-x-api/icc-helement-x-api.js +10 -10
  207. package/icc-x-api/icc-helement-x-api.js.map +1 -1
  208. package/icc-x-api/icc-icure-maintenance-x-api.js.map +1 -1
  209. package/icc-x-api/icc-invoice-x-api.js +7 -7
  210. package/icc-x-api/icc-invoice-x-api.js.map +1 -1
  211. package/icc-x-api/icc-maintenance-task-x-api.js +7 -7
  212. package/icc-x-api/icc-maintenance-task-x-api.js.map +1 -1
  213. package/icc-x-api/icc-message-x-api.js +8 -8
  214. package/icc-x-api/icc-message-x-api.js.map +1 -1
  215. package/icc-x-api/icc-patient-x-api.js +11 -11
  216. package/icc-x-api/icc-patient-x-api.js.map +1 -1
  217. package/icc-x-api/icc-receipt-x-api.js +10 -10
  218. package/icc-x-api/icc-receipt-x-api.js.map +1 -1
  219. package/icc-x-api/icc-recovery-x-api.js +4 -4
  220. package/icc-x-api/icc-recovery-x-api.js.map +1 -1
  221. package/icc-x-api/icc-time-table-x-api.js +5 -5
  222. package/icc-x-api/icc-time-table-x-api.js.map +1 -1
  223. package/icc-x-api/icc-topic-x-api.js +9 -9
  224. package/icc-x-api/icc-topic-x-api.js.map +1 -1
  225. package/icc-x-api/icc-user-x-api.js +4 -4
  226. package/icc-x-api/icc-user-x-api.js.map +1 -1
  227. package/icc-x-api/index.js +22 -22
  228. package/icc-x-api/index.js.map +1 -1
  229. package/icc-x-api/maintenance/KeyPairUpdateRequest.js +2 -2
  230. package/icc-x-api/maintenance/KeyPairUpdateRequest.js.map +1 -1
  231. package/icc-x-api/storage/IcureStorageFacade.js +1 -1
  232. package/icc-x-api/storage/IcureStorageFacade.js.map +1 -1
  233. package/icc-x-api/storage/LocalStorageImpl.js +1 -1
  234. package/icc-x-api/storage/LocalStorageImpl.js.map +1 -1
  235. package/icc-x-api/utils/EntityWithDelegationTypeName.js +4 -4
  236. package/icc-x-api/utils/EntityWithDelegationTypeName.js.map +1 -1
  237. package/icc-x-api/utils/asn1-packer.js +2 -3
  238. package/icc-x-api/utils/asn1-packer.js.map +1 -1
  239. package/icc-x-api/utils/asn1-parser.js +1 -2
  240. package/icc-x-api/utils/asn1-parser.js.map +1 -1
  241. package/icc-x-api/utils/binary-utils.js +11 -11
  242. package/icc-x-api/utils/binary-utils.js.map +1 -1
  243. package/icc-x-api/utils/code-util.js +1 -2
  244. package/icc-x-api/utils/code-util.js.map +1 -1
  245. package/icc-x-api/utils/collection-utils.js +5 -6
  246. package/icc-x-api/utils/collection-utils.js.map +1 -1
  247. package/icc-x-api/utils/crypto-utils.d.ts +1 -1
  248. package/icc-x-api/utils/crypto-utils.js +17 -18
  249. package/icc-x-api/utils/crypto-utils.js.map +1 -1
  250. package/icc-x-api/utils/formatting-util.js +21 -21
  251. package/icc-x-api/utils/formatting-util.js.map +1 -1
  252. package/icc-x-api/utils/functional-util.js +3 -4
  253. package/icc-x-api/utils/functional-util.js.map +1 -1
  254. package/icc-x-api/utils/graph-utils.js +3 -4
  255. package/icc-x-api/utils/graph-utils.js.map +1 -1
  256. package/icc-x-api/utils/hcp-util.js +4 -4
  257. package/icc-x-api/utils/hcp-util.js.map +1 -1
  258. package/icc-x-api/utils/insurability-util.js +6 -7
  259. package/icc-x-api/utils/insurability-util.js.map +1 -1
  260. package/icc-x-api/utils/lru-temporised-async-cache.js.map +1 -1
  261. package/icc-x-api/utils/net-utils.js +3 -4
  262. package/icc-x-api/utils/net-utils.js.map +1 -1
  263. package/icc-x-api/utils/person-util.js +3 -4
  264. package/icc-x-api/utils/person-util.js.map +1 -1
  265. package/icc-x-api/utils/proxy-utils.js.map +1 -1
  266. package/icc-x-api/utils/simple-lru-cache.js.map +1 -1
  267. package/icc-x-api/utils/uuid-encoder.js +2 -2
  268. package/icc-x-api/utils/uuid-encoder.js.map +1 -1
  269. package/icc-x-api/utils/websocket.d.ts +0 -1
  270. package/icc-x-api/utils/websocket.js +3 -3
  271. package/icc-x-api/utils/websocket.js.map +1 -1
  272. package/package.json +3 -3
  273. package/test/icc-api/api/IccAgendaApi.js.map +1 -1
  274. package/test/icc-api/api/IccCalendarItemApi.js.map +1 -1
  275. package/test/icc-api/api/IccCalendarItemTypeApi.js +2 -2
  276. package/test/icc-api/api/IccCalendarItemTypeApi.js.map +1 -1
  277. package/test/icc-api/api/IccDocumentApi.js.map +1 -1
  278. package/test/icc-api/api/IccKeywordApi.js.map +1 -1
  279. package/test/icc-api/api/IccMedicalLocationApi.js.map +1 -1
  280. package/test/icc-api/api/IccPlaceApi.js.map +1 -1
  281. package/test/icc-api/api/IccUserApi.js +6 -6
  282. package/test/icc-x-api/auth/group-switch-test.js.map +1 -1
  283. package/test/icc-x-api/auth/jwt-concurrency-test.js +1 -2
  284. package/test/icc-x-api/auth/jwt-concurrency-test.js.map +1 -1
  285. package/test/icc-x-api/auth/jwt-provider-test.js.map +1 -1
  286. package/test/icc-x-api/auth/smart-auth-provider-test.js.map +1 -1
  287. package/test/icc-x-api/autofix-anonymity-test.js.map +1 -1
  288. package/test/icc-x-api/confidential-entities-test.js +1 -1
  289. package/test/icc-x-api/confidential-entities-test.js.map +1 -1
  290. package/test/icc-x-api/crud/comprehensive-crud-test.js.map +1 -1
  291. package/test/icc-x-api/crud/entities-crud-test-interface.js +24 -24
  292. package/test/icc-x-api/crud/entities-crud-test-interface.js.map +1 -1
  293. package/test/icc-x-api/crypto/anonymous-delegations-test.js +2 -2
  294. package/test/icc-x-api/crypto/anonymous-delegations-test.js.map +1 -1
  295. package/test/icc-x-api/crypto/cryptoTest.js.map +1 -1
  296. package/test/icc-x-api/crypto/delegate-ci-to-patient-with-missing-keys-test.js.map +1 -1
  297. package/test/icc-x-api/crypto/exchange-data-manager-test.js +4 -4
  298. package/test/icc-x-api/crypto/exchange-data-manager-test.js.map +1 -1
  299. package/test/icc-x-api/crypto/full-crypto-test.js +5 -5
  300. package/test/icc-x-api/crypto/full-crypto-test.js.map +1 -1
  301. package/test/icc-x-api/crypto/legacy-metadata-migration-test.js +7 -7
  302. package/test/icc-x-api/crypto/legacy-metadata-migration-test.js.map +1 -1
  303. package/test/icc-x-api/crypto/secure-delegations-manager-test.js +2 -2
  304. package/test/icc-x-api/crypto/secure-delegations-manager-test.js.map +1 -1
  305. package/test/icc-x-api/crypto/shamir.js.map +1 -1
  306. package/test/icc-x-api/crypto/soft-deleted-data-owners.js +3 -3
  307. package/test/icc-x-api/crypto/soft-deleted-data-owners.js.map +1 -1
  308. package/test/icc-x-api/entity-with-attachments-api-test.js +2 -2
  309. package/test/icc-x-api/entity-with-attachments-api-test.js.map +1 -1
  310. package/test/icc-x-api/icc-maintenance-task-x-api-test.js +4 -4
  311. package/test/icc-x-api/icc-message-x-api.js +1 -1
  312. package/test/icc-x-api/icc-message-x-api.js.map +1 -1
  313. package/test/icc-x-api/icc-patient-x-api-test.js.map +1 -1
  314. package/test/icc-x-api/icc-recovery-x-api.js.map +1 -1
  315. package/test/icc-x-api/icc-topic-x-api.js.map +1 -1
  316. package/test/icc-x-api/icc-user-x-api-test.js.map +1 -1
  317. package/test/icc-x-api/patient-user.js.map +1 -1
  318. package/test/icc-x-api/test-legacy-data-support.js.map +1 -1
  319. package/test/icc-x-api/utils/graph-test.js.map +1 -1
  320. package/test/icc-x-api/utils/lru-temporised-async-cache-test.js.map +1 -1
  321. package/test/support/CSM-243.js +2 -2
  322. package/test/support/CSM-243.js.map +1 -1
  323. package/test/support/CSM-93.js +1 -1
  324. package/test/support/CSM-93.js.map +1 -1
  325. package/test/utils/FakeDataOwnerApi.js.map +1 -1
  326. package/test/utils/FakeEncryptionKeysManager.js +2 -2
  327. package/test/utils/FakeEncryptionKeysManager.js.map +1 -1
  328. package/test/utils/FakeExchangeDataApi.js.map +1 -1
  329. package/test/utils/FakeExchangeDataManager.js.map +1 -1
  330. package/test/utils/FakeGenericApi.js.map +1 -1
  331. package/test/utils/TestApi.js +2 -2
  332. package/test/utils/TestApi.js.map +1 -1
  333. package/test/utils/TestCryptoStrategies.js.map +1 -1
  334. package/test/utils/TestStorage.js +2 -2
  335. package/test/utils/TestStorage.js.map +1 -1
  336. package/test/utils/test_utils.js +22 -22
  337. package/test/utils/test_utils.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"KeyPairUpdateRequest.js","sourceRoot":"","sources":["../../../icc-x-api/maintenance/KeyPairUpdateRequest.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,yEAAqE;AAoBrE,IAAiB,oBAAoB,CAuBpC;AAvBD,WAAiB,oBAAoB;IACnC;;OAEG;IACH,SAAgB,mBAAmB,CAAC,IAAqB;QACvD,IAAI,IAAI,CAAC,QAAQ,KAAK,oBAAoB,CAAC,SAAS;YAClD,MAAM,IAAI,KAAK,CAAC,+CAA+C,oBAAoB,CAAC,SAAS,4BAA4B,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAA;QAE3I,SAAS,cAAc,CAAC,MAAc;;YACpC,MAAM,IAAI,GAA6B,MAAA,IAAI,CAAC,UAAU,0CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,CAAA;YACpF,IAAI,CAAC,IAAI;gBAAE,MAAM,IAAI,KAAK,CAAC,4CAA4C,MAAM,8BAA8B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YAClI,MAAM,SAAS,GAAG,MAAA,IAAI,CAAC,UAAU,0CAAE,WAAW,CAAA;YAC9C,IAAI,CAAC,SAAS;gBACZ,MAAM,IAAI,KAAK,CAAC,iBAAiB,MAAA,IAAI,CAAC,UAAU,0CAAE,WAAW,iBAAiB,MAAM,8BAA8B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YAC3I,OAAO,SAAS,CAAA;QAClB,CAAC;QAED,OAAO;YACL,oBAAoB,EAAE,cAAc,CAAC,oBAAoB,CAAC,gBAAgB,CAAC;YAC3E,YAAY,EAAE,cAAc,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;YACpE,YAAY,EAAE,IAAI;SACnB,CAAA;IACH,CAAC;IAlBe,wCAAmB,sBAkBlC,CAAA;AACH,CAAC,EAvBgB,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAuBpC;AAED,WAAiB,oBAAoB;IACnC;;OAEG;IACU,qCAAgB,GAAG,sBAAsB,CAAA;IACtD;;OAEG;IACU,sCAAiB,GAAG,0BAA0B,CAAA;IAC3D;;OAEG;IACU,8BAAS,GAAG,iCAAe,CAAC,YAAY,CAAC,aAAa,CAAA;AACrE,CAAC,EAbgB,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAapC","sourcesContent":["/**\n * Represents a request to update aes exchange keys following the creation of a new key pair for a data owner.\n */\nimport { MaintenanceTask } from '../../icc-api/model/MaintenanceTask'\nimport { PropertyStub } from '../../icc-api/model/PropertyStub'\n\nexport interface KeyPairUpdateRequest {\n /**\n * New public key of the data owner, in hex-encoded spki format.\n */\n readonly newPublicKey: string\n\n /**\n * Id of the data owner which created a new key pair and wants to regain access to his exchange keys.\n */\n readonly concernedDataOwnerId: string\n\n /**\n * @internal this field is intended for internal use only and may be changed in future without notice\n */\n readonly originalTask?: MaintenanceTask\n}\n\nexport namespace KeyPairUpdateRequest {\n /**\n * Create a key pair update request from a maintenance task.\n */\n export function fromMaintenanceTask(task: MaintenanceTask): KeyPairUpdateRequest {\n if (task.taskType !== KeyPairUpdateRequest.TASK_TYPE)\n throw new Error(`Key pair update tasks should have task type ${KeyPairUpdateRequest.TASK_TYPE}, but got task with type ${task.taskType}`)\n\n function findStringProp(propId: string): string {\n const prop: PropertyStub | undefined = task.properties?.find((x) => x.id === propId)\n if (!prop) throw new Error(`Task is missing required string property ${propId} for KeyPairUpdateRequest. ${JSON.stringify(task)}`)\n const propValue = prop.typedValue?.stringValue\n if (!propValue)\n throw new Error(`Invalid value ${prop.typedValue?.stringValue} for property ${propId} for KeyPairUpdateRequest. ${JSON.stringify(task)}`)\n return propValue\n }\n\n return {\n concernedDataOwnerId: findStringProp(KeyPairUpdateRequest.OWNER_ID_PROP_ID),\n newPublicKey: findStringProp(KeyPairUpdateRequest.OWNER_PUB_PROP_ID),\n originalTask: task,\n }\n }\n}\n\nexport namespace KeyPairUpdateRequest {\n /**\n * @internal this field is intended for internal use only and may be changed in future without notice\n */\n export const OWNER_ID_PROP_ID = 'dataOwnerConcernedId'\n /**\n * @internal this field is intended for internal use only and may be changed in future without notice\n */\n export const OWNER_PUB_PROP_ID = 'dataOwnerConcernedPubKey'\n /**\n * @internal this field is intended for internal use only and may be changed in future without notice\n */\n export const TASK_TYPE = MaintenanceTask.TaskTypeEnum.KeyPairUpdate\n}\n"]}
1
+ {"version":3,"file":"KeyPairUpdateRequest.js","sourceRoot":"","sources":["../../../icc-x-api/maintenance/KeyPairUpdateRequest.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,yEAAqE;AAoBrE,IAAiB,oBAAoB,CAuBpC;AAvBD,WAAiB,oBAAoB;IACnC;;OAEG;IACH,SAAgB,mBAAmB,CAAC,IAAqB;QACvD,IAAI,IAAI,CAAC,QAAQ,KAAK,oBAAoB,CAAC,SAAS;YAClD,MAAM,IAAI,KAAK,CAAC,+CAA+C,oBAAoB,CAAC,SAAS,4BAA4B,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAA;QAE3I,SAAS,cAAc,CAAC,MAAc;;YACpC,MAAM,IAAI,GAA6B,MAAA,IAAI,CAAC,UAAU,0CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,CAAA;YACpF,IAAI,CAAC,IAAI;gBAAE,MAAM,IAAI,KAAK,CAAC,4CAA4C,MAAM,8BAA8B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YAClI,MAAM,SAAS,GAAG,MAAA,IAAI,CAAC,UAAU,0CAAE,WAAW,CAAA;YAC9C,IAAI,CAAC,SAAS;gBACZ,MAAM,IAAI,KAAK,CAAC,iBAAiB,MAAA,IAAI,CAAC,UAAU,0CAAE,WAAW,iBAAiB,MAAM,8BAA8B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YAC3I,OAAO,SAAS,CAAA;QAClB,CAAC;QAED,OAAO;YACL,oBAAoB,EAAE,cAAc,CAAC,oBAAoB,CAAC,gBAAgB,CAAC;YAC3E,YAAY,EAAE,cAAc,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;YACpE,YAAY,EAAE,IAAI;SACnB,CAAA;IACH,CAAC;IAlBe,wCAAmB,sBAkBlC,CAAA;AACH,CAAC,EAvBgB,oBAAoB,oCAApB,oBAAoB,QAuBpC;AAED,WAAiB,oBAAoB;IACnC;;OAEG;IACU,qCAAgB,GAAG,sBAAsB,CAAA;IACtD;;OAEG;IACU,sCAAiB,GAAG,0BAA0B,CAAA;IAC3D;;OAEG;IACU,8BAAS,GAAG,iCAAe,CAAC,YAAY,CAAC,aAAa,CAAA;AACrE,CAAC,EAbgB,oBAAoB,oCAApB,oBAAoB,QAapC","sourcesContent":["/**\n * Represents a request to update aes exchange keys following the creation of a new key pair for a data owner.\n */\nimport { MaintenanceTask } from '../../icc-api/model/MaintenanceTask'\nimport { PropertyStub } from '../../icc-api/model/PropertyStub'\n\nexport interface KeyPairUpdateRequest {\n /**\n * New public key of the data owner, in hex-encoded spki format.\n */\n readonly newPublicKey: string\n\n /**\n * Id of the data owner which created a new key pair and wants to regain access to his exchange keys.\n */\n readonly concernedDataOwnerId: string\n\n /**\n * @internal this field is intended for internal use only and may be changed in future without notice\n */\n readonly originalTask?: MaintenanceTask\n}\n\nexport namespace KeyPairUpdateRequest {\n /**\n * Create a key pair update request from a maintenance task.\n */\n export function fromMaintenanceTask(task: MaintenanceTask): KeyPairUpdateRequest {\n if (task.taskType !== KeyPairUpdateRequest.TASK_TYPE)\n throw new Error(`Key pair update tasks should have task type ${KeyPairUpdateRequest.TASK_TYPE}, but got task with type ${task.taskType}`)\n\n function findStringProp(propId: string): string {\n const prop: PropertyStub | undefined = task.properties?.find((x) => x.id === propId)\n if (!prop) throw new Error(`Task is missing required string property ${propId} for KeyPairUpdateRequest. ${JSON.stringify(task)}`)\n const propValue = prop.typedValue?.stringValue\n if (!propValue)\n throw new Error(`Invalid value ${prop.typedValue?.stringValue} for property ${propId} for KeyPairUpdateRequest. ${JSON.stringify(task)}`)\n return propValue\n }\n\n return {\n concernedDataOwnerId: findStringProp(KeyPairUpdateRequest.OWNER_ID_PROP_ID),\n newPublicKey: findStringProp(KeyPairUpdateRequest.OWNER_PUB_PROP_ID),\n originalTask: task,\n }\n }\n}\n\nexport namespace KeyPairUpdateRequest {\n /**\n * @internal this field is intended for internal use only and may be changed in future without notice\n */\n export const OWNER_ID_PROP_ID = 'dataOwnerConcernedId'\n /**\n * @internal this field is intended for internal use only and may be changed in future without notice\n */\n export const OWNER_PUB_PROP_ID = 'dataOwnerConcernedPubKey'\n /**\n * @internal this field is intended for internal use only and may be changed in future without notice\n */\n export const TASK_TYPE = MaintenanceTask.TaskTypeEnum.KeyPairUpdate\n}\n"]}
@@ -45,8 +45,8 @@ class IcureStorageFacade {
45
45
  * @return the keypair and if the key was generated on this device or undefined if the key pair could not be found.
46
46
  */
47
47
  loadKey(dataOwnerId, publicKeyFingerprint, legacyPublicKey) {
48
- var _a, _b;
49
48
  return __awaiter(this, void 0, void 0, function* () {
49
+ var _a, _b;
50
50
  const deviceKey = (_b = (_a = (yield this.keys.getKeypair(this.entryFor.deviceKeypairOfDataOwner(dataOwnerId, publicKeyFingerprint)))) !== null && _a !== void 0 ? _a : (yield this.keys.getKeypair(`org.taktik.icure.rsa.${dataOwnerId}.${publicKeyFingerprint}`))) !== null && _b !== void 0 ? _b : (!!legacyPublicKey && (0, utils_1.fingerprintV1)(legacyPublicKey) === publicKeyFingerprint
51
51
  ? yield this.keys.getKeypair(`org.taktik.icure.rsa.${dataOwnerId}`)
52
52
  : undefined);
@@ -1 +1 @@
1
- {"version":3,"file":"IcureStorageFacade.js","sourceRoot":"","sources":["../../../icc-x-api/storage/IcureStorageFacade.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,2CAA+C;AAE/C;;;GAGG;AACH,MAAa,kBAAkB;IAK7B,YAAY,UAA4B,EAAE,OAA8B,EAAE,gBAAyC;QACjH,IAAI,CAAC,IAAI,GAAG,UAAU,CAAA;QACtB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAA;QACnB,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAA;IAClC,CAAC;IAED;;;;;;OAMG;IACG,OAAO,CAAC,WAAmB,EAAE,oBAA4B,EAAE,OAA4B,EAAE,QAAiB;;YAC9G,MAAM,GAAG,GAAG,QAAQ;gBAClB,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,wBAAwB,CAAC,WAAW,EAAE,oBAAoB,CAAC;gBAC3E,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,iCAAiC,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAA;YACtF,MAAM,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;QAC5C,CAAC;KAAA;IAED;;;;;;;OAOG;IACG,OAAO,CACX,WAAmB,EACnB,oBAA4B,EAC5B,eAAmC;;;YAEnC,MAAM,SAAS,GACb,MAAA,MAAA,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,wBAAwB,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAC,CAAC,mCACvG,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,wBAAwB,WAAW,IAAI,oBAAoB,EAAE,CAAC,CAAC,mCAC3F,CAAC,CAAC,CAAC,eAAe,IAAI,IAAA,qBAAa,EAAC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AAC,CAAC,EAAE,EAAE;oBACxC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,KAAK;wBAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;gBAC9E,CAAC,CAAC,CAAA;gBACF,OAAO,MAAM,CAAA;aACd;;gBAAM,OAAO,EAAE,CAAA;QAClB,CAAC;KAAA;IAED;;;;;OAKG;IACG,oBAAoB,CAAC,WAAmB,EAAE,oBAA4B,EAAE,OAA4B;;YACxG,MAAM,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,wBAAwB,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,CAAA;YAC1F,MAAM,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,oCAAoC,CAAC,WAAW,EAAE,oBAAoB,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;QAC1I,CAAC;KAAA;IAED;;;;OAIG;IACG,gBAAgB,CAAC,WAAmB;;YACxC,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,wBAAwB,CAAC,WAAW,CAAC,CAAC,CAAA;QACxF,CAAC;KAAA;IAED;;;;;OAKG;IACG,4BAA4B,CAAC,WAAmB,EAAE,oBAA4B;;YAClF,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,oCAAoC,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAC,CAAA;QAC5H,CAAC;KAAA;CACF;AApHD,gDAoHC","sourcesContent":["import { KeyStorageFacade } from './KeyStorageFacade'\nimport { StorageFacade } from './StorageFacade'\nimport { StorageEntryKeysFactory } from './StorageEntryKeysFactory'\nimport { KeyPair } from '../crypto/RSA'\nimport { fingerprintV1 } from '../crypto/utils'\n\n/**\n * @internal This class is meant for internal use only and may be changed without notice.\n * Simplifies access to the storage facades for iCure-specific data storage.\n */\nexport class IcureStorageFacade {\n private readonly keys: KeyStorageFacade\n private readonly data: StorageFacade<string>\n private readonly entryFor: StorageEntryKeysFactory\n\n constructor(keyStorage: KeyStorageFacade, storage: StorageFacade<string>, entryKeysFactory: StorageEntryKeysFactory) {\n this.keys = keyStorage\n this.data = storage\n this.entryFor = entryKeysFactory\n }\n\n /**\n * Saves a key pair for the data owner.\n * @param dataOwnerId id of the data owner with the key.\n * @param publicKeyFingerprint fingerprint of the public key of the pair.\n * @param keyPair a key pair of the data owner.\n * @param isDevice true if the key was generated on this device.\n */\n async saveKey(dataOwnerId: string, publicKeyFingerprint: string, keyPair: KeyPair<JsonWebKey>, isDevice: boolean): Promise<void> {\n const key = isDevice\n ? this.entryFor.deviceKeypairOfDataOwner(dataOwnerId, publicKeyFingerprint)\n : this.entryFor.cachedRecoveredKeypairOfDataOwner(dataOwnerId, publicKeyFingerprint)\n await this.keys.storeKeyPair(key, keyPair)\n }\n\n /**\n * Get an existing key pair for the data owner.\n * @param dataOwnerId id of the data owner with the key.\n * @param publicKeyFingerprint fingerprint of a public key of the data owner.\n * @param legacyPublicKey the legacy public key of the data owner, if present (only used to know if we should search for the key in 'legacy' storage\n * locations.\n * @return the keypair and if the key was generated on this device or undefined if the key pair could not be found.\n */\n async loadKey(\n dataOwnerId: string,\n publicKeyFingerprint: string,\n legacyPublicKey: string | undefined\n ): Promise<{ pair: KeyPair<JsonWebKey>; isDevice: boolean } | undefined> {\n const deviceKey =\n (await this.keys.getKeypair(this.entryFor.deviceKeypairOfDataOwner(dataOwnerId, publicKeyFingerprint))) ??\n (await this.keys.getKeypair(`org.taktik.icure.rsa.${dataOwnerId}.${publicKeyFingerprint}`)) ??\n (!!legacyPublicKey && fingerprintV1(legacyPublicKey) === publicKeyFingerprint\n ? await this.keys.getKeypair(`org.taktik.icure.rsa.${dataOwnerId}`)\n : undefined)\n if (deviceKey) return { pair: deviceKey, isDevice: true }\n const cachedKey = await this.keys.getKeypair(this.entryFor.cachedRecoveredKeypairOfDataOwner(dataOwnerId, publicKeyFingerprint))\n if (cachedKey) return { pair: cachedKey, isDevice: false }\n return undefined\n }\n\n /**\n * Save the results of public key verification. If there were already results stored the entries will be merged. In case of conflicts the new\n * {@link verificationDetails} take priority over the stored data.\n * @param dataOwnerId id of a data owner.\n * @param verificationDetails results of verification, associates key fingerprints to true if they were verified by the user or false otherwise.\n * @return the updated keys\n */\n async saveSelfVerifiedKeys(\n dataOwnerId: string,\n verificationDetails: { [keyFingerprint: string]: boolean }\n ): Promise<{ [keyFingerprint: string]: boolean }> {\n const updated = {\n ...(await this.loadSelfVerifiedKeys(dataOwnerId)),\n ...verificationDetails,\n }\n await this.data.setItem(this.entryFor.selfPublicKeysVerificationCacheForDataOwner(dataOwnerId), JSON.stringify(updated))\n return updated\n }\n\n /**\n * Get the last saved results of public key verification.\n * @param dataOwnerId id of a data owner.\n * @return saved results of verification, associates key fingerprints to true if they were verified by the user or false otherwise. If no results\n * were saved returns an empty object instead.\n * @throws if the stored results are not in a valid format.\n */\n async loadSelfVerifiedKeys(dataOwnerId: string): Promise<{ [keyFingerprint: string]: boolean }> {\n const dataString = await this.data.getItem(this.entryFor.selfPublicKeysVerificationCacheForDataOwner(dataOwnerId))\n if (dataString) {\n const parsed = JSON.parse(dataString)\n Object.entries(parsed).forEach(([k, v]) => {\n if (v !== true && v !== false) throw new Error(`Unexpected entry ${k}:${v}`)\n })\n return parsed\n } else return {}\n }\n\n /**\n * Saves a signature and verification key pair. Overrides previously saved signature keys (but keeps signature verification keys).\n * @param dataOwnerId id of the data owner with the key.\n * @param publicKeyFingerprint fingerprint of the public key of the pair.\n * @param keyPair the key pair to save.\n */\n async saveSignatureKeyPair(dataOwnerId: string, publicKeyFingerprint: string, keyPair: KeyPair<JsonWebKey>): Promise<void> {\n await this.keys.storeKeyPair(this.entryFor.signatureKeyForDataOwner(dataOwnerId), keyPair)\n await this.keys.storePublicKey(this.entryFor.signatureVerificationKeyForDataOwner(dataOwnerId, publicKeyFingerprint), keyPair.publicKey)\n }\n\n /**\n * Loads the signature key for the data owner.\n * @param dataOwnerId id of the data owner with the key.\n * @return the signature key for the data owner or undefined if there is no signature key stored.\n */\n async loadSignatureKey(dataOwnerId: string): Promise<KeyPair<JsonWebKey> | undefined> {\n return await this.keys.getKeypair(this.entryFor.signatureKeyForDataOwner(dataOwnerId))\n }\n\n /**\n * Loads the signature verification key for a data owner with the provided fingerprint.\n * @param dataOwnerId id of the data owner with the key.\n * @param publicKeyFingerprint fingerprint of the verification key.\n * @return the requested signature verification key or undefined if the key could not be found.\n */\n async loadSignatureVerificationKey(dataOwnerId: string, publicKeyFingerprint: string): Promise<JsonWebKey | undefined> {\n return await this.keys.getPublicKey(this.entryFor.signatureVerificationKeyForDataOwner(dataOwnerId, publicKeyFingerprint))\n }\n}\n"]}
1
+ {"version":3,"file":"IcureStorageFacade.js","sourceRoot":"","sources":["../../../icc-x-api/storage/IcureStorageFacade.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,2CAA+C;AAE/C;;;GAGG;AACH,MAAa,kBAAkB;IAK7B,YAAY,UAA4B,EAAE,OAA8B,EAAE,gBAAyC;QACjH,IAAI,CAAC,IAAI,GAAG,UAAU,CAAA;QACtB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAA;QACnB,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAA;IAClC,CAAC;IAED;;;;;;OAMG;IACG,OAAO,CAAC,WAAmB,EAAE,oBAA4B,EAAE,OAA4B,EAAE,QAAiB;;YAC9G,MAAM,GAAG,GAAG,QAAQ;gBAClB,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,wBAAwB,CAAC,WAAW,EAAE,oBAAoB,CAAC;gBAC3E,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,iCAAiC,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAA;YACtF,MAAM,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,CA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AAC;KAAA;IAED;;;;;OAKG;IACG,4BAA4B,CAAC,WAAmB,EAAE,oBAA4B;;YAClF,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,oCAAoC,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAC,CAAA;QAC5H,CAAC;KAAA;CACF;AApHD,gDAoHC","sourcesContent":["import { KeyStorageFacade } from './KeyStorageFacade'\nimport { StorageFacade } from './StorageFacade'\nimport { StorageEntryKeysFactory } from './StorageEntryKeysFactory'\nimport { KeyPair } from '../crypto/RSA'\nimport { fingerprintV1 } from '../crypto/utils'\n\n/**\n * @internal This class is meant for internal use only and may be changed without notice.\n * Simplifies access to the storage facades for iCure-specific data storage.\n */\nexport class IcureStorageFacade {\n private readonly keys: KeyStorageFacade\n private readonly data: StorageFacade<string>\n private readonly entryFor: StorageEntryKeysFactory\n\n constructor(keyStorage: KeyStorageFacade, storage: StorageFacade<string>, entryKeysFactory: StorageEntryKeysFactory) {\n this.keys = keyStorage\n this.data = storage\n this.entryFor = entryKeysFactory\n }\n\n /**\n * Saves a key pair for the data owner.\n * @param dataOwnerId id of the data owner with the key.\n * @param publicKeyFingerprint fingerprint of the public key of the pair.\n * @param keyPair a key pair of the data owner.\n * @param isDevice true if the key was generated on this device.\n */\n async saveKey(dataOwnerId: string, publicKeyFingerprint: string, keyPair: KeyPair<JsonWebKey>, isDevice: boolean): Promise<void> {\n const key = isDevice\n ? this.entryFor.deviceKeypairOfDataOwner(dataOwnerId, publicKeyFingerprint)\n : this.entryFor.cachedRecoveredKeypairOfDataOwner(dataOwnerId, publicKeyFingerprint)\n await this.keys.storeKeyPair(key, keyPair)\n }\n\n /**\n * Get an existing key pair for the data owner.\n * @param dataOwnerId id of the data owner with the key.\n * @param publicKeyFingerprint fingerprint of a public key of the data owner.\n * @param legacyPublicKey the legacy public key of the data owner, if present (only used to know if we should search for the key in 'legacy' storage\n * locations.\n * @return the keypair and if the key was generated on this device or undefined if the key pair could not be found.\n */\n async loadKey(\n dataOwnerId: string,\n publicKeyFingerprint: string,\n legacyPublicKey: string | undefined\n ): Promise<{ pair: KeyPair<JsonWebKey>; isDevice: boolean } | undefined> {\n const deviceKey =\n (await this.keys.getKeypair(this.entryFor.deviceKeypairOfDataOwner(dataOwnerId, publicKeyFingerprint))) ??\n (await this.keys.getKeypair(`org.taktik.icure.rsa.${dataOwnerId}.${publicKeyFingerprint}`)) ??\n (!!legacyPublicKey && fingerprintV1(legacyPublicKey) === publicKeyFingerprint\n ? await this.keys.getKeypair(`org.taktik.icure.rsa.${dataOwnerId}`)\n : undefined)\n if (deviceKey) return { pair: deviceKey, isDevice: true }\n const cachedKey = await this.keys.getKeypair(this.entryFor.cachedRecoveredKeypairOfDataOwner(dataOwnerId, publicKeyFingerprint))\n if (cachedKey) return { pair: cachedKey, isDevice: false }\n return undefined\n }\n\n /**\n * Save the results of public key verification. If there were already results stored the entries will be merged. In case of conflicts the new\n * {@link verificationDetails} take priority over the stored data.\n * @param dataOwnerId id of a data owner.\n * @param verificationDetails results of verification, associates key fingerprints to true if they were verified by the user or false otherwise.\n * @return the updated keys\n */\n async saveSelfVerifiedKeys(\n dataOwnerId: string,\n verificationDetails: { [keyFingerprint: string]: boolean }\n ): Promise<{ [keyFingerprint: string]: boolean }> {\n const updated = {\n ...(await this.loadSelfVerifiedKeys(dataOwnerId)),\n ...verificationDetails,\n }\n await this.data.setItem(this.entryFor.selfPublicKeysVerificationCacheForDataOwner(dataOwnerId), JSON.stringify(updated))\n return updated\n }\n\n /**\n * Get the last saved results of public key verification.\n * @param dataOwnerId id of a data owner.\n * @return saved results of verification, associates key fingerprints to true if they were verified by the user or false otherwise. If no results\n * were saved returns an empty object instead.\n * @throws if the stored results are not in a valid format.\n */\n async loadSelfVerifiedKeys(dataOwnerId: string): Promise<{ [keyFingerprint: string]: boolean }> {\n const dataString = await this.data.getItem(this.entryFor.selfPublicKeysVerificationCacheForDataOwner(dataOwnerId))\n if (dataString) {\n const parsed = JSON.parse(dataString)\n Object.entries(parsed).forEach(([k, v]) => {\n if (v !== true && v !== false) throw new Error(`Unexpected entry ${k}:${v}`)\n })\n return parsed\n } else return {}\n }\n\n /**\n * Saves a signature and verification key pair. Overrides previously saved signature keys (but keeps signature verification keys).\n * @param dataOwnerId id of the data owner with the key.\n * @param publicKeyFingerprint fingerprint of the public key of the pair.\n * @param keyPair the key pair to save.\n */\n async saveSignatureKeyPair(dataOwnerId: string, publicKeyFingerprint: string, keyPair: KeyPair<JsonWebKey>): Promise<void> {\n await this.keys.storeKeyPair(this.entryFor.signatureKeyForDataOwner(dataOwnerId), keyPair)\n await this.keys.storePublicKey(this.entryFor.signatureVerificationKeyForDataOwner(dataOwnerId, publicKeyFingerprint), keyPair.publicKey)\n }\n\n /**\n * Loads the signature key for the data owner.\n * @param dataOwnerId id of the data owner with the key.\n * @return the signature key for the data owner or undefined if there is no signature key stored.\n */\n async loadSignatureKey(dataOwnerId: string): Promise<KeyPair<JsonWebKey> | undefined> {\n return await this.keys.getKeypair(this.entryFor.signatureKeyForDataOwner(dataOwnerId))\n }\n\n /**\n * Loads the signature verification key for a data owner with the provided fingerprint.\n * @param dataOwnerId id of the data owner with the key.\n * @param publicKeyFingerprint fingerprint of the verification key.\n * @return the requested signature verification key or undefined if the key could not be found.\n */\n async loadSignatureVerificationKey(dataOwnerId: string, publicKeyFingerprint: string): Promise<JsonWebKey | undefined> {\n return await this.keys.getPublicKey(this.entryFor.signatureVerificationKeyForDataOwner(dataOwnerId, publicKeyFingerprint))\n }\n}\n"]}
@@ -12,8 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.LocalStorageImpl = void 0;
13
13
  class LocalStorageImpl {
14
14
  getItem(key) {
15
- var _a;
16
15
  return __awaiter(this, void 0, void 0, function* () {
16
+ var _a;
17
17
  if (typeof Storage === 'undefined') {
18
18
  console.error('Your browser does not support HTML5 Browser Local Storage !');
19
19
  throw new Error('Your browser does not support HTML5 Browser Local Storage !');
@@ -1 +1 @@
1
- {"version":3,"file":"LocalStorageImpl.js","sourceRoot":"","sources":["../../../icc-x-api/storage/LocalStorageImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAa,gBAAgB;IACrB,OAAO,CAAC,GAAW;;;YACvB,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE;gBAClC,OAAO,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAA;gBAC5E,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAA;aAC/E;YACD,OAAO,MAAA,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,mCAAI,SAAS,CAAA;;KAC9C;IAEK,UAAU,CAAC,GAAW;;YAC1B,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE;gBAClC,OAAO,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAA;gBAC5E,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAA;aAC/E;YACD,OAAO,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;QACrC,CAAC;KAAA;IAEK,OAAO,CAAC,GAAW,EAAE,YAAoB;;YAC7C,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE;gBAClC,OAAO,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAA;gBAC5E,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAA;aAC/E;YACD,OAAO,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,YAAY,CAAC,CAAA;QAChD,CAAC;KAAA;CACF;AAxBD,4CAwBC","sourcesContent":["import { StorageFacade } from './StorageFacade'\n\nexport class LocalStorageImpl implements StorageFacade<string> {\n async getItem(key: string): Promise<string | undefined> {\n if (typeof Storage === 'undefined') {\n console.error('Your browser does not support HTML5 Browser Local Storage !')\n throw new Error('Your browser does not support HTML5 Browser Local Storage !')\n }\n return localStorage.getItem(key) ?? undefined\n }\n\n async removeItem(key: string): Promise<void> {\n if (typeof Storage === 'undefined') {\n console.error('Your browser does not support HTML5 Browser Local Storage !')\n throw new Error('Your browser does not support HTML5 Browser Local Storage !')\n }\n return localStorage.removeItem(key)\n }\n\n async setItem(key: string, valueToStore: string): Promise<void> {\n if (typeof Storage === 'undefined') {\n console.error('Your browser does not support HTML5 Browser Local Storage !')\n throw new Error('Your browser does not support HTML5 Browser Local Storage !')\n }\n return localStorage.setItem(key, valueToStore)\n }\n}\n"]}
1
+ {"version":3,"file":"LocalStorageImpl.js","sourceRoot":"","sources":["../../../icc-x-api/storage/LocalStorageImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAa,gBAAgB;IACrB,OAAO,CAAC,GAAW;;;YACvB,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE,CAAC;gBACnC,OAAO,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAA;gBAC5E,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAA;YAChF,CAAC;YACD,OAAO,MAAA,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,mCAAI,SAAS,CAAA;QAC/C,CAAC;KAAA;IAEK,UAAU,CAAC,GAAW;;YAC1B,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE,CAAC;gBACnC,OAAO,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAA;gBAC5E,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAA;YAChF,CAAC;YACD,OAAO,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;QACrC,CAAC;KAAA;IAEK,OAAO,CAAC,GAAW,EAAE,YAAoB;;YAC7C,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE,CAAC;gBACnC,OAAO,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAA;gBAC5E,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAA;YAChF,CAAC;YACD,OAAO,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,YAAY,CAAC,CAAA;QAChD,CAAC;KAAA;CACF;AAxBD,4CAwBC","sourcesContent":["import { StorageFacade } from './StorageFacade'\n\nexport class LocalStorageImpl implements StorageFacade<string> {\n async getItem(key: string): Promise<string | undefined> {\n if (typeof Storage === 'undefined') {\n console.error('Your browser does not support HTML5 Browser Local Storage !')\n throw new Error('Your browser does not support HTML5 Browser Local Storage !')\n }\n return localStorage.getItem(key) ?? undefined\n }\n\n async removeItem(key: string): Promise<void> {\n if (typeof Storage === 'undefined') {\n console.error('Your browser does not support HTML5 Browser Local Storage !')\n throw new Error('Your browser does not support HTML5 Browser Local Storage !')\n }\n return localStorage.removeItem(key)\n }\n\n async setItem(key: string, valueToStore: string): Promise<void> {\n if (typeof Storage === 'undefined') {\n console.error('Your browser does not support HTML5 Browser Local Storage !')\n throw new Error('Your browser does not support HTML5 Browser Local Storage !')\n }\n return localStorage.setItem(key, valueToStore)\n }\n}\n"]}
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tryGetEncryptedEntityClassOf = exports.encryptedEntityClassOf = exports.entityWithDelegationTypeNames = exports.EntityWithDelegationTypeName = void 0;
3
+ exports.entityWithDelegationTypeNames = exports.EntityWithDelegationTypeName = void 0;
4
+ exports.encryptedEntityClassOf = encryptedEntityClassOf;
5
+ exports.tryGetEncryptedEntityClassOf = tryGetEncryptedEntityClassOf;
4
6
  var EntityWithDelegationTypeName;
5
7
  (function (EntityWithDelegationTypeName) {
6
8
  EntityWithDelegationTypeName["Article"] = "Article";
@@ -18,7 +20,7 @@ var EntityWithDelegationTypeName;
18
20
  EntityWithDelegationTypeName["Receipt"] = "Receipt";
19
21
  EntityWithDelegationTypeName["TimeTable"] = "TimeTable";
20
22
  EntityWithDelegationTypeName["Topic"] = "Topic";
21
- })(EntityWithDelegationTypeName = exports.EntityWithDelegationTypeName || (exports.EntityWithDelegationTypeName = {}));
23
+ })(EntityWithDelegationTypeName || (exports.EntityWithDelegationTypeName = EntityWithDelegationTypeName = {}));
22
24
  exports.entityWithDelegationTypeNames = new Set([
23
25
  EntityWithDelegationTypeName.Article,
24
26
  EntityWithDelegationTypeName.AccessLog,
@@ -53,7 +55,6 @@ function encryptedEntityClassOf(entity, declaredClassName) {
53
55
  `declared: ${declaredClassName ? '"' + declaredClassName + '"' : 'undefined'}).` +
54
56
  `Please specify a valid class name.\nValid class names are ${Array.from(exports.entityWithDelegationTypeNames)}.`);
55
57
  }
56
- exports.encryptedEntityClassOf = encryptedEntityClassOf;
57
58
  /**
58
59
  * @internal this function is meant for internal use only and may be changed without notice
59
60
  * Gets the class of an encrypted entity. Returns undefined if the class can't be retrieved.
@@ -89,5 +90,4 @@ function tryGetEncryptedEntityClassOf(entity, declaredClassName) {
89
90
  else
90
91
  return undefined;
91
92
  }
92
- exports.tryGetEncryptedEntityClassOf = tryGetEncryptedEntityClassOf;
93
93
  //# sourceMappingURL=EntityWithDelegationTypeName.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EntityWithDelegationTypeName.js","sourceRoot":"","sources":["../../../icc-x-api/utils/EntityWithDelegationTypeName.ts"],"names":[],"mappings":";;;AAKA,IAAY,4BAgBX;AAhBD,WAAY,4BAA4B;IACtC,mDAAmB,CAAA;IACnB,uDAAuB,CAAA;IACvB,6DAA6B,CAAA;IAC7B,iEAAiC,CAAA;IACjC,mDAAmB,CAAA;IACnB,qDAAqB,CAAA;IACrB,6CAAa,CAAA;IACb,+DAA+B,CAAA;IAC/B,mDAAmB,CAAA;IACnB,mEAAmC,CAAA;IACnC,mDAAmB,CAAA;IACnB,mDAAmB,CAAA;IACnB,mDAAmB,CAAA;IACnB,uDAAuB,CAAA;IACvB,+CAAe,CAAA;AACjB,CAAC,EAhBW,4BAA4B,GAA5B,oCAA4B,KAA5B,oCAA4B,QAgBvC;AAEY,QAAA,6BAA6B,GAAsC,IAAI,GAAG,CAAC;IACtF,4BAA4B,CAAC,OAAO;IACpC,4BAA4B,CAAC,SAAS;IACtC,4BAA4B,CAAC,YAAY;IACzC,4BAA4B,CAAC,cAAc;IAC3C,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AAC,uBAAuB,iBAAiB,sDAAsD,KAAK,SAAS,SAAS,IAAI,CAAC,CAAA;YAC5I,OAAO,SAAyC,CAAA;SACjD;KACF;IACD,IAAI,CAAC,iBAAiB;QACpB,OAAO,CAAC,IAAI,CACV,iIAAiI;YAC/H,kFAAkF,CACrF,CAAA;IACH,MAAM,eAAe,GAAG,MAAA,MAAM,CAAC,WAAW,0CAAE,IAAI,CAAA;IAChD,IAAI,qCAA6B,CAAC,GAAG,CAAC,eAAsB,CAAC,EAAE;QAC7D,IAAI,iBAAiB,IAAI,iBAAiB,KAAK,eAAe;YAC5D,MAAM,IAAI,KAAK,CAAC,uBAAuB,iBAAiB,4CAA4C,eAAe,GAAG,CAAC,CAAA;QACzH,OAAO,eAA+C,CAAA;KACvD;SAAM,IAAI,iBAAiB,IAAI,qCAA6B,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE;QACpF,OAAO,iBAAiB,CAAA;KACzB;;QAAM,OAAO,SAAS,CAAA;AACzB,CAAC;AA3BD,oEA2BC","sourcesContent":["/**\n * Names of all possible encrypted entity types.\n */\nimport { EncryptedEntity, EncryptedEntityStub } from '../../icc-api/model/models'\n\nexport enum EntityWithDelegationTypeName {\n Article = 'Article',\n AccessLog = 'AccessLog',\n CalendarItem = 'CalendarItem',\n Classification = 'Classification',\n Contact = 'Contact',\n Document = 'Document',\n Form = 'Form',\n HealthElement = 'HealthElement',\n Invoice = 'Invoice',\n MaintenanceTask = 'MaintenanceTask',\n Message = 'Message',\n Patient = 'Patient',\n Receipt = 'Receipt',\n TimeTable = 'TimeTable',\n Topic = 'Topic',\n}\n\nexport const entityWithDelegationTypeNames: Set<EntityWithDelegationTypeName> = new Set([\n EntityWithDelegationTypeName.Article,\n EntityWithDelegationTypeName.AccessLog,\n EntityWithDelegationTypeName.CalendarItem,\n EntityWithDelegationTypeName.Classification,\n EntityWithDelegationTypeName.Contact,\n EntityWithDelegationTypeName.Document,\n EntityWithDelegationTypeName.Form,\n EntityWithDelegationTypeName.HealthElement,\n EntityWithDelegationTypeName.Invoice,\n EntityWithDelegationTypeName.MaintenanceTask,\n EntityWithDelegationTypeName.Message,\n EntityWithDelegationTypeName.Patient,\n EntityWithDelegationTypeName.Receipt,\n EntityWithDelegationTypeName.TimeTable,\n])\n\n/**\n * Type containing information on an entity and its type. If the entity is a stub (EncryptedEntityStub or IcureStub) the type should refer to the\n * original entity from which the stub was extracted.\n */\nexport type EncryptedEntityWithType = { entity: EncryptedEntityStub | EncryptedEntity; type: EntityWithDelegationTypeName }\n\n/**\n * @internal this function is meant for internal use only and may be changed without notice\n * Gets the class of an encrypted entity. Throws error if the class can't be retrieved.\n * @param entity the entity object\n * @param declaredClassName the declared type of the entity, to use as a fallback in case the original class name can't be retrieved (for example\n * due to the use of minified code).\n * @return the class of the encrypted entity\n */\nexport function encryptedEntityClassOf(\n entity: EncryptedEntity | EncryptedEntityStub,\n declaredClassName: EntityWithDelegationTypeName | undefined\n): EntityWithDelegationTypeName {\n const entityClass = tryGetEncryptedEntityClassOf(entity, declaredClassName)\n if (entityClass) {\n return entityClass\n } else\n throw new Error(\n `No valid encrypted entity class name (constructor: \"${entity.constructor.name}\",` +\n `declared: ${declaredClassName ? '\"' + declaredClassName + '\"' : 'undefined'}).` +\n `Please specify a valid class name.\\nValid class names are ${Array.from(entityWithDelegationTypeNames)}.`\n )\n}\n\n/**\n * @internal this function is meant for internal use only and may be changed without notice\n * Gets the class of an encrypted entity. Returns undefined if the class can't be retrieved.\n * @param entity the entity object\n * @param declaredClassName the declared type of the entity, to use as a fallback in case the original class name can't be retrieved (for example\n * due to the use of minified code).\n * @return the class of the encrypted entity\n */\nexport function tryGetEncryptedEntityClassOf(\n entity: EncryptedEntity | EncryptedEntityStub,\n declaredClassName: EntityWithDelegationTypeName | undefined\n): EntityWithDelegationTypeName | undefined {\n const _type = (entity as any)._type\n if (_type && (typeof _type === 'string' || _type instanceof String)) {\n const splitType = _type.split('.')\n const candidate = splitType[splitType.length - 1]\n if (entityWithDelegationTypeNames.has(candidate as any)) {\n if (declaredClassName && declaredClassName !== candidate)\n throw new Error(`Declared type name \"${declaredClassName}\" does not match type detected from field \\`_type:\"${_type}\"\\` (\"${candidate}\")`)\n return candidate as EntityWithDelegationTypeName\n }\n }\n if (!declaredClassName)\n console.warn(\n 'Usage of a delegation-related method without specifying the entity class name, and input object does not have a `_type` value. ' +\n 'Will use constructor name as fallback, but this may not work with minified code.'\n )\n const constructorName = entity.constructor?.name\n if (entityWithDelegationTypeNames.has(constructorName as any)) {\n if (declaredClassName && declaredClassName !== constructorName)\n throw new Error(`Declared type name \"${declaredClassName}\" does not match valid constructor name \"${constructorName}\"`)\n return constructorName as EntityWithDelegationTypeName\n } else if (declaredClassName && entityWithDelegationTypeNames.has(declaredClassName)) {\n return declaredClassName\n } else return undefined\n}\n"]}
1
+ {"version":3,"file":"EntityWithDelegationTypeName.js","sourceRoot":"","sources":["../../../icc-x-api/utils/EntityWithDelegationTypeName.ts"],"names":[],"mappings":";;;AAsDA,wDAaC;AAUD,oEA2BC;AAnGD,IAAY,4BAgBX;AAhBD,WAAY,4BAA4B;IACtC,mDAAmB,CAAA;IACnB,uDAAuB,CAAA;IACvB,6DAA6B,CAAA;IAC7B,iEAAiC,CAAA;IACjC,mDAAmB,CAAA;IACnB,qDAAqB,CAAA;IACrB,6CAAa,CAAA;IACb,+DAA+B,CAAA;IAC/B,mDAAmB,CAAA;IACnB,mEAAmC,CAAA;IACnC,mDAAmB,CAAA;IACnB,mDAAmB,CAAA;IACnB,mDAAmB,CAAA;IACnB,uDAAuB,CAAA;IACvB,+CAAe,CAAA;AACjB,CAAC,EAhBW,4BAA4B,4CAA5B,4BAA4B,QAgBvC;AAEY,QAAA,6BAA6B,GAAsC,IAAI,GAAG,CAAC;IACtF,4BAA4B,CAAC,OAAO;IACpC,4BAA4B,CAAC,SAAS;IACtC,4BAA4B,CAAC,YAAY;IACzC,4BAA4B,CAAC,cAAc;IAC3C,4BAA4B,CAAC,OAAO;IACpC,4BA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iB,sDAAsD,KAAK,SAAS,SAAS,IAAI,CAAC,CAAA;YAC5I,OAAO,SAAyC,CAAA;QAClD,CAAC;IACH,CAAC;IACD,IAAI,CAAC,iBAAiB;QACpB,OAAO,CAAC,IAAI,CACV,iIAAiI;YAC/H,kFAAkF,CACrF,CAAA;IACH,MAAM,eAAe,GAAG,MAAA,MAAM,CAAC,WAAW,0CAAE,IAAI,CAAA;IAChD,IAAI,qCAA6B,CAAC,GAAG,CAAC,eAAsB,CAAC,EAAE,CAAC;QAC9D,IAAI,iBAAiB,IAAI,iBAAiB,KAAK,eAAe;YAC5D,MAAM,IAAI,KAAK,CAAC,uBAAuB,iBAAiB,4CAA4C,eAAe,GAAG,CAAC,CAAA;QACzH,OAAO,eAA+C,CAAA;IACxD,CAAC;SAAM,IAAI,iBAAiB,IAAI,qCAA6B,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,CAAC;QACrF,OAAO,iBAAiB,CAAA;IAC1B,CAAC;;QAAM,OAAO,SAAS,CAAA;AACzB,CAAC","sourcesContent":["/**\n * Names of all possible encrypted entity types.\n */\nimport { EncryptedEntity, EncryptedEntityStub } from '../../icc-api/model/models'\n\nexport enum EntityWithDelegationTypeName {\n Article = 'Article',\n AccessLog = 'AccessLog',\n CalendarItem = 'CalendarItem',\n Classification = 'Classification',\n Contact = 'Contact',\n Document = 'Document',\n Form = 'Form',\n HealthElement = 'HealthElement',\n Invoice = 'Invoice',\n MaintenanceTask = 'MaintenanceTask',\n Message = 'Message',\n Patient = 'Patient',\n Receipt = 'Receipt',\n TimeTable = 'TimeTable',\n Topic = 'Topic',\n}\n\nexport const entityWithDelegationTypeNames: Set<EntityWithDelegationTypeName> = new Set([\n EntityWithDelegationTypeName.Article,\n EntityWithDelegationTypeName.AccessLog,\n EntityWithDelegationTypeName.CalendarItem,\n EntityWithDelegationTypeName.Classification,\n EntityWithDelegationTypeName.Contact,\n EntityWithDelegationTypeName.Document,\n EntityWithDelegationTypeName.Form,\n EntityWithDelegationTypeName.HealthElement,\n EntityWithDelegationTypeName.Invoice,\n EntityWithDelegationTypeName.MaintenanceTask,\n EntityWithDelegationTypeName.Message,\n EntityWithDelegationTypeName.Patient,\n EntityWithDelegationTypeName.Receipt,\n EntityWithDelegationTypeName.TimeTable,\n])\n\n/**\n * Type containing information on an entity and its type. If the entity is a stub (EncryptedEntityStub or IcureStub) the type should refer to the\n * original entity from which the stub was extracted.\n */\nexport type EncryptedEntityWithType = { entity: EncryptedEntityStub | EncryptedEntity; type: EntityWithDelegationTypeName }\n\n/**\n * @internal this function is meant for internal use only and may be changed without notice\n * Gets the class of an encrypted entity. Throws error if the class can't be retrieved.\n * @param entity the entity object\n * @param declaredClassName the declared type of the entity, to use as a fallback in case the original class name can't be retrieved (for example\n * due to the use of minified code).\n * @return the class of the encrypted entity\n */\nexport function encryptedEntityClassOf(\n entity: EncryptedEntity | EncryptedEntityStub,\n declaredClassName: EntityWithDelegationTypeName | undefined\n): EntityWithDelegationTypeName {\n const entityClass = tryGetEncryptedEntityClassOf(entity, declaredClassName)\n if (entityClass) {\n return entityClass\n } else\n throw new Error(\n `No valid encrypted entity class name (constructor: \"${entity.constructor.name}\",` +\n `declared: ${declaredClassName ? '\"' + declaredClassName + '\"' : 'undefined'}).` +\n `Please specify a valid class name.\\nValid class names are ${Array.from(entityWithDelegationTypeNames)}.`\n )\n}\n\n/**\n * @internal this function is meant for internal use only and may be changed without notice\n * Gets the class of an encrypted entity. Returns undefined if the class can't be retrieved.\n * @param entity the entity object\n * @param declaredClassName the declared type of the entity, to use as a fallback in case the original class name can't be retrieved (for example\n * due to the use of minified code).\n * @return the class of the encrypted entity\n */\nexport function tryGetEncryptedEntityClassOf(\n entity: EncryptedEntity | EncryptedEntityStub,\n declaredClassName: EntityWithDelegationTypeName | undefined\n): EntityWithDelegationTypeName | undefined {\n const _type = (entity as any)._type\n if (_type && (typeof _type === 'string' || _type instanceof String)) {\n const splitType = _type.split('.')\n const candidate = splitType[splitType.length - 1]\n if (entityWithDelegationTypeNames.has(candidate as any)) {\n if (declaredClassName && declaredClassName !== candidate)\n throw new Error(`Declared type name \"${declaredClassName}\" does not match type detected from field \\`_type:\"${_type}\"\\` (\"${candidate}\")`)\n return candidate as EntityWithDelegationTypeName\n }\n }\n if (!declaredClassName)\n console.warn(\n 'Usage of a delegation-related method without specifying the entity class name, and input object does not have a `_type` value. ' +\n 'Will use constructor name as fallback, but this may not work with minified code.'\n )\n const constructorName = entity.constructor?.name\n if (entityWithDelegationTypeNames.has(constructorName as any)) {\n if (declaredClassName && declaredClassName !== constructorName)\n throw new Error(`Declared type name \"${declaredClassName}\" does not match valid constructor name \"${constructorName}\"`)\n return constructorName as EntityWithDelegationTypeName\n } else if (declaredClassName && entityWithDelegationTypeNames.has(declaredClassName)) {\n return declaredClassName\n } else return undefined\n}\n"]}
@@ -6,7 +6,8 @@
6
6
  *
7
7
  * Ported to Typescript by iCure sa */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.pack = exports.packOther = void 0;
9
+ exports.packOther = packOther;
10
+ exports.pack = pack;
10
11
  const numToHex = function (d) {
11
12
  const ds = d.toString(16);
12
13
  if (ds.length % 2) {
@@ -47,7 +48,6 @@ function packOther(...args) {
47
48
  }
48
49
  return hex + numToHex(str.length / 2) + str;
49
50
  }
50
- exports.packOther = packOther;
51
51
  // The Integer type has some special rules
52
52
  function packUInt(...arr) {
53
53
  const str = arr.join('');
@@ -79,5 +79,4 @@ function pack(arr) {
79
79
  const packed = '03' === typ ? packBitStr(str) : '02' === typ ? packUInt(str) : packOther(typ, str);
80
80
  return packed;
81
81
  }
82
- exports.pack = pack;
83
82
  //# sourceMappingURL=asn1-packer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"asn1-packer.js","sourceRoot":"","sources":["../../../icc-x-api/utils/asn1-packer.ts"],"names":[],"mappings":";AAAA,+CAA+C;AAC/C;;;;sCAIsC;;;AAEtC,MAAM,QAAQ,GAAG,UAAU,CAAS;IAClC,MAAM,EAAE,G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AC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAElG,OAAO,MAAM,CAAA;AACf,CAAC;AAfD,oBAeC","sourcesContent":["// Copyright 2018 AJ ONeal. All rights reserved\n/* This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n *\n * Ported to Typescript by iCure sa */\n\nconst numToHex = function (d: number): string {\n const ds = d.toString(16)\n if (ds.length % 2) {\n return '0' + ds\n }\n return ds\n}\n\n//\n// Packer\n//\n// Almost every ASN.1 type that's important for CSR\n// can be represented generically with only a few rules.\nexport function packOther(...args: string[]) {\n const typ: string = args.shift()!\n const str: string = args.join('').replace(/\\s+/g, '').toLowerCase()\n var len: number = str.length / 2\n var lenlen = 0\n var hex = typ\n\n // We can't have an odd number of hex chars\n if (len !== Math.round(len)) {\n throw new Error('invalid hex')\n }\n\n // The first byte of any ASN.1 sequence is the type (Sequence, Integer, etc)\n // The second byte is either the size of the value, or the size of its size\n // 1. If the second byte is < 0x80 (128) it is considered the size\n // 2. If it is > 0x80 then it describes the number of bytes of the size\n // ex: 0x82 means the next 2 bytes describe the size of the value\n // 3. The special case of exactly 0x80 is \"indefinite\" length (to end-of-file)\n if (len > 127) {\n lenlen += 1\n while (len > 255) {\n lenlen += 1\n len = len >> 8\n }\n }\n\n if (lenlen) {\n hex += numToHex(0x80 + lenlen)\n }\n return hex + numToHex(str.length / 2) + str\n}\n\n// The Integer type has some special rules\nfunction packUInt(...arr: string[]) {\n const str = arr.join('')\n const first = parseInt(str.slice(0, 2), 16)\n\n // If the first byte is 0x80 or greater, the number is considered negative\n // Therefore we add a '00' prefix if the 0x80 bit is set\n return 0x80 & first ? packOther('02', '00' + str) : packOther('02', str)\n}\n\n// The Bit String type also has a special rule\nfunction packBitStr(...arr: string[]) {\n var str = arr.join('')\n // '00' is a mask of how many bits of the next byte to ignore\n return packOther('03', '00' + str)\n}\n\nexport type Asn1Item = number | string | Asn1Item[]\n\nexport function pack(arr: Asn1Item[]) {\n var typ = numToHex(arr[0] as number)\n var str = ''\n if (arr[1]) {\n if (Array.isArray(arr[1])) {\n arr[1].forEach((a) => (str += pack(a as Asn1Item[])))\n } else if ('string' === typeof arr[1]) {\n str = arr[1]\n } else {\n throw new Error('unexpected item')\n }\n }\n const packed = '03' === typ ? packBitStr(str) : '02' === typ ? packUInt(str) : packOther(typ, str)\n\n return packed\n}\n"]}
1
+ {"version":3,"file":"asn1-packer.js","sourceRoot":"","sources":["../../../icc-x-api/utils/asn1-packer.ts"],"names":[],"mappings":";AAAA,+CAA+C;AAC/C;;;;sCAIsC;;AAetC,8BA8BC;AAqBD,oBAeC;AA/ED,MAAM,QAAQ,GAAG,UAAU,CAAS;IAClC,MAAM,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IACzB,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClB,OAAO,GAAG,GAAG,EAAE,CAAA;IACjB,CAAC;IACD,OAAO,EAAE,CAAA;AACX,CAAC,CAAA;AAED,EAAE;AACF,SAAS;AACT,EAAE;AACF,mDAAmD;AACnD,wDAAwD;AACxD,SAAgB,SAAS,CAAC,GAAG,IAAc;IACzC,MAAM,GAAG,GAAW,IAAI,CAAC,KAAK,EAAG,CAAA;IACjC,MAAM,GAAG,GAAW,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAA;IACnE,IAAI,GAAG,GAAW,GAAG,CAAC,MAAM,GAAG,CAAC,CAAA;IAChC,IAAI,MAAM,GAAG,CAAC,CAAA;IACd,IAAI,GAAG,GAAG,GAAG,CAAA;IAEb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I,EAAE,IAAI,GAAG,GAAG,CAAC,CAAA;AACpC,CAAC;AAID,SAAgB,IAAI,CAAC,GAAe;IAClC,IAAI,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAW,CAAC,CAAA;IACpC,IAAI,GAAG,GAAG,EAAE,CAAA;IACZ,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACX,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC1B,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,CAAe,CAAC,CAAC,CAAC,CAAA;QACvD,CAAC;aAAM,IAAI,QAAQ,KAAK,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YACtC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAA;QACd,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACpC,CAAC;IACH,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAElG,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["// Copyright 2018 AJ ONeal. All rights reserved\n/* This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n *\n * Ported to Typescript by iCure sa */\n\nconst numToHex = function (d: number): string {\n const ds = d.toString(16)\n if (ds.length % 2) {\n return '0' + ds\n }\n return ds\n}\n\n//\n// Packer\n//\n// Almost every ASN.1 type that's important for CSR\n// can be represented generically with only a few rules.\nexport function packOther(...args: string[]) {\n const typ: string = args.shift()!\n const str: string = args.join('').replace(/\\s+/g, '').toLowerCase()\n var len: number = str.length / 2\n var lenlen = 0\n var hex = typ\n\n // We can't have an odd number of hex chars\n if (len !== Math.round(len)) {\n throw new Error('invalid hex')\n }\n\n // The first byte of any ASN.1 sequence is the type (Sequence, Integer, etc)\n // The second byte is either the size of the value, or the size of its size\n // 1. If the second byte is < 0x80 (128) it is considered the size\n // 2. If it is > 0x80 then it describes the number of bytes of the size\n // ex: 0x82 means the next 2 bytes describe the size of the value\n // 3. The special case of exactly 0x80 is \"indefinite\" length (to end-of-file)\n if (len > 127) {\n lenlen += 1\n while (len > 255) {\n lenlen += 1\n len = len >> 8\n }\n }\n\n if (lenlen) {\n hex += numToHex(0x80 + lenlen)\n }\n return hex + numToHex(str.length / 2) + str\n}\n\n// The Integer type has some special rules\nfunction packUInt(...arr: string[]) {\n const str = arr.join('')\n const first = parseInt(str.slice(0, 2), 16)\n\n // If the first byte is 0x80 or greater, the number is considered negative\n // Therefore we add a '00' prefix if the 0x80 bit is set\n return 0x80 & first ? packOther('02', '00' + str) : packOther('02', str)\n}\n\n// The Bit String type also has a special rule\nfunction packBitStr(...arr: string[]) {\n var str = arr.join('')\n // '00' is a mask of how many bits of the next byte to ignore\n return packOther('03', '00' + str)\n}\n\nexport type Asn1Item = number | string | Asn1Item[]\n\nexport function pack(arr: Asn1Item[]) {\n var typ = numToHex(arr[0] as number)\n var str = ''\n if (arr[1]) {\n if (Array.isArray(arr[1])) {\n arr[1].forEach((a) => (str += pack(a as Asn1Item[])))\n } else if ('string' === typeof arr[1]) {\n str = arr[1]\n } else {\n throw new Error('unexpected item')\n }\n }\n const packed = '03' === typ ? packBitStr(str) : '02' === typ ? packUInt(str) : packOther(typ, str)\n\n return packed\n}\n"]}
@@ -7,7 +7,7 @@
7
7
  // Parser
8
8
  //
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.parseAsn1 = void 0;
10
+ exports.parseAsn1 = parseAsn1;
11
11
  // Although I've only seen 9 max in https certificates themselves,
12
12
  // but each domain list could have up to 100
13
13
  const ELOOPN = 102;
@@ -135,5 +135,4 @@ function parseAsn1(buf, depth = [], eager = false) {
135
135
  return asn1;
136
136
  }
137
137
  }
138
- exports.parseAsn1 = parseAsn1;
139
138
  //# sourceMappingURL=asn1-parser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"asn1-parser.js","sourceRoot":"","sources":["../../../icc-x-api/utils/asn1-parser.ts"],"names":[],"mappings":";AAAA,+CAA+C;AAC/C;;8DAE8D;AAC9D,EAAE;AACF,SAAS;AACT,EAAE;;;AAEF,kEAAkE;AAClE,4CAA4C;AAC5C,MAAM,MAAM,GAAG,GAAG,CAAA;AAClB,MAAM,KAAK,GAAG,2BAA2B,GAAG,MAAM,GAAG,wCAAwC,CAAA;AAC7F,0CAA0C;AAC1C,MAAM,MAAM,GAAG,EAAE,CAAA;AACjB,MAAM,KAAK,GAAG,4BAA4B,GAAG,MAAM,GAAG,2CAA2C,CAAA;AACjG,mEAAmE;AACnE,2HAA2H;AAC3H,wEAAwE;AACxE,6DAA6D;AAC7D,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AACvC,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAEnD,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAE,EAAE;IAC7B,MAAM,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IACzB,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE;QACjB,OAAO,GAAG,GAAG,EAAE,CAAA;KAChB;IACD,OAAO,EAAE,CAAA;AACX,CAAC,CAAA;AAED,MAAM,QAAQ,GAAG,CAAC,EAAc,EAAE,EAAE;IAClC,IAAI,GAAG,GAAG,EAAE,CAA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,CAAC,CAAC,KAAK,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QACpC,OAAO,IAAI,CAAA;KACZ;IAED,+DAA+D;IAC/D,wCAAwC;IACxC,IAAI;QACF,OAAO,aAAa,CAAC,IAAI,CAAC,CAAA;KAC3B;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;QAC3C,OAAO,IAAI,CAAA;KACZ;AACH,CAAC;AA7FD,8BA6FC","sourcesContent":["// Copyright 2018 AJ ONeal. All rights reserved\n/* This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\n//\n// Parser\n//\n\n// Although I've only seen 9 max in https certificates themselves,\n// but each domain list could have up to 100\nconst ELOOPN = 102\nconst ELOOP = 'ujs Error: iterated over ' + ELOOPN + '+ elements (probably a malformed file)'\n// I've seen https certificates go 29 deep\nconst EDEEPN = 60\nconst EDEEP = 'ujs Error: element nested ' + EDEEPN + '+ layers deep (probably a malformed file)'\n// Container Types are Sequence 0x30, Container Array? (0xA0, 0xA1)\n// Value Types are Boolean 0x01, Integer 0x02, Null 0x05, Object ID 0x06, String 0x0C, 0x16, 0x13, 0x1e Value Array? (0x82)\n// Bit String (0x03) and Octet String (0x04) may be values or containers\n// Sometimes Bit String is used as a container (RSA Pub Spki)\nconst CTYPES = [0x30, 0x31, 0xa0, 0xa1]\nconst VTYPES = [0x01, 0x02, 0x05, 0x06, 0x0c, 0x82]\n\nconst numToHex = (d: number) => {\n const dh = d.toString(16)\n if (dh.length % 2) {\n return '0' + dh\n }\n return dh\n}\n\nconst bufToHex = (u8: Uint8Array) => {\n var hex = []\n var i, h\n var len = u8.byteLength || u8.length\n\n for (i = 0; i < len; i += 1) {\n h = u8[i].toString(16)\n if (h.length % 2) {\n h = '0' + h\n }\n hex.push(h)\n }\n return hex.join('').toLowerCase()\n}\n\nconst _replacer = function (k: string, v: any) {\n if ('type' === k) {\n return '0x' + numToHex(v)\n }\n if (v && 'value' === k) {\n return '0x' + bufToHex(v.data || v)\n }\n return v\n}\n\nexport type Asn1 = { type: number; lengthSize: number; length: number; children?: Asn1[]; value?: Uint8Array }\n\nexport function parseAsn1(buf: Uint8Array, depth: number[] = [], eager: boolean = false): Asn1 {\n if (depth.length >= EDEEPN) {\n throw new Error(EDEEP)\n }\n\n var index = 2 // we know, at minimum, data starts after type (0) and lengthSize (1)\n var asn1: Asn1 = { type: buf[0], lengthSize: 0, length: buf[1] }\n var child\n var iters = 0\n var adjust = 0\n var adjustedLen: number\n\n // Determine how many bytes the length uses, and what it is\n if (0x80 & asn1.length) {\n asn1.lengthSize = 0x7f & asn1.length\n // I think that buf->hex->int solves the problem of Endianness... not sure\n asn1.length = parseInt(bufToHex(buf.slice(index, index + asn1.lengthSize)), 16)\n index += asn1.lengthSize\n }\n\n // High-order bit Integers have a leading 0x00 to signify that they are positive.\n // Bit Streams use the first byte to signify padding, which x.509 doesn't use.\n if (0x00 === buf[index] && (0x02 === asn1.type || 0x03 === asn1.type)) {\n // However, 0x00 on its own is a valid number\n if (asn1.length > 1) {\n index += 1\n adjust = -1\n }\n }\n adjustedLen = asn1.length + adjust\n\n function parseChildren(eager: boolean) {\n asn1.children = []\n //console.warn('1 len:', (2 + asn1.lengthSize + asn1.length), 'idx:', index, 'clen:', 0);\n while (iters < ELOOPN && index < 2 + asn1.length + asn1.lengthSize) {\n iters += 1\n depth.length += 1\n child = parseAsn1(buf.slice(index, index + adjustedLen), depth, eager)\n depth.length -= 1\n // The numbers don't match up exactly and I don't remember why...\n // probably something with adjustedLen or some such, but the tests pass\n index += 2 + child.lengthSize + child.length\n //console.warn('2 len:', (2 + asn1.lengthSize + asn1.length), 'idx:', index, 'clen:', (2 + child.lengthSize + child.length));\n if (index > 2 + asn1.lengthSize + asn1.length) {\n if (!eager) {\n console.error(JSON.stringify(asn1, _replacer, 2))\n }\n throw new Error(\n 'Parse error: child value length (' +\n child.length +\n ') is greater than remaining parent length (' +\n (asn1.length - index) +\n ' = ' +\n asn1.length +\n ' - ' +\n index +\n ')'\n )\n }\n asn1.children.push(child)\n //console.warn(depth.join(ws) + '0x' + Enc.numToHex(asn1.type), index, 'len:', asn1.length, asn1);\n }\n if (index !== 2 + asn1.lengthSize + asn1.length) {\n //console.warn('index:', index, 'length:', (2 + asn1.lengthSize + asn1.length));\n throw new Error('premature end-of-file')\n }\n if (iters >= ELOOPN) {\n throw new Error(ELOOP)\n }\n\n delete asn1.value\n return asn1\n }\n\n // Recurse into types that are _always_ containers\n if (-1 !== CTYPES.indexOf(asn1.type)) {\n return parseChildren(eager)\n }\n\n // Return types that are _always_ values\n asn1.value = buf.slice(index, index + adjustedLen)\n if (-1 !== VTYPES.indexOf(asn1.type)) {\n return asn1\n }\n\n // For ambigious / unknown types, recurse and return on failure\n // (and return child array size to zero)\n try {\n return parseChildren(true)\n } catch (e) {\n asn1.children && (asn1.children.length = 0)\n return asn1\n }\n}\n"]}
1
+ {"version":3,"file":"asn1-parser.js","sourceRoot":"","sources":["../../../icc-x-api/utils/asn1-parser.ts"],"names":[],"mappings":";AAAA,+CAA+C;AAC/C;;8DAE8D;AAC9D,EAAE;AACF,SAAS;AACT,EAAE;;AAmDF,8BA6FC;AA9ID,kEAAkE;AAClE,4CAA4C;AAC5C,MAAM,MAAM,GAAG,GAAG,CAAA;AAClB,MAAM,KAAK,GAAG,2BAA2B,GAAG,MAAM,GAAG,wCAAwC,CAAA;AAC7F,0CAA0C;AAC1C,MAAM,MAAM,GAAG,EAAE,CAAA;AACjB,MAAM,KAAK,GAAG,4BAA4B,GAAG,MAAM,GAAG,2CAA2C,CAAA;AACjG,mEAAmE;AACnE,2HAA2H;AAC3H,wEAAwE;AACxE,6DAA6D;AAC7D,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,I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AkG;QACpG,CAAC;QACD,IAAI,KAAK,KAAK,CAAC,GAAG,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;YAChD,gFAAgF;YAChF,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAA;QAC1C,CAAC;QACD,IAAI,KAAK,IAAI,MAAM,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAA;QACxB,CAAC;QAED,OAAO,IAAI,CAAC,KAAK,CAAA;QACjB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,kDAAkD;IAClD,IAAI,CAAC,CAAC,KAAK,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACrC,OAAO,aAAa,CAAC,KAAK,CAAC,CAAA;IAC7B,CAAC;IAED,wCAAwC;IACxC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,WAAW,CAAC,CAAA;IAClD,IAAI,CAAC,CAAC,KAAK,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACrC,OAAO,IAAI,CAAA;IACb,CAAC;IAED,+DAA+D;IAC/D,wCAAwC;IACxC,IAAI,CAAC;QACH,OAAO,aAAa,CAAC,IAAI,CAAC,CAAA;IAC5B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;QAC3C,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2018 AJ ONeal. All rights reserved\n/* This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\n//\n// Parser\n//\n\n// Although I've only seen 9 max in https certificates themselves,\n// but each domain list could have up to 100\nconst ELOOPN = 102\nconst ELOOP = 'ujs Error: iterated over ' + ELOOPN + '+ elements (probably a malformed file)'\n// I've seen https certificates go 29 deep\nconst EDEEPN = 60\nconst EDEEP = 'ujs Error: element nested ' + EDEEPN + '+ layers deep (probably a malformed file)'\n// Container Types are Sequence 0x30, Container Array? (0xA0, 0xA1)\n// Value Types are Boolean 0x01, Integer 0x02, Null 0x05, Object ID 0x06, String 0x0C, 0x16, 0x13, 0x1e Value Array? (0x82)\n// Bit String (0x03) and Octet String (0x04) may be values or containers\n// Sometimes Bit String is used as a container (RSA Pub Spki)\nconst CTYPES = [0x30, 0x31, 0xa0, 0xa1]\nconst VTYPES = [0x01, 0x02, 0x05, 0x06, 0x0c, 0x82]\n\nconst numToHex = (d: number) => {\n const dh = d.toString(16)\n if (dh.length % 2) {\n return '0' + dh\n }\n return dh\n}\n\nconst bufToHex = (u8: Uint8Array) => {\n var hex = []\n var i, h\n var len = u8.byteLength || u8.length\n\n for (i = 0; i < len; i += 1) {\n h = u8[i].toString(16)\n if (h.length % 2) {\n h = '0' + h\n }\n hex.push(h)\n }\n return hex.join('').toLowerCase()\n}\n\nconst _replacer = function (k: string, v: any) {\n if ('type' === k) {\n return '0x' + numToHex(v)\n }\n if (v && 'value' === k) {\n return '0x' + bufToHex(v.data || v)\n }\n return v\n}\n\nexport type Asn1 = { type: number; lengthSize: number; length: number; children?: Asn1[]; value?: Uint8Array }\n\nexport function parseAsn1(buf: Uint8Array, depth: number[] = [], eager: boolean = false): Asn1 {\n if (depth.length >= EDEEPN) {\n throw new Error(EDEEP)\n }\n\n var index = 2 // we know, at minimum, data starts after type (0) and lengthSize (1)\n var asn1: Asn1 = { type: buf[0], lengthSize: 0, length: buf[1] }\n var child\n var iters = 0\n var adjust = 0\n var adjustedLen: number\n\n // Determine how many bytes the length uses, and what it is\n if (0x80 & asn1.length) {\n asn1.lengthSize = 0x7f & asn1.length\n // I think that buf->hex->int solves the problem of Endianness... not sure\n asn1.length = parseInt(bufToHex(buf.slice(index, index + asn1.lengthSize)), 16)\n index += asn1.lengthSize\n }\n\n // High-order bit Integers have a leading 0x00 to signify that they are positive.\n // Bit Streams use the first byte to signify padding, which x.509 doesn't use.\n if (0x00 === buf[index] && (0x02 === asn1.type || 0x03 === asn1.type)) {\n // However, 0x00 on its own is a valid number\n if (asn1.length > 1) {\n index += 1\n adjust = -1\n }\n }\n adjustedLen = asn1.length + adjust\n\n function parseChildren(eager: boolean) {\n asn1.children = []\n //console.warn('1 len:', (2 + asn1.lengthSize + asn1.length), 'idx:', index, 'clen:', 0);\n while (iters < ELOOPN && index < 2 + asn1.length + asn1.lengthSize) {\n iters += 1\n depth.length += 1\n child = parseAsn1(buf.slice(index, index + adjustedLen), depth, eager)\n depth.length -= 1\n // The numbers don't match up exactly and I don't remember why...\n // probably something with adjustedLen or some such, but the tests pass\n index += 2 + child.lengthSize + child.length\n //console.warn('2 len:', (2 + asn1.lengthSize + asn1.length), 'idx:', index, 'clen:', (2 + child.lengthSize + child.length));\n if (index > 2 + asn1.lengthSize + asn1.length) {\n if (!eager) {\n console.error(JSON.stringify(asn1, _replacer, 2))\n }\n throw new Error(\n 'Parse error: child value length (' +\n child.length +\n ') is greater than remaining parent length (' +\n (asn1.length - index) +\n ' = ' +\n asn1.length +\n ' - ' +\n index +\n ')'\n )\n }\n asn1.children.push(child)\n //console.warn(depth.join(ws) + '0x' + Enc.numToHex(asn1.type), index, 'len:', asn1.length, asn1);\n }\n if (index !== 2 + asn1.lengthSize + asn1.length) {\n //console.warn('index:', index, 'length:', (2 + asn1.lengthSize + asn1.length));\n throw new Error('premature end-of-file')\n }\n if (iters >= ELOOPN) {\n throw new Error(ELOOP)\n }\n\n delete asn1.value\n return asn1\n }\n\n // Recurse into types that are _always_ containers\n if (-1 !== CTYPES.indexOf(asn1.type)) {\n return parseChildren(eager)\n }\n\n // Return types that are _always_ values\n asn1.value = buf.slice(index, index + adjustedLen)\n if (-1 !== VTYPES.indexOf(asn1.type)) {\n return asn1\n }\n\n // For ambigious / unknown types, recurse and return on failure\n // (and return child array size to zero)\n try {\n return parseChildren(true)\n } catch (e) {\n asn1.children && (asn1.children.length = 0)\n return asn1\n }\n}\n"]}
@@ -1,6 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.concat_uas = exports.string2hex = exports.hex2string = exports.b64Url2ua = exports.ua2b64Url = exports.b64_2uas = exports.ua2hex = exports.hex2ua = exports.ua2utf8 = exports.utf8_2ua = exports.a2b = exports.b2a = exports.ua2b64 = exports.b64_2ua = exports.b64_2ab = exports.ua2ab = exports.string2ab = exports.string2ua = exports.ua2string = void 0;
3
+ exports.a2b = exports.b2a = exports.ua2b64 = exports.b64_2ua = exports.b64_2ab = exports.ua2ab = exports.string2ab = exports.string2ua = exports.ua2string = void 0;
4
+ exports.utf8_2ua = utf8_2ua;
5
+ exports.ua2utf8 = ua2utf8;
6
+ exports.hex2ua = hex2ua;
7
+ exports.ua2hex = ua2hex;
8
+ exports.b64_2uas = b64_2uas;
9
+ exports.ua2b64Url = ua2b64Url;
10
+ exports.b64Url2ua = b64Url2ua;
11
+ exports.hex2string = hex2string;
12
+ exports.string2hex = string2hex;
13
+ exports.concat_uas = concat_uas;
4
14
  const ModelHelper_1 = require("../../icc-api/model/ModelHelper");
5
15
  Object.defineProperty(exports, "ua2string", { enumerable: true, get: function () { return ModelHelper_1.ua2string; } });
6
16
  Object.defineProperty(exports, "string2ua", { enumerable: true, get: function () { return ModelHelper_1.string2ua; } });
@@ -44,7 +54,6 @@ function utf8_2ua(str) {
44
54
  }
45
55
  return utf8.subarray(0, j);
46
56
  }
47
- exports.utf8_2ua = utf8_2ua;
48
57
  /**
49
58
  * Uint8Array/ArrayBuffer to utf-8 strring
50
59
  * @param _ua {Uint8Array} or ArrayBuffer
@@ -102,7 +111,6 @@ function ua2utf8(_ua) {
102
111
  }
103
112
  return out;
104
113
  }
105
- exports.ua2utf8 = ua2utf8;
106
114
  function hex2ua(s) {
107
115
  const ua = new Uint8Array(s.length / 2);
108
116
  s = s.toLowerCase();
@@ -113,7 +121,6 @@ function hex2ua(s) {
113
121
  }
114
122
  return ua;
115
123
  }
116
- exports.hex2ua = hex2ua;
117
124
  /**
118
125
  * Uint8Array/ArrayBuffer to hex String
119
126
  *
@@ -131,7 +138,6 @@ function ua2hex(_ua) {
131
138
  }
132
139
  return s;
133
140
  }
134
- exports.ua2hex = ua2hex;
135
141
  function b64_2uas(s) {
136
142
  const sliceSize = 1024;
137
143
  const byteCharacters = (0, ModelHelper_1.a2b)(s);
@@ -149,28 +155,22 @@ function b64_2uas(s) {
149
155
  }
150
156
  return byteArrays;
151
157
  }
152
- exports.b64_2uas = b64_2uas;
153
158
  function ua2b64Url(ua) {
154
159
  return (0, ModelHelper_1.ua2b64)(ua).replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
155
160
  }
156
- exports.ua2b64Url = ua2b64Url;
157
161
  function b64Url2ua(ua) {
158
162
  return (0, ModelHelper_1.b64_2ua)(ua.replace(/-/g, '+').replace(/_/g, '/').replace(/=/g, '') + (ua.length % 4 === 3 ? '=' : ua.length % 4 === 2 ? '==' : ''));
159
163
  }
160
- exports.b64Url2ua = b64Url2ua;
161
164
  function hex2string(hexStr) {
162
165
  return (0, ModelHelper_1.ua2string)(hex2ua(hexStr));
163
166
  }
164
- exports.hex2string = hex2string;
165
167
  function string2hex(text) {
166
168
  return ua2hex((0, ModelHelper_1.string2ua)(text));
167
169
  }
168
- exports.string2hex = string2hex;
169
170
  function concat_uas(ua1, ua2) {
170
171
  const newBuffer = new Uint8Array(ua1.length + ua2.length);
171
172
  newBuffer.set(ua1, 0);
172
173
  newBuffer.set(ua2, ua1.length);
173
174
  return newBuffer;
174
175
  }
175
- exports.concat_uas = concat_uas;
176
176
  //# sourceMappingURL=binary-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"binary-utils.js","sourceRoot":"","sources":["../../../icc-x-api/utils/binary-utils.ts"],"names":[],"mappings":";;;AAAA,iEAA4H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SAAS,CAAC,EAAU;IAClC,OAAO,IAAA,qBAAO,EAAC,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AAC5I,CAAC;AAFD,8BAEC;AAED,SAAgB,UAAU,CAAC,MAAc;IACvC,OAAO,IAAA,uBAAS,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;AAClC,CAAC;AAFD,gCAEC;AAED,SAAgB,UAAU,CAAC,IAAY;IACrC,OAAO,MAAM,CAAC,IAAA,uBAAS,EAAC,IAAI,CAAC,CAAC,CAAA;AAChC,CAAC;AAFD,gCAEC;AAED,SAAgB,UAAU,CAAC,GAAe,EAAE,GAAe;IACzD,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAA;IACzD,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;IACrB,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC9B,OAAO,SAAS,CAAA;AAClB,CAAC;AALD,gCAKC","sourcesContent":["import { ua2string, string2ua, string2ab, ua2ab, b64_2ab, b64_2ua, ua2b64, b2a, a2b } from '../../icc-api/model/ModelHelper'\nexport { ua2string, string2ua, string2ab, ua2ab, b64_2ab, b64_2ua, ua2b64, b2a, a2b }\n\nconst textDecoder = typeof TextDecoder !== 'undefined' ? new TextDecoder() : null\nconst textEncoder = typeof TextEncoder !== 'undefined' ? new TextEncoder() : null\n\nexport function utf8_2ua(str: string): Uint8Array {\n if (textEncoder) {\n return textEncoder.encode(str)\n }\n\n const utf8 = new Uint8Array(4 * str.length)\n let j = 0\n for (let i = 0; i < str.length; i++) {\n let charcode = str.charCodeAt(i)\n if (charcode < 0x80) {\n utf8.set([charcode], j++)\n } else if (charcode < 0x800) {\n utf8.set([0xc0 | (charcode >> 6), 0x80 | (charcode & 0x3f)], j)\n j += 2\n } else if (charcode < 0xd800 || charcode >= 0xe000) {\n utf8.set([0xe0 | (charcode >> 12), 0x80 | ((charcode >> 6) & 0x3f), 0x80 | (charcode & 0x3f)], j)\n j += 3\n } else {\n i++\n // UTF-16 encodes 0x10000-0x10FFFF by\n // subtracting 0x10000 and splitting the\n // 20 bits of 0x0-0xFFFFF into two halves\n charcode = 0x10000 + (((charcode & 0x3ff) << 10) | (str.charCodeAt(i) & 0x3ff))\n utf8.set([0xf0 | (charcode >> 18), 0x80 | ((charcode >> 12) & 0x3f), 0x80 | ((charcode >> 6) & 0x3f), 0x80 | (charcode & 0x3f)], j)\n j += 4\n }\n }\n return utf8.subarray(0, j)\n}\n\n/**\n * Uint8Array/ArrayBuffer to utf-8 strring\n * @param _ua {Uint8Array} or ArrayBuffer\n * @returns {String} a UTF-8 encoded string\n */\nexport function ua2utf8(_ua: Uint8Array | ArrayBuffer): string {\n if (textDecoder) {\n // if _ua is undefined, imitate the JS implementation below which returns an empty string\n return _ua ? textDecoder.decode(_ua) : ''\n }\n\n let out, i, len, c, u\n let char2, char3, char4\n\n // avoid applying the Uint8Array constructor: on ArrayBuffer it creates a\n // view but on Uint8Array it creates a copy\n const array = ArrayBuffer.isView(_ua) ? _ua : new Uint8Array(_ua)\n\n out = ''\n len = array.length || array.byteLength\n i = 0\n while (i < len) {\n c = array[i++]\n switch (c >> 4) {\n case 0:\n case 1:\n case 2:\n case 3:\n case 4:\n case 5:\n case 6:\n case 7:\n // 0xxxxxxx\n out += String.fromCharCode(c)\n break\n case 12:\n case 13:\n // 110x xxxx 10xx xxxx\n char2 = array[i++]\n out += String.fromCharCode(((c & 0x1f) << 6) | (char2 & 0x3f))\n break\n case 14:\n // 1110 xxxx 10xx xxxx 10xx xxxx\n char2 = array[i++]\n char3 = array[i++]\n out += String.fromCharCode(((c & 0x0f) << 12) | ((char2 & 0x3f) << 6) | ((char3 & 0x3f) << 0))\n break\n case 15:\n // 1111 xxxx 10xx xxxx 10xx xxxx 10xx xxxx\n char2 = array[i++]\n char3 = array[i++]\n char4 = array[i++]\n u = ((c & 0x07) << 18) | ((char2 & 0x3f) << 12) | ((char3 & 0x3f) << 6) | (((char4 & 0x3f) << 0) - 0x10000)\n out += String.fromCharCode(0xd800 + (u >> 10))\n out += String.fromCharCode(0xdc00 + (u & 1023))\n break\n }\n }\n\n return out\n}\n\nexport function hex2ua(s: string): Uint8Array {\n const ua = new Uint8Array(s.length / 2)\n s = s.toLowerCase()\n for (let i = 0; i < s.length; i += 2) {\n ua[i / 2] =\n (s.charCodeAt(i) < 58 ? s.charCodeAt(i) - 48 : s.charCodeAt(i) - 87) * 16 +\n (s.charCodeAt(i + 1) < 58 ? s.charCodeAt(i + 1) - 48 : s.charCodeAt(i + 1) - 87)\n }\n return ua\n}\n\n/**\n * Uint8Array/ArrayBuffer to hex String\n *\n * @param _ua {Uint8Array} or ArrayBuffer\n * @returns {String} Hex String\n */\nexport function ua2hex(_ua: Uint8Array | ArrayBuffer): string {\n let s = ''\n const ua = new Uint8Array(_ua)\n for (let i = 0; i < ua.length; i++) {\n const hhb = (ua[i] & 0xf0) >> 4\n const lhb = ua[i] & 0x0f\n s += String.fromCharCode(hhb > 9 ? hhb + 87 : hhb + 48)\n s += String.fromCharCode(lhb > 9 ? lhb + 87 : lhb + 48)\n }\n\n return s\n}\n\nexport function b64_2uas(s: string): Array<Uint8Array> {\n const sliceSize = 1024\n const byteCharacters = a2b(s)\n const bytesLength = byteCharacters.length\n const slicesCount = Math.ceil(bytesLength / sliceSize)\n const byteArrays = new Array(slicesCount)\n\n for (let sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) {\n const begin = sliceIndex * sliceSize\n const end = Math.min(begin + sliceSize, bytesLength)\n\n const bytes = new Array(end - begin)\n for (let offset = begin, i = 0; offset < end; ++i, ++offset) {\n bytes[i] = byteCharacters[offset].charCodeAt(0)\n }\n byteArrays[sliceIndex] = new Uint8Array(bytes)\n }\n return byteArrays\n}\n\nexport function ua2b64Url(ua: Uint8Array | ArrayBuffer): string {\n return ua2b64(ua).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=/g, '')\n}\n\nexport function b64Url2ua(ua: string): ArrayBuffer {\n return b64_2ua(ua.replace(/-/g, '+').replace(/_/g, '/').replace(/=/g, '') + (ua.length % 4 === 3 ? '=' : ua.length % 4 === 2 ? '==' : ''))\n}\n\nexport function hex2string(hexStr: string): string {\n return ua2string(hex2ua(hexStr))\n}\n\nexport function string2hex(text: string): string {\n return ua2hex(string2ua(text))\n}\n\nexport function concat_uas(ua1: Uint8Array, ua2: Uint8Array): Uint8Array {\n const newBuffer = new Uint8Array(ua1.length + ua2.length)\n newBuffer.set(ua1, 0)\n newBuffer.set(ua2, ua1.length)\n return newBuffer\n}\n"]}
1
+ {"version":3,"file":"binary-utils.js","sourceRoot":"","sources":["../../../icc-x-api/utils/binary-utils.ts"],"names":[],"mappings":";;;AAMA,4BA4BC;AAOD,0BAuDC;AAED,wBASC;AAQD,wBAWC;AAED,4BAkBC;AAED,8BAEC;AAED,8BAEC;AAED,gCAEC;AAED,gCAEC;AAED,gCAKC;AAzKD,iEAA4H;AACnH,0FADA,uBAAS,OACA;AAAE,0FADA,uBAAS,OACA;AAAE,0FADA,uBAAS,OACA;AAAE,sFADA,mBAAK,OACA;AAAE,wFADA,qBAAO,OACA;AAAE,wFADA,qBAAO,OACA;AAAE,uFADA,oBAAM,OACA;AAAE,oFADA,iBAAG,OACA;AAAE,oFADA,iBAAG,OACA;AAEnF,MAAM,WAAW,GAAG,OAAO,WAAW,KAAK,WAAW,CAAC,CAAC,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AM,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AAC5I,CAAC;AAED,SAAgB,UAAU,CAAC,MAAc;IACvC,OAAO,IAAA,uBAAS,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;AAClC,CAAC;AAED,SAAgB,UAAU,CAAC,IAAY;IACrC,OAAO,MAAM,CAAC,IAAA,uBAAS,EAAC,IAAI,CAAC,CAAC,CAAA;AAChC,CAAC;AAED,SAAgB,UAAU,CAAC,GAAe,EAAE,GAAe;IACzD,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAA;IACzD,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;IACrB,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC9B,OAAO,SAAS,CAAA;AAClB,CAAC","sourcesContent":["import { ua2string, string2ua, string2ab, ua2ab, b64_2ab, b64_2ua, ua2b64, b2a, a2b } from '../../icc-api/model/ModelHelper'\nexport { ua2string, string2ua, string2ab, ua2ab, b64_2ab, b64_2ua, ua2b64, b2a, a2b }\n\nconst textDecoder = typeof TextDecoder !== 'undefined' ? new TextDecoder() : null\nconst textEncoder = typeof TextEncoder !== 'undefined' ? new TextEncoder() : null\n\nexport function utf8_2ua(str: string): Uint8Array {\n if (textEncoder) {\n return textEncoder.encode(str)\n }\n\n const utf8 = new Uint8Array(4 * str.length)\n let j = 0\n for (let i = 0; i < str.length; i++) {\n let charcode = str.charCodeAt(i)\n if (charcode < 0x80) {\n utf8.set([charcode], j++)\n } else if (charcode < 0x800) {\n utf8.set([0xc0 | (charcode >> 6), 0x80 | (charcode & 0x3f)], j)\n j += 2\n } else if (charcode < 0xd800 || charcode >= 0xe000) {\n utf8.set([0xe0 | (charcode >> 12), 0x80 | ((charcode >> 6) & 0x3f), 0x80 | (charcode & 0x3f)], j)\n j += 3\n } else {\n i++\n // UTF-16 encodes 0x10000-0x10FFFF by\n // subtracting 0x10000 and splitting the\n // 20 bits of 0x0-0xFFFFF into two halves\n charcode = 0x10000 + (((charcode & 0x3ff) << 10) | (str.charCodeAt(i) & 0x3ff))\n utf8.set([0xf0 | (charcode >> 18), 0x80 | ((charcode >> 12) & 0x3f), 0x80 | ((charcode >> 6) & 0x3f), 0x80 | (charcode & 0x3f)], j)\n j += 4\n }\n }\n return utf8.subarray(0, j)\n}\n\n/**\n * Uint8Array/ArrayBuffer to utf-8 strring\n * @param _ua {Uint8Array} or ArrayBuffer\n * @returns {String} a UTF-8 encoded string\n */\nexport function ua2utf8(_ua: Uint8Array | ArrayBuffer): string {\n if (textDecoder) {\n // if _ua is undefined, imitate the JS implementation below which returns an empty string\n return _ua ? textDecoder.decode(_ua) : ''\n }\n\n let out, i, len, c, u\n let char2, char3, char4\n\n // avoid applying the Uint8Array constructor: on ArrayBuffer it creates a\n // view but on Uint8Array it creates a copy\n const array = ArrayBuffer.isView(_ua) ? _ua : new Uint8Array(_ua)\n\n out = ''\n len = array.length || array.byteLength\n i = 0\n while (i < len) {\n c = array[i++]\n switch (c >> 4) {\n case 0:\n case 1:\n case 2:\n case 3:\n case 4:\n case 5:\n case 6:\n case 7:\n // 0xxxxxxx\n out += String.fromCharCode(c)\n break\n case 12:\n case 13:\n // 110x xxxx 10xx xxxx\n char2 = array[i++]\n out += String.fromCharCode(((c & 0x1f) << 6) | (char2 & 0x3f))\n break\n case 14:\n // 1110 xxxx 10xx xxxx 10xx xxxx\n char2 = array[i++]\n char3 = array[i++]\n out += String.fromCharCode(((c & 0x0f) << 12) | ((char2 & 0x3f) << 6) | ((char3 & 0x3f) << 0))\n break\n case 15:\n // 1111 xxxx 10xx xxxx 10xx xxxx 10xx xxxx\n char2 = array[i++]\n char3 = array[i++]\n char4 = array[i++]\n u = ((c & 0x07) << 18) | ((char2 & 0x3f) << 12) | ((char3 & 0x3f) << 6) | (((char4 & 0x3f) << 0) - 0x10000)\n out += String.fromCharCode(0xd800 + (u >> 10))\n out += String.fromCharCode(0xdc00 + (u & 1023))\n break\n }\n }\n\n return out\n}\n\nexport function hex2ua(s: string): Uint8Array {\n const ua = new Uint8Array(s.length / 2)\n s = s.toLowerCase()\n for (let i = 0; i < s.length; i += 2) {\n ua[i / 2] =\n (s.charCodeAt(i) < 58 ? s.charCodeAt(i) - 48 : s.charCodeAt(i) - 87) * 16 +\n (s.charCodeAt(i + 1) < 58 ? s.charCodeAt(i + 1) - 48 : s.charCodeAt(i + 1) - 87)\n }\n return ua\n}\n\n/**\n * Uint8Array/ArrayBuffer to hex String\n *\n * @param _ua {Uint8Array} or ArrayBuffer\n * @returns {String} Hex String\n */\nexport function ua2hex(_ua: Uint8Array | ArrayBuffer): string {\n let s = ''\n const ua = new Uint8Array(_ua)\n for (let i = 0; i < ua.length; i++) {\n const hhb = (ua[i] & 0xf0) >> 4\n const lhb = ua[i] & 0x0f\n s += String.fromCharCode(hhb > 9 ? hhb + 87 : hhb + 48)\n s += String.fromCharCode(lhb > 9 ? lhb + 87 : lhb + 48)\n }\n\n return s\n}\n\nexport function b64_2uas(s: string): Array<Uint8Array> {\n const sliceSize = 1024\n const byteCharacters = a2b(s)\n const bytesLength = byteCharacters.length\n const slicesCount = Math.ceil(bytesLength / sliceSize)\n const byteArrays = new Array(slicesCount)\n\n for (let sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) {\n const begin = sliceIndex * sliceSize\n const end = Math.min(begin + sliceSize, bytesLength)\n\n const bytes = new Array(end - begin)\n for (let offset = begin, i = 0; offset < end; ++i, ++offset) {\n bytes[i] = byteCharacters[offset].charCodeAt(0)\n }\n byteArrays[sliceIndex] = new Uint8Array(bytes)\n }\n return byteArrays\n}\n\nexport function ua2b64Url(ua: Uint8Array | ArrayBuffer): string {\n return ua2b64(ua).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=/g, '')\n}\n\nexport function b64Url2ua(ua: string): ArrayBuffer {\n return b64_2ua(ua.replace(/-/g, '+').replace(/_/g, '/').replace(/=/g, '') + (ua.length % 4 === 3 ? '=' : ua.length % 4 === 2 ? '==' : ''))\n}\n\nexport function hex2string(hexStr: string): string {\n return ua2string(hex2ua(hexStr))\n}\n\nexport function string2hex(text: string): string {\n return ua2hex(string2ua(text))\n}\n\nexport function concat_uas(ua1: Uint8Array, ua2: Uint8Array): Uint8Array {\n const newBuffer = new Uint8Array(ua1.length + ua2.length)\n newBuffer.set(ua1, 0)\n newBuffer.set(ua2, ua1.length)\n return newBuffer\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizeCode = void 0;
3
+ exports.normalizeCode = normalizeCode;
4
4
  const _ = require("lodash");
5
5
  /**
6
6
  * Normalizes the code's four main fields (type, code, version and id). The first three are considered to be
@@ -41,5 +41,4 @@ function normalizeCode(code) {
41
41
  code.id = `${code.type}|${code.code}|${code.version}`;
42
42
  return code;
43
43
  }
44
- exports.normalizeCode = normalizeCode;
45
44
  //# sourceMappingURL=code-util.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"code-util.js","sourceRoot":"","sources":["../../../icc-x-api/utils/code-util.ts"],"names":[],"mappings":";;;AAAA,4BAA2B;AAI3B;;;;;;;GAOG;AACH,SAAgB,aAAa,CAAC,IAAU;IACtC,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAEpB,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE;QAC1C,2DAA2D;KAC5D;SAAM,IAAI,IAAI,CAAC,EAAE,EAAE;QAClB,mDAAmD;QACnD,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QACjE,IAAI,MAAM,IAAI,MAAM,IAAI,SAAS,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YACxD,IAAI,CAAC,IAAI,CAAC,IAAI;gBAAE,IAAI,CAAC,IAAI,GAAG,MAAM,CAAA;YAClC,IAAI,CAAC,IAAI,CAAC,IAAI;gBAAE,IAAI,CAAC,IAAI,GAAG,MAAM,CAAA;YAClC,IAAI,CAAC,IAAI,CAAC,OAAO;gBAAE,IAAI,CAAC,OAAO,GAAG,SAAS,CAAA;SAC5C;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,oDAAoD,IAAI,CAAC,EAAE,GAAG,CAAC,CAAA;SAChF;KACF;SAAM,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;QAClD,iCAAiC;QACjC,IAAI,CAAC,OAAO,GAAG,GAAG,CAAA;KACnB;SAAM;QACL,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;KAClD;IAED,qEAAqE;IACrE,IAAI,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE,CAAA;IAErD,OAAO,IAAI,CAAA;AACb,CAAC;AA1BD,sCA0BC","sourcesContent":["import * as _ from 'lodash'\n\nimport { Code } from '../../icc-api/model/Code'\n\n/**\n * Normalizes the code's four main fields (type, code, version and id). The first three are considered to be\n * authoritative, while the id is a pure function of them. The authoritative fields are filled in from the id if\n * missing, or the version is set to '1' if it is the only missing authoritative field. The id is then rederived from\n * the three fields.\n * @param code The code to normalize.\n * @returns A shallow copy of the input with its type, code, version and id normalized.\n */\nexport function normalizeCode(code: Code): Code {\n code = _.clone(code)\n\n if (code.type && code.code && code.version) {\n // do nothing, we all have the authoritative fields we need\n } else if (code.id) {\n // reconstruct the authoritative fields from the id\n const [idType, idCode, idVersion, ...idRest] = code.id.split('|')\n if (idType && idCode && idVersion && idRest.length === 0) {\n if (!code.type) code.type = idType\n if (!code.code) code.code = idCode\n if (!code.version) code.version = idVersion\n } else {\n throw new Error(`attempted to normalize from a malformed code id \"${code.id}\"`)\n }\n } else if (code.type && code.code && !code.version) {\n // we can provide a default value\n code.version = '1'\n } else {\n throw new Error('could not reconstruct the code')\n }\n\n // Recompute the id to ensure that it matches the reconstructed code.\n code.id = `${code.type}|${code.code}|${code.version}`\n\n return code\n}\n"]}
1
+ {"version":3,"file":"code-util.js","sourceRoot":"","sources":["../../../icc-x-api/utils/code-util.ts"],"names":[],"mappings":";;AAYA,sCA0BC;AAtCD,4BAA2B;AAI3B;;;;;;;GAOG;AACH,SAAgB,aAAa,CAAC,IAAU;IACtC,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAEpB,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QAC3C,2DAA2D;IAC7D,CAAC;SAAM,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC;QACnB,mDAAmD;QACnD,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QACjE,IAAI,MAAM,IAAI,MAAM,IAAI,SAAS,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzD,IAAI,CAAC,IAAI,CAAC,IAAI;gBAAE,IAAI,CAAC,IAAI,GAAG,MAAM,CAAA;YAClC,IAAI,CAAC,IAAI,CAAC,IAAI;gBAAE,IAAI,CAAC,IAAI,GAAG,MAAM,CAAA;YAClC,IAAI,CAAC,IAAI,CAAC,OAAO;gBAAE,IAAI,CAAC,OAAO,GAAG,SAAS,CAAA;QAC7C,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,oDAAoD,IAAI,CAAC,EAAE,GAAG,CAAC,CAAA;QACjF,CAAC;IACH,CAAC;SAAM,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QACnD,iCAAiC;QACjC,IAAI,CAAC,OAAO,GAAG,GAAG,CAAA;IACpB,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;IACnD,CAAC;IAED,qEAAqE;IACrE,IAAI,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE,CAAA;IAErD,OAAO,IAAI,CAAA;AACb,CAAC","sourcesContent":["import * as _ from 'lodash'\n\nimport { Code } from '../../icc-api/model/Code'\n\n/**\n * Normalizes the code's four main fields (type, code, version and id). The first three are considered to be\n * authoritative, while the id is a pure function of them. The authoritative fields are filled in from the id if\n * missing, or the version is set to '1' if it is the only missing authoritative field. The id is then rederived from\n * the three fields.\n * @param code The code to normalize.\n * @returns A shallow copy of the input with its type, code, version and id normalized.\n */\nexport function normalizeCode(code: Code): Code {\n code = _.clone(code)\n\n if (code.type && code.code && code.version) {\n // do nothing, we all have the authoritative fields we need\n } else if (code.id) {\n // reconstruct the authoritative fields from the id\n const [idType, idCode, idVersion, ...idRest] = code.id.split('|')\n if (idType && idCode && idVersion && idRest.length === 0) {\n if (!code.type) code.type = idType\n if (!code.code) code.code = idCode\n if (!code.version) code.version = idVersion\n } else {\n throw new Error(`attempted to normalize from a malformed code id \"${code.id}\"`)\n }\n } else if (code.type && code.code && !code.version) {\n // we can provide a default value\n code.version = '1'\n } else {\n throw new Error('could not reconstruct the code')\n }\n\n // Recompute the id to ensure that it matches the reconstructed code.\n code.id = `${code.type}|${code.code}|${code.version}`\n\n return code\n}\n"]}
@@ -9,7 +9,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.asyncGeneratorToArray = exports.objectEquals = exports.anyEquals = exports.arrayEquals = exports.setEquals = void 0;
12
+ exports.setEquals = setEquals;
13
+ exports.arrayEquals = arrayEquals;
14
+ exports.anyEquals = anyEquals;
15
+ exports.objectEquals = objectEquals;
16
+ exports.asyncGeneratorToArray = asyncGeneratorToArray;
13
17
  /**
14
18
  * Check if two sets are equals (they contain the same elements). Will not work if the content can't be compared by `==`.
15
19
  */
@@ -18,7 +22,6 @@ function setEquals(setA, setB) {
18
22
  return false;
19
23
  return Array.from(setA).every((x) => setB.has(x));
20
24
  }
21
- exports.setEquals = setEquals;
22
25
  /**
23
26
  * Check if two arrays are equals (they contain the same elements).
24
27
  */
@@ -31,7 +34,6 @@ function arrayEquals(arrayA, arrayB) {
31
34
  }
32
35
  return true;
33
36
  }
34
- exports.arrayEquals = arrayEquals;
35
37
  /**
36
38
  * Check if two elements are equals (they contain the same elements).
37
39
  */
@@ -48,7 +50,6 @@ function anyEquals(anyA, anyB) {
48
50
  }
49
51
  return anyA === anyB;
50
52
  }
51
- exports.anyEquals = anyEquals;
52
53
  /**
53
54
  * Check if two objects are equals (by comparing the properties in a deep way).
54
55
  * @param objectA
@@ -77,7 +78,6 @@ function objectEquals(objectA, objectB, ignoredProperties) {
77
78
  }
78
79
  return true;
79
80
  }
80
- exports.objectEquals = objectEquals;
81
81
  /**
82
82
  * Fully consumes an async generator and provides all results as an array.
83
83
  * @param generator an async generator.
@@ -93,5 +93,4 @@ function asyncGeneratorToArray(generator) {
93
93
  return res;
94
94
  });
95
95
  }
96
- exports.asyncGeneratorToArray = asyncGeneratorToArray;
97
96
  //# sourceMappingURL=collection-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"collection-utils.js","sourceRoot":"","sources":["../../../icc-x-api/utils/collection-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA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,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACjE,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QACnB,IAAI,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,QAAQ,CAAC,GAAG,CAAC;YAAE,SAAQ;QAC9C,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;YAAE,OAAO,KAAK,CAAA;KACzD;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AAtBD,oCAsBC;AAED;;;GAGG;AACH,SAAsB,qBAAqB,CAAI,SAAwC;;QACrF,MAAM,GAAG,GAAG,EAAE,CAAA;QACd,IAAI,MAAM,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE,CAAA;QACnC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE;YACnB,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;YACtB,MAAM,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE,CAAA;SAChC;QACD,OAAO,GAAG,CAAA;IACZ,CAAC;CAAA;AARD,sDAQC","sourcesContent":["/**\n * Check if two sets are equals (they contain the same elements). Will not work if the content can't be compared by `==`.\n */\nexport function setEquals<T>(setA: Set<T>, setB: Set<T>): boolean {\n if (setA.size != setB.size) return false\n return Array.from(setA).every((x) => setB.has(x))\n}\n\n/**\n * Check if two arrays are equals (they contain the same elements).\n */\nexport function arrayEquals<T>(arrayA: T[], arrayB: T[]): boolean {\n if (arrayA.length != arrayB.length) return false\n for (let i = 0; i < arrayA.length; ++i) {\n if (!anyEquals(arrayA[i], arrayB[i])) return false\n }\n return true\n}\n\n/**\n * Check if two elements are equals (they contain the same elements).\n */\nexport function anyEquals(anyA: any, anyB: any): boolean {\n //Test if object is array\n if (Array.isArray(anyA) && Array.isArray(anyB)) {\n return arrayEquals(anyA, anyB)\n } /*Test if objects are set */ else if (anyA instanceof Set && anyB instanceof Set) {\n return setEquals(anyA, anyB)\n } else if (typeof anyA === 'object' && typeof anyB === 'object') {\n return objectEquals(anyA, anyB)\n }\n return anyA === anyB\n}\n\n/**\n * Check if two objects are equals (by comparing the properties in a deep way).\n * @param objectA\n * @param objectB\n * @param ignoredProperties\n */\nexport function objectEquals<T extends { [key: string]: any }>(objectA: T, objectB: T, ignoredProperties?: string[]): boolean {\n const missingInA = Object.keys(objectB)\n .filter((key) => !ignoredProperties?.includes(key))\n .filter((key) => !Object.keys(objectA).includes(key))\n .filter((key) => objectB[key] !== undefined && objectB[key] !== null)\n\n if (missingInA.length > 0) return false\n\n const missingInB = Object.keys(objectA)\n .filter((key) => !ignoredProperties?.includes(key))\n .filter((key) => !Object.keys(objectB).includes(key))\n .filter((key) => objectA[key] !== undefined && objectA[key] !== null)\n\n if (missingInB.length > 0) return false\n\n for (let i = 0, keys = Object.keys(objectA); i < keys.length; i++) {\n const key = keys[i]\n if (ignoredProperties?.includes(key)) continue\n if (!anyEquals(objectA[key], objectB[key])) return false\n }\n\n return true\n}\n\n/**\n * Fully consumes an async generator and provides all results as an array.\n * @param generator an async generator.\n */\nexport async function asyncGeneratorToArray<T>(generator: AsyncGenerator<T, any, never>): Promise<T[]> {\n const res = []\n let latest = await generator.next()\n while (!latest.done) {\n res.push(latest.value)\n latest = await generator.next()\n }\n return res\n}\n"]}
1
+ {"version":3,"file":"collection-utils.js","sourceRoot":"","sources":["../../../icc-x-api/utils/collection-utils.ts"],"names":[],"mappings":";;;;;;;;;;;AAGA,8BAGC;AAKD,kCAMC;AAKD,8BAUC;AAQD,oCAsBC;AAMD,sDAQC;AA5ED;;GAEG;AACH,SAAgB,SAAS,CAAI,IAAY,EAAE,IAAY;IACrD,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAA;IACxC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CA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AAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,QAAQ,CAAC,GAAG,CAAC;YAAE,SAAQ;QAC9C,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;YAAE,OAAO,KAAK,CAAA;IAC1D,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;GAGG;AACH,SAAsB,qBAAqB,CAAI,SAAwC;;QACrF,MAAM,GAAG,GAAG,EAAE,CAAA;QACd,IAAI,MAAM,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE,CAAA;QACnC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACpB,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;YACtB,MAAM,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE,CAAA;QACjC,CAAC;QACD,OAAO,GAAG,CAAA;IACZ,CAAC;CAAA","sourcesContent":["/**\n * Check if two sets are equals (they contain the same elements). Will not work if the content can't be compared by `==`.\n */\nexport function setEquals<T>(setA: Set<T>, setB: Set<T>): boolean {\n if (setA.size != setB.size) return false\n return Array.from(setA).every((x) => setB.has(x))\n}\n\n/**\n * Check if two arrays are equals (they contain the same elements).\n */\nexport function arrayEquals<T>(arrayA: T[], arrayB: T[]): boolean {\n if (arrayA.length != arrayB.length) return false\n for (let i = 0; i < arrayA.length; ++i) {\n if (!anyEquals(arrayA[i], arrayB[i])) return false\n }\n return true\n}\n\n/**\n * Check if two elements are equals (they contain the same elements).\n */\nexport function anyEquals(anyA: any, anyB: any): boolean {\n //Test if object is array\n if (Array.isArray(anyA) && Array.isArray(anyB)) {\n return arrayEquals(anyA, anyB)\n } /*Test if objects are set */ else if (anyA instanceof Set && anyB instanceof Set) {\n return setEquals(anyA, anyB)\n } else if (typeof anyA === 'object' && typeof anyB === 'object') {\n return objectEquals(anyA, anyB)\n }\n return anyA === anyB\n}\n\n/**\n * Check if two objects are equals (by comparing the properties in a deep way).\n * @param objectA\n * @param objectB\n * @param ignoredProperties\n */\nexport function objectEquals<T extends { [key: string]: any }>(objectA: T, objectB: T, ignoredProperties?: string[]): boolean {\n const missingInA = Object.keys(objectB)\n .filter((key) => !ignoredProperties?.includes(key))\n .filter((key) => !Object.keys(objectA).includes(key))\n .filter((key) => objectB[key] !== undefined && objectB[key] !== null)\n\n if (missingInA.length > 0) return false\n\n const missingInB = Object.keys(objectA)\n .filter((key) => !ignoredProperties?.includes(key))\n .filter((key) => !Object.keys(objectB).includes(key))\n .filter((key) => objectA[key] !== undefined && objectA[key] !== null)\n\n if (missingInB.length > 0) return false\n\n for (let i = 0, keys = Object.keys(objectA); i < keys.length; i++) {\n const key = keys[i]\n if (ignoredProperties?.includes(key)) continue\n if (!anyEquals(objectA[key], objectB[key])) return false\n }\n\n return true\n}\n\n/**\n * Fully consumes an async generator and provides all results as an array.\n * @param generator an async generator.\n */\nexport async function asyncGeneratorToArray<T>(generator: AsyncGenerator<T, any, never>): Promise<T[]> {\n const res = []\n let latest = await generator.next()\n while (!latest.done) {\n res.push(latest.value)\n latest = await generator.next()\n }\n return res\n}\n"]}
@@ -31,7 +31,7 @@ export declare function pkcs8ToJwk(buf: Uint8Array | ArrayBuffer): {
31
31
  * in one null byte according to standards rather than in a multi-byte
32
32
  * overlong form.
33
33
  */
34
- export declare function truncateTrailingNulls(a: Uint8Array): Uint8Array;
34
+ export declare function truncateTrailingNulls(a: Uint8Array): Uint8Array<ArrayBufferLike>;
35
35
  /**
36
36
  *
37
37
  * @param buffer1 {Uint8Array}