@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,375 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AnonCredsProofFormatService = void 0;
4
+ const core_1 = require("@credo-ts/core");
5
+ const AnonCredsProofRequest_1 = require("../models/AnonCredsProofRequest");
6
+ const services_1 = require("../services");
7
+ const AnonCredsRegistryService_1 = require("../services/registry/AnonCredsRegistryService");
8
+ const utils_1 = require("../utils");
9
+ const timestamp_1 = require("../utils/timestamp");
10
+ const ANONCREDS_PRESENTATION_PROPOSAL = 'anoncreds/proof-request@v1.0';
11
+ const ANONCREDS_PRESENTATION_REQUEST = 'anoncreds/proof-request@v1.0';
12
+ const ANONCREDS_PRESENTATION = 'anoncreds/proof@v1.0';
13
+ class AnonCredsProofFormatService {
14
+ constructor() {
15
+ this.formatKey = 'anoncreds';
16
+ }
17
+ async createProposal(agentContext, { attachmentId, proofFormats }) {
18
+ var _a, _b, _c, _d;
19
+ const format = new core_1.ProofFormatSpec({
20
+ format: ANONCREDS_PRESENTATION_PROPOSAL,
21
+ attachmentId,
22
+ });
23
+ const anoncredsFormat = proofFormats.anoncreds;
24
+ if (!anoncredsFormat) {
25
+ throw Error('Missing anoncreds format to create proposal attachment format');
26
+ }
27
+ const proofRequest = (0, utils_1.createRequestFromPreview)({
28
+ attributes: (_a = anoncredsFormat.attributes) !== null && _a !== void 0 ? _a : [],
29
+ predicates: (_b = anoncredsFormat.predicates) !== null && _b !== void 0 ? _b : [],
30
+ name: (_c = anoncredsFormat.name) !== null && _c !== void 0 ? _c : 'Proof request',
31
+ version: (_d = anoncredsFormat.version) !== null && _d !== void 0 ? _d : '1.0',
32
+ nonce: await agentContext.wallet.generateNonce(),
33
+ nonRevokedInterval: anoncredsFormat.nonRevokedInterval,
34
+ });
35
+ const attachment = this.getFormatData(proofRequest, format.attachmentId);
36
+ return { attachment, format };
37
+ }
38
+ async processProposal(agentContext, { attachment }) {
39
+ const proposalJson = attachment.getDataAsJson();
40
+ // fromJson also validates
41
+ core_1.JsonTransformer.fromJSON(proposalJson, AnonCredsProofRequest_1.AnonCredsProofRequest);
42
+ // Assert attribute and predicate (group) names do not match
43
+ (0, utils_1.assertNoDuplicateGroupsNamesInProofRequest)(proposalJson);
44
+ }
45
+ async acceptProposal(agentContext, { proposalAttachment, attachmentId }) {
46
+ const format = new core_1.ProofFormatSpec({
47
+ format: ANONCREDS_PRESENTATION_REQUEST,
48
+ attachmentId,
49
+ });
50
+ const proposalJson = proposalAttachment.getDataAsJson();
51
+ const request = Object.assign(Object.assign({}, proposalJson), {
52
+ // We never want to reuse the nonce from the proposal, as this will allow replay attacks
53
+ nonce: await agentContext.wallet.generateNonce() });
54
+ const attachment = this.getFormatData(request, format.attachmentId);
55
+ return { attachment, format };
56
+ }
57
+ async createRequest(agentContext, { attachmentId, proofFormats }) {
58
+ var _a, _b;
59
+ const format = new core_1.ProofFormatSpec({
60
+ format: ANONCREDS_PRESENTATION_REQUEST,
61
+ attachmentId,
62
+ });
63
+ const anoncredsFormat = proofFormats.anoncreds;
64
+ if (!anoncredsFormat) {
65
+ throw Error('Missing anoncreds format in create request attachment format');
66
+ }
67
+ const request = {
68
+ name: anoncredsFormat.name,
69
+ version: anoncredsFormat.version,
70
+ nonce: await agentContext.wallet.generateNonce(),
71
+ requested_attributes: (_a = anoncredsFormat.requested_attributes) !== null && _a !== void 0 ? _a : {},
72
+ requested_predicates: (_b = anoncredsFormat.requested_predicates) !== null && _b !== void 0 ? _b : {},
73
+ non_revoked: anoncredsFormat.non_revoked,
74
+ };
75
+ // Assert attribute and predicate (group) names do not match
76
+ (0, utils_1.assertNoDuplicateGroupsNamesInProofRequest)(request);
77
+ const attachment = this.getFormatData(request, format.attachmentId);
78
+ return { attachment, format };
79
+ }
80
+ async processRequest(agentContext, { attachment }) {
81
+ const requestJson = attachment.getDataAsJson();
82
+ // fromJson also validates
83
+ core_1.JsonTransformer.fromJSON(requestJson, AnonCredsProofRequest_1.AnonCredsProofRequest);
84
+ // Assert attribute and predicate (group) names do not match
85
+ (0, utils_1.assertNoDuplicateGroupsNamesInProofRequest)(requestJson);
86
+ }
87
+ async acceptRequest(agentContext, { proofFormats, requestAttachment, attachmentId }) {
88
+ const format = new core_1.ProofFormatSpec({
89
+ format: ANONCREDS_PRESENTATION,
90
+ attachmentId,
91
+ });
92
+ const requestJson = requestAttachment.getDataAsJson();
93
+ const anoncredsFormat = proofFormats === null || proofFormats === void 0 ? void 0 : proofFormats.anoncreds;
94
+ const selectedCredentials = anoncredsFormat !== null && anoncredsFormat !== void 0 ? anoncredsFormat : (await this._selectCredentialsForRequest(agentContext, requestJson, {
95
+ filterByNonRevocationRequirements: true,
96
+ }));
97
+ const proof = await this.createProof(agentContext, requestJson, selectedCredentials);
98
+ const attachment = this.getFormatData(proof, format.attachmentId);
99
+ return {
100
+ attachment,
101
+ format,
102
+ };
103
+ }
104
+ async processPresentation(agentContext, { requestAttachment, attachment }) {
105
+ var _a;
106
+ const verifierService = agentContext.dependencyManager.resolve(services_1.AnonCredsVerifierServiceSymbol);
107
+ const proofRequestJson = requestAttachment.getDataAsJson();
108
+ // NOTE: we don't do validation here, as this is handled by the AnonCreds implementation, however
109
+ // this can lead to confusing error messages. We should consider doing validation here as well.
110
+ // Defining a class-transformer/class-validator class seems a bit overkill, and the usage of interfaces
111
+ // for the anoncreds package keeps things simple. Maybe we can try to use something like zod to validate
112
+ const proofJson = attachment.getDataAsJson();
113
+ for (const [referent, attribute] of Object.entries(proofJson.requested_proof.revealed_attrs)) {
114
+ if (!(0, utils_1.checkValidCredentialValueEncoding)(attribute.raw, attribute.encoded)) {
115
+ throw new core_1.AriesFrameworkError(`The encoded value for '${referent}' is invalid. ` +
116
+ `Expected '${(0, utils_1.encodeCredentialValue)(attribute.raw)}'. ` +
117
+ `Actual '${attribute.encoded}'`);
118
+ }
119
+ }
120
+ for (const [, attributeGroup] of Object.entries((_a = proofJson.requested_proof.revealed_attr_groups) !== null && _a !== void 0 ? _a : {})) {
121
+ for (const [attributeName, attribute] of Object.entries(attributeGroup.values)) {
122
+ if (!(0, utils_1.checkValidCredentialValueEncoding)(attribute.raw, attribute.encoded)) {
123
+ throw new core_1.AriesFrameworkError(`The encoded value for '${attributeName}' is invalid. ` +
124
+ `Expected '${(0, utils_1.encodeCredentialValue)(attribute.raw)}'. ` +
125
+ `Actual '${attribute.encoded}'`);
126
+ }
127
+ }
128
+ }
129
+ const schemas = await this.getSchemas(agentContext, new Set(proofJson.identifiers.map((i) => i.schema_id)));
130
+ const credentialDefinitions = await this.getCredentialDefinitions(agentContext, new Set(proofJson.identifiers.map((i) => i.cred_def_id)));
131
+ const revocationRegistries = await (0, utils_1.getRevocationRegistriesForProof)(agentContext, proofJson);
132
+ return await verifierService.verifyProof(agentContext, {
133
+ proofRequest: proofRequestJson,
134
+ proof: proofJson,
135
+ schemas,
136
+ credentialDefinitions,
137
+ revocationRegistries,
138
+ });
139
+ }
140
+ async getCredentialsForRequest(agentContext, { requestAttachment, proofFormats }) {
141
+ var _a;
142
+ const proofRequestJson = requestAttachment.getDataAsJson();
143
+ // Set default values
144
+ const { filterByNonRevocationRequirements = true } = (_a = proofFormats === null || proofFormats === void 0 ? void 0 : proofFormats.anoncreds) !== null && _a !== void 0 ? _a : {};
145
+ const credentialsForRequest = await this._getCredentialsForRequest(agentContext, proofRequestJson, {
146
+ filterByNonRevocationRequirements,
147
+ });
148
+ return credentialsForRequest;
149
+ }
150
+ async selectCredentialsForRequest(agentContext, { requestAttachment, proofFormats }) {
151
+ var _a;
152
+ const proofRequestJson = requestAttachment.getDataAsJson();
153
+ // Set default values
154
+ const { filterByNonRevocationRequirements = true } = (_a = proofFormats === null || proofFormats === void 0 ? void 0 : proofFormats.anoncreds) !== null && _a !== void 0 ? _a : {};
155
+ const selectedCredentials = this._selectCredentialsForRequest(agentContext, proofRequestJson, {
156
+ filterByNonRevocationRequirements,
157
+ });
158
+ return selectedCredentials;
159
+ }
160
+ async shouldAutoRespondToProposal(agentContext, { proposalAttachment, requestAttachment }) {
161
+ const proposalJson = proposalAttachment.getDataAsJson();
162
+ const requestJson = requestAttachment.getDataAsJson();
163
+ const areRequestsEqual = (0, utils_1.areAnonCredsProofRequestsEqual)(proposalJson, requestJson);
164
+ agentContext.config.logger.debug(`AnonCreds request and proposal are are equal: ${areRequestsEqual}`, {
165
+ proposalJson,
166
+ requestJson,
167
+ });
168
+ return areRequestsEqual;
169
+ }
170
+ async shouldAutoRespondToRequest(agentContext, { proposalAttachment, requestAttachment }) {
171
+ const proposalJson = proposalAttachment.getDataAsJson();
172
+ const requestJson = requestAttachment.getDataAsJson();
173
+ return (0, utils_1.areAnonCredsProofRequestsEqual)(proposalJson, requestJson);
174
+ }
175
+ async shouldAutoRespondToPresentation(
176
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
177
+ _agentContext,
178
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
179
+ _options) {
180
+ // The presentation is already verified in processPresentation, so we can just return true here.
181
+ // It's only an ack, so it's just that we received the presentation.
182
+ return true;
183
+ }
184
+ supportsFormat(formatIdentifier) {
185
+ const supportedFormats = [ANONCREDS_PRESENTATION_PROPOSAL, ANONCREDS_PRESENTATION_REQUEST, ANONCREDS_PRESENTATION];
186
+ return supportedFormats.includes(formatIdentifier);
187
+ }
188
+ async _getCredentialsForRequest(agentContext, proofRequest, options) {
189
+ const credentialsForProofRequest = {
190
+ attributes: {},
191
+ predicates: {},
192
+ };
193
+ for (const [referent, requestedAttribute] of Object.entries(proofRequest.requested_attributes)) {
194
+ const credentials = await this.getCredentialsForProofRequestReferent(agentContext, proofRequest, referent);
195
+ credentialsForProofRequest.attributes[referent] = (0, utils_1.sortRequestedCredentialsMatches)(await Promise.all(credentials.map(async (credential) => {
196
+ const { isRevoked, timestamp } = await this.getRevocationStatus(agentContext, proofRequest, requestedAttribute, credential.credentialInfo);
197
+ return {
198
+ credentialId: credential.credentialInfo.credentialId,
199
+ revealed: true,
200
+ credentialInfo: credential.credentialInfo,
201
+ timestamp,
202
+ revoked: isRevoked,
203
+ };
204
+ })));
205
+ // We only attach revoked state if non-revocation is requested. So if revoked is true it means
206
+ // the credential is not applicable to the proof request
207
+ if (options.filterByNonRevocationRequirements) {
208
+ credentialsForProofRequest.attributes[referent] = credentialsForProofRequest.attributes[referent].filter((r) => !r.revoked);
209
+ }
210
+ }
211
+ for (const [referent, requestedPredicate] of Object.entries(proofRequest.requested_predicates)) {
212
+ const credentials = await this.getCredentialsForProofRequestReferent(agentContext, proofRequest, referent);
213
+ credentialsForProofRequest.predicates[referent] = (0, utils_1.sortRequestedCredentialsMatches)(await Promise.all(credentials.map(async (credential) => {
214
+ const { isRevoked, timestamp } = await this.getRevocationStatus(agentContext, proofRequest, requestedPredicate, credential.credentialInfo);
215
+ return {
216
+ credentialId: credential.credentialInfo.credentialId,
217
+ credentialInfo: credential.credentialInfo,
218
+ timestamp,
219
+ revoked: isRevoked,
220
+ };
221
+ })));
222
+ // We only attach revoked state if non-revocation is requested. So if revoked is true it means
223
+ // the credential is not applicable to the proof request
224
+ if (options.filterByNonRevocationRequirements) {
225
+ credentialsForProofRequest.predicates[referent] = credentialsForProofRequest.predicates[referent].filter((r) => !r.revoked);
226
+ }
227
+ }
228
+ return credentialsForProofRequest;
229
+ }
230
+ async _selectCredentialsForRequest(agentContext, proofRequest, options) {
231
+ const credentialsForRequest = await this._getCredentialsForRequest(agentContext, proofRequest, options);
232
+ const selectedCredentials = {
233
+ attributes: {},
234
+ predicates: {},
235
+ selfAttestedAttributes: {},
236
+ };
237
+ Object.keys(credentialsForRequest.attributes).forEach((attributeName) => {
238
+ const attributeArray = credentialsForRequest.attributes[attributeName];
239
+ if (attributeArray.length === 0) {
240
+ throw new core_1.AriesFrameworkError('Unable to automatically select requested attributes.');
241
+ }
242
+ selectedCredentials.attributes[attributeName] = attributeArray[0];
243
+ });
244
+ Object.keys(credentialsForRequest.predicates).forEach((attributeName) => {
245
+ if (credentialsForRequest.predicates[attributeName].length === 0) {
246
+ throw new core_1.AriesFrameworkError('Unable to automatically select requested predicates.');
247
+ }
248
+ else {
249
+ selectedCredentials.predicates[attributeName] = credentialsForRequest.predicates[attributeName][0];
250
+ }
251
+ });
252
+ return selectedCredentials;
253
+ }
254
+ async getCredentialsForProofRequestReferent(agentContext, proofRequest, attributeReferent) {
255
+ const holderService = agentContext.dependencyManager.resolve(services_1.AnonCredsHolderServiceSymbol);
256
+ const credentials = await holderService.getCredentialsForProofRequest(agentContext, {
257
+ proofRequest,
258
+ attributeReferent,
259
+ });
260
+ return credentials;
261
+ }
262
+ /**
263
+ * Build schemas object needed to create and verify proof objects.
264
+ *
265
+ * Creates object with `{ schemaId: AnonCredsSchema }` mapping
266
+ *
267
+ * @param schemaIds List of schema ids
268
+ * @returns Object containing schemas for specified schema ids
269
+ *
270
+ */
271
+ async getSchemas(agentContext, schemaIds) {
272
+ const registryService = agentContext.dependencyManager.resolve(AnonCredsRegistryService_1.AnonCredsRegistryService);
273
+ const schemas = {};
274
+ for (const schemaId of schemaIds) {
275
+ const schemaRegistry = registryService.getRegistryForIdentifier(agentContext, schemaId);
276
+ const schemaResult = await schemaRegistry.getSchema(agentContext, schemaId);
277
+ if (!schemaResult.schema) {
278
+ throw new core_1.AriesFrameworkError(`Schema not found for id ${schemaId}: ${schemaResult.resolutionMetadata.message}`);
279
+ }
280
+ schemas[schemaId] = schemaResult.schema;
281
+ }
282
+ return schemas;
283
+ }
284
+ /**
285
+ * Build credential definitions object needed to create and verify proof objects.
286
+ *
287
+ * Creates object with `{ credentialDefinitionId: AnonCredsCredentialDefinition }` mapping
288
+ *
289
+ * @param credentialDefinitionIds List of credential definition ids
290
+ * @returns Object containing credential definitions for specified credential definition ids
291
+ *
292
+ */
293
+ async getCredentialDefinitions(agentContext, credentialDefinitionIds) {
294
+ const registryService = agentContext.dependencyManager.resolve(AnonCredsRegistryService_1.AnonCredsRegistryService);
295
+ const credentialDefinitions = {};
296
+ for (const credentialDefinitionId of credentialDefinitionIds) {
297
+ const credentialDefinitionRegistry = registryService.getRegistryForIdentifier(agentContext, credentialDefinitionId);
298
+ const credentialDefinitionResult = await credentialDefinitionRegistry.getCredentialDefinition(agentContext, credentialDefinitionId);
299
+ if (!credentialDefinitionResult.credentialDefinition) {
300
+ throw new core_1.AriesFrameworkError(`Credential definition not found for id ${credentialDefinitionId}: ${credentialDefinitionResult.resolutionMetadata.message}`);
301
+ }
302
+ credentialDefinitions[credentialDefinitionId] = credentialDefinitionResult.credentialDefinition;
303
+ }
304
+ return credentialDefinitions;
305
+ }
306
+ async getRevocationStatus(agentContext, proofRequest, requestedItem, credentialInfo) {
307
+ var _a, _b;
308
+ const requestNonRevoked = (_a = requestedItem.non_revoked) !== null && _a !== void 0 ? _a : proofRequest.non_revoked;
309
+ const credentialRevocationId = credentialInfo.credentialRevocationId;
310
+ const revocationRegistryId = credentialInfo.revocationRegistryId;
311
+ // If revocation interval is not present or the credential is not revocable then we
312
+ // don't need to fetch the revocation status
313
+ if (!requestNonRevoked || !credentialRevocationId || !revocationRegistryId) {
314
+ return { isRevoked: undefined, timestamp: undefined };
315
+ }
316
+ agentContext.config.logger.trace(`Fetching credential revocation status for credential revocation id '${credentialRevocationId}' with revocation interval with from '${requestNonRevoked.from}' and to '${requestNonRevoked.to}'`);
317
+ // Make sure the revocation interval follows best practices from Aries RFC 0441
318
+ (0, utils_1.assertBestPracticeRevocationInterval)(requestNonRevoked);
319
+ const registryService = agentContext.dependencyManager.resolve(AnonCredsRegistryService_1.AnonCredsRegistryService);
320
+ const registry = registryService.getRegistryForIdentifier(agentContext, revocationRegistryId);
321
+ const revocationStatusResult = await registry.getRevocationStatusList(agentContext, revocationRegistryId, (_b = requestNonRevoked.to) !== null && _b !== void 0 ? _b : (0, timestamp_1.dateToTimestamp)(new Date()));
322
+ if (!revocationStatusResult.revocationStatusList) {
323
+ throw new core_1.AriesFrameworkError(`Could not retrieve revocation status list for revocation registry ${revocationRegistryId}: ${revocationStatusResult.resolutionMetadata.message}`);
324
+ }
325
+ // Item is revoked when the value at the index is 1
326
+ const isRevoked = revocationStatusResult.revocationStatusList.revocationList[parseInt(credentialRevocationId)] === 1;
327
+ agentContext.config.logger.trace(`Credential with credential revocation index '${credentialRevocationId}' is ${isRevoked ? '' : 'not '}revoked with revocation interval with to '${requestNonRevoked.to}' & from '${requestNonRevoked.from}'`);
328
+ return {
329
+ isRevoked,
330
+ timestamp: revocationStatusResult.revocationStatusList.timestamp,
331
+ };
332
+ }
333
+ /**
334
+ * Create anoncreds proof from a given proof request and requested credential object.
335
+ *
336
+ * @param proofRequest The proof request to create the proof for
337
+ * @param requestedCredentials The requested credentials object specifying which credentials to use for the proof
338
+ * @returns anoncreds proof object
339
+ */
340
+ async createProof(agentContext, proofRequest, selectedCredentials) {
341
+ const holderService = agentContext.dependencyManager.resolve(services_1.AnonCredsHolderServiceSymbol);
342
+ const credentialObjects = await Promise.all([...Object.values(selectedCredentials.attributes), ...Object.values(selectedCredentials.predicates)].map(async (c) => { var _a; return (_a = c.credentialInfo) !== null && _a !== void 0 ? _a : holderService.getCredential(agentContext, { credentialId: c.credentialId }); }));
343
+ const schemas = await this.getSchemas(agentContext, new Set(credentialObjects.map((c) => c.schemaId)));
344
+ const credentialDefinitions = await this.getCredentialDefinitions(agentContext, new Set(credentialObjects.map((c) => c.credentialDefinitionId)));
345
+ // selectedCredentials are overridden with specified timestamps of the revocation status list that
346
+ // should be used for the selected credentials.
347
+ const { revocationRegistries, updatedSelectedCredentials } = await (0, utils_1.getRevocationRegistriesForRequest)(agentContext, proofRequest, selectedCredentials);
348
+ return await holderService.createProof(agentContext, {
349
+ proofRequest,
350
+ selectedCredentials: updatedSelectedCredentials,
351
+ schemas,
352
+ credentialDefinitions,
353
+ revocationRegistries,
354
+ });
355
+ }
356
+ /**
357
+ * Returns an object of type {@link Attachment} for use in credential exchange messages.
358
+ * It looks up the correct format identifier and encodes the data as a base64 attachment.
359
+ *
360
+ * @param data The data to include in the attach object
361
+ * @param id the attach id from the formats component of the message
362
+ */
363
+ getFormatData(data, id) {
364
+ const attachment = new core_1.Attachment({
365
+ id,
366
+ mimeType: 'application/json',
367
+ data: new core_1.AttachmentData({
368
+ base64: core_1.JsonEncoder.toBase64(data),
369
+ }),
370
+ });
371
+ return attachment;
372
+ }
373
+ }
374
+ exports.AnonCredsProofFormatService = AnonCredsProofFormatService;
375
+ //# sourceMappingURL=AnonCredsProofFormatService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnonCredsProofFormatService.js","sourceRoot":"","sources":["../../src/formats/AnonCredsProofFormatService.ts"],"names":[],"mappings":";;;AAqCA,yCAOuB;AAEvB,2EAAqG;AACrG,0CAA0F;AAC1F,4FAAwF;AACxF,oCAUiB;AACjB,kDAAoD;AAEpD,MAAM,+BAA+B,GAAG,8BAA8B,CAAA;AACtE,MAAM,8BAA8B,GAAG,8BAA8B,CAAA;AACrE,MAAM,sBAAsB,GAAG,sBAAsB,CAAA;AAErD,MAAa,2BAA2B;IAAxC;QACkB,cAAS,GAAG,WAAoB,CAAA;IAmjBlD,CAAC;IAjjBQ,KAAK,CAAC,cAAc,CACzB,YAA0B,EAC1B,EAAE,YAAY,EAAE,YAAY,EAA0D;;QAEtF,MAAM,MAAM,GAAG,IAAI,sBAAe,CAAC;YACjC,MAAM,EAAE,+BAA+B;YACvC,YAAY;SACb,CAAC,CAAA;QAE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D,YAAY;YACZ,mBAAmB,EAAE,0BAA0B;YAC/C,OAAO;YACP,qBAAqB;YACrB,oBAAoB;SACrB,CAAC,CAAA;IACJ,CAAC;IAED;;;;;;OAMG;IACK,aAAa,CAAC,IAAa,EAAE,EAAU;QAC7C,MAAM,UAAU,GAAG,IAAI,iBAAU,CAAC;YAChC,EAAE;YACF,QAAQ,EAAE,kBAAkB;YAC5B,IAAI,EAAE,IAAI,qBAAc,CAAC;gBACvB,MAAM,EAAE,kBAAW,CAAC,QAAQ,CAAC,IAAI,CAAC;aACnC,CAAC;SACH,CAAC,CAAA;QAEF,OAAO,UAAU,CAAA;IACnB,CAAC;CACF;AApjBD,kEAojBC"}
@@ -0,0 +1,32 @@
1
+ import type { AnonCredsAcceptOfferFormat, AnonCredsAcceptProposalFormat, AnonCredsAcceptRequestFormat, AnonCredsCredentialProposalFormat, AnonCredsOfferCredentialFormat, AnonCredsProposeCredentialFormat } from './AnonCredsCredentialFormat';
2
+ import type { AnonCredsCredential, AnonCredsCredentialOffer, AnonCredsCredentialRequest } from '../models';
3
+ import type { CredentialFormat } from '@credo-ts/core';
4
+ export type LegacyIndyCredentialProposalFormat = Omit<AnonCredsCredentialProposalFormat, 'schema_issuer_id' | 'issuer_id'>;
5
+ /**
6
+ * This defines the module payload for calling CredentialsApi.createProposal
7
+ * or CredentialsApi.negotiateOffer
8
+ *
9
+ * NOTE: This doesn't include the `issuerId` and `schemaIssuerId` properties that are present in the newer format.
10
+ */
11
+ export type LegacyIndyProposeCredentialFormat = Omit<AnonCredsProposeCredentialFormat, 'schemaIssuerId' | 'issuerId'>;
12
+ export interface LegacyIndyCredentialRequest extends AnonCredsCredentialRequest {
13
+ prover_did: string;
14
+ }
15
+ export interface LegacyIndyCredentialFormat extends CredentialFormat {
16
+ formatKey: 'indy';
17
+ credentialRecordType: 'anoncreds';
18
+ credentialFormats: {
19
+ createProposal: LegacyIndyProposeCredentialFormat;
20
+ acceptProposal: AnonCredsAcceptProposalFormat;
21
+ createOffer: AnonCredsOfferCredentialFormat;
22
+ acceptOffer: AnonCredsAcceptOfferFormat;
23
+ createRequest: never;
24
+ acceptRequest: AnonCredsAcceptRequestFormat;
25
+ };
26
+ formatData: {
27
+ proposal: LegacyIndyCredentialProposalFormat;
28
+ offer: AnonCredsCredentialOffer;
29
+ request: LegacyIndyCredentialRequest;
30
+ credential: AnonCredsCredential;
31
+ };
32
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=LegacyIndyCredentialFormat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LegacyIndyCredentialFormat.js","sourceRoot":"","sources":["../../src/formats/LegacyIndyCredentialFormat.ts"],"names":[],"mappings":""}
@@ -0,0 +1,80 @@
1
+ import type { LegacyIndyCredentialFormat } from './LegacyIndyCredentialFormat';
2
+ import type { CredentialFormatService, AgentContext, CredentialFormatCreateProposalOptions, CredentialFormatCreateProposalReturn, CredentialFormatProcessOptions, CredentialFormatAcceptProposalOptions, CredentialFormatCreateOfferReturn, CredentialFormatCreateOfferOptions, CredentialFormatAcceptOfferOptions, CredentialFormatCreateReturn, CredentialFormatAcceptRequestOptions, CredentialFormatProcessCredentialOptions, CredentialFormatAutoRespondProposalOptions, CredentialFormatAutoRespondOfferOptions, CredentialFormatAutoRespondRequestOptions, CredentialFormatAutoRespondCredentialOptions } from '@credo-ts/core';
3
+ import { CredentialFormatSpec, Attachment } from '@credo-ts/core';
4
+ export declare class LegacyIndyCredentialFormatService implements CredentialFormatService<LegacyIndyCredentialFormat> {
5
+ /** formatKey is the key used when calling agent.credentials.xxx with credentialFormats.indy */
6
+ readonly formatKey: "indy";
7
+ /**
8
+ * credentialRecordType is the type of record that stores the credential. It is stored in the credential
9
+ * record binding in the credential exchange record.
10
+ */
11
+ readonly credentialRecordType: "anoncreds";
12
+ /**
13
+ * Create a {@link AttachmentFormats} object dependent on the message type.
14
+ *
15
+ * @param options The object containing all the options for the proposed credential
16
+ * @returns object containing associated attachment, format and optionally the credential preview
17
+ *
18
+ */
19
+ createProposal(agentContext: AgentContext, { credentialFormats, credentialRecord }: CredentialFormatCreateProposalOptions<LegacyIndyCredentialFormat>): Promise<CredentialFormatCreateProposalReturn>;
20
+ processProposal(agentContext: AgentContext, { attachment }: CredentialFormatProcessOptions): Promise<void>;
21
+ acceptProposal(agentContext: AgentContext, { attachmentId, credentialFormats, credentialRecord, proposalAttachment, }: CredentialFormatAcceptProposalOptions<LegacyIndyCredentialFormat>): Promise<CredentialFormatCreateOfferReturn>;
22
+ /**
23
+ * Create a credential attachment format for a credential request.
24
+ *
25
+ * @param options The object containing all the options for the credential offer
26
+ * @returns object containing associated attachment, formats and offersAttach elements
27
+ *
28
+ */
29
+ createOffer(agentContext: AgentContext, { credentialFormats, credentialRecord, attachmentId, }: CredentialFormatCreateOfferOptions<LegacyIndyCredentialFormat>): Promise<CredentialFormatCreateOfferReturn>;
30
+ processOffer(agentContext: AgentContext, { attachment, credentialRecord }: CredentialFormatProcessOptions): Promise<void>;
31
+ acceptOffer(agentContext: AgentContext, { credentialRecord, attachmentId, offerAttachment, credentialFormats, }: CredentialFormatAcceptOfferOptions<LegacyIndyCredentialFormat>): Promise<CredentialFormatCreateReturn>;
32
+ /**
33
+ * Starting from a request is not supported for indy credentials, this method only throws an error.
34
+ */
35
+ createRequest(): Promise<CredentialFormatCreateReturn>;
36
+ /**
37
+ * We don't have any models to validate an indy request object, for now this method does nothing
38
+ */
39
+ processRequest(agentContext: AgentContext, options: CredentialFormatProcessOptions): Promise<void>;
40
+ acceptRequest(agentContext: AgentContext, { credentialRecord, attachmentId, offerAttachment, requestAttachment, }: CredentialFormatAcceptRequestOptions<LegacyIndyCredentialFormat>): Promise<CredentialFormatCreateReturn>;
41
+ /**
42
+ * Processes an incoming credential - retrieve metadata, retrieve payload and store it in the Indy wallet
43
+ * @param options the issue credential message wrapped inside this object
44
+ * @param credentialRecord the credential exchange record for this credential
45
+ */
46
+ processCredential(agentContext: AgentContext, { credentialRecord, attachment }: CredentialFormatProcessCredentialOptions): Promise<void>;
47
+ supportsFormat(format: string): boolean;
48
+ /**
49
+ * Gets the attachment object for a given attachmentId. We need to get out the correct attachmentId for
50
+ * indy and then find the corresponding attachment (if there is one)
51
+ * @param formats the formats object containing the attachmentId
52
+ * @param messageAttachments the attachments containing the payload
53
+ * @returns The Attachment if found or undefined
54
+ *
55
+ */
56
+ getAttachment(formats: CredentialFormatSpec[], messageAttachments: Attachment[]): Attachment | undefined;
57
+ deleteCredentialById(agentContext: AgentContext, credentialRecordId: string): Promise<void>;
58
+ shouldAutoRespondToProposal(agentContext: AgentContext, { offerAttachment, proposalAttachment }: CredentialFormatAutoRespondProposalOptions): Promise<boolean>;
59
+ shouldAutoRespondToOffer(agentContext: AgentContext, { offerAttachment, proposalAttachment }: CredentialFormatAutoRespondOfferOptions): Promise<boolean>;
60
+ shouldAutoRespondToRequest(agentContext: AgentContext, { offerAttachment, requestAttachment }: CredentialFormatAutoRespondRequestOptions): Promise<boolean>;
61
+ shouldAutoRespondToCredential(agentContext: AgentContext, { credentialRecord, requestAttachment, credentialAttachment }: CredentialFormatAutoRespondCredentialOptions): Promise<boolean>;
62
+ private createIndyOffer;
63
+ private assertPreviewAttributesMatchSchemaAttributes;
64
+ /**
65
+ * Get linked attachments for indy format from a proposal message. This allows attachments
66
+ * to be copied across to old style credential records
67
+ *
68
+ * @param options ProposeCredentialOptions object containing (optionally) the linked attachments
69
+ * @return array of linked attachments or undefined if none present
70
+ */
71
+ private getCredentialLinkedAttachments;
72
+ /**
73
+ * Returns an object of type {@link Attachment} for use in credential exchange messages.
74
+ * It looks up the correct format identifier and encodes the data as a base64 attachment.
75
+ *
76
+ * @param data The data to include in the attach object
77
+ * @param id the attach id from the formats component of the message
78
+ */
79
+ getFormatData(data: unknown, id: string): Attachment;
80
+ }