@credo-ts/openid4vc 0.5.0-alpha.115

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 (141) 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 +510 -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/OpenId4VcIssuerApi.d.ts +62 -0
  28. package/build/openid4vc-issuer/OpenId4VcIssuerApi.js +111 -0
  29. package/build/openid4vc-issuer/OpenId4VcIssuerApi.js.map +1 -0
  30. package/build/openid4vc-issuer/OpenId4VcIssuerModule.d.ts +21 -0
  31. package/build/openid4vc-issuer/OpenId4VcIssuerModule.js +103 -0
  32. package/build/openid4vc-issuer/OpenId4VcIssuerModule.js.map +1 -0
  33. package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.d.ts +43 -0
  34. package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.js +68 -0
  35. package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.js.map +1 -0
  36. package/build/openid4vc-issuer/OpenId4VcIssuerService.d.ts +40 -0
  37. package/build/openid4vc-issuer/OpenId4VcIssuerService.js +392 -0
  38. package/build/openid4vc-issuer/OpenId4VcIssuerService.js.map +1 -0
  39. package/build/openid4vc-issuer/OpenId4VcIssuerServiceOptions.d.ts +85 -0
  40. package/build/openid4vc-issuer/OpenId4VcIssuerServiceOptions.js +3 -0
  41. package/build/openid4vc-issuer/OpenId4VcIssuerServiceOptions.js.map +1 -0
  42. package/build/openid4vc-issuer/index.d.ts +6 -0
  43. package/build/openid4vc-issuer/index.js +25 -0
  44. package/build/openid4vc-issuer/index.js.map +1 -0
  45. package/build/openid4vc-issuer/repository/OpenId4VcIssuerRecord.d.ts +37 -0
  46. package/build/openid4vc-issuer/repository/OpenId4VcIssuerRecord.js +31 -0
  47. package/build/openid4vc-issuer/repository/OpenId4VcIssuerRecord.js.map +1 -0
  48. package/build/openid4vc-issuer/repository/OpenId4VcIssuerRepository.d.ts +8 -0
  49. package/build/openid4vc-issuer/repository/OpenId4VcIssuerRepository.js +35 -0
  50. package/build/openid4vc-issuer/repository/OpenId4VcIssuerRepository.js.map +1 -0
  51. package/build/openid4vc-issuer/repository/index.d.ts +2 -0
  52. package/build/openid4vc-issuer/repository/index.js +19 -0
  53. package/build/openid4vc-issuer/repository/index.js.map +1 -0
  54. package/build/openid4vc-issuer/router/accessTokenEndpoint.d.ts +34 -0
  55. package/build/openid4vc-issuer/router/accessTokenEndpoint.js +97 -0
  56. package/build/openid4vc-issuer/router/accessTokenEndpoint.js.map +1 -0
  57. package/build/openid4vc-issuer/router/credentialEndpoint.d.ts +16 -0
  58. package/build/openid4vc-issuer/router/credentialEndpoint.js +26 -0
  59. package/build/openid4vc-issuer/router/credentialEndpoint.js.map +1 -0
  60. package/build/openid4vc-issuer/router/index.d.ts +4 -0
  61. package/build/openid4vc-issuer/router/index.js +10 -0
  62. package/build/openid4vc-issuer/router/index.js.map +1 -0
  63. package/build/openid4vc-issuer/router/metadataEndpoint.d.ts +2 -0
  64. package/build/openid4vc-issuer/router/metadataEndpoint.js +30 -0
  65. package/build/openid4vc-issuer/router/metadataEndpoint.js.map +1 -0
  66. package/build/openid4vc-issuer/router/requestContext.d.ts +5 -0
  67. package/build/openid4vc-issuer/router/requestContext.js +3 -0
  68. package/build/openid4vc-issuer/router/requestContext.js.map +1 -0
  69. package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.d.ts +27 -0
  70. package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.js +277 -0
  71. package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.js.map +1 -0
  72. package/build/openid4vc-verifier/OpenId4VcSiopVerifierServiceOptions.d.ts +44 -0
  73. package/build/openid4vc-verifier/OpenId4VcSiopVerifierServiceOptions.js +3 -0
  74. package/build/openid4vc-verifier/OpenId4VcSiopVerifierServiceOptions.js.map +1 -0
  75. package/build/openid4vc-verifier/OpenId4VcVerifierApi.d.ts +48 -0
  76. package/build/openid4vc-verifier/OpenId4VcVerifierApi.js +89 -0
  77. package/build/openid4vc-verifier/OpenId4VcVerifierApi.js.map +1 -0
  78. package/build/openid4vc-verifier/OpenId4VcVerifierModule.d.ts +21 -0
  79. package/build/openid4vc-verifier/OpenId4VcVerifierModule.js +98 -0
  80. package/build/openid4vc-verifier/OpenId4VcVerifierModule.js.map +1 -0
  81. package/build/openid4vc-verifier/OpenId4VcVerifierModuleConfig.d.ts +34 -0
  82. package/build/openid4vc-verifier/OpenId4VcVerifierModuleConfig.js +45 -0
  83. package/build/openid4vc-verifier/OpenId4VcVerifierModuleConfig.js.map +1 -0
  84. package/build/openid4vc-verifier/index.d.ts +6 -0
  85. package/build/openid4vc-verifier/index.js +23 -0
  86. package/build/openid4vc-verifier/index.js.map +1 -0
  87. package/build/openid4vc-verifier/repository/OpenId4VcVerifierRecord.d.ts +26 -0
  88. package/build/openid4vc-verifier/repository/OpenId4VcVerifierRecord.js +28 -0
  89. package/build/openid4vc-verifier/repository/OpenId4VcVerifierRecord.js.map +1 -0
  90. package/build/openid4vc-verifier/repository/OpenId4VcVerifierRepository.d.ts +8 -0
  91. package/build/openid4vc-verifier/repository/OpenId4VcVerifierRepository.js +35 -0
  92. package/build/openid4vc-verifier/repository/OpenId4VcVerifierRepository.js.map +1 -0
  93. package/build/openid4vc-verifier/repository/index.d.ts +2 -0
  94. package/build/openid4vc-verifier/repository/index.js +19 -0
  95. package/build/openid4vc-verifier/repository/index.js.map +1 -0
  96. package/build/openid4vc-verifier/router/authorizationEndpoint.d.ts +11 -0
  97. package/build/openid4vc-verifier/router/authorizationEndpoint.js +30 -0
  98. package/build/openid4vc-verifier/router/authorizationEndpoint.js.map +1 -0
  99. package/build/openid4vc-verifier/router/index.d.ts +2 -0
  100. package/build/openid4vc-verifier/router/index.js +6 -0
  101. package/build/openid4vc-verifier/router/index.js.map +1 -0
  102. package/build/openid4vc-verifier/router/requestContext.d.ts +5 -0
  103. package/build/openid4vc-verifier/router/requestContext.js +3 -0
  104. package/build/openid4vc-verifier/router/requestContext.js.map +1 -0
  105. package/build/shared/index.d.ts +2 -0
  106. package/build/shared/index.js +19 -0
  107. package/build/shared/index.js.map +1 -0
  108. package/build/shared/issuerMetadataUtils.d.ts +14 -0
  109. package/build/shared/issuerMetadataUtils.js +69 -0
  110. package/build/shared/issuerMetadataUtils.js.map +1 -0
  111. package/build/shared/models/CredentialHolderBinding.d.ts +10 -0
  112. package/build/shared/models/CredentialHolderBinding.js +3 -0
  113. package/build/shared/models/CredentialHolderBinding.js.map +1 -0
  114. package/build/shared/models/OpenId4VcJwtIssuer.d.ts +6 -0
  115. package/build/shared/models/OpenId4VcJwtIssuer.js +3 -0
  116. package/build/shared/models/OpenId4VcJwtIssuer.js.map +1 -0
  117. package/build/shared/models/OpenId4VciCredentialFormatProfile.d.ts +6 -0
  118. package/build/shared/models/OpenId4VciCredentialFormatProfile.js +11 -0
  119. package/build/shared/models/OpenId4VciCredentialFormatProfile.js.map +1 -0
  120. package/build/shared/models/index.d.ts +21 -0
  121. package/build/shared/models/index.js +20 -0
  122. package/build/shared/models/index.js.map +1 -0
  123. package/build/shared/router/context.d.ts +10 -0
  124. package/build/shared/router/context.js +22 -0
  125. package/build/shared/router/context.js.map +1 -0
  126. package/build/shared/router/express.d.ts +2 -0
  127. package/build/shared/router/express.js +16 -0
  128. package/build/shared/router/express.js.map +1 -0
  129. package/build/shared/router/index.d.ts +3 -0
  130. package/build/shared/router/index.js +20 -0
  131. package/build/shared/router/index.js.map +1 -0
  132. package/build/shared/router/tenants.d.ts +13 -0
  133. package/build/shared/router/tenants.js +50 -0
  134. package/build/shared/router/tenants.js.map +1 -0
  135. package/build/shared/transform.d.ts +5 -0
  136. package/build/shared/transform.js +61 -0
  137. package/build/shared/transform.js.map +1 -0
  138. package/build/shared/utils.d.ts +21 -0
  139. package/build/shared/utils.js +85 -0
  140. package/build/shared/utils.js.map +1 -0
  141. package/package.json +43 -0
