@ajna-inc/openbadges 0.1.0

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 (224) hide show
  1. package/LICENSE +202 -0
  2. package/build/OpenBadgesModule.d.ts +10 -0
  3. package/build/OpenBadgesModule.js +75 -0
  4. package/build/OpenBadgesModule.js.map +1 -0
  5. package/build/OpenBadgesModuleConfig.d.ts +96 -0
  6. package/build/OpenBadgesModuleConfig.js +50 -0
  7. package/build/OpenBadgesModuleConfig.js.map +1 -0
  8. package/build/api/OpenBadgesApi.d.ts +48 -0
  9. package/build/api/OpenBadgesApi.js +81 -0
  10. package/build/api/OpenBadgesApi.js.map +1 -0
  11. package/build/api/index.d.ts +1 -0
  12. package/build/api/index.js +18 -0
  13. package/build/api/index.js.map +1 -0
  14. package/build/constants.d.ts +12 -0
  15. package/build/constants.js +27 -0
  16. package/build/constants.js.map +1 -0
  17. package/build/cryptosuites/EcdsaSd2023.d.ts +143 -0
  18. package/build/cryptosuites/EcdsaSd2023.js +518 -0
  19. package/build/cryptosuites/EcdsaSd2023.js.map +1 -0
  20. package/build/cryptosuites/EddsaRdfc2022.d.ts +112 -0
  21. package/build/cryptosuites/EddsaRdfc2022.js +356 -0
  22. package/build/cryptosuites/EddsaRdfc2022.js.map +1 -0
  23. package/build/cryptosuites/constants.d.ts +14 -0
  24. package/build/cryptosuites/constants.js +22 -0
  25. package/build/cryptosuites/constants.js.map +1 -0
  26. package/build/cryptosuites/contextPreprocessor.d.ts +24 -0
  27. package/build/cryptosuites/contextPreprocessor.js +127 -0
  28. package/build/cryptosuites/contextPreprocessor.js.map +1 -0
  29. package/build/cryptosuites/dataIntegrityV2Context.d.ts +144 -0
  30. package/build/cryptosuites/dataIntegrityV2Context.js +86 -0
  31. package/build/cryptosuites/dataIntegrityV2Context.js.map +1 -0
  32. package/build/cryptosuites/index.d.ts +11 -0
  33. package/build/cryptosuites/index.js +33 -0
  34. package/build/cryptosuites/index.js.map +1 -0
  35. package/build/http/OpenBadgesHttpModule.d.ts +9 -0
  36. package/build/http/OpenBadgesHttpModule.js +120 -0
  37. package/build/http/OpenBadgesHttpModule.js.map +1 -0
  38. package/build/http/OpenBadgesHttpModuleConfig.d.ts +55 -0
  39. package/build/http/OpenBadgesHttpModuleConfig.js +78 -0
  40. package/build/http/OpenBadgesHttpModuleConfig.js.map +1 -0
  41. package/build/http/endpoints/authorize.d.ts +3 -0
  42. package/build/http/endpoints/authorize.js +79 -0
  43. package/build/http/endpoints/authorize.js.map +1 -0
  44. package/build/http/endpoints/consent.d.ts +3 -0
  45. package/build/http/endpoints/consent.js +25 -0
  46. package/build/http/endpoints/consent.js.map +1 -0
  47. package/build/http/endpoints/credentials.d.ts +4 -0
  48. package/build/http/endpoints/credentials.js +85 -0
  49. package/build/http/endpoints/credentials.js.map +1 -0
  50. package/build/http/endpoints/did.d.ts +3 -0
  51. package/build/http/endpoints/did.js +48 -0
  52. package/build/http/endpoints/did.js.map +1 -0
  53. package/build/http/endpoints/introspect.d.ts +3 -0
  54. package/build/http/endpoints/introspect.js +37 -0
  55. package/build/http/endpoints/introspect.js.map +1 -0
  56. package/build/http/endpoints/jwks.d.ts +3 -0
  57. package/build/http/endpoints/jwks.js +46 -0
  58. package/build/http/endpoints/jwks.js.map +1 -0
  59. package/build/http/endpoints/profile.d.ts +4 -0
  60. package/build/http/endpoints/profile.js +58 -0
  61. package/build/http/endpoints/profile.js.map +1 -0
  62. package/build/http/endpoints/refresh.d.ts +15 -0
  63. package/build/http/endpoints/refresh.js +134 -0
  64. package/build/http/endpoints/refresh.js.map +1 -0
  65. package/build/http/endpoints/registration.d.ts +3 -0
  66. package/build/http/endpoints/registration.js +42 -0
  67. package/build/http/endpoints/registration.js.map +1 -0
  68. package/build/http/endpoints/revoke.d.ts +3 -0
  69. package/build/http/endpoints/revoke.js +38 -0
  70. package/build/http/endpoints/revoke.js.map +1 -0
  71. package/build/http/endpoints/serviceDescription.d.ts +3 -0
  72. package/build/http/endpoints/serviceDescription.js +52 -0
  73. package/build/http/endpoints/serviceDescription.js.map +1 -0
  74. package/build/http/endpoints/statusList.d.ts +10 -0
  75. package/build/http/endpoints/statusList.js +95 -0
  76. package/build/http/endpoints/statusList.js.map +1 -0
  77. package/build/http/endpoints/token.d.ts +3 -0
  78. package/build/http/endpoints/token.js +147 -0
  79. package/build/http/endpoints/token.js.map +1 -0
  80. package/build/http/middleware/auth.d.ts +5 -0
  81. package/build/http/middleware/auth.js +48 -0
  82. package/build/http/middleware/auth.js.map +1 -0
  83. package/build/http/router.d.ts +13 -0
  84. package/build/http/router.js +36 -0
  85. package/build/http/router.js.map +1 -0
  86. package/build/http/tenants.d.ts +2 -0
  87. package/build/http/tenants.js +20 -0
  88. package/build/http/tenants.js.map +1 -0
  89. package/build/http/util/auth.d.ts +8 -0
  90. package/build/http/util/auth.js +43 -0
  91. package/build/http/util/auth.js.map +1 -0
  92. package/build/index.d.ts +46 -0
  93. package/build/index.js +71 -0
  94. package/build/index.js.map +1 -0
  95. package/build/models/ClrCredential.d.ts +112 -0
  96. package/build/models/ClrCredential.js +52 -0
  97. package/build/models/ClrCredential.js.map +1 -0
  98. package/build/models/EndorsementCredential.d.ts +89 -0
  99. package/build/models/EndorsementCredential.js +11 -0
  100. package/build/models/EndorsementCredential.js.map +1 -0
  101. package/build/models/StatusListCredential.d.ts +81 -0
  102. package/build/models/StatusListCredential.js +28 -0
  103. package/build/models/StatusListCredential.js.map +1 -0
  104. package/build/models/index.d.ts +8 -0
  105. package/build/models/index.js +25 -0
  106. package/build/models/index.js.map +1 -0
  107. package/build/repository/OpenBadgeCredentialRecord.d.ts +44 -0
  108. package/build/repository/OpenBadgeCredentialRecord.js +46 -0
  109. package/build/repository/OpenBadgeCredentialRecord.js.map +1 -0
  110. package/build/repository/OpenBadgeCredentialRepository.d.ts +8 -0
  111. package/build/repository/OpenBadgeCredentialRepository.js +38 -0
  112. package/build/repository/OpenBadgeCredentialRepository.js.map +1 -0
  113. package/build/repository/OpenBadgesAuthCodeRecord.d.ts +35 -0
  114. package/build/repository/OpenBadgesAuthCodeRecord.js +28 -0
  115. package/build/repository/OpenBadgesAuthCodeRecord.js.map +1 -0
  116. package/build/repository/OpenBadgesAuthCodeRepository.d.ts +6 -0
  117. package/build/repository/OpenBadgesAuthCodeRepository.js +32 -0
  118. package/build/repository/OpenBadgesAuthCodeRepository.js.map +1 -0
  119. package/build/repository/OpenBadgesConsentRecord.d.ts +24 -0
  120. package/build/repository/OpenBadgesConsentRecord.js +23 -0
  121. package/build/repository/OpenBadgesConsentRecord.js.map +1 -0
  122. package/build/repository/OpenBadgesConsentRepository.d.ts +6 -0
  123. package/build/repository/OpenBadgesConsentRepository.js +32 -0
  124. package/build/repository/OpenBadgesConsentRepository.js.map +1 -0
  125. package/build/repository/OpenBadgesKeyBindingRecord.d.ts +24 -0
  126. package/build/repository/OpenBadgesKeyBindingRecord.js +32 -0
  127. package/build/repository/OpenBadgesKeyBindingRecord.js.map +1 -0
  128. package/build/repository/OpenBadgesKeyBindingRepository.d.ts +7 -0
  129. package/build/repository/OpenBadgesKeyBindingRepository.js +35 -0
  130. package/build/repository/OpenBadgesKeyBindingRepository.js.map +1 -0
  131. package/build/repository/OpenBadgesOAuthRecord.d.ts +35 -0
  132. package/build/repository/OpenBadgesOAuthRecord.js +25 -0
  133. package/build/repository/OpenBadgesOAuthRecord.js.map +1 -0
  134. package/build/repository/OpenBadgesOAuthRepository.d.ts +8 -0
  135. package/build/repository/OpenBadgesOAuthRepository.js +38 -0
  136. package/build/repository/OpenBadgesOAuthRepository.js.map +1 -0
  137. package/build/repository/OpenBadgesProfileRecord.d.ts +21 -0
  138. package/build/repository/OpenBadgesProfileRecord.js +22 -0
  139. package/build/repository/OpenBadgesProfileRecord.js.map +1 -0
  140. package/build/repository/OpenBadgesProfileRepository.d.ts +6 -0
  141. package/build/repository/OpenBadgesProfileRepository.js +32 -0
  142. package/build/repository/OpenBadgesProfileRepository.js.map +1 -0
  143. package/build/repository/OpenBadgesRevocationCacheRecord.d.ts +23 -0
  144. package/build/repository/OpenBadgesRevocationCacheRecord.js +23 -0
  145. package/build/repository/OpenBadgesRevocationCacheRecord.js.map +1 -0
  146. package/build/repository/OpenBadgesRevocationCacheRepository.d.ts +6 -0
  147. package/build/repository/OpenBadgesRevocationCacheRepository.js +32 -0
  148. package/build/repository/OpenBadgesRevocationCacheRepository.js.map +1 -0
  149. package/build/repository/OpenBadgesServiceDescriptionRecord.d.ts +21 -0
  150. package/build/repository/OpenBadgesServiceDescriptionRecord.js +22 -0
  151. package/build/repository/OpenBadgesServiceDescriptionRecord.js.map +1 -0
  152. package/build/repository/OpenBadgesServiceDescriptionRepository.d.ts +6 -0
  153. package/build/repository/OpenBadgesServiceDescriptionRepository.js +32 -0
  154. package/build/repository/OpenBadgesServiceDescriptionRepository.js.map +1 -0
  155. package/build/repository/OpenBadgesTokenRecord.d.ts +39 -0
  156. package/build/repository/OpenBadgesTokenRecord.js +36 -0
  157. package/build/repository/OpenBadgesTokenRecord.js.map +1 -0
  158. package/build/repository/OpenBadgesTokenRepository.d.ts +9 -0
  159. package/build/repository/OpenBadgesTokenRepository.js +45 -0
  160. package/build/repository/OpenBadgesTokenRepository.js.map +1 -0
  161. package/build/repository/StatusListRecord.d.ts +49 -0
  162. package/build/repository/StatusListRecord.js +47 -0
  163. package/build/repository/StatusListRecord.js.map +1 -0
  164. package/build/repository/StatusListRepository.d.ts +24 -0
  165. package/build/repository/StatusListRepository.js +52 -0
  166. package/build/repository/StatusListRepository.js.map +1 -0
  167. package/build/repository/index.d.ts +18 -0
  168. package/build/repository/index.js +35 -0
  169. package/build/repository/index.js.map +1 -0
  170. package/build/services/AchievementValidator.d.ts +158 -0
  171. package/build/services/AchievementValidator.js +238 -0
  172. package/build/services/AchievementValidator.js.map +1 -0
  173. package/build/services/ConsumerService.d.ts +24 -0
  174. package/build/services/ConsumerService.js +143 -0
  175. package/build/services/ConsumerService.js.map +1 -0
  176. package/build/services/ContextService.d.ts +14 -0
  177. package/build/services/ContextService.js +54 -0
  178. package/build/services/ContextService.js.map +1 -0
  179. package/build/services/DataIntegrityService.d.ts +51 -0
  180. package/build/services/DataIntegrityService.js +134 -0
  181. package/build/services/DataIntegrityService.js.map +1 -0
  182. package/build/services/DidCommLinkService.d.ts +7 -0
  183. package/build/services/DidCommLinkService.js +20 -0
  184. package/build/services/DidCommLinkService.js.map +1 -0
  185. package/build/services/DisplayMapper.d.ts +9 -0
  186. package/build/services/DisplayMapper.js +26 -0
  187. package/build/services/DisplayMapper.js.map +1 -0
  188. package/build/services/IssuerService.d.ts +38 -0
  189. package/build/services/IssuerService.js +225 -0
  190. package/build/services/IssuerService.js.map +1 -0
  191. package/build/services/JwtService.d.ts +19 -0
  192. package/build/services/JwtService.js +229 -0
  193. package/build/services/JwtService.js.map +1 -0
  194. package/build/services/KeyService.d.ts +102 -0
  195. package/build/services/KeyService.js +439 -0
  196. package/build/services/KeyService.js.map +1 -0
  197. package/build/services/OAuthClient.d.ts +26 -0
  198. package/build/services/OAuthClient.js +127 -0
  199. package/build/services/OAuthClient.js.map +1 -0
  200. package/build/services/ProofService.d.ts +15 -0
  201. package/build/services/ProofService.js +43 -0
  202. package/build/services/ProofService.js.map +1 -0
  203. package/build/services/RevocationService.d.ts +59 -0
  204. package/build/services/RevocationService.js +319 -0
  205. package/build/services/RevocationService.js.map +1 -0
  206. package/build/services/VerifyService.d.ts +17 -0
  207. package/build/services/VerifyService.js +54 -0
  208. package/build/services/VerifyService.js.map +1 -0
  209. package/build/services/crypto/CryptoDriver.d.ts +9 -0
  210. package/build/services/crypto/CryptoDriver.js +7 -0
  211. package/build/services/crypto/CryptoDriver.js.map +1 -0
  212. package/build/services/crypto/JsonLdCryptoDriver.d.ts +17 -0
  213. package/build/services/crypto/JsonLdCryptoDriver.js +45 -0
  214. package/build/services/crypto/JsonLdCryptoDriver.js.map +1 -0
  215. package/build/services/crypto/JwtCryptoDriver.d.ts +13 -0
  216. package/build/services/crypto/JwtCryptoDriver.js +42 -0
  217. package/build/services/crypto/JwtCryptoDriver.js.map +1 -0
  218. package/build/services/index.d.ts +12 -0
  219. package/build/services/index.js +29 -0
  220. package/build/services/index.js.map +1 -0
  221. package/build/utils/validate.d.ts +17 -0
  222. package/build/utils/validate.js +107 -0
  223. package/build/utils/validate.js.map +1 -0
  224. package/package.json +57 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2020-present Hyperledger Contributors.
