@credo-ts/anoncreds 0.6.0-pr-2444-20251010162514 → 0.6.0-pr-2454-20251015095608

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 (276) hide show
  1. package/build/AnonCredsApi.d.mts +4 -4
  2. package/build/AnonCredsApi.d.mts.map +1 -1
  3. package/build/AnonCredsApi.d.ts +4 -4
  4. package/build/AnonCredsApi.d.ts.map +1 -1
  5. package/build/AnonCredsApi.js +14 -14
  6. package/build/AnonCredsApi.mjs +14 -14
  7. package/build/AnonCredsApi.mjs.map +1 -1
  8. package/build/AnonCredsModule.d.mts.map +1 -1
  9. package/build/AnonCredsModule.d.ts.map +1 -1
  10. package/build/AnonCredsModule.js +7 -7
  11. package/build/AnonCredsModule.mjs +7 -7
  12. package/build/AnonCredsModule.mjs.map +1 -1
  13. package/build/anoncreds-rs/AnonCredsDataIntegrityService.js +1 -1
  14. package/build/anoncreds-rs/AnonCredsDataIntegrityService.mjs +1 -1
  15. package/build/anoncreds-rs/AnonCredsDataIntegrityService.mjs.map +1 -1
  16. package/build/anoncreds-rs/AnonCredsRsHolderService.js +6 -6
  17. package/build/anoncreds-rs/AnonCredsRsHolderService.mjs +6 -6
  18. package/build/anoncreds-rs/AnonCredsRsHolderService.mjs.map +1 -1
  19. package/build/anoncreds-rs/AnonCredsRsIssuerService.js +3 -3
  20. package/build/anoncreds-rs/AnonCredsRsIssuerService.mjs +3 -3
  21. package/build/anoncreds-rs/AnonCredsRsIssuerService.mjs.map +1 -1
  22. package/build/anoncreds-rs/AnonCredsRsVerifierService.mjs.map +1 -1
  23. package/build/anoncreds-rs/utils.js +1 -1
  24. package/build/anoncreds-rs/utils.mjs +1 -1
  25. package/build/anoncreds-rs/utils.mjs.map +1 -1
  26. package/build/error/index.js +1 -1
  27. package/build/error/index.mjs +1 -1
  28. package/build/formats/AnonCredsDidCommCredentialFormatService.d.mts.map +1 -1
  29. package/build/formats/AnonCredsDidCommCredentialFormatService.d.ts.map +1 -1
  30. package/build/formats/AnonCredsDidCommCredentialFormatService.js +5 -5
  31. package/build/formats/AnonCredsDidCommCredentialFormatService.mjs +5 -5
  32. package/build/formats/AnonCredsDidCommCredentialFormatService.mjs.map +1 -1
  33. package/build/formats/AnonCredsDidCommProofFormat.d.mts +1 -1
  34. package/build/formats/AnonCredsDidCommProofFormat.d.ts +1 -1
  35. package/build/formats/AnonCredsDidCommProofFormatService.d.mts.map +1 -1
  36. package/build/formats/AnonCredsDidCommProofFormatService.d.ts.map +1 -1
  37. package/build/formats/AnonCredsDidCommProofFormatService.js +5 -5
  38. package/build/formats/AnonCredsDidCommProofFormatService.mjs +5 -5
  39. package/build/formats/AnonCredsDidCommProofFormatService.mjs.map +1 -1
  40. package/build/formats/DataIntegrityDidCommCredentialFormatService.d.mts +4 -18
  41. package/build/formats/DataIntegrityDidCommCredentialFormatService.d.mts.map +1 -1
  42. package/build/formats/DataIntegrityDidCommCredentialFormatService.d.ts +4 -18
  43. package/build/formats/DataIntegrityDidCommCredentialFormatService.d.ts.map +1 -1
  44. package/build/formats/DataIntegrityDidCommCredentialFormatService.js +16 -16
  45. package/build/formats/DataIntegrityDidCommCredentialFormatService.mjs +16 -16
  46. package/build/formats/DataIntegrityDidCommCredentialFormatService.mjs.map +1 -1
  47. package/build/formats/LegacyIndyDidCommCredentialFormatService.d.mts.map +1 -1
  48. package/build/formats/LegacyIndyDidCommCredentialFormatService.d.ts.map +1 -1
  49. package/build/formats/LegacyIndyDidCommCredentialFormatService.js +3 -3
  50. package/build/formats/LegacyIndyDidCommCredentialFormatService.mjs +3 -3
  51. package/build/formats/LegacyIndyDidCommCredentialFormatService.mjs.map +1 -1
  52. package/build/formats/LegacyIndyDidCommProofFormat.d.mts +1 -1
  53. package/build/formats/LegacyIndyDidCommProofFormat.d.ts +1 -1
  54. package/build/formats/LegacyIndyDidCommProofFormatService.d.mts.map +1 -1
  55. package/build/formats/LegacyIndyDidCommProofFormatService.d.ts.map +1 -1
  56. package/build/formats/LegacyIndyDidCommProofFormatService.js +8 -8
  57. package/build/formats/LegacyIndyDidCommProofFormatService.mjs +8 -8
  58. package/build/formats/LegacyIndyDidCommProofFormatService.mjs.map +1 -1
  59. package/build/formats/index.js +1 -1
  60. package/build/formats/index.mjs +1 -1
  61. package/build/index.d.mts +30 -30
  62. package/build/index.d.ts +30 -30
  63. package/build/index.js +25 -25
  64. package/build/index.mjs +25 -25
  65. package/build/models/AnonCredsCredentialProposal.js +2 -2
  66. package/build/models/AnonCredsCredentialProposal.mjs +1 -1
  67. package/build/models/AnonCredsProofRequest.js +2 -2
  68. package/build/models/AnonCredsProofRequest.mjs +1 -1
  69. package/build/models/AnonCredsProofRequest.mjs.map +1 -1
  70. package/build/models/AnonCredsRequestedAttribute.js +2 -2
  71. package/build/models/AnonCredsRequestedAttribute.mjs +1 -1
  72. package/build/models/AnonCredsRequestedAttribute.mjs.map +1 -1
  73. package/build/models/AnonCredsRequestedPredicate.js +3 -3
  74. package/build/models/AnonCredsRequestedPredicate.mjs +2 -2
  75. package/build/models/AnonCredsRequestedPredicate.mjs.map +1 -1
  76. package/build/models/AnonCredsRestriction.js +2 -2
  77. package/build/models/AnonCredsRestriction.mjs +1 -1
  78. package/build/models/AnonCredsRestrictionWrapper.js +2 -2
  79. package/build/models/AnonCredsRestrictionWrapper.mjs +1 -1
  80. package/build/models/exchange.mjs.map +1 -1
  81. package/build/models/index.js +1 -1
  82. package/build/models/index.mjs +1 -1
  83. package/build/protocols/credentials/v1/DidCommCredentialV1Protocol.d.mts +1 -1
  84. package/build/protocols/credentials/v1/DidCommCredentialV1Protocol.d.mts.map +1 -1
  85. package/build/protocols/credentials/v1/DidCommCredentialV1Protocol.d.ts +1 -1
  86. package/build/protocols/credentials/v1/DidCommCredentialV1Protocol.d.ts.map +1 -1
  87. package/build/protocols/credentials/v1/DidCommCredentialV1Protocol.js +4 -4
  88. package/build/protocols/credentials/v1/DidCommCredentialV1Protocol.mjs +4 -4
  89. package/build/protocols/credentials/v1/DidCommCredentialV1Protocol.mjs.map +1 -1
  90. package/build/protocols/credentials/v1/handlers/DidCommIssueCredentialV1Handler.mjs.map +1 -1
  91. package/build/protocols/credentials/v1/handlers/DidCommOfferCredentialV1Handler.mjs.map +1 -1
  92. package/build/protocols/credentials/v1/handlers/DidCommProposeCredentialV1Handler.mjs.map +1 -1
  93. package/build/protocols/credentials/v1/handlers/DidCommRequestCredentialV1Handler.mjs.map +1 -1
  94. package/build/protocols/credentials/v1/handlers/index.js +1 -1
  95. package/build/protocols/credentials/v1/handlers/index.mjs +1 -1
  96. package/build/protocols/credentials/v1/index.js +2 -2
  97. package/build/protocols/credentials/v1/index.mjs +2 -2
  98. package/build/protocols/credentials/v1/messages/DidCommCredentialV1AckMessage.d.mts +2 -2
  99. package/build/protocols/credentials/v1/messages/DidCommCredentialV1AckMessage.d.ts +2 -2
  100. package/build/protocols/credentials/v1/messages/DidCommCredentialV1Preview.d.mts +2 -2
  101. package/build/protocols/credentials/v1/messages/DidCommCredentialV1Preview.d.mts.map +1 -1
  102. package/build/protocols/credentials/v1/messages/DidCommCredentialV1Preview.d.ts +2 -2
  103. package/build/protocols/credentials/v1/messages/DidCommCredentialV1Preview.d.ts.map +1 -1
  104. package/build/protocols/credentials/v1/messages/DidCommCredentialV1Preview.js +4 -4
  105. package/build/protocols/credentials/v1/messages/DidCommCredentialV1Preview.mjs +2 -2
  106. package/build/protocols/credentials/v1/messages/DidCommCredentialV1Preview.mjs.map +1 -1
  107. package/build/protocols/credentials/v1/messages/DidCommCredentialV1ProblemReportMessage.d.mts +2 -2
  108. package/build/protocols/credentials/v1/messages/DidCommCredentialV1ProblemReportMessage.d.ts +2 -2
  109. package/build/protocols/credentials/v1/messages/DidCommIssueCredentialV1Message.d.mts +2 -2
  110. package/build/protocols/credentials/v1/messages/DidCommIssueCredentialV1Message.d.mts.map +1 -1
  111. package/build/protocols/credentials/v1/messages/DidCommIssueCredentialV1Message.d.ts +2 -2
  112. package/build/protocols/credentials/v1/messages/DidCommIssueCredentialV1Message.d.ts.map +1 -1
  113. package/build/protocols/credentials/v1/messages/DidCommIssueCredentialV1Message.js +4 -4
  114. package/build/protocols/credentials/v1/messages/DidCommIssueCredentialV1Message.mjs +2 -2
  115. package/build/protocols/credentials/v1/messages/DidCommIssueCredentialV1Message.mjs.map +1 -1
  116. package/build/protocols/credentials/v1/messages/DidCommOfferCredentialV1Message.d.mts +2 -2
  117. package/build/protocols/credentials/v1/messages/DidCommOfferCredentialV1Message.d.mts.map +1 -1
  118. package/build/protocols/credentials/v1/messages/DidCommOfferCredentialV1Message.d.ts +2 -2
  119. package/build/protocols/credentials/v1/messages/DidCommOfferCredentialV1Message.d.ts.map +1 -1
  120. package/build/protocols/credentials/v1/messages/DidCommOfferCredentialV1Message.js +4 -4
  121. package/build/protocols/credentials/v1/messages/DidCommOfferCredentialV1Message.mjs +2 -2
  122. package/build/protocols/credentials/v1/messages/DidCommOfferCredentialV1Message.mjs.map +1 -1
  123. package/build/protocols/credentials/v1/messages/DidCommProposeCredentialV1Message.d.mts +2 -2
  124. package/build/protocols/credentials/v1/messages/DidCommProposeCredentialV1Message.d.mts.map +1 -1
  125. package/build/protocols/credentials/v1/messages/DidCommProposeCredentialV1Message.d.ts +2 -2
  126. package/build/protocols/credentials/v1/messages/DidCommProposeCredentialV1Message.js +4 -4
  127. package/build/protocols/credentials/v1/messages/DidCommProposeCredentialV1Message.mjs +2 -2
  128. package/build/protocols/credentials/v1/messages/DidCommRequestCredentialV1Message.d.mts +2 -2
  129. package/build/protocols/credentials/v1/messages/DidCommRequestCredentialV1Message.d.mts.map +1 -1
  130. package/build/protocols/credentials/v1/messages/DidCommRequestCredentialV1Message.d.ts +2 -2
  131. package/build/protocols/credentials/v1/messages/DidCommRequestCredentialV1Message.d.ts.map +1 -1
  132. package/build/protocols/credentials/v1/messages/DidCommRequestCredentialV1Message.js +4 -4
  133. package/build/protocols/credentials/v1/messages/DidCommRequestCredentialV1Message.mjs +2 -2
  134. package/build/protocols/credentials/v1/messages/DidCommRequestCredentialV1Message.mjs.map +1 -1
  135. package/build/protocols/credentials/v1/messages/index.js +2 -2
  136. package/build/protocols/credentials/v1/messages/index.mjs +2 -2
  137. package/build/protocols/index.js +5 -5
  138. package/build/protocols/index.mjs +5 -5
  139. package/build/protocols/proofs/v1/DidCommProofV1Protocol.d.mts +2 -2
  140. package/build/protocols/proofs/v1/DidCommProofV1Protocol.d.mts.map +1 -1
  141. package/build/protocols/proofs/v1/DidCommProofV1Protocol.d.ts +2 -2
  142. package/build/protocols/proofs/v1/DidCommProofV1Protocol.d.ts.map +1 -1
  143. package/build/protocols/proofs/v1/DidCommProofV1Protocol.js +6 -6
  144. package/build/protocols/proofs/v1/DidCommProofV1Protocol.mjs +6 -6
  145. package/build/protocols/proofs/v1/DidCommProofV1Protocol.mjs.map +1 -1
  146. package/build/protocols/proofs/v1/handlers/DidCommPresentationV1Handler.mjs.map +1 -1
  147. package/build/protocols/proofs/v1/handlers/DidCommProposePresentationV1Handler.mjs.map +1 -1
  148. package/build/protocols/proofs/v1/handlers/DidCommRequestPresentationV1Handler.mjs.map +1 -1
  149. package/build/protocols/proofs/v1/handlers/index.js +1 -1
  150. package/build/protocols/proofs/v1/handlers/index.mjs +1 -1
  151. package/build/protocols/proofs/v1/index.js +4 -4
  152. package/build/protocols/proofs/v1/index.mjs +4 -4
  153. package/build/protocols/proofs/v1/messages/DidCommPresentationV1AckMessage.d.mts +2 -2
  154. package/build/protocols/proofs/v1/messages/DidCommPresentationV1AckMessage.d.ts +2 -2
  155. package/build/protocols/proofs/v1/messages/DidCommPresentationV1Message.d.mts +2 -2
  156. package/build/protocols/proofs/v1/messages/DidCommPresentationV1Message.d.mts.map +1 -1
  157. package/build/protocols/proofs/v1/messages/DidCommPresentationV1Message.d.ts +2 -2
  158. package/build/protocols/proofs/v1/messages/DidCommPresentationV1Message.d.ts.map +1 -1
  159. package/build/protocols/proofs/v1/messages/DidCommPresentationV1Message.js +4 -4
  160. package/build/protocols/proofs/v1/messages/DidCommPresentationV1Message.mjs +2 -2
  161. package/build/protocols/proofs/v1/messages/DidCommPresentationV1Message.mjs.map +1 -1
  162. package/build/protocols/proofs/v1/messages/DidCommPresentationV1ProblemReportMessage.d.mts +2 -2
  163. package/build/protocols/proofs/v1/messages/DidCommPresentationV1ProblemReportMessage.d.mts.map +1 -1
  164. package/build/protocols/proofs/v1/messages/DidCommProposePresentationV1Message.d.mts +2 -2
  165. package/build/protocols/proofs/v1/messages/DidCommProposePresentationV1Message.d.mts.map +1 -1
  166. package/build/protocols/proofs/v1/messages/DidCommProposePresentationV1Message.d.ts +2 -2
  167. package/build/protocols/proofs/v1/messages/DidCommProposePresentationV1Message.d.ts.map +1 -1
  168. package/build/protocols/proofs/v1/messages/DidCommProposePresentationV1Message.js +4 -4
  169. package/build/protocols/proofs/v1/messages/DidCommProposePresentationV1Message.mjs +2 -2
  170. package/build/protocols/proofs/v1/messages/DidCommRequestPresentationV1Message.d.mts +2 -2
  171. package/build/protocols/proofs/v1/messages/DidCommRequestPresentationV1Message.d.mts.map +1 -1
  172. package/build/protocols/proofs/v1/messages/DidCommRequestPresentationV1Message.d.ts +2 -2
  173. package/build/protocols/proofs/v1/messages/DidCommRequestPresentationV1Message.d.ts.map +1 -1
  174. package/build/protocols/proofs/v1/messages/DidCommRequestPresentationV1Message.js +4 -4
  175. package/build/protocols/proofs/v1/messages/DidCommRequestPresentationV1Message.mjs +2 -2
  176. package/build/protocols/proofs/v1/messages/DidCommRequestPresentationV1Message.mjs.map +1 -1
  177. package/build/protocols/proofs/v1/messages/index.js +3 -3
  178. package/build/protocols/proofs/v1/messages/index.mjs +3 -3
  179. package/build/protocols/proofs/v1/models/DidCommPresentationV1Preview.d.mts +1 -1
  180. package/build/protocols/proofs/v1/models/DidCommPresentationV1Preview.d.mts.map +1 -1
  181. package/build/protocols/proofs/v1/models/DidCommPresentationV1Preview.d.ts +2 -2
  182. package/build/protocols/proofs/v1/models/DidCommPresentationV1Preview.d.ts.map +1 -1
  183. package/build/protocols/proofs/v1/models/DidCommPresentationV1Preview.js +6 -6
  184. package/build/protocols/proofs/v1/models/DidCommPresentationV1Preview.mjs +4 -4
  185. package/build/protocols/proofs/v1/models/DidCommPresentationV1Preview.mjs.map +1 -1
  186. package/build/repository/AnonCredsCredentialDefinitionPrivateRepository.js +2 -2
  187. package/build/repository/AnonCredsCredentialDefinitionPrivateRepository.mjs +2 -2
  188. package/build/repository/AnonCredsCredentialDefinitionPrivateRepository.mjs.map +1 -1
  189. package/build/repository/AnonCredsCredentialDefinitionRecord.d.mts.map +1 -1
  190. package/build/repository/AnonCredsCredentialDefinitionRecord.d.ts.map +1 -1
  191. package/build/repository/AnonCredsCredentialDefinitionRecord.js +1 -1
  192. package/build/repository/AnonCredsCredentialDefinitionRecord.mjs +1 -1
  193. package/build/repository/AnonCredsCredentialDefinitionRecord.mjs.map +1 -1
  194. package/build/repository/AnonCredsCredentialDefinitionRepository.js +1 -1
  195. package/build/repository/AnonCredsCredentialDefinitionRepository.mjs +1 -1
  196. package/build/repository/AnonCredsCredentialDefinitionRepository.mjs.map +1 -1
  197. package/build/repository/AnonCredsCredentialRecord.d.mts.map +1 -1
  198. package/build/repository/AnonCredsCredentialRecord.d.ts.map +1 -1
  199. package/build/repository/AnonCredsCredentialRecord.mjs.map +1 -1
  200. package/build/repository/AnonCredsCredentialRepository.js +1 -1
  201. package/build/repository/AnonCredsCredentialRepository.mjs +1 -1
  202. package/build/repository/AnonCredsCredentialRepository.mjs.map +1 -1
  203. package/build/repository/AnonCredsKeyCorrectnessProofRepository.js +1 -1
  204. package/build/repository/AnonCredsKeyCorrectnessProofRepository.mjs +1 -1
  205. package/build/repository/AnonCredsKeyCorrectnessProofRepository.mjs.map +1 -1
  206. package/build/repository/AnonCredsLinkSecretRepository.js +1 -1
  207. package/build/repository/AnonCredsLinkSecretRepository.mjs +1 -1
  208. package/build/repository/AnonCredsLinkSecretRepository.mjs.map +1 -1
  209. package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.d.mts.map +1 -1
  210. package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.d.ts.map +1 -1
  211. package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.js +1 -1
  212. package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.mjs +1 -1
  213. package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.mjs.map +1 -1
  214. package/build/repository/AnonCredsRevocationRegistryDefinitionRecord.d.mts.map +1 -1
  215. package/build/repository/AnonCredsRevocationRegistryDefinitionRecord.d.ts.map +1 -1
  216. package/build/repository/AnonCredsRevocationRegistryDefinitionRecord.mjs.map +1 -1
  217. package/build/repository/AnonCredsRevocationRegistryDefinitionRepository.js +1 -1
  218. package/build/repository/AnonCredsRevocationRegistryDefinitionRepository.mjs +1 -1
  219. package/build/repository/AnonCredsRevocationRegistryDefinitionRepository.mjs.map +1 -1
  220. package/build/repository/AnonCredsSchemaRecord.d.mts.map +1 -1
  221. package/build/repository/AnonCredsSchemaRecord.d.ts.map +1 -1
  222. package/build/repository/AnonCredsSchemaRecord.js +1 -1
  223. package/build/repository/AnonCredsSchemaRecord.mjs +1 -1
  224. package/build/repository/AnonCredsSchemaRecord.mjs.map +1 -1
  225. package/build/repository/AnonCredsSchemaRepository.js +1 -1
  226. package/build/repository/AnonCredsSchemaRepository.mjs +1 -1
  227. package/build/repository/AnonCredsSchemaRepository.mjs.map +1 -1
  228. package/build/repository/index.js +6 -6
  229. package/build/repository/index.mjs +6 -6
  230. package/build/services/AnonCredsHolderService.d.mts +1 -1
  231. package/build/services/AnonCredsHolderService.d.ts +1 -1
  232. package/build/services/AnonCredsHolderServiceOptions.d.mts +1 -1
  233. package/build/services/AnonCredsHolderServiceOptions.d.ts +1 -1
  234. package/build/services/index.js +3 -3
  235. package/build/services/index.mjs +3 -3
  236. package/build/services/registry/AnonCredsRegistryService.d.mts.map +1 -1
  237. package/build/services/registry/AnonCredsRegistryService.d.ts.map +1 -1
  238. package/build/services/registry/AnonCredsRegistryService.js +1 -1
  239. package/build/services/registry/AnonCredsRegistryService.mjs +1 -1
  240. package/build/services/registry/AnonCredsRegistryService.mjs.map +1 -1
  241. package/build/services/tails/BasicTailsFileService.d.mts.map +1 -1
  242. package/build/services/tails/BasicTailsFileService.d.ts.map +1 -1
  243. package/build/services/tails/BasicTailsFileService.mjs.map +1 -1
  244. package/build/updates/0.3.1-0.4/credentialDefinition.js +1 -1
  245. package/build/updates/0.3.1-0.4/credentialDefinition.mjs +1 -1
  246. package/build/updates/0.3.1-0.4/credentialDefinition.mjs.map +1 -1
  247. package/build/updates/0.4-0.5/anonCredsCredentialRecord.js +3 -3
  248. package/build/updates/0.4-0.5/anonCredsCredentialRecord.mjs +3 -3
  249. package/build/updates/0.4-0.5/anonCredsCredentialRecord.mjs.map +1 -1
  250. package/build/utils/anonCredsObjects.d.mts.map +1 -1
  251. package/build/utils/anonCredsObjects.d.ts.map +1 -1
  252. package/build/utils/anonCredsObjects.mjs.map +1 -1
  253. package/build/utils/areRequestsEqual.mjs.map +1 -1
  254. package/build/utils/bytesToBigint.mjs.map +1 -1
  255. package/build/utils/createRequestFromPreview.mjs.map +1 -1
  256. package/build/utils/credential.d.mts.map +1 -1
  257. package/build/utils/credential.d.ts.map +1 -1
  258. package/build/utils/credential.mjs.map +1 -1
  259. package/build/utils/getCredentialsForAnonCredsRequest.js +3 -3
  260. package/build/utils/getCredentialsForAnonCredsRequest.mjs +3 -3
  261. package/build/utils/getCredentialsForAnonCredsRequest.mjs.map +1 -1
  262. package/build/utils/getRevocationRegistries.mjs.map +1 -1
  263. package/build/utils/hasDuplicateGroupNames.mjs.map +1 -1
  264. package/build/utils/index.js +9 -9
  265. package/build/utils/index.mjs +9 -9
  266. package/build/utils/indyIdentifiers.d.mts.map +1 -1
  267. package/build/utils/indyIdentifiers.d.ts.map +1 -1
  268. package/build/utils/indyIdentifiers.mjs.map +1 -1
  269. package/build/utils/isMap.mjs.map +1 -1
  270. package/build/utils/revocationInterval.d.mts.map +1 -1
  271. package/build/utils/revocationInterval.d.ts.map +1 -1
  272. package/build/utils/revocationInterval.mjs.map +1 -1
  273. package/build/utils/w3cAnonCredsUtils.d.mts.map +1 -1
  274. package/build/utils/w3cAnonCredsUtils.d.ts.map +1 -1
  275. package/build/utils/w3cAnonCredsUtils.mjs.map +1 -1
  276. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"AnonCredsRsVerifierService.mjs","names":["AnonCredsRsVerifierService","AnonCredsW3cCredential","presentation: Presentation | undefined","rsCredentialDefinitions: Record<string, JsonObject>","rsSchemas: Record<string, JsonObject>","revocationRegistryDefinitions: Record<string, JsonObject>","lists: JsonObject[]","nonRevokedIntervalOverrides: NonRevokedIntervalOverride[]","requestedNonRevokedRestrictions: {\n nonRevokedInterval: AnonCredsNonRevokedInterval\n schemaId?: string\n credentialDefinitionId?: string\n revocationRegistryDefinitionId?: string\n }[]","revocationRegistryDefinitions: Record<string, RevocationRegistryDefinition>","verificationOptions: VerifyAnonCredsW3cPresentationOptions","w3cPresentation: W3cPresentation | undefined"],"sources":["../../src/anoncreds-rs/AnonCredsRsVerifierService.ts"],"sourcesContent":["import type { AgentContext } from '@credo-ts/core'\nimport type {\n JsonObject,\n NonRevokedIntervalOverride,\n RevocationRegistryDefinition,\n VerifyW3cPresentationOptions as VerifyAnonCredsW3cPresentationOptions,\n} from '@hyperledger/anoncreds-shared'\nimport type { AnonCredsNonRevokedInterval, AnonCredsProof, AnonCredsProofRequest } from '../models'\nimport type { CredentialWithRevocationMetadata } from '../models/utils'\nimport type { AnonCredsVerifierService, VerifyProofOptions, VerifyW3cPresentationOptions } from '../services'\n\nimport { JsonTransformer, injectable } from '@credo-ts/core'\nimport { W3cCredential as AnonCredsW3cCredential, Presentation, W3cPresentation } from '@hyperledger/anoncreds-shared'\n\nimport { fetchRevocationStatusList } from '../utils'\n\nimport { getRevocationMetadata } from './utils'\n\n@injectable()\nexport class AnonCredsRsVerifierService implements AnonCredsVerifierService {\n public async verifyProof(agentContext: AgentContext, options: VerifyProofOptions): Promise<boolean> {\n const { credentialDefinitions, proof, proofRequest, revocationRegistries, schemas } = options\n\n let presentation: Presentation | undefined\n try {\n // Check that provided timestamps correspond to the active ones from the VDR. If they are and differ from the originally\n // requested ones, create overrides for anoncreds-rs to consider them valid\n const { verified, nonRevokedIntervalOverrides } = await this.verifyTimestamps(agentContext, proof, proofRequest)\n\n // No need to call anoncreds-rs as we already know that the proof will not be valid\n if (!verified) {\n agentContext.config.logger.debug('Invalid timestamps for provided identifiers')\n return false\n }\n\n presentation = Presentation.fromJson(proof as unknown as JsonObject)\n\n const rsCredentialDefinitions: Record<string, JsonObject> = {}\n for (const credDefId in credentialDefinitions) {\n rsCredentialDefinitions[credDefId] = credentialDefinitions[credDefId] as unknown as JsonObject\n }\n\n const rsSchemas: Record<string, JsonObject> = {}\n for (const schemaId in schemas) {\n rsSchemas[schemaId] = schemas[schemaId] as unknown as JsonObject\n }\n\n const revocationRegistryDefinitions: Record<string, JsonObject> = {}\n const lists: JsonObject[] = []\n\n for (const revocationRegistryDefinitionId in revocationRegistries) {\n const { definition, revocationStatusLists } = options.revocationRegistries[revocationRegistryDefinitionId]\n\n revocationRegistryDefinitions[revocationRegistryDefinitionId] = definition as unknown as JsonObject\n\n lists.push(...(Object.values(revocationStatusLists) as unknown as Array<JsonObject>))\n }\n\n return presentation.verify({\n presentationRequest: proofRequest as unknown as JsonObject,\n credentialDefinitions: rsCredentialDefinitions,\n schemas: rsSchemas,\n revocationRegistryDefinitions,\n revocationStatusLists: lists,\n nonRevokedIntervalOverrides,\n })\n } finally {\n presentation?.handle.clear()\n }\n }\n\n private async verifyTimestamps(\n agentContext: AgentContext,\n proof: AnonCredsProof,\n proofRequest: AnonCredsProofRequest\n ): Promise<{ verified: boolean; nonRevokedIntervalOverrides?: NonRevokedIntervalOverride[] }> {\n const nonRevokedIntervalOverrides: NonRevokedIntervalOverride[] = []\n\n // Override expected timestamps if the requested ones don't exacly match the values from VDR\n const globalNonRevokedInterval = proofRequest.non_revoked\n\n const requestedNonRevokedRestrictions: {\n nonRevokedInterval: AnonCredsNonRevokedInterval\n schemaId?: string\n credentialDefinitionId?: string\n revocationRegistryDefinitionId?: string\n }[] = []\n\n for (const value of [\n ...Object.values(proofRequest.requested_attributes),\n ...Object.values(proofRequest.requested_predicates),\n ]) {\n const nonRevokedInterval = value.non_revoked ?? globalNonRevokedInterval\n if (nonRevokedInterval) {\n for (const restriction of value.restrictions ?? []) {\n requestedNonRevokedRestrictions.push({\n nonRevokedInterval,\n schemaId: restriction.schema_id,\n credentialDefinitionId: restriction.cred_def_id,\n revocationRegistryDefinitionId: restriction.rev_reg_id,\n })\n }\n }\n }\n\n for (const identifier of proof.identifiers) {\n if (!identifier.timestamp || !identifier.rev_reg_id) {\n continue\n }\n const relatedNonRevokedRestrictionItem = requestedNonRevokedRestrictions.find(\n (item) =>\n item.revocationRegistryDefinitionId === identifier.rev_reg_id ||\n item.credentialDefinitionId === identifier.cred_def_id ||\n item.schemaId === identifier.schema_id\n )\n\n const requestedFrom = relatedNonRevokedRestrictionItem?.nonRevokedInterval.from\n if (requestedFrom && requestedFrom > identifier.timestamp) {\n // Check VDR if the active revocation status list at requestedFrom was the one from provided timestamp.\n // If it matches, add to the override list\n const { revocationStatusList } = await fetchRevocationStatusList(\n agentContext,\n identifier.rev_reg_id,\n requestedFrom\n )\n\n const vdrTimestamp = revocationStatusList?.timestamp\n if (vdrTimestamp && vdrTimestamp === identifier.timestamp) {\n nonRevokedIntervalOverrides.push({\n overrideRevocationStatusListTimestamp: identifier.timestamp,\n requestedFromTimestamp: requestedFrom,\n revocationRegistryDefinitionId: identifier.rev_reg_id,\n })\n } else {\n agentContext.config.logger.debug(\n `VDR timestamp for ${requestedFrom} does not correspond to the one provided in proof identifiers. Expected: ${identifier.timestamp} and received ${vdrTimestamp}`\n )\n return { verified: false }\n }\n }\n }\n\n return {\n verified: true,\n nonRevokedIntervalOverrides: nonRevokedIntervalOverrides.length ? nonRevokedIntervalOverrides : undefined,\n }\n }\n\n private getRevocationMetadataForCredentials = async (\n agentContext: AgentContext,\n credentialsWithMetadata: CredentialWithRevocationMetadata[]\n ) => {\n const revocationMetadataFetchPromises = credentialsWithMetadata\n .filter((cwm) => cwm.nonRevoked)\n .map(async (credentialWithMetadata) => {\n const w3cJsonLdVerifiableCredential = JsonTransformer.toJSON(credentialWithMetadata.credential)\n const { revocationRegistryIndex, revocationRegistryId, timestamp } =\n AnonCredsW3cCredential.fromJson(w3cJsonLdVerifiableCredential)\n\n return await getRevocationMetadata(agentContext, {\n nonRevokedInterval: credentialWithMetadata.nonRevoked as AnonCredsNonRevokedInterval,\n timestamp: timestamp,\n revocationRegistryId,\n revocationRegistryIndex,\n })\n })\n\n return await Promise.all(revocationMetadataFetchPromises)\n }\n\n public async verifyW3cPresentation(agentContext: AgentContext, options: VerifyW3cPresentationOptions) {\n const revocationMetadata = await this.getRevocationMetadataForCredentials(\n agentContext,\n options.credentialsWithRevocationMetadata\n )\n\n const revocationRegistryDefinitions: Record<string, RevocationRegistryDefinition> = {}\n for (const rm of revocationMetadata) {\n revocationRegistryDefinitions[rm.revocationRegistryId] = rm.revocationRegistryDefinition\n }\n\n const verificationOptions: VerifyAnonCredsW3cPresentationOptions = {\n presentationRequest: options.proofRequest as unknown as JsonObject,\n schemas: options.schemas as unknown as Record<string, JsonObject>,\n credentialDefinitions: options.credentialDefinitions as unknown as Record<string, JsonObject>,\n revocationRegistryDefinitions,\n revocationStatusLists: revocationMetadata.map((rm) => rm.revocationStatusList),\n nonRevokedIntervalOverrides: revocationMetadata\n .filter((rm) => rm.nonRevokedIntervalOverride)\n .map((rm) => rm.nonRevokedIntervalOverride as NonRevokedIntervalOverride),\n }\n\n let result = false\n const presentationJson = JsonTransformer.toJSON(options.presentation)\n if ('presentation_submission' in presentationJson) presentationJson.presentation_submission = undefined\n\n let w3cPresentation: W3cPresentation | undefined\n try {\n w3cPresentation = W3cPresentation.fromJson(presentationJson)\n result = w3cPresentation.verify(verificationOptions)\n } finally {\n w3cPresentation?.handle.clear()\n }\n return result\n }\n}\n"],"mappings":";;;;;;;;AAmBO,uCAAMA,6BAA+D;;OAiIlE,sCAAsC,OAC5C,cACA,4BACG;GACH,MAAM,kCAAkC,wBACrC,QAAQ,QAAQ,IAAI,WAAW,CAC/B,IAAI,OAAO,2BAA2B;IACrC,MAAM,gCAAgC,gBAAgB,OAAO,uBAAuB,WAAW;IAC/F,MAAM,EAAE,yBAAyB,sBAAsB,cACrDC,gBAAuB,SAAS,8BAA8B;AAEhE,WAAO,MAAM,sBAAsB,cAAc;KAC/C,oBAAoB,uBAAuB;KAChC;KACX;KACA;KACD,CAAC;KACF;AAEJ,UAAO,MAAM,QAAQ,IAAI,gCAAgC;;;CAnJ3D,MAAa,YAAY,cAA4B,SAA+C;EAClG,MAAM,EAAE,uBAAuB,OAAO,cAAc,sBAAsB,YAAY;EAEtF,IAAIC;AACJ,MAAI;GAGF,MAAM,EAAE,UAAU,gCAAgC,MAAM,KAAK,iBAAiB,cAAc,OAAO,aAAa;AAGhH,OAAI,CAAC,UAAU;AACb,iBAAa,OAAO,OAAO,MAAM,8CAA8C;AAC/E,WAAO;;AAGT,kBAAe,aAAa,SAAS,MAA+B;GAEpE,MAAMC,0BAAsD,EAAE;AAC9D,QAAK,MAAM,aAAa,sBACtB,yBAAwB,aAAa,sBAAsB;GAG7D,MAAMC,YAAwC,EAAE;AAChD,QAAK,MAAM,YAAY,QACrB,WAAU,YAAY,QAAQ;GAGhC,MAAMC,gCAA4D,EAAE;GACpE,MAAMC,QAAsB,EAAE;AAE9B,QAAK,MAAM,kCAAkC,sBAAsB;IACjE,MAAM,EAAE,YAAY,0BAA0B,QAAQ,qBAAqB;AAE3E,kCAA8B,kCAAkC;AAEhE,UAAM,KAAK,GAAI,OAAO,OAAO,sBAAsB,CAAkC;;AAGvF,UAAO,aAAa,OAAO;IACzB,qBAAqB;IACrB,uBAAuB;IACvB,SAAS;IACT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ACT;EAED,MAAMC,gCAA8E,EAAE;AACtF,OAAK,MAAM,MAAM,mBACf,+BAA8B,GAAG,wBAAwB,GAAG;EAG9D,MAAMC,sBAA6D;GACjE,qBAAqB,QAAQ;GAC7B,SAAS,QAAQ;GACjB,uBAAuB,QAAQ;GAC/B;GACA,uBAAuB,mBAAmB,KAAK,OAAO,GAAG,qBAAqB;GAC9E,6BAA6B,mBAC1B,QAAQ,OAAO,GAAG,2BAA2B,CAC7C,KAAK,OAAO,GAAG,2BAAyD;GAC5E;EAED,IAAI,SAAS;EACb,MAAM,mBAAmB,gBAAgB,OAAO,QAAQ,aAAa;AACrE,MAAI,6BAA6B,iBAAkB,kBAAiB,0BAA0B;EAE9F,IAAIC;AACJ,MAAI;AACF,qBAAkB,gBAAgB,SAAS,iBAAiB;AAC5D,YAAS,gBAAgB,OAAO,oBAAoB;YAC5C;AACR,oBAAiB,OAAO,OAAO;;AAEjC,SAAO;;;yCAzLV,YAAY"}