@@ -0,0 +1,111 @@
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.OpenId4VcIssuerApi = void 0;
24
+ const core_1 = require("@credo-ts/core");
25
+ const OpenId4VcIssuerModuleConfig_1 = require("./OpenId4VcIssuerModuleConfig");
26
+ const OpenId4VcIssuerService_1 = require("./OpenId4VcIssuerService");
27
+ /**
28
+ * @public
29
+ * This class represents the API for interacting with the OpenID4VC Issuer service.
30
+ * It provides methods for creating a credential offer, creating a response to a credential issuance request,
31
+ * and retrieving a credential offer from a URI.
32
+ */
33
+ let OpenId4VcIssuerApi = class OpenId4VcIssuerApi {
34
+ constructor(config, agentContext, openId4VcIssuerService) {
35
+ this.config = config;
36
+ this.agentContext = agentContext;
37
+ this.openId4VcIssuerService = openId4VcIssuerService;
38
+ }
39
+ async getAllIssuers() {
40
+ return this.openId4VcIssuerService.getAllIssuers(this.agentContext);
41
+ }
42
+ async getByIssuerId(issuerId) {
43
+ return this.openId4VcIssuerService.getByIssuerId(this.agentContext, issuerId);
44
+ }
45
+ /**
46
+ * Creates an issuer and stores the corresponding issuer metadata. Multiple issuers can be created, to allow different sets of
47
+ * credentials to be issued with each issuer.
48
+ */
49
+ async createIssuer(options) {
50
+ return this.openId4VcIssuerService.createIssuer(this.agentContext, options);
51
+ }
52
+ /**
53
+ * Rotate the key used for signing access tokens for the issuer with the given issuerId.
54
+ */
55
+ async rotateAccessTokenSigningKey(issuerId) {
56
+ const issuer = await this.openId4VcIssuerService.getByIssuerId(this.agentContext, issuerId);
57
+ return this.openId4VcIssuerService.rotateAccessTokenSigningKey(this.agentContext, issuer);
58
+ }
59
+ async getIssuerMetadata(issuerId) {
60
+ const issuer = await this.openId4VcIssuerService.getByIssuerId(this.agentContext, issuerId);
61
+ return this.openId4VcIssuerService.getIssuerMetadata(this.agentContext, issuer);
62
+ }
63
+ async updateIssuerMetadata(options) {
64
+ const issuer = await this.openId4VcIssuerService.getByIssuerId(this.agentContext, options.issuerId);
65
+ issuer.credentialsSupported = options.credentialsSupported;
66
+ issuer.display = options.display;
67
+ return this.openId4VcIssuerService.updateIssuer(this.agentContext, issuer);
68
+ }
69
+ /**
70
+ * Creates a credential offer. Either the preAuthorizedCodeFlowConfig or the authorizationCodeFlowConfig must be provided.
71
+ *
72
+ * @returns Object containing the payload of the credential offer and the credential offer request, which can be sent to the wallet.
73
+ */
74
+ async createCredentialOffer(options) {
75
+ const { issuerId } = options, rest = __rest(options, ["issuerId"]);
76
+ const issuer = await this.openId4VcIssuerService.getByIssuerId(this.agentContext, issuerId);
77
+ return await this.openId4VcIssuerService.createCredentialOffer(this.agentContext, Object.assign(Object.assign({}, rest), { issuer }));
78
+ }
79
+ /**
80
+ * This function retrieves the credential offer referenced by the given URI.
81
+ * Retrieving a credential offer from a URI is possible after a credential offer was created with
82
+ * @see createCredentialOffer and the credentialOfferUri option.
83
+ *
84
+ * @throws if no credential offer can found for the given URI.
85
+ * @param uri - The URI referencing the credential offer.
86
+ * @returns The credential offer payload associated with the given URI.
87
+ */
88
+ async getCredentialOfferFromUri(uri) {
89
+ return await this.openId4VcIssuerService.getCredentialOfferFromUri(this.agentContext, uri);
90
+ }
91
+ /**
92
+ * This function creates a response which can be send to the holder after receiving a credential issuance request.
93
+ *
94
+ * @param options.credentialRequest - The credential request, for which to create a response.
95
+ * @param options.credential - The credential to be issued.
96
+ * @param options.verificationMethod - The verification method used for signing the credential.
97
+ */
98
+ async createCredentialResponse(options) {
99
+ const { issuerId } = options, rest = __rest(options, ["issuerId"]);
100
+ const issuer = await this.openId4VcIssuerService.getByIssuerId(this.agentContext, issuerId);
101
+ return await this.openId4VcIssuerService.createCredentialResponse(this.agentContext, Object.assign(Object.assign({}, rest), { issuer }));
102
+ }
103
+ };
104
+ OpenId4VcIssuerApi = __decorate([
105
+ (0, core_1.injectable)(),
106
+ __metadata("design:paramtypes", [OpenId4VcIssuerModuleConfig_1.OpenId4VcIssuerModuleConfig,
107
+ core_1.AgentContext,
108
+ OpenId4VcIssuerService_1.OpenId4VcIssuerService])
109
+ ], OpenId4VcIssuerApi);
110
+ exports.OpenId4VcIssuerApi = OpenId4VcIssuerApi;
111
+ //# sourceMappingURL=OpenId4VcIssuerApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenId4VcIssuerApi.js","sourceRoot":"","sources":["../../src/openid4vc-issuer/OpenId4VcIssuerApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAQA,yCAAyD;AAEzD,+EAA2E;AAC3E,qEAAiE;AAEjE;;;;;GAKG;AAEI,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAC7B,YACkB,MAAmC,EAC3C,YAA0B,EAC1B,sBAA8C;QAFtC,WAAM,GAAN,MAAM,CAA6B;QAC3C,iBAAY,GAAZ,YAAY,CAAc;QAC1B,2BAAsB,GAAtB,sBAAsB,CAAwB;IACrD,CAAC;IAEG,KAAK,CAAC,aAAa;QACxB,OAAO,IAAI,CAAC,sBAAsB,CAAC,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;IACrE,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,QAAgB;QACzC,OAAO,IAAI,CAAC,sBAAsB,CAAC,aAAa,CAAC,IAAI,CA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AK,OAAO,EAA/B,YAAqB,CAAU,CAAA;QACrC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,aAAa,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAA;QAC3F,OAAO,MAAM,IAAI,CAAC,sBAAsB,CAAC,qBAAqB,CAAC,IAAI,CAAC,YAAY,kCAAO,IAAI,KAAE,MAAM,IAAG,CAAA;IACxG,CAAC;IAED;;;;;;;;OAQG;IACI,KAAK,CAAC,yBAAyB,CAAC,GAAW;QAChD,OAAO,MAAM,IAAI,CAAC,sBAAsB,CAAC,yBAAyB,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,CAAC,CAAA;IAC5F,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,wBAAwB,CAAC,OAAyE;QAC7G,MAAM,EAAE,QAAQ,KAAc,OAAO,EAAhB,IAAI,UAAK,OAAO,EAA/B,YAAqB,CAAU,CAAA;QACrC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,aAAa,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAA;QAC3F,OAAO,MAAM,IAAI,CAAC,sBAAsB,CAAC,wBAAwB,CAAC,IAAI,CAAC,YAAY,kCAAO,IAAI,KAAE,MAAM,IAAG,CAAA;IAC3G,CAAC;CACF,CAAA;AAnFY,kBAAkB;IAD9B,IAAA,iBAAU,GAAE;qCAGe,yDAA2B;QAC7B,mBAAY;QACF,+CAAsB;GAJ7C,kBAAkB,CAmF9B;AAnFY,gDAAkB"}
@@ -0,0 +1,21 @@
1
+ import type { OpenId4VcIssuerModuleConfigOptions } from './OpenId4VcIssuerModuleConfig';
2
+ import type { AgentContext, DependencyManager, Module } from '@credo-ts/core';
3
+ import { OpenId4VcIssuerApi } from './OpenId4VcIssuerApi';
4
+ import { OpenId4VcIssuerModuleConfig } from './OpenId4VcIssuerModuleConfig';
5
+ /**
6
+ * @public
7
+ */
8
+ export declare class OpenId4VcIssuerModule implements Module {
9
+ readonly api: typeof OpenId4VcIssuerApi;
10
+ readonly config: OpenId4VcIssuerModuleConfig;
11
+ constructor(options: OpenId4VcIssuerModuleConfigOptions);
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.OpenId4VcIssuerModule = void 0;
4
+ const core_1 = require("@credo-ts/core");
5
+ const router_1 = require("../shared/router");
6
+ const OpenId4VcIssuerApi_1 = require("./OpenId4VcIssuerApi");
7
+ const OpenId4VcIssuerModuleConfig_1 = require("./OpenId4VcIssuerModuleConfig");
8
+ const OpenId4VcIssuerService_1 = require("./OpenId4VcIssuerService");
9
+ const OpenId4VcIssuerRepository_1 = require("./repository/OpenId4VcIssuerRepository");
10
+ const router_2 = require("./router");
11
+ /**
12
+ * @public
13
+ */
14
+ class OpenId4VcIssuerModule {
15
+ constructor(options) {
16
+ this.api = OpenId4VcIssuerApi_1.OpenId4VcIssuerApi;
17
+ this.config = new OpenId4VcIssuerModuleConfig_1.OpenId4VcIssuerModuleConfig(options);
18
+ }
19
+ /**
20
+ * Registers the dependencies of the question answer module on the dependency manager.
21
+ */
22
+ register(dependencyManager) {
23
+ // Warn about experimental module
24
+ dependencyManager
25
+ .resolve(core_1.AgentConfig)
26
+ .logger.warn("The '@credo-ts/openid4vc' Issuer module is experimental and could have unexpected breaking changes. When using this module, make sure to use strict versions for all @credo-ts packages.");
27
+ // Register config
28
+ dependencyManager.registerInstance(OpenId4VcIssuerModuleConfig_1.OpenId4VcIssuerModuleConfig, this.config);
29
+ // Services
30
+ dependencyManager.registerSingleton(OpenId4VcIssuerService_1.OpenId4VcIssuerService);
31
+ // Repository
32
+ dependencyManager.registerSingleton(OpenId4VcIssuerRepository_1.OpenId4VcIssuerRepository);
33
+ }
34
+ async initialize(rootAgentContext) {
35
+ this.configureRouter(rootAgentContext);
36
+ }
37
+ /**
38
+ * Registers the endpoints on the router passed to this module.
39
+ */
40
+ configureRouter(rootAgentContext) {
41
+ const { Router, json, urlencoded } = (0, router_1.importExpress)();
42
+ // TODO: it is currently not possible to initialize an agent
43
+ // shut it down, and then start it again, as the
44
+ // express router is configured with a specific `AgentContext` instance
45
+ // and dependency manager. One option is to always create a new router
46
+ // but then users cannot pass their own router implementation.
47
+ // We need to find a proper way to fix this.
48
+ // We use separate context router and endpoint router. Context router handles the linking of the request
49
+ // to a specific agent context. Endpoint router only knows about a single context
50
+ const endpointRouter = Router();
51
+ const contextRouter = this.config.router;
52
+ // parse application/x-www-form-urlencoded
53
+ contextRouter.use(urlencoded({ extended: false }));
54
+ // parse application/json
55
+ contextRouter.use(json());
56
+ contextRouter.param('issuerId', async (req, _res, next, issuerId) => {
57
+ if (!issuerId) {
58
+ rootAgentContext.config.logger.debug('No issuerId provided for incoming oid4vci request, returning 404');
59
+ _res.status(404).send('Not found');
60
+ }
61
+ let agentContext = undefined;
62
+ try {
63
+ // FIXME: should we create combined openId actor record?
64
+ agentContext = await (0, router_1.getAgentContextForActorId)(rootAgentContext, issuerId);
65
+ const issuerApi = agentContext.dependencyManager.resolve(OpenId4VcIssuerApi_1.OpenId4VcIssuerApi);
66
+ const issuer = await issuerApi.getByIssuerId(issuerId);
67
+ req.requestContext = {
68
+ agentContext,
69
+ issuer,
70
+ };
71
+ }
72
+ catch (error) {
73
+ agentContext === null || agentContext === void 0 ? void 0 : agentContext.config.logger.error('Failed to correlate incoming oid4vci request to existing tenant and issuer', {
74
+ error,
75
+ });
76
+ // If the opening failed
77
+ await (agentContext === null || agentContext === void 0 ? void 0 : agentContext.endSession());
78
+ return _res.status(404).send('Not found');
79
+ }
80
+ next();
81
+ });
82
+ contextRouter.use('/:issuerId', endpointRouter);
83
+ // Configure endpoints
84
+ (0, router_2.configureIssuerMetadataEndpoint)(endpointRouter);
85
+ (0, router_2.configureAccessTokenEndpoint)(endpointRouter, this.config.accessTokenEndpoint);
86
+ (0, router_2.configureCredentialEndpoint)(endpointRouter, this.config.credentialEndpoint);
87
+ // First one will be called for all requests (when next is called)
88
+ contextRouter.use(async (req, _res, next) => {
89
+ const { agentContext } = (0, router_1.getRequestContext)(req);
90
+ await agentContext.endSession();
91
+ next();
92
+ });
93
+ // This one will be called for all errors that are thrown
94
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
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.OpenId4VcIssuerModule = OpenId4VcIssuerModule;
103
+ //# sourceMappingURL=OpenId4VcIssuerModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenId4VcIssuerModule.js","sourceRoot":"","sources":["../../src/openid4vc-issuer/OpenId4VcIssuerModule.ts"],"names":[],"mappings":";;;AAIA,yCAA4C;AAE5C,6CAA8F;AAE9F,6DAAyD;AACzD,+EAA2E;AAC3E,qEAAiE;AACjE,sFAAkF;AAClF,qCAAqH;AAErH;;GAEG;AACH,MAAa,qBAAqB;IAIhC,YAAmB,OAA2C;QAH9C,QAAG,GAAG,uCAAkB,CAAA;QAItC,IAAI,CAAC,MAAM,GAAG,IAAI,yDAA2B,CAAC,OAAO,CAAC,CAAA;IACxD,CAAC;IAED;;OAEG;IACI,QAAQ,CAAC,iBAAoC;QAClD,iCAAiC;QACjC,iBAAiB;aACd,OAAO,CAAC,kBAAW,CAAC;aACpB,MAAM,CAAC,IAAI,CACV,0LAA0L,CAC3L,CAAA;QAEH,kBAAkB;QAClB,iBAAiB,CAAC,gBAAgB,CAAC,yDAA2B,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;QAE5E,WAAW;QACX,iBAAiB,CAAC,iBAAiB,CA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AE,IAAS,EAAE,EAAE;YACnG,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,sDAgHC"}
@@ -0,0 +1,43 @@
1
+ import type { OpenId4VciAccessTokenEndpointConfig, OpenId4VciCredentialEndpointConfig } from './router';
2
+ import type { AgentContext, Optional } from '@credo-ts/core';
3
+ import type { CNonceState, CredentialOfferSession, IStateManager, URIState } from '@sphereon/oid4vci-common';
4
+ import type { Router } from 'express';
5
+ export interface OpenId4VcIssuerModuleConfigOptions {
6
+ /**
7
+ * Base url at which the issuer 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 openid4vci 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
+ credential: Optional<OpenId4VciCredentialEndpointConfig, 'endpointPath'>;
21
+ accessToken?: Optional<OpenId4VciAccessTokenEndpointConfig, 'cNonceExpiresInSeconds' | 'endpointPath' | 'preAuthorizedCodeExpirationInSeconds' | 'tokenExpiresInSeconds'>;
22
+ };
23
+ }
24
+ export declare class OpenId4VcIssuerModuleConfig {
25
+ private options;
26
+ readonly router: Router;
27
+ private credentialOfferSessionManagerMap;
28
+ private uriStateManagerMap;
29
+ private cNonceStateManagerMap;
30
+ constructor(options: OpenId4VcIssuerModuleConfigOptions);
31
+ get baseUrl(): string;
32
+ /**
33
+ * Get the credential endpoint config, with default values set
34
+ */
35
+ get credentialEndpoint(): OpenId4VciCredentialEndpointConfig;
36
+ /**
37
+ * Get the access token endpoint config, with default values set
38
+ */
39
+ get accessTokenEndpoint(): OpenId4VciAccessTokenEndpointConfig;
40
+ getUriStateManager(agentContext: AgentContext): IStateManager<URIState>;
41
+ getCredentialOfferSessionStateManager(agentContext: AgentContext): IStateManager<CredentialOfferSession>;
42
+ getCNonceStateManager(agentContext: AgentContext): IStateManager<CNonceState>;
43
+ }
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OpenId4VcIssuerModuleConfig = void 0;
4
+ const oid4vci_issuer_1 = require("@sphereon/oid4vci-issuer");
5
+ const router_1 = require("../shared/router");
6
+ const DEFAULT_C_NONCE_EXPIRES_IN = 5 * 60 * 1000; // 5 minutes
7
+ const DEFAULT_TOKEN_EXPIRES_IN = 3 * 60 * 1000; // 3 minutes
8
+ const DEFAULT_PRE_AUTH_CODE_EXPIRES_IN = 3 * 60 * 1000; // 3 minutes
9
+ class OpenId4VcIssuerModuleConfig {
10
+ constructor(options) {
11
+ var _a;
12
+ this.uriStateManagerMap = new Map();
13
+ this.credentialOfferSessionManagerMap = new Map();
14
+ this.cNonceStateManagerMap = new Map();
15
+ this.options = options;
16
+ this.router = (_a = options.router) !== null && _a !== void 0 ? _a : (0, router_1.importExpress)().Router();
17
+ }
18
+ get baseUrl() {
19
+ return this.options.baseUrl;
20
+ }
21
+ /**
22
+ * Get the credential endpoint config, with default values set
23
+ */
24
+ get credentialEndpoint() {
25
+ var _a;
26
+ // Use user supplied options, or return defaults.
27
+ const userOptions = this.options.endpoints.credential;
28
+ return Object.assign(Object.assign({}, userOptions), { endpointPath: (_a = userOptions.endpointPath) !== null && _a !== void 0 ? _a : '/credential' });
29
+ }
30
+ /**
31
+ * Get the access token endpoint config, with default values set
32
+ */
33
+ get accessTokenEndpoint() {
34
+ var _a, _b, _c, _d, _e;
35
+ // Use user supplied options, or return defaults.
36
+ const userOptions = (_a = this.options.endpoints.accessToken) !== null && _a !== void 0 ? _a : {};
37
+ return Object.assign(Object.assign({}, userOptions), { endpointPath: (_b = userOptions.endpointPath) !== null && _b !== void 0 ? _b : '/token', cNonceExpiresInSeconds: (_c = userOptions.cNonceExpiresInSeconds) !== null && _c !== void 0 ? _c : DEFAULT_C_NONCE_EXPIRES_IN, preAuthorizedCodeExpirationInSeconds: (_d = userOptions.preAuthorizedCodeExpirationInSeconds) !== null && _d !== void 0 ? _d : DEFAULT_PRE_AUTH_CODE_EXPIRES_IN, tokenExpiresInSeconds: (_e = userOptions.tokenExpiresInSeconds) !== null && _e !== void 0 ? _e : DEFAULT_TOKEN_EXPIRES_IN });
38
+ }
39
+ // FIXME: rework (no in-memory)
40
+ getUriStateManager(agentContext) {
41
+ const value = this.uriStateManagerMap.get(agentContext.contextCorrelationId);
42
+ if (value)
43
+ return value;
44
+ const newValue = new oid4vci_issuer_1.MemoryStates();
45
+ this.uriStateManagerMap.set(agentContext.contextCorrelationId, newValue);
46
+ return newValue;
47
+ }
48
+ // FIXME: rework (no in-memory)
49
+ getCredentialOfferSessionStateManager(agentContext) {
50
+ const value = this.credentialOfferSessionManagerMap.get(agentContext.contextCorrelationId);
51
+ if (value)
52
+ return value;
53
+ const newValue = new oid4vci_issuer_1.MemoryStates();
54
+ this.credentialOfferSessionManagerMap.set(agentContext.contextCorrelationId, newValue);
55
+ return newValue;
56
+ }
57
+ // FIXME: rework (no in-memory)
58
+ getCNonceStateManager(agentContext) {
59
+ const value = this.cNonceStateManagerMap.get(agentContext.contextCorrelationId);
60
+ if (value)
61
+ return value;
62
+ const newValue = new oid4vci_issuer_1.MemoryStates();
63
+ this.cNonceStateManagerMap.set(agentContext.contextCorrelationId, newValue);
64
+ return newValue;
65
+ }
66
+ }
67
+ exports.OpenId4VcIssuerModuleConfig = OpenId4VcIssuerModuleConfig;
68
+ //# sourceMappingURL=OpenId4VcIssuerModuleConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenId4VcIssuerModuleConfig.js","sourceRoot":"","sources":["../../src/openid4vc-issuer/OpenId4VcIssuerModuleConfig.ts"],"names":[],"mappings":";;;AAKA,6DA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penId4VciCreateCredentialResponseOptions, OpenId4VciCreateCredentialOfferOptions, OpenId4VciCreateIssuerOptions, OpenId4VcIssuerMetadata } from './OpenId4VcIssuerServiceOptions';
2
+ import type { AgentContext } from '@credo-ts/core';
3
+ import { JwsService, W3cCredentialService } from '@credo-ts/core';
4
+ import { OpenId4VcIssuerModuleConfig } from './OpenId4VcIssuerModuleConfig';
5
+ import { OpenId4VcIssuerRepository, OpenId4VcIssuerRecord } from './repository';
6
+ /**
7
+ * @internal
8
+ */
9
+ export declare class OpenId4VcIssuerService {
10
+ private w3cCredentialService;
11
+ private jwsService;
12
+ private openId4VcIssuerConfig;
13
+ private openId4VcIssuerRepository;
14
+ constructor(w3cCredentialService: W3cCredentialService, jwsService: JwsService, openId4VcIssuerConfig: OpenId4VcIssuerModuleConfig, openId4VcIssuerRepository: OpenId4VcIssuerRepository);
15
+ getIssuerMetadata(agentContext: AgentContext, issuerRecord: OpenId4VcIssuerRecord): OpenId4VcIssuerMetadata;
16
+ createCredentialOffer(agentContext: AgentContext, options: OpenId4VciCreateCredentialOfferOptions & {
17
+ issuer: OpenId4VcIssuerRecord;
18
+ }): Promise<{
19
+ credentialOfferPayload: import("@sphereon/oid4vci-common").CredentialOfferPayloadV1_0_11;
20
+ credentialOffer: string;
21
+ }>;
22
+ getCredentialOfferFromUri(agentContext: AgentContext, uri: string): Promise<import("@sphereon/oid4vci-common").CredentialOfferPayloadV1_0_11>;
23
+ createCredentialResponse(agentContext: AgentContext, options: OpenId4VciCreateCredentialResponseOptions & {
24
+ issuer: OpenId4VcIssuerRecord;
25
+ }): Promise<import("@sphereon/oid4vci-common").CredentialResponse>;
26
+ getAllIssuers(agentContext: AgentContext): Promise<OpenId4VcIssuerRecord[]>;
27
+ getByIssuerId(agentContext: AgentContext, issuerId: string): Promise<OpenId4VcIssuerRecord>;
28
+ updateIssuer(agentContext: AgentContext, issuer: OpenId4VcIssuerRecord): Promise<void>;
29
+ createIssuer(agentContext: AgentContext, options: OpenId4VciCreateIssuerOptions): Promise<OpenId4VcIssuerRecord>;
30
+ rotateAccessTokenSigningKey(agentContext: AgentContext, issuer: OpenId4VcIssuerRecord): Promise<void>;
31
+ private getCredentialOfferSessionFromUri;
32
+ private getJwtVerifyCallback;
33
+ private getVcIssuer;
34
+ private getGrantsFromConfig;
35
+ private findOfferedCredentialsMatchingRequest;
36
+ private getSdJwtVcCredentialSigningCallback;
37
+ private getW3cCredentialSigningCallback;
38
+ private getHolderBindingFromRequest;
39
+ private getCredentialDataSupplier;
40
+ }