@nmshd/consumption 7.4.0 → 7.5.0-openid4vc.1

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 (87) hide show
  1. package/dist/buildInformation.js +5 -5
  2. package/dist/consumption/ConsumptionConfig.d.ts +1 -0
  3. package/dist/consumption/ConsumptionConfig.d.ts.map +1 -1
  4. package/dist/consumption/ConsumptionController.d.ts +3 -1
  5. package/dist/consumption/ConsumptionController.d.ts.map +1 -1
  6. package/dist/consumption/ConsumptionController.js +7 -1
  7. package/dist/consumption/ConsumptionController.js.map +1 -1
  8. package/dist/consumption/ConsumptionControllerName.d.ts +2 -1
  9. package/dist/consumption/ConsumptionControllerName.d.ts.map +1 -1
  10. package/dist/consumption/ConsumptionControllerName.js +1 -0
  11. package/dist/consumption/ConsumptionControllerName.js.map +1 -1
  12. package/dist/consumption/ConsumptionIds.d.ts +1 -0
  13. package/dist/consumption/ConsumptionIds.d.ts.map +1 -1
  14. package/dist/consumption/ConsumptionIds.js +1 -0
  15. package/dist/consumption/ConsumptionIds.js.map +1 -1
  16. package/dist/modules/index.d.ts +1 -0
  17. package/dist/modules/index.d.ts.map +1 -1
  18. package/dist/modules/index.js +1 -0
  19. package/dist/modules/index.js.map +1 -1
  20. package/dist/modules/openid4vc/OpenId4VcController.d.ts +36 -0
  21. package/dist/modules/openid4vc/OpenId4VcController.d.ts.map +1 -0
  22. package/dist/modules/openid4vc/OpenId4VcController.js +100 -0
  23. package/dist/modules/openid4vc/OpenId4VcController.js.map +1 -0
  24. package/dist/modules/openid4vc/index.d.ts +8 -0
  25. package/dist/modules/openid4vc/index.d.ts.map +1 -0
  26. package/dist/modules/openid4vc/index.js +24 -0
  27. package/dist/modules/openid4vc/index.js.map +1 -0
  28. package/dist/modules/openid4vc/local/BaseAgent.d.ts +17 -0
  29. package/dist/modules/openid4vc/local/BaseAgent.d.ts.map +1 -0
  30. package/dist/modules/openid4vc/local/BaseAgent.js +72 -0
  31. package/dist/modules/openid4vc/local/BaseAgent.js.map +1 -0
  32. package/dist/modules/openid4vc/local/EnmeshedHolderFileSystem.d.ts +14 -0
  33. package/dist/modules/openid4vc/local/EnmeshedHolderFileSystem.d.ts.map +1 -0
  34. package/dist/modules/openid4vc/local/EnmeshedHolderFileSystem.js +29 -0
  35. package/dist/modules/openid4vc/local/EnmeshedHolderFileSystem.js.map +1 -0
  36. package/dist/modules/openid4vc/local/EnmeshedHolderKeyManagmentService.d.ts +33 -0
  37. package/dist/modules/openid4vc/local/EnmeshedHolderKeyManagmentService.d.ts.map +1 -0
  38. package/dist/modules/openid4vc/local/EnmeshedHolderKeyManagmentService.js +345 -0
  39. package/dist/modules/openid4vc/local/EnmeshedHolderKeyManagmentService.js.map +1 -0
  40. package/dist/modules/openid4vc/local/EnmeshedStorageService.d.ts +25 -0
  41. package/dist/modules/openid4vc/local/EnmeshedStorageService.d.ts.map +1 -0
  42. package/dist/modules/openid4vc/local/EnmeshedStorageService.js +139 -0
  43. package/dist/modules/openid4vc/local/EnmeshedStorageService.js.map +1 -0
  44. package/dist/modules/openid4vc/local/Holder.d.ts +43 -0
  45. package/dist/modules/openid4vc/local/Holder.d.ts.map +1 -0
  46. package/dist/modules/openid4vc/local/Holder.js +184 -0
  47. package/dist/modules/openid4vc/local/Holder.js.map +1 -0
  48. package/dist/modules/openid4vc/local/KeyStorage.d.ts +12 -0
  49. package/dist/modules/openid4vc/local/KeyStorage.d.ts.map +1 -0
  50. package/dist/modules/openid4vc/local/KeyStorage.js +67 -0
  51. package/dist/modules/openid4vc/local/KeyStorage.js.map +1 -0
  52. package/dist/modules/openid4vc/local/OpenId4VciCredentialResponseJSON.d.ts +7 -0
  53. package/dist/modules/openid4vc/local/OpenId4VciCredentialResponseJSON.d.ts.map +1 -0
  54. package/dist/modules/openid4vc/local/OpenId4VciCredentialResponseJSON.js +3 -0
  55. package/dist/modules/openid4vc/local/OpenId4VciCredentialResponseJSON.js.map +1 -0
  56. package/dist/modules/openid4vc/local/RequestedCredentialCache.d.ts +9 -0
  57. package/dist/modules/openid4vc/local/RequestedCredentialCache.d.ts.map +1 -0
  58. package/dist/modules/openid4vc/local/RequestedCredentialCache.js +57 -0
  59. package/dist/modules/openid4vc/local/RequestedCredentialCache.js.map +1 -0
  60. package/dist/modules/requests/events/ShareCredentialOfferRequestItemProcessedByRecipientEvent.d.ts +12 -0
  61. package/dist/modules/requests/events/ShareCredentialOfferRequestItemProcessedByRecipientEvent.d.ts.map +1 -0
  62. package/dist/modules/requests/events/ShareCredentialOfferRequestItemProcessedByRecipientEvent.js +12 -0
  63. package/dist/modules/requests/events/ShareCredentialOfferRequestItemProcessedByRecipientEvent.js.map +1 -0
  64. package/dist/modules/requests/events/index.d.ts +1 -0
  65. package/dist/modules/requests/events/index.d.ts.map +1 -1
  66. package/dist/modules/requests/events/index.js +1 -0
  67. package/dist/modules/requests/events/index.js.map +1 -1
  68. package/dist/modules/requests/index.d.ts +3 -0
  69. package/dist/modules/requests/index.d.ts.map +1 -1
  70. package/dist/modules/requests/index.js +3 -0
  71. package/dist/modules/requests/index.js.map +1 -1
  72. package/dist/modules/requests/itemProcessors/shareAuthorizationRequest/AcceptShareAuthorizationRequestRequestItemParameters.d.ts +11 -0
  73. package/dist/modules/requests/itemProcessors/shareAuthorizationRequest/AcceptShareAuthorizationRequestRequestItemParameters.d.ts.map +1 -0
  74. package/dist/modules/requests/itemProcessors/shareAuthorizationRequest/AcceptShareAuthorizationRequestRequestItemParameters.js +29 -0
  75. package/dist/modules/requests/itemProcessors/shareAuthorizationRequest/AcceptShareAuthorizationRequestRequestItemParameters.js.map +1 -0
  76. package/dist/modules/requests/itemProcessors/shareAuthorizationRequest/ShareAuthorizationRequestRequestItemProcessor.d.ts +12 -0
  77. package/dist/modules/requests/itemProcessors/shareAuthorizationRequest/ShareAuthorizationRequestRequestItemProcessor.d.ts.map +1 -0
  78. package/dist/modules/requests/itemProcessors/shareAuthorizationRequest/ShareAuthorizationRequestRequestItemProcessor.js +55 -0
  79. package/dist/modules/requests/itemProcessors/shareAuthorizationRequest/ShareAuthorizationRequestRequestItemProcessor.js.map +1 -0
  80. package/dist/modules/requests/itemProcessors/shareCredentialOffer/ShareCredentialOfferRequestItemProcessor.d.ts +14 -0
  81. package/dist/modules/requests/itemProcessors/shareCredentialOffer/ShareCredentialOfferRequestItemProcessor.d.ts.map +1 -0
  82. package/dist/modules/requests/itemProcessors/shareCredentialOffer/ShareCredentialOfferRequestItemProcessor.js +45 -0
  83. package/dist/modules/requests/itemProcessors/shareCredentialOffer/ShareCredentialOfferRequestItemProcessor.js.map +1 -0
  84. package/dist/modules/requests/outgoing/OutgoingRequestsController.d.ts.map +1 -1
  85. package/dist/modules/requests/outgoing/OutgoingRequestsController.js +3 -1
  86. package/dist/modules/requests/outgoing/OutgoingRequestsController.js.map +1 -1
  87. package/package.json +31 -9