1
+ {"version":3,"file":"AnonCredsRsVerifierService.mjs","names":["AnonCredsRsVerifierService","AnonCredsW3cCredential","presentation: Presentation | undefined","rsCredentialDefinitions: Record<string, JsonObject>","rsSchemas: Record<string, JsonObject>","revocationRegistryDefinitions: Record<string, JsonObject>","lists: JsonObject[]","nonRevokedIntervalOverrides: NonRevokedIntervalOverride[]","requestedNonRevokedRestrictions: {\n nonRevokedInterval: AnonCredsNonRevokedInterval\n schemaId?: string\n credentialDefinitionId?: string\n revocationRegistryDefinitionId?: string\n }[]","revocationRegistryDefinitions: Record<string, RevocationRegistryDefinition>","verificationOptions: VerifyAnonCredsW3cPresentationOptions","w3cPresentation: W3cPresentation | undefined"],"sources":["../../src/anoncreds-rs/AnonCredsRsVerifierService.ts"],"sourcesContent":["import type { AgentContext } from '@credo-ts/core'\nimport { injectable, JsonTransformer } from '@credo-ts/core'\nimport type {\n JsonObject,\n NonRevokedIntervalOverride,\n RevocationRegistryDefinition,\n VerifyW3cPresentationOptions as VerifyAnonCredsW3cPresentationOptions,\n} from '@hyperledger/anoncreds-shared'\nimport { W3cCredential as AnonCredsW3cCredential, Presentation, W3cPresentation } from '@hyperledger/anoncreds-shared'\nimport type { AnonCredsNonRevokedInterval, AnonCredsProof, AnonCredsProofRequest } from '../models'\nimport type { CredentialWithRevocationMetadata } from '../models/utils'\nimport type { AnonCredsVerifierService, VerifyProofOptions, VerifyW3cPresentationOptions } from '../services'\n\nimport { fetchRevocationStatusList } from '../utils'\n\nimport { getRevocationMetadata } from './utils'\n\n@injectable()\nexport class AnonCredsRsVerifierService implements AnonCredsVerifierService {\n public async verifyProof(agentContext: AgentContext, options: VerifyProofOptions): Promise<boolean> {\n const { credentialDefinitions, proof, proofRequest, revocationRegistries, schemas } = options\n\n let presentation: Presentation | undefined\n try {\n // Check that provided timestamps correspond to the active ones from the VDR. If they are and differ from the originally\n // requested ones, create overrides for anoncreds-rs to consider them valid\n const { verified, nonRevokedIntervalOverrides } = await this.verifyTimestamps(agentContext, proof, proofRequest)\n\n // No need to call anoncreds-rs as we already know that the proof will not be valid\n if (!verified) {\n agentContext.config.logger.debug('Invalid timestamps for provided identifiers')\n return false\n }\n\n presentation = Presentation.fromJson(proof as unknown as JsonObject)\n\n const rsCredentialDefinitions: Record<string, JsonObject> = {}\n for (const credDefId in credentialDefinitions) {\n rsCredentialDefinitions[credDefId] = credentialDefinitions[credDefId] as unknown as JsonObject\n }\n\n const rsSchemas: Record<string, JsonObject> = {}\n for (const schemaId in schemas) {\n rsSchemas[schemaId] = schemas[schemaId] as unknown as JsonObject\n }\n\n const revocationRegistryDefinitions: Record<string, JsonObject> = {}\n const lists: JsonObject[] = []\n\n for (const revocationRegistryDefinitionId in revocationRegistries) {\n const { definition, revocationStatusLists } = options.revocationRegistries[revocationRegistryDefinitionId]\n\n revocationRegistryDefinitions[revocationRegistryDefinitionId] = definition as unknown as JsonObject\n\n lists.push(...(Object.values(revocationStatusLists) as unknown as Array<JsonObject>))\n }\n\n return presentation.verify({\n presentationRequest: proofRequest as unknown as JsonObject,\n credentialDefinitions: rsCredentialDefinitions,\n schemas: rsSchemas,\n revocationRegistryDefinitions,\n revocationStatusLists: lists,\n nonRevokedIntervalOverrides,\n })\n } finally {\n presentation?.handle.clear()\n }\n }\n\n private async verifyTimestamps(\n agentContext: AgentContext,\n proof: AnonCredsProof,\n proofRequest: AnonCredsProofRequest\n ): Promise<{ verified: boolean; nonRevokedIntervalOverrides?: NonRevokedIntervalOverride[] }> {\n const nonRevokedIntervalOverrides: NonRevokedIntervalOverride[] = []\n\n // Override expected timestamps if the requested ones don't exacly match the values from VDR\n const globalNonRevokedInterval = proofRequest.non_revoked\n\n const requestedNonRevokedRestrictions: {\n nonRevokedInterval: AnonCredsNonRevokedInterval\n schemaId?: string\n credentialDefinitionId?: string\n revocationRegistryDefinitionId?: string\n }[] = []\n\n for (const value of [\n ...Object.values(proofRequest.requested_attributes),\n ...Object.values(proofRequest.requested_predicates),\n ]) {\n const nonRevokedInterval = value.non_revoked ?? globalNonRevokedInterval\n if (nonRevokedInterval) {\n for (const restriction of value.restrictions ?? []) {\n requestedNonRevokedRestrictions.push({\n nonRevokedInterval,\n schemaId: restriction.schema_id,\n credentialDefinitionId: restriction.cred_def_id,\n revocationRegistryDefinitionId: restriction.rev_reg_id,\n })\n }\n }\n }\n\n for (const identifier of proof.identifiers) {\n if (!identifier.timestamp || !identifier.rev_reg_id) {\n continue\n }\n const relatedNonRevokedRestrictionItem = requestedNonRevokedRestrictions.find(\n (item) =>\n item.revocationRegistryDefinitionId === identifier.rev_reg_id ||\n item.credentialDefinitionId === identifier.cred_def_id ||\n item.schemaId === identifier.schema_id\n )\n\n const requestedFrom = relatedNonRevokedRestrictionItem?.nonRevokedInterval.from\n if (requestedFrom && requestedFrom > identifier.timestamp) {\n // Check VDR if the active revocation status list at requestedFrom was the one from provided timestamp.\n // If it matches, add to the override list\n const { revocationStatusList } = await fetchRevocationStatusList(\n agentContext,\n identifier.rev_reg_id,\n requestedFrom\n )\n\n const vdrTimestamp = revocationStatusList?.timestamp\n if (vdrTimestamp && vdrTimestamp === identifier.timestamp) {\n nonRevokedIntervalOverrides.push({\n overrideRevocationStatusListTimestamp: identifier.timestamp,\n requestedFromTimestamp: requestedFrom,\n revocationRegistryDefinitionId: identifier.rev_reg_id,\n })\n } else {\n agentContext.config.logger.debug(\n `VDR timestamp for ${requestedFrom} does not correspond to the one provided in proof identifiers. Expected: ${identifier.timestamp} and received ${vdrTimestamp}`\n )\n return { verified: false }\n }\n }\n }\n\n return {\n verified: true,\n nonRevokedIntervalOverrides: nonRevokedIntervalOverrides.length ? nonRevokedIntervalOverrides : undefined,\n }\n }\n\n private getRevocationMetadataForCredentials = async (\n agentContext: AgentContext,\n credentialsWithMetadata: CredentialWithRevocationMetadata[]\n ) => {\n const revocationMetadataFetchPromises = credentialsWithMetadata\n .filter((cwm) => cwm.nonRevoked)\n .map(async (credentialWithMetadata) => {\n const w3cJsonLdVerifiableCredential = JsonTransformer.toJSON(credentialWithMetadata.credential)\n const { revocationRegistryIndex, revocationRegistryId, timestamp } =\n AnonCredsW3cCredential.fromJson(w3cJsonLdVerifiableCredential)\n\n return await getRevocationMetadata(agentContext, {\n nonRevokedInterval: credentialWithMetadata.nonRevoked as AnonCredsNonRevokedInterval,\n timestamp: timestamp,\n revocationRegistryId,\n revocationRegistryIndex,\n })\n })\n\n return await Promise.all(revocationMetadataFetchPromises)\n }\n\n public async verifyW3cPresentation(agentContext: AgentContext, options: VerifyW3cPresentationOptions) {\n const revocationMetadata = await this.getRevocationMetadataForCredentials(\n agentContext,\n options.credentialsWithRevocationMetadata\n )\n\n const revocationRegistryDefinitions: Record<string, RevocationRegistryDefinition> = {}\n for (const rm of revocationMetadata) {\n revocationRegistryDefinitions[rm.revocationRegistryId] = rm.revocationRegistryDefinition\n }\n\n const verificationOptions: VerifyAnonCredsW3cPresentationOptions = {\n presentationRequest: options.proofRequest as unknown as JsonObject,\n schemas: options.schemas as unknown as Record<string, JsonObject>,\n credentialDefinitions: options.credentialDefinitions as unknown as Record<string, JsonObject>,\n revocationRegistryDefinitions,\n revocationStatusLists: revocationMetadata.map((rm) => rm.revocationStatusList),\n nonRevokedIntervalOverrides: revocationMetadata\n .filter((rm) => rm.nonRevokedIntervalOverride)\n .map((rm) => rm.nonRevokedIntervalOverride as NonRevokedIntervalOverride),\n }\n\n let result = false\n const presentationJson = JsonTransformer.toJSON(options.presentation)\n if ('presentation_submission' in presentationJson) presentationJson.presentation_submission = undefined\n\n let w3cPresentation: W3cPresentation | undefined\n try {\n w3cPresentation = W3cPresentation.fromJson(presentationJson)\n result = w3cPresentation.verify(verificationOptions)\n } finally {\n w3cPresentation?.handle.clear()\n }\n return result\n }\n}\n"],"mappings":";;;;;;;;AAkBO,uCAAMA,6BAA+D;;OAiIlE,sCAAsC,OAC5C,cACA,4BACG;GACH,MAAM,kCAAkC,wBACrC,QAAQ,QAAQ,IAAI,WAAW,CAC/B,IAAI,OAAO,2BAA2B;IACrC,MAAM,gCAAgC,gBAAgB,OAAO,uBAAuB,WAAW;IAC/F,MAAM,EAAE,yBAAyB,sBAAsB,cACrDC,gBAAuB,SAAS,8BAA8B;AAEhE,WAAO,MAAM,sBAAsB,cAAc;KAC/C,oBAAoB,uBAAuB;KAChC;KACX;KACA;KACD,CAAC;KACF;AAEJ,UAAO,MAAM,QAAQ,IAAI,gCAAgC;;;CAnJ3D,MAAa,YAAY,cAA4B,SAA+C;EAClG,MAAM,EAAE,uBAAuB,OAAO,cAAc,sBAAsB,YAAY;EAEtF,IAAIC;AACJ,MAAI;GAGF,MAAM,EAAE,UAAU,gCAAgC,MAAM,KAAK,iBAAiB,cAAc,OAAO,aAAa;AAGhH,OAAI,CAAC,UAAU;AACb,iBAAa,OAAO,OAAO,MAAM,8CAA8C;AAC/E,WAAO;;AAGT,kBAAe,aAAa,SAAS,MAA+B;GAEpE,MAAMC,0BAAsD,EAAE;AAC9D,QAAK,MAAM,aAAa,sBACtB,yBAAwB,aAAa,sBAAsB;GAG7D,MAAMC,YAAwC,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C/B,uCAAuC,WAAW;KAClD,wBAAwB;KACxB,gCAAgC,WAAW;KAC5C,CAAC;SACG;AACL,kBAAa,OAAO,OAAO,MACzB,qBAAqB,cAAc,2EAA2E,WAAW,UAAU,gBAAgB,eACpJ;AACD,YAAO,EAAE,UAAU,OAAO;;;;AAKhC,SAAO;GACL,UAAU;GACV,6BAA6B,4BAA4B,SAAS,8BAA8B;GACjG;;CAyBH,MAAa,sBAAsB,cAA4B,SAAuC;EACpG,MAAM,qBAAqB,MAAM,KAAK,oCACpC,cACA,QAAQ,kCACT;EAED,MAAMC,gCAA8E,EAAE;AACtF,OAAK,MAAM,MAAM,mBACf,+BAA8B,GAAG,wBAAwB,GAAG;EAG9D,MAAMC,sBAA6D;GACjE,qBAAqB,QAAQ;GAC7B,SAAS,QAAQ;GACjB,uBAAuB,QAAQ;GAC/B;GACA,uBAAuB,mBAAmB,KAAK,OAAO,GAAG,qBAAqB;GAC9E,6BAA6B,mBAC1B,QAAQ,OAAO,GAAG,2BAA2B,CAC7C,KAAK,OAAO,GAAG,2BAAyD;GAC5E;EAED,IAAI,SAAS;EACb,MAAM,mBAAmB,gBAAgB,OAAO,QAAQ,aAAa;AACrE,MAAI,6BAA6B,iBAAkB,kBAAiB,0BAA0B;EAE9F,IAAIC;AACJ,MAAI;AACF,qBAAkB,gBAAgB,SAAS,iBAAiB;AAC5D,YAAS,gBAAgB,OAAO,oBAAoB;YAC5C;AACR,oBAAiB,OAAO,OAAO;;AAEjC,SAAO;;;yCAzLV,YAAY"}
@@ -1,7 +1,7 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
2
  const require_AnonCredsModuleConfig = require('../AnonCredsModuleConfig.js');
