@credo-ts/anoncreds 0.5.0-alpha.101

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 (378) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +35 -0
  3. package/build/AnonCredsApi.d.ts +91 -0
  4. package/build/AnonCredsApi.js +577 -0
  5. package/build/AnonCredsApi.js.map +1 -0
  6. package/build/AnonCredsApiOptions.d.ts +24 -0
  7. package/build/AnonCredsApiOptions.js +3 -0
  8. package/build/AnonCredsApiOptions.js.map +1 -0
  9. package/build/AnonCredsModule.d.ts +19 -0
  10. package/build/AnonCredsModule.js +41 -0
  11. package/build/AnonCredsModule.js.map +1 -0
  12. package/build/AnonCredsModuleConfig.d.ts +28 -0
  13. package/build/AnonCredsModuleConfig.js +23 -0
  14. package/build/AnonCredsModuleConfig.js.map +1 -0
  15. package/build/error/AnonCredsError.d.ts +6 -0
  16. package/build/error/AnonCredsError.js +11 -0
  17. package/build/error/AnonCredsError.js.map +1 -0
  18. package/build/error/AnonCredsStoreRecordError.d.ts +6 -0
  19. package/build/error/AnonCredsStoreRecordError.js +11 -0
  20. package/build/error/AnonCredsStoreRecordError.js.map +1 -0
  21. package/build/error/index.d.ts +2 -0
  22. package/build/error/index.js +19 -0
  23. package/build/error/index.js.map +1 -0
  24. package/build/formats/AnonCredsCredentialFormat.d.ts +79 -0
  25. package/build/formats/AnonCredsCredentialFormat.js +3 -0
  26. package/build/formats/AnonCredsCredentialFormat.js.map +1 -0
  27. package/build/formats/AnonCredsCredentialFormatService.d.ts +80 -0
  28. package/build/formats/AnonCredsCredentialFormatService.js +455 -0
  29. package/build/formats/AnonCredsCredentialFormatService.js.map +1 -0
  30. package/build/formats/AnonCredsProofFormat.d.ts +70 -0
  31. package/build/formats/AnonCredsProofFormat.js +3 -0
  32. package/build/formats/AnonCredsProofFormat.js.map +1 -0
  33. package/build/formats/AnonCredsProofFormatService.d.ts +58 -0
  34. package/build/formats/AnonCredsProofFormatService.js +375 -0
  35. package/build/formats/AnonCredsProofFormatService.js.map +1 -0
  36. package/build/formats/LegacyIndyCredentialFormat.d.ts +32 -0
  37. package/build/formats/LegacyIndyCredentialFormat.js +3 -0
  38. package/build/formats/LegacyIndyCredentialFormat.js.map +1 -0
  39. package/build/formats/LegacyIndyCredentialFormatService.d.ts +80 -0
  40. package/build/formats/LegacyIndyCredentialFormatService.js +414 -0
  41. package/build/formats/LegacyIndyCredentialFormatService.js.map +1 -0
  42. package/build/formats/LegacyIndyProofFormat.d.ts +29 -0
  43. package/build/formats/LegacyIndyProofFormat.js +3 -0
  44. package/build/formats/LegacyIndyProofFormat.js.map +1 -0
  45. package/build/formats/LegacyIndyProofFormatService.d.ts +58 -0
  46. package/build/formats/LegacyIndyProofFormatService.js +384 -0
  47. package/build/formats/LegacyIndyProofFormatService.js.map +1 -0
  48. package/build/formats/index.d.ts +8 -0
  49. package/build/formats/index.js +30 -0
  50. package/build/formats/index.js.map +1 -0
  51. package/build/index.d.ts +16 -0
  52. package/build/index.js +41 -0
  53. package/build/index.js.map +1 -0
  54. package/build/models/AnonCredsCredentialProposal.d.ts +62 -0
  55. package/build/models/AnonCredsCredentialProposal.js +81 -0
  56. package/build/models/AnonCredsCredentialProposal.js.map +1 -0
  57. package/build/models/AnonCredsProofRequest.d.ts +27 -0
  58. package/build/models/AnonCredsProofRequest.js +82 -0
  59. package/build/models/AnonCredsProofRequest.js.map +1 -0
  60. package/build/models/AnonCredsRequestedAttribute.d.ts +16 -0
  61. package/build/models/AnonCredsRequestedAttribute.js +56 -0
  62. package/build/models/AnonCredsRequestedAttribute.js.map +1 -0
  63. package/build/models/AnonCredsRequestedPredicate.d.ts +19 -0
  64. package/build/models/AnonCredsRequestedPredicate.js +61 -0
  65. package/build/models/AnonCredsRequestedPredicate.js.map +1 -0
  66. package/build/models/AnonCredsRestriction.d.ts +55 -0
  67. package/build/models/AnonCredsRestriction.js +160 -0
  68. package/build/models/AnonCredsRestriction.js.map +1 -0
  69. package/build/models/AnonCredsRestrictionWrapper.d.ts +4 -0
  70. package/build/models/AnonCredsRestrictionWrapper.js +25 -0
  71. package/build/models/AnonCredsRestrictionWrapper.js.map +1 -0
  72. package/build/models/AnonCredsRevocationInterval.d.ts +5 -0
  73. package/build/models/AnonCredsRevocationInterval.js +33 -0
  74. package/build/models/AnonCredsRevocationInterval.js.map +1 -0
  75. package/build/models/exchange.d.ts +100 -0
  76. package/build/models/exchange.js +5 -0
  77. package/build/models/exchange.js.map +1 -0
  78. package/build/models/index.d.ts +4 -0
  79. package/build/models/index.js +21 -0
  80. package/build/models/index.js.map +1 -0
  81. package/build/models/internal.d.ts +38 -0
  82. package/build/models/internal.js +3 -0
  83. package/build/models/internal.js.map +1 -0
  84. package/build/models/registry.d.ts +39 -0
  85. package/build/models/registry.js +3 -0
  86. package/build/models/registry.js.map +1 -0
  87. package/build/protocols/credentials/v1/V1CredentialProtocol.d.ts +162 -0
  88. package/build/protocols/credentials/v1/V1CredentialProtocol.js +901 -0
  89. package/build/protocols/credentials/v1/V1CredentialProtocol.js.map +1 -0
  90. package/build/protocols/credentials/v1/errors/V1CredentialProblemReportError.d.ts +10 -0
  91. package/build/protocols/credentials/v1/errors/V1CredentialProblemReportError.js +18 -0
  92. package/build/protocols/credentials/v1/errors/V1CredentialProblemReportError.js.map +1 -0
  93. package/build/protocols/credentials/v1/errors/index.d.ts +1 -0
  94. package/build/protocols/credentials/v1/errors/index.js +6 -0
  95. package/build/protocols/credentials/v1/errors/index.js.map +1 -0
  96. package/build/protocols/credentials/v1/handlers/V1CredentialAckHandler.d.ts +9 -0
  97. package/build/protocols/credentials/v1/handlers/V1CredentialAckHandler.js +15 -0
  98. package/build/protocols/credentials/v1/handlers/V1CredentialAckHandler.js.map +1 -0
  99. package/build/protocols/credentials/v1/handlers/V1CredentialProblemReportHandler.d.ts +9 -0
  100. package/build/protocols/credentials/v1/handlers/V1CredentialProblemReportHandler.js +15 -0
  101. package/build/protocols/credentials/v1/handlers/V1CredentialProblemReportHandler.js.map +1 -0
  102. package/build/protocols/credentials/v1/handlers/V1IssueCredentialHandler.d.ts +10 -0
  103. package/build/protocols/credentials/v1/handlers/V1IssueCredentialHandler.js +40 -0
  104. package/build/protocols/credentials/v1/handlers/V1IssueCredentialHandler.js.map +1 -0
  105. package/build/protocols/credentials/v1/handlers/V1OfferCredentialHandler.d.ts +10 -0
  106. package/build/protocols/credentials/v1/handlers/V1OfferCredentialHandler.js +33 -0
  107. package/build/protocols/credentials/v1/handlers/V1OfferCredentialHandler.js.map +1 -0
  108. package/build/protocols/credentials/v1/handlers/V1ProposeCredentialHandler.d.ts +10 -0
  109. package/build/protocols/credentials/v1/handlers/V1ProposeCredentialHandler.js +38 -0
  110. package/build/protocols/credentials/v1/handlers/V1ProposeCredentialHandler.js.map +1 -0
  111. package/build/protocols/credentials/v1/handlers/V1RequestCredentialHandler.d.ts +10 -0
  112. package/build/protocols/credentials/v1/handlers/V1RequestCredentialHandler.js +40 -0
  113. package/build/protocols/credentials/v1/handlers/V1RequestCredentialHandler.js.map +1 -0
  114. package/build/protocols/credentials/v1/handlers/index.d.ts +6 -0
  115. package/build/protocols/credentials/v1/handlers/index.js +23 -0
  116. package/build/protocols/credentials/v1/handlers/index.js.map +1 -0
  117. package/build/protocols/credentials/v1/index.d.ts +2 -0
  118. package/build/protocols/credentials/v1/index.js +19 -0
  119. package/build/protocols/credentials/v1/index.js.map +1 -0
  120. package/build/protocols/credentials/v1/messages/V1CredentialAckMessage.d.ts +16 -0
  121. package/build/protocols/credentials/v1/messages/V1CredentialAckMessage.js +34 -0
  122. package/build/protocols/credentials/v1/messages/V1CredentialAckMessage.js.map +1 -0
  123. package/build/protocols/credentials/v1/messages/V1CredentialPreview.d.ts +26 -0
  124. package/build/protocols/credentials/v1/messages/V1CredentialPreview.js +69 -0
  125. package/build/protocols/credentials/v1/messages/V1CredentialPreview.js.map +1 -0
  126. package/build/protocols/credentials/v1/messages/V1CredentialProblemReportMessage.d.ts +16 -0
  127. package/build/protocols/credentials/v1/messages/V1CredentialProblemReportMessage.js +34 -0
  128. package/build/protocols/credentials/v1/messages/V1CredentialProblemReportMessage.js.map +1 -0
  129. package/build/protocols/credentials/v1/messages/V1IssueCredentialMessage.d.ts +19 -0
  130. package/build/protocols/credentials/v1/messages/V1IssueCredentialMessage.js +62 -0
  131. package/build/protocols/credentials/v1/messages/V1IssueCredentialMessage.js.map +1 -0
  132. package/build/protocols/credentials/v1/messages/V1OfferCredentialMessage.d.ts +27 -0
  133. package/build/protocols/credentials/v1/messages/V1OfferCredentialMessage.js +75 -0
  134. package/build/protocols/credentials/v1/messages/V1OfferCredentialMessage.js.map +1 -0
  135. package/build/protocols/credentials/v1/messages/V1ProposeCredentialMessage.d.ts +59 -0
  136. package/build/protocols/credentials/v1/messages/V1ProposeCredentialMessage.js +109 -0
  137. package/build/protocols/credentials/v1/messages/V1ProposeCredentialMessage.js.map +1 -0
  138. package/build/protocols/credentials/v1/messages/V1RequestCredentialMessage.d.ts +19 -0
  139. package/build/protocols/credentials/v1/messages/V1RequestCredentialMessage.js +61 -0
  140. package/build/protocols/credentials/v1/messages/V1RequestCredentialMessage.js.map +1 -0
  141. package/build/protocols/credentials/v1/messages/index.d.ts +7 -0
  142. package/build/protocols/credentials/v1/messages/index.js +24 -0
  143. package/build/protocols/credentials/v1/messages/index.js.map +1 -0
  144. package/build/protocols/index.d.ts +2 -0
  145. package/build/protocols/index.js +19 -0
  146. package/build/protocols/index.js.map +1 -0
  147. package/build/protocols/proofs/v1/V1ProofProtocol.d.ts +50 -0
  148. package/build/protocols/proofs/v1/V1ProofProtocol.js +826 -0
  149. package/build/protocols/proofs/v1/V1ProofProtocol.js.map +1 -0
  150. package/build/protocols/proofs/v1/errors/V1PresentationProblemReportError.d.ts +12 -0
  151. package/build/protocols/proofs/v1/errors/V1PresentationProblemReportError.js +19 -0
  152. package/build/protocols/proofs/v1/errors/V1PresentationProblemReportError.js.map +1 -0
  153. package/build/protocols/proofs/v1/errors/index.d.ts +1 -0
  154. package/build/protocols/proofs/v1/errors/index.js +18 -0
  155. package/build/protocols/proofs/v1/errors/index.js.map +1 -0
  156. package/build/protocols/proofs/v1/handlers/V1PresentationAckHandler.d.ts +9 -0
  157. package/build/protocols/proofs/v1/handlers/V1PresentationAckHandler.js +15 -0
  158. package/build/protocols/proofs/v1/handlers/V1PresentationAckHandler.js.map +1 -0
  159. package/build/protocols/proofs/v1/handlers/V1PresentationHandler.d.ts +10 -0
  160. package/build/protocols/proofs/v1/handlers/V1PresentationHandler.js +40 -0
  161. package/build/protocols/proofs/v1/handlers/V1PresentationHandler.js.map +1 -0
  162. package/build/protocols/proofs/v1/handlers/V1PresentationProblemReportHandler.d.ts +9 -0
  163. package/build/protocols/proofs/v1/handlers/V1PresentationProblemReportHandler.js +15 -0
  164. package/build/protocols/proofs/v1/handlers/V1PresentationProblemReportHandler.js.map +1 -0
  165. package/build/protocols/proofs/v1/handlers/V1ProposePresentationHandler.d.ts +11 -0
  166. package/build/protocols/proofs/v1/handlers/V1ProposePresentationHandler.js +38 -0
  167. package/build/protocols/proofs/v1/handlers/V1ProposePresentationHandler.js.map +1 -0
  168. package/build/protocols/proofs/v1/handlers/V1RequestPresentationHandler.d.ts +10 -0
  169. package/build/protocols/proofs/v1/handlers/V1RequestPresentationHandler.js +35 -0
  170. package/build/protocols/proofs/v1/handlers/V1RequestPresentationHandler.js.map +1 -0
  171. package/build/protocols/proofs/v1/handlers/index.d.ts +5 -0
  172. package/build/protocols/proofs/v1/handlers/index.js +22 -0
  173. package/build/protocols/proofs/v1/handlers/index.js.map +1 -0
  174. package/build/protocols/proofs/v1/index.d.ts +4 -0
  175. package/build/protocols/proofs/v1/index.js +21 -0
  176. package/build/protocols/proofs/v1/index.js.map +1 -0
  177. package/build/protocols/proofs/v1/messages/V1PresentationAckMessage.d.ts +8 -0
  178. package/build/protocols/proofs/v1/messages/V1PresentationAckMessage.js +27 -0
  179. package/build/protocols/proofs/v1/messages/V1PresentationAckMessage.js.map +1 -0
  180. package/build/protocols/proofs/v1/messages/V1PresentationMessage.d.ts +31 -0
  181. package/build/protocols/proofs/v1/messages/V1PresentationMessage.js +67 -0
  182. package/build/protocols/proofs/v1/messages/V1PresentationMessage.js.map +1 -0
  183. package/build/protocols/proofs/v1/messages/V1PresentationProblemReportMessage.d.ts +16 -0
  184. package/build/protocols/proofs/v1/messages/V1PresentationProblemReportMessage.js +34 -0
  185. package/build/protocols/proofs/v1/messages/V1PresentationProblemReportMessage.js.map +1 -0
  186. package/build/protocols/proofs/v1/messages/V1ProposePresentationMessage.d.ts +26 -0
  187. package/build/protocols/proofs/v1/messages/V1ProposePresentationMessage.js +53 -0
  188. package/build/protocols/proofs/v1/messages/V1ProposePresentationMessage.js.map +1 -0
  189. package/build/protocols/proofs/v1/messages/V1RequestPresentationMessage.d.ts +29 -0
  190. package/build/protocols/proofs/v1/messages/V1RequestPresentationMessage.js +65 -0
  191. package/build/protocols/proofs/v1/messages/V1RequestPresentationMessage.js.map +1 -0
  192. package/build/protocols/proofs/v1/messages/index.d.ts +5 -0
  193. package/build/protocols/proofs/v1/messages/index.js +22 -0
  194. package/build/protocols/proofs/v1/messages/index.js.map +1 -0
  195. package/build/protocols/proofs/v1/models/V1PresentationPreview.d.ts +50 -0
  196. package/build/protocols/proofs/v1/models/V1PresentationPreview.js +130 -0
  197. package/build/protocols/proofs/v1/models/V1PresentationPreview.js.map +1 -0
  198. package/build/protocols/proofs/v1/models/index.d.ts +1 -0
  199. package/build/protocols/proofs/v1/models/index.js +18 -0
  200. package/build/protocols/proofs/v1/models/index.js.map +1 -0
  201. package/build/repository/AnonCredsCredentialDefinitionPrivateRecord.d.ts +20 -0
  202. package/build/repository/AnonCredsCredentialDefinitionPrivateRecord.js +22 -0
  203. package/build/repository/AnonCredsCredentialDefinitionPrivateRecord.js.map +1 -0
  204. package/build/repository/AnonCredsCredentialDefinitionPrivateRepository.d.ts +8 -0
  205. package/build/repository/AnonCredsCredentialDefinitionPrivateRepository.js +35 -0
  206. package/build/repository/AnonCredsCredentialDefinitionPrivateRepository.js.map +1 -0
  207. package/build/repository/AnonCredsCredentialDefinitionRecord.d.ts +38 -0
  208. package/build/repository/AnonCredsCredentialDefinitionRecord.js +29 -0
  209. package/build/repository/AnonCredsCredentialDefinitionRecord.js.map +1 -0
  210. package/build/repository/AnonCredsCredentialDefinitionRepository.d.ts +8 -0
  211. package/build/repository/AnonCredsCredentialDefinitionRepository.js +53 -0
  212. package/build/repository/AnonCredsCredentialDefinitionRepository.js.map +1 -0
  213. package/build/repository/AnonCredsCredentialRecord.d.ts +48 -0
  214. package/build/repository/AnonCredsCredentialRecord.js +37 -0
  215. package/build/repository/AnonCredsCredentialRecord.js.map +1 -0
  216. package/build/repository/AnonCredsCredentialRepository.d.ts +10 -0
  217. package/build/repository/AnonCredsCredentialRepository.js +41 -0
  218. package/build/repository/AnonCredsCredentialRepository.js.map +1 -0
  219. package/build/repository/AnonCredsKeyCorrectnessProofRecord.d.ts +20 -0
  220. package/build/repository/AnonCredsKeyCorrectnessProofRecord.js +22 -0
  221. package/build/repository/AnonCredsKeyCorrectnessProofRecord.js.map +1 -0
  222. package/build/repository/AnonCredsKeyCorrectnessProofRepository.d.ts +8 -0
  223. package/build/repository/AnonCredsKeyCorrectnessProofRepository.js +35 -0
  224. package/build/repository/AnonCredsKeyCorrectnessProofRepository.js.map +1 -0
  225. package/build/repository/AnonCredsLinkSecretRecord.d.ts +23 -0
  226. package/build/repository/AnonCredsLinkSecretRecord.js +22 -0
  227. package/build/repository/AnonCredsLinkSecretRecord.js.map +1 -0
  228. package/build/repository/AnonCredsLinkSecretRepository.d.ts +10 -0
  229. package/build/repository/AnonCredsLinkSecretRepository.js +41 -0
  230. package/build/repository/AnonCredsLinkSecretRepository.js.map +1 -0
  231. package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRecord.d.ts +34 -0
  232. package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRecord.js +30 -0
  233. package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRecord.js.map +1 -0
  234. package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.d.ts +10 -0
  235. package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.js +38 -0
  236. package/build/repository/AnonCredsRevocationRegistryDefinitionPrivateRepository.js.map +1 -0
  237. package/build/repository/AnonCredsRevocationRegistryDefinitionRecord.d.ts +24 -0
  238. package/build/repository/AnonCredsRevocationRegistryDefinitionRecord.js +22 -0
  239. package/build/repository/AnonCredsRevocationRegistryDefinitionRecord.js.map +1 -0
  240. package/build/repository/AnonCredsRevocationRegistryDefinitionRepository.d.ts +9 -0
  241. package/build/repository/AnonCredsRevocationRegistryDefinitionRepository.js +38 -0
  242. package/build/repository/AnonCredsRevocationRegistryDefinitionRepository.js.map +1 -0
  243. package/build/repository/AnonCredsSchemaRecord.d.ts +38 -0
  244. package/build/repository/AnonCredsSchemaRecord.js +29 -0
  245. package/build/repository/AnonCredsSchemaRecord.js.map +1 -0
  246. package/build/repository/AnonCredsSchemaRepository.d.ts +8 -0
  247. package/build/repository/AnonCredsSchemaRepository.js +53 -0
  248. package/build/repository/AnonCredsSchemaRepository.js.map +1 -0
  249. package/build/repository/anonCredsCredentialDefinitionRecordMetadataTypes.d.ts +9 -0
  250. package/build/repository/anonCredsCredentialDefinitionRecordMetadataTypes.js +9 -0
  251. package/build/repository/anonCredsCredentialDefinitionRecordMetadataTypes.js.map +1 -0
  252. package/build/repository/anonCredsRevocationRegistryDefinitionRecordMetadataTypes.d.ts +9 -0
  253. package/build/repository/anonCredsRevocationRegistryDefinitionRecordMetadataTypes.js +9 -0
  254. package/build/repository/anonCredsRevocationRegistryDefinitionRecordMetadataTypes.js.map +1 -0
  255. package/build/repository/anonCredsSchemaRecordMetadataTypes.d.ts +9 -0
  256. package/build/repository/anonCredsSchemaRecordMetadataTypes.js +9 -0
  257. package/build/repository/anonCredsSchemaRecordMetadataTypes.js.map +1 -0
  258. package/build/repository/index.d.ts +16 -0
  259. package/build/repository/index.js +33 -0
  260. package/build/repository/index.js.map +1 -0
  261. package/build/services/AnonCredsHolderService.d.ts +15 -0
  262. package/build/services/AnonCredsHolderService.js +5 -0
  263. package/build/services/AnonCredsHolderService.js.map +1 -0
  264. package/build/services/AnonCredsHolderServiceOptions.d.ts +82 -0
  265. package/build/services/AnonCredsHolderServiceOptions.js +3 -0
  266. package/build/services/AnonCredsHolderServiceOptions.js.map +1 -0
  267. package/build/services/AnonCredsIssuerService.d.ts +14 -0
  268. package/build/services/AnonCredsIssuerService.js +5 -0
  269. package/build/services/AnonCredsIssuerService.js.map +1 -0
  270. package/build/services/AnonCredsIssuerServiceOptions.d.ts +61 -0
  271. package/build/services/AnonCredsIssuerServiceOptions.js +3 -0
  272. package/build/services/AnonCredsIssuerServiceOptions.js.map +1 -0
  273. package/build/services/AnonCredsVerifierService.d.ts +6 -0
  274. package/build/services/AnonCredsVerifierService.js +5 -0
  275. package/build/services/AnonCredsVerifierService.js.map +1 -0
  276. package/build/services/AnonCredsVerifierServiceOptions.d.ts +20 -0
  277. package/build/services/AnonCredsVerifierServiceOptions.js +3 -0
  278. package/build/services/AnonCredsVerifierServiceOptions.js.map +1 -0
  279. package/build/services/index.d.ts +8 -0
  280. package/build/services/index.js +27 -0
  281. package/build/services/index.js.map +1 -0
  282. package/build/services/registry/AnonCredsRegistry.d.ts +25 -0
  283. package/build/services/registry/AnonCredsRegistry.js +3 -0
  284. package/build/services/registry/AnonCredsRegistry.js.map +1 -0
  285. package/build/services/registry/AnonCredsRegistryService.d.ts +10 -0
  286. package/build/services/registry/AnonCredsRegistryService.js +33 -0
  287. package/build/services/registry/AnonCredsRegistryService.js.map +1 -0
  288. package/build/services/registry/CredentialDefinitionOptions.d.ts +34 -0
  289. package/build/services/registry/CredentialDefinitionOptions.js +3 -0
  290. package/build/services/registry/CredentialDefinitionOptions.js.map +1 -0
  291. package/build/services/registry/RevocationRegistryDefinitionOptions.d.ts +34 -0
  292. package/build/services/registry/RevocationRegistryDefinitionOptions.js +3 -0
  293. package/build/services/registry/RevocationRegistryDefinitionOptions.js.map +1 -0
  294. package/build/services/registry/RevocationStatusListOptions.d.ts +32 -0
  295. package/build/services/registry/RevocationStatusListOptions.js +3 -0
  296. package/build/services/registry/RevocationStatusListOptions.js.map +1 -0
  297. package/build/services/registry/SchemaOptions.d.ts +34 -0
  298. package/build/services/registry/SchemaOptions.js +3 -0
  299. package/build/services/registry/SchemaOptions.js.map +1 -0
  300. package/build/services/registry/base.d.ts +19 -0
  301. package/build/services/registry/base.js +3 -0
  302. package/build/services/registry/base.js.map +1 -0
  303. package/build/services/registry/index.d.ts +7 -0
  304. package/build/services/registry/index.js +23 -0
  305. package/build/services/registry/index.js.map +1 -0
  306. package/build/services/tails/BasicTailsFileService.d.ts +23 -0
  307. package/build/services/tails/BasicTailsFileService.js +65 -0
  308. package/build/services/tails/BasicTailsFileService.js.map +1 -0
  309. package/build/services/tails/TailsFileService.d.ts +42 -0
  310. package/build/services/tails/TailsFileService.js +3 -0
  311. package/build/services/tails/TailsFileService.js.map +1 -0
  312. package/build/services/tails/index.d.ts +2 -0
  313. package/build/services/tails/index.js +19 -0
  314. package/build/services/tails/index.js.map +1 -0
  315. package/build/updates/0.3.1-0.4/credentialDefinition.d.ts +18 -0
  316. package/build/updates/0.3.1-0.4/credentialDefinition.js +57 -0
  317. package/build/updates/0.3.1-0.4/credentialDefinition.js.map +1 -0
  318. package/build/updates/0.3.1-0.4/credentialExchangeRecord.d.ts +69 -0
  319. package/build/updates/0.3.1-0.4/credentialExchangeRecord.js +122 -0
  320. package/build/updates/0.3.1-0.4/credentialExchangeRecord.js.map +1 -0
  321. package/build/updates/0.3.1-0.4/index.d.ts +2 -0
  322. package/build/updates/0.3.1-0.4/index.js +15 -0
  323. package/build/updates/0.3.1-0.4/index.js.map +1 -0
  324. package/build/updates/0.3.1-0.4/linkSecret.d.ts +6 -0
  325. package/build/updates/0.3.1-0.4/linkSecret.js +36 -0
  326. package/build/updates/0.3.1-0.4/linkSecret.js.map +1 -0
  327. package/build/updates/0.3.1-0.4/schema.d.ts +15 -0
  328. package/build/updates/0.3.1-0.4/schema.js +42 -0
  329. package/build/updates/0.3.1-0.4/schema.js.map +1 -0
  330. package/build/utils/areRequestsEqual.d.ts +6 -0
  331. package/build/utils/areRequestsEqual.js +136 -0
  332. package/build/utils/areRequestsEqual.js.map +1 -0
  333. package/build/utils/composeAutoAccept.d.ts +15 -0
  334. package/build/utils/composeAutoAccept.js +27 -0
  335. package/build/utils/composeAutoAccept.js.map +1 -0
  336. package/build/utils/createRequestFromPreview.d.ts +10 -0
  337. package/build/utils/createRequestFromPreview.js +72 -0
  338. package/build/utils/createRequestFromPreview.js.map +1 -0
  339. package/build/utils/credential.d.ts +62 -0
  340. package/build/utils/credential.js +169 -0
  341. package/build/utils/credential.js.map +1 -0
  342. package/build/utils/credentialPreviewAttributes.d.ts +2 -0
  343. package/build/utils/credentialPreviewAttributes.js +25 -0
  344. package/build/utils/credentialPreviewAttributes.js.map +1 -0
  345. package/build/utils/getRevocationRegistries.d.ts +22 -0
  346. package/build/utils/getRevocationRegistries.js +152 -0
  347. package/build/utils/getRevocationRegistries.js.map +1 -0
  348. package/build/utils/hasDuplicateGroupNames.d.ts +2 -0
  349. package/build/utils/hasDuplicateGroupNames.js +23 -0
  350. package/build/utils/hasDuplicateGroupNames.js.map +1 -0
  351. package/build/utils/index.d.ts +13 -0
  352. package/build/utils/index.js +36 -0
  353. package/build/utils/index.js.map +1 -0
  354. package/build/utils/indyIdentifiers.d.ts +48 -0
  355. package/build/utils/indyIdentifiers.js +146 -0
  356. package/build/utils/indyIdentifiers.js.map +1 -0
  357. package/build/utils/isMap.d.ts +5 -0
  358. package/build/utils/isMap.js +18 -0
  359. package/build/utils/isMap.js.map +1 -0
  360. package/build/utils/linkSecret.d.ts +7 -0
  361. package/build/utils/linkSecret.js +24 -0
  362. package/build/utils/linkSecret.js.map +1 -0
  363. package/build/utils/metadata.d.ts +24 -0
  364. package/build/utils/metadata.js +18 -0
  365. package/build/utils/metadata.js.map +1 -0
  366. package/build/utils/proverDid.d.ts +8 -0
  367. package/build/utils/proverDid.js +16 -0
  368. package/build/utils/proverDid.js.map +1 -0
  369. package/build/utils/revocationInterval.d.ts +7 -0
  370. package/build/utils/revocationInterval.js +15 -0
  371. package/build/utils/revocationInterval.js.map +1 -0
  372. package/build/utils/sortRequestedCredentialsMatches.d.ts +8 -0
  373. package/build/utils/sortRequestedCredentialsMatches.js +33 -0
  374. package/build/utils/sortRequestedCredentialsMatches.js.map +1 -0
  375. package/build/utils/timestamp.d.ts +1 -0
  376. package/build/utils/timestamp.js +7 -0
  377. package/build/utils/timestamp.js.map +1 -0
  378. package/package.json +41 -0