@@ -0,0 +1,184 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Holder = void 0;
4
+ const core_1 = require("@credo-ts/core");
5
+ const openid4vc_1 = require("@credo-ts/openid4vc");
6
+ const content_1 = require("@nmshd/content");
7
+ const BaseAgent_1 = require("./BaseAgent");
8
+ const EnmeshedStorageService_1 = require("./EnmeshedStorageService");
9
+ function getOpenIdHolderModules() {
10
+ return {
11
+ openid4vc: new openid4vc_1.OpenId4VcModule(),
12
+ x509: new core_1.X509Module({
13
+ getTrustedCertificatesForVerification: (_agentContext, { certificateChain, verification }) => {
14
+ // eslint-disable-next-line no-console
15
+ console.log(`dynamically trusting certificate ${certificateChain[0].getIssuerNameField("C")} for verification of ${verification.type}`);
16
+ return [certificateChain[0].toString("pem")];
17
+ }
18
+ })
19
+ };
20
+ }
21
+ class Holder extends BaseAgent_1.BaseAgent {
22
+ constructor(keyStorage, accountController, attributeController, fetchInstance) {
23
+ super(keyStorage, getOpenIdHolderModules(), accountController, attributeController, fetchInstance);
24
+ this.client = {
25
+ clientId: "wallet",
26
+ redirectUri: "http://localhost:3000/redirect"
27
+ };
28
+ }
29
+ async resolveCredentialOffer(credentialOffer) {
30
+ return await this.agent.openid4vc.holder.resolveCredentialOffer(credentialOffer);
31
+ }
32
+ async requestCredentials(resolvedCredentialOffer, credentialConfigurationIds, access) {
33
+ const tokenResponse = "accessToken" in access
34
+ ? {
35
+ accessToken: access.accessToken,
36
+ accessTokenResponse: {
37
+ // eslint-disable-next-line @typescript-eslint/naming-convention
38
+ access_token: access.accessToken,
39
+ // eslint-disable-next-line @typescript-eslint/naming-convention
40
+ token_type: "bearer"
41
+ }
42
+ }
43
+ : await this.agent.openid4vc.holder.requestToken({ resolvedCredentialOffer, txCode: access.pinCode });
44
+ const credentialResponse = await this.agent.openid4vc.holder.requestCredentials({
45
+ resolvedCredentialOffer,
46
+ credentialConfigurationIds: credentialConfigurationIds,
47
+ credentialBindingResolver: async ({ supportedDidMethods, supportsAllDidMethods, proofTypes }) => {
48
+ const key = await this.agent.kms.createKeyForSignatureAlgorithm({
49
+ algorithm: proofTypes.jwt?.supportedSignatureAlgorithms[0] ?? "EdDSA"
50
+ });
51
+ const publicJwk = core_1.Kms.PublicJwk.fromPublicJwk(key.publicJwk);
52
+ if (supportsAllDidMethods || supportedDidMethods?.includes("did:key")) {
53
+ await this.agent.dids.create({
54
+ method: "key",
55
+ options: {
56
+ keyId: key.keyId
57
+ }
58
+ });
59
+ const didKey = new core_1.DidKey(publicJwk);
60
+ return {
61
+ method: "did",
62
+ didUrls: [`${didKey.did}#${didKey.publicJwk.fingerprint}`]
63
+ };
64
+ }
65
+ if (supportedDidMethods?.includes("did:jwk")) {
66
+ const didJwk = core_1.DidJwk.fromPublicJwk(publicJwk);
67
+ await this.agent.dids.create({
68
+ method: "jwk",
69
+ options: {
70
+ keyId: key.keyId
71
+ }
72
+ });
73
+ return {
74
+ method: "did",
75
+ didUrls: [`${didJwk.did}#0`]
76
+ };
77
+ }
78
+ // We fall back on jwk binding
79
+ return {
80
+ method: "jwk",
81
+ keys: [publicJwk]
82
+ };
83
+ },
84
+ ...tokenResponse
85
+ });
86
+ this.agent.config.logger.info("Credential response:", credentialResponse);
87
+ return credentialResponse.credentials;
88
+ }
89
+ async storeCredentials(credentialResponses) {
90
+ const storedCredentials = await Promise.all(credentialResponses.map((credentialResponse) => {
91
+ if (![core_1.ClaimFormat.SdJwtW3cVc, core_1.ClaimFormat.SdJwtDc, core_1.ClaimFormat.MsoMdoc].includes(credentialResponse.claimFormat)) {
92
+ throw new Error("Unsupported credential format");
93
+ }
94
+ const enmeshedStorageService = this.agent.dependencyManager.resolve(core_1.InjectionSymbols.StorageService);
95
+ return enmeshedStorageService.saveWithDisplay(this.agent.context, credentialResponse.encoded, credentialResponse.claimFormat, credentialResponse.displayInformation);
96
+ }));
97
+ this.agent.config.logger.info(`Stored credentials: ${JSON.stringify(storedCredentials)}`);
98
+ return storedCredentials;
99
+ }
100
+ async resolveAuthorizationRequest(request) {
101
+ const resolvedRequest = await this.agent.openid4vc.holder.resolveOpenId4VpAuthorizationRequest(request);
102
+ return resolvedRequest;
103
+ }
104
+ async acceptAuthorizationRequest(resolvedAuthorizationRequest, credential) {
105
+ if (!resolvedAuthorizationRequest.presentationExchange && !resolvedAuthorizationRequest.dcql) {
106
+ throw new Error("Missing presentation exchange or dcql on resolved authorization request");
107
+ }
108
+ const credentialContent = credential.content.value;
109
+ const credentialRecord = (0, EnmeshedStorageService_1.decodeRecord)(credentialContent.type, credentialContent.value);
110
+ let credentialForPex;
111
+ if (resolvedAuthorizationRequest.presentationExchange) {
112
+ const inputDescriptor = resolvedAuthorizationRequest.presentationExchange.credentialsForRequest.requirements[0].submissionEntry[0].inputDescriptorId;
113
+ credentialForPex = {
114
+ [inputDescriptor]: [
115
+ {
116
+ credentialRecord,
117
+ claimFormat: credentialContent.type,
118
+ disclosedPayload: {} // TODO: implement SD properly
119
+ }
120
+ ]
121
+ };
122
+ }
123
+ let credentialForDcql;
124
+ if (resolvedAuthorizationRequest.dcql) {
125
+ const queryId = resolvedAuthorizationRequest.dcql.queryResult.credentials[0].id;
126
+ credentialForDcql = {
127
+ [queryId]: [
128
+ {
129
+ credentialRecord,
130
+ claimFormat: credentialContent.type,
131
+ disclosedPayload: {} // TODO: implement SD properly
132
+ }
133
+ ]
134
+ };
135
+ }
136
+ const submissionResult = await this.agent.openid4vc.holder.acceptOpenId4VpAuthorizationRequest({
137
+ authorizationRequestPayload: resolvedAuthorizationRequest.authorizationRequestPayload,
138
+ presentationExchange: credentialForPex ? { credentials: credentialForPex } : undefined,
139
+ dcql: credentialForDcql ? { credentials: credentialForDcql } : undefined
140
+ });
141
+ return submissionResult.serverResponse;
142
+ }
143
+ // hacky solution because credo doesn't support credentials without key binding
144
+ // TODO: use credentials without key binding once supported
145
+ async createPresentationTokenContent(credential, nonce) {
146
+ if (credential.type !== core_1.ClaimFormat.SdJwtDc)
147
+ throw new Error("Only SD-JWT credentials are supported for token presentation");
148
+ const sdJwtVcApi = this.agent.dependencyManager.resolve(core_1.SdJwtVcApi);
149
+ const presentation = await sdJwtVcApi.present({
150
+ sdJwtVc: sdJwtVcApi.fromCompact(credential.value),
151
+ verifierMetadata: {
152
+ audience: "defaultPresentationAudience",
153
+ issuedAt: Date.now() / 1000,
154
+ nonce
155
+ }
156
+ });
157
+ return content_1.TokenContentVerifiablePresentation.from({
158
+ value: presentation,
159
+ type: credential.type,
160
+ displayInformation: credential.displayInformation
161
+ });
162
+ }
163
+ async verifyPresentationTokenContent(tokenContent, expectedNonce) {
164
+ if (tokenContent.type !== core_1.ClaimFormat.SdJwtDc)
165
+ throw new Error("Only SD-JWT credentials are supported for token presentation");
166
+ const sdJwtVcApi = this.agent.dependencyManager.resolve(core_1.SdJwtVcApi);
167
+ const verificationResult = await sdJwtVcApi.verify({
168
+ compactSdJwtVc: tokenContent.value,
169
+ keyBinding: {
170
+ audience: "defaultPresentationAudience",
171
+ nonce: expectedNonce
172
+ }
173
+ });
174
+ return { isValid: verificationResult.isValid, error: "error" in verificationResult ? verificationResult.error : undefined };
175
+ }
176
+ async exit() {
177
+ await this.shutdown();
178
+ }
179
+ async restart() {
180
+ await this.shutdown();
181
+ }
182
+ }
183
+ exports.Holder = Holder;
184
+ //# sourceMappingURL=Holder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Holder.js","sourceRoot":"","sources":["../../../../src/modules/openid4vc/local/Holder.ts"],"names":[],"mappings":";;;AAAA,yCAawB;AACxB,mDAAwK;AACxK,4CAA0F;AAG1F,2CAAwC;AACxC,qEAAgF;AAIhF,SAAS,sBAAsB;IAC3B,OAAO;QACH,SAAS,EAAE,IAAI,2BAAe,EAAE;QAChC,IAAI,EAAE,IAAI,iBAAU,CAAC;YACjB,qCAAqC,EAAE,CAAC,aAAa,EAAE,EAAE,gBAAgB,EAAE,YAAY,EAAE,EAAE,EAAE;gBACzF,sCAAsC;gBACtC,OAAO,CAAC,GAAG,CAAC,oCAAoC,gBAAgB,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,GAAG,CAAC,wBAAwB,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;gBACxI,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;YACjD,CAAC;SACJ,CAAC;KACI,CAAC;AACf,CAAC;AAED,MAAa,MAAO,SAAQ,qBAAoD;IAM5E,YAAmB,UAAsB,EAAE,iBAAoC,EAAE,mBAAyC,EAAE,aAA2B;QACnJ,KAAK,CAAC,UAAU,EAAE,sBAAsB,EAAE,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,aAAa,CAAC,CAAC;QANhG,WAAM,GAAG;YACZ,QAAQ,EAAE,QAAQ;YAClB,WAAW,EAAE,gCAAgC;SAChD,CAAC;IAIF,CAAC;IAEM,KAAK,CAAC,sBAAsB,CAAC,eAAuB;QACvD,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,sBAAsB,CAAC,eAAe,CAAC,CAAC;IACrF,CAAC;IAEM,KAAK,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AEM,KAAK,CAAC,OAAO;QAChB,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;CACJ;AApND,wBAoNC"}
@@ -0,0 +1,12 @@
1
+ import { ILogger } from "@js-soft/logging-abstractions";
2
+ import { SynchronizedCollection } from "@nmshd/transport";
3
+ export declare class KeyStorage {
4
+ private readonly collection;
5
+ private readonly logger;
6
+ constructor(collection: SynchronizedCollection, logger: ILogger);
7
+ hasKey(keyId: string): Promise<boolean>;
8
+ storeKey(keyId: string, keyData: any): Promise<void>;
9
+ getKey(keyId: string): Promise<any | undefined>;
10
+ deleteKey(keyId: string): Promise<void>;
11
+ }
12
+ //# sourceMappingURL=KeyStorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyStorage.d.ts","sourceRoot":"","sources":["../../../../src/modules/openid4vc/local/KeyStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAGxD,OAAO,EAA2C,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAmBnG,qBAAa,UAAU;IAEf,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,UAAU,EAAE,sBAAsB,EAClC,MAAM,EAAE,OAAO;IAGvB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKvC,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAUpD,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC;IAW/C,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CASvD"}
@@ -0,0 +1,67 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.KeyStorage = void 0;
13
+ const ts_serval_1 = require("@js-soft/ts-serval");
14
+ const core_types_1 = require("@nmshd/core-types");
15
+ const transport_1 = require("@nmshd/transport");
16
+ const ts_simple_nameof_1 = require("ts-simple-nameof");
17
+ class KeyStorageEntry extends transport_1.CoreSynchronizable {
18
+ constructor() {
19
+ super(...arguments);
20
+ this.technicalProperties = [(0, ts_simple_nameof_1.nameof)((r) => r.key)];
21
+ }
22
+ static from(entry) {
23
+ return this.fromAny(entry);
24
+ }
25
+ }
26
+ __decorate([
27
+ (0, ts_serval_1.serialize)({ any: true }),
28
+ (0, ts_serval_1.validate)(),
29
+ __metadata("design:type", Object)
30
+ ], KeyStorageEntry.prototype, "key", void 0);
31
+ class KeyStorage {
32
+ constructor(collection, logger) {
33
+ this.collection = collection;
34
+ this.logger = logger;
35
+ }
36
+ async hasKey(keyId) {
37
+ const entry = await this.collection.read(keyId);
38
+ return !!entry;
39
+ }
40
+ async storeKey(keyId, keyData) {
41
+ const entry = await this.collection.read(keyId);
42
+ if (entry) {
43
+ this.logger.info(`Key with id ${keyId} already exists`);
44
+ return;
45
+ }
46
+ await this.collection.create(KeyStorageEntry.from({ id: core_types_1.CoreId.from(keyId), key: keyData }));
47
+ }
48
+ async getKey(keyId) {
49
+ const entry = await this.collection.read(keyId);
50
+ if (!entry) {
51
+ this.logger.warn(`Key with id ${keyId} not found`);
52
+ return undefined;
53
+ }
54
+ const parsed = KeyStorageEntry.from(entry);
55
+ return parsed.key;
56
+ }
57
+ async deleteKey(keyId) {
58
+ const entry = await this.collection.read(keyId);
59
+ if (!entry) {
60
+ this.logger.warn(`Key with id ${keyId} not found, cannot delete`);
61
+ return;
62
+ }
63
+ await this.collection.delete(KeyStorageEntry.from(entry));
64
+ }
65
+ }
66
+ exports.KeyStorage = KeyStorage;
67
+ //# sourceMappingURL=KeyStorage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyStorage.js","sourceRoot":"","sources":["../../../../src/modules/openid4vc/local/KeyStorage.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,kDAAyD;AACzD,kDAA2C;AAC3C,gDAAmG;AACnG,uDAA0C;AAM1C,MAAM,eAAgB,SAAQ,8BAAkB;IAAhD;;QACoB,wBAAmB,GAAa,CAAC,IAAA,yBAAM,EAAkB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAS5F,CAAC;IAHU,MAAM,CAAC,IAAI,CAAC,KAAuB;QACtC,OAAO,IAAI,CAAC,OAAO,CAAkB,KAAK,CAAC,CAAC;IAChD,CAAC;CACJ;AALU;IAFN,IAAA,qBAAS,EAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;IACxB,IAAA,oBAAQ,GAAE;;4CACK;AAOpB,MAAa,UAAU;IACnB,YACqB,UAAkC,EAClC,MAAe;QADf,eAAU,GAAV,UAAU,CAAwB;QAClC,WAAM,GAAN,MAAM,CAAS;IACjC,CAAC;IAEG,KAAK,CAAC,MAAM,CAAC,KAAa;QAC7B,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAChD,OAAO,CAAC,CAAC,KAAK,CAAC;IACnB,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,KAAa,EAAE,OAAY;QAC7C,MAAM,KAAK,GAAG,MAAM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imFormat: ClaimFormat;
4
+ encoded: string | W3cJsonCredential;
5
+ displayInformation?: Record<string, any>[];
6
+ }
7
+ //# sourceMappingURL=OpenId4VciCredentialResponseJSON.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenId4VciCredentialResponseJSON.d.ts","sourceRoot":"","sources":["../../../../src/modules/openid4vc/local/OpenId4VciCredentialResponseJSON.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEhE,MAAM,WAAW,gCAAgC;IAC7C,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,MAAM,GAAG,iBAAiB,CAAC;IACpC,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;CAC9C"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=OpenId4VciCredentialResponseJSON.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenId4VciCredentialResponseJSON.js","sourceRoot":"","sources":["../../../../src/modules/openid4vc/local/OpenId4VciCredentialResponseJSON.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import { SynchronizedCollection } from "@nmshd/transport";
2
+ import { OpenId4VciCredentialResponseJSON } from "./OpenId4VciCredentialResponseJSON";
3
+ export declare class RequestedCredentialCache {
4
+ private readonly collection;
5
+ constructor(collection: SynchronizedCollection);
6
+ get(credentialOfferUrl: string): Promise<OpenId4VciCredentialResponseJSON[] | undefined>;
7
+ set(credentialOfferUrl: string, credentialResponses: OpenId4VciCredentialResponseJSON[]): Promise<void>;
8
+ }
9
+ //# sourceMappingURL=RequestedCredentialCache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RequestedCredentialCache.d.ts","sourceRoot":"","sources":["../../../../src/modules/openid4vc/local/RequestedCredentialCache.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAG9E,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AAyBtF,qBAAa,wBAAwB;IACd,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,sBAAsB;IAEzD,GAAG,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,gCAAgC,EAAE,GAAG,SAAS,CAAC;IAKxF,GAAG,CAAC,kBAAkB,EAAE,MAAM,EAAE,mBAAmB,EAAE,gCAAgC,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAIvH"}
@@ -0,0 +1,57 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.RequestedCredentialCache = void 0;
13
+ const ts_serval_1 = require("@js-soft/ts-serval");
14
+ const transport_1 = require("@nmshd/transport");
15
+ const ts_simple_nameof_1 = require("ts-simple-nameof");
16
+ const ConsumptionIds_1 = require("../../../consumption/ConsumptionIds");
17
+ class RequestedCredentialCacheEntry extends transport_1.CoreSynchronizable {
18
+ constructor() {
19
+ super(...arguments);
20
+ this.technicalProperties = [
21
+ (0, ts_simple_nameof_1.nameof)((r) => r.credentialOfferUrl),
22
+ (0, ts_simple_nameof_1.nameof)((r) => r.credentialResponses)
23
+ ];
24
+ }
25
+ static create(id, credentialOfferUrl, credentialResponses) {
26
+ return this.fromAny({
27
+ id: id,
28
+ credentialOfferUrl: credentialOfferUrl,
29
+ credentialResponses
30
+ });
31
+ }
32
+ }
33
+ __decorate([
34
+ (0, ts_serval_1.serialize)(),
35
+ (0, ts_serval_1.validate)(),
36
+ __metadata("design:type", String)
37
+ ], RequestedCredentialCacheEntry.prototype, "credentialOfferUrl", void 0);
38
+ __decorate([
39
+ (0, ts_serval_1.serialize)({ any: true }),
40
+ (0, ts_serval_1.validate)(),
41
+ __metadata("design:type", Array)
42
+ ], RequestedCredentialCacheEntry.prototype, "credentialResponses", void 0);
43
+ class RequestedCredentialCache {
44
+ constructor(collection) {
45
+ this.collection = collection;
46
+ }
47
+ async get(credentialOfferUrl) {
48
+ const doc = await this.collection.findOne({ credentialOfferUrl: credentialOfferUrl });
49
+ return doc ? RequestedCredentialCacheEntry.fromAny(doc).credentialResponses : undefined;
50
+ }
51
+ async set(credentialOfferUrl, credentialResponses) {
52
+ const id = await ConsumptionIds_1.ConsumptionIds.requestedCredentialCacheEntry.generate();
53
+ await this.collection.create(RequestedCredentialCacheEntry.create(id, credentialOfferUrl, credentialResponses));
54
+ }
55
+ }
56
+ exports.RequestedCredentialCache = RequestedCredentialCache;
57
+ //# sourceMappingURL=RequestedCredentialCache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RequestedCredentialCache.js","sourceRoot":"","sources":["../../../../src/modules/openid4vc/local/RequestedCredentialCache.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAyD;AAEzD,gDAA8E;AAC9E,uDAA0C;AAC1C,wEAAqE;AAGrE,MAAM,6BAA8B,SAAQ,8BAAkB;IAA9D;;QACoB,wBAAmB,GAAa;YAC5C,IAAA,yBAAM,EAAgC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,kBAAkB,CAAC;YAClE,IAAA,yBAAM,EAAgC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,mBAAmB,CAAC;SACtE,CAAC;IAiBN,CAAC;IAPU,MAAM,CAAC,MAAM,CAAC,EAAU,EAAE,kBAA0B,EAAE,mBAAuD;QAChH,OAAO,IAAI,CAAC,OAAO,CAAgC;YAC/C,EAAE,EAAE,EAAE;YACN,kBAAkB,EAAE,kBAAkB;YACtC,mBAAmB;SACtB,CAAC,CAAC;IACP,CAAC;CACJ;AAbU;IAFN,IAAA,qBAAS,GAAE;IACX,IAAA,oBAAQ,GAAE;;yEACuB;AAI3B;IAFN,IAAA,qBAAS,EAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;IACxB,IAAA,oBAAQ,GAAE;;0EACoD;AAWnE,MAAa,wBAAwB;IACjC,YAAoC,UAAkC;QAAlC,eAAU,GAAV,UAAU,CAAwB;IAAG,CAAC;IAEnE,KAAK,CAAC,GAAG,CAAC,kBAA0B;QACvC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAC,CAAC;QACtF,OAAO,GAAG,CAAC,CAAC,CAAC,6BAA6B,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5F,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,kBAA0B,EAAE,mBAAuD;QAChG,MAAM,EAAE,GAAG,MAAM,+BAAc,CAAC,6BAA6B,CAAC,QAAQ,EAAE,CAAC;QACzE,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,6BAA6B,CAAC,MAAM,CAAC,EAAE,EAAE,kBAAkB,EAAE,mBAAmB,CAAC,CAAC,CAAC;IACpH,CAAC;CACJ;AAZD,4DAYC"}
@@ -0,0 +1,12 @@
1
+ import { CoreAddress } from "@nmshd/core-types";
2
+ import { TransportDataEvent } from "@nmshd/transport";
3
+ export interface ShareCredentialOfferRequestItemProcessedByRecipientEventData {
4
+ credentialOfferUrl: string;
5
+ accepted: boolean;
6
+ peer: CoreAddress;
7
+ }
8
+ export declare class ShareCredentialOfferRequestItemProcessedByRecipientEvent extends TransportDataEvent<ShareCredentialOfferRequestItemProcessedByRecipientEventData> {
9
+ static readonly namespace = "consumption.shareCredentialOfferRequestItemProcessedByRecipient";
10
+ constructor(eventTargetAddress: string, data: ShareCredentialOfferRequestItemProcessedByRecipientEventData);
11
+ }
12
+ //# sourceMappingURL=ShareCredentialOfferRequestItemProcessedByRecipientEvent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShareCredentialOfferRequestItemProcessedByRecipientEvent.d.ts","sourceRoot":"","sources":["../../../../src/modules/requests/events/ShareCredentialOfferRequestItemProcessedByRecipientEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,WAAW,4DAA4D;IACzE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,WAAW,CAAC;CACrB;AAED,qBAAa,wDAAyD,SAAQ,kBAAkB,CAAC,4DAA4D,CAAC;IAC1J,gBAAuB,SAAS,qEAAqE;gBAElF,kBAAkB,EAAE,MAAM,EAAE,IAAI,EAAE,4DAA4D;CAGpH"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ShareCredentialOfferRequestItemProcessedByRecipientEvent = void 0;
4
+ const transport_1 = require("@nmshd/transport");
5
+ class ShareCredentialOfferRequestItemProcessedByRecipientEvent extends transport_1.TransportDataEvent {
6
+ static { this.namespace = "consumption.shareCredentialOfferRequestItemProcessedByRecipient"; }
7
+ constructor(eventTargetAddress, data) {
8
+ super(ShareCredentialOfferRequestItemProcessedByRecipientEvent.namespace, eventTargetAddress, data);
9
+ }
10
+ }
11
+ exports.ShareCredentialOfferRequestItemProcessedByRecipientEvent = ShareCredentialOfferRequestItemProcessedByRecipientEvent;
12
+ //# sourceMappingURL=ShareCredentialOfferRequestItemProcessedByRecipientEvent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShareCredentialOfferRequestItemProcessedByRecipientEvent.js","sourceRoot":"","sources":["../../../../src/modules/requests/events/ShareCredentialOfferRequestItemProcessedByRecipientEvent.ts"],"names":[],"mappings":";;;AACA,gDAAsD;AAQtD,MAAa,wDAAyD,SAAQ,8BAAgF;aACnI,cAAS,GAAG,iEAAiE,CAAC;IAErG,YAAmB,kBAA0B,EAAE,IAAkE;QAC7G,KAAK,CAAC,wDAAwD,CAAC,SAAS,EAAE,kBAAkB,EAAE,IAAI,CAAC,CAAC;IACxG,CAAC;;AALL,4HAMC"}
@@ -3,4 +3,5 @@ export * from "./IncomingRequestStatusChangedEvent";
3
3
  export * from "./OutgoingRequestCreatedAndCompletedEvent";