3
- const require_revocationInterval = require('../utils/revocationInterval.js');
4
3
  const require_anonCredsObjects = require('../utils/anonCredsObjects.js');
4
+ const require_revocationInterval = require('../utils/revocationInterval.js');
5
5
  require('../utils/index.js');
6
6
  let __credo_ts_core = require("@credo-ts/core");
7
7
  __credo_ts_core = require_rolldown_runtime.__toESM(__credo_ts_core);
@@ -1,6 +1,6 @@
1
1
  import { AnonCredsModuleConfig } from "../AnonCredsModuleConfig.mjs";
2
- import { assertBestPracticeRevocationInterval } from "../utils/revocationInterval.mjs";
3
2
  import { fetchRevocationRegistryDefinition, fetchRevocationStatusList } from "../utils/anonCredsObjects.mjs";
3
+ import { assertBestPracticeRevocationInterval } from "../utils/revocationInterval.mjs";
4
4
  import "../utils/index.mjs";
5
5
  import { CredoError, JsonTransformer } from "@credo-ts/core";
6
6
  import { CredentialRevocationState, RevocationRegistryDefinition, RevocationStatusList, W3cCredential as W3cCredential$1 } from "@hyperledger/anoncreds-shared";
@@ -1 +1 @@
1
- {"version":3,"file":"utils.mjs","names":["nonRevokedIntervalOverride: NonRevokedIntervalOverride | undefined","AnonCredsW3cCredential"],"sources":["../../src/anoncreds-rs/utils.ts"],"sourcesContent":["import type { AgentContext, JsonObject, W3cJsonLdVerifiableCredential } from '@credo-ts/core'\nimport type { NonRevokedIntervalOverride } from '@hyperledger/anoncreds-shared'\nimport type { AnonCredsNonRevokedInterval } from '../models'\n\nimport { CredoError, JsonTransformer } from '@credo-ts/core'\nimport {\n W3cCredential as AnonCredsW3cCredential,\n CredentialRevocationState,\n RevocationRegistryDefinition,\n RevocationStatusList,\n} from '@hyperledger/anoncreds-shared'\n\nimport { AnonCredsModuleConfig } from '../AnonCredsModuleConfig'\nimport {\n assertBestPracticeRevocationInterval,\n fetchRevocationRegistryDefinition,\n fetchRevocationStatusList,\n} from '../utils'\n\nexport interface CredentialRevocationMetadata {\n timestamp?: number\n revocationRegistryId: string\n revocationRegistryIndex?: number\n nonRevokedInterval: AnonCredsNonRevokedInterval\n}\n\nexport async function getRevocationMetadata(\n agentContext: AgentContext,\n credentialRevocationMetadata: CredentialRevocationMetadata,\n mustHaveTimeStamp = false\n) {\n let nonRevokedIntervalOverride: NonRevokedIntervalOverride | undefined\n\n const { revocationRegistryId, revocationRegistryIndex, nonRevokedInterval, timestamp } = credentialRevocationMetadata\n if (!revocationRegistryId || !nonRevokedInterval || (mustHaveTimeStamp && !timestamp)) {\n throw new CredoError('Invalid revocation metadata')\n }\n\n // Make sure the revocation interval follows best practices from Aries RFC 0441\n assertBestPracticeRevocationInterval(nonRevokedInterval)\n\n const { revocationRegistryDefinition: anonCredsRevocationRegistryDefinition } =\n await fetchRevocationRegistryDefinition(agentContext, revocationRegistryId)\n\n const tailsFileService = agentContext.dependencyManager.resolve(AnonCredsModuleConfig).tailsFileService\n const { tailsFilePath } = await tailsFileService.getTailsFile(agentContext, {\n revocationRegistryDefinition: anonCredsRevocationRegistryDefinition,\n })\n\n const timestampToFetch = timestamp ?? nonRevokedInterval.to\n if (!timestampToFetch) throw new CredoError('Timestamp to fetch is required')\n\n const { revocationStatusList: _revocationStatusList } = await fetchRevocationStatusList(\n agentContext,\n revocationRegistryId,\n timestampToFetch\n )\n const updatedTimestamp = timestamp ?? _revocationStatusList.timestamp\n\n const revocationRegistryDefinition = RevocationRegistryDefinition.fromJson(\n anonCredsRevocationRegistryDefinition as unknown as JsonObject\n )\n\n const revocationStatusList = RevocationStatusList.fromJson(_revocationStatusList as unknown as JsonObject)\n const revocationState = revocationRegistryIndex\n ? CredentialRevocationState.create({\n revocationRegistryIndex: Number(revocationRegistryIndex),\n revocationRegistryDefinition: revocationRegistryDefinition,\n tailsPath: tailsFilePath,\n revocationStatusList,\n })\n : undefined\n\n const requestedFrom = nonRevokedInterval.from\n if (requestedFrom && requestedFrom > timestampToFetch) {\n const { revocationStatusList: overrideRevocationStatusList } = await fetchRevocationStatusList(\n agentContext,\n revocationRegistryId,\n requestedFrom\n )\n\n const vdrTimestamp = overrideRevocationStatusList?.timestamp\n if (vdrTimestamp && vdrTimestamp === timestampToFetch) {\n nonRevokedIntervalOverride = {\n overrideRevocationStatusListTimestamp: timestampToFetch,\n requestedFromTimestamp: requestedFrom,\n revocationRegistryDefinitionId: revocationRegistryId,\n }\n } else {\n throw new CredoError(\n `VDR timestamp for ${requestedFrom} does not correspond to the one provided in proof identifiers. Expected: ${updatedTimestamp} and received ${vdrTimestamp}`\n )\n }\n }\n\n return {\n updatedTimestamp,\n revocationRegistryId,\n revocationRegistryDefinition,\n revocationStatusList,\n nonRevokedIntervalOverride,\n revocationState,\n }\n}\n\nexport const getW3cAnonCredsCredentialMetadata = (w3cJsonLdVerifiableCredential: W3cJsonLdVerifiableCredential) => {\n const w3cJsonLdVerifiableCredentialJson = JsonTransformer.toJSON(w3cJsonLdVerifiableCredential)\n\n const { schemaId, credentialDefinitionId, revocationRegistryId } = AnonCredsW3cCredential.fromJson(\n w3cJsonLdVerifiableCredentialJson\n )\n\n return {\n schemaId,\n credentialDefinitionId,\n revocationRegistryId,\n }\n}\n"],"mappings":";;;;;;;;AA0BA,eAAsB,sBACpB,cACA,8BACA,oBAAoB,OACpB;CACA,IAAIA;CAEJ,MAAM,EAAE,sBAAsB,yBAAyB,oBAAoB,cAAc;AACzF,KAAI,CAAC,wBAAwB,CAAC,sBAAuB,qBAAqB,CAAC,UACzE,OAAM,IAAI,WAAW,8BAA8B;AAIrD,sCAAqC,mBAAmB;CAExD,MAAM,EAAE,8BAA8B,0CACpC,MAAM,kCAAkC,cAAc,qBAAqB;CAG7E,MAAM,EAAE,kBAAkB,MADD,aAAa,kBAAkB,QAAQ,sBAAsB,CAAC,iBACtC,aAAa,cAAc,EAC1E,8BAA8B,uCAC/B,CAAC;CAEF,MAAM,mBAAmB,aAAa,mBAAmB;AACzD,KAAI,CAAC,iBAAkB,OAAM,IAAI,WAAW,iCAAiC;CAE7E,MAAM,EAAE,sBAAsB,0BAA0B,MAAM,0BAC5D,cACA,sBACA,iBACD;CACD,MAAM,mBAAmB,aAAa,sBAAsB;CAE5D,MAAM,+BAA+B,6BAA6B,SAChE,sCACD;CAED,MAAM,uBAAuB,qBAAqB,SAAS,sBAA+C;CAC1G,MAAM,kBAAkB,0BACpB,0BAA0B,OAAO;EAC/B,yBAAyB,OAAO,wBAAwB;EAC1B;EAC9B,WAAW;EACX;EACD,CAAC,GACF;CAEJ,MAAM,gBAAgB,mBAAmB;AACzC,KAAI,iBAAiB,gBAAgB,kBAAkB;EACrD,MAAM,EAAE,sBAAsB,iCAAiC,MAAM,0BACnE,cACA,sBACA,cACD;EAED,MAAM,eAAe,8BAA8B;AACnD,MAAI,gBAAgB,iBAAiB,iBACnC,8BAA6B;GAC3B,uCAAuC;GACvC,wBAAwB;GACxB,gCAAgC;GACjC;MAED,OAAM,IAAI,WACR,qBAAqB,cAAc,2EAA2E,iBAAiB,gBAAgB,eAChJ;;AAIL,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACD;;AAGH,MAAa,qCAAqC,kCAAiE;CACjH,MAAM,oCAAoC,gBAAgB,OAAO,8BAA8B;CAE/F,MAAM,EAAE,UAAU,wBAAwB,yBAAyBC,gBAAuB,SACxF,kCACD;AAED,QAAO;EACL;EACA;EACA;EACD"}
1
+ {"version":3,"file":"utils.mjs","names":["nonRevokedIntervalOverride: NonRevokedIntervalOverride | undefined","AnonCredsW3cCredential"],"sources":["../../src/anoncreds-rs/utils.ts"],"sourcesContent":["import type { AgentContext, JsonObject, W3cJsonLdVerifiableCredential } from '@credo-ts/core'\nimport { CredoError, JsonTransformer } from '@credo-ts/core'\nimport type { NonRevokedIntervalOverride } from '@hyperledger/anoncreds-shared'\nimport {\n W3cCredential as AnonCredsW3cCredential,\n CredentialRevocationState,\n RevocationRegistryDefinition,\n RevocationStatusList,\n} from '@hyperledger/anoncreds-shared'\nimport { AnonCredsModuleConfig } from '../AnonCredsModuleConfig'\nimport type { AnonCredsNonRevokedInterval } from '../models'\nimport {\n assertBestPracticeRevocationInterval,\n fetchRevocationRegistryDefinition,\n fetchRevocationStatusList,\n} from '../utils'\n\nexport interface CredentialRevocationMetadata {\n timestamp?: number\n revocationRegistryId: string\n revocationRegistryIndex?: number\n nonRevokedInterval: AnonCredsNonRevokedInterval\n}\n\nexport async function getRevocationMetadata(\n agentContext: AgentContext,\n credentialRevocationMetadata: CredentialRevocationMetadata,\n mustHaveTimeStamp = false\n) {\n let nonRevokedIntervalOverride: NonRevokedIntervalOverride | undefined\n\n const { revocationRegistryId, revocationRegistryIndex, nonRevokedInterval, timestamp } = credentialRevocationMetadata\n if (!revocationRegistryId || !nonRevokedInterval || (mustHaveTimeStamp && !timestamp)) {\n throw new CredoError('Invalid revocation metadata')\n }\n\n // Make sure the revocation interval follows best practices from Aries RFC 0441\n assertBestPracticeRevocationInterval(nonRevokedInterval)\n\n const { revocationRegistryDefinition: anonCredsRevocationRegistryDefinition } =\n await fetchRevocationRegistryDefinition(agentContext, revocationRegistryId)\n\n const tailsFileService = agentContext.dependencyManager.resolve(AnonCredsModuleConfig).tailsFileService\n const { tailsFilePath } = await tailsFileService.getTailsFile(agentContext, {\n revocationRegistryDefinition: anonCredsRevocationRegistryDefinition,\n })\n\n const timestampToFetch = timestamp ?? nonRevokedInterval.to\n if (!timestampToFetch) throw new CredoError('Timestamp to fetch is required')\n\n const { revocationStatusList: _revocationStatusList } = await fetchRevocationStatusList(\n agentContext,\n revocationRegistryId,\n timestampToFetch\n )\n const updatedTimestamp = timestamp ?? _revocationStatusList.timestamp\n\n const revocationRegistryDefinition = RevocationRegistryDefinition.fromJson(\n anonCredsRevocationRegistryDefinition as unknown as JsonObject\n )\n\n const revocationStatusList = RevocationStatusList.fromJson(_revocationStatusList as unknown as JsonObject)\n const revocationState = revocationRegistryIndex\n ? CredentialRevocationState.create({\n revocationRegistryIndex: Number(revocationRegistryIndex),\n revocationRegistryDefinition: revocationRegistryDefinition,\n tailsPath: tailsFilePath,\n revocationStatusList,\n })\n : undefined\n\n const requestedFrom = nonRevokedInterval.from\n if (requestedFrom && requestedFrom > timestampToFetch) {\n const { revocationStatusList: overrideRevocationStatusList } = await fetchRevocationStatusList(\n agentContext,\n revocationRegistryId,\n requestedFrom\n )\n\n const vdrTimestamp = overrideRevocationStatusList?.timestamp\n if (vdrTimestamp && vdrTimestamp === timestampToFetch) {\n nonRevokedIntervalOverride = {\n overrideRevocationStatusListTimestamp: timestampToFetch,\n requestedFromTimestamp: requestedFrom,\n revocationRegistryDefinitionId: revocationRegistryId,\n }\n } else {\n throw new CredoError(\n `VDR timestamp for ${requestedFrom} does not correspond to the one provided in proof identifiers. Expected: ${updatedTimestamp} and received ${vdrTimestamp}`\n )\n }\n }\n\n return {\n updatedTimestamp,\n revocationRegistryId,\n revocationRegistryDefinition,\n revocationStatusList,\n nonRevokedIntervalOverride,\n revocationState,\n }\n}\n\nexport const getW3cAnonCredsCredentialMetadata = (w3cJsonLdVerifiableCredential: W3cJsonLdVerifiableCredential) => {\n const w3cJsonLdVerifiableCredentialJson = JsonTransformer.toJSON(w3cJsonLdVerifiableCredential)\n\n const { schemaId, credentialDefinitionId, revocationRegistryId } = AnonCredsW3cCredential.fromJson(\n w3cJsonLdVerifiableCredentialJson\n )\n\n return {\n schemaId,\n credentialDefinitionId,\n revocationRegistryId,\n }\n}\n"],"mappings":";;;;;;;;AAwBA,eAAsB,sBACpB,cACA,8BACA,oBAAoB,OACpB;CACA,IAAIA;CAEJ,MAAM,EAAE,sBAAsB,yBAAyB,oBAAoB,cAAc;AACzF,KAAI,CAAC,wBAAwB,CAAC,sBAAuB,qBAAqB,CAAC,UACzE,OAAM,IAAI,WAAW,8BAA8B;AAIrD,sCAAqC,mBAAmB;CAExD,MAAM,EAAE,8BAA8B,0CACpC,MAAM,kCAAkC,cAAc,qBAAqB;CAG7E,MAAM,EAAE,kBAAkB,MADD,aAAa,kBAAkB,QAAQ,sBAAsB,CAAC,iBACtC,aAAa,cAAc,EAC1E,8BAA8B,uCAC/B,CAAC;CAEF,MAAM,mBAAmB,aAAa,mBAAmB;AACzD,KAAI,CAAC,iBAAkB,OAAM,IAAI,WAAW,iCAAiC;CAE7E,MAAM,EAAE,sBAAsB,0BAA0B,MAAM,0BAC5D,cACA,sBACA,iBACD;CACD,MAAM,mBAAmB,aAAa,sBAAsB;CAE5D,MAAM,+BAA+B,6BAA6B,SAChE,sCACD;CAED,MAAM,uBAAuB,qBAAqB,SAAS,sBAA+C;CAC1G,MAAM,kBAAkB,0BACpB,0BAA0B,OAAO;EAC/B,yBAAyB,OAAO,wBAAwB;EAC1B;EAC9B,WAAW;EACX;EACD,CAAC,GACF;CAEJ,MAAM,gBAAgB,mBAAmB;AACzC,KAAI,iBAAiB,gBAAgB,kBAAkB;EACrD,MAAM,EAAE,sBAAsB,iCAAiC,MAAM,0BACnE,cACA,sBACA,cACD;EAED,MAAM,eAAe,8BAA8B;AACnD,MAAI,gBAAgB,iBAAiB,iBACnC,8BAA6B;GAC3B,uCAAuC;GACvC,wBAAwB;GACxB,gCAAgC;GACjC;MAED,OAAM,IAAI,WACR,qBAAqB,cAAc,2EAA2E,iBAAiB,gBAAgB,eAChJ;;AAIL,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACD;;AAGH,MAAa,qCAAqC,kCAAiE;CACjH,MAAM,oCAAoC,gBAAgB,OAAO,8BAA8B;CAE/F,MAAM,EAAE,UAAU,wBAAwB,yBAAyBC,gBAAuB,SACxF,kCACD;AAED,QAAO;EACL;EACA;EACA;EACD"}
@@ -1,3 +1,3 @@
1
1
  const require_AnonCredsError = require('./AnonCredsError.js');
2
- const require_AnonCredsStoreRecordError = require('./AnonCredsStoreRecordError.js');
3
2
  const require_AnonCredsRsError = require('./AnonCredsRsError.js');
3
+ const require_AnonCredsStoreRecordError = require('./AnonCredsStoreRecordError.js');
@@ -1,3 +1,3 @@
1
1
  import { AnonCredsError } from "./AnonCredsError.mjs";
2
- import { AnonCredsStoreRecordError } from "./AnonCredsStoreRecordError.mjs";
3
2
  import { AnonCredsRsError } from "./AnonCredsRsError.mjs";