@@ -0,0 +1,414 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.LegacyIndyCredentialFormatService = void 0;
15
+ const core_1 = require("@credo-ts/core");
16
+ const error_1 = require("../error");
17
+ const AnonCredsCredentialProposal_1 = require("../models/AnonCredsCredentialProposal");
18
+ const services_1 = require("../services");
19
+ const AnonCredsRegistryService_1 = require("../services/registry/AnonCredsRegistryService");
20
+ const credential_1 = require("../utils/credential");
21
+ const indyIdentifiers_1 = require("../utils/indyIdentifiers");
22
+ const metadata_1 = require("../utils/metadata");
23
+ const proverDid_1 = require("../utils/proverDid");
24
+ const INDY_CRED_ABSTRACT = 'hlindy/cred-abstract@v2.0';
25
+ const INDY_CRED_REQUEST = 'hlindy/cred-req@v2.0';
26
+ const INDY_CRED_FILTER = 'hlindy/cred-filter@v2.0';
27
+ const INDY_CRED = 'hlindy/cred@v2.0';
28
+ class LegacyIndyCredentialFormatService {
29
+ constructor() {
30
+ /** formatKey is the key used when calling agent.credentials.xxx with credentialFormats.indy */
31
+ this.formatKey = 'indy';
32
+ /**
33
+ * credentialRecordType is the type of record that stores the credential. It is stored in the credential
34
+ * record binding in the credential exchange record.
35
+ */
36
+ this.credentialRecordType = 'anoncreds';
37
+ }
38
+ /**
39
+ * Create a {@link AttachmentFormats} object dependent on the message type.
40
+ *
41
+ * @param options The object containing all the options for the proposed credential
42
+ * @returns object containing associated attachment, format and optionally the credential preview
43
+ *
44
+ */
45
+ async createProposal(agentContext, { credentialFormats, credentialRecord }) {
46
+ const format = new core_1.CredentialFormatSpec({
47
+ format: INDY_CRED_FILTER,
48
+ });
49
+ const indyFormat = credentialFormats.indy;
50
+ if (!indyFormat) {
51
+ throw new core_1.AriesFrameworkError('Missing indy payload in createProposal');
52
+ }
53
+ // We want all properties except for `attributes` and `linkedAttachments` attributes.
54
+ // The easiest way is to destructure and use the spread operator. But that leaves the other properties unused
55
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
56
+ const { attributes, linkedAttachments } = indyFormat, indyCredentialProposal = __rest(indyFormat, ["attributes", "linkedAttachments"]);
57
+ const proposal = new AnonCredsCredentialProposal_1.AnonCredsCredentialProposal(indyCredentialProposal);
58
+ try {
59
+ core_1.MessageValidator.validateSync(proposal);
60
+ }
61
+ catch (error) {
62
+ throw new core_1.AriesFrameworkError(`Invalid proposal supplied: ${indyCredentialProposal} in Indy Format Service`);
63
+ }
64
+ const attachment = this.getFormatData(core_1.JsonTransformer.toJSON(proposal), format.attachmentId);
65
+ const { previewAttributes } = this.getCredentialLinkedAttachments(indyFormat.attributes, indyFormat.linkedAttachments);
66
+ // Set the metadata
67
+ credentialRecord.metadata.set(metadata_1.AnonCredsCredentialMetadataKey, {
68
+ schemaId: proposal.schemaId,
69
+ credentialDefinitionId: proposal.credentialDefinitionId,
70
+ });
71
+ return { format, attachment, previewAttributes };
72
+ }
73
+ async processProposal(agentContext, { attachment }) {
74
+ const proposalJson = attachment.getDataAsJson();
75
+ core_1.JsonTransformer.fromJSON(proposalJson, AnonCredsCredentialProposal_1.AnonCredsCredentialProposal);
76
+ }
77
+ async acceptProposal(agentContext, { attachmentId, credentialFormats, credentialRecord, proposalAttachment, }) {
78
+ var _a, _b;
79
+ const indyFormat = credentialFormats === null || credentialFormats === void 0 ? void 0 : credentialFormats.indy;
80
+ const proposalJson = proposalAttachment.getDataAsJson();
81
+ const credentialDefinitionId = (_a = indyFormat === null || indyFormat === void 0 ? void 0 : indyFormat.credentialDefinitionId) !== null && _a !== void 0 ? _a : proposalJson.cred_def_id;
82
+ const attributes = (_b = indyFormat === null || indyFormat === void 0 ? void 0 : indyFormat.attributes) !== null && _b !== void 0 ? _b : credentialRecord.credentialAttributes;
83
+ if (!credentialDefinitionId) {
84
+ throw new core_1.AriesFrameworkError('No credential definition id in proposal or provided as input to accept proposal method.');
85
+ }
86
+ if (!(0, indyIdentifiers_1.isUnqualifiedCredentialDefinitionId)(credentialDefinitionId)) {
87
+ throw new core_1.AriesFrameworkError(`${credentialDefinitionId} is not a valid legacy indy credential definition id`);
88
+ }
89
+ if (!attributes) {
90
+ throw new core_1.AriesFrameworkError('No attributes in proposal or provided as input to accept proposal method.');
91
+ }
92
+ const { format, attachment, previewAttributes } = await this.createIndyOffer(agentContext, {
93
+ credentialRecord,
94
+ attachmentId,
95
+ attributes,
96
+ credentialDefinitionId,
97
+ linkedAttachments: indyFormat === null || indyFormat === void 0 ? void 0 : indyFormat.linkedAttachments,
98
+ });
99
+ return { format, attachment, previewAttributes };
100
+ }
101
+ /**
102
+ * Create a credential attachment format for a credential request.
103
+ *
104
+ * @param options The object containing all the options for the credential offer
105
+ * @returns object containing associated attachment, formats and offersAttach elements
106
+ *
107
+ */
108
+ async createOffer(agentContext, { credentialFormats, credentialRecord, attachmentId, }) {
109
+ const indyFormat = credentialFormats.indy;
110
+ if (!indyFormat) {
111
+ throw new core_1.AriesFrameworkError('Missing indy credentialFormat data');
112
+ }
113
+ const { format, attachment, previewAttributes } = await this.createIndyOffer(agentContext, {
114
+ credentialRecord,
115
+ attachmentId,
116
+ attributes: indyFormat.attributes,
117
+ credentialDefinitionId: indyFormat.credentialDefinitionId,
118
+ linkedAttachments: indyFormat.linkedAttachments,
119
+ });
120
+ return { format, attachment, previewAttributes };
121
+ }
122
+ async processOffer(agentContext, { attachment, credentialRecord }) {
123
+ agentContext.config.logger.debug(`Processing indy credential offer for credential record ${credentialRecord.id}`);
124
+ const credOffer = attachment.getDataAsJson();
125
+ if (!(0, indyIdentifiers_1.isUnqualifiedSchemaId)(credOffer.schema_id) || !(0, indyIdentifiers_1.isUnqualifiedCredentialDefinitionId)(credOffer.cred_def_id)) {
126
+ throw new core_1.ProblemReportError('Invalid credential offer', {
127
+ problemCode: core_1.CredentialProblemReportReason.IssuanceAbandoned,
128
+ });
129
+ }
130
+ }
131
+ async acceptOffer(agentContext, { credentialRecord, attachmentId, offerAttachment, credentialFormats, }) {
132
+ var _a;
133
+ const registryService = agentContext.dependencyManager.resolve(AnonCredsRegistryService_1.AnonCredsRegistryService);
134
+ const holderService = agentContext.dependencyManager.resolve(services_1.AnonCredsHolderServiceSymbol);
135
+ const credentialOffer = offerAttachment.getDataAsJson();
136
+ if (!(0, indyIdentifiers_1.isUnqualifiedCredentialDefinitionId)(credentialOffer.cred_def_id)) {
137
+ throw new core_1.AriesFrameworkError(`${credentialOffer.cred_def_id} is not a valid legacy indy credential definition id`);
138
+ }
139
+ // Get credential definition
140
+ const registry = registryService.getRegistryForIdentifier(agentContext, credentialOffer.cred_def_id);
141
+ const { credentialDefinition, resolutionMetadata } = await registry.getCredentialDefinition(agentContext, credentialOffer.cred_def_id);
142
+ if (!credentialDefinition) {
143
+ throw new error_1.AnonCredsError(`Unable to retrieve credential definition with id ${credentialOffer.cred_def_id}: ${resolutionMetadata.error} ${resolutionMetadata.message}`);
144
+ }
145
+ const { credentialRequest, credentialRequestMetadata } = await holderService.createCredentialRequest(agentContext, {
146
+ credentialOffer,
147
+ credentialDefinition,
148
+ linkSecretId: (_a = credentialFormats === null || credentialFormats === void 0 ? void 0 : credentialFormats.indy) === null || _a === void 0 ? void 0 : _a.linkSecretId,
149
+ useLegacyProverDid: true,
150
+ });
151
+ if (!credentialRequest.prover_did) {
152
+ // We just generate a prover did like string, as it's not used for anything and we don't need
153
+ // to prove ownership of the did. It's deprecated in AnonCreds v1, but kept for backwards compatibility
154
+ credentialRequest.prover_did = (0, proverDid_1.generateLegacyProverDidLikeString)();
155
+ }
156
+ credentialRecord.metadata.set(metadata_1.AnonCredsCredentialRequestMetadataKey, credentialRequestMetadata);
157
+ credentialRecord.metadata.set(metadata_1.AnonCredsCredentialMetadataKey, {
158
+ credentialDefinitionId: credentialOffer.cred_def_id,
159
+ schemaId: credentialOffer.schema_id,
160
+ });
161
+ const format = new core_1.CredentialFormatSpec({
162
+ attachmentId,
163
+ format: INDY_CRED_REQUEST,
164
+ });
165
+ const attachment = this.getFormatData(credentialRequest, format.attachmentId);
166
+ return { format, attachment };
167
+ }
168
+ /**
169
+ * Starting from a request is not supported for indy credentials, this method only throws an error.
170
+ */
171
+ async createRequest() {
172
+ throw new core_1.AriesFrameworkError('Starting from a request is not supported for indy credentials');
173
+ }
174
+ /**
175
+ * We don't have any models to validate an indy request object, for now this method does nothing
176
+ */
177
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
178
+ async processRequest(agentContext, options) {
179
+ // not needed for Indy
180
+ }
181
+ async acceptRequest(agentContext, { credentialRecord, attachmentId, offerAttachment, requestAttachment, }) {
182
+ // Assert credential attributes
183
+ const credentialAttributes = credentialRecord.credentialAttributes;
184
+ if (!credentialAttributes) {
185
+ throw new core_1.AriesFrameworkError(`Missing required credential attribute values on credential record with id ${credentialRecord.id}`);
186
+ }
187
+ const anonCredsIssuerService = agentContext.dependencyManager.resolve(services_1.AnonCredsIssuerServiceSymbol);
188
+ const credentialOffer = offerAttachment === null || offerAttachment === void 0 ? void 0 : offerAttachment.getDataAsJson();
189
+ if (!credentialOffer)
190
+ throw new core_1.AriesFrameworkError('Missing indy credential offer in createCredential');
191
+ const credentialRequest = requestAttachment.getDataAsJson();
192
+ if (!credentialRequest)
193
+ throw new core_1.AriesFrameworkError('Missing indy credential request in createCredential');
194
+ const { credential, credentialRevocationId } = await anonCredsIssuerService.createCredential(agentContext, {
195
+ credentialOffer,
196
+ credentialRequest,
197
+ credentialValues: (0, credential_1.convertAttributesToCredentialValues)(credentialAttributes),
198
+ });
199
+ if (credential.rev_reg_id) {
200
+ credentialRecord.metadata.add(metadata_1.AnonCredsCredentialMetadataKey, {
201
+ credentialRevocationId: credentialRevocationId,
202
+ revocationRegistryId: credential.rev_reg_id,
203
+ });
204
+ credentialRecord.setTags({
205
+ anonCredsRevocationRegistryId: credential.rev_reg_id,
206
+ anonCredsCredentialRevocationId: credentialRevocationId,
207
+ });
208
+ }
209
+ const format = new core_1.CredentialFormatSpec({
210
+ attachmentId,
211
+ format: INDY_CRED,
212
+ });
213
+ const attachment = this.getFormatData(credential, format.attachmentId);
214
+ return { format, attachment };
215
+ }
216
+ /**
217
+ * Processes an incoming credential - retrieve metadata, retrieve payload and store it in the Indy wallet
218
+ * @param options the issue credential message wrapped inside this object
219
+ * @param credentialRecord the credential exchange record for this credential
220
+ */
221
+ async processCredential(agentContext, { credentialRecord, attachment }) {
222
+ const credentialRequestMetadata = credentialRecord.metadata.get(metadata_1.AnonCredsCredentialRequestMetadataKey);
223
+ const registryService = agentContext.dependencyManager.resolve(AnonCredsRegistryService_1.AnonCredsRegistryService);
224
+ const anonCredsHolderService = agentContext.dependencyManager.resolve(services_1.AnonCredsHolderServiceSymbol);
225
+ if (!credentialRequestMetadata) {
226
+ throw new core_1.AriesFrameworkError(`Missing required request metadata for credential exchange with thread id with id ${credentialRecord.id}`);
227
+ }
228
+ if (!credentialRecord.credentialAttributes) {
229
+ throw new core_1.AriesFrameworkError('Missing credential attributes on credential record. Unable to check credential attributes');
230
+ }
231
+ const anonCredsCredential = attachment.getDataAsJson();
232
+ const credentialDefinitionResult = await registryService
233
+ .getRegistryForIdentifier(agentContext, anonCredsCredential.cred_def_id)
234
+ .getCredentialDefinition(agentContext, anonCredsCredential.cred_def_id);
235
+ if (!credentialDefinitionResult.credentialDefinition) {
236
+ throw new core_1.AriesFrameworkError(`Unable to resolve credential definition ${anonCredsCredential.cred_def_id}: ${credentialDefinitionResult.resolutionMetadata.error} ${credentialDefinitionResult.resolutionMetadata.message}`);
237
+ }
238
+ const schemaResult = await registryService
239
+ .getRegistryForIdentifier(agentContext, anonCredsCredential.cred_def_id)
240
+ .getSchema(agentContext, anonCredsCredential.schema_id);
241
+ if (!schemaResult.schema) {
242
+ throw new core_1.AriesFrameworkError(`Unable to resolve schema ${anonCredsCredential.schema_id}: ${schemaResult.resolutionMetadata.error} ${schemaResult.resolutionMetadata.message}`);
243
+ }
244
+ // Resolve revocation registry if credential is revocable
245
+ let revocationRegistryResult = null;
246
+ if (anonCredsCredential.rev_reg_id) {
247
+ revocationRegistryResult = await registryService
248
+ .getRegistryForIdentifier(agentContext, anonCredsCredential.rev_reg_id)
249
+ .getRevocationRegistryDefinition(agentContext, anonCredsCredential.rev_reg_id);
250
+ if (!revocationRegistryResult.revocationRegistryDefinition) {
251
+ throw new core_1.AriesFrameworkError(`Unable to resolve revocation registry definition ${anonCredsCredential.rev_reg_id}: ${revocationRegistryResult.resolutionMetadata.error} ${revocationRegistryResult.resolutionMetadata.message}`);
252
+ }
253
+ }
254
+ // assert the credential values match the offer values
255
+ const recordCredentialValues = (0, credential_1.convertAttributesToCredentialValues)(credentialRecord.credentialAttributes);
256
+ (0, credential_1.assertCredentialValuesMatch)(anonCredsCredential.values, recordCredentialValues);
257
+ const credentialId = await anonCredsHolderService.storeCredential(agentContext, {
258
+ credentialId: core_1.utils.uuid(),
259
+ credentialRequestMetadata,
260
+ credential: anonCredsCredential,
261
+ credentialDefinitionId: credentialDefinitionResult.credentialDefinitionId,
262
+ credentialDefinition: credentialDefinitionResult.credentialDefinition,
263
+ schema: schemaResult.schema,
264
+ revocationRegistry: (revocationRegistryResult === null || revocationRegistryResult === void 0 ? void 0 : revocationRegistryResult.revocationRegistryDefinition)
265
+ ? {
266
+ definition: revocationRegistryResult.revocationRegistryDefinition,
267
+ id: revocationRegistryResult.revocationRegistryDefinitionId,
268
+ }
269
+ : undefined,
270
+ });
271
+ // If the credential is revocable, store the revocation identifiers in the credential record
272
+ if (anonCredsCredential.rev_reg_id) {
273
+ const credential = await anonCredsHolderService.getCredential(agentContext, { credentialId });
274
+ credentialRecord.metadata.add(metadata_1.AnonCredsCredentialMetadataKey, {
275
+ credentialRevocationId: credential.credentialRevocationId,
276
+ revocationRegistryId: credential.revocationRegistryId,
277
+ });
278
+ credentialRecord.setTags({
279
+ anonCredsRevocationRegistryId: credential.revocationRegistryId,
280
+ anonCredsCredentialRevocationId: credential.credentialRevocationId,
281
+ });
282
+ }
283
+ credentialRecord.credentials.push({
284
+ credentialRecordType: this.credentialRecordType,
285
+ credentialRecordId: credentialId,
286
+ });
287
+ }
288
+ supportsFormat(format) {
289
+ const supportedFormats = [INDY_CRED_ABSTRACT, INDY_CRED_REQUEST, INDY_CRED_FILTER, INDY_CRED];
290
+ return supportedFormats.includes(format);
291
+ }
292
+ /**
293
+ * Gets the attachment object for a given attachmentId. We need to get out the correct attachmentId for
294
+ * indy and then find the corresponding attachment (if there is one)
295
+ * @param formats the formats object containing the attachmentId
296
+ * @param messageAttachments the attachments containing the payload
297
+ * @returns The Attachment if found or undefined
298
+ *
299
+ */
300
+ getAttachment(formats, messageAttachments) {
301
+ const supportedAttachmentIds = formats.filter((f) => this.supportsFormat(f.format)).map((f) => f.attachmentId);
302
+ const supportedAttachment = messageAttachments.find((attachment) => supportedAttachmentIds.includes(attachment.id));
303
+ return supportedAttachment;
304
+ }
305
+ async deleteCredentialById(agentContext, credentialRecordId) {
306
+ const anonCredsHolderService = agentContext.dependencyManager.resolve(services_1.AnonCredsHolderServiceSymbol);
307
+ await anonCredsHolderService.deleteCredential(agentContext, credentialRecordId);
308
+ }
309
+ async shouldAutoRespondToProposal(agentContext, { offerAttachment, proposalAttachment }) {
310
+ const proposalJson = proposalAttachment.getDataAsJson();
311
+ const offerJson = offerAttachment.getDataAsJson();
312
+ // We want to make sure the credential definition matches.
313
+ // TODO: If no credential definition is present on the proposal, we could check whether the other fields
314
+ // of the proposal match with the credential definition id.
315
+ return proposalJson.cred_def_id === offerJson.cred_def_id;
316
+ }
317
+ async shouldAutoRespondToOffer(agentContext, { offerAttachment, proposalAttachment }) {
318
+ const proposalJson = proposalAttachment.getDataAsJson();
319
+ const offerJson = offerAttachment.getDataAsJson();
320
+ // We want to make sure the credential definition matches.
321
+ // TODO: If no credential definition is present on the proposal, we could check whether the other fields
322
+ // of the proposal match with the credential definition id.
323
+ return proposalJson.cred_def_id === offerJson.cred_def_id;
324
+ }
325
+ async shouldAutoRespondToRequest(agentContext, { offerAttachment, requestAttachment }) {
326
+ const credentialOfferJson = offerAttachment.getDataAsJson();
327
+ const credentialRequestJson = requestAttachment.getDataAsJson();
328
+ return credentialOfferJson.cred_def_id === credentialRequestJson.cred_def_id;
329
+ }
330
+ async shouldAutoRespondToCredential(agentContext, { credentialRecord, requestAttachment, credentialAttachment }) {
331
+ const credentialJson = credentialAttachment.getDataAsJson();
332
+ const credentialRequestJson = requestAttachment.getDataAsJson();
333
+ // make sure the credential definition matches
334
+ if (credentialJson.cred_def_id !== credentialRequestJson.cred_def_id)
335
+ return false;
336
+ // If we don't have any attributes stored we can't compare so always return false.
337
+ if (!credentialRecord.credentialAttributes)
338
+ return false;
339
+ const attributeValues = (0, credential_1.convertAttributesToCredentialValues)(credentialRecord.credentialAttributes);
340
+ // check whether the values match the values in the record
341
+ return (0, credential_1.checkCredentialValuesMatch)(attributeValues, credentialJson.values);
342
+ }
343
+ async createIndyOffer(agentContext, { credentialRecord, attachmentId, credentialDefinitionId, attributes, linkedAttachments, }) {
344
+ const anonCredsIssuerService = agentContext.dependencyManager.resolve(services_1.AnonCredsIssuerServiceSymbol);
345
+ // if the proposal has an attachment Id use that, otherwise the generated id of the formats object
346
+ const format = new core_1.CredentialFormatSpec({
347
+ attachmentId: attachmentId,
348
+ format: INDY_CRED_ABSTRACT,
349
+ });
350
+ const offer = await anonCredsIssuerService.createCredentialOffer(agentContext, {
351
+ credentialDefinitionId,
352
+ });
353
+ const { previewAttributes } = this.getCredentialLinkedAttachments(attributes, linkedAttachments);
354
+ if (!previewAttributes) {
355
+ throw new core_1.AriesFrameworkError('Missing required preview attributes for indy offer');
356
+ }
357
+ await this.assertPreviewAttributesMatchSchemaAttributes(agentContext, offer, previewAttributes);
358
+ credentialRecord.metadata.set(metadata_1.AnonCredsCredentialMetadataKey, {
359
+ schemaId: offer.schema_id,
360
+ credentialDefinitionId: offer.cred_def_id,
361
+ });
362
+ const attachment = this.getFormatData(offer, format.attachmentId);
363
+ return { format, attachment, previewAttributes };
364
+ }
365
+ async assertPreviewAttributesMatchSchemaAttributes(agentContext, offer, attributes) {
366
+ const registryService = agentContext.dependencyManager.resolve(AnonCredsRegistryService_1.AnonCredsRegistryService);
367
+ const registry = registryService.getRegistryForIdentifier(agentContext, offer.schema_id);
368
+ const schemaResult = await registry.getSchema(agentContext, offer.schema_id);
369
+ if (!schemaResult.schema) {
370
+ throw new core_1.AriesFrameworkError(`Unable to resolve schema ${offer.schema_id} from registry: ${schemaResult.resolutionMetadata.error} ${schemaResult.resolutionMetadata.message}`);
371
+ }
372
+ (0, credential_1.assertAttributesMatch)(schemaResult.schema, attributes);
373
+ }
374
+ /**
375
+ * Get linked attachments for indy format from a proposal message. This allows attachments
376
+ * to be copied across to old style credential records
377
+ *
378
+ * @param options ProposeCredentialOptions object containing (optionally) the linked attachments
379
+ * @return array of linked attachments or undefined if none present
380
+ */
381
+ getCredentialLinkedAttachments(attributes, linkedAttachments) {
382
+ if (!linkedAttachments && !attributes) {
383
+ return {};
384
+ }
385
+ let previewAttributes = attributes !== null && attributes !== void 0 ? attributes : [];
386
+ let attachments;
387
+ if (linkedAttachments) {
388
+ // there are linked attachments so transform into the attribute field of the CredentialPreview object for
389
+ // this proposal
390
+ previewAttributes = (0, credential_1.createAndLinkAttachmentsToPreview)(linkedAttachments, previewAttributes);
391
+ attachments = linkedAttachments.map((linkedAttachment) => linkedAttachment.attachment);
392
+ }
393
+ return { attachments, previewAttributes };
394
+ }
395
+ /**
396
+ * Returns an object of type {@link Attachment} for use in credential exchange messages.
397
+ * It looks up the correct format identifier and encodes the data as a base64 attachment.
398
+ *
399
+ * @param data The data to include in the attach object
400
+ * @param id the attach id from the formats component of the message
401
+ */
402
+ getFormatData(data, id) {
403
+ const attachment = new core_1.Attachment({
404
+ id,
405
+ mimeType: 'application/json',
406
+ data: {
407
+ base64: core_1.JsonEncoder.toBase64(data),
408
+ },
409
+ });
410
+ return attachment;
411
+ }
412
+ }
413
+ exports.LegacyIndyCredentialFormatService = LegacyIndyCredentialFormatService;
414
+ //# sourceMappingURL=LegacyIndyCredentialFormatService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LegacyIndyCredentialFormatService.js","sourceRoot":"","sources":["../../src/formats/LegacyIndyCredentialFormatService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AA+BA,yCAUuB;AAEvB,oCAAyC;AACzC,uFAAmF;AACnF,0CAAwF;AACxF,4FAAwF;AACxF,oDAM4B;AAC5B,8DAAqG;AACrG,gDAAyG;AACzG,kDAAsE;AAEtE,MAAM,kBAAkB,GAAG,2BAA2B,CAAA;AACtD,MAAM,iBAAiB,GAAG,sBAAsB,CAAA;AAChD,MAAM,gBAAgB,GAAG,yBAAyB,CAAA;AAClD,MAAM,SAAS,GAAG,kBAAkB,CAAA;AAEpC,MAAa,iCAAiC;IAA9C;QACE,+FAA+F;QAC/E,cAAS,GAAG,MAAe,CAAA;QAE3C;;;WAGG;QACa,yB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C,IAAa,EAAE,EAAU;QAC5C,MAAM,UAAU,GAAG,IAAI,iBAAU,CAAC;YAChC,EAAE;YACF,QAAQ,EAAE,kBAAkB;YAC5B,IAAI,EAAE;gBACJ,MAAM,EAAE,kBAAW,CAAC,QAAQ,CAAC,IAAI,CAAC;aACnC;SACF,CAAC,CAAA;QAEF,OAAO,UAAU,CAAA;IACnB,CAAC;CACF;AAxkBD,8EAwkBC"}
@@ -0,0 +1,29 @@
1
+ import type { AnonCredsProposeProofFormat, AnonCredsRequestProofFormat, AnonCredsGetCredentialsForProofRequestOptions, AnonCredsCredentialsForProofRequest } from './AnonCredsProofFormat';
2
+ import type { AnonCredsProof, AnonCredsProofRequest, AnonCredsSelectedCredentials } from '../models';
3
+ import type { ProofFormat } from '@credo-ts/core';
4
+ export type LegacyIndyProofRequest = AnonCredsProofRequest;
5
+ export interface LegacyIndyProofFormat extends ProofFormat {
6
+ formatKey: 'indy';
7
+ proofFormats: {
8
+ createProposal: AnonCredsProposeProofFormat;
9
+ acceptProposal: {
10
+ name?: string;
11
+ version?: string;
12
+ };
13
+ createRequest: AnonCredsRequestProofFormat;
14
+ acceptRequest: AnonCredsSelectedCredentials;
15
+ getCredentialsForRequest: {
16
+ input: AnonCredsGetCredentialsForProofRequestOptions;
17
+ output: AnonCredsCredentialsForProofRequest;
18
+ };
19
+ selectCredentialsForRequest: {
20
+ input: AnonCredsGetCredentialsForProofRequestOptions;
21
+ output: AnonCredsSelectedCredentials;
22
+ };
23
+ };
24
+ formatData: {
25
+ proposal: LegacyIndyProofRequest;
26
+ request: LegacyIndyProofRequest;
27
+ presentation: AnonCredsProof;
28
+ };
29
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=LegacyIndyProofFormat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LegacyIndyProofFormat.js","sourceRoot":"","sources":["../../src/formats/LegacyIndyProofFormat.ts"],"names":[],"mappings":""}
@@ -0,0 +1,58 @@
1
+ import type { LegacyIndyProofFormat } from './LegacyIndyProofFormat';
2
+ import type { ProofFormatService, AgentContext, ProofFormatCreateReturn, FormatCreateRequestOptions, ProofFormatCreateProposalOptions, ProofFormatProcessOptions, ProofFormatAcceptProposalOptions, ProofFormatAcceptRequestOptions, ProofFormatProcessPresentationOptions, ProofFormatGetCredentialsForRequestOptions, ProofFormatGetCredentialsForRequestReturn, ProofFormatSelectCredentialsForRequestOptions, ProofFormatSelectCredentialsForRequestReturn, ProofFormatAutoRespondProposalOptions, ProofFormatAutoRespondRequestOptions, ProofFormatAutoRespondPresentationOptions } from '@credo-ts/core';
3
+ export declare class LegacyIndyProofFormatService implements ProofFormatService<LegacyIndyProofFormat> {
4
+ readonly formatKey: "indy";
5
+ createProposal(agentContext: AgentContext, { attachmentId, proofFormats }: ProofFormatCreateProposalOptions<LegacyIndyProofFormat>): Promise<ProofFormatCreateReturn>;
6
+ processProposal(agentContext: AgentContext, { attachment }: ProofFormatProcessOptions): Promise<void>;
7
+ acceptProposal(agentContext: AgentContext, { proposalAttachment, attachmentId }: ProofFormatAcceptProposalOptions<LegacyIndyProofFormat>): Promise<ProofFormatCreateReturn>;
8
+ createRequest(agentContext: AgentContext, { attachmentId, proofFormats }: FormatCreateRequestOptions<LegacyIndyProofFormat>): Promise<ProofFormatCreateReturn>;
9
+ processRequest(agentContext: AgentContext, { attachment }: ProofFormatProcessOptions): Promise<void>;
10
+ acceptRequest(agentContext: AgentContext, { proofFormats, requestAttachment, attachmentId }: ProofFormatAcceptRequestOptions<LegacyIndyProofFormat>): Promise<ProofFormatCreateReturn>;
11
+ processPresentation(agentContext: AgentContext, { requestAttachment, attachment }: ProofFormatProcessPresentationOptions): Promise<boolean>;
12
+ getCredentialsForRequest(agentContext: AgentContext, { requestAttachment, proofFormats }: ProofFormatGetCredentialsForRequestOptions<LegacyIndyProofFormat>): Promise<ProofFormatGetCredentialsForRequestReturn<LegacyIndyProofFormat>>;
13
+ selectCredentialsForRequest(agentContext: AgentContext, { requestAttachment, proofFormats }: ProofFormatSelectCredentialsForRequestOptions<LegacyIndyProofFormat>): Promise<ProofFormatSelectCredentialsForRequestReturn<LegacyIndyProofFormat>>;
14
+ shouldAutoRespondToProposal(agentContext: AgentContext, { proposalAttachment, requestAttachment }: ProofFormatAutoRespondProposalOptions): Promise<boolean>;
15
+ shouldAutoRespondToRequest(agentContext: AgentContext, { proposalAttachment, requestAttachment }: ProofFormatAutoRespondRequestOptions): Promise<boolean>;
16
+ shouldAutoRespondToPresentation(_agentContext: AgentContext, _options: ProofFormatAutoRespondPresentationOptions): Promise<boolean>;
17
+ supportsFormat(formatIdentifier: string): boolean;
18
+ private _getCredentialsForRequest;
19
+ private _selectCredentialsForRequest;
20
+ private getCredentialsForProofRequestReferent;
21
+ /**
22
+ * Build schemas object needed to create and verify proof objects.
23
+ *
24
+ * Creates object with `{ schemaId: AnonCredsSchema }` mapping
25
+ *
26
+ * @param schemaIds List of schema ids
27
+ * @returns Object containing schemas for specified schema ids
28
+ *
29
+ */
30
+ private getSchemas;
31
+ /**
32
+ * Build credential definitions object needed to create and verify proof objects.
33
+ *
34
+ * Creates object with `{ credentialDefinitionId: AnonCredsCredentialDefinition }` mapping
35
+ *
36
+ * @param credentialDefinitionIds List of credential definition ids
37
+ * @returns Object containing credential definitions for specified credential definition ids
38
+ *
39
+ */
40
+ private getCredentialDefinitions;
41
+ private getRevocationStatus;
42
+ /**
43
+ * Create indy proof from a given proof request and requested credential object.
44
+ *
45
+ * @param proofRequest The proof request to create the proof for
46
+ * @param requestedCredentials The requested credentials object specifying which credentials to use for the proof
47
+ * @returns indy proof object
48
+ */
49
+ private createProof;
50
+ /**
51
+ * Returns an object of type {@link Attachment} for use in credential exchange messages.
52
+ * It looks up the correct format identifier and encodes the data as a base64 attachment.
53
+ *
54
+ * @param data The data to include in the attach object
55
+ * @param id the attach id from the formats component of the message
56
+ */
57
+ private getFormatData;
58
+ }