4
4
  export * from "./OutgoingRequestCreatedEvent";
5
5
  export * from "./OutgoingRequestStatusChangedEvent";
6
+ export * from "./ShareCredentialOfferRequestItemProcessedByRecipientEvent";
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/requests/events/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qCAAqC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/requests/events/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qCAAqC,CAAC;AACpD,cAAc,4DAA4D,CAAC"}
@@ -19,4 +19,5 @@ __exportStar(require("./IncomingRequestStatusChangedEvent"), exports);
19
19
  __exportStar(require("./OutgoingRequestCreatedAndCompletedEvent"), exports);
20
20
  __exportStar(require("./OutgoingRequestCreatedEvent"), exports);
21
21
  __exportStar(require("./OutgoingRequestStatusChangedEvent"), exports);
22
+ __exportStar(require("./ShareCredentialOfferRequestItemProcessedByRecipientEvent"), exports);
22
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/requests/events/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iEAA+C;AAC/C,sEAAoD;AACpD,4EAA0D;AAC1D,gEAA8C;AAC9C,sEAAoD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/requests/events/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iEAA+C;AAC/C,sEAAoD;AACpD,4EAA0D;AAC1D,gEAA8C;AAC9C,sEAAoD;AACpD,6FAA2E"}
@@ -26,6 +26,9 @@ export * from "./itemProcessors/RequestItemConstructor";
26
26
  export * from "./itemProcessors/RequestItemProcessorConstructor";
