@nmshd/consumption 7.4.1 → 7.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/buildInformation.js +5 -5
- package/dist/consumption/ConsumptionConfig.d.ts +1 -0
- package/dist/consumption/ConsumptionConfig.d.ts.map +1 -1
- package/dist/consumption/ConsumptionController.d.ts +3 -1
- package/dist/consumption/ConsumptionController.d.ts.map +1 -1
- package/dist/consumption/ConsumptionController.js +7 -1
- package/dist/consumption/ConsumptionController.js.map +1 -1
- package/dist/consumption/ConsumptionControllerName.d.ts +2 -1
- package/dist/consumption/ConsumptionControllerName.d.ts.map +1 -1
- package/dist/consumption/ConsumptionControllerName.js +1 -0
- package/dist/consumption/ConsumptionControllerName.js.map +1 -1
- package/dist/consumption/ConsumptionIds.d.ts +1 -0
- package/dist/consumption/ConsumptionIds.d.ts.map +1 -1
- package/dist/consumption/ConsumptionIds.js +1 -0
- package/dist/consumption/ConsumptionIds.js.map +1 -1
- package/dist/modules/attributes/AttributesController.js.map +1 -1
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.d.ts.map +1 -1
- package/dist/modules/index.js +1 -0
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/openid4vc/OpenId4VcController.d.ts +37 -0
- package/dist/modules/openid4vc/OpenId4VcController.d.ts.map +1 -0
- package/dist/modules/openid4vc/OpenId4VcController.js +102 -0
- package/dist/modules/openid4vc/OpenId4VcController.js.map +1 -0
- package/dist/modules/openid4vc/index.d.ts +8 -0
- package/dist/modules/openid4vc/index.d.ts.map +1 -0
- package/dist/modules/openid4vc/index.js +24 -0
- package/dist/modules/openid4vc/index.js.map +1 -0
- package/dist/modules/openid4vc/local/BaseAgent.d.ts +17 -0
- package/dist/modules/openid4vc/local/BaseAgent.d.ts.map +1 -0
- package/dist/modules/openid4vc/local/BaseAgent.js +72 -0
- package/dist/modules/openid4vc/local/BaseAgent.js.map +1 -0
- package/dist/modules/openid4vc/local/EnmeshedHolderFileSystem.d.ts +15 -0
- package/dist/modules/openid4vc/local/EnmeshedHolderFileSystem.d.ts.map +1 -0
- package/dist/modules/openid4vc/local/EnmeshedHolderFileSystem.js +30 -0
- package/dist/modules/openid4vc/local/EnmeshedHolderFileSystem.js.map +1 -0
- package/dist/modules/openid4vc/local/EnmeshedHolderKeyManagementService.d.ts +32 -0
- package/dist/modules/openid4vc/local/EnmeshedHolderKeyManagementService.d.ts.map +1 -0
- package/dist/modules/openid4vc/local/EnmeshedHolderKeyManagementService.js +312 -0
- package/dist/modules/openid4vc/local/EnmeshedHolderKeyManagementService.js.map +1 -0
- package/dist/modules/openid4vc/local/EnmeshedStorageService.d.ts +25 -0
- package/dist/modules/openid4vc/local/EnmeshedStorageService.d.ts.map +1 -0
- package/dist/modules/openid4vc/local/EnmeshedStorageService.js +134 -0
- package/dist/modules/openid4vc/local/EnmeshedStorageService.js.map +1 -0
- package/dist/modules/openid4vc/local/Holder.d.ts +43 -0
- package/dist/modules/openid4vc/local/Holder.d.ts.map +1 -0
- package/dist/modules/openid4vc/local/Holder.js +163 -0
- package/dist/modules/openid4vc/local/Holder.js.map +1 -0
- package/dist/modules/openid4vc/local/KeyStorage.d.ts +12 -0
- package/dist/modules/openid4vc/local/KeyStorage.d.ts.map +1 -0
- package/dist/modules/openid4vc/local/KeyStorage.js +67 -0
- package/dist/modules/openid4vc/local/KeyStorage.js.map +1 -0
- package/dist/modules/openid4vc/local/OpenId4VciCredentialResponseJSON.d.ts +7 -0
- package/dist/modules/openid4vc/local/OpenId4VciCredentialResponseJSON.d.ts.map +1 -0
- package/dist/modules/openid4vc/local/OpenId4VciCredentialResponseJSON.js +3 -0
- package/dist/modules/openid4vc/local/OpenId4VciCredentialResponseJSON.js.map +1 -0
- package/dist/modules/openid4vc/local/RequestedCredentialCache.d.ts +9 -0
- package/dist/modules/openid4vc/local/RequestedCredentialCache.d.ts.map +1 -0
- package/dist/modules/openid4vc/local/RequestedCredentialCache.js +57 -0
- package/dist/modules/openid4vc/local/RequestedCredentialCache.js.map +1 -0
- package/dist/modules/requests/events/ShareCredentialOfferRequestItemProcessedByRecipientEvent.d.ts +12 -0
- package/dist/modules/requests/events/ShareCredentialOfferRequestItemProcessedByRecipientEvent.d.ts.map +1 -0
- package/dist/modules/requests/events/ShareCredentialOfferRequestItemProcessedByRecipientEvent.js +12 -0
- package/dist/modules/requests/events/ShareCredentialOfferRequestItemProcessedByRecipientEvent.js.map +1 -0
- package/dist/modules/requests/events/index.d.ts +1 -0
- package/dist/modules/requests/events/index.d.ts.map +1 -1
- package/dist/modules/requests/events/index.js +1 -0
- package/dist/modules/requests/events/index.js.map +1 -1
- package/dist/modules/requests/index.d.ts +3 -0
- package/dist/modules/requests/index.d.ts.map +1 -1
- package/dist/modules/requests/index.js +3 -0
- package/dist/modules/requests/index.js.map +1 -1
- package/dist/modules/requests/itemProcessors/shareAuthorizationRequest/AcceptShareAuthorizationRequestRequestItemParameters.d.ts +11 -0
- package/dist/modules/requests/itemProcessors/shareAuthorizationRequest/AcceptShareAuthorizationRequestRequestItemParameters.d.ts.map +1 -0
- package/dist/modules/requests/itemProcessors/shareAuthorizationRequest/AcceptShareAuthorizationRequestRequestItemParameters.js +29 -0
- package/dist/modules/requests/itemProcessors/shareAuthorizationRequest/AcceptShareAuthorizationRequestRequestItemParameters.js.map +1 -0
- package/dist/modules/requests/itemProcessors/shareAuthorizationRequest/ShareAuthorizationRequestRequestItemProcessor.d.ts +12 -0
- package/dist/modules/requests/itemProcessors/shareAuthorizationRequest/ShareAuthorizationRequestRequestItemProcessor.d.ts.map +1 -0
- package/dist/modules/requests/itemProcessors/shareAuthorizationRequest/ShareAuthorizationRequestRequestItemProcessor.js +55 -0
- package/dist/modules/requests/itemProcessors/shareAuthorizationRequest/ShareAuthorizationRequestRequestItemProcessor.js.map +1 -0
- package/dist/modules/requests/itemProcessors/shareCredentialOffer/ShareCredentialOfferRequestItemProcessor.d.ts +14 -0
- package/dist/modules/requests/itemProcessors/shareCredentialOffer/ShareCredentialOfferRequestItemProcessor.d.ts.map +1 -0
- package/dist/modules/requests/itemProcessors/shareCredentialOffer/ShareCredentialOfferRequestItemProcessor.js +42 -0
- package/dist/modules/requests/itemProcessors/shareCredentialOffer/ShareCredentialOfferRequestItemProcessor.js.map +1 -0
- package/dist/modules/requests/outgoing/OutgoingRequestsController.d.ts.map +1 -1
- package/dist/modules/requests/outgoing/OutgoingRequestsController.js +3 -1
- package/dist/modules/requests/outgoing/OutgoingRequestsController.js.map +1 -1
- package/package.json +32 -9
|
@@ -0,0 +1,134 @@
|
|
|
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.EnmeshedStorageService = void 0;
|
|
13
|
+
exports.decodeRecord = decodeRecord;
|
|
14
|
+
const core_1 = require("@credo-ts/core");
|
|
15
|
+
const content_1 = require("@nmshd/content");
|
|
16
|
+
const transport_1 = require("@nmshd/transport");
|
|
17
|
+
const AttributesController_1 = require("../../attributes/AttributesController");
|
|
18
|
+
const KeyStorage_1 = require("./KeyStorage");
|
|
19
|
+
let EnmeshedStorageService = class EnmeshedStorageService {
|
|
20
|
+
constructor(accountController, attributeController, keyStorage) {
|
|
21
|
+
this.accountController = accountController;
|
|
22
|
+
this.attributeController = attributeController;
|
|
23
|
+
this.keyStorage = keyStorage;
|
|
24
|
+
this.storage = new Map();
|
|
25
|
+
this.supportsCursorPagination = false;
|
|
26
|
+
}
|
|
27
|
+
save(_agentContext, record) {
|
|
28
|
+
if (record.id !== "STORAGE_VERSION_RECORD_ID" && record.type !== "DidRecord") {
|
|
29
|
+
throw new Error("Not implemented: saving records other than STORAGE_VERSION_RECORD_ID and DidRecord has not been required so far.");
|
|
30
|
+
}
|
|
31
|
+
this.storage.set(record.id, record);
|
|
32
|
+
return Promise.resolve();
|
|
33
|
+
}
|
|
34
|
+
async saveWithDisplay(agentContext, value, type, displayInformation) {
|
|
35
|
+
const owner = this.accountController.identity.address;
|
|
36
|
+
const identityAttribute = content_1.IdentityAttribute.from({
|
|
37
|
+
value: {
|
|
38
|
+
"@type": "VerifiableCredential",
|
|
39
|
+
value: value,
|
|
40
|
+
type: type,
|
|
41
|
+
displayInformation: displayInformation
|
|
42
|
+
},
|
|
43
|
+
owner: owner
|
|
44
|
+
});
|
|
45
|
+
const result = await this.attributeController.createOwnIdentityAttribute({
|
|
46
|
+
content: identityAttribute
|
|
47
|
+
});
|
|
48
|
+
agentContext.config.logger.debug(`Saved record: ${JSON.stringify(result)}`);
|
|
49
|
+
return await Promise.resolve(result);
|
|
50
|
+
}
|
|
51
|
+
update(_agentContext, _record) {
|
|
52
|
+
throw new Error("Storage update not implemented because previously not needed");
|
|
53
|
+
}
|
|
54
|
+
delete(_agentContext, _record) {
|
|
55
|
+
throw new Error("Storage delete not implemented because previously not needed");
|
|
56
|
+
}
|
|
57
|
+
deleteById(_agentContext, _recordClass, _id) {
|
|
58
|
+
throw new Error("Storage delete not implemented because previously not needed");
|
|
59
|
+
}
|
|
60
|
+
getById(_agentContext, _recordClass, id) {
|
|
61
|
+
const record = this.storage.get(id);
|
|
62
|
+
if (!record)
|
|
63
|
+
throw new Error(`Record with id ${id} not found`);
|
|
64
|
+
return Promise.resolve(record);
|
|
65
|
+
}
|
|
66
|
+
async getAll(_agentContext, recordClass) {
|
|
67
|
+
const recordType = recordClass.type;
|
|
68
|
+
const correspondingCredentialType = this.recordTypeToCredentialType(recordType);
|
|
69
|
+
const attributes = await this.attributeController.getLocalAttributes({
|
|
70
|
+
"@type": "OwnIdentityAttribute",
|
|
71
|
+
"content.value.@type": "VerifiableCredential",
|
|
72
|
+
"content.value.type": correspondingCredentialType
|
|
73
|
+
});
|
|
74
|
+
return attributes.map((attribute) => {
|
|
75
|
+
const attributeValue = attribute.content.value;
|
|
76
|
+
return decodeRecord(correspondingCredentialType, attributeValue.value);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
// this is currently the only method which supports all record types, as otherwise the presentation could not work
|
|
80
|
+
recordTypeToCredentialType(recordType) {
|
|
81
|
+
switch (recordType) {
|
|
82
|
+
case core_1.SdJwtVcRecord.name:
|
|
83
|
+
return core_1.ClaimFormat.SdJwtDc;
|
|
84
|
+
case core_1.MdocRecord.name:
|
|
85
|
+
return core_1.ClaimFormat.MsoMdoc;
|
|
86
|
+
case core_1.W3cCredentialRecord.name:
|
|
87
|
+
return core_1.ClaimFormat.SdJwtW3cVc;
|
|
88
|
+
default:
|
|
89
|
+
throw new Error("Record type not supported.");
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
async findByQuery(agentContext, recordClass, query, queryOptions) {
|
|
93
|
+
agentContext.config.logger.debug(`Finding records by query ${JSON.stringify(query)} and options ${JSON.stringify(queryOptions)}`);
|
|
94
|
+
const records = [];
|
|
95
|
+
for (const record of await this.getAll(agentContext, recordClass)) {
|
|
96
|
+
if (this.matchesQuery(record, query)) {
|
|
97
|
+
records.push(record);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (records.length === 0) {
|
|
101
|
+
// recover from storage if no record was found by query, as the record might have been only added very shortly before calling the findByQuery
|
|
102
|
+
for (const record of this.storage.values()) {
|
|
103
|
+
if (this.matchesQuery(record, query)) {
|
|
104
|
+
records.push(record);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return records;
|
|
109
|
+
}
|
|
110
|
+
matchesQuery(record, query) {
|
|
111
|
+
return Object.entries(query).every(([key, value]) => {
|
|
112
|
+
if (key === "$or") {
|
|
113
|
+
return value.some((subquery) => this.matchesQuery(record, subquery));
|
|
114
|
+
}
|
|
115
|
+
return record.getTags()[key] === value;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
exports.EnmeshedStorageService = EnmeshedStorageService;
|
|
120
|
+
exports.EnmeshedStorageService = EnmeshedStorageService = __decorate([
|
|
121
|
+
(0, core_1.injectable)(),
|
|
122
|
+
__metadata("design:paramtypes", [transport_1.AccountController,
|
|
123
|
+
AttributesController_1.AttributesController,
|
|
124
|
+
KeyStorage_1.KeyStorage])
|
|
125
|
+
], EnmeshedStorageService);
|
|
126
|
+
function decodeRecord(type, encoded) {
|
|
127
|
+
switch (type) {
|
|
128
|
+
case core_1.ClaimFormat.SdJwtDc:
|
|
129
|
+
return new core_1.SdJwtVcRecord({ credentialInstances: [{ compactSdJwtVc: encoded }] });
|
|
130
|
+
default:
|
|
131
|
+
throw new Error("Credential type not supported.");
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=EnmeshedStorageService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EnmeshedStorageService.js","sourceRoot":"","sources":["../../../../src/modules/openid4vc/local/EnmeshedStorageService.ts"],"names":[],"mappings":";;;;;;;;;;;;AA0IA,oCAOC;AAjJD,yCAYwB;AACxB,4CAAyE;AACzE,gDAAqD;AAErD,gFAA6E;AAC7E,6CAA0C;AAGnC,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAG/B,YACqB,iBAAoC,EACpC,mBAAyC,EACzC,UAAsB;QAFtB,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,wBAAmB,GAAnB,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AChD,IAAI,GAAG,KAAK,KAAK,EAAE,CAAC;gBAChB,OAAQ,KAAe,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;YACpF,CAAC;YACD,OAAO,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC;QAC3C,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;AApHY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,iBAAU,GAAE;qCAK+B,6BAAiB;QACf,2CAAoB;QAC7B,uBAAU;GANlC,sBAAsB,CAoHlC;AAED,SAAgB,YAAY,CAAC,IAAY,EAAE,OAAqC;IAC5E,QAAQ,IAAI,EAAE,CAAC;QACX,KAAK,kBAAW,CAAC,OAAO;YACpB,OAAO,IAAI,oBAAa,CAAC,EAAE,mBAAmB,EAAE,CAAC,EAAE,cAAc,EAAE,OAAiB,EAAE,CAAC,EAAE,CAAC,CAAC;QAC/F;YACI,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IAC1D,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { X509Module } from "@credo-ts/core";
|
|
2
|
+
import { OpenId4VciCredentialResponse, OpenId4VcModule, type OpenId4VciResolvedCredentialOffer, type OpenId4VpResolvedAuthorizationRequest } from "@credo-ts/openid4vc";
|
|
3
|
+
import { TokenContentVerifiablePresentation, VerifiableCredential } from "@nmshd/content";
|
|
4
|
+
import { AccountController } from "@nmshd/transport";
|
|
5
|
+
import { AttributesController, OwnIdentityAttribute } from "../../attributes";
|
|
6
|
+
import { BaseAgent } from "./BaseAgent";
|
|
7
|
+
import { KeyStorage } from "./KeyStorage";
|
|
8
|
+
import { OpenId4VciCredentialResponseJSON } from "./OpenId4VciCredentialResponseJSON";
|
|
9
|
+
declare function getOpenIdHolderModules(): {
|
|
10
|
+
readonly openid4vc: OpenId4VcModule<null, null>;
|
|
11
|
+
readonly x509: X509Module;
|
|
12
|
+
};
|
|
13
|
+
export declare class Holder extends BaseAgent<ReturnType<typeof getOpenIdHolderModules>> {
|
|
14
|
+
client: {
|
|
15
|
+
clientId: string;
|
|
16
|
+
redirectUri: string;
|
|
17
|
+
};
|
|
18
|
+
constructor(keyStorage: KeyStorage, accountController: AccountController, attributeController: AttributesController, fetchInstance: typeof fetch);
|
|
19
|
+
resolveCredentialOffer(credentialOffer: string): Promise<OpenId4VciResolvedCredentialOffer>;
|
|
20
|
+
requestCredentials(resolvedCredentialOffer: OpenId4VciResolvedCredentialOffer, credentialConfigurationIds: string[], access: {
|
|
21
|
+
accessToken: string;
|
|
22
|
+
} | {
|
|
23
|
+
pinCode?: string;
|
|
24
|
+
}): Promise<OpenId4VciCredentialResponse[]>;
|
|
25
|
+
storeCredentials(credentialResponses: OpenId4VciCredentialResponseJSON[]): Promise<OwnIdentityAttribute[]>;
|
|
26
|
+
resolveAuthorizationRequest(request: string): Promise<OpenId4VpResolvedAuthorizationRequest>;
|
|
27
|
+
acceptAuthorizationRequest(resolvedAuthorizationRequest: OpenId4VpResolvedAuthorizationRequest, credential: OwnIdentityAttribute): Promise<{
|
|
28
|
+
readonly status: number;
|
|
29
|
+
readonly body: string | Record<string, unknown> | null;
|
|
30
|
+
} | {
|
|
31
|
+
readonly status: number;
|
|
32
|
+
readonly body: Record<string, unknown>;
|
|
33
|
+
} | undefined>;
|
|
34
|
+
createPresentationTokenContent(credential: VerifiableCredential, nonce: string): Promise<TokenContentVerifiablePresentation>;
|
|
35
|
+
verifyPresentationTokenContent(tokenContent: TokenContentVerifiablePresentation, expectedNonce: string): Promise<{
|
|
36
|
+
isValid: boolean;
|
|
37
|
+
error?: Error;
|
|
38
|
+
}>;
|
|
39
|
+
exit(): Promise<void>;
|
|
40
|
+
restart(): Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=Holder.d.ts.map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AAE,CAAC;IAsB1G,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,qCAAqC,CAAC;IAK5F,0BAA0B,CACnC,4BAA4B,EAAE,qCAAqC,EACnE,UAAU,EAAE,oBAAoB,GACjC,OAAO,CACJ;QACI,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;KAC1D,GACD;QACI,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC1C,GACD,SAAS,CACd;IA2BY,8BAA8B,CAAC,UAAU,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,kCAAkC,CAAC;IAoB5H,8BAA8B,CAAC,YAAY,EAAE,kCAAkC,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,KAAK,CAAA;KAAE,CAAC;IAerJ,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAGxC"}
|
|
@@ -0,0 +1,163 @@
|
|
|
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 }) => {
|
|
14
|
+
return [certificateChain[0].toString("pem")];
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
class Holder extends BaseAgent_1.BaseAgent {
|
|
20
|
+
constructor(keyStorage, accountController, attributeController, fetchInstance) {
|
|
21
|
+
super(keyStorage, getOpenIdHolderModules(), accountController, attributeController, fetchInstance);
|
|
22
|
+
this.client = {
|
|
23
|
+
clientId: "wallet",
|
|
24
|
+
redirectUri: "http://localhost:3000/redirect"
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
async resolveCredentialOffer(credentialOffer) {
|
|
28
|
+
return await this.agent.openid4vc.holder.resolveCredentialOffer(credentialOffer);
|
|
29
|
+
}
|
|
30
|
+
async requestCredentials(resolvedCredentialOffer, credentialConfigurationIds, access) {
|
|
31
|
+
const tokenResponse = "accessToken" in access
|
|
32
|
+
? {
|
|
33
|
+
accessToken: access.accessToken,
|
|
34
|
+
accessTokenResponse: {
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
36
|
+
access_token: access.accessToken,
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
38
|
+
token_type: "bearer"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
: await this.agent.openid4vc.holder.requestToken({ resolvedCredentialOffer, txCode: access.pinCode });
|
|
42
|
+
const credentialResponse = await this.agent.openid4vc.holder.requestCredentials({
|
|
43
|
+
resolvedCredentialOffer,
|
|
44
|
+
credentialConfigurationIds: credentialConfigurationIds,
|
|
45
|
+
credentialBindingResolver: async ({ supportedDidMethods, supportsAllDidMethods, proofTypes }) => {
|
|
46
|
+
const key = await this.agent.kms.createKeyForSignatureAlgorithm({
|
|
47
|
+
algorithm: proofTypes.jwt?.supportedSignatureAlgorithms[0] ?? "EdDSA"
|
|
48
|
+
});
|
|
49
|
+
const publicJwk = core_1.Kms.PublicJwk.fromPublicJwk(key.publicJwk);
|
|
50
|
+
if (supportsAllDidMethods || supportedDidMethods?.includes("did:key")) {
|
|
51
|
+
await this.agent.dids.create({
|
|
52
|
+
method: "key",
|
|
53
|
+
options: {
|
|
54
|
+
keyId: key.keyId
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
const didKey = new core_1.DidKey(publicJwk);
|
|
58
|
+
return {
|
|
59
|
+
method: "did",
|
|
60
|
+
didUrls: [`${didKey.did}#${didKey.publicJwk.fingerprint}`]
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
if (supportedDidMethods?.includes("did:jwk")) {
|
|
64
|
+
const didJwk = core_1.DidJwk.fromPublicJwk(publicJwk);
|
|
65
|
+
await this.agent.dids.create({
|
|
66
|
+
method: "jwk",
|
|
67
|
+
options: {
|
|
68
|
+
keyId: key.keyId
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
return {
|
|
72
|
+
method: "did",
|
|
73
|
+
didUrls: [`${didJwk.did}#0`]
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
method: "jwk",
|
|
78
|
+
keys: [publicJwk]
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
...tokenResponse
|
|
82
|
+
});
|
|
83
|
+
this.agent.config.logger.info("Credential response:", credentialResponse);
|
|
84
|
+
return credentialResponse.credentials;
|
|
85
|
+
}
|
|
86
|
+
async storeCredentials(credentialResponses) {
|
|
87
|
+
const storedCredentials = await Promise.all(credentialResponses.map((credentialResponse) => {
|
|
88
|
+
if (![core_1.ClaimFormat.SdJwtDc].includes(credentialResponse.claimFormat)) {
|
|
89
|
+
throw new Error("Unsupported credential format");
|
|
90
|
+
}
|
|
91
|
+
const enmeshedStorageService = this.agent.dependencyManager.resolve(core_1.InjectionSymbols.StorageService);
|
|
92
|
+
return enmeshedStorageService.saveWithDisplay(this.agent.context, credentialResponse.encoded, credentialResponse.claimFormat, credentialResponse.displayInformation);
|
|
93
|
+
}));
|
|
94
|
+
this.agent.config.logger.info(`Stored credentials: ${JSON.stringify(storedCredentials)}`);
|
|
95
|
+
return storedCredentials;
|
|
96
|
+
}
|
|
97
|
+
async resolveAuthorizationRequest(request) {
|
|
98
|
+
const resolvedRequest = await this.agent.openid4vc.holder.resolveOpenId4VpAuthorizationRequest(request);
|
|
99
|
+
return resolvedRequest;
|
|
100
|
+
}
|
|
101
|
+
async acceptAuthorizationRequest(resolvedAuthorizationRequest, credential) {
|
|
102
|
+
if (!resolvedAuthorizationRequest.dcql) {
|
|
103
|
+
throw new Error("Missing dcql on resolved authorization request");
|
|
104
|
+
}
|
|
105
|
+
const credentialContent = credential.content.value;
|
|
106
|
+
const credentialRecord = (0, EnmeshedStorageService_1.decodeRecord)(credentialContent.type, credentialContent.value);
|
|
107
|
+
const queryId = resolvedAuthorizationRequest.dcql.queryResult.credentials[0].id;
|
|
108
|
+
const credentialForDcql = {
|
|
109
|
+
[queryId]: [
|
|
110
|
+
{
|
|
111
|
+
credentialRecord,
|
|
112
|
+
claimFormat: credentialContent.type,
|
|
113
|
+
disclosedPayload: {}
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
};
|
|
117
|
+
const submissionResult = await this.agent.openid4vc.holder.acceptOpenId4VpAuthorizationRequest({
|
|
118
|
+
authorizationRequestPayload: resolvedAuthorizationRequest.authorizationRequestPayload,
|
|
119
|
+
presentationExchange: undefined,
|
|
120
|
+
dcql: { credentials: credentialForDcql }
|
|
121
|
+
});
|
|
122
|
+
return submissionResult.serverResponse;
|
|
123
|
+
}
|
|
124
|
+
async createPresentationTokenContent(credential, nonce) {
|
|
125
|
+
if (credential.type !== core_1.ClaimFormat.SdJwtDc)
|
|
126
|
+
throw new Error("Only SD-JWT credentials are supported for token presentation");
|
|
127
|
+
const sdJwtVcApi = this.agent.dependencyManager.resolve(core_1.SdJwtVcApi);
|
|
128
|
+
const presentation = await sdJwtVcApi.present({
|
|
129
|
+
sdJwtVc: sdJwtVcApi.fromCompact(credential.value),
|
|
130
|
+
verifierMetadata: {
|
|
131
|
+
audience: "defaultPresentationAudience",
|
|
132
|
+
issuedAt: Date.now() / 1000,
|
|
133
|
+
nonce
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
return content_1.TokenContentVerifiablePresentation.from({
|
|
137
|
+
value: presentation,
|
|
138
|
+
type: credential.type,
|
|
139
|
+
displayInformation: credential.displayInformation
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
async verifyPresentationTokenContent(tokenContent, expectedNonce) {
|
|
143
|
+
if (tokenContent.type !== core_1.ClaimFormat.SdJwtDc)
|
|
144
|
+
throw new Error("Only SD-JWT credentials are supported for token presentation");
|
|
145
|
+
const sdJwtVcApi = this.agent.dependencyManager.resolve(core_1.SdJwtVcApi);
|
|
146
|
+
const verificationResult = await sdJwtVcApi.verify({
|
|
147
|
+
compactSdJwtVc: tokenContent.value,
|
|
148
|
+
keyBinding: {
|
|
149
|
+
audience: "defaultPresentationAudience",
|
|
150
|
+
nonce: expectedNonce
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
return { isValid: verificationResult.isValid, error: "error" in verificationResult ? verificationResult.error : undefined };
|
|
154
|
+
}
|
|
155
|
+
async exit() {
|
|
156
|
+
await this.shutdown();
|
|
157
|
+
}
|
|
158
|
+
async restart() {
|
|
159
|
+
await this.shutdown();
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
exports.Holder = Holder;
|
|
163
|
+
//# sourceMappingURL=Holder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Holder.js","sourceRoot":"","sources":["../../../../src/modules/openid4vc/local/Holder.ts"],"names":[],"mappings":";;;AAAA,yCAAkK;AAClK,mDAAwK;AACxK,4CAA0F;AAG1F,2CAAwC;AACxC,qEAAgF;AAIhF,SAAS,sBAAsB;IAC3B,OAAO;QACH,SAAS,EAAE,IAAI,2BAAe,EAAE;QAChC,IAAI,EAAE,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J;AAhMD,wBAgMC"}
|
|
@@ -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,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AC3C,OAAO,MAAM,CAAC,GAAG,CAAC;IACtB,CAAC;IAEM,KAAK,CAAC,SAAS,CAAC,KAAa;QAChC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAChD,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,KAAK,2BAA2B,CAAC,CAAC;YAClE,OAAO;QACX,CAAC;QAED,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9D,CAAC;CACJ;AAzCD,gCAyCC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ClaimFormat, W3cJsonCredential } from "@credo-ts/core";
|
|
2
|
+
export interface OpenId4VciCredentialResponseJSON {
|
|
3
|
+
claimFormat: 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 @@
|
|
|
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"}
|
package/dist/modules/requests/events/ShareCredentialOfferRequestItemProcessedByRecipientEvent.d.ts
ADDED
|
@@ -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"}
|
package/dist/modules/requests/events/ShareCredentialOfferRequestItemProcessedByRecipientEvent.js
ADDED
|
@@ -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
|
package/dist/modules/requests/events/ShareCredentialOfferRequestItemProcessedByRecipientEvent.js.map
ADDED
|
@@ -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";
|