@credo-ts/openid4vc 0.4.1-alpha.157

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 (192) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +31 -0
  3. package/build/index.d.ts +4 -0
  4. package/build/index.js +21 -0
  5. package/build/index.js.map +1 -0
  6. package/build/openid4vc-holder/OpenId4VcHolderApi.d.ts +83 -0
  7. package/build/openid4vc-holder/OpenId4VcHolderApi.js +115 -0
  8. package/build/openid4vc-holder/OpenId4VcHolderApi.js.map +1 -0
  9. package/build/openid4vc-holder/OpenId4VcHolderModule.d.ts +13 -0
  10. package/build/openid4vc-holder/OpenId4VcHolderModule.js +30 -0
  11. package/build/openid4vc-holder/OpenId4VcHolderModule.js.map +1 -0
  12. package/build/openid4vc-holder/OpenId4VciHolderService.d.ts +33 -0
  13. package/build/openid4vc-holder/OpenId4VciHolderService.js +512 -0
  14. package/build/openid4vc-holder/OpenId4VciHolderService.js.map +1 -0
  15. package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.d.ts +153 -0
  16. package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.js +11 -0
  17. package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.js.map +1 -0
  18. package/build/openid4vc-holder/OpenId4vcSiopHolderService.d.ts +18 -0
  19. package/build/openid4vc-holder/OpenId4vcSiopHolderService.js +228 -0
  20. package/build/openid4vc-holder/OpenId4vcSiopHolderService.js.map +1 -0
  21. package/build/openid4vc-holder/OpenId4vcSiopHolderServiceOptions.d.ts +43 -0
  22. package/build/openid4vc-holder/OpenId4vcSiopHolderServiceOptions.js +3 -0
  23. package/build/openid4vc-holder/OpenId4vcSiopHolderServiceOptions.js.map +1 -0
  24. package/build/openid4vc-holder/index.d.ts +6 -0
  25. package/build/openid4vc-holder/index.js +23 -0
  26. package/build/openid4vc-holder/index.js.map +1 -0
  27. package/build/openid4vc-issuer/OpenId4VcIssuanceSessionState.d.ts +9 -0
  28. package/build/openid4vc-issuer/OpenId4VcIssuanceSessionState.js +14 -0
  29. package/build/openid4vc-issuer/OpenId4VcIssuanceSessionState.js.map +1 -0
  30. package/build/openid4vc-issuer/OpenId4VcIssuerApi.d.ts +60 -0
  31. package/build/openid4vc-issuer/OpenId4VcIssuerApi.js +106 -0
  32. package/build/openid4vc-issuer/OpenId4VcIssuerApi.js.map +1 -0
  33. package/build/openid4vc-issuer/OpenId4VcIssuerEvents.d.ts +13 -0
  34. package/build/openid4vc-issuer/OpenId4VcIssuerEvents.js +8 -0
  35. package/build/openid4vc-issuer/OpenId4VcIssuerEvents.js.map +1 -0
  36. package/build/openid4vc-issuer/OpenId4VcIssuerModule.d.ts +21 -0
  37. package/build/openid4vc-issuer/OpenId4VcIssuerModule.js +106 -0
  38. package/build/openid4vc-issuer/OpenId4VcIssuerModule.js.map +1 -0
  39. package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.d.ts +41 -0
  40. package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.js +46 -0
  41. package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.js.map +1 -0
  42. package/build/openid4vc-issuer/OpenId4VcIssuerService.d.ts +54 -0
  43. package/build/openid4vc-issuer/OpenId4VcIssuerService.js +425 -0
  44. package/build/openid4vc-issuer/OpenId4VcIssuerService.js.map +1 -0
  45. package/build/openid4vc-issuer/OpenId4VcIssuerServiceOptions.d.ts +88 -0
  46. package/build/openid4vc-issuer/OpenId4VcIssuerServiceOptions.js +3 -0
  47. package/build/openid4vc-issuer/OpenId4VcIssuerServiceOptions.js.map +1 -0
  48. package/build/openid4vc-issuer/index.d.ts +8 -0
  49. package/build/openid4vc-issuer/index.js +27 -0
  50. package/build/openid4vc-issuer/index.js.map +1 -0
  51. package/build/openid4vc-issuer/repository/OpenId4VcCNonceStateManager.d.ts +18 -0
  52. package/build/openid4vc-issuer/repository/OpenId4VcCNonceStateManager.js +99 -0
  53. package/build/openid4vc-issuer/repository/OpenId4VcCNonceStateManager.js.map +1 -0
  54. package/build/openid4vc-issuer/repository/OpenId4VcCredentialOfferSessionStateManager.d.ts +21 -0
  55. package/build/openid4vc-issuer/repository/OpenId4VcCredentialOfferSessionStateManager.js +182 -0
  56. package/build/openid4vc-issuer/repository/OpenId4VcCredentialOfferSessionStateManager.js.map +1 -0
  57. package/build/openid4vc-issuer/repository/OpenId4VcCredentialOfferUriStateManager.d.ts +17 -0
  58. package/build/openid4vc-issuer/repository/OpenId4VcCredentialOfferUriStateManager.js +68 -0
  59. package/build/openid4vc-issuer/repository/OpenId4VcCredentialOfferUriStateManager.js.map +1 -0
  60. package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRecord.d.ts +84 -0
  61. package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRecord.js +58 -0
  62. package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRecord.js.map +1 -0
  63. package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRepository.d.ts +5 -0
  64. package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRepository.js +29 -0
  65. package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRepository.js.map +1 -0
  66. package/build/openid4vc-issuer/repository/OpenId4VcIssuerRecord.d.ts +37 -0
  67. package/build/openid4vc-issuer/repository/OpenId4VcIssuerRecord.js +31 -0
  68. package/build/openid4vc-issuer/repository/OpenId4VcIssuerRecord.js.map +1 -0
  69. package/build/openid4vc-issuer/repository/OpenId4VcIssuerRepository.d.ts +8 -0
  70. package/build/openid4vc-issuer/repository/OpenId4VcIssuerRepository.js +35 -0
  71. package/build/openid4vc-issuer/repository/OpenId4VcIssuerRepository.js.map +1 -0
  72. package/build/openid4vc-issuer/repository/index.d.ts +4 -0
  73. package/build/openid4vc-issuer/repository/index.js +21 -0
  74. package/build/openid4vc-issuer/repository/index.js.map +1 -0
  75. package/build/openid4vc-issuer/router/accessTokenEndpoint.d.ts +34 -0
  76. package/build/openid4vc-issuer/router/accessTokenEndpoint.js +111 -0
  77. package/build/openid4vc-issuer/router/accessTokenEndpoint.js.map +1 -0
  78. package/build/openid4vc-issuer/router/credentialEndpoint.d.ts +16 -0
  79. package/build/openid4vc-issuer/router/credentialEndpoint.js +44 -0
  80. package/build/openid4vc-issuer/router/credentialEndpoint.js.map +1 -0
  81. package/build/openid4vc-issuer/router/credentialOfferEndpoint.d.ts +11 -0
  82. package/build/openid4vc-issuer/router/credentialOfferEndpoint.js +61 -0
  83. package/build/openid4vc-issuer/router/credentialOfferEndpoint.js.map +1 -0
  84. package/build/openid4vc-issuer/router/index.d.ts +5 -0
  85. package/build/openid4vc-issuer/router/index.js +12 -0
  86. package/build/openid4vc-issuer/router/index.js.map +1 -0
  87. package/build/openid4vc-issuer/router/metadataEndpoint.d.ts +2 -0
  88. package/build/openid4vc-issuer/router/metadataEndpoint.js +30 -0
  89. package/build/openid4vc-issuer/router/metadataEndpoint.js.map +1 -0
  90. package/build/openid4vc-issuer/router/requestContext.d.ts +5 -0
  91. package/build/openid4vc-issuer/router/requestContext.js +3 -0
  92. package/build/openid4vc-issuer/router/requestContext.js.map +1 -0
  93. package/build/openid4vc-issuer/router/verifyAccessToken.d.ts +3 -0
  94. package/build/openid4vc-issuer/router/verifyAccessToken.js +33 -0
  95. package/build/openid4vc-issuer/router/verifyAccessToken.js.map +1 -0
  96. package/build/openid4vc-issuer/util/credentialRequest.d.ts +5 -0
  97. package/build/openid4vc-issuer/util/credentialRequest.js +18 -0
  98. package/build/openid4vc-issuer/util/credentialRequest.js.map +1 -0
  99. package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.d.ts +43 -0
  100. package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.js +357 -0
  101. package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.js.map +1 -0
  102. package/build/openid4vc-verifier/OpenId4VcSiopVerifierServiceOptions.d.ts +45 -0
  103. package/build/openid4vc-verifier/OpenId4VcSiopVerifierServiceOptions.js +3 -0
  104. package/build/openid4vc-verifier/OpenId4VcSiopVerifierServiceOptions.js.map +1 -0
  105. package/build/openid4vc-verifier/OpenId4VcVerificationSessionState.d.ts +6 -0
  106. package/build/openid4vc-verifier/OpenId4VcVerificationSessionState.js +11 -0
  107. package/build/openid4vc-verifier/OpenId4VcVerificationSessionState.js.map +1 -0
  108. package/build/openid4vc-verifier/OpenId4VcVerifierApi.d.ts +60 -0
  109. package/build/openid4vc-verifier/OpenId4VcVerifierApi.js +102 -0
  110. package/build/openid4vc-verifier/OpenId4VcVerifierApi.js.map +1 -0
  111. package/build/openid4vc-verifier/OpenId4VcVerifierEvents.d.ts +13 -0
  112. package/build/openid4vc-verifier/OpenId4VcVerifierEvents.js +8 -0
  113. package/build/openid4vc-verifier/OpenId4VcVerifierEvents.js.map +1 -0
  114. package/build/openid4vc-verifier/OpenId4VcVerifierModule.d.ts +21 -0
  115. package/build/openid4vc-verifier/OpenId4VcVerifierModule.js +103 -0
  116. package/build/openid4vc-verifier/OpenId4VcVerifierModule.js.map +1 -0
  117. package/build/openid4vc-verifier/OpenId4VcVerifierModuleConfig.d.ts +31 -0
  118. package/build/openid4vc-verifier/OpenId4VcVerifierModuleConfig.js +28 -0
  119. package/build/openid4vc-verifier/OpenId4VcVerifierModuleConfig.js.map +1 -0
  120. package/build/openid4vc-verifier/index.d.ts +8 -0
  121. package/build/openid4vc-verifier/index.js +25 -0
  122. package/build/openid4vc-verifier/index.js.map +1 -0
  123. package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartyEventEmitter.d.ts +50 -0
  124. package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartyEventEmitter.js +229 -0
  125. package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartyEventEmitter.js.map +1 -0
  126. package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartySessionManager.d.ts +19 -0
  127. package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartySessionManager.js +146 -0
  128. package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartySessionManager.js.map +1 -0
  129. package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.d.ts +61 -0
  130. package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.js +45 -0
  131. package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.js.map +1 -0
  132. package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRepository.d.ts +5 -0
  133. package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRepository.js +29 -0
  134. package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRepository.js.map +1 -0
  135. package/build/openid4vc-verifier/repository/OpenId4VcVerifierRecord.d.ts +26 -0
  136. package/build/openid4vc-verifier/repository/OpenId4VcVerifierRecord.js +28 -0
  137. package/build/openid4vc-verifier/repository/OpenId4VcVerifierRecord.js.map +1 -0
  138. package/build/openid4vc-verifier/repository/OpenId4VcVerifierRepository.d.ts +8 -0
  139. package/build/openid4vc-verifier/repository/OpenId4VcVerifierRepository.js +35 -0
  140. package/build/openid4vc-verifier/repository/OpenId4VcVerifierRepository.js.map +1 -0
  141. package/build/openid4vc-verifier/repository/index.d.ts +4 -0
  142. package/build/openid4vc-verifier/repository/index.js +21 -0
  143. package/build/openid4vc-verifier/repository/index.js.map +1 -0
  144. package/build/openid4vc-verifier/router/authorizationEndpoint.d.ts +11 -0
  145. package/build/openid4vc-verifier/router/authorizationEndpoint.js +37 -0
  146. package/build/openid4vc-verifier/router/authorizationEndpoint.js.map +1 -0
  147. package/build/openid4vc-verifier/router/authorizationRequestEndpoint.d.ts +11 -0
  148. package/build/openid4vc-verifier/router/authorizationRequestEndpoint.js +65 -0
  149. package/build/openid4vc-verifier/router/authorizationRequestEndpoint.js.map +1 -0
  150. package/build/openid4vc-verifier/router/index.d.ts +2 -0
  151. package/build/openid4vc-verifier/router/index.js +6 -0
  152. package/build/openid4vc-verifier/router/index.js.map +1 -0
  153. package/build/openid4vc-verifier/router/requestContext.d.ts +5 -0
  154. package/build/openid4vc-verifier/router/requestContext.js +3 -0
  155. package/build/openid4vc-verifier/router/requestContext.js.map +1 -0
  156. package/build/shared/index.d.ts +2 -0
  157. package/build/shared/index.js +19 -0
  158. package/build/shared/index.js.map +1 -0
  159. package/build/shared/issuerMetadataUtils.d.ts +14 -0
  160. package/build/shared/issuerMetadataUtils.js +69 -0
  161. package/build/shared/issuerMetadataUtils.js.map +1 -0
  162. package/build/shared/models/CredentialHolderBinding.d.ts +10 -0
  163. package/build/shared/models/CredentialHolderBinding.js +3 -0
  164. package/build/shared/models/CredentialHolderBinding.js.map +1 -0
  165. package/build/shared/models/OpenId4VcJwtIssuer.d.ts +6 -0
  166. package/build/shared/models/OpenId4VcJwtIssuer.js +3 -0
  167. package/build/shared/models/OpenId4VcJwtIssuer.js.map +1 -0
  168. package/build/shared/models/OpenId4VciCredentialFormatProfile.d.ts +6 -0
  169. package/build/shared/models/OpenId4VciCredentialFormatProfile.js +11 -0
  170. package/build/shared/models/OpenId4VciCredentialFormatProfile.js.map +1 -0
  171. package/build/shared/models/index.d.ts +21 -0
  172. package/build/shared/models/index.js +20 -0
  173. package/build/shared/models/index.js.map +1 -0
  174. package/build/shared/router/context.d.ts +10 -0
  175. package/build/shared/router/context.js +22 -0
  176. package/build/shared/router/context.js.map +1 -0
  177. package/build/shared/router/express.d.ts +2 -0
  178. package/build/shared/router/express.js +16 -0
  179. package/build/shared/router/express.js.map +1 -0
  180. package/build/shared/router/index.d.ts +3 -0
  181. package/build/shared/router/index.js +20 -0
  182. package/build/shared/router/index.js.map +1 -0
  183. package/build/shared/router/tenants.d.ts +13 -0
  184. package/build/shared/router/tenants.js +50 -0
  185. package/build/shared/router/tenants.js.map +1 -0
  186. package/build/shared/transform.d.ts +5 -0
  187. package/build/shared/transform.js +61 -0
  188. package/build/shared/transform.js.map +1 -0
  189. package/build/shared/utils.d.ts +21 -0
  190. package/build/shared/utils.js +85 -0
  191. package/build/shared/utils.js.map +1 -0
  192. package/package.json +44 -0