27
27
  export * from "./itemProcessors/RequestItemProcessorRegistry";
28
28
  export * from "./itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor";
29
+ export * from "./itemProcessors/shareAuthorizationRequest/AcceptShareAuthorizationRequestRequestItemParameters";
30
+ export * from "./itemProcessors/shareAuthorizationRequest/ShareAuthorizationRequestRequestItemProcessor";
31
+ export * from "./itemProcessors/shareCredentialOffer/ShareCredentialOfferRequestItemProcessor";
29
32
  export * from "./itemProcessors/transferFileOwnership/TransferFileOwnershipRequestItemProcessor";
30
33
  export * from "./local/LocalRequest";
31
34
  export * from "./local/LocalRequestStatus";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/requests/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,6EAA6E,CAAC;AAC5F,cAAc,uDAAuD,CAAC;AAC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ACnE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,uCAAuC,CAAC;AACtD,cAAc,uDAAuD,CAAC;AACtE,cAAc,mFAAmF,CAAC;AAClG,cAAc,+CAA+C,CAAC;AAC9D,cAAc,sEAAsE,CAAC;AACrF,cAAc,6EAA6E,CAAC;AAC5F,cAAc,sEAAsE,CAAC;AACrF,cAAc,iEAAiE,CAAC;AAChF,cAAc,0DAA0D,CAAC;AACzE,cAAc,8CAA8C,CAAC;AAC7D,cAAc,wCAAwC,CAAC;AACvD,cAAc,+EAA+E,CAAC;AAC9F,cAAc,wEAAwE,CAAC;AACvF,OAAO,EACH,4CAA4C,EAC5C,iEAAiE,EACjE,4DAA4D,EAC/D,MAAM,yEAAyE,CAAC;AACjF,cAAc,kEAAkE,CAAC;AACjF,cAAc,yCAAyC,CAAC;AACxD,cAAc,kDAAkD,CAAC;AACjE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,oEAAoE,CAAC;AACnF,cAAc,iGAAiG,CAAC;AAChH,cAAc,0FAA0F,CAAC;AACzG,cAAc,gFAAgF,CAAC;AAC/F,cAAc,kFAAkF,CAAC;AACjG,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oCAAoC,CAAC;AACnD,cAAc,uBAAuB,CAAC;AACtC,cAAc,sEAAsE,CAAC;AACrF,cAAc,yIAAyI,CAAC;AACxJ,cAAc,qEAAqE,CAAC;AACpF,cAAc,kEAAkE,CAAC;AACjF,cAAc,uCAAuC,CAAC;AACtD,cAAc,8DAA8D,CAAC"}