3
+ import { AnonCredsStoreRecordError } from "./AnonCredsStoreRecordError.mjs";
@@ -1 +1 @@
1
- {"version":3,"file":"AnonCredsDidCommCredentialFormatService.d.mts","names":[],"sources":["../../src/formats/AnonCredsDidCommCredentialFormatService.ts"],"sourcesContent":[],"mappings":";;;;;cAuEa,uCAAA,Y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A,MAAA,CAAA,EAuKgC,iBAvKhC"}
@@ -1 +1 @@
1
- {"version":3,"file":"AnonCredsDidCommCredentialFormatService.d.ts","names":[],"sources":["../../src/formats/AnonCredsDidCommCredentialFormatService.ts"],"sourcesContent":[],"mappings":";;;;;cAuEa,uCAAA,YACA,+BAA+B;EAD/B;EACX,SAAA,SAAA,EAAA,WAAA;;;;;WAuBkD,oBAAA,EAAA,KAAA;;;;;;;;gBAiDlC,CAAA,aAAA,EArDC,YAqDD,EAAA;IAAA,iBAAA;IAAA;EAAA,CAAA,EAjDX,4CAiDW,CAjDkC,gCAiDlC,CAAA,CAAA,EAhDb,OAgDa,CAhDL,2CAgDK,CAAA;iBAEZ,CAAA,aAAA,EAXa,YAWb,EAAA;IAAA;EAAA,CAAA,EAVc,qCAUd,CAAA,EATD,OASC,CAAA,IAAA,CAAA;gBACA,CAAA,YAAA,EAHY,YAGZ,EAAA;IAAA,YAAA;IAAA,iBAAA;IAAA,wBAAA;IAAA;EAAA,CAAA,EAGC,4CAHD,CAG8C,gCAH9C,CAAA,CAAA,EAID,OAJC,CAIO,wCAJP,CAAA;;;;;;;;aA2CA,CAAA,YAAA,EAFY,YAEZ,EAAA;IAAA,iBAAA;IAAA,wBAAA;IAAA;EAAA,CAAA,EAGC,yCAHD,CAG2C,gCAH3C,CAAA,CAAA,EAID,OAJC,CAIO,wCAJP,CAAA;cACA,CAAA,YAAA,EAwBY,YAxBZ,EAAA;IAAA,UAAA;IAAA;EAAA,CAAA,EAyBwC,qCAzBxC,CAAA,EAyB6E,OAzB7E,CAAA,IAAA,CAAA;aACA,CAAA,YAAA,EAwCY,YAxCZ,EAAA;IAAA,wBAAA;IAAA,YAAA;IAAA,eAAA;IAAA;EAAA,CAAA,EA8CC,yCA9CD,CA8C2C,gCA9C3C,CAAA,CAAA,EA+CD,OA/CC,CA+CO,mCA/CP,CAAA;;;;eAED,CAAA,CAAA,EAgF2B,OAhF3B,CAgFmC,mCAhFnC,CAAA;;;;gBAsByC,C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;IAAA;EAAA,CAAA,EA6PA,mDA7PA,CAAA,EA6PmD,OA7PnD,CAAA,OAAA,CAAA;UACM,oBAAA;UAAR,4CAAA;;;;;;;;UAoMA,8BAAA;;;;;;;;eA4Bc,CAAA,IAAA,EAAA,OAAA,EAAA,EAAA,EAAA,MAAA,CAAA,EAuKgC,iBAvKhC"}
@@ -1,18 +1,18 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
- const require_AnonCredsHolderService = require('../services/AnonCredsHolderService.js');
3
- const require_AnonCredsIssuerService = require('../services/AnonCredsIssuerService.js');
4
- require('../services/index.js');
5
2
  const require_AnonCredsCredentialDefinitionRepository = require('../repository/AnonCredsCredentialDefinitionRepository.js');
6
3
  const require_AnonCredsRevocationRegistryDefinitionPrivateRecord = require('../repository/AnonCredsRevocationRegistryDefinitionPrivateRecord.js');
7
4
  const require_AnonCredsRevocationRegistryDefinitionPrivateRepository = require('../repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.js');
8
5
  require('../repository/index.js');
9
- const require_AnonCredsCredentialProposal = require('../models/AnonCredsCredentialProposal.js');
6
+ const require_AnonCredsHolderService = require('../services/AnonCredsHolderService.js');
7
+ const require_AnonCredsIssuerService = require('../services/AnonCredsIssuerService.js');
8
+ require('../services/index.js');
9
+ const require_anonCredsObjects = require('../utils/anonCredsObjects.js');
10
10
  const require_credential = require('../utils/credential.js');
11
11
  const require_timestamp = require('../utils/timestamp.js');
12
- const require_anonCredsObjects = require('../utils/anonCredsObjects.js');
13
12
  const require_metadata = require('../utils/metadata.js');
14
13
  const require_w3cAnonCredsUtils = require('../utils/w3cAnonCredsUtils.js');
15
14
  require('../utils/index.js');
15
+ const require_AnonCredsCredentialProposal = require('../models/AnonCredsCredentialProposal.js');
16
16
  let __credo_ts_core = require("@credo-ts/core");
17
17
  __credo_ts_core = require_rolldown_runtime.__toESM(__credo_ts_core);
18
18
  let __credo_ts_didcomm = require("@credo-ts/didcomm");
@@ -1,17 +1,17 @@
1
- import { AnonCredsHolderServiceSymbol } from "../services/AnonCredsHolderService.mjs";
2
- import { AnonCredsIssuerServiceSymbol } from "../services/AnonCredsIssuerService.mjs";
3
- import "../services/index.mjs";
4
1
  import { AnonCredsCredentialDefinitionRepository } from "../repository/AnonCredsCredentialDefinitionRepository.mjs";
5
2
  import { AnonCredsRevocationRegistryState } from "../repository/AnonCredsRevocationRegistryDefinitionPrivateRecord.mjs";
6
3
  import { AnonCredsRevocationRegistryDefinitionPrivateRepository } from "../repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.mjs";
7
4
  import "../repository/index.mjs";
8
- import { AnonCredsCredentialProposal } from "../models/AnonCredsCredentialProposal.mjs";
5
+ import { AnonCredsHolderServiceSymbol } from "../services/AnonCredsHolderService.mjs";
6
+ import { AnonCredsIssuerServiceSymbol } from "../services/AnonCredsIssuerService.mjs";
7
+ import "../services/index.mjs";
8
+ import { fetchCredentialDefinition, fetchRevocationRegistryDefinition, fetchRevocationStatusList, fetchSchema } from "../utils/anonCredsObjects.mjs";
9
9
  import { assertAttributesMatch, assertCredentialValuesMatch, checkCredentialValuesMatch, convertAttributesToCredentialValues, createAndLinkAttachmentsToPreview } from "../utils/credential.mjs";
10
10
  import { dateToTimestamp } from "../utils/timestamp.mjs";
11
- import { fetchCredentialDefinition, fetchRevocationRegistryDefinition, fetchRevocationStatusList, fetchSchema } from "../utils/anonCredsObjects.mjs";
12
11
  import { AnonCredsCredentialMetadataKey, AnonCredsCredentialRequestMetadataKey } from "../utils/metadata.mjs";
13
12
  import { getStoreCredentialOptions } from "../utils/w3cAnonCredsUtils.mjs";
14
13
  import "../utils/index.mjs";
14
+ import { AnonCredsCredentialProposal } from "../models/AnonCredsCredentialProposal.mjs";
15
15
  import { CredoError, JsonEncoder, JsonTransformer, MessageValidator, utils } from "@credo-ts/core";
16
16
  import { DidCommAttachment, DidCommCredentialFormatSpec, DidCommCredentialProblemReportReason, DidCommProblemReportError } from "@credo-ts/didcomm";
17
17
 