@@ -0,0 +1,102 @@
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 __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.OpenId4VcVerifierApi = void 0;
24
+ const core_1 = require("@credo-ts/core");
25
+ const OpenId4VcSiopVerifierService_1 = require("./OpenId4VcSiopVerifierService");
26
+ const OpenId4VcVerifierModuleConfig_1 = require("./OpenId4VcVerifierModuleConfig");
27
+ /**
28
+ * @public
29
+ */
30
+ let OpenId4VcVerifierApi = class OpenId4VcVerifierApi {
31
+ constructor(config, agentContext, openId4VcSiopVerifierService) {
32
+ this.config = config;
33
+ this.agentContext = agentContext;
34
+ this.openId4VcSiopVerifierService = openId4VcSiopVerifierService;
35
+ }
36
+ /**
37
+ * Retrieve all verifier records from storage
38
+ */
39
+ async getAllVerifiers() {
40
+ return this.openId4VcSiopVerifierService.getAllVerifiers(this.agentContext);
41
+ }
42
+ /**
43
+ * Retrieve a verifier record from storage by its verified id
44
+ */
45
+ async getVerifierByVerifierId(verifierId) {
46
+ return this.openId4VcSiopVerifierService.getVerifierByVerifierId(this.agentContext, verifierId);
47
+ }
48
+ /**
49
+ * Create a new verifier and store the new verifier record.
50
+ */
51
+ async createVerifier(options) {
52
+ return this.openId4VcSiopVerifierService.createVerifier(this.agentContext, options);
53
+ }
54
+ async findVerificationSessionsByQuery(query) {
55
+ return this.openId4VcSiopVerifierService.findVerificationSessionsByQuery(this.agentContext, query);
56
+ }
57
+ async getVerificationSessionById(verificationSessionId) {
58
+ return this.openId4VcSiopVerifierService.getVerificationSessionById(this.agentContext, verificationSessionId);
59
+ }
60
+ /**
61
+ * Create an authorization request, acting as a Relying Party (RP).
62
+ *
63
+ * Currently two types of requests are supported:
64
+ * - SIOP Self-Issued ID Token request: request to a Self-Issued OP from an RP
65
+ * - SIOP Verifiable Presentation Request: request to a Self-Issued OP from an RP, requesting a Verifiable Presentation using OpenID4VP
66
+ *
67
+ * Other flows (non-SIOP) are not supported at the moment, but can be added in the future.
68
+ *
69
+ * See {@link OpenId4VcSiopCreateAuthorizationRequestOptions} for detailed documentation on the options.
70
+ */
71
+ async createAuthorizationRequest(_a) {
72
+ var { verifierId } = _a, otherOptions = __rest(_a, ["verifierId"]);
73
+ const verifier = await this.getVerifierByVerifierId(verifierId);
74
+ return await this.openId4VcSiopVerifierService.createAuthorizationRequest(this.agentContext, Object.assign(Object.assign({}, otherOptions), { verifier }));
75
+ }
76
+ /**
77
+ * Verifies an authorization response, acting as a Relying Party (RP).
78
+ *
79
+ * It validates the ID Token, VP Token and the signature(s) of the received Verifiable Presentation(s)
80
+ * as well as that the structure of the Verifiable Presentation matches the provided presentation definition.
81
+ */
82
+ async verifyAuthorizationResponse(_a) {
83
+ var { verificationSessionId } = _a, otherOptions = __rest(_a, ["verificationSessionId"]);
84
+ const verificationSession = await this.getVerificationSessionById(verificationSessionId);
85
+ return await this.openId4VcSiopVerifierService.verifyAuthorizationResponse(this.agentContext, Object.assign(Object.assign({}, otherOptions), { verificationSession }));
86
+ }
87
+ async getVerifiedAuthorizationResponse(verificationSessionId) {
88
+ const verificationSession = await this.getVerificationSessionById(verificationSessionId);
89
+ return this.openId4VcSiopVerifierService.getVerifiedAuthorizationResponse(verificationSession);
90
+ }
91
+ async findVerificationSessionForAuthorizationResponse(options) {
92
+ return this.openId4VcSiopVerifierService.findVerificationSessionForAuthorizationResponse(this.agentContext, options);
93
+ }
94
+ };
95
+ OpenId4VcVerifierApi = __decorate([
96
+ (0, core_1.injectable)(),
97
+ __metadata("design:paramtypes", [OpenId4VcVerifierModuleConfig_1.OpenId4VcVerifierModuleConfig,
98
+ core_1.AgentContext,
99
+ OpenId4VcSiopVerifierService_1.OpenId4VcSiopVerifierService])
100
+ ], OpenId4VcVerifierApi);
101
+ exports.OpenId4VcVerifierApi = OpenId4VcVerifierApi;
102
+ //# sourceMappingURL=OpenId4VcVerifierApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenId4VcVerifierApi.js","sourceRoot":"","sources":["../../src/openid4vc-verifier/OpenId4VcVerifierApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAUA,yCAAyD;AAEzD,iFAA6E;AAC7E,mFAA+E;AAE/E;;GAEG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAC/B,YACkB,MAAqC,EAC7C,YAA0B,EAC1B,4BAA0D;QAFlD,WAAM,GAAN,MAAM,CAA+B;QAC7C,iBAAY,GAAZ,YAAY,CAAc;QAC1B,iCAA4B,GAA5B,4BAA4B,CAA8B;IACjE,CAAC;IAEJ;;OAEG;IACI,KAAK,CAAC,eAAe;QAC1B,OAAO,IAAI,CAAC,4BAA4B,CAAC,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;IAC7E,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,uBAAuB,CAAC,UAAkB;QACrD,OAAO,IAAI,CAAC,4BA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,GAAG,MAAM,IAAI,CAAC,0BAA0B,CAAC,qBAAqB,CAAC,CAAA;QACxF,OAAO,IAAI,CAAC,4BAA4B,CAAC,gCAAgC,CAAC,mBAAmB,CAAC,CAAA;IAChG,CAAC;IAEM,KAAK,CAAC,+CAA+C,CAAC,OAG5D;QACC,OAAO,IAAI,CAAC,4BAA4B,CAAC,+CAA+C,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;IACtH,CAAC;CACF,CAAA;AA1FY,oBAAoB;IADhC,IAAA,iBAAU,GAAE;qCAGe,6DAA6B;QAC/B,mBAAY;QACI,2DAA4B;GAJzD,oBAAoB,CA0FhC;AA1FY,oDAAoB"}
@@ -0,0 +1,13 @@
1
+ import type { OpenId4VcVerificationSessionState } from './OpenId4VcVerificationSessionState';
2
+ import type { OpenId4VcVerificationSessionRecord } from './repository';
3
+ import type { BaseEvent } from '@credo-ts/core';
4
+ export declare enum OpenId4VcVerifierEvents {
5
+ VerificationSessionStateChanged = "OpenId4VcVerifier.VerificationSessionStateChanged"
6
+ }
7
+ export interface OpenId4VcVerificationSessionStateChangedEvent extends BaseEvent {
8
+ type: typeof OpenId4VcVerifierEvents.VerificationSessionStateChanged;
9
+ payload: {
10
+ verificationSession: OpenId4VcVerificationSessionRecord;
11
+ previousState: OpenId4VcVerificationSessionState | null;
12
+ };
13
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OpenId4VcVerifierEvents = void 0;
4
+ var OpenId4VcVerifierEvents;
5
+ (function (OpenId4VcVerifierEvents) {
6
+ OpenId4VcVerifierEvents["VerificationSessionStateChanged"] = "OpenId4VcVerifier.VerificationSessionStateChanged";
7
+ })(OpenId4VcVerifierEvents = exports.OpenId4VcVerifierEvents || (exports.OpenId4VcVerifierEvents = {}));
8
+ //# sourceMappingURL=OpenId4VcVerifierEvents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenId4VcVerifierEvents.js","sourceRoot":"","sources":["../../src/openid4vc-verifier/OpenId4VcVerifierEvents.ts"],"names":[],"mappings":";;;AAIA,IAAY,uBAEX;AAFD,WAAY,uBAAuB;IACjC,gHAAqF,CAAA;AACvF,CAAC,EAFW,uBAAuB,GAAvB,+BAAuB,KAAvB,+BAAuB,QAElC"}
@@ -0,0 +1,21 @@
1
+ import type { OpenId4VcVerifierModuleConfigOptions } from './OpenId4VcVerifierModuleConfig';
2
+ import type { AgentContext, DependencyManager, Module } from '@credo-ts/core';
3
+ import { OpenId4VcVerifierApi } from './OpenId4VcVerifierApi';
4
+ import { OpenId4VcVerifierModuleConfig } from './OpenId4VcVerifierModuleConfig';
5
+ /**
6
+ * @public
7
+ */
8
+ export declare class OpenId4VcVerifierModule implements Module {
9
+ readonly api: typeof OpenId4VcVerifierApi;
10
+ readonly config: OpenId4VcVerifierModuleConfig;
11
+ constructor(options: OpenId4VcVerifierModuleConfigOptions);
12
+ /**
13
+ * Registers the dependencies of the question answer module on the dependency manager.
14
+ */
15
+ register(dependencyManager: DependencyManager): void;
16
+ initialize(rootAgentContext: AgentContext): Promise<void>;
17
+ /**
18
+ * Registers the endpoints on the router passed to this module.
19
+ */
20
+ private configureRouter;
21
+ }
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OpenId4VcVerifierModule = void 0;
4
+ const core_1 = require("@credo-ts/core");
5
+ const router_1 = require("../shared/router");
6
+ const OpenId4VcSiopVerifierService_1 = require("./OpenId4VcSiopVerifierService");
7
+ const OpenId4VcVerifierApi_1 = require("./OpenId4VcVerifierApi");
8
+ const OpenId4VcVerifierModuleConfig_1 = require("./OpenId4VcVerifierModuleConfig");
9
+ const repository_1 = require("./repository");
10
+ const OpenId4VcRelyingPartyEventEmitter_1 = require("./repository/OpenId4VcRelyingPartyEventEmitter");
11
+ const router_2 = require("./router");
12
+ const authorizationRequestEndpoint_1 = require("./router/authorizationRequestEndpoint");
13
+ /**
14
+ * @public
15
+ */
16
+ class OpenId4VcVerifierModule {
17
+ constructor(options) {
18
+ this.api = OpenId4VcVerifierApi_1.OpenId4VcVerifierApi;
19
+ this.config = new OpenId4VcVerifierModuleConfig_1.OpenId4VcVerifierModuleConfig(options);
20
+ }
21
+ /**
22
+ * Registers the dependencies of the question answer module on the dependency manager.
23
+ */
24
+ register(dependencyManager) {
25
+ // Warn about experimental module
26
+ const logger = dependencyManager.resolve(core_1.AgentConfig).logger;
27
+ logger.warn("The '@credo-ts/openid4vc' Verifier module is experimental and could have unexpected breaking changes. When using this module, make sure to use strict versions for all @credo-ts packages.");
28
+ // Register config
29
+ dependencyManager.registerInstance(OpenId4VcVerifierModuleConfig_1.OpenId4VcVerifierModuleConfig, this.config);
30
+ // Services
31
+ dependencyManager.registerSingleton(OpenId4VcSiopVerifierService_1.OpenId4VcSiopVerifierService);
32
+ // Repository
33
+ dependencyManager.registerSingleton(repository_1.OpenId4VcVerifierRepository);
34
+ // Global event emitter
35
+ dependencyManager.registerSingleton(OpenId4VcRelyingPartyEventEmitter_1.OpenId4VcRelyingPartyEventHandler);
36
+ }
37
+ async initialize(rootAgentContext) {
38
+ this.configureRouter(rootAgentContext);
39
+ }
40
+ /**
41
+ * Registers the endpoints on the router passed to this module.
42
+ */
43
+ configureRouter(rootAgentContext) {
44
+ const { Router, json, urlencoded } = (0, router_1.importExpress)();
45
+ // FIXME: it is currently not possible to initialize an agent
46
+ // shut it down, and then start it again, as the
47
+ // express router is configured with a specific `AgentContext` instance
48
+ // and dependency manager. One option is to always create a new router
49
+ // but then users cannot pass their own router implementation.
50
+ // We need to find a proper way to fix this.
51
+ // We use separate context router and endpoint router. Context router handles the linking of the request
52
+ // to a specific agent context. Endpoint router only knows about a single context
53
+ const endpointRouter = Router();
54
+ const contextRouter = this.config.router;
55
+ // parse application/x-www-form-urlencoded
56
+ contextRouter.use(urlencoded({ extended: false }));
57
+ // parse application/json
58
+ contextRouter.use(json());
59
+ contextRouter.param('verifierId', async (req, _res, next, verifierId) => {
60
+ if (!verifierId) {
61
+ rootAgentContext.config.logger.debug('No verifierId provided for incoming authorization response, returning 404');
62
+ _res.status(404).send('Not found');
63
+ }
64
+ let agentContext = undefined;
65
+ try {
66
+ agentContext = await (0, router_1.getAgentContextForActorId)(rootAgentContext, verifierId);
67
+ const verifierApi = agentContext.dependencyManager.resolve(OpenId4VcVerifierApi_1.OpenId4VcVerifierApi);
68
+ const verifier = await verifierApi.getVerifierByVerifierId(verifierId);
69
+ req.requestContext = {
70
+ agentContext,
71
+ verifier,
72
+ };
73
+ }
74
+ catch (error) {
75
+ agentContext === null || agentContext === void 0 ? void 0 : agentContext.config.logger.error('Failed to correlate incoming openid request to existing tenant and verifier', {
76
+ error,
77
+ });
78
+ // If the opening failed
79
+ await (agentContext === null || agentContext === void 0 ? void 0 : agentContext.endSession());
80
+ return _res.status(404).send('Not found');
81
+ }
82
+ next();
83
+ });
84
+ contextRouter.use('/:verifierId', endpointRouter);
85
+ // Configure endpoints
86
+ (0, router_2.configureAuthorizationEndpoint)(endpointRouter, this.config.authorizationEndpoint);
87
+ (0, authorizationRequestEndpoint_1.configureAuthorizationRequestEndpoint)(endpointRouter, this.config.authorizationRequestEndpoint);
88
+ // First one will be called for all requests (when next is called)
89
+ contextRouter.use(async (req, _res, next) => {
90
+ const { agentContext } = (0, router_1.getRequestContext)(req);
91
+ await agentContext.endSession();
92
+ next();
93
+ });
94
+ // This one will be called for all errors that are thrown
95
+ contextRouter.use(async (_error, req, _res, next) => {
96
+ const { agentContext } = (0, router_1.getRequestContext)(req);
97
+ await agentContext.endSession();
98
+ next();
99
+ });
100
+ }
101
+ }
102
+ exports.OpenId4VcVerifierModule = OpenId4VcVerifierModule;
103
+ //# sourceMappingURL=OpenId4VcVerifierModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenId4VcVerifierModule.js","sourceRoot":"","sources":["../../src/openid4vc-verifier/OpenId4VcVerifierModule.ts"],"names":[],"mappings":";;;AAKA,y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AAC,CAAC,CAAA;QAEF,aAAa,CAAC,GAAG,CAAC,cAAc,EAAE,cAAc,CAAC,CAAA;QAEjD,sBAAsB;QACtB,IAAA,uCAA8B,EAAC,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAA;QACjF,IAAA,oEAAqC,EAAC,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,4BAA4B,CAAC,CAAA;QAE/F,kEAAkE;QAClE,aAAa,CAAC,GAAG,CAAC,KAAK,EAAE,GAAiC,EAAE,IAAa,EAAE,IAAI,EAAE,EAAE;YACjF,MAAM,EAAE,YAAY,EAAE,GAAG,IAAA,0BAAiB,EAAC,GAAG,CAAC,CAAA;YAC/C,MAAM,YAAY,CAAC,UAAU,EAAE,CAAA;YAC/B,IAAI,EAAE,CAAA;QACR,CAAC,CAAC,CAAA;QAEF,yDAAyD;QACzD,aAAa,CAAC,GAAG,CAAC,KAAK,EAAE,MAAe,EAAE,GAAiC,EAAE,IAAa,EAAE,IAAkB,EAAE,EAAE;YAChH,MAAM,EAAE,YAAY,EAAE,GAAG,IAAA,0BAAiB,EAAC,GAAG,CAAC,CAAA;YAC/C,MAAM,YAAY,CAAC,UAAU,EAAE,CAAA;YAC/B,IAAI,EAAE,CAAA;QACR,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAhHD,0DAgHC"}
@@ -0,0 +1,31 @@
1
+ import type { OpenId4VcSiopAuthorizationEndpointConfig } from './router/authorizationEndpoint';
2
+ import type { OpenId4VcSiopAuthorizationRequestEndpointConfig } from './router/authorizationRequestEndpoint';
3
+ import type { Optional } from '@credo-ts/core';
4
+ import type { Router } from 'express';
5
+ export interface OpenId4VcVerifierModuleConfigOptions {
6
+ /**
7
+ * Base url at which the verifier endpoints will be hosted. All endpoints will be exposed with
8
+ * this path as prefix.
9
+ */
10
+ baseUrl: string;
11
+ /**
12
+ * Express router on which the verifier endpoints will be registered. If
13
+ * no router is provided, a new one will be created.
14
+ *
15
+ * NOTE: you must manually register the router on your express app and
16
+ * expose this on a public url that is reachable when `baseUrl` is called.
17
+ */
18
+ router?: Router;
19
+ endpoints?: {
20
+ authorization?: Optional<OpenId4VcSiopAuthorizationEndpointConfig, 'endpointPath'>;
21
+ authorizationRequest?: Optional<OpenId4VcSiopAuthorizationRequestEndpointConfig, 'endpointPath'>;
22
+ };
23
+ }
24
+ export declare class OpenId4VcVerifierModuleConfig {
25
+ private options;
26
+ readonly router: Router;
27
+ constructor(options: OpenId4VcVerifierModuleConfigOptions);
28
+ get baseUrl(): string;
29
+ get authorizationRequestEndpoint(): OpenId4VcSiopAuthorizationRequestEndpointConfig;
30
+ get authorizationEndpoint(): OpenId4VcSiopAuthorizationEndpointConfig;
31
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OpenId4VcVerifierModuleConfig = void 0;
4
+ const router_1 = require("../shared/router");
5
+ class OpenId4VcVerifierModuleConfig {
6
+ constructor(options) {
7
+ var _a;
8
+ this.options = options;
9
+ this.router = (_a = options.router) !== null && _a !== void 0 ? _a : (0, router_1.importExpress)().Router();
10
+ }
11
+ get baseUrl() {
12
+ return this.options.baseUrl;
13
+ }
14
+ get authorizationRequestEndpoint() {
15
+ var _a, _b, _c, _d;
16
+ // Use user supplied options, or return defaults.
17
+ const userOptions = (_a = this.options.endpoints) === null || _a === void 0 ? void 0 : _a.authorizationRequest;
18
+ return Object.assign(Object.assign({}, userOptions), { endpointPath: (_d = (_c = (_b = this.options.endpoints) === null || _b === void 0 ? void 0 : _b.authorizationRequest) === null || _c === void 0 ? void 0 : _c.endpointPath) !== null && _d !== void 0 ? _d : '/authorization-requests' });
19
+ }
20
+ get authorizationEndpoint() {
21
+ var _a, _b;
22
+ // Use user supplied options, or return defaults.
23
+ const userOptions = (_a = this.options.endpoints) === null || _a === void 0 ? void 0 : _a.authorization;
24
+ return Object.assign(Object.assign({}, userOptions), { endpointPath: (_b = userOptions === null || userOptions === void 0 ? void 0 : userOptions.endpointPath) !== null && _b !== void 0 ? _b : '/authorize' });
25
+ }
26
+ }
27
+ exports.OpenId4VcVerifierModuleConfig = OpenId4VcVerifierModuleConfig;
28
+ //# sourceMappingURL=OpenId4VcVerifierModuleConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenId4VcVerifierModuleConfig.js","sourceRoot":"","sources":["../../src/openid4vc-verifier/OpenId4VcVerifierModuleConfig.ts"],"names":[],"mappings":";;;AAKA,6CAAgD;AAwBhD,MAAa,6BAA6B;IAIxC,YAAmB,OAA6C;;QAC9D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QAEtB,IAAI,CAAC,MAAM,GAAG,MAAA,OAAO,CAAC,MAAM,mCAAI,IAAA,sBAAa,GAAE,CAAC,MAAM,EAAE,CAAA;IAC1D,CAAC;IAED,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAA;IAC7B,CAAC;IAED,IAAW,4BAA4B;;QACrC,iDAAiD;QACjD,MAAM,WAAW,GAAG,MAAA,IAAI,CAAC,OAAO,CAAC,SAAS,0CAAE,oBAAoB,CAAA;QAEhE,uCACK,WAAW,KACd,YAAY,EAAE,MAAA,MAAA,MAAA,IAAI,CAAC,OAAO,CAAC,SAAS,0CAAE,oBAAoB,0CAAE,YAAY,mCAAI,yBAAyB,IACtG;IACH,CAAC;IAED,IAAW,qBAAqB;;QAC9B,iDAAiD;QACjD,MAAM,WAAW,GAAG,MAAA,IAAI,CAAC,OAAO,CAAC,SAAS,0CAAE,aAAa,CAAA;QAEzD,uCACK,WAAW,KACd,YAAY,EAAE,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,YAAY,mCAAI,YAAY,IACxD;IACH,CAAC;CACF;AAjCD,sEAiCC"}
@@ -0,0 +1,8 @@
1
+ export * from './OpenId4VcVerifierApi';
2
+ export * from './OpenId4VcVerifierModule';
3
+ export * from './OpenId4VcSiopVerifierService';
4
+ export * from './OpenId4VcSiopVerifierServiceOptions';
5
+ export * from './OpenId4VcVerifierModuleConfig';
6
+ export * from './repository';
7
+ export * from './OpenId4VcVerificationSessionState';
8
+ export * from './OpenId4VcVerifierEvents';
@@ -0,0 +1,25 @@
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("./OpenId4VcVerifierApi"), exports);
18
+ __exportStar(require("./OpenId4VcVerifierModule"), exports);
19
+ __exportStar(require("./OpenId4VcSiopVerifierService"), exports);
20
+ __exportStar(require("./OpenId4VcSiopVerifierServiceOptions"), exports);
21
+ __exportStar(require("./OpenId4VcVerifierModuleConfig"), exports);
22
+ __exportStar(require("./repository"), exports);
23
+ __exportStar(require("./OpenId4VcVerificationSessionState"), exports);
24
+ __exportStar(require("./OpenId4VcVerifierEvents"), exports);
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/openid4vc-verifier/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAsC;AACtC,4DAAyC;AACzC,iEAA8C;AAC9C,wEAAqD;AACrD,kEAA+C;AAC/C,+CAA4B;AAC5B,sEAAmD;AACnD,4DAAyC"}
@@ -0,0 +1,50 @@
1
+ /// <reference types="node" />
2
+ import type { AgentContext } from '@credo-ts/core';
3
+ import { AgentContextProvider, AgentDependencies } from '@credo-ts/core';
4
+ import { EventEmitter as NativeEventEmitter } from 'events';
5
+ import { OpenId4VcVerificationSessionState } from '../OpenId4VcVerificationSessionState';
6
+ import { OpenId4VcVerificationSessionRecord } from './OpenId4VcVerificationSessionRecord';
7
+ export declare class OpenId4VcRelyingPartyEventHandler {
8
+ private agentContextProvider;
9
+ readonly nativeEventEmitter: NativeEventEmitter;
10
+ constructor(agentContextProvider: AgentContextProvider, agentDependencies: AgentDependencies);
11
+ getEventEmitterForVerifier(contextCorrelationId: string, verifierId: string): OpenId4VcRelyingPartyEventEmitter;
12
+ private onAuthorizationRequestCreatedSuccess;
13
+ private onAuthorizationRequestSentSuccess;
14
+ private onAuthorizationResponseReceivedFailed;
15
+ private onAuthorizationResponseVerifiedSuccess;
16
+ private onAuthorizationResponseVerifiedFailed;
17
+ private withSession;
18
+ protected emitStateChangedEvent(agentContext: AgentContext, verificationSession: OpenId4VcVerificationSessionRecord, previousState: OpenId4VcVerificationSessionState | null): void;
19
+ }
20
+ /**
21
+ * Custom implementation of the event emitter so we can associate the contextCorrelationId
22
+ * and the verifierId with the events that are emitted. This allows us to only create one
23
+ * event emitter and thus not have endless event emitters and listeners for each active RP.
24
+ *
25
+ * We only modify the emit method, and add the verifierId and contextCorrelationId to the event
26
+ * this allows the listener to know which tenant and which verifier the event is associated with.
27
+ */
28
+ declare class OpenId4VcRelyingPartyEventEmitter implements NativeEventEmitter {
29
+ private nativeEventEmitter;
30
+ private contextCorrelationId;
31
+ private verifierId;
32
+ constructor(nativeEventEmitter: NativeEventEmitter, contextCorrelationId: string, verifierId: string);
33
+ emit(eventName: string | symbol, ...args: any[]): boolean;
34
+ [NativeEventEmitter.captureRejectionSymbol]?(error: Error, event: string, ...args: any[]): void;
35
+ addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
36
+ on(eventName: string | symbol, listener: (...args: any[]) => void): this;
37
+ once(eventName: string | symbol, listener: (...args: any[]) => void): this;
38
+ removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
39
+ off(eventName: string | symbol, listener: (...args: any[]) => void): this;
40
+ removeAllListeners(event?: string | symbol | undefined): this;
41
+ setMaxListeners(n: number): this;
42
+ getMaxListeners(): number;
43
+ listeners(eventName: string | symbol): Function[];
44
+ rawListeners(eventName: string | symbol): Function[];
45
+ listenerCount(eventName: string | symbol, listener?: Function | undefined): number;
46
+ prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
47
+ prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
48
+ eventNames(): (string | symbol)[];
49
+ }
50
+ export {};