@@ -41,6 +41,9 @@ __exportStar(require("./itemProcessors/RequestItemConstructor"), exports);
41
41
  __exportStar(require("./itemProcessors/RequestItemProcessorConstructor"), exports);
42
42
  __exportStar(require("./itemProcessors/RequestItemProcessorRegistry"), exports);
43
43
  __exportStar(require("./itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor"), exports);
44
+ __exportStar(require("./itemProcessors/shareAuthorizationRequest/AcceptShareAuthorizationRequestRequestItemParameters"), exports);
45
+ __exportStar(require("./itemProcessors/shareAuthorizationRequest/ShareAuthorizationRequestRequestItemProcessor"), exports);
46
+ __exportStar(require("./itemProcessors/shareCredentialOffer/ShareCredentialOfferRequestItemProcessor"), exports);
44
47
  __exportStar(require("./itemProcessors/transferFileOwnership/TransferFileOwnershipRequestItemProcessor"), exports);
45
48
  __exportStar(require("./local/LocalRequest"), exports);
46
49
  __exportStar(require("./local/LocalRequestStatus"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/requests/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,8GAA4F;AAC5F,wFAAsE;AACtE,gFAA8D;AAC9D,qFAAmE;AACnE,gFAA8D;AAC9D,4EAA0D;AAC1D,gFAA8D;AAC9D,8EAA4D;AAC5D,wEAAsD;AACtD,wFAAsE;AACtE,oHAAkG;AAClG,gFAA8D;AAC9D,uGAAqF;AACrF,8GAA4F;AAC5F,uGAAqF;AACrF,kGAAgF;AAChF,2FAAyE;AACzE,+EAA6D;AAC7D,yEAAuD;AACvD,gHAA8F;AAC9F,yGAAuF;AAMvF,mGAAiF;AACjF,0EAAwD;AACxD,mFAAiE;AACjE,gFAA8D;AAC9D,qGAAmF;AACnF,mHAAiG;AACjG,uDAAqC;AACrC,6DAA2C;AAC3C,qEAAmD;AACnD,wDAAsC;AACtC,uGAAqF;AACrF,0KAAwJ;AACxJ,sGAAoF;AACpF,mGAAiF;AACjF,wEAAsD;AACtD,+FAA6E"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/requests/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,8GAA4F;AAC5F,wFAAsE;AACtE,gFAA8D;AAC9D,qFAAmE;AACnE,gFAA8D;AAC9D,4EAA0D;AAC1D,gFAA8D;AAC9D,8EAA4D;AAC5D,wEAAsD;AACtD,wFAAsE;AACtE,oHAAkG;AAClG,gFAA8D;AAC9D,uGAAqF;AACrF,8GAA4F;AAC5F,uGAAqF;AACrF,kGAAgF;AAChF,2FAAyE;AACzE,+EAA6D;AAC7D,yEAAuD;AACvD,gHAA8F;AAC9F,yGAAuF;AAMvF,mGAAiF;AACjF,0EAAwD;AACxD,mFAAiE;AACjE,gFAA8D;AAC9D,qGAAmF;AACnF,kIAAgH;AAChH,2HAAyG;AACzG,iHAA+F;AAC/F,mHAAiG;AACjG,uDAAqC;AACrC,6DAA2C;AAC3C,qEAAmD;AACnD,wDAAsC;AACtC,uGAAqF;AACrF,0KAAwJ;AACxJ,sGAAoF;AACpF,mGAAiF;AACjF,wEAAsD;AACtD,+FAA6E"}
@@ -0,0 +1,11 @@
1
+ import { Serializable } from "@js-soft/ts-serval";
2
+ import { CoreId } from "@nmshd/core-types";
3
+ import { AcceptRequestItemParametersJSON } from "../../incoming/decide/AcceptRequestItemParameters";
4
+ export interface AcceptShareAuthorizationRequestRequestItemParametersJSON extends AcceptRequestItemParametersJSON {
5
+ attributeId: string;
6
+ }
7
+ export declare class AcceptShareAuthorizationRequestRequestItemParameters extends Serializable {
8
+ attributeId: CoreId;
9
+ static from(value: AcceptShareAuthorizationRequestRequestItemParametersJSON): AcceptShareAuthorizationRequestRequestItemParameters;
10
+ }
11
+ //# sourceMappingURL=AcceptShareAuthorizationRequestRequestItemParameters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcceptShareAuthorizationRequestRequestItemParameters.d.ts","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/shareAuthorizationRequest/AcceptShareAuthorizationRequestRequestItemParameters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA6B,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,+BAA+B,EAAE,MAAM,mDAAmD,CAAC;AAEpG,MAAM,WAAW,wDAAyD,SAAQ,+BAA+B;IAC7G,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,qBACa,oDAAqD,SAAQ,YAAY;IAG3E,WAAW,EAAE,MAAM,CAAC;WAEb,IAAI,CAAC,KAAK,EAAE,wDAAwD,GAAG,oDAAoD;CAG5I"}
@@ -0,0 +1,29 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.AcceptShareAuthorizationRequestRequestItemParameters = void 0;
13
+ const ts_serval_1 = require("@js-soft/ts-serval");
14
+ const core_types_1 = require("@nmshd/core-types");
15
+ let AcceptShareAuthorizationRequestRequestItemParameters = class AcceptShareAuthorizationRequestRequestItemParameters extends ts_serval_1.Serializable {
16
+ static from(value) {
17
+ return this.fromAny(value);
18
+ }
19
+ };
20
+ exports.AcceptShareAuthorizationRequestRequestItemParameters = AcceptShareAuthorizationRequestRequestItemParameters;
21
+ __decorate([
22
+ (0, ts_serval_1.serialize)(),
23
+ (0, ts_serval_1.validate)(),
24
+ __metadata("design:type", core_types_1.CoreId)
25
+ ], AcceptShareAuthorizationRequestRequestItemParameters.prototype, "attributeId", void 0);
26
+ exports.AcceptShareAuthorizationRequestRequestItemParameters = AcceptShareAuthorizationRequestRequestItemParameters = __decorate([
27
+ (0, ts_serval_1.type)("AcceptShareAuthorizationRequestRequestItemParameters")
28
+ ], AcceptShareAuthorizationRequestRequestItemParameters);
29
+ //# sourceMappingURL=AcceptShareAuthorizationRequestRequestItemParameters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcceptShareAuthorizationRequestRequestItemParameters.js","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/shareAuthorizationRequest/AcceptShareAuthorizationRequestRequestItemParameters.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA6E;AAC7E,kDAA2C;AAQpC,IAAM,oDAAoD,GAA1D,MAAM,oDAAqD,SAAQ,wBAAY;IAK3E,MAAM,CAAC,IAAI,CAAC,KAA+D;QAC9E,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;CACJ,CAAA;AARY,oHAAoD;AAGtD;IAFN,IAAA,qBAAS,GAAE;IACX,IAAA,oBAAQ,GAAE;8BACS,mBAAM;yFAAC;+DAHlB,oDAAoD;IADhE,IAAA,gBAAI,EAAC,sDAAsD,CAAC;GAChD,oDAAoD,CAQhE"}
@@ -0,0 +1,12 @@
1
+ import { AcceptResponseItem, Request, ShareAuthorizationRequestRequestItem } from "@nmshd/content";
2
+ import { CoreAddress } from "@nmshd/core-types";
3
+ import { ValidationResult } from "../../../common/ValidationResult";
4
+ import { GenericRequestItemProcessor } from "../GenericRequestItemProcessor";
5
+ import { LocalRequestInfo } from "../IRequestItemProcessor";
6
+ import { AcceptShareAuthorizationRequestRequestItemParametersJSON } from "./AcceptShareAuthorizationRequestRequestItemParameters";
7
+ export declare class ShareAuthorizationRequestRequestItemProcessor extends GenericRequestItemProcessor<ShareAuthorizationRequestRequestItem> {
8
+ canCreateOutgoingRequestItem(requestItem: ShareAuthorizationRequestRequestItem, _request: Request, _recipient?: CoreAddress): Promise<ValidationResult>;
9
+ canAccept(requestItem: ShareAuthorizationRequestRequestItem, params: AcceptShareAuthorizationRequestRequestItemParametersJSON, _requestInfo: LocalRequestInfo): Promise<ValidationResult>;
10
+ accept(requestItem: ShareAuthorizationRequestRequestItem, params: AcceptShareAuthorizationRequestRequestItemParametersJSON, _requestInfo: LocalRequestInfo): Promise<AcceptResponseItem>;
11
+ }
12
+ //# sourceMappingURL=ShareAuthorizationRequestRequestItemProcessor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShareAuthorizationRequestRequestItemProcessor.d.ts","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/shareAuthorizationRequest/ShareAuthorizationRequestRequestItemProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAsB,oCAAoC,EAAE,MAAM,gBAAgB,CAAC;AACvH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAEH,wDAAwD,EAC3D,MAAM,wDAAwD,CAAC;AAEhE,qBAAa,6CAA8C,SAAQ,2BAA2B,CAAC,oCAAoC,CAAC;IAC1G,4BAA4B,CAAC,WAAW,EAAE,oCAAoC,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAUvJ,SAAS,CAC3B,WAAW,EAAE,oCAAoC,EACjD,MAAM,EAAE,wDAAwD,EAChE,YAAY,EAAE,gBAAgB,GAC/B,OAAO,CAAC,gBAAgB,CAAC;IAsBN,MAAM,CACxB,WAAW,EAAE,oCAAoC,EACjD,MAAM,EAAE,wDAAwD,EAChE,YAAY,EAAE,gBAAgB,GAC/B,OAAO,CAAC,kBAAkB,CAAC;CAoBjC"}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ShareAuthorizationRequestRequestItemProcessor = void 0;
4
+ const content_1 = require("@nmshd/content");
5
+ const transport_1 = require("@nmshd/transport");
6
+ const ConsumptionCoreErrors_1 = require("../../../../consumption/ConsumptionCoreErrors");
7
+ const attributes_1 = require("../../../attributes");
8
+ const ValidationResult_1 = require("../../../common/ValidationResult");
9
+ const GenericRequestItemProcessor_1 = require("../GenericRequestItemProcessor");
10
+ const AcceptShareAuthorizationRequestRequestItemParameters_1 = require("./AcceptShareAuthorizationRequestRequestItemParameters");
11
+ class ShareAuthorizationRequestRequestItemProcessor extends GenericRequestItemProcessor_1.GenericRequestItemProcessor {
12
+ async canCreateOutgoingRequestItem(requestItem, _request, _recipient) {
13
+ try {
14
+ await this.consumptionController.openId4Vc.resolveAuthorizationRequest(requestItem.authorizationRequestUrl);
15
+ }
16
+ catch (_) {
17
+ return ValidationResult_1.ValidationResult.error(ConsumptionCoreErrors_1.ConsumptionCoreErrors.requests.invalidRequestItem("The authorization request url can't be resolved."));
18
+ }
19
+ return ValidationResult_1.ValidationResult.success();
20
+ }
21
+ async canAccept(requestItem, params, _requestInfo) {
22
+ const parsedParams = AcceptShareAuthorizationRequestRequestItemParameters_1.AcceptShareAuthorizationRequestRequestItemParameters.from(params);
23
+ const attribute = (await this.consumptionController.attributes.getLocalAttribute(parsedParams.attributeId));
24
+ if (!attribute)
25
+ return ValidationResult_1.ValidationResult.error(transport_1.TransportCoreErrors.general.recordNotFound(attributes_1.LocalAttribute, parsedParams.attributeId.toString()));
26
+ let resolvedAuthorizationRequest;
27
+ try {
28
+ resolvedAuthorizationRequest = await this.consumptionController.openId4Vc.resolveAuthorizationRequest(requestItem.authorizationRequestUrl);
29
+ }
30
+ catch (_) {
31
+ return ValidationResult_1.ValidationResult.error(ConsumptionCoreErrors_1.ConsumptionCoreErrors.requests.invalidRequestItem("The authorization request url can't be resolved."));
32
+ }
33
+ const matchingCredentials = resolvedAuthorizationRequest.matchingCredentials;
34
+ const matchingAttributeIds = matchingCredentials.map((c) => c.id.toString());
35
+ if (!matchingAttributeIds.includes(parsedParams.attributeId.toString())) {
36
+ return ValidationResult_1.ValidationResult.error(ConsumptionCoreErrors_1.ConsumptionCoreErrors.requests.invalidAcceptParameters("The credential selected for presentation doesn't match the query."));
37
+ }
38
+ return ValidationResult_1.ValidationResult.success();
39
+ }
40
+ async accept(requestItem, params, _requestInfo) {
41
+ const parsedParams = AcceptShareAuthorizationRequestRequestItemParameters_1.AcceptShareAuthorizationRequestRequestItemParameters.from(params);
42
+ const resolvedAuthorizationRequest = await this.consumptionController.openId4Vc.resolveAuthorizationRequest(requestItem.authorizationRequestUrl);
43
+ const attribute = (await this.consumptionController.attributes.getLocalAttribute(parsedParams.attributeId));
44
+ if (!attribute)
45
+ throw transport_1.TransportCoreErrors.general.recordNotFound(attributes_1.LocalAttribute, parsedParams.attributeId.toString());
46
+ const acceptResult = await this.consumptionController.openId4Vc.acceptAuthorizationRequest(resolvedAuthorizationRequest.authorizationRequest, attribute);
47
+ if (acceptResult.status !== 200) {
48
+ transport_1.TransportLoggerFactory.getLogger(ShareAuthorizationRequestRequestItemProcessor).error("Failed to accept ShareAuthorizationRequestRequestItem. Error message:", JSON.stringify(acceptResult.message));
49
+ throw ConsumptionCoreErrors_1.ConsumptionCoreErrors.requests.invalidAcceptParameters("The presentation was not successful. Try again later or select a different credential.");
50
+ }
51
+ return content_1.AcceptResponseItem.from({ result: content_1.ResponseItemResult.Accepted });
52
+ }
53
+ }
54
+ exports.ShareAuthorizationRequestRequestItemProcessor = ShareAuthorizationRequestRequestItemProcessor;
55
+ //# sourceMappingURL=ShareAuthorizationRequestRequestItemProcessor.js.map