@@ -1 +1 @@
1
- {"version":3,"file":"AnonCredsDidCommCredentialFormatService.mjs","names":["revocationRegistryDefinitionId: string | undefined","revocationRegistryIndex: number | undefined","revocationStatusList: AnonCredsRevocationStatusList | undefined","attachments: DidCommAttachment[] | undefined"],"sources":["../../src/formats/AnonCredsDidCommCredentialFormatService.ts"],"sourcesContent":["import type { AgentContext } from '@credo-ts/core'\nimport type {\n DidCommCredentialExchangeRecord,\n DidCommCredentialFormatAcceptOfferOptions,\n DidCommCredentialFormatAcceptProposalOptions,\n DidCommCredentialFormatAcceptRequestOptions,\n DidCommCredentialFormatAutoRespondCredentialOptions,\n DidCommCredentialFormatAutoRespondOfferOptions,\n DidCommCredentialFormatAutoRespondProposalOptions,\n DidCommCredentialFormatAutoRespondRequestOptions,\n DidCommCredentialFormatCreateOfferOptions,\n DidCommCredentialFormatCreateOfferReturn,\n DidCommCredentialFormatCreateProposalOptions,\n DidCommCredentialFormatCreateProposalReturn,\n DidCommCredentialFormatCreateReturn,\n DidCommCredentialFormatProcessCredentialOptions,\n DidCommCredentialFormatProcessOptions,\n DidCommCredentialFormatService,\n DidCommCredentialPreviewAttributeOptions,\n DidCommLinkedAttachment,\n} from '@credo-ts/didcomm'\nimport type {\n AnonCredsCredential,\n AnonCredsCredentialOffer,\n AnonCredsCredentialRequest,\n AnonCredsRevocationStatusList,\n} from '../models'\nimport type { AnonCredsHolderService, AnonCredsIssuerService } from '../services'\nimport type { AnonCredsCredentialMetadata, AnonCredsCredentialRequestMetadata } from '../utils/metadata'\nimport type {\n AnonCredsDidCommCredentialFormat,\n AnonCredsDidCommCredentialProposalFormat,\n} from './AnonCredsDidCommCredentialFormat'\n\nimport { CredoError, JsonEncoder, JsonTransformer, MessageValidator, utils } from '@credo-ts/core'\nimport {\n DidCommAttachment,\n DidCommCredentialFormatSpec,\n DidCommCredentialProblemReportReason,\n DidCommProblemReportError,\n} from '@credo-ts/didcomm'\n\nimport { AnonCredsCredentialProposal } from '../models/AnonCredsCredentialProposal'\nimport {\n AnonCredsCredentialDefinitionRepository,\n AnonCredsRevocationRegistryDefinitionPrivateRepository,\n AnonCredsRevocationRegistryState,\n} from '../repository'\nimport { AnonCredsHolderServiceSymbol, AnonCredsIssuerServiceSymbol } from '../services'\nimport {\n dateToTimestamp,\n fetchCredentialDefinition,\n fetchRevocationRegistryDefinition,\n fetchRevocationStatusList,\n fetchSchema,\n} from '../utils'\nimport {\n assertAttributesMatch,\n assertCredentialValuesMatch,\n checkCredentialValuesMatch,\n convertAttributesToCredentialValues,\n createAndLinkAttachmentsToPreview,\n} from '../utils/credential'\nimport { AnonCredsCredentialMetadataKey, AnonCredsCredentialRequestMetadataKey } from '../utils/metadata'\nimport { getStoreCredentialOptions } from '../utils/w3cAnonCredsUtils'\n\nconst ANONCREDS_CREDENTIAL_OFFER = 'anoncreds/credential-offer@v1.0'\nconst ANONCREDS_CREDENTIAL_REQUEST = 'anoncreds/credential-request@v1.0'\nconst ANONCREDS_CREDENTIAL_FILTER = 'anoncreds/credential-filter@v1.0'\nconst ANONCREDS_CREDENTIAL = 'anoncreds/credential@v1.0'\n\nexport class AnonCredsDidCommCredentialFormatService\n implements DidCommCredentialFormatService<AnonCredsDidCommCredentialFormat>\n{\n /** formatKey is the key used when calling agent.credentials.xxx with credentialFormats.anoncreds */\n public readonly formatKey = 'anoncreds' as const\n\n /**\n * credentialRecordType is the type of record that stores the credential. It is stored in the credential\n * record binding in the credential exchange record.\n */\n public readonly credentialRecordType = 'w3c' as const\n\n /**\n * Create a {@link AttachmentFormats} object dependent on the message type.\n *\n * @param options The object containing all the options for the proposed credential\n * @returns object containing associated attachment, format and optionally the credential preview\n *\n */\n public async createProposal(\n _agentContext: AgentContext,\n {\n credentialFormats,\n credentialExchangeRecord,\n }: DidCommCredentialFormatCreateProposalOptions<AnonCredsDidCommCredentialFormat>\n ): Promise<DidCommCredentialFormatCreateProposalReturn> {\n const format = new DidCommCredentialFormatSpec({\n format: ANONCREDS_CREDENTIAL_FILTER,\n })\n\n const anoncredsFormat = credentialFormats.anoncreds\n\n if (!anoncredsFormat) {\n throw new CredoError('Missing anoncreds payload in createProposal')\n }\n\n // We want all properties except for `attributes` and `linkedAttachments` attributes.\n // The easiest way is to destructure and use the spread operator. But that leaves the other properties unused\n const { attributes, linkedAttachments, ...anoncredsCredentialProposal } = anoncredsFormat\n const proposal = new AnonCredsCredentialProposal(anoncredsCredentialProposal)\n\n try {\n MessageValidator.validateSync(proposal)\n } catch (_error) {\n throw new CredoError(`Invalid proposal supplied: ${anoncredsCredentialProposal} in AnonCredsFormatService`)\n }\n\n const attachment = this.getFormatData(JsonTransformer.toJSON(proposal), format.attachmentId)\n\n const { previewAttributes } = this.getCredentialLinkedAttachments(\n anoncredsFormat.attributes,\n anoncredsFormat.linkedAttachments\n )\n\n // Set the metadata\n credentialExchangeRecord.metadata.set<AnonCredsCredentialMetadata>(AnonCredsCredentialMetadataKey, {\n schemaId: proposal.schemaId,\n credentialDefinitionId: proposal.credentialDefinitionId,\n })\n\n return { format, attachment, previewAttributes }\n }\n\n public async processProposal(\n _agentContext: AgentContext,\n { attachment }: DidCommCredentialFormatProcessOptions\n ): Promise<void> {\n const proposalJson = attachment.getDataAsJson()\n\n JsonTransformer.fromJSON(proposalJson, AnonCredsCredentialProposal)\n }\n\n public async acceptProposal(\n agentContext: AgentContext,\n {\n attachmentId,\n credentialFormats,\n credentialExchangeRecord,\n proposalAttachment,\n }: DidCommCredentialFormatAcceptProposalOptions<AnonCredsDidCommCredentialFormat>\n ): Promise<DidCommCredentialFormatCreateOfferReturn> {\n const anoncredsFormat = credentialFormats?.anoncreds\n\n const proposalJson = proposalAttachment.getDataAsJson<AnonCredsDidCommCredentialProposalFormat>()\n const credentialDefinitionId = anoncredsFormat?.credentialDefinitionId ?? proposalJson.cred_def_id\n\n const attributes = anoncredsFormat?.attributes ?? credentialExchangeRecord.credentialAttributes\n\n if (!credentialDefinitionId) {\n throw new CredoError('No credential definition id in proposal or provided as input to accept proposal method.')\n }\n\n if (!attributes) {\n throw new CredoError('No attributes in proposal or provided as input to accept proposal method.')\n }\n\n const { format, attachment, previewAttributes } = await this.createAnonCredsOffer(agentContext, {\n credentialExchangeRecord,\n attachmentId,\n attributes,\n credentialDefinitionId,\n revocationRegistryDefinitionId: anoncredsFormat?.revocationRegistryDefinitionId,\n revocationRegistryIndex: anoncredsFormat?.revocationRegistryIndex,\n linkedAttachments: anoncredsFormat?.linkedAttachments,\n })\n\n return { format, attachment, previewAttributes }\n }\n\n /**\n * Create a credential attachment format for a credential request.\n *\n * @param options The object containing all the options for the credential offer\n * @returns object containing associated attachment, formats and offersAttach elements\n *\n */\n public async createOffer(\n agentContext: AgentContext,\n {\n credentialFormats,\n credentialExchangeRecord,\n attachmentId,\n }: DidCommCredentialFormatCreateOfferOptions<AnonCredsDidCommCredentialFormat>\n ): Promise<DidCommCredentialFormatCreateOfferReturn> {\n const anoncredsFormat = credentialFormats.anoncreds\n\n if (!anoncredsFormat) {\n throw new CredoError('Missing anoncreds credential format data')\n }\n\n const { format, attachment, previewAttributes } = await this.createAnonCredsOffer(agentContext, {\n credentialExchangeRecord,\n attachmentId,\n attributes: anoncredsFormat.attributes,\n credentialDefinitionId: anoncredsFormat.credentialDefinitionId,\n revocationRegistryDefinitionId: anoncredsFormat.revocationRegistryDefinitionId,\n revocationRegistryIndex: anoncredsFormat.revocationRegistryIndex,\n linkedAttachments: anoncredsFormat.linkedAttachments,\n })\n\n return { format, attachment, previewAttributes }\n }\n\n public async processOffer(\n agentContext: AgentContext,\n { attachment, credentialExchangeRecord }: DidCommCredentialFormatProcessOptions\n ) {\n agentContext.config.logger.debug(\n `Processing anoncreds credential offer for credential record ${credentialExchangeRecord.id}`\n )\n\n const credOffer = attachment.getDataAsJson<AnonCredsCredentialOffer>()\n\n if (!credOffer.schema_id || !credOffer.cred_def_id) {\n throw new DidCommProblemReportError('Invalid credential offer', {\n problemCode: DidCommCredentialProblemReportReason.IssuanceAbandoned,\n })\n }\n }\n\n public async acceptOffer(\n agentContext: AgentContext,\n {\n credentialExchangeRecord,\n attachmentId,\n offerAttachment,\n credentialFormats,\n }: DidCommCredentialFormatAcceptOfferOptions<AnonCredsDidCommCredentialFormat>\n ): Promise<DidCommCredentialFormatCreateReturn> {\n const holderService = agentContext.dependencyManager.resolve<AnonCredsHolderService>(AnonCredsHolderServiceSymbol)\n\n const credentialOffer = offerAttachment.getDataAsJson<AnonCredsCredentialOffer>()\n\n // Get credential definition\n const { credentialDefinition } = await fetchCredentialDefinition(agentContext, credentialOffer.cred_def_id)\n\n const { credentialRequest, credentialRequestMetadata } = await holderService.createCredentialRequest(agentContext, {\n credentialOffer,\n credentialDefinition,\n linkSecretId: credentialFormats?.anoncreds?.linkSecretId,\n })\n\n credentialExchangeRecord.metadata.set<AnonCredsCredentialRequestMetadata>(\n AnonCredsCredentialRequestMetadataKey,\n credentialRequestMetadata\n )\n credentialExchangeRecord.metadata.set<AnonCredsCredentialMetadata>(AnonCredsCredentialMetadataKey, {\n credentialDefinitionId: credentialOffer.cred_def_id,\n schemaId: credentialOffer.schema_id,\n })\n\n const format = new DidCommCredentialFormatSpec({\n attachmentId,\n format: ANONCREDS_CREDENTIAL_REQUEST,\n })\n\n const attachment = this.getFormatData(credentialRequest, format.attachmentId)\n return { format, attachment }\n }\n\n /**\n * Starting from a request is not supported for anoncreds credentials, this method only throws an error.\n */\n public async createRequest(): Promise<DidCommCredentialFormatCreateReturn> {\n throw new CredoError('Starting from a request is not supported for anoncreds credentials')\n }\n\n /**\n * We don't have any models to validate an anoncreds request object, for now this method does nothing\n */\n public async processRequest(\n _agentContext: AgentContext,\n _options: DidCommCredentialFormatProcessOptions\n ): Promise<void> {\n // not needed for anoncreds\n }\n\n public async acceptRequest(\n agentContext: AgentContext,\n {\n credentialExchangeRecord,\n attachmentId,\n offerAttachment,\n requestAttachment,\n }: DidCommCredentialFormatAcceptRequestOptions<AnonCredsDidCommCredentialFormat>\n ): Promise<DidCommCredentialFormatCreateReturn> {\n // Assert credential attributes\n const credentialAttributes = credentialExchangeRecord.credentialAttributes\n if (!credentialAttributes) {\n throw new CredoError(\n `Missing required credential attribute values on credential record with id ${credentialExchangeRecord.id}`\n )\n }\n\n const anonCredsIssuerService =\n agentContext.dependencyManager.resolve<AnonCredsIssuerService>(AnonCredsIssuerServiceSymbol)\n\n const credentialOffer = offerAttachment?.getDataAsJson<AnonCredsCredentialOffer>()\n if (!credentialOffer) throw new CredoError('Missing anoncreds credential offer in createCredential')\n\n const credentialRequest = requestAttachment.getDataAsJson<AnonCredsCredentialRequest>()\n if (!credentialRequest) throw new CredoError('Missing anoncreds credential request in createCredential')\n\n // We check locally for credential definition info. If it supports revocation, we need to search locally for\n // an active revocation registry\n const credentialDefinition = (\n await agentContext.dependencyManager\n .resolve(AnonCredsCredentialDefinitionRepository)\n .getByCredentialDefinitionId(agentContext, credentialRequest.cred_def_id)\n ).credentialDefinition.value\n\n let revocationRegistryDefinitionId: string | undefined\n let revocationRegistryIndex: number | undefined\n let revocationStatusList: AnonCredsRevocationStatusList | undefined\n\n if (credentialDefinition.revocation) {\n const credentialMetadata =\n credentialExchangeRecord.metadata.get<AnonCredsCredentialMetadata>(AnonCredsCredentialMetadataKey)\n revocationRegistryDefinitionId = credentialMetadata?.revocationRegistryId\n if (credentialMetadata?.credentialRevocationId) {\n revocationRegistryIndex = Number(credentialMetadata.credentialRevocationId)\n }\n\n if (!revocationRegistryDefinitionId || revocationRegistryIndex === undefined) {\n throw new CredoError(\n 'Revocation registry definition id and revocation index are mandatory to issue AnonCreds revocable credentials'\n )\n }\n const revocationRegistryDefinitionPrivateRecord = await agentContext.dependencyManager\n .resolve(AnonCredsRevocationRegistryDefinitionPrivateRepository)\n .getByRevocationRegistryDefinitionId(agentContext, revocationRegistryDefinitionId)\n\n if (revocationRegistryDefinitionPrivateRecord.state !== AnonCredsRevocationRegistryState.Active) {\n throw new CredoError(\n `Revocation registry ${revocationRegistryDefinitionId} is in ${revocationRegistryDefinitionPrivateRecord.state} state`\n )\n }\n\n const revocationStatusListResult = await fetchRevocationStatusList(\n agentContext,\n revocationRegistryDefinitionId,\n dateToTimestamp(new Date())\n )\n revocationStatusList = revocationStatusListResult.revocationStatusList\n }\n\n const { credential, credentialRevocationId } = await anonCredsIssuerService.createCredential(agentContext, {\n credentialOffer,\n credentialRequest,\n credentialValues: convertAttributesToCredentialValues(credentialAttributes),\n revocationRegistryDefinitionId,\n revocationRegistryIndex,\n revocationStatusList,\n })\n\n // If the credential is revocable, store the revocation identifiers in the credential record\n if (credential.rev_reg_id) {\n credentialExchangeRecord.metadata.add<AnonCredsCredentialMetadata>(AnonCredsCredentialMetadataKey, {\n revocationRegistryId: revocationRegistryDefinitionId ?? undefined,\n credentialRevocationId: credentialRevocationId ?? undefined,\n })\n credentialExchangeRecord.setTags({\n anonCredsRevocationRegistryId: revocationRegistryDefinitionId,\n anonCredsCredentialRevocationId: credentialRevocationId,\n })\n }\n\n const format = new DidCommCredentialFormatSpec({\n attachmentId,\n format: ANONCREDS_CREDENTIAL,\n })\n\n const attachment = this.getFormatData(credential, format.attachmentId)\n return { format, attachment }\n }\n\n /**\n * Processes an incoming credential - retrieve metadata, retrieve payload and store it in wallet\n * @param options the issue credential message wrapped inside this object\n * @param credentialExchangeRecord the credential exchange record for this credential\n */\n public async processCredential(\n agentContext: AgentContext,\n { credentialExchangeRecord, attachment }: DidCommCredentialFormatProcessCredentialOptions\n ): Promise<void> {\n const credentialRequestMetadata = credentialExchangeRecord.metadata.get<AnonCredsCredentialRequestMetadata>(\n AnonCredsCredentialRequestMetadataKey\n )\n\n const anonCredsHolderService =\n agentContext.dependencyManager.resolve<AnonCredsHolderService>(AnonCredsHolderServiceSymbol)\n\n if (!credentialRequestMetadata) {\n throw new CredoError(\n `Missing required request metadata for credential exchange with thread id with id ${credentialExchangeRecord.id}`\n )\n }\n\n if (!credentialExchangeRecord.credentialAttributes) {\n throw new CredoError('Missing credential attributes on credential record. Unable to check credential attributes')\n }\n\n const anonCredsCredential = attachment.getDataAsJson<AnonCredsCredential>()\n\n const { credentialDefinition, credentialDefinitionId } = await fetchCredentialDefinition(\n agentContext,\n anonCredsCredential.cred_def_id\n )\n const { schema, indyNamespace } = await fetchSchema(agentContext, anonCredsCredential.schema_id)\n\n // Resolve revocation registry if credential is revocable\n const revocationRegistryResult = anonCredsCredential.rev_reg_id\n ? await fetchRevocationRegistryDefinition(agentContext, anonCredsCredential.rev_reg_id)\n : undefined\n\n // assert the credential values match the offer values\n const recordCredentialValues = convertAttributesToCredentialValues(credentialExchangeRecord.credentialAttributes)\n assertCredentialValuesMatch(anonCredsCredential.values, recordCredentialValues)\n\n const storeCredentialOptions = getStoreCredentialOptions(\n {\n credentialId: utils.uuid(),\n credentialRequestMetadata,\n credential: anonCredsCredential,\n credentialDefinitionId,\n credentialDefinition,\n schema,\n revocationRegistry: revocationRegistryResult?.revocationRegistryDefinition\n ? {\n definition: revocationRegistryResult.revocationRegistryDefinition,\n id: revocationRegistryResult.revocationRegistryDefinitionId,\n }\n : undefined,\n },\n indyNamespace\n )\n\n const credentialId = await anonCredsHolderService.storeCredential(agentContext, storeCredentialOptions)\n\n // If the credential is revocable, store the revocation identifiers in the credential record\n if (anonCredsCredential.rev_reg_id) {\n const credential = await anonCredsHolderService.getCredential(agentContext, { id: credentialId })\n\n credentialExchangeRecord.metadata.add<AnonCredsCredentialMetadata>(AnonCredsCredentialMetadataKey, {\n credentialRevocationId: credential.credentialRevocationId ?? undefined,\n revocationRegistryId: credential.revocationRegistryId ?? undefined,\n })\n credentialExchangeRecord.setTags({\n anonCredsRevocationRegistryId: credential.revocationRegistryId,\n anonCredsCredentialRevocationId: credential.credentialRevocationId,\n })\n }\n\n credentialExchangeRecord.credentials.push({\n credentialRecordType: this.credentialRecordType,\n credentialRecordId: credentialId,\n })\n }\n\n public supportsFormat(format: string): boolean {\n const supportedFormats = [\n ANONCREDS_CREDENTIAL_REQUEST,\n ANONCREDS_CREDENTIAL_OFFER,\n ANONCREDS_CREDENTIAL_FILTER,\n ANONCREDS_CREDENTIAL,\n ]\n\n return supportedFormats.includes(format)\n }\n\n /**\n * Gets the attachment object for a given attachmentId. We need to get out the correct attachmentId for\n * anoncreds and then find the corresponding attachment (if there is one)\n * @param formats the formats object containing the attachmentId\n * @param messageAttachments the attachments containing the payload\n * @returns The DidCommAttachment if found or undefined\n *\n */\n public getAttachment(\n formats: DidCommCredentialFormatSpec[],\n messageAttachments: DidCommAttachment[]\n ): DidCommAttachment | undefined {\n const supportedAttachmentIds = formats.filter((f) => this.supportsFormat(f.format)).map((f) => f.attachmentId)\n const supportedAttachment = messageAttachments.find((attachment) => supportedAttachmentIds.includes(attachment.id))\n\n return supportedAttachment\n }\n\n public async deleteCredentialById(agentContext: AgentContext, credentialRecordId: string): Promise<void> {\n const anonCredsHolderService =\n agentContext.dependencyManager.resolve<AnonCredsHolderService>(AnonCredsHolderServiceSymbol)\n\n await anonCredsHolderService.deleteCredential(agentContext, credentialRecordId)\n }\n\n public async shouldAutoRespondToProposal(\n _agentContext: AgentContext,\n { offerAttachment, proposalAttachment }: DidCommCredentialFormatAutoRespondProposalOptions\n ) {\n const proposalJson = proposalAttachment.getDataAsJson<AnonCredsDidCommCredentialProposalFormat>()\n const offerJson = offerAttachment.getDataAsJson<AnonCredsCredentialOffer>()\n\n // We want to make sure the credential definition matches.\n // TODO: If no credential definition is present on the proposal, we could check whether the other fields\n // of the proposal match with the credential definition id.\n return proposalJson.cred_def_id === offerJson.cred_def_id\n }\n\n public async shouldAutoRespondToOffer(\n _agentContext: AgentContext,\n { offerAttachment, proposalAttachment }: DidCommCredentialFormatAutoRespondOfferOptions\n ) {\n const proposalJson = proposalAttachment.getDataAsJson<AnonCredsDidCommCredentialProposalFormat>()\n const offerJson = offerAttachment.getDataAsJson<AnonCredsCredentialOffer>()\n\n // We want to make sure the credential definition matches.\n // TODO: If no credential definition is present on the proposal, we could check whether the other fields\n // of the proposal match with the credential definition id.\n return proposalJson.cred_def_id === offerJson.cred_def_id\n }\n\n public async shouldAutoRespondToRequest(\n _agentContext: AgentContext,\n { offerAttachment, requestAttachment }: DidCommCredentialFormatAutoRespondRequestOptions\n ) {\n const credentialOfferJson = offerAttachment.getDataAsJson<AnonCredsCredentialOffer>()\n const credentialRequestJson = requestAttachment.getDataAsJson<AnonCredsCredentialRequest>()\n\n return credentialOfferJson.cred_def_id === credentialRequestJson.cred_def_id\n }\n\n public async shouldAutoRespondToCredential(\n _agentContext: AgentContext,\n {\n credentialExchangeRecord,\n requestAttachment,\n credentialAttachment,\n }: DidCommCredentialFormatAutoRespondCredentialOptions\n ) {\n const credentialJson = credentialAttachment.getDataAsJson<AnonCredsCredential>()\n const credentialRequestJson = requestAttachment.getDataAsJson<AnonCredsCredentialRequest>()\n\n // make sure the credential definition matches\n if (credentialJson.cred_def_id !== credentialRequestJson.cred_def_id) return false\n\n // If we don't have any attributes stored we can't compare so always return false.\n if (!credentialExchangeRecord.credentialAttributes) return false\n const attributeValues = convertAttributesToCredentialValues(credentialExchangeRecord.credentialAttributes)\n\n // check whether the values match the values in the record\n return checkCredentialValuesMatch(attributeValues, credentialJson.values)\n }\n\n private async createAnonCredsOffer(\n agentContext: AgentContext,\n {\n credentialExchangeRecord,\n attachmentId,\n credentialDefinitionId,\n revocationRegistryDefinitionId,\n revocationRegistryIndex,\n attributes,\n linkedAttachments,\n }: {\n credentialDefinitionId: string\n revocationRegistryDefinitionId?: string\n revocationRegistryIndex?: number\n credentialExchangeRecord: DidCommCredentialExchangeRecord\n attachmentId?: string\n attributes: DidCommCredentialPreviewAttributeOptions[]\n linkedAttachments?: DidCommLinkedAttachment[]\n }\n ): Promise<DidCommCredentialFormatCreateOfferReturn> {\n const anonCredsIssuerService =\n agentContext.dependencyManager.resolve<AnonCredsIssuerService>(AnonCredsIssuerServiceSymbol)\n\n // if the proposal has an attachment Id use that, otherwise the generated id of the formats object\n const format = new DidCommCredentialFormatSpec({\n attachmentId: attachmentId,\n format: ANONCREDS_CREDENTIAL_OFFER,\n })\n\n const offer = await anonCredsIssuerService.createCredentialOffer(agentContext, {\n credentialDefinitionId,\n })\n\n const { previewAttributes } = this.getCredentialLinkedAttachments(attributes, linkedAttachments)\n if (!previewAttributes) {\n throw new CredoError('Missing required preview attributes for anoncreds offer')\n }\n\n await this.assertPreviewAttributesMatchSchemaAttributes(agentContext, offer, previewAttributes)\n\n // We check locally for credential definition info. If it supports revocation, revocationRegistryIndex\n // and revocationRegistryDefinitionId are mandatory\n const credentialDefinition = (\n await agentContext.dependencyManager\n .resolve(AnonCredsCredentialDefinitionRepository)\n .getByCredentialDefinitionId(agentContext, offer.cred_def_id)\n ).credentialDefinition.value\n\n if (credentialDefinition.revocation) {\n if (!revocationRegistryDefinitionId || revocationRegistryIndex === undefined) {\n throw new CredoError(\n 'AnonCreds revocable credentials require revocationRegistryDefinitionId and revocationRegistryIndex'\n )\n }\n\n // Set revocation tags\n credentialExchangeRecord.setTags({\n anonCredsRevocationRegistryId: revocationRegistryDefinitionId,\n anonCredsCredentialRevocationId: revocationRegistryIndex.toString(),\n })\n }\n\n // Set the metadata\n credentialExchangeRecord.metadata.set<AnonCredsCredentialMetadata>(AnonCredsCredentialMetadataKey, {\n schemaId: offer.schema_id,\n credentialDefinitionId: offer.cred_def_id,\n credentialRevocationId: revocationRegistryIndex?.toString(),\n revocationRegistryId: revocationRegistryDefinitionId,\n })\n\n const attachment = this.getFormatData(offer, format.attachmentId)\n\n return { format, attachment, previewAttributes }\n }\n\n private async assertPreviewAttributesMatchSchemaAttributes(\n agentContext: AgentContext,\n offer: AnonCredsCredentialOffer,\n attributes: DidCommCredentialPreviewAttributeOptions[]\n ): Promise<void> {\n const { schema } = await fetchSchema(agentContext, offer.schema_id)\n\n assertAttributesMatch(schema, attributes)\n }\n\n /**\n * Get linked attachments for anoncreds format from a proposal message. This allows attachments\n * to be copied across to old style credential records\n *\n * @param options ProposeCredentialOptions object containing (optionally) the linked attachments\n * @return array of linked attachments or undefined if none present\n */\n private getCredentialLinkedAttachments(\n attributes?: DidCommCredentialPreviewAttributeOptions[],\n linkedAttachments?: DidCommLinkedAttachment[]\n ): {\n attachments?: DidCommAttachment[]\n previewAttributes?: DidCommCredentialPreviewAttributeOptions[]\n } {\n if (!linkedAttachments && !attributes) {\n return {}\n }\n\n let previewAttributes = attributes ?? []\n let attachments: DidCommAttachment[] | undefined\n\n if (linkedAttachments) {\n // there are linked attachments so transform into the attribute field of the CredentialPreview object for\n // this proposal\n previewAttributes = createAndLinkAttachmentsToPreview(linkedAttachments, previewAttributes)\n attachments = linkedAttachments.map((linkedAttachment) => linkedAttachment.attachment)\n }\n\n return { attachments, previewAttributes }\n }\n\n /**\n * Returns an object of type {@link DidCommAttachment} for use in credential exchange messages.\n * It looks up the correct format identifier and encodes the data as a base64 attachment.\n *\n * @param data The data to include in the attach object\n * @param id the attach id from the formats component of the message\n */\n public getFormatData(data: unknown, id: string): DidCommAttachment {\n const attachment = new DidCommAttachment({\n id,\n mimeType: 'application/json',\n data: {\n base64: JsonEncoder.toBase64(data),\n },\n })\n\n return attachment\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkEA,MAAM,6BAA6B;AACnC,MAAM,+BAA+B;AACrC,MAAM,8BAA8B;AACpC,MAAM,uBAAuB;AAE7B,IAAa,0CAAb,MAEA;;OAEkB,YAAY;OAMZ,uBAAuB;;;;;;;;;CASvC,MAAa,eACX,eACA,EACE,mBACA,4BAEoD;EACtD,MAAM,SAAS,IAAI,4BAA4B,EAC7C,QAAQ,6BACT,CAAC;EAEF,MAAM,kBAAkB,kBAAkB;AAE1C,MAAI,CAAC,gBACH,OAAM,IAAI,WAAW,8CAA8C;EAKrE,MAAM,EAAE,YAAY,kBAAmB,GAAG,gCAAgC;EAC1E,MAAM,WAAW,IAAI,4BAA4B,4BAA4B;AAE7E,MAAI;AACF,oBAAiB,aAAa,SAAS;WAChC,QAAQ;AACf,SAAM,IAAI,WAAW,8BAA8B,4BAA4B,4BAA4B;;EAG7G,MAAM,aAAa,KAAK,cAAc,gBAAgB,OAAO,SAAS,EAAE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undefined","revocationRegistryIndex: number | undefined","revocationStatusList: AnonCredsRevocationStatusList | undefined","attachments: DidCommAttachment[] | undefined"],"sources":["../../src/formats/AnonCredsDidCommCredentialFormatService.ts"],"sourcesContent":["import type { AgentContext } from '@credo-ts/core'\nimport { CredoError, JsonEncoder, JsonTransformer, MessageValidator, utils } from '@credo-ts/core'\nimport type {\n DidCommCredentialExchangeRecord,\n DidCommCredentialFormatAcceptOfferOptions,\n DidCommCredentialFormatAcceptProposalOptions,\n DidCommCredentialFormatAcceptRequestOptions,\n DidCommCredentialFormatAutoRespondCredentialOptions,\n DidCommCredentialFormatAutoRespondOfferOptions,\n DidCommCredentialFormatAutoRespondProposalOptions,\n DidCommCredentialFormatAutoRespondRequestOptions,\n DidCommCredentialFormatCreateOfferOptions,\n DidCommCredentialFormatCreateOfferReturn,\n DidCommCredentialFormatCreateProposalOptions,\n DidCommCredentialFormatCreateProposalReturn,\n DidCommCredentialFormatCreateReturn,\n DidCommCredentialFormatProcessCredentialOptions,\n DidCommCredentialFormatProcessOptions,\n DidCommCredentialFormatService,\n DidCommCredentialPreviewAttributeOptions,\n DidCommLinkedAttachment,\n} from '@credo-ts/didcomm'\nimport {\n DidCommAttachment,\n DidCommCredentialFormatSpec,\n DidCommCredentialProblemReportReason,\n DidCommProblemReportError,\n} from '@credo-ts/didcomm'\nimport type {\n AnonCredsCredential,\n AnonCredsCredentialOffer,\n AnonCredsCredentialRequest,\n AnonCredsRevocationStatusList,\n} from '../models'\nimport { AnonCredsCredentialProposal } from '../models/AnonCredsCredentialProposal'\nimport {\n AnonCredsCredentialDefinitionRepository,\n AnonCredsRevocationRegistryDefinitionPrivateRepository,\n AnonCredsRevocationRegistryState,\n} from '../repository'\nimport type { AnonCredsHolderService, AnonCredsIssuerService } from '../services'\nimport { AnonCredsHolderServiceSymbol, AnonCredsIssuerServiceSymbol } from '../services'\nimport {\n dateToTimestamp,\n fetchCredentialDefinition,\n fetchRevocationRegistryDefinition,\n fetchRevocationStatusList,\n fetchSchema,\n} from '../utils'\nimport {\n assertAttributesMatch,\n assertCredentialValuesMatch,\n checkCredentialValuesMatch,\n convertAttributesToCredentialValues,\n createAndLinkAttachmentsToPreview,\n} from '../utils/credential'\nimport type { AnonCredsCredentialMetadata, AnonCredsCredentialRequestMetadata } from '../utils/metadata'\nimport { AnonCredsCredentialMetadataKey, AnonCredsCredentialRequestMetadataKey } from '../utils/metadata'\nimport { getStoreCredentialOptions } from '../utils/w3cAnonCredsUtils'\nimport type {\n AnonCredsDidCommCredentialFormat,\n AnonCredsDidCommCredentialProposalFormat,\n} from './AnonCredsDidCommCredentialFormat'\n\nconst ANONCREDS_CREDENTIAL_OFFER = 'anoncreds/credential-offer@v1.0'\nconst ANONCREDS_CREDENTIAL_REQUEST = 'anoncreds/credential-request@v1.0'\nconst ANONCREDS_CREDENTIAL_FILTER = 'anoncreds/credential-filter@v1.0'\nconst ANONCREDS_CREDENTIAL = 'anoncreds/credential@v1.0'\n\nexport class AnonCredsDidCommCredentialFormatService\n implements DidCommCredentialFormatService<AnonCredsDidCommCredentialFormat>\n{\n /** formatKey is the key used when calling agent.credentials.xxx with credentialFormats.anoncreds */\n public readonly formatKey = 'anoncreds' as const\n\n /**\n * credentialRecordType is the type of record that stores the credential. It is stored in the credential\n * record binding in the credential exchange record.\n */\n public readonly credentialRecordType = 'w3c' as const\n\n /**\n * Create a {@link AttachmentFormats} object dependent on the message type.\n *\n * @param options The object containing all the options for the proposed credential\n * @returns object containing associated attachment, format and optionally the credential preview\n *\n */\n public async createProposal(\n _agentContext: AgentContext,\n {\n credentialFormats,\n credentialExchangeRecord,\n }: DidCommCredentialFormatCreateProposalOptions<AnonCredsDidCommCredentialFormat>\n ): Promise<DidCommCredentialFormatCreateProposalReturn> {\n const format = new DidCommCredentialFormatSpec({\n format: ANONCREDS_CREDENTIAL_FILTER,\n })\n\n const anoncredsFormat = credentialFormats.anoncreds\n\n if (!anoncredsFormat) {\n throw new CredoError('Missing anoncreds payload in createProposal')\n }\n\n // We want all properties except for `attributes` and `linkedAttachments` attributes.\n // The easiest way is to destructure and use the spread operator. But that leaves the other properties unused\n // biome-ignore lint/correctness/noUnusedVariables: no explanation\n const { attributes, linkedAttachments, ...anoncredsCredentialProposal } = anoncredsFormat\n const proposal = new AnonCredsCredentialProposal(anoncredsCredentialProposal)\n\n try {\n MessageValidator.validateSync(proposal)\n } catch (_error) {\n throw new CredoError(`Invalid proposal supplied: ${anoncredsCredentialProposal} in AnonCredsFormatService`)\n }\n\n const attachment = this.getFormatData(JsonTransformer.toJSON(proposal), format.attachmentId)\n\n const { previewAttributes } = this.getCredentialLinkedAttachments(\n anoncredsFormat.attributes,\n anoncredsFormat.linkedAttachments\n )\n\n // Set the metadata\n credentialExchangeRecord.metadata.set<AnonCredsCredentialMetadata>(AnonCredsCredentialMetadataKey, {\n schemaId: proposal.schemaId,\n credentialDefinitionId: proposal.credentialDefinitionId,\n })\n\n return { format, attachment, previewAttributes }\n }\n\n public async processProposal(\n _agentContext: AgentContext,\n { attachment }: DidCommCredentialFormatProcessOptions\n ): Promise<void> {\n const proposalJson = attachment.getDataAsJson()\n\n JsonTransformer.fromJSON(proposalJson, AnonCredsCredentialProposal)\n }\n\n public async acceptProposal(\n agentContext: AgentContext,\n {\n attachmentId,\n credentialFormats,\n credentialExchangeRecord,\n proposalAttachment,\n }: DidCommCredentialFormatAcceptProposalOptions<AnonCredsDidCommCredentialFormat>\n ): Promise<DidCommCredentialFormatCreateOfferReturn> {\n const anoncredsFormat = credentialFormats?.anoncreds\n\n const proposalJson = proposalAttachment.getDataAsJson<AnonCredsDidCommCredentialProposalFormat>()\n const credentialDefinitionId = anoncredsFormat?.credentialDefinitionId ?? proposalJson.cred_def_id\n\n const attributes = anoncredsFormat?.attributes ?? credentialExchangeRecord.credentialAttributes\n\n if (!credentialDefinitionId) {\n throw new CredoError('No credential definition id in proposal or provided as input to accept proposal method.')\n }\n\n if (!attributes) {\n throw new CredoError('No attributes in proposal or provided as input to accept proposal method.')\n }\n\n const { format, attachment, previewAttributes } = await this.createAnonCredsOffer(agentContext, {\n credentialExchangeRecord,\n attachmentId,\n attributes,\n credentialDefinitionId,\n revocationRegistryDefinitionId: anoncredsFormat?.revocationRegistryDefinitionId,\n revocationRegistryIndex: anoncredsFormat?.revocationRegistryIndex,\n linkedAttachments: anoncredsFormat?.linkedAttachments,\n })\n\n return { format, attachment, previewAttributes }\n }\n\n /**\n * Create a credential attachment format for a credential request.\n *\n * @param options The object containing all the options for the credential offer\n * @returns object containing associated attachment, formats and offersAttach elements\n *\n */\n public async createOffer(\n agentContext: AgentContext,\n {\n credentialFormats,\n credentialExchangeRecord,\n attachmentId,\n }: DidCommCredentialFormatCreateOfferOptions<AnonCredsDidCommCredentialFormat>\n ): Promise<DidCommCredentialFormatCreateOfferReturn> {\n const anoncredsFormat = credentialFormats.anoncreds\n\n if (!anoncredsFormat) {\n throw new CredoError('Missing anoncreds credential format data')\n }\n\n const { format, attachment, previewAttributes } = await this.createAnonCredsOffer(agentContext, {\n credentialExchangeRecord,\n attachmentId,\n attributes: anoncredsFormat.attributes,\n credentialDefinitionId: anoncredsFormat.credentialDefinitionId,\n revocationRegistryDefinitionId: anoncredsFormat.revocationRegistryDefinitionId,\n revocationRegistryIndex: anoncredsFormat.revocationRegistryIndex,\n linkedAttachments: anoncredsFormat.linkedAttachments,\n })\n\n return { format, attachment, previewAttributes }\n }\n\n public async processOffer(\n agentContext: AgentContext,\n { attachment, credentialExchangeRecord }: DidCommCredentialFormatProcessOptions\n ) {\n agentContext.config.logger.debug(\n `Processing anoncreds credential offer for credential record ${credentialExchangeRecord.id}`\n )\n\n const credOffer = attachment.getDataAsJson<AnonCredsCredentialOffer>()\n\n if (!credOffer.schema_id || !credOffer.cred_def_id) {\n throw new DidCommProblemReportError('Invalid credential offer', {\n problemCode: DidCommCredentialProblemReportReason.IssuanceAbandoned,\n })\n }\n }\n\n public async acceptOffer(\n agentContext: AgentContext,\n {\n credentialExchangeRecord,\n attachmentId,\n offerAttachment,\n credentialFormats,\n }: DidCommCredentialFormatAcceptOfferOptions<AnonCredsDidCommCredentialFormat>\n ): Promise<DidCommCredentialFormatCreateReturn> {\n const holderService = agentContext.dependencyManager.resolve<AnonCredsHolderService>(AnonCredsHolderServiceSymbol)\n\n const credentialOffer = offerAttachment.getDataAsJson<AnonCredsCredentialOffer>()\n\n // Get credential definition\n const { credentialDefinition } = await fetchCredentialDefinition(agentContext, credentialOffer.cred_def_id)\n\n const { credentialRequest, credentialRequestMetadata } = await holderService.createCredentialRequest(agentContext, {\n credentialOffer,\n credentialDefinition,\n linkSecretId: credentialFormats?.anoncreds?.linkSecretId,\n })\n\n credentialExchangeRecord.metadata.set<AnonCredsCredentialRequestMetadata>(\n AnonCredsCredentialRequestMetadataKey,\n credentialRequestMetadata\n )\n credentialExchangeRecord.metadata.set<AnonCredsCredentialMetadata>(AnonCredsCredentialMetadataKey, {\n credentialDefinitionId: credentialOffer.cred_def_id,\n schemaId: credentialOffer.schema_id,\n })\n\n const format = new DidCommCredentialFormatSpec({\n attachmentId,\n format: ANONCREDS_CREDENTIAL_REQUEST,\n })\n\n const attachment = this.getFormatData(credentialRequest, format.attachmentId)\n return { format, attachment }\n }\n\n /**\n * Starting from a request is not supported for anoncreds credentials, this method only throws an error.\n */\n public async createRequest(): Promise<DidCommCredentialFormatCreateReturn> {\n throw new CredoError('Starting from a request is not supported for anoncreds credentials')\n }\n\n /**\n * We don't have any models to validate an anoncreds request object, for now this method does nothing\n */\n public async processRequest(\n _agentContext: AgentContext,\n _options: DidCommCredentialFormatProcessOptions\n ): Promise<void> {\n // not needed for anoncreds\n }\n\n public async acceptRequest(\n agentContext: AgentContext,\n {\n credentialExchangeRecord,\n attachmentId,\n offerAttachment,\n requestAttachment,\n }: DidCommCredentialFormatAcceptRequestOptions<AnonCredsDidCommCredentialFormat>\n ): Promise<DidCommCredentialFormatCreateReturn> {\n // Assert credential attributes\n const credentialAttributes = credentialExchangeRecord.credentialAttributes\n if (!credentialAttributes) {\n throw new CredoError(\n `Missing required credential attribute values on credential record with id ${credentialExchangeRecord.id}`\n )\n }\n\n const anonCredsIssuerService =\n agentContext.dependencyManager.resolve<AnonCredsIssuerService>(AnonCredsIssuerServiceSymbol)\n\n const credentialOffer = offerAttachment?.getDataAsJson<AnonCredsCredentialOffer>()\n if (!credentialOffer) throw new CredoError('Missing anoncreds credential offer in createCredential')\n\n const credentialRequest = requestAttachment.getDataAsJson<AnonCredsCredentialRequest>()\n if (!credentialRequest) throw new CredoError('Missing anoncreds credential request in createCredential')\n\n // We check locally for credential definition info. If it supports revocation, we need to search locally for\n // an active revocation registry\n const credentialDefinition = (\n await agentContext.dependencyManager\n .resolve(AnonCredsCredentialDefinitionRepository)\n .getByCredentialDefinitionId(agentContext, credentialRequest.cred_def_id)\n ).credentialDefinition.value\n\n let revocationRegistryDefinitionId: string | undefined\n let revocationRegistryIndex: number | undefined\n let revocationStatusList: AnonCredsRevocationStatusList | undefined\n\n if (credentialDefinition.revocation) {\n const credentialMetadata =\n credentialExchangeRecord.metadata.get<AnonCredsCredentialMetadata>(AnonCredsCredentialMetadataKey)\n revocationRegistryDefinitionId = credentialMetadata?.revocationRegistryId\n if (credentialMetadata?.credentialRevocationId) {\n revocationRegistryIndex = Number(credentialMetadata.credentialRevocationId)\n }\n\n if (!revocationRegistryDefinitionId || revocationRegistryIndex === undefined) {\n throw new CredoError(\n 'Revocation registry definition id and revocation index are mandatory to issue AnonCreds revocable credentials'\n )\n }\n const revocationRegistryDefinitionPrivateRecord = await agentContext.dependencyManager\n .resolve(AnonCredsRevocationRegistryDefinitionPrivateRepository)\n .getByRevocationRegistryDefinitionId(agentContext, revocationRegistryDefinitionId)\n\n if (revocationRegistryDefinitionPrivateRecord.state !== AnonCredsRevocationRegistryState.Active) {\n throw new CredoError(\n `Revocation registry ${revocationRegistryDefinitionId} is in ${revocationRegistryDefinitionPrivateRecord.state} state`\n )\n }\n\n const revocationStatusListResult = await fetchRevocationStatusList(\n agentContext,\n revocationRegistryDefinitionId,\n dateToTimestamp(new Date())\n )\n revocationStatusList = revocationStatusListResult.revocationStatusList\n }\n\n const { credential, credentialRevocationId } = await anonCredsIssuerService.createCredential(agentContext, {\n credentialOffer,\n credentialRequest,\n credentialValues: convertAttributesToCredentialValues(credentialAttributes),\n revocationRegistryDefinitionId,\n revocationRegistryIndex,\n revocationStatusList,\n })\n\n // If the credential is revocable, store the revocation identifiers in the credential record\n if (credential.rev_reg_id) {\n credentialExchangeRecord.metadata.add<AnonCredsCredentialMetadata>(AnonCredsCredentialMetadataKey, {\n revocationRegistryId: revocationRegistryDefinitionId ?? undefined,\n credentialRevocationId: credentialRevocationId ?? undefined,\n })\n credentialExchangeRecord.setTags({\n anonCredsRevocationRegistryId: revocationRegistryDefinitionId,\n anonCredsCredentialRevocationId: credentialRevocationId,\n })\n }\n\n const format = new DidCommCredentialFormatSpec({\n attachmentId,\n format: ANONCREDS_CREDENTIAL,\n })\n\n const attachment = this.getFormatData(credential, format.attachmentId)\n return { format, attachment }\n }\n\n /**\n * Processes an incoming credential - retrieve metadata, retrieve payload and store it in wallet\n * @param options the issue credential message wrapped inside this object\n * @param credentialExchangeRecord the credential exchange record for this credential\n */\n public async processCredential(\n agentContext: AgentContext,\n { credentialExchangeRecord, attachment }: DidCommCredentialFormatProcessCredentialOptions\n ): Promise<void> {\n const credentialRequestMetadata = credentialExchangeRecord.metadata.get<AnonCredsCredentialRequestMetadata>(\n AnonCredsCredentialRequestMetadataKey\n )\n\n const anonCredsHolderService =\n agentContext.dependencyManager.resolve<AnonCredsHolderService>(AnonCredsHolderServiceSymbol)\n\n if (!credentialRequestMetadata) {\n throw new CredoError(\n `Missing required request metadata for credential exchange with thread id with id ${credentialExchangeRecord.id}`\n )\n }\n\n if (!credentialExchangeRecord.credentialAttributes) {\n throw new CredoError('Missing credential attributes on credential record. Unable to check credential attributes')\n }\n\n const anonCredsCredential = attachment.getDataAsJson<AnonCredsCredential>()\n\n const { credentialDefinition, credentialDefinitionId } = await fetchCredentialDefinition(\n agentContext,\n anonCredsCredential.cred_def_id\n )\n const { schema, indyNamespace } = await fetchSchema(agentContext, anonCredsCredential.schema_id)\n\n // Resolve revocation registry if credential is revocable\n const revocationRegistryResult = anonCredsCredential.rev_reg_id\n ? await fetchRevocationRegistryDefinition(agentContext, anonCredsCredential.rev_reg_id)\n : undefined\n\n // assert the credential values match the offer values\n const recordCredentialValues = convertAttributesToCredentialValues(credentialExchangeRecord.credentialAttributes)\n assertCredentialValuesMatch(anonCredsCredential.values, recordCredentialValues)\n\n const storeCredentialOptions = getStoreCredentialOptions(\n {\n credentialId: utils.uuid(),\n credentialRequestMetadata,\n credential: anonCredsCredential,\n credentialDefinitionId,\n credentialDefinition,\n schema,\n revocationRegistry: revocationRegistryResult?.revocationRegistryDefinition\n ? {\n definition: revocationRegistryResult.revocationRegistryDefinition,\n id: revocationRegistryResult.revocationRegistryDefinitionId,\n }\n : undefined,\n },\n indyNamespace\n )\n\n const credentialId = await anonCredsHolderService.storeCredential(agentContext, storeCredentialOptions)\n\n // If the credential is revocable, store the revocation identifiers in the credential record\n if (anonCredsCredential.rev_reg_id) {\n const credential = await anonCredsHolderService.getCredential(agentContext, { id: credentialId })\n\n credentialExchangeRecord.metadata.add<AnonCredsCredentialMetadata>(AnonCredsCredentialMetadataKey, {\n credentialRevocationId: credential.credentialRevocationId ?? undefined,\n revocationRegistryId: credential.revocationRegistryId ?? undefined,\n })\n credentialExchangeRecord.setTags({\n anonCredsRevocationRegistryId: credential.revocationRegistryId,\n anonCredsCredentialRevocationId: credential.credentialRevocationId,\n })\n }\n\n credentialExchangeRecord.credentials.push({\n credentialRecordType: this.credentialRecordType,\n credentialRecordId: credentialId,\n })\n }\n\n public supportsFormat(format: string): boolean {\n const supportedFormats = [\n ANONCREDS_CREDENTIAL_REQUEST,\n ANONCREDS_CREDENTIAL_OFFER,\n ANONCREDS_CREDENTIAL_FILTER,\n ANONCREDS_CREDENTIAL,\n ]\n\n return supportedFormats.includes(format)\n }\n\n /**\n * Gets the attachment object for a given attachmentId. We need to get out the correct attachmentId for\n * anoncreds and then find the corresponding attachment (if there is one)\n * @param formats the formats object containing the attachmentId\n * @param messageAttachments the attachments containing the payload\n * @returns The DidCommAttachment if found or undefined\n *\n */\n public getAttachment(\n formats: DidCommCredentialFormatSpec[],\n messageAttachments: DidCommAttachment[]\n ): DidCommAttachment | undefined {\n const supportedAttachmentIds = formats.filter((f) => this.supportsFormat(f.format)).map((f) => f.attachmentId)\n const supportedAttachment = messageAttachments.find((attachment) => supportedAttachmentIds.includes(attachment.id))\n\n return supportedAttachment\n }\n\n public async deleteCredentialById(agentContext: AgentContext, credentialRecordId: string): Promise<void> {\n const anonCredsHolderService =\n agentContext.dependencyManager.resolve<AnonCredsHolderService>(AnonCredsHolderServiceSymbol)\n\n await anonCredsHolderService.deleteCredential(agentContext, credentialRecordId)\n }\n\n public async shouldAutoRespondToProposal(\n _agentContext: AgentContext,\n { offerAttachment, proposalAttachment }: DidCommCredentialFormatAutoRespondProposalOptions\n ) {\n const proposalJson = proposalAttachment.getDataAsJson<AnonCredsDidCommCredentialProposalFormat>()\n const offerJson = offerAttachment.getDataAsJson<AnonCredsCredentialOffer>()\n\n // We want to make sure the credential definition matches.\n // TODO: If no credential definition is present on the proposal, we could check whether the other fields\n // of the proposal match with the credential definition id.\n return proposalJson.cred_def_id === offerJson.cred_def_id\n }\n\n public async shouldAutoRespondToOffer(\n _agentContext: AgentContext,\n { offerAttachment, proposalAttachment }: DidCommCredentialFormatAutoRespondOfferOptions\n ) {\n const proposalJson = proposalAttachment.getDataAsJson<AnonCredsDidCommCredentialProposalFormat>()\n const offerJson = offerAttachment.getDataAsJson<AnonCredsCredentialOffer>()\n\n // We want to make sure the credential definition matches.\n // TODO: If no credential definition is present on the proposal, we could check whether the other fields\n // of the proposal match with the credential definition id.\n return proposalJson.cred_def_id === offerJson.cred_def_id\n }\n\n public async shouldAutoRespondToRequest(\n _agentContext: AgentContext,\n { offerAttachment, requestAttachment }: DidCommCredentialFormatAutoRespondRequestOptions\n ) {\n const credentialOfferJson = offerAttachment.getDataAsJson<AnonCredsCredentialOffer>()\n const credentialRequestJson = requestAttachment.getDataAsJson<AnonCredsCredentialRequest>()\n\n return credentialOfferJson.cred_def_id === credentialRequestJson.cred_def_id\n }\n\n public async shouldAutoRespondToCredential(\n _agentContext: AgentContext,\n {\n credentialExchangeRecord,\n requestAttachment,\n credentialAttachment,\n }: DidCommCredentialFormatAutoRespondCredentialOptions\n ) {\n const credentialJson = credentialAttachment.getDataAsJson<AnonCredsCredential>()\n const credentialRequestJson = requestAttachment.getDataAsJson<AnonCredsCredentialRequest>()\n\n // make sure the credential definition matches\n if (credentialJson.cred_def_id !== credentialRequestJson.cred_def_id) return false\n\n // If we don't have any attributes stored we can't compare so always return false.\n if (!credentialExchangeRecord.credentialAttributes) return false\n const attributeValues = convertAttributesToCredentialValues(credentialExchangeRecord.credentialAttributes)\n\n // check whether the values match the values in the record\n return checkCredentialValuesMatch(attributeValues, credentialJson.values)\n }\n\n private async createAnonCredsOffer(\n agentContext: AgentContext,\n {\n credentialExchangeRecord,\n attachmentId,\n credentialDefinitionId,\n revocationRegistryDefinitionId,\n revocationRegistryIndex,\n attributes,\n linkedAttachments,\n }: {\n credentialDefinitionId: string\n revocationRegistryDefinitionId?: string\n revocationRegistryIndex?: number\n credentialExchangeRecord: DidCommCredentialExchangeRecord\n attachmentId?: string\n attributes: DidCommCredentialPreviewAttributeOptions[]\n linkedAttachments?: DidCommLinkedAttachment[]\n }\n ): Promise<DidCommCredentialFormatCreateOfferReturn> {\n const anonCredsIssuerService =\n agentContext.dependencyManager.resolve<AnonCredsIssuerService>(AnonCredsIssuerServiceSymbol)\n\n // if the proposal has an attachment Id use that, otherwise the generated id of the formats object\n const format = new DidCommCredentialFormatSpec({\n attachmentId: attachmentId,\n format: ANONCREDS_CREDENTIAL_OFFER,\n })\n\n const offer = await anonCredsIssuerService.createCredentialOffer(agentContext, {\n credentialDefinitionId,\n })\n\n const { previewAttributes } = this.getCredentialLinkedAttachments(attributes, linkedAttachments)\n if (!previewAttributes) {\n throw new CredoError('Missing required preview attributes for anoncreds offer')\n }\n\n await this.assertPreviewAttributesMatchSchemaAttributes(agentContext, offer, previewAttributes)\n\n // We check locally for credential definition info. If it supports revocation, revocationRegistryIndex\n // and revocationRegistryDefinitionId are mandatory\n const credentialDefinition = (\n await agentContext.dependencyManager\n .resolve(AnonCredsCredentialDefinitionRepository)\n .getByCredentialDefinitionId(agentContext, offer.cred_def_id)\n ).credentialDefinition.value\n\n if (credentialDefinition.revocation) {\n if (!revocationRegistryDefinitionId || revocationRegistryIndex === undefined) {\n throw new CredoError(\n 'AnonCreds revocable credentials require revocationRegistryDefinitionId and revocationRegistryIndex'\n )\n }\n\n // Set revocation tags\n credentialExchangeRecord.setTags({\n anonCredsRevocationRegistryId: revocationRegistryDefinitionId,\n anonCredsCredentialRevocationId: revocationRegistryIndex.toString(),\n })\n }\n\n // Set the metadata\n credentialExchangeRecord.metadata.set<AnonCredsCredentialMetadata>(AnonCredsCredentialMetadataKey, {\n schemaId: offer.schema_id,\n credentialDefinitionId: offer.cred_def_id,\n credentialRevocationId: revocationRegistryIndex?.toString(),\n revocationRegistryId: revocationRegistryDefinitionId,\n })\n\n const attachment = this.getFormatData(offer, format.attachmentId)\n\n return { format, attachment, previewAttributes }\n }\n\n private async assertPreviewAttributesMatchSchemaAttributes(\n agentContext: AgentContext,\n offer: AnonCredsCredentialOffer,\n attributes: DidCommCredentialPreviewAttributeOptions[]\n ): Promise<void> {\n const { schema } = await fetchSchema(agentContext, offer.schema_id)\n\n assertAttributesMatch(schema, attributes)\n }\n\n /**\n * Get linked attachments for anoncreds format from a proposal message. This allows attachments\n * to be copied across to old style credential records\n *\n * @param options ProposeCredentialOptions object containing (optionally) the linked attachments\n * @return array of linked attachments or undefined if none present\n */\n private getCredentialLinkedAttachments(\n attributes?: DidCommCredentialPreviewAttributeOptions[],\n linkedAttachments?: DidCommLinkedAttachment[]\n ): {\n attachments?: DidCommAttachment[]\n previewAttributes?: DidCommCredentialPreviewAttributeOptions[]\n } {\n if (!linkedAttachments && !attributes) {\n return {}\n }\n\n let previewAttributes = attributes ?? []\n let attachments: DidCommAttachment[] | undefined\n\n if (linkedAttachments) {\n // there are linked attachments so transform into the attribute field of the CredentialPreview object for\n // this proposal\n previewAttributes = createAndLinkAttachmentsToPreview(linkedAttachments, previewAttributes)\n attachments = linkedAttachments.map((linkedAttachment) => linkedAttachment.attachment)\n }\n\n return { attachments, previewAttributes }\n }\n\n /**\n * Returns an object of type {@link DidCommAttachment} for use in credential exchange messages.\n * It looks up the correct format identifier and encodes the data as a base64 attachment.\n *\n * @param data The data to include in the attach object\n * @param id the attach id from the formats component of the message\n */\n public getFormatData(data: unknown, id: string): DidCommAttachment {\n const attachment = new DidCommAttachment({\n id,\n mimeType: 'application/json',\n data: {\n base64: JsonEncoder.toBase64(data),\n },\n })\n\n return attachment\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgEA,MAAM,6BAA6B;AACnC,MAAM,+BAA+B;AACrC,MAAM,8BAA8B;AACpC,MAAM,uBAAuB;AAE7B,IAAa,0CAAb,MAEA;;OAEkB,YAAY;OAMZ,uBAAuB;;;;;;;;;CASvC,MAAa,eACX,eACA,EACE,mBACA,4BAEoD;EACtD,MAAM,SAAS,IAAI,4BAA4B,EAC7C,QAAQ,6BACT,CAAC;EAEF,MAAM,kBAAkB,kBAAkB;AAE1C,MAAI,CAAC,gBACH,OAAM,IAAI,WAAW,8CAA8C;EAMrE,MAAM,EAAE,YAAY,kBAAmB,GAAG,gCAAgC;EAC1E,MAAM,WAAW,IAAI,4BAA4B,4BAA4B;AAE7E,MAAI;AACF,oBAAiB,aAAa,SAAS;WAChC,QAAQ;AACf,SAAM,IAAI,WAAW,8BAA8B,4BAA4B,4BAA4B;;EAG7G,MAAM,aAAa,KAAK,cAAc,gBAAgB,OAAO,SAAS,EAAE,OAAO,aAAa;EAE5F,MAAM,EAAE,sBAAsB,K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{ AnonCredsNonRevokedInterval, AnonCredsPredicateType, AnonCredsProof, AnonCredsProofRequest, AnonCredsRequestedAttribute, AnonCredsRequestedPredicate } from "../models/exchange.mjs";
2
+ import { AnonCredsRequestedAttributeMatch, AnonCredsRequestedPredicateMatch, AnonCredsSelectedCredentials } from "../models/internal.mjs";
3
3
  import { DidCommProofFormat } from "@credo-ts/didcomm";
4
4
 
5
5
  //#region src/formats/AnonCredsDidCommProofFormat.d.ts
@@ -1,5 +1,5 @@
1
- import { AnonCredsRequestedAttributeMatch, AnonCredsRequestedPredicateMatch, AnonCredsSelectedCredentials } from "../models/internal.js";
2
1
  import { AnonCredsNonRevokedInterval, AnonCredsPredicateType, AnonCredsProof, AnonCredsProofRequest, AnonCredsRequestedAttribute, AnonCredsRequestedPredicate } from "../models/exchange.js";
2
+ import { AnonCredsRequestedAttributeMatch, AnonCredsRequestedPredicateMatch, AnonCredsSelectedCredentials } from "../models/internal.js";
3
3
  import { DidCommProofFormat } from "@credo-ts/didcomm";
4
4
 
5
5
  //#region src/formats/AnonCredsDidCommProofFormat.d.ts
@@ -1 +1 @@
1
- {"version":3,"file":"AnonCredsDidCommProofFormatService.d.mts","names":[],"sources":["../../src/formats/AnonCredsDidCommProofFormatService.ts"],"sourcesContent":[],"mappings":";;;;;cAsDa,kCAAA,YAA8C,0BAA0B;;EAAxE,cAAA,CAAA,YAAA,EAIK,YAJ8B,EAAA;IAAA,YAAA;IAAA;EAAA,CAAA,EAKZ,uCALY,CAK4B,2BAL5B,CAAA,CAAA,EAM3C,OAN2C,CAMnC,8BANmC,CAAA;EAAA,eAAA,CAAA,aAAA,EAiC7B,YAjC6B,EAAA;IAAA;EAAA,CAAA,EAkC5B,gCAlC4B,CAAA,EAmC3C,OAnC2C,CAAA,IAAA,CAAA;gBAAqC,CAAA,YAAA,EA8CnE,YA9CmE,EAAA;IAAA,kBAAA;IAAA;EAAA,CAAA,EA+C3C,uCA/C2C,CA+CH,2BA/CG,CAAA,CAAA,EAgDhF,O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,CAAA,EAAA,OAAA;UACf,4BAAA;;;;;;;;;;UAoCe,UAAA;;;;;;;;;;UA8Cd,wBAAA;;;;;;;;UA8BA,WAAA;;;;;;;;UAwDmC,aAAA"}
@@ -2,16 +2,16 @@ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
2
  const require_AnonCredsHolderService = require('../services/AnonCredsHolderService.js');
3
3
  const require_AnonCredsVerifierService = require('../services/AnonCredsVerifierService.js');
4
4
  require('../services/index.js');
5
- const require_createRequestFromPreview = require('../utils/createRequestFromPreview.js');
6
- const require_hasDuplicateGroupNames = require('../utils/hasDuplicateGroupNames.js');
5
+ const require_anonCredsObjects = require('../utils/anonCredsObjects.js');
7
6
  const require_areRequestsEqual = require('../utils/areRequestsEqual.js');
8
- const require_getRevocationRegistries = require('../utils/getRevocationRegistries.js');
7
+ const require_createRequestFromPreview = require('../utils/createRequestFromPreview.js');
9
8
  const require_credential = require('../utils/credential.js');
10
- const require_anonCredsObjects = require('../utils/anonCredsObjects.js');
11
9
  const require_getCredentialsForAnonCredsRequest = require('../utils/getCredentialsForAnonCredsRequest.js');
10
+ const require_getRevocationRegistries = require('../utils/getRevocationRegistries.js');
11
+ const require_hasDuplicateGroupNames = require('../utils/hasDuplicateGroupNames.js');
12
12
  require('../utils/index.js');
13
- const require_AnonCredsProofRequest = require('../models/AnonCredsProofRequest.js');
14
13
  const require_proofRequest = require('../utils/proofRequest.js');
14
+ const require_AnonCredsProofRequest = require('../models/AnonCredsProofRequest.js');
15
15
  let __credo_ts_core = require("@credo-ts/core");
16
16
  __credo_ts_core = require_rolldown_runtime.__toESM(__credo_ts_core);
17
17
  let __credo_ts_didcomm = require("@credo-ts/didcomm");
@@ -1,16 +1,16 @@
1
1
  import { AnonCredsHolderServiceSymbol } from "../services/AnonCredsHolderService.mjs";
2
2
  import { AnonCredsVerifierServiceSymbol } from "../services/AnonCredsVerifierService.mjs";
3
3
  import "../services/index.mjs";
4
- import { createRequestFromPreview } from "../utils/createRequestFromPreview.mjs";
5
- import { assertNoDuplicateGroupsNamesInProofRequest } from "../utils/hasDuplicateGroupNames.mjs";
4
+ import { fetchCredentialDefinition, fetchSchema } from "../utils/anonCredsObjects.mjs";
6
5
  import { areAnonCredsProofRequestsEqual } from "../utils/areRequestsEqual.mjs";
7
- import { getRevocationRegistriesForProof, getRevocationRegistriesForRequest } from "../utils/getRevocationRegistries.mjs";
6
+ import { createRequestFromPreview } from "../utils/createRequestFromPreview.mjs";
8
7
  import { checkValidCredentialValueEncoding, encodeCredentialValue } from "../utils/credential.mjs";
9
- import { fetchCredentialDefinition, fetchSchema } from "../utils/anonCredsObjects.mjs";
10
8
  import { getCredentialsForAnonCredsProofRequest } from "../utils/getCredentialsForAnonCredsRequest.mjs";
9
+ import { getRevocationRegistriesForProof, getRevocationRegistriesForRequest } from "../utils/getRevocationRegistries.mjs";
10
+ import { assertNoDuplicateGroupsNamesInProofRequest } from "../utils/hasDuplicateGroupNames.mjs";
11
11
  import "../utils/index.mjs";
12
- import { AnonCredsProofRequest } from "../models/AnonCredsProofRequest.mjs";
13
12
  import { proofRequestUsesUnqualifiedIdentifiers } from "../utils/proofRequest.mjs";
13
+ import { AnonCredsProofRequest } from "../models/AnonCredsProofRequest.mjs";
14
14
  import { CredoError, JsonEncoder, JsonTransformer } from "@credo-ts/core";
15
15
  import { DidCommAttachment, DidCommAttachmentData, DidCommProofFormatSpec } from "@credo-ts/didcomm";
16
16
 
@@ -1 +1 @@
1
- {"version":3,"file":"AnonCredsDidCommProofFormatService.mjs","names":["AnonCredsProofRequestClass","selectedCredentials: AnonCredsSelectedCredentials","schemas: { [key: string]: AnonCredsSchema }","credentialDefinitions: { [key: string]: AnonCredsCredentialDefinition }"],"sources":["../../src/formats/AnonCredsDidCommProofFormatService.ts"],"sourcesContent":["import type { AgentContext } from '@credo-ts/core'\nimport type {\n DidCommFormatCreateRequestOptions,\n DidCommProofFormatAcceptProposalOptions,\n DidCommProofFormatAcceptRequestOptions,\n DidCommProofFormatAutoRespondPresentationOptions,\n DidCommProofFormatAutoRespondProposalOptions,\n DidCommProofFormatAutoRespondRequestOptions,\n DidCommProofFormatCreateProposalOptions,\n DidCommProofFormatCreateReturn,\n DidCommProofFormatGetCredentialsForRequestOptions,\n DidCommProofFormatGetCredentialsForRequestReturn,\n DidCommProofFormatProcessOptions,\n DidCommProofFormatProcessPresentationOptions,\n DidCommProofFormatSelectCredentialsForRequestOptions,\n DidCommProofFormatSelectCredentialsForRequestReturn,\n DidCommProofFormatService,\n} from '@credo-ts/didcomm'\nimport type {\n AnonCredsCredentialDefinition,\n AnonCredsProof,\n AnonCredsProofRequest,\n AnonCredsSchema,\n AnonCredsSelectedCredentials,\n} from '../models'\nimport type { AnonCredsHolderService, AnonCredsVerifierService } from '../services'\nimport type {\n AnonCredsDidCommProofFormat,\n AnonCredsGetCredentialsForProofRequestOptions,\n} from './AnonCredsDidCommProofFormat'\n\nimport { CredoError, JsonEncoder, JsonTransformer } from '@credo-ts/core'\nimport { DidCommAttachment, DidCommAttachmentData, DidCommProofFormatSpec } from '@credo-ts/didcomm'\n\nimport { AnonCredsProofRequest as AnonCredsProofRequestClass } from '../models/AnonCredsProofRequest'\nimport { AnonCredsHolderServiceSymbol, AnonCredsVerifierServiceSymbol } from '../services'\nimport {\n areAnonCredsProofRequestsEqual,\n assertNoDuplicateGroupsNamesInProofRequest,\n checkValidCredentialValueEncoding,\n createRequestFromPreview,\n fetchCredentialDefinition,\n fetchSchema,\n getRevocationRegistriesForProof,\n getRevocationRegistriesForRequest,\n} from '../utils'\nimport { encodeCredentialValue } from '../utils/credential'\nimport { getCredentialsForAnonCredsProofRequest } from '../utils/getCredentialsForAnonCredsRequest'\nimport { proofRequestUsesUnqualifiedIdentifiers } from '../utils/proofRequest'\n\nconst ANONCREDS_PRESENTATION_PROPOSAL = 'anoncreds/proof-request@v1.0'\nconst ANONCREDS_PRESENTATION_REQUEST = 'anoncreds/proof-request@v1.0'\nconst ANONCREDS_PRESENTATION = 'anoncreds/proof@v1.0'\n\nexport class AnonCredsDidCommProofFormatService implements DidCommProofFormatService<AnonCredsDidCommProofFormat> {\n public readonly formatKey = 'anoncreds' as const\n\n public async createProposal(\n agentContext: AgentContext,\n { attachmentId, proofFormats }: DidCommProofFormatCreateProposalOptions<AnonCredsDidCommProofFormat>\n ): Promise<DidCommProofFormatCreateReturn> {\n const holderService = agentContext.dependencyManager.resolve<AnonCredsHolderService>(AnonCredsHolderServiceSymbol)\n\n const format = new DidCommProofFormatSpec({\n format: ANONCREDS_PRESENTATION_PROPOSAL,\n attachmentId,\n })\n\n const anoncredsFormat = proofFormats.anoncreds\n if (!anoncredsFormat) {\n throw Error('Missing anoncreds format to create proposal attachment format')\n }\n\n const proofRequest = createRequestFromPreview({\n attributes: anoncredsFormat.attributes ?? [],\n predicates: anoncredsFormat.predicates ?? [],\n name: anoncredsFormat.name ?? 'Proof request',\n version: anoncredsFormat.version ?? '1.0',\n nonce: holderService.generateNonce(agentContext),\n nonRevokedInterval: anoncredsFormat.nonRevokedInterval,\n })\n const attachment = this.getFormatData(proofRequest, format.attachmentId)\n\n return { attachment, format }\n }\n\n public async processProposal(\n _agentContext: AgentContext,\n { attachment }: DidCommProofFormatProcessOptions\n ): Promise<void> {\n const proposalJson = attachment.getDataAsJson<AnonCredsProofRequest>()\n\n // fromJson also validates\n JsonTransformer.fromJSON(proposalJson, AnonCredsProofRequestClass)\n\n // Assert attribute and predicate (group) names do not match\n assertNoDuplicateGroupsNamesInProofRequest(proposalJson)\n }\n\n public async acceptProposal(\n agentContext: AgentContext,\n { proposalAttachment, attachmentId }: DidCommProofFormatAcceptProposalOptions<AnonCredsDidCommProofFormat>\n ): Promise<DidCommProofFormatCreateReturn> {\n const holderService = agentContext.dependencyManager.resolve<AnonCredsHolderService>(AnonCredsHolderServiceSymbol)\n\n const format = new DidCommProofFormatSpec({\n format: ANONCREDS_PRESENTATION_REQUEST,\n attachmentId,\n })\n\n const proposalJson = proposalAttachment.getDataAsJson<AnonCredsProofRequest>()\n\n const request = {\n ...proposalJson,\n // We never want to reuse the nonce from the proposal, as this will allow replay attacks\n nonce: holderService.generateNonce(agentContext),\n }\n\n const attachment = this.getFormatData(request, format.attachmentId)\n\n return { attachment, format }\n }\n\n public async createRequest(\n agentContext: AgentContext,\n { attachmentId, proofFormats }: DidCommFormatCreateRequestOptions<AnonCredsDidCommProofFormat>\n ): Promise<DidCommProofFormatCreateReturn> {\n const holderService = agentContext.dependencyManager.resolve<AnonCredsHolderService>(AnonCredsHolderServiceSymbol)\n const format = new DidCommProofFormatSpec({\n format: ANONCREDS_PRESENTATION_REQUEST,\n attachmentId,\n })\n\n const anoncredsFormat = proofFormats.anoncreds\n if (!anoncredsFormat) {\n throw Error('Missing anoncreds format in create request attachment format')\n }\n\n const request = {\n name: anoncredsFormat.name,\n version: anoncredsFormat.version,\n nonce: holderService.generateNonce(agentContext),\n requested_attributes: anoncredsFormat.requested_attributes ?? {},\n requested_predicates: anoncredsFormat.requested_predicates ?? {},\n non_revoked: anoncredsFormat.non_revoked,\n } satisfies AnonCredsProofRequest\n\n // Assert attribute and predicate (group) names do not match\n assertNoDuplicateGroupsNamesInProofRequest(request)\n\n const attachment = this.getFormatData(request, format.attachmentId)\n\n return { attachment, format }\n }\n\n public async processRequest(\n _agentContext: AgentContext,\n { attachment }: DidCommProofFormatProcessOptions\n ): Promise<void> {\n const requestJson = attachment.getDataAsJson<AnonCredsProofRequest>()\n\n // fromJson also validates\n JsonTransformer.fromJSON(requestJson, AnonCredsProofRequestClass)\n\n // Assert attribute and predicate (group) names do not match\n assertNoDuplicateGroupsNamesInProofRequest(requestJson)\n }\n\n public async acceptRequest(\n agentContext: AgentContext,\n {\n proofFormats,\n requestAttachment,\n attachmentId,\n }: DidCommProofFormatAcceptRequestOptions<AnonCredsDidCommProofFormat>\n ): Promise<DidCommProofFormatCreateReturn> {\n const format = new DidCommProofFormatSpec({\n format: ANONCREDS_PRESENTATION,\n attachmentId,\n })\n const requestJson = requestAttachment.getDataAsJson<AnonCredsProofRequest>()\n\n const anoncredsFormat = proofFormats?.anoncreds\n\n const selectedCredentials =\n anoncredsFormat ??\n (await this._selectCredentialsForRequest(agentContext, requestJson, {\n filterByNonRevocationRequirements: true,\n }))\n\n const proof = await this.createProof(agentContext, requestJson, selectedCredentials)\n const attachment = this.getFormatData(proof, format.attachmentId)\n\n return {\n attachment,\n format,\n }\n }\n\n public async processPresentation(\n agentContext: AgentContext,\n { requestAttachment, attachment }: DidCommProofFormatProcessPresentationOptions\n ): Promise<boolean> {\n const verifierService =\n agentContext.dependencyManager.resolve<AnonCredsVerifierService>(AnonCredsVerifierServiceSymbol)\n\n const proofRequestJson = requestAttachment.getDataAsJson<AnonCredsProofRequest>()\n\n // NOTE: we don't do validation here, as this is handled by the AnonCreds implementation, however\n // this can lead to confusing error messages. We should consider doing validation here as well.\n // Defining a class-transformer/class-validator class seems a bit overkill, and the usage of interfaces\n // for the anoncreds package keeps things simple. Maybe we can try to use something like zod to validate\n const proofJson = attachment.getDataAsJson<AnonCredsProof>()\n\n for (const [referent, attribute] of Object.entries(proofJson.requested_proof.revealed_attrs)) {\n if (!checkValidCredentialValueEncoding(attribute.raw, attribute.encoded)) {\n throw new CredoError(\n `The encoded value for '${referent}' is invalid. ` +\n `Expected '${encodeCredentialValue(attribute.raw)}'. ` +\n `Actual '${attribute.encoded}'`\n )\n }\n }\n\n for (const [, attributeGroup] of Object.entries(proofJson.requested_proof.revealed_attr_groups ?? {})) {\n for (const [attributeName, attribute] of Object.entries(attributeGroup.values)) {\n if (!checkValidCredentialValueEncoding(attribute.raw, attribute.encoded)) {\n throw new CredoError(\n `The encoded value for '${attributeName}' is invalid. ` +\n `Expected '${encodeCredentialValue(attribute.raw)}'. ` +\n `Actual '${attribute.encoded}'`\n )\n }\n }\n }\n\n const schemas = await this.getSchemas(agentContext, new Set(proofJson.identifiers.map((i) => i.schema_id)))\n const credentialDefinitions = await this.getCredentialDefinitions(\n agentContext,\n new Set(proofJson.identifiers.map((i) => i.cred_def_id))\n )\n\n const revocationRegistries = await getRevocationRegistriesForProof(agentContext, proofJson)\n\n const verified = await verifierService.verifyProof(agentContext, {\n proofRequest: proofRequestJson,\n proof: proofJson,\n schemas,\n credentialDefinitions,\n revocationRegistries,\n })\n\n return verified\n }\n\n public async getCredentialsForRequest(\n agentContext: AgentContext,\n { requestAttachment, proofFormats }: DidCommProofFormatGetCredentialsForRequestOptions<AnonCredsDidCommProofFormat>\n ): Promise<DidCommProofFormatGetCredentialsForRequestReturn<AnonCredsDidCommProofFormat>> {\n const proofRequestJson = requestAttachment.getDataAsJson<AnonCredsProofRequest>()\n\n // Set default values\n const { filterByNonRevocationRequirements = true } = proofFormats?.anoncreds ?? {}\n\n const credentialsForRequest = await getCredentialsForAnonCredsProofRequest(agentContext, proofRequestJson, {\n filterByNonRevocationRequirements,\n })\n\n return credentialsForRequest\n }\n\n public async selectCredentialsForRequest(\n agentContext: AgentContext,\n {\n requestAttachment,\n proofFormats,\n }: DidCommProofFormatSelectCredentialsForRequestOptions<AnonCredsDidCommProofFormat>\n ): Promise<DidCommProofFormatSelectCredentialsForRequestReturn<AnonCredsDidCommProofFormat>> {\n const proofRequestJson = requestAttachment.getDataAsJson<AnonCredsProofRequest>()\n\n // Set default values\n const { filterByNonRevocationRequirements = true } = proofFormats?.anoncreds ?? {}\n\n const selectedCredentials = this._selectCredentialsForRequest(agentContext, proofRequestJson, {\n filterByNonRevocationRequirements,\n })\n\n return selectedCredentials\n }\n\n public async shouldAutoRespondToProposal(\n agentContext: AgentContext,\n { proposalAttachment, requestAttachment }: DidCommProofFormatAutoRespondProposalOptions\n ): Promise<boolean> {\n const proposalJson = proposalAttachment.getDataAsJson<AnonCredsProofRequest>()\n const requestJson = requestAttachment.getDataAsJson<AnonCredsProofRequest>()\n\n const areRequestsEqual = areAnonCredsProofRequestsEqual(proposalJson, requestJson)\n agentContext.config.logger.debug(`AnonCreds request and proposal are are equal: ${areRequestsEqual}`, {\n proposalJson,\n requestJson,\n })\n\n return areRequestsEqual\n }\n\n public async shouldAutoRespondToRequest(\n _agentContext: AgentContext,\n { proposalAttachment, requestAttachment }: DidCommProofFormatAutoRespondRequestOptions\n ): Promise<boolean> {\n const proposalJson = proposalAttachment.getDataAsJson<AnonCredsProofRequest>()\n const requestJson = requestAttachment.getDataAsJson<AnonCredsProofRequest>()\n\n return areAnonCredsProofRequestsEqual(proposalJson, requestJson)\n }\n\n public async shouldAutoRespondToPresentation(\n _agentContext: AgentContext,\n _options: DidCommProofFormatAutoRespondPresentationOptions\n ): Promise<boolean> {\n // The presentation is already verified in processPresentation, so we can just return true here.\n // It's only an ack, so it's just that we received the presentation.\n return true\n }\n\n public supportsFormat(formatIdentifier: string): boolean {\n const supportedFormats = [ANONCREDS_PRESENTATION_PROPOSAL, ANONCREDS_PRESENTATION_REQUEST, ANONCREDS_PRESENTATION]\n return supportedFormats.includes(formatIdentifier)\n }\n\n private async _selectCredentialsForRequest(\n agentContext: AgentContext,\n proofRequest: AnonCredsProofRequest,\n options: AnonCredsGetCredentialsForProofRequestOptions\n ): Promise<AnonCredsSelectedCredentials> {\n const credentialsForRequest = await getCredentialsForAnonCredsProofRequest(agentContext, proofRequest, options)\n\n const selectedCredentials: AnonCredsSelectedCredentials = {\n attributes: {},\n predicates: {},\n selfAttestedAttributes: {},\n }\n\n for (const attributeName of Object.keys(credentialsForRequest.attributes)) {\n const attributeArray = credentialsForRequest.attributes[attributeName]\n\n if (attributeArray.length === 0) {\n throw new CredoError('Unable to automatically select requested attributes.')\n }\n\n selectedCredentials.attributes[attributeName] = attributeArray[0]\n }\n\n for (const attributeName of Object.keys(credentialsForRequest.predicates)) {\n if (credentialsForRequest.predicates[attributeName].length === 0) {\n throw new CredoError('Unable to automatically select requested predicates.')\n }\n selectedCredentials.predicates[attributeName] = credentialsForRequest.predicates[attributeName][0]\n }\n\n return selectedCredentials\n }\n\n /**\n * Build schemas object needed to create and verify proof objects.\n *\n * Creates object with `{ schemaId: AnonCredsSchema }` mapping\n *\n * @param schemaIds List of schema ids\n * @returns Object containing schemas for specified schema ids\n *\n */\n private async getSchemas(agentContext: AgentContext, schemaIds: Set<string>) {\n const schemas: { [key: string]: AnonCredsSchema } = {}\n\n for (const schemaId of schemaIds) {\n const { schema } = await fetchSchema(agentContext, schemaId)\n schemas[schemaId] = schema\n }\n\n return schemas\n }\n\n /**\n * Build credential definitions object needed to create and verify proof objects.\n *\n * Creates object with `{ credentialDefinitionId: AnonCredsCredentialDefinition }` mapping\n *\n * @param credentialDefinitionIds List of credential definition ids\n * @returns Object containing credential definitions for specified credential definition ids\n *\n */\n private async getCredentialDefinitions(agentContext: AgentContext, credentialDefinitionIds: Set<string>) {\n const credentialDefinitions: { [key: string]: AnonCredsCredentialDefinition } = {}\n\n for (const credentialDefinitionId of credentialDefinitionIds) {\n const { credentialDefinition } = await fetchCredentialDefinition(agentContext, credentialDefinitionId)\n credentialDefinitions[credentialDefinitionId] = credentialDefinition\n }\n\n return credentialDefinitions\n }\n\n /**\n * Create anoncreds proof from a given proof request and requested credential object.\n *\n * @param proofRequest The proof request to create the proof for\n * @param requestedCredentials The requested credentials object specifying which credentials to use for the proof\n * @returns anoncreds proof object\n */\n private async createProof(\n agentContext: AgentContext,\n proofRequest: AnonCredsProofRequest,\n selectedCredentials: AnonCredsSelectedCredentials\n ): Promise<AnonCredsProof> {\n const holderService = agentContext.dependencyManager.resolve<AnonCredsHolderService>(AnonCredsHolderServiceSymbol)\n\n const credentialObjects = await Promise.all(\n [...Object.values(selectedCredentials.attributes), ...Object.values(selectedCredentials.predicates)].map(\n async (c) =>\n holderService.getCredential(agentContext, {\n id: c.credentialId,\n useUnqualifiedIdentifiersIfPresent: proofRequestUsesUnqualifiedIdentifiers(proofRequest),\n })\n )\n )\n\n const schemas = await this.getSchemas(agentContext, new Set(credentialObjects.map((c) => c.schemaId)))\n const credentialDefinitions = await this.getCredentialDefinitions(\n agentContext,\n new Set(credentialObjects.map((c) => c.credentialDefinitionId))\n )\n\n // selectedCredentials are overridden with specified timestamps of the revocation status list that\n // should be used for the selected credentials.\n const { revocationRegistries, updatedSelectedCredentials } = await getRevocationRegistriesForRequest(\n agentContext,\n proofRequest,\n selectedCredentials\n )\n\n return await holderService.createProof(agentContext, {\n proofRequest,\n selectedCredentials: updatedSelectedCredentials,\n schemas,\n credentialDefinitions,\n revocationRegistries,\n })\n }\n\n /**\n * Returns an object of type {@link DidCommAttachment} for use in credential exchange messages.\n * It looks up the correct format identifier and encodes the data as a base64 attachment.\n *\n * @param data The data to include in the attach object\n * @param id the attach id from the formats component of the message\n */\n private getFormatData(data: unknown, id: string): DidCommAttachment {\n const attachment = new DidCommAttachment({\n id,\n mimeType: 'application/json',\n data: new DidCommAttachmentData({\n base64: JsonEncoder.toBase64(data),\n }),\n })\n\n return attachment\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAkDA,MAAM,kCAAkC;AACxC,MAAM,iCAAiC;AACvC,MAAM,yBAAyB;AAE/B,IAAa,qCAAb,MAAkH;;OAChG,YAAY;;CAE5B,MAAa,eACX,cACA,EAAE,cAAc,gBACyB;EACzC,MAAM,gBAAgB,aAAa,kBAAkB,QAAgC,6BAA6B;EAElH,MAAM,SAAS,IAAI,uBAAuB;GACxC,QAAQ;GACR;GACD,CAAC;EAEF,MAAM,kBAAkB,aAAa;AACrC,MAAI,CAAC,gBACH,OAAM,MAAM,gEAAgE;EAG9E,MAAM,eAAe,yBAAyB;GAC5C,YAAY,gBAAgB,cAAc,EAAE;GAC5C,YAAY,gBAAgB,cAAc,EAAE;GAC5C,MAAM,gBAAgB,QAAQ;GAC9B,SAAS,gBAAgB,WAAW;GACpC,OAAO,cAAc,cAAc,aAAa;GAChD,oBAAoB,gBAAgB;GACrC,CAAC;AAGF,SAAO;GAAE,YAFU,KAAK,cAAc,cAAc,OAAO,aAAa;GAEnD;GAAQ;;CAG/B,MAAa,gBACX,eACA,EAAE,cACa;EACf,MAAM,eAAe,WAAW,eAAsC;AAGtE,kBAAgB,SAAS,cAAcA,sBAA2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GACV,MAAM,IAAI,sBAAsB,EAC9B,QAAQ,YAAY,SAAS,KAAK,EACnC,CAAC;GACH,CAAC"}
1
+ {"version":3,"file":"AnonCredsDidCommProofFormatService.mjs","names":["AnonCredsProofRequestClass","selectedCredentials: AnonCredsSelectedCredentials","schemas: { [key: string]: AnonCredsSchema }","credentialDefinitions: { [key: string]: AnonCredsCredentialDefinition }"],"sources":["../../src/formats/AnonCredsDidCommProofFormatService.ts"],"sourcesContent":["import type { AgentContext } from '@credo-ts/core'\nimport { CredoError, JsonEncoder, JsonTransformer } from '@credo-ts/core'\nimport type {\n DidCommFormatCreateRequestOptions,\n DidCommProofFormatAcceptProposalOptions,\n DidCommProofFormatAcceptRequestOptions,\n DidCommProofFormatAutoRespondPresentationOptions,\n DidCommProofFormatAutoRespondProposalOptions,\n DidCommProofFormatAutoRespondRequestOptions,\n DidCommProofFormatCreateProposalOptions,\n DidCommProofFormatCreateReturn,\n DidCommProofFormatGetCredentialsForRequestOptions,\n DidCommProofFormatGetCredentialsForRequestReturn,\n DidCommProofFormatProcessOptions,\n DidCommProofFormatProcessPresentationOptions,\n DidCommProofFormatSelectCredentialsForRequestOptions,\n DidCommProofFormatSelectCredentialsForRequestReturn,\n DidCommProofFormatService,\n} from '@credo-ts/didcomm'\nimport { DidCommAttachment, DidCommAttachmentData, DidCommProofFormatSpec } from '@credo-ts/didcomm'\nimport type {\n AnonCredsCredentialDefinition,\n AnonCredsProof,\n AnonCredsProofRequest,\n AnonCredsSchema,\n AnonCredsSelectedCredentials,\n} from '../models'\nimport { AnonCredsProofRequest as AnonCredsProofRequestClass } from '../models/AnonCredsProofRequest'\nimport type { AnonCredsHolderService, AnonCredsVerifierService } from '../services'\nimport { AnonCredsHolderServiceSymbol, AnonCredsVerifierServiceSymbol } from '../services'\nimport {\n areAnonCredsProofRequestsEqual,\n assertNoDuplicateGroupsNamesInProofRequest,\n checkValidCredentialValueEncoding,\n createRequestFromPreview,\n fetchCredentialDefinition,\n fetchSchema,\n getRevocationRegistriesForProof,\n getRevocationRegistriesForRequest,\n} from '../utils'\nimport { encodeCredentialValue } from '../utils/credential'\nimport { getCredentialsForAnonCredsProofRequest } from '../utils/getCredentialsForAnonCredsRequest'\nimport { proofRequestUsesUnqualifiedIdentifiers } from '../utils/proofRequest'\nimport type {\n AnonCredsDidCommProofFormat,\n AnonCredsGetCredentialsForProofRequestOptions,\n} from './AnonCredsDidCommProofFormat'\n\nconst ANONCREDS_PRESENTATION_PROPOSAL = 'anoncreds/proof-request@v1.0'\nconst ANONCREDS_PRESENTATION_REQUEST = 'anoncreds/proof-request@v1.0'\nconst ANONCREDS_PRESENTATION = 'anoncreds/proof@v1.0'\n\nexport class AnonCredsDidCommProofFormatService implements DidCommProofFormatService<AnonCredsDidCommProofFormat> {\n public readonly formatKey = 'anoncreds' as const\n\n public async createProposal(\n agentContext: AgentContext,\n { attachmentId, proofFormats }: DidCommProofFormatCreateProposalOptions<AnonCredsDidCommProofFormat>\n ): Promise<DidCommProofFormatCreateReturn> {\n const holderService = agentContext.dependencyManager.resolve<AnonCredsHolderService>(AnonCredsHolderServiceSymbol)\n\n const format = new DidCommProofFormatSpec({\n format: ANONCREDS_PRESENTATION_PROPOSAL,\n attachmentId,\n })\n\n const anoncredsFormat = proofFormats.anoncreds\n if (!anoncredsFormat) {\n throw Error('Missing anoncreds format to create proposal attachment format')\n }\n\n const proofRequest = createRequestFromPreview({\n attributes: anoncredsFormat.attributes ?? [],\n predicates: anoncredsFormat.predicates ?? [],\n name: anoncredsFormat.name ?? 'Proof request',\n version: anoncredsFormat.version ?? '1.0',\n nonce: holderService.generateNonce(agentContext),\n nonRevokedInterval: anoncredsFormat.nonRevokedInterval,\n })\n const attachment = this.getFormatData(proofRequest, format.attachmentId)\n\n return { attachment, format }\n }\n\n public async processProposal(\n _agentContext: AgentContext,\n { attachment }: DidCommProofFormatProcessOptions\n ): Promise<void> {\n const proposalJson = attachment.getDataAsJson<AnonCredsProofRequest>()\n\n // fromJson also validates\n JsonTransformer.fromJSON(proposalJson, AnonCredsProofRequestClass)\n\n // Assert attribute and predicate (group) names do not match\n assertNoDuplicateGroupsNamesInProofRequest(proposalJson)\n }\n\n public async acceptProposal(\n agentContext: AgentContext,\n { proposalAttachment, attachmentId }: DidCommProofFormatAcceptProposalOptions<AnonCredsDidCommProofFormat>\n ): Promise<DidCommProofFormatCreateReturn> {\n const holderService = agentContext.dependencyManager.resolve<AnonCredsHolderService>(AnonCredsHolderServiceSymbol)\n\n const format = new DidCommProofFormatSpec({\n format: ANONCREDS_PRESENTATION_REQUEST,\n attachmentId,\n })\n\n const proposalJson = proposalAttachment.getDataAsJson<AnonCredsProofRequest>()\n\n const request = {\n ...proposalJson,\n // We never want to reuse the nonce from the proposal, as this will allow replay attacks\n nonce: holderService.generateNonce(agentContext),\n }\n\n const attachment = this.getFormatData(request, format.attachmentId)\n\n return { attachment, format }\n }\n\n public async createRequest(\n agentContext: AgentContext,\n { attachmentId, proofFormats }: DidCommFormatCreateRequestOptions<AnonCredsDidCommProofFormat>\n ): Promise<DidCommProofFormatCreateReturn> {\n const holderService = agentContext.dependencyManager.resolve<AnonCredsHolderService>(AnonCredsHolderServiceSymbol)\n const format = new DidCommProofFormatSpec({\n format: ANONCREDS_PRESENTATION_REQUEST,\n attachmentId,\n })\n\n const anoncredsFormat = proofFormats.anoncreds\n if (!anoncredsFormat) {\n throw Error('Missing anoncreds format in create request attachment format')\n }\n\n const request = {\n name: anoncredsFormat.name,\n version: anoncredsFormat.version,\n nonce: holderService.generateNonce(agentContext),\n requested_attributes: anoncredsFormat.requested_attributes ?? {},\n requested_predicates: anoncredsFormat.requested_predicates ?? {},\n non_revoked: anoncredsFormat.non_revoked,\n } satisfies AnonCredsProofRequest\n\n // Assert attribute and predicate (group) names do not match\n assertNoDuplicateGroupsNamesInProofRequest(request)\n\n const attachment = this.getFormatData(request, format.attachmentId)\n\n return { attachment, format }\n }\n\n public async processRequest(\n _agentContext: AgentContext,\n { attachment }: DidCommProofFormatProcessOptions\n ): Promise<void> {\n const requestJson = attachment.getDataAsJson<AnonCredsProofRequest>()\n\n // fromJson also validates\n JsonTransformer.fromJSON(requestJson, AnonCredsProofRequestClass)\n\n // Assert attribute and predicate (group) names do not match\n assertNoDuplicateGroupsNamesInProofRequest(requestJson)\n }\n\n public async acceptRequest(\n agentContext: AgentContext,\n {\n proofFormats,\n requestAttachment,\n attachmentId,\n }: DidCommProofFormatAcceptRequestOptions<AnonCredsDidCommProofFormat>\n ): Promise<DidCommProofFormatCreateReturn> {\n const format = new DidCommProofFormatSpec({\n format: ANONCREDS_PRESENTATION,\n attachmentId,\n })\n const requestJson = requestAttachment.getDataAsJson<AnonCredsProofRequest>()\n\n const anoncredsFormat = proofFormats?.anoncreds\n\n const selectedCredentials =\n anoncredsFormat ??\n (await this._selectCredentialsForRequest(agentContext, requestJson, {\n filterByNonRevocationRequirements: true,\n }))\n\n const proof = await this.createProof(agentContext, requestJson, selectedCredentials)\n const attachment = this.getFormatData(proof, format.attachmentId)\n\n return {\n attachment,\n format,\n }\n }\n\n public async processPresentation(\n agentContext: AgentContext,\n { requestAttachment, attachment }: DidCommProofFormatProcessPresentationOptions\n ): Promise<boolean> {\n const verifierService =\n agentContext.dependencyManager.resolve<AnonCredsVerifierService>(AnonCredsVerifierServiceSymbol)\n\n const proofRequestJson = requestAttachment.getDataAsJson<AnonCredsProofRequest>()\n\n // NOTE: we don't do validation here, as this is handled by the AnonCreds implementation, however\n // this can lead to confusing error messages. We should consider doing validation here as well.\n // Defining a class-transformer/class-validator class seems a bit overkill, and the usage of interfaces\n // for the anoncreds package keeps things simple. Maybe we can try to use something like zod to validate\n const proofJson = attachment.getDataAsJson<AnonCredsProof>()\n\n for (const [referent, attribute] of Object.entries(proofJson.requested_proof.revealed_attrs)) {\n if (!checkValidCredentialValueEncoding(attribute.raw, attribute.encoded)) {\n throw new CredoError(\n `The encoded value for '${referent}' is invalid. ` +\n `Expected '${encodeCredentialValue(attribute.raw)}'. ` +\n `Actual '${attribute.encoded}'`\n )\n }\n }\n\n for (const [, attributeGroup] of Object.entries(proofJson.requested_proof.revealed_attr_groups ?? {})) {\n for (const [attributeName, attribute] of Object.entries(attributeGroup.values)) {\n if (!checkValidCredentialValueEncoding(attribute.raw, attribute.encoded)) {\n throw new CredoError(\n `The encoded value for '${attributeName}' is invalid. ` +\n `Expected '${encodeCredentialValue(attribute.raw)}'. ` +\n `Actual '${attribute.encoded}'`\n )\n }\n }\n }\n\n const schemas = await this.getSchemas(agentContext, new Set(proofJson.identifiers.map((i) => i.schema_id)))\n const credentialDefinitions = await this.getCredentialDefinitions(\n agentContext,\n new Set(proofJson.identifiers.map((i) => i.cred_def_id))\n )\n\n const revocationRegistries = await getRevocationRegistriesForProof(agentContext, proofJson)\n\n const verified = await verifierService.verifyProof(agentContext, {\n proofRequest: proofRequestJson,\n proof: proofJson,\n schemas,\n credentialDefinitions,\n revocationRegistries,\n })\n\n return verified\n }\n\n public async getCredentialsForRequest(\n agentContext: AgentContext,\n { requestAttachment, proofFormats }: DidCommProofFormatGetCredentialsForRequestOptions<AnonCredsDidCommProofFormat>\n ): Promise<DidCommProofFormatGetCredentialsForRequestReturn<AnonCredsDidCommProofFormat>> {\n const proofRequestJson = requestAttachment.getDataAsJson<AnonCredsProofRequest>()\n\n // Set default values\n const { filterByNonRevocationRequirements = true } = proofFormats?.anoncreds ?? {}\n\n const credentialsForRequest = await getCredentialsForAnonCredsProofRequest(agentContext, proofRequestJson, {\n filterByNonRevocationRequirements,\n })\n\n return credentialsForRequest\n }\n\n public async selectCredentialsForRequest(\n agentContext: AgentContext,\n {\n requestAttachment,\n proofFormats,\n }: DidCommProofFormatSelectCredentialsForRequestOptions<AnonCredsDidCommProofFormat>\n ): Promise<DidCommProofFormatSelectCredentialsForRequestReturn<AnonCredsDidCommProofFormat>> {\n const proofRequestJson = requestAttachment.getDataAsJson<AnonCredsProofRequest>()\n\n // Set default values\n const { filterByNonRevocationRequirements = true } = proofFormats?.anoncreds ?? {}\n\n const selectedCredentials = this._selectCredentialsForRequest(agentContext, proofRequestJson, {\n filterByNonRevocationRequirements,\n })\n\n return selectedCredentials\n }\n\n public async shouldAutoRespondToProposal(\n agentContext: AgentContext,\n { proposalAttachment, requestAttachment }: DidCommProofFormatAutoRespondProposalOptions\n ): Promise<boolean> {\n const proposalJson = proposalAttachment.getDataAsJson<AnonCredsProofRequest>()\n const requestJson = requestAttachment.getDataAsJson<AnonCredsProofRequest>()\n\n const areRequestsEqual = areAnonCredsProofRequestsEqual(proposalJson, requestJson)\n agentContext.config.logger.debug(`AnonCreds request and proposal are are equal: ${areRequestsEqual}`, {\n proposalJson,\n requestJson,\n })\n\n return areRequestsEqual\n }\n\n public async shouldAutoRespondToRequest(\n _agentContext: AgentContext,\n { proposalAttachment, requestAttachment }: DidCommProofFormatAutoRespondRequestOptions\n ): Promise<boolean> {\n const proposalJson = proposalAttachment.getDataAsJson<AnonCredsProofRequest>()\n const requestJson = requestAttachment.getDataAsJson<AnonCredsProofRequest>()\n\n return areAnonCredsProofRequestsEqual(proposalJson, requestJson)\n }\n\n public async shouldAutoRespondToPresentation(\n _agentContext: AgentContext,\n _options: DidCommProofFormatAutoRespondPresentationOptions\n ): Promise<boolean> {\n // The presentation is already verified in processPresentation, so we can just return true here.\n // It's only an ack, so it's just that we received the presentation.\n return true\n }\n\n public supportsFormat(formatIdentifier: string): boolean {\n const supportedFormats = [ANONCREDS_PRESENTATION_PROPOSAL, ANONCREDS_PRESENTATION_REQUEST, ANONCREDS_PRESENTATION]\n return supportedFormats.includes(formatIdentifier)\n }\n\n private async _selectCredentialsForRequest(\n agentContext: AgentContext,\n proofRequest: AnonCredsProofRequest,\n options: AnonCredsGetCredentialsForProofRequestOptions\n ): Promise<AnonCredsSelectedCredentials> {\n const credentialsForRequest = await getCredentialsForAnonCredsProofRequest(agentContext, proofRequest, options)\n\n const selectedCredentials: AnonCredsSelectedCredentials = {\n attributes: {},\n predicates: {},\n selfAttestedAttributes: {},\n }\n\n for (const attributeName of Object.keys(credentialsForRequest.attributes)) {\n const attributeArray = credentialsForRequest.attributes[attributeName]\n\n if (attributeArray.length === 0) {\n throw new CredoError('Unable to automatically select requested attributes.')\n }\n\n selectedCredentials.attributes[attributeName] = attributeArray[0]\n }\n\n for (const attributeName of Object.keys(credentialsForRequest.predicates)) {\n if (credentialsForRequest.predicates[attributeName].length === 0) {\n throw new CredoError('Unable to automatically select requested predicates.')\n }\n selectedCredentials.predicates[attributeName] = credentialsForRequest.predicates[attributeName][0]\n }\n\n return selectedCredentials\n }\n\n /**\n * Build schemas object needed to create and verify proof objects.\n *\n * Creates object with `{ schemaId: AnonCredsSchema }` mapping\n *\n * @param schemaIds List of schema ids\n * @returns Object containing schemas for specified schema ids\n *\n */\n private async getSchemas(agentContext: AgentContext, schemaIds: Set<string>) {\n const schemas: { [key: string]: AnonCredsSchema } = {}\n\n for (const schemaId of schemaIds) {\n const { schema } = await fetchSchema(agentContext, schemaId)\n schemas[schemaId] = schema\n }\n\n return schemas\n }\n\n /**\n * Build credential definitions object needed to create and verify proof objects.\n *\n * Creates object with `{ credentialDefinitionId: AnonCredsCredentialDefinition }` mapping\n *\n * @param credentialDefinitionIds List of credential definition ids\n * @returns Object containing credential definitions for specified credential definition ids\n *\n */\n private async getCredentialDefinitions(agentContext: AgentContext, credentialDefinitionIds: Set<string>) {\n const credentialDefinitions: { [key: string]: AnonCredsCredentialDefinition } = {}\n\n for (const credentialDefinitionId of credentialDefinitionIds) {\n const { credentialDefinition } = await fetchCredentialDefinition(agentContext, credentialDefinitionId)\n credentialDefinitions[credentialDefinitionId] = credentialDefinition\n }\n\n return credentialDefinitions\n }\n\n /**\n * Create anoncreds proof from a given proof request and requested credential object.\n *\n * @param proofRequest The proof request to create the proof for\n * @param requestedCredentials The requested credentials object specifying which credentials to use for the proof\n * @returns anoncreds proof object\n */\n private async createProof(\n agentContext: AgentContext,\n proofRequest: AnonCredsProofRequest,\n selectedCredentials: AnonCredsSelectedCredentials\n ): Promise<AnonCredsProof> {\n const holderService = agentContext.dependencyManager.resolve<AnonCredsHolderService>(AnonCredsHolderServiceSymbol)\n\n const credentialObjects = await Promise.all(\n [...Object.values(selectedCredentials.attributes), ...Object.values(selectedCredentials.predicates)].map(\n async (c) =>\n holderService.getCredential(agentContext, {\n id: c.credentialId,\n useUnqualifiedIdentifiersIfPresent: proofRequestUsesUnqualifiedIdentifiers(proofRequest),\n })\n )\n )\n\n const schemas = await this.getSchemas(agentContext, new Set(credentialObjects.map((c) => c.schemaId)))\n const credentialDefinitions = await this.getCredentialDefinitions(\n agentContext,\n new Set(credentialObjects.map((c) => c.credentialDefinitionId))\n )\n\n // selectedCredentials are overridden with specified timestamps of the revocation status list that\n // should be used for the selected credentials.\n const { revocationRegistries, updatedSelectedCredentials } = await getRevocationRegistriesForRequest(\n agentContext,\n proofRequest,\n selectedCredentials\n )\n\n return await holderService.createProof(agentContext, {\n proofRequest,\n selectedCredentials: updatedSelectedCredentials,\n schemas,\n credentialDefinitions,\n revocationRegistries,\n })\n }\n\n /**\n * Returns an object of type {@link DidCommAttachment} for use in credential exchange messages.\n * It looks up the correct format identifier and encodes the data as a base64 attachment.\n *\n * @param data The data to include in the attach object\n * @param id the attach id from the formats component of the message\n */\n private getFormatData(data: unknown, id: string): DidCommAttachment {\n const attachment = new DidCommAttachment({\n id,\n mimeType: 'application/json',\n data: new DidCommAttachmentData({\n base64: JsonEncoder.toBase64(data),\n }),\n })\n\n return attachment\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAgDA,MAAM,kCAAkC;AACxC,MAAM,iCAAiC;AACvC,MAAM,yBAAyB;AAE/B,IAAa,qCAAb,MAAkH;;OAChG,YAAY;;CAE5B,MAAa,eACX,cACA,EAAE,cAAc,gBACyB;EACzC,MAAM,gBAAgB,aAAa,kBAAkB,QAAgC,6BAA6B;EAElH,MAAM,SAAS,IAAI,uBAAuB;GACxC,QAAQ;GACR;GACD,CAAC;EAEF,MAAM,kBAAkB,aAAa;AACrC,MAAI,CAAC,gBAC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