190
+ Copyright 2021 Queen’s Printer for Ontario. Mostafa Youssef (https://github.com/MosCD3), Amit Padmani (https://github.com/nbAmit), Prasad Katkar (https://github.com/NB-PrasadKatkar), Mike Richardson (https://github.com/NB-MikeRichardson)
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,10 @@
1
+ import type { AgentContext, DependencyManager, Module } from '@credo-ts/core';
2
+ import { OpenBadgesModuleConfig, OpenBadgesModuleConfigOptions } from './OpenBadgesModuleConfig';
3
+ import { OpenBadgesApi } from './api/OpenBadgesApi';
4
+ export declare class OpenBadgesModule implements Module {
5
+ readonly api: typeof OpenBadgesApi;
6
+ readonly config: OpenBadgesModuleConfig;
7
+ constructor(options: OpenBadgesModuleConfigOptions);
8
+ register(dependencyManager: DependencyManager): void;
9
+ initialize(_agentContext: AgentContext): Promise<void>;
10
+ }
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OpenBadgesModule = void 0;
4
+ const core_1 = require("@credo-ts/core");
5
+ const OpenBadgesModuleConfig_1 = require("./OpenBadgesModuleConfig");
6
+ const OpenBadgesApi_1 = require("./api/OpenBadgesApi");
7
+ const OpenBadgeCredentialRepository_1 = require("./repository/OpenBadgeCredentialRepository");
8
+ const OpenBadgesProfileRepository_1 = require("./repository/OpenBadgesProfileRepository");
9
+ const OpenBadgesServiceDescriptionRepository_1 = require("./repository/OpenBadgesServiceDescriptionRepository");
10
+ const OpenBadgesOAuthRepository_1 = require("./repository/OpenBadgesOAuthRepository");
11
+ const OpenBadgesRevocationCacheRepository_1 = require("./repository/OpenBadgesRevocationCacheRepository");
12
+ const OpenBadgesAuthCodeRepository_1 = require("./repository/OpenBadgesAuthCodeRepository");
13
+ const OpenBadgesTokenRepository_1 = require("./repository/OpenBadgesTokenRepository");
14
+ const OpenBadgesConsentRepository_1 = require("./repository/OpenBadgesConsentRepository");
15
+ const StatusListRepository_1 = require("./repository/StatusListRepository");
16
+ const IssuerService_1 = require("./services/IssuerService");
17
+ const VerifyService_1 = require("./services/VerifyService");
18
+ const ConsumerService_1 = require("./services/ConsumerService");
19
+ const OAuthClient_1 = require("./services/OAuthClient");
20
+ const DidCommLinkService_1 = require("./services/DidCommLinkService");
21
+ const DisplayMapper_1 = require("./services/DisplayMapper");
22
+ const ContextService_1 = require("./services/ContextService");
23
+ const DataIntegrityService_1 = require("./services/DataIntegrityService");
24
+ const JwtService_1 = require("./services/JwtService");
25
+ const KeyService_1 = require("./services/KeyService");
26
+ // legacy key repository removed; using KMS-backed bindings instead
27
+ const OpenBadgesKeyBindingRepository_1 = require("./repository/OpenBadgesKeyBindingRepository");
28
+ const ProofService_1 = require("./services/ProofService");
29
+ const RevocationService_1 = require("./services/RevocationService");
30
+ const AchievementValidator_1 = require("./services/AchievementValidator");
31
+ const JsonLdCryptoDriver_1 = require("./services/crypto/JsonLdCryptoDriver");
32
+ const JwtCryptoDriver_1 = require("./services/crypto/JwtCryptoDriver");
33
+ class OpenBadgesModule {
34
+ constructor(options) {
35
+ this.api = OpenBadgesApi_1.OpenBadgesApi;
36
+ this.config = new OpenBadgesModuleConfig_1.OpenBadgesModuleConfig(options);
37
+ }
38
+ register(dependencyManager) {
39
+ dependencyManager.resolve(core_1.AgentConfig).logger.info('Registering OpenBadgesModule');
40
+ dependencyManager.registerInstance(OpenBadgesModuleConfig_1.OpenBadgesModuleConfig, this.config);
41
+ // Records/Repositories
42
+ dependencyManager.registerSingleton(OpenBadgeCredentialRepository_1.OpenBadgeCredentialRepository);
43
+ dependencyManager.registerSingleton(OpenBadgesProfileRepository_1.OpenBadgesProfileRepository);
44
+ dependencyManager.registerSingleton(OpenBadgesServiceDescriptionRepository_1.OpenBadgesServiceDescriptionRepository);
45
+ dependencyManager.registerSingleton(OpenBadgesOAuthRepository_1.OpenBadgesOAuthRepository);
46
+ dependencyManager.registerSingleton(OpenBadgesRevocationCacheRepository_1.OpenBadgesRevocationCacheRepository);
47
+ dependencyManager.registerSingleton(OpenBadgesKeyBindingRepository_1.OpenBadgesKeyBindingRepository);
48
+ dependencyManager.registerSingleton(OpenBadgesAuthCodeRepository_1.OpenBadgesAuthCodeRepository);
49
+ dependencyManager.registerSingleton(OpenBadgesTokenRepository_1.OpenBadgesTokenRepository);
50
+ dependencyManager.registerSingleton(OpenBadgesConsentRepository_1.OpenBadgesConsentRepository);
51
+ dependencyManager.registerSingleton(StatusListRepository_1.StatusListRepository);
52
+ // Services
53
+ dependencyManager.registerSingleton(OpenBadgesApi_1.OpenBadgesApi);
54
+ dependencyManager.registerSingleton(IssuerService_1.IssuerService);
55
+ dependencyManager.registerSingleton(VerifyService_1.VerifyService);
56
+ dependencyManager.registerSingleton(ConsumerService_1.ConsumerService);
57
+ dependencyManager.registerSingleton(OAuthClient_1.OAuthClient);
58
+ dependencyManager.registerSingleton(DidCommLinkService_1.DidCommLinkService);
59
+ dependencyManager.registerSingleton(DisplayMapper_1.DisplayMapper);
60
+ dependencyManager.registerSingleton(ContextService_1.ContextService);
61
+ dependencyManager.registerSingleton(DataIntegrityService_1.DataIntegrityService);
62
+ dependencyManager.registerSingleton(KeyService_1.KeyService);
63
+ dependencyManager.registerSingleton(JwtService_1.JwtService);
64
+ dependencyManager.registerSingleton(JsonLdCryptoDriver_1.JsonLdCryptoDriver);
65
+ dependencyManager.registerSingleton(JwtCryptoDriver_1.JwtCryptoDriver);
66
+ dependencyManager.registerSingleton(ProofService_1.ProofService);
67
+ dependencyManager.registerSingleton(RevocationService_1.RevocationService);
68
+ dependencyManager.registerSingleton(AchievementValidator_1.AchievementValidator);
69
+ }
70
+ async initialize(_agentContext) {
71
+ // No protocols to register yet. Reserved for future discover-features claims if needed.
72
+ }
73
+ }
74
+ exports.OpenBadgesModule = OpenBadgesModule;
75
+ //# sourceMappingURL=OpenBadgesModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenBadgesModule.js","sourceRoot":"","sources":["../src/OpenBadgesModule.ts"],"names":[],"mappings":";;;AACA,yCAA4C;AAE5C,qEAAgG;AAChG,uDAAmD;AAEnD,8FAA0F;AAC1F,0FAAsF;AACtF,gHAA4G;AAC5G,sFAAkF;AAClF,0GAAsG;AACtG,4FAAwF;AACxF,sFAAkF;AAClF,0FAAsF;AACtF,4EAAwE;AAExE,4DAAwD;AACxD,4DAAwD;AACxD,gEAA4D;AAC5D,wDAAoD;AACpD,sEAAkE;AAClE,4DAAwD;AACxD,8DAA0D;AAC1D,0EAAsE;AACtE,sDAAkD;AAClD,sDAAkD;AAClD,mEAAmE;AACnE,gGAA4F;AAC5F,0DAAsD;AACtD,oEAAgE;AAChE,0EAAsE;AACtE,6EAAyE;AACzE,uEAAmE;AAEnE,MAAa,gBAAgB;IAI3B,YAAmB,OAAsC;QAHzC,QAAG,GAAG,6BAAa,CAAA;QAIjC,IAAI,CAAC,MAAM,GAAG,IAAI,+CAAsB,CAAC,OAAO,CAAC,CAAA;IACnD,CAAC;IAEM,QAAQ,CAAC,iBAAoC;QAClD,iBAAiB,CAAC,OAAO,CAAC,kBAAW,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAA;QAClF,iBAAiB,CAAC,gBAAgB,CAAC,+CAAsB,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;QAEvE,uBAAuB;QACvB,iBAAiB,CAAC,iBAAiB,CAAC,6DAA6B,CAAC,CAAA;QAClE,iBAAiB,CAAC,iBAAiB,CAAC,yDAA2B,CAAC,CAAA;QAChE,iBAAiB,CAAC,iBAAiB,CAAC,+EAAsC,CAAC,CAAA;QAC3E,iBAAiB,CAAC,iBAAiB,CAAC,qDAAyB,CAAC,CAAA;QAC9D,iBAAiB,CAAC,iBAAiB,CAAC,yEAAmC,CAAC,CAAA;QACxE,iBAAiB,CAAC,iBAAiB,CAAC,+DAA8B,CAAC,CAAA;QACnE,iBAAiB,CAAC,iBAAiB,CAAC,2DAA4B,CAAC,CAAA;QACjE,iBAAiB,CAAC,iBAAiB,CAAC,qDAAyB,CAAC,CAAA;QAC9D,iBAAiB,CAAC,iBAAiB,CAAC,yDAA2B,CAAC,CAAA;QAChE,iBAAiB,CAAC,iBAAiB,CAAC,2CAAoB,CAAC,CAAA;QAEzD,WAAW;QACX,iBAAiB,CAAC,iBAAiB,CAAC,6BAAa,CAAC,CAAA;QAClD,iBAAiB,CAAC,iBAAiB,CAAC,6BAAa,CAAC,CAAA;QAClD,iBAAiB,CAAC,iBAAiB,CAAC,6BAAa,CAAC,CAAA;QAClD,iBAAiB,CAAC,iBAAiB,CAAC,iCAAe,CAAC,CAAA;QACpD,iBAAiB,CAAC,iBAAiB,CAAC,yBAAW,CAAC,CAAA;QAChD,iBAAiB,CAAC,iBAAiB,CAAC,uCAAkB,CAAC,CAAA;QACvD,iBAAiB,CAAC,iBAAiB,CAAC,6BAAa,CAAC,CAAA;QAClD,iBAAiB,CAAC,iBAAiB,CAAC,+BAAc,CAAC,CAAA;QACnD,iBAAiB,CAAC,iBAAiB,CAAC,2CAAoB,CAAC,CAAA;QACzD,iBAAiB,CAAC,iBAAiB,CAAC,uBAAU,CAAC,CAAA;QAC/C,iBAAiB,CAAC,iBAAiB,CAAC,uBAAU,CAAC,CAAA;QAC/C,iBAAiB,CAAC,iBAAiB,CAAC,uCAAkB,CAAC,CAAA;QACvD,iBAAiB,CAAC,iBAAiB,CAAC,iCAAe,CAAC,CAAA;QACpD,iBAAiB,CAAC,iBAAiB,CAAC,2BAAY,CAAC,CAAA;QACjD,iBAAiB,CAAC,iBAAiB,CAAC,qCAAiB,CAAC,CAAA;QACtD,iBAAiB,CAAC,iBAAiB,CAAC,2CAAoB,CAAC,CAAA;IAC3D,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,aAA2B;QACjD,wFAAwF;IAC1F,CAAC;CACF;AA9CD,4CA8CC"}
@@ -0,0 +1,96 @@
1
+ import { CRYPTOSUITE_ECDSA_SD_2023, CRYPTOSUITE_EDDSA_RDFC_2022, PROOF_TYPE_ED25519_2020 } from './cryptosuites';
2
+ /**
3
+ * Supported cryptosuites for JSON-LD proofs
4
+ */
5
+ export type Cryptosuite = typeof CRYPTOSUITE_EDDSA_RDFC_2022 | typeof CRYPTOSUITE_ECDSA_SD_2023 | typeof PROOF_TYPE_ED25519_2020;
6
+ /**
7
+ * Supported DID methods
8
+ */
9
+ export type DidMethod = 'did:web' | 'did:key' | 'did:jwk';
10
+ /**
11
+ * Selective disclosure configuration
12
+ */
13
+ export interface SelectiveDisclosureConfig {
14
+ /** Enable selective disclosure support */
15
+ enabled: boolean;
16
+ /** Default mandatory pointers (JSON Pointers that are always disclosed) */
17
+ mandatoryPointers?: string[];
18
+ }
19
+ /**
20
+ * Status list configuration
21
+ */
22
+ export interface StatusListConfig {
23
+ /** Enable status list support for revocation/suspension */
24
+ enabled: boolean;
25
+ /** Default purpose: 'revocation' or 'suspension' */
26
+ defaultPurpose?: 'revocation' | 'suspension';
27
+ /** Status list credential validity period in seconds */
28
+ validityPeriod?: number;
29
+ }
30
+ export type OpenBadgesModuleConfigOptions = {
31
+ /**
32
+ * DID method to use for issuer identifiers
33
+ * @default 'did:web'
34
+ */
35
+ didMethod?: DidMethod;
36
+ /**
37
+ * Proof format: 'jsonld' (Data Integrity / Linked Data Proof) or 'jwt' (VC-JWT)
38
+ * @default 'jsonld'
39
+ */
40
+ proofFormat?: 'jsonld' | 'jwt';
41
+ /**
42
+ * Cryptosuite to use for JSON-LD proofs
43
+ * - 'eddsa-rdfc-2022': Ed25519 with RDFC canonicalization (recommended, required for cert)
44
+ * - 'ecdsa-sd-2023': ECDSA P-256 with selective disclosure (required for cert)
45
+ * - 'Ed25519Signature2020': Legacy Ed25519 suite
46
+ * @default 'eddsa-rdfc-2022'
47
+ */
48
+ cryptosuite?: Cryptosuite;
49
+ /**
50
+ * Selective disclosure configuration
51
+ * Only applicable when cryptosuite is 'ecdsa-sd-2023'
52
+ */
53
+ selectiveDisclosure?: SelectiveDisclosureConfig;
54
+ /**
55
+ * Status list configuration for credential revocation/suspension
56
+ */
57
+ statusList?: StatusListConfig;
58
+ /**
59
+ * @deprecated Use proofFormat instead
60
+ */
61
+ proofType?: 'jsonld' | 'jwt';
62
+ /**
63
+ * @deprecated No longer used
64
+ */
65
+ allowJwtProofs?: boolean;
66
+ /**
67
+ * Cache JSON-LD contexts locally
68
+ * @default true
69
+ */
70
+ cacheContexts?: boolean;
71
+ };
72
+ export declare class OpenBadgesModuleConfig {
73
+ readonly didMethod: DidMethod;
74
+ readonly proofFormat: 'jsonld' | 'jwt';
75
+ readonly cryptosuite: Cryptosuite;
76
+ readonly selectiveDisclosure: SelectiveDisclosureConfig;
77
+ readonly statusList: StatusListConfig;
78
+ readonly cacheContexts: boolean;
79
+ /** @deprecated Use proofFormat instead */
80
+ readonly proofType: 'jsonld' | 'jwt';
81
+ /** @deprecated No longer used */
82
+ readonly allowJwtProofs: boolean;
83
+ constructor(options?: OpenBadgesModuleConfigOptions);
84
+ /**
85
+ * Check if selective disclosure is supported and enabled
86
+ */
87
+ get supportsSelectiveDisclosure(): boolean;
88
+ /**
89
+ * Check if using a Data Integrity cryptosuite
90
+ */
91
+ get isDataIntegritySuite(): boolean;
92
+ /**
93
+ * Check if using JWT format
94
+ */
95
+ get isJwtFormat(): boolean;
96
+ }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OpenBadgesModuleConfig = void 0;
4
+ const cryptosuites_1 = require("./cryptosuites");
5
+ class OpenBadgesModuleConfig {
6
+ constructor(options = {}) {
7
+ this.didMethod = options.didMethod ?? 'did:web';
8
+ this.proofFormat = options.proofFormat ?? options.proofType ?? 'jsonld';
9
+ this.proofType = this.proofFormat; // Backward compat
10
+ this.cryptosuite = options.cryptosuite ?? cryptosuites_1.CRYPTOSUITE_EDDSA_RDFC_2022;
11
+ this.selectiveDisclosure = options.selectiveDisclosure ?? {
12
+ enabled: false,
13
+ mandatoryPointers: [
14
+ '/issuer',
15
+ '/validFrom',
16
+ '/credentialSubject/id',
17
+ '/credentialSubject/achievement/id',
18
+ '/credentialSubject/achievement/name',
19
+ ],
20
+ };
21
+ this.statusList = options.statusList ?? {
22
+ enabled: false,
23
+ defaultPurpose: 'revocation',
24
+ validityPeriod: 86400, // 24 hours
25
+ };
26
+ this.cacheContexts = options.cacheContexts ?? true;
27
+ this.allowJwtProofs = options.allowJwtProofs ?? false;
28
+ }
29
+ /**
30
+ * Check if selective disclosure is supported and enabled
31
+ */
32
+ get supportsSelectiveDisclosure() {
33
+ return this.selectiveDisclosure.enabled && this.cryptosuite === cryptosuites_1.CRYPTOSUITE_ECDSA_SD_2023;
34
+ }
35
+ /**
36
+ * Check if using a Data Integrity cryptosuite
37
+ */
38
+ get isDataIntegritySuite() {
39
+ return (this.cryptosuite === cryptosuites_1.CRYPTOSUITE_EDDSA_RDFC_2022 ||
40
+ this.cryptosuite === cryptosuites_1.CRYPTOSUITE_ECDSA_SD_2023);
41
+ }
42
+ /**
43
+ * Check if using JWT format
44
+ */
45
+ get isJwtFormat() {
46
+ return this.proofFormat === 'jwt';
47
+ }
48
+ }
49
+ exports.OpenBadgesModuleConfig = OpenBadgesModuleConfig;
50
+ //# sourceMappingURL=OpenBadgesModuleConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenBadgesModuleConfig.js","sourceRoot":"","sources":["../src/OpenBadgesModuleConfig.ts"],"names":[],"mappings":";;;AAAA,iDAIuB;AAuFvB,MAAa,sBAAsB;IAajC,YAAmB,UAAyC,EAAE;QAC5D,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,SAAS,CAAA;QAC/C,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,SAAS,IAAI,QAAQ,CAAA;QACvE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,WAAW,CAAA,CAAC,kBAAkB;QACpD,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,0CAA2B,CAAA;QAErE,IAAI,CAAC,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,IAAI;YACxD,OAAO,EAAE,KAAK;YACd,iBAAiB,EAAE;gBACjB,SAAS;gBACT,YAAY;gBACZ,uBAAuB;gBACvB,mCAAmC;gBACnC,qCAAqC;aACtC;SACF,CAAA;QAED,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI;YACtC,OAAO,EAAE,KAAK;YACd,cAAc,EAAE,YAAY;YAC5B,cAAc,EAAE,KAAK,EAAE,WAAW;SACnC,CAAA;QAED,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,IAAI,IAAI,CAAA;QAClD,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,KAAK,CAAA;IACvD,CAAC;IAED;;OAEG;IACH,IAAW,2BAA2B;QACpC,OAAO,IAAI,CAAC,mBAAmB,CAAC,OAAO,IAAI,IAAI,CAAC,WAAW,KAAK,wCAAyB,CAAA;IAC3F,CAAC;IAED;;OAEG;IACH,IAAW,oBAAoB;QAC7B,OAAO,CACL,IAAI,CAAC,WAAW,KAAK,0CAA2B;YAChD,IAAI,CAAC,WAAW,KAAK,wCAAyB,CAC/C,CAAA;IACH,CAAC;IAED;;OAEG;IACH,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,WAAW,KAAK,KAAK,CAAA;IACnC,CAAC;CACF;AA/DD,wDA+DC"}
@@ -0,0 +1,48 @@
1
+ import { AgentContext } from '@credo-ts/core';
2
+ import { IssuerService } from '../services/IssuerService';
3
+ import { VerifyService, ConsumerService } from '../services';
4
+ import { KeyService } from '../services/KeyService';
5
+ import type { EndorsementCredentialInput } from '../models/EndorsementCredential';
6
+ import type { ClrCredentialInput } from '../models/ClrCredential';
7
+ export declare class OpenBadgesApi {
8
+ private readonly issuerService;
9
+ private readonly verifyService;
10
+ private readonly consumerService;
11
+ private readonly keys;
12
+ private readonly agentContext;
13
+ constructor(issuerService: IssuerService, verifyService: VerifyService, consumerService: ConsumerService, keys: KeyService, agentContext: AgentContext);
14
+ issue(input: any): Promise<import("..").OpenBadgeCredentialRecord>;
15
+ /**
16
+ * Issues an EndorsementCredential - a third-party validation credential
17
+ *
18
+ * @param input - The endorsement credential input
19
+ * @returns The saved credential record
20
+ */
21
+ issueEndorsement(input: EndorsementCredentialInput): Promise<import("..").OpenBadgeCredentialRecord>;
22
+ verify(credentialOrJwt: unknown): Promise<{
23
+ isValidStructure: boolean;
24
+ issues: import("..").ValidationIssue[];
25
+ status: string;
26
+ proofVerified: boolean;
27
+ }>;
28
+ importFromUrl(url: string, options?: {
29
+ discoveryUrl?: string;
30
+ }): Promise<{
31
+ discovery: any;
32
+ registration: {
33
+ client_id: string;
34
+ redirect_uris?: string[];
35
+ scope?: string;
36
+ };
37
+ authorizationUrl: string;
38
+ host: string;
39
+ }>;
40
+ ensureBinding(controller: string, vmId: string): Promise<import("..").OpenBadgesKeyBindingRecord>;
41
+ /**
42
+ * Issues a ClrCredential - a Comprehensive Learner Record bundling multiple credentials
43
+ *
44
+ * @param input - The CLR credential input
45
+ * @returns The saved credential record
46
+ */
47
+ issueClr(input: ClrCredentialInput): Promise<import("..").OpenBadgeCredentialRecord>;
48
+ }
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.OpenBadgesApi = void 0;
16
+ const core_1 = require("@credo-ts/core");
17
+ const IssuerService_1 = require("../services/IssuerService");
18
+ const services_1 = require("../services");
19
+ const KeyService_1 = require("../services/KeyService");
20
+ let OpenBadgesApi = class OpenBadgesApi {
21
+ constructor(issuerService, verifyService, consumerService, keys, agentContext) {
22
+ this.issuerService = issuerService;
23
+ this.verifyService = verifyService;
24
+ this.consumerService = consumerService;
25
+ this.keys = keys;
26
+ this.agentContext = agentContext;
27
+ }
28
+ async issue(input) {
29
+ console.log('[OB] OpenBadgesApi.issue() called');
30
+ const res = await this.issuerService.issueCredential(this.agentContext, input);
31
+ console.log('[OB] OpenBadgesApi.issue() stored record id:', res?.id);
32
+ return res;
33
+ }
34
+ /**
35
+ * Issues an EndorsementCredential - a third-party validation credential
36
+ *
37
+ * @param input - The endorsement credential input
38
+ * @returns The saved credential record
39
+ */
40
+ async issueEndorsement(input) {
41
+ console.log('[OB] OpenBadgesApi.issueEndorsement() called');
42
+ const res = await this.issuerService.issueEndorsement(this.agentContext, input);
43
+ console.log('[OB] OpenBadgesApi.issueEndorsement() stored record id:', res?.id);
44
+ return res;
45
+ }
46
+ async verify(credentialOrJwt) {
47
+ console.log('[OB] OpenBadgesApi.verify() called');
48
+ const res = await this.verifyService.verify(this.agentContext, credentialOrJwt);
49
+ console.log('[OB] OpenBadgesApi.verify() result:', res);
50
+ return res;
51
+ }
52
+ async importFromUrl(url, options) {
53
+ return this.consumerService.importFromUrl(this.agentContext, url, options);
54
+ }
55
+ async ensureBinding(controller, vmId) {
56
+ return this.keys.ensureBinding(this.agentContext, { controller, vmId });
57
+ }
58
+ /**
59
+ * Issues a ClrCredential - a Comprehensive Learner Record bundling multiple credentials
60
+ *
61
+ * @param input - The CLR credential input
62
+ * @returns The saved credential record
63
+ */
64
+ async issueClr(input) {
65
+ console.log('[OB] OpenBadgesApi.issueClr() called');
66
+ const res = await this.issuerService.issueClr(this.agentContext, input);
67
+ console.log('[OB] OpenBadgesApi.issueClr() stored record id:', res?.id);
68
+ return res;
69
+ }
70
+ };
71
+ exports.OpenBadgesApi = OpenBadgesApi;
72
+ exports.OpenBadgesApi = OpenBadgesApi = __decorate([
73
+ (0, core_1.injectable)(),
74
+ __param(3, (0, core_1.inject)(KeyService_1.KeyService)),
75
+ __metadata("design:paramtypes", [IssuerService_1.IssuerService,
76
+ services_1.VerifyService,
77
+ services_1.ConsumerService,
78
+ KeyService_1.KeyService,
79
+ core_1.AgentContext])
80
+ ], OpenBadgesApi);
81
+ //# sourceMappingURL=OpenBadgesApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenBadgesApi.js","sourceRoot":"","sources":["../../src/api/OpenBadgesApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yCAAiE;AACjE,6DAAyD;AACzD,0CAA4D;AAC5D,uDAAmD;AAK5C,IAAM,aAAa,GAAnB,MAAM,aAAa;IACxB,YACmB,aAA4B,EAC5B,aAA4B,EAC5B,eAAgC,EACZ,IAAgB,EACpC,YAA0B;QAJ1B,kBAAa,GAAb,aAAa,CAAe;QAC5B,kBAAa,GAAb,aAAa,CAAe;QAC5B,oBAAe,GAAf,eAAe,CAAiB;QACZ,SAAI,GAAJ,IAAI,CAAY;QACpC,iBAAY,GAAZ,YAAY,CAAc;IAC1C,CAAC;IAEG,KAAK,CAAC,KAAK,CAAC,KAAU;QAC3B,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAA;QAChD,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,IAAI,CAAC,YAAuC,EAAE,KAAK,CAAC,CAAA;QACzG,OAAO,CAAC,GAAG,CAAC,8CAA8C,EAAG,GAAW,EAAE,EAAE,CAAC,CAAA;QAC7E,OAAO,GAAG,CAAA;IACZ,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,gBAAgB,CAAC,KAAiC;QAC7D,OAAO,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAA;QAC3D,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,IAAI,CAAC,YAAuC,EAAE,KAAK,CAAC,CAAA;QAC1G,OAAO,CAAC,GAAG,CAAC,yDAAyD,EAAG,GAAW,EAAE,EAAE,CAAC,CAAA;QACxF,OAAO,GAAG,CAAA;IACZ,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,eAAwB;QAC1C,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAA;QACjD,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,YAAuC,EAAE,eAAe,CAAC,CAAA;QAC1G,OAAO,CAAC,GAAG,CAAC,qCAAqC,EAAE,GAAG,CAAC,CAAA;QACvD,OAAO,GAAG,CAAA;IACZ,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,GAAW,EAAE,OAAmC;QACzE,OAAO,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,IAAI,CAAC,YAAuC,EAAE,GAAG,EAAE,OAAO,CAAC,CAAA;IACvG,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,UAAkB,EAAE,IAAY;QACzD,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,YAAuC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAA;IACpG,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,QAAQ,CAAC,KAAyB;QAC7C,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAA;QACnD,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAuC,EAAE,KAAK,CAAC,CAAA;QAClG,OAAO,CAAC,GAAG,CAAC,iDAAiD,EAAG,GAAW,EAAE,EAAE,CAAC,CAAA;QAChF,OAAO,GAAG,CAAA;IACZ,CAAC;CACF,CAAA;AAxDY,sCAAa;wBAAb,aAAa;IADzB,IAAA,iBAAU,GAAE;IAMR,WAAA,IAAA,aAAM,EAAC,uBAAU,CAAC,CAAA;qCAHa,6BAAa;QACb,wBAAa;QACX,0BAAe;QACN,uBAAU;QACtB,mBAAY;GANlC,aAAa,CAwDzB"}
@@ -0,0 +1 @@
1
+ export * from './OpenBadgesApi';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./OpenBadgesApi"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAA+B"}
@@ -0,0 +1,12 @@
1
+ export declare const VC_V2_CONTEXT = "https://www.w3.org/ns/credentials/v2";
2
+ export declare const OBV3_CONTEXT = "https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.3.json";
3
+ export declare const CLR_V2_CONTEXT = "https://purl.imsglobal.org/spec/clr/v2p0/context-2.0.1.json";
4
+ export declare const DATA_INTEGRITY_V2_CONTEXT = "https://w3id.org/security/data-integrity/v2";
5
+ export declare const REQUIRED_TYPES: string[];
6
+ export declare const ENDORSEMENT_TYPES: string[];
7
+ export declare const CLR_TYPES: string[];
8
+ export declare const DI_EDDSA_RDFC_2022 = "eddsa-rdfc-2022";
9
+ export declare const DI_ECDSA_SD_2023 = "ecdsa-sd-2023";
10
+ export declare const ONE_EDTECH_REVOCATION_LIST = "1EdTechRevocationList";
11
+ export declare const STATUS_LIST_2021 = "StatusList2021";
12
+ export { CRYPTOSUITE_ECDSA_SD_2023, CRYPTOSUITE_EDDSA_RDFC_2022, PROOF_TYPE_DATA_INTEGRITY, PROOF_TYPE_ED25519_2020, VM_TYPE_MULTIKEY, VM_TYPE_ED25519_2020, } from './cryptosuites';