@nmshd/consumption 7.0.0-alpha.9 → 7.0.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.
- package/dist/buildInformation.js +5 -5
- package/dist/consumption/ConsumptionBaseController.d.ts.map +1 -1
- package/dist/consumption/ConsumptionBaseController.js +6 -1
- package/dist/consumption/ConsumptionBaseController.js.map +1 -1
- package/dist/consumption/ConsumptionController.d.ts +3 -3
- package/dist/consumption/ConsumptionController.d.ts.map +1 -1
- package/dist/consumption/ConsumptionController.js +4 -7
- package/dist/consumption/ConsumptionController.js.map +1 -1
- package/dist/consumption/ConsumptionControllerName.d.ts +2 -2
- package/dist/consumption/ConsumptionControllerName.d.ts.map +1 -1
- package/dist/consumption/ConsumptionControllerName.js +1 -1
- package/dist/consumption/ConsumptionControllerName.js.map +1 -1
- package/dist/consumption/ConsumptionCoreErrors.d.ts +3 -0
- package/dist/consumption/ConsumptionCoreErrors.d.ts.map +1 -1
- package/dist/consumption/ConsumptionCoreErrors.js +9 -0
- package/dist/consumption/ConsumptionCoreErrors.js.map +1 -1
- package/dist/consumption/ConsumptionIds.d.ts +0 -1
- package/dist/consumption/ConsumptionIds.d.ts.map +1 -1
- package/dist/consumption/ConsumptionIds.js +0 -1
- package/dist/consumption/ConsumptionIds.js.map +1 -1
- package/dist/modules/attributes/AttributesController.d.ts +8 -2
- package/dist/modules/attributes/AttributesController.d.ts.map +1 -1
- package/dist/modules/attributes/AttributesController.js +93 -11
- package/dist/modules/attributes/AttributesController.js.map +1 -1
- package/dist/modules/attributes/events/AttributeWasViewedAtChangedEvent.d.ts +7 -0
- package/dist/modules/attributes/events/AttributeWasViewedAtChangedEvent.d.ts.map +1 -0
- package/dist/modules/attributes/events/AttributeWasViewedAtChangedEvent.js +12 -0
- package/dist/modules/attributes/events/AttributeWasViewedAtChangedEvent.js.map +1 -0
- package/dist/modules/attributes/events/index.d.ts +1 -0
- package/dist/modules/attributes/events/index.d.ts.map +1 -1
- package/dist/modules/attributes/events/index.js +1 -0
- package/dist/modules/attributes/events/index.js.map +1 -1
- package/dist/modules/attributes/local/LocalAttribute.d.ts +3 -0
- package/dist/modules/attributes/local/LocalAttribute.d.ts.map +1 -1
- package/dist/modules/attributes/local/LocalAttribute.js +7 -1
- package/dist/modules/attributes/local/LocalAttribute.js.map +1 -1
- package/dist/modules/index.d.ts +1 -1
- package/dist/modules/index.d.ts.map +1 -1
- package/dist/modules/index.js +1 -1
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/notifications/NotificationsController.js +6 -6
- package/dist/modules/notifications/NotificationsController.js.map +1 -1
- package/dist/modules/openid4vc/OpenId4VcController.d.ts +7 -0
- package/dist/modules/openid4vc/OpenId4VcController.d.ts.map +1 -0
- package/dist/modules/openid4vc/OpenId4VcController.js +48 -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/{attributeListeners/events → openid4vc}/index.js +7 -1
- package/dist/modules/openid4vc/index.js.map +1 -0
- package/dist/modules/openid4vc/local/BaseAgent.d.ts +20 -0
- package/dist/modules/openid4vc/local/BaseAgent.d.ts.map +1 -0
- package/dist/modules/openid4vc/local/BaseAgent.js +73 -0
- package/dist/modules/openid4vc/local/BaseAgent.js.map +1 -0
- package/dist/modules/openid4vc/local/FakeFileSystem.d.ts +17 -0
- package/dist/modules/openid4vc/local/FakeFileSystem.d.ts.map +1 -0
- package/dist/modules/openid4vc/local/FakeFileSystem.js +67 -0
- package/dist/modules/openid4vc/local/FakeFileSystem.js.map +1 -0
- package/dist/modules/openid4vc/local/FakeKeyManagmentService.d.ts +23 -0
- package/dist/modules/openid4vc/local/FakeKeyManagmentService.d.ts.map +1 -0
- package/dist/modules/openid4vc/local/FakeKeyManagmentService.js +127 -0
- package/dist/modules/openid4vc/local/FakeKeyManagmentService.js.map +1 -0
- package/dist/modules/openid4vc/local/FakeStorageService.d.ts +12 -0
- package/dist/modules/openid4vc/local/FakeStorageService.d.ts.map +1 -0
- package/dist/modules/openid4vc/local/FakeStorageService.js +72 -0
- package/dist/modules/openid4vc/local/FakeStorageService.js.map +1 -0
- package/dist/modules/openid4vc/local/Holder.d.ts +32 -0
- package/dist/modules/openid4vc/local/Holder.d.ts.map +1 -0
- package/dist/modules/openid4vc/local/Holder.js +173 -0
- package/dist/modules/openid4vc/local/Holder.js.map +1 -0
- package/dist/modules/openid4vc/local/LocalAgentDependencies.d.ts +3 -0
- package/dist/modules/openid4vc/local/LocalAgentDependencies.d.ts.map +1 -0
- package/dist/modules/openid4vc/local/LocalAgentDependencies.js +20 -0
- package/dist/modules/openid4vc/local/LocalAgentDependencies.js.map +1 -0
- package/dist/modules/requests/incoming/IncomingRequestsController.d.ts +1 -0
- package/dist/modules/requests/incoming/IncomingRequestsController.d.ts.map +1 -1
- package/dist/modules/requests/incoming/IncomingRequestsController.js +21 -8
- package/dist/modules/requests/incoming/IncomingRequestsController.js.map +1 -1
- package/dist/modules/requests/incoming/decide/DecideRequestParameters.d.ts +1 -0
- package/dist/modules/requests/incoming/decide/DecideRequestParameters.d.ts.map +1 -1
- package/dist/modules/requests/incoming/decide/InternalDecideRequestParameters.d.ts +2 -0
- package/dist/modules/requests/incoming/decide/InternalDecideRequestParameters.d.ts.map +1 -1
- package/dist/modules/requests/incoming/decide/InternalDecideRequestParameters.js +5 -0
- package/dist/modules/requests/incoming/decide/InternalDecideRequestParameters.js.map +1 -1
- package/dist/modules/requests/index.d.ts +0 -3
- package/dist/modules/requests/index.d.ts.map +1 -1
- package/dist/modules/requests/index.js +0 -3
- package/dist/modules/requests/index.js.map +1 -1
- package/dist/modules/requests/itemProcessors/createAttribute/CreateAttributeRequestItemProcessor.d.ts.map +1 -1
- package/dist/modules/requests/itemProcessors/createAttribute/CreateAttributeRequestItemProcessor.js +8 -2
- package/dist/modules/requests/itemProcessors/createAttribute/CreateAttributeRequestItemProcessor.js.map +1 -1
- package/dist/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.d.ts.map +1 -1
- package/dist/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.js +10 -4
- package/dist/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.js.map +1 -1
- package/dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.d.ts.map +1 -1
- package/dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.js +7 -4
- package/dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.js.map +1 -1
- package/dist/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.js +6 -6
- package/dist/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.js.map +1 -1
- package/dist/modules/requests/itemProcessors/transferFileOwnership/TransferFileOwnershipRequestItemProcessor.d.ts.map +1 -1
- package/dist/modules/requests/itemProcessors/transferFileOwnership/TransferFileOwnershipRequestItemProcessor.js +33 -22
- package/dist/modules/requests/itemProcessors/transferFileOwnership/TransferFileOwnershipRequestItemProcessor.js.map +1 -1
- package/dist/modules/requests/itemProcessors/utility/validateAttributeMatchesWithQuery.js +1 -1
- package/dist/modules/requests/itemProcessors/utility/validateAttributeMatchesWithQuery.js.map +1 -1
- package/dist/modules/requests/local/LocalRequest.d.ts +2 -0
- package/dist/modules/requests/local/LocalRequest.d.ts.map +1 -1
- package/dist/modules/requests/local/LocalRequest.js +7 -1
- package/dist/modules/requests/local/LocalRequest.js.map +1 -1
- package/dist/modules/requests/outgoing/OutgoingRequestsController.d.ts.map +1 -1
- package/dist/modules/requests/outgoing/OutgoingRequestsController.js +12 -9
- package/dist/modules/requests/outgoing/OutgoingRequestsController.js.map +1 -1
- package/package.json +17 -12
- package/dist/modules/attributeListeners/AttributeListenersController.d.ts +0 -20
- package/dist/modules/attributeListeners/AttributeListenersController.d.ts.map +0 -1
- package/dist/modules/attributeListeners/AttributeListenersController.js +0 -51
- package/dist/modules/attributeListeners/AttributeListenersController.js.map +0 -1
- package/dist/modules/attributeListeners/events/AttributeListenerCreatedEvent.d.ts +0 -7
- package/dist/modules/attributeListeners/events/AttributeListenerCreatedEvent.d.ts.map +0 -1
- package/dist/modules/attributeListeners/events/AttributeListenerCreatedEvent.js +0 -12
- package/dist/modules/attributeListeners/events/AttributeListenerCreatedEvent.js.map +0 -1
- package/dist/modules/attributeListeners/events/index.d.ts +0 -2
- package/dist/modules/attributeListeners/events/index.d.ts.map +0 -1
- package/dist/modules/attributeListeners/events/index.js.map +0 -1
- package/dist/modules/attributeListeners/index.d.ts +0 -5
- package/dist/modules/attributeListeners/index.d.ts.map +0 -1
- package/dist/modules/attributeListeners/index.js +0 -21
- package/dist/modules/attributeListeners/index.js.map +0 -1
- package/dist/modules/attributeListeners/local/CreateLocalAttributeListenerParams.d.ts +0 -13
- package/dist/modules/attributeListeners/local/CreateLocalAttributeListenerParams.d.ts.map +0 -1
- package/dist/modules/attributeListeners/local/CreateLocalAttributeListenerParams.js +0 -35
- package/dist/modules/attributeListeners/local/CreateLocalAttributeListenerParams.js.map +0 -1
- package/dist/modules/attributeListeners/local/LocalAttributeListener.d.ts +0 -21
- package/dist/modules/attributeListeners/local/LocalAttributeListener.d.ts.map +0 -1
- package/dist/modules/attributeListeners/local/LocalAttributeListener.js +0 -44
- package/dist/modules/attributeListeners/local/LocalAttributeListener.js.map +0 -1
- package/dist/modules/requests/itemProcessors/freeText/AcceptFreeTextRequestItemParameters.d.ts +0 -10
- package/dist/modules/requests/itemProcessors/freeText/AcceptFreeTextRequestItemParameters.d.ts.map +0 -1
- package/dist/modules/requests/itemProcessors/freeText/AcceptFreeTextRequestItemParameters.js +0 -28
- package/dist/modules/requests/itemProcessors/freeText/AcceptFreeTextRequestItemParameters.js.map +0 -1
- package/dist/modules/requests/itemProcessors/freeText/FreeTextRequestItemProcessor.d.ts +0 -9
- package/dist/modules/requests/itemProcessors/freeText/FreeTextRequestItemProcessor.d.ts.map +0 -1
- package/dist/modules/requests/itemProcessors/freeText/FreeTextRequestItemProcessor.js +0 -31
- package/dist/modules/requests/itemProcessors/freeText/FreeTextRequestItemProcessor.js.map +0 -1
- package/dist/modules/requests/itemProcessors/registerAttributeListener/RegisterAttributeListenerRequestItemProcessor.d.ts +0 -8
- package/dist/modules/requests/itemProcessors/registerAttributeListener/RegisterAttributeListenerRequestItemProcessor.d.ts.map +0 -1
- package/dist/modules/requests/itemProcessors/registerAttributeListener/RegisterAttributeListenerRequestItemProcessor.js +0 -19
- package/dist/modules/requests/itemProcessors/registerAttributeListener/RegisterAttributeListenerRequestItemProcessor.js.map +0 -1
|
@@ -14,5 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./local/BaseAgent"), exports);
|
|
18
|
+
__exportStar(require("./local/FakeFileSystem"), exports);
|
|
19
|
+
__exportStar(require("./local/FakeKeyManagmentService"), exports);
|
|
20
|
+
__exportStar(require("./local/FakeStorageService"), exports);
|
|
21
|
+
__exportStar(require("./local/Holder"), exports);
|
|
22
|
+
__exportStar(require("./local/LocalAgentDependencies"), exports);
|
|
23
|
+
__exportStar(require("./OpenId4VcController"), exports);
|
|
18
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/openid4vc/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,yDAAuC;AACvC,kEAAgD;AAChD,6DAA2C;AAC3C,iDAA+B;AAC/B,iEAA+C;AAC/C,wDAAsC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Agent, DidKey, type InitConfig, type ModulesMap, type VerificationMethod } from "@credo-ts/core";
|
|
2
|
+
export declare class BaseAgent<AgentModules extends ModulesMap> {
|
|
3
|
+
port: number;
|
|
4
|
+
name: string;
|
|
5
|
+
config: InitConfig;
|
|
6
|
+
agent: Agent<AgentModules>;
|
|
7
|
+
did: string;
|
|
8
|
+
didKey: DidKey;
|
|
9
|
+
kid: string;
|
|
10
|
+
verificationMethod: VerificationMethod;
|
|
11
|
+
private readonly keyStorage;
|
|
12
|
+
constructor({ port, name, modules }: {
|
|
13
|
+
port: number;
|
|
14
|
+
name: string;
|
|
15
|
+
modules: AgentModules;
|
|
16
|
+
});
|
|
17
|
+
initializeAgent(privateKey: string): Promise<any>;
|
|
18
|
+
shutdown(): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=BaseAgent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseAgent.d.ts","sourceRoot":"","sources":["../../../../src/modules/openid4vc/local/BaseAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,EAGL,MAAM,EAIN,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,kBAAkB,EAC1B,MAAM,gBAAgB,CAAC;AAOxB,qBAAa,SAAS,CAAC,YAAY,SAAS,UAAU;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IAC3B,GAAG,EAAG,MAAM,CAAC;IACb,MAAM,EAAG,MAAM,CAAC;IAChB,GAAG,EAAG,MAAM,CAAC;IACb,kBAAkB,EAAG,kBAAkB,CAAC;IAC/C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA0D;gBAElE,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,YAAY,CAAA;KAAE;IA6BpF,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAuCjD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAGzC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseAgent = void 0;
|
|
4
|
+
const core_1 = require("@credo-ts/core");
|
|
5
|
+
const kms_1 = require("@credo-ts/core/build/modules/kms");
|
|
6
|
+
const FakeKeyManagmentService_1 = require("./FakeKeyManagmentService");
|
|
7
|
+
const FakeStorageService_1 = require("./FakeStorageService");
|
|
8
|
+
const LocalAgentDependencies_1 = require("./LocalAgentDependencies");
|
|
9
|
+
class BaseAgent {
|
|
10
|
+
constructor({ port, name, modules }) {
|
|
11
|
+
this.keyStorage = new Map();
|
|
12
|
+
this.name = name;
|
|
13
|
+
this.port = port;
|
|
14
|
+
const config = {
|
|
15
|
+
label: name,
|
|
16
|
+
allowInsecureHttpUrls: true,
|
|
17
|
+
logger: new core_1.ConsoleLogger(core_1.LogLevel.off)
|
|
18
|
+
};
|
|
19
|
+
this.config = config;
|
|
20
|
+
const dependencyManager = new core_1.DependencyManager();
|
|
21
|
+
dependencyManager.registerInstance(core_1.InjectionSymbols.StorageService, new FakeStorageService_1.FakeStorageService());
|
|
22
|
+
// dependencyManager.registerInstance(InjectionSymbols.StorageUpdateService, new FakeStorageService());
|
|
23
|
+
if (!dependencyManager.isRegistered(core_1.InjectionSymbols.StorageService)) {
|
|
24
|
+
// eslint-disable-next-line no-console
|
|
25
|
+
console.log("StorageService not registered!!!");
|
|
26
|
+
}
|
|
27
|
+
this.agent = new core_1.Agent({
|
|
28
|
+
config,
|
|
29
|
+
dependencies: LocalAgentDependencies_1.agentDependencies,
|
|
30
|
+
modules
|
|
31
|
+
}, dependencyManager);
|
|
32
|
+
}
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
34
|
+
async initializeAgent(privateKey) {
|
|
35
|
+
// as we are not using askar we need to set the storage version
|
|
36
|
+
const storrage = this.agent.dependencyManager.resolve(core_1.InjectionSymbols.StorageService);
|
|
37
|
+
const versionRecord = { id: "STORAGE_VERSION_RECORD_ID", storageVersion: "0.5.0", value: "0.5.0" };
|
|
38
|
+
await storrage.save(this.agent.context, versionRecord);
|
|
39
|
+
// as we are not using askar we need to setup our own key management service
|
|
40
|
+
const kmsConfig = this.agent.dependencyManager.resolve(kms_1.KeyManagementModuleConfig);
|
|
41
|
+
// TODO: think about adding the local key storrage to the FakeKMS constructor
|
|
42
|
+
kmsConfig.registerBackend(new FakeKeyManagmentService_1.FakeKeyManagmentService());
|
|
43
|
+
if (kmsConfig.backends.length === 0)
|
|
44
|
+
throw new Error("No KMS backend registered");
|
|
45
|
+
await this.agent.initialize();
|
|
46
|
+
// create a uuid based key id
|
|
47
|
+
const keyId = crypto.randomUUID();
|
|
48
|
+
const didCreateResult = await this.agent.dids.create({
|
|
49
|
+
method: "key",
|
|
50
|
+
options: {
|
|
51
|
+
createKey: {
|
|
52
|
+
type: {
|
|
53
|
+
crv: "Ed25519",
|
|
54
|
+
kty: "OKP"
|
|
55
|
+
},
|
|
56
|
+
keyId: keyId
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
this.did = didCreateResult.didState.did;
|
|
61
|
+
this.didKey = core_1.DidKey.fromDid(this.did);
|
|
62
|
+
this.kid = `${this.did}#${this.didKey.publicJwk.fingerprint}`;
|
|
63
|
+
const verificationMethod = didCreateResult.didState.didDocument?.dereferenceKey(this.kid, ["authentication"]);
|
|
64
|
+
if (!verificationMethod)
|
|
65
|
+
throw new Error("No verification method found");
|
|
66
|
+
this.verificationMethod = verificationMethod;
|
|
67
|
+
}
|
|
68
|
+
async shutdown() {
|
|
69
|
+
await this.agent.shutdown();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.BaseAgent = BaseAgent;
|
|
73
|
+
//# sourceMappingURL=BaseAgent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseAgent.js","sourceRoot":"","sources":["../../../../src/modules/openid4vc/local/BaseAgent.ts"],"names":[],"mappings":";;;AAAA,yCAWwB;AACxB,0DAA6E;AAE7E,uEAAoE;AACpE,6DAA0D;AAC1D,qEAA6D;AAE7D,MAAa,SAAS;IAWlB,YAAmB,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAyD;QAFhF,eAAU,GAA4B,IAAI,GAAG,EAAsB,CAAC;QAGjF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QAEjB,MAAM,MAAM,GAAG;YACX,KAAK,EAAE,IAAI;YACX,qBAAqB,EAAE,IAAI;YAC3B,MAAM,EAAE,IAAI,oBAAa,CAAC,eAAQ,CAAC,GAAG,CAAC;SACrB,CAAC;QAEvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,MAAM,iBAAiB,GAAG,IAAI,wBAAiB,EAAE,CAAC;QAClD,iBAAiB,CAAC,gBAAgB,CAAC,uBAAgB,CAAC,cAAc,EAAE,IAAI,uCAAkB,EAAE,CAAC,CAAC;QAC9F,uGAAuG;QACvG,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,uBAAgB,CAAC,cAAc,CAAC,EAAE,CAAC;YACnE,sCAAsC;YACtC,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;QACpD,CAAC;QACD,IAAI,CAAC,KAAK,GAAG,IAAI,YAAK,CAClB;YACI,MAAM;YACN,YAAY,EAAE,0CAAiB;YAC/B,OAAO;SACV,EACD,iBAAiB,CACpB,CAAC;IACN,CAAC;IAED,6DAA6D;IACtD,KAAK,CAAC,eAAe,CAAC,UAAkB;QAC3C,+DAA+D;QAC/D,MAAM,QAAQ,GAAG,IAAI,CAAC,K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MAAM,kBAAkB,GAAG,eAAe,CAAC,QAAQ,CAAC,WAAW,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;QAC9G,IAAI,CAAC,kBAAkB;YAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QACzE,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IACjD,CAAC;IAEM,KAAK,CAAC,QAAQ;QACjB,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAChC,CAAC;CACJ;AAlFD,8BAkFC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DownloadToFileOptions, FileSystem } from "@credo-ts/core";
|
|
2
|
+
export declare class FakeFileSystem implements FileSystem {
|
|
3
|
+
readonly dataPath: string;
|
|
4
|
+
readonly cachePath: string;
|
|
5
|
+
readonly tempPath: string;
|
|
6
|
+
private readonly fileSystem;
|
|
7
|
+
private readonly directories;
|
|
8
|
+
constructor();
|
|
9
|
+
exists(path: string): Promise<boolean>;
|
|
10
|
+
createDirectory(path: string): Promise<void>;
|
|
11
|
+
copyFile(sourcePath: string, destinationPath: string): Promise<void>;
|
|
12
|
+
write(path: string, data: string): Promise<void>;
|
|
13
|
+
read(path: string): Promise<string>;
|
|
14
|
+
delete(path: string): Promise<void>;
|
|
15
|
+
downloadToFile(url: string, path: string, options?: DownloadToFileOptions): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=FakeFileSystem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FakeFileSystem.d.ts","sourceRoot":"","sources":["../../../../src/modules/openid4vc/local/FakeFileSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEnE,qBAAa,cAAe,YAAW,UAAU;IAC7C,SAAgB,QAAQ,EAAE,MAAM,CAAC;IAEjC,SAAgB,SAAS,EAAE,MAAM,CAAC;IAElC,SAAgB,QAAQ,EAAE,MAAM,CAAC;IAEjC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkC;IAE7D,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAmC;;IAaxD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAQtC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM5C,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUpE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUhD,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAQnC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQnC,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;CAgBnG"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FakeFileSystem = void 0;
|
|
4
|
+
class FakeFileSystem {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.fileSystem = new Map();
|
|
7
|
+
this.directories = new Map();
|
|
8
|
+
this.dataPath = "/data";
|
|
9
|
+
this.cachePath = "/cache";
|
|
10
|
+
this.tempPath = "/temp";
|
|
11
|
+
// initialize the directories map with the known paths
|
|
12
|
+
this.directories.set(this.dataPath, true);
|
|
13
|
+
this.directories.set(this.cachePath, true);
|
|
14
|
+
this.directories.set(this.tempPath, true);
|
|
15
|
+
}
|
|
16
|
+
exists(path) {
|
|
17
|
+
if (this.directories.has(path) || this.fileSystem.has(path)) {
|
|
18
|
+
return Promise.resolve(true);
|
|
19
|
+
}
|
|
20
|
+
return Promise.resolve(false);
|
|
21
|
+
}
|
|
22
|
+
createDirectory(path) {
|
|
23
|
+
this.directories.set(path, true);
|
|
24
|
+
return Promise.resolve();
|
|
25
|
+
}
|
|
26
|
+
copyFile(sourcePath, destinationPath) {
|
|
27
|
+
if (this.fileSystem.has(sourcePath)) {
|
|
28
|
+
this.fileSystem.set(destinationPath, this.fileSystem.get(sourcePath));
|
|
29
|
+
return Promise.resolve();
|
|
30
|
+
}
|
|
31
|
+
return Promise.reject(new Error(`Source file ${sourcePath} does not exist`));
|
|
32
|
+
}
|
|
33
|
+
write(path, data) {
|
|
34
|
+
this.fileSystem.set(path, data);
|
|
35
|
+
if (!this.directories.has(path)) {
|
|
36
|
+
this.directories.set(path, false); // mark as file
|
|
37
|
+
}
|
|
38
|
+
return Promise.resolve();
|
|
39
|
+
}
|
|
40
|
+
read(path) {
|
|
41
|
+
if (!this.fileSystem.has(path)) {
|
|
42
|
+
return Promise.reject(new Error(`File ${path} does not exist`));
|
|
43
|
+
}
|
|
44
|
+
return Promise.resolve(this.fileSystem.get(path) ?? "");
|
|
45
|
+
}
|
|
46
|
+
delete(path) {
|
|
47
|
+
if (this.fileSystem.has(path)) {
|
|
48
|
+
this.fileSystem.delete(path);
|
|
49
|
+
}
|
|
50
|
+
return Promise.resolve();
|
|
51
|
+
}
|
|
52
|
+
downloadToFile(url, path, options) {
|
|
53
|
+
// Simulate a download by writing a placeholder content
|
|
54
|
+
let content = `Downloaded content from ${url}`;
|
|
55
|
+
if (options) {
|
|
56
|
+
if (options.verifyHash) {
|
|
57
|
+
// Here you would implement hash verification logic if needed
|
|
58
|
+
// eslint-disable-next-line prefer-template
|
|
59
|
+
content = content + ` with hash verification: ${options.verifyHash}`;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
this.fileSystem.set(path, content);
|
|
63
|
+
return Promise.resolve();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.FakeFileSystem = FakeFileSystem;
|
|
67
|
+
//# sourceMappingURL=FakeFileSystem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FakeFileSystem.js","sourceRoot":"","sources":["../../../../src/modules/openid4vc/local/FakeFileSystem.ts"],"names":[],"mappings":";;;AAEA,MAAa,cAAc;IAWvB;QAJiB,eAAU,GAAwB,IAAI,GAAG,EAAE,CAAC;QAE5C,gBAAW,GAAyB,IAAI,GAAG,EAAE,CAAC;QAG3D,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QAExB,sDAAsD;QACtD,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC1C,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC;IAEM,MAAM,CAAC,IAAY;QACtB,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1D,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;QAED,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAEM,eAAe,CAAC,IAAY;QAC/B,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAEjC,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;IAEM,QAAQ,CAAC,UAAkB,EAAE,eAAuB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B,CAAC;IAEM,cAAc,CAAC,GAAW,EAAE,IAAY,EAAE,OAA+B;QAC5E,uDAAuD;QACvD,IAAI,OAAO,GAAG,2BAA2B,GAAG,EAAE,CAAC;QAE/C,IAAI,OAAO,EAAE,CAAC;YACV,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;gBACrB,6DAA6D;gBAC7D,2CAA2C;gBAC3C,OAAO,GAAG,OAAO,GAAG,4BAA4B,OAAO,CAAC,UAAU,EAAE,CAAC;YACzE,CAAC;QACL,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAEnC,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;CACJ;AAxFD,wCAwFC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AgentContext } from "@credo-ts/core";
|
|
2
|
+
import { KeyManagementService, KmsCreateKeyOptions, KmsCreateKeyReturn, KmsCreateKeyType, KmsDecryptOptions, KmsDecryptReturn, KmsDeleteKeyOptions, KmsEncryptOptions, KmsEncryptReturn, KmsImportKeyOptions, KmsImportKeyReturn, KmsJwkPrivate, KmsJwkPublic, KmsOperation, KmsRandomBytesOptions, KmsRandomBytesReturn, KmsSignOptions, KmsSignReturn, KmsVerifyOptions, KmsVerifyReturn } from "@credo-ts/core/build/modules/kms";
|
|
3
|
+
export interface JwkKeyPair {
|
|
4
|
+
publicKey: JsonWebKey;
|
|
5
|
+
privateKey: JsonWebKey;
|
|
6
|
+
}
|
|
7
|
+
export declare class FakeKeyManagmentService implements KeyManagementService {
|
|
8
|
+
static readonly backend = "fakeKeyManagementService";
|
|
9
|
+
readonly backend = "fakeKeyManagementService";
|
|
10
|
+
keystore: Map<string, string>;
|
|
11
|
+
constructor();
|
|
12
|
+
isOperationSupported(agentContext: AgentContext, operation: KmsOperation): boolean;
|
|
13
|
+
getPublicKey(agentContext: AgentContext, keyId: string): Promise<KmsJwkPublic>;
|
|
14
|
+
createKey<Type extends KmsCreateKeyType>(agentContext: AgentContext, options: KmsCreateKeyOptions<Type>): Promise<KmsCreateKeyReturn<Type>>;
|
|
15
|
+
importKey<Jwk extends KmsJwkPrivate>(agentContext: AgentContext, options: KmsImportKeyOptions<Jwk>): Promise<KmsImportKeyReturn<Jwk>>;
|
|
16
|
+
deleteKey(agentContext: AgentContext, options: KmsDeleteKeyOptions): Promise<boolean>;
|
|
17
|
+
sign(agentContext: AgentContext, options: KmsSignOptions): Promise<KmsSignReturn>;
|
|
18
|
+
verify(agentContext: AgentContext, options: KmsVerifyOptions): Promise<KmsVerifyReturn>;
|
|
19
|
+
encrypt(agentContext: AgentContext, options: KmsEncryptOptions): Promise<KmsEncryptReturn>;
|
|
20
|
+
decrypt(agentContext: AgentContext, options: KmsDecryptOptions): Promise<KmsDecryptReturn>;
|
|
21
|
+
randomBytes(agentContext: AgentContext, options: KmsRandomBytesOptions): KmsRandomBytesReturn;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=FakeKeyManagmentService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FakeKeyManagmentService.d.ts","sourceRoot":"","sources":["../../../../src/modules/openid4vc/local/FakeKeyManagmentService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EACH,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACrB,oBAAoB,EACpB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,EAClB,MAAM,kCAAkC,CAAC;AAE1C,MAAM,WAAW,UAAU;IACvB,SAAS,EAAE,UAAU,CAAC;IACtB,UAAU,EAAE,UAAU,CAAC;CAC1B;AAED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
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FakeKeyManagmentService = void 0;
|
|
4
|
+
class FakeKeyManagmentService {
|
|
5
|
+
static { this.backend = "fakeKeyManagementService"; }
|
|
6
|
+
constructor() {
|
|
7
|
+
this.backend = FakeKeyManagmentService.backend;
|
|
8
|
+
if (global.fakeKmsKeystore) {
|
|
9
|
+
this.keystore = global.fakeKmsKeystore;
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
this.keystore = new Map();
|
|
13
|
+
global.fakeKmsKeystore = this.keystore;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
isOperationSupported(agentContext, operation) {
|
|
17
|
+
if (operation.operation === "createKey") {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
if (operation.operation === "verify") {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
if (operation.operation === "sign" && operation.algorithm === "ES256") {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
getPublicKey(agentContext, keyId) {
|
|
29
|
+
const keyPair = this.keystore.get(keyId);
|
|
30
|
+
if (!keyPair) {
|
|
31
|
+
throw new Error(`Key with id ${keyId} not found`);
|
|
32
|
+
}
|
|
33
|
+
return Promise.resolve(JSON.parse(keyPair).publicKey);
|
|
34
|
+
}
|
|
35
|
+
async createKey(agentContext, options) {
|
|
36
|
+
// check if a key-id is provided
|
|
37
|
+
options.keyId ??= crypto.randomUUID();
|
|
38
|
+
// we want to create a key pair using the web-crypto api and store the private key in our keystore
|
|
39
|
+
const keyPair = await crypto.subtle.generateKey({
|
|
40
|
+
name: "ECDSA",
|
|
41
|
+
namedCurve: "P-256" // ES256
|
|
42
|
+
}, true, ["sign", "verify"]);
|
|
43
|
+
// and return the public key as jwk
|
|
44
|
+
const publicKeyJwk = await crypto.subtle.exportKey("jwk", keyPair.publicKey);
|
|
45
|
+
const privateKeyJwk = await crypto.subtle.exportKey("jwk", keyPair.privateKey);
|
|
46
|
+
const jwkKeyPair = {
|
|
47
|
+
publicKey: publicKeyJwk,
|
|
48
|
+
privateKey: privateKeyJwk
|
|
49
|
+
};
|
|
50
|
+
// store the key pair in the keystore
|
|
51
|
+
this.keystore.set(options.keyId, JSON.stringify(jwkKeyPair));
|
|
52
|
+
return await Promise.resolve({
|
|
53
|
+
keyId: options.keyId,
|
|
54
|
+
publicJwk: publicKeyJwk
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
importKey(agentContext, options) {
|
|
58
|
+
throw new Error("Method not implemented.");
|
|
59
|
+
}
|
|
60
|
+
deleteKey(agentContext, options) {
|
|
61
|
+
throw new Error("Method not implemented.");
|
|
62
|
+
}
|
|
63
|
+
async sign(agentContext, options) {
|
|
64
|
+
// load key from keystore
|
|
65
|
+
const stringifiedKeyPair = this.keystore.get(options.keyId);
|
|
66
|
+
if (!stringifiedKeyPair) {
|
|
67
|
+
throw new Error(`Key with id ${options.keyId} not found`);
|
|
68
|
+
}
|
|
69
|
+
const privateKeyJwk = JSON.parse(stringifiedKeyPair).privateKey;
|
|
70
|
+
const privateKey = await crypto.subtle.importKey("jwk", // format
|
|
71
|
+
privateKeyJwk, // the exported JWK object
|
|
72
|
+
{ name: "ECDSA", namedCurve: "P-256" }, // algorithm
|
|
73
|
+
true, // extractable
|
|
74
|
+
["sign"] // key usages
|
|
75
|
+
);
|
|
76
|
+
// load data from options
|
|
77
|
+
const data = options.data;
|
|
78
|
+
// check if method is ES256
|
|
79
|
+
if (options.algorithm !== "ES256") {
|
|
80
|
+
throw new Error(`Algorithm ${options.algorithm} not supported`);
|
|
81
|
+
}
|
|
82
|
+
// transform the private key to a jwk
|
|
83
|
+
const signatureBuffer = await crypto.subtle.sign({ name: "ECDSA", hash: { name: "SHA-256" } }, privateKey, data);
|
|
84
|
+
return {
|
|
85
|
+
signature: new Uint8Array(signatureBuffer)
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
async verify(agentContext, options) {
|
|
89
|
+
// load key from keystore
|
|
90
|
+
let publicKeyJwk;
|
|
91
|
+
if (!options.key.publicJwk) {
|
|
92
|
+
if (!options.key.keyId) {
|
|
93
|
+
throw new Error("Either publicJwk or keyId must be provided");
|
|
94
|
+
}
|
|
95
|
+
const stringifiedKeyPair = this.keystore.get(options.key.keyId);
|
|
96
|
+
if (!stringifiedKeyPair) {
|
|
97
|
+
throw new Error(`Key with id ${options.key.keyId} not found`);
|
|
98
|
+
}
|
|
99
|
+
publicKeyJwk = JSON.parse(stringifiedKeyPair).publicKey;
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
publicKeyJwk = options.key.publicJwk;
|
|
103
|
+
}
|
|
104
|
+
// check algorithm
|
|
105
|
+
if (options.algorithm !== "ES256") {
|
|
106
|
+
throw new Error(`Algorithm ${options.algorithm} not supported`);
|
|
107
|
+
}
|
|
108
|
+
// import the public key
|
|
109
|
+
const publicKey = await crypto.subtle.importKey("jwk", publicKeyJwk, { name: "ECDSA", namedCurve: "P-256" }, true, ["verify"]);
|
|
110
|
+
// verify signature against data
|
|
111
|
+
const isValid = await crypto.subtle.verify({ name: "ECDSA", hash: { name: "SHA-256" } }, publicKey, options.signature, options.data);
|
|
112
|
+
return {
|
|
113
|
+
verified: isValid
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
encrypt(agentContext, options) {
|
|
117
|
+
throw new Error("Method not implemented.");
|
|
118
|
+
}
|
|
119
|
+
decrypt(agentContext, options) {
|
|
120
|
+
throw new Error("Method not implemented.");
|
|
121
|
+
}
|
|
122
|
+
randomBytes(agentContext, options) {
|
|
123
|
+
throw new Error("Method not implemented.");
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
exports.FakeKeyManagmentService = FakeKeyManagmentService;
|
|
127
|
+
//# sourceMappingURL=FakeKeyManagmentService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FakeKeyManagmentService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C,CAAC;IACM,WAAW,CAAC,YAA0B,EAAE,OAA8B;QACzE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;;AA5IL,0DA6IC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AgentContext, BaseRecord, BaseRecordConstructor, Query, QueryOptions, StorageService } from "@credo-ts/core";
|
|
2
|
+
export declare class FakeStorageService<T extends BaseRecord> implements StorageService<T> {
|
|
3
|
+
storrage: Map<string, string>;
|
|
4
|
+
save(agentContext: AgentContext, record: T): Promise<void>;
|
|
5
|
+
update(agentContext: AgentContext, record: T): Promise<void>;
|
|
6
|
+
delete(agentContext: AgentContext, record: T): Promise<void>;
|
|
7
|
+
deleteById(agentContext: AgentContext, recordClass: BaseRecordConstructor<T>, id: string): Promise<void>;
|
|
8
|
+
getById(agentContext: AgentContext, recordClass: BaseRecordConstructor<T>, id: string): Promise<T>;
|
|
9
|
+
getAll(agentContext: AgentContext, recordClass: BaseRecordConstructor<T>): Promise<T[]>;
|
|
10
|
+
findByQuery(agentContext: AgentContext, recordClass: BaseRecordConstructor<T>, query: Query<T>, queryOptions?: QueryOptions): Promise<T[]>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=FakeStorageService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FakeStorageService.d.ts","sourceRoot":"","sources":["../../../../src/modules/openid4vc/local/FakeStorageService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,qBAAqB,EAA+B,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEnJ,qBACa,kBAAkB,CAAC,CAAC,SAAS,UAAU,CAAE,YAAW,cAAc,CAAC,CAAC,CAAC;IACvE,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAa;IAEpC,IAAI,CAAC,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAO1D,MAAM,CAAC,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAMlE,MAAM,CAAC,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAI5D,UAAU,CAAC,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,qBAAqB,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxG,OAAO,CAAC,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,qBAAqB,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAOlG,MAAM,CAAC,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IAOvF,WAAW,CAAC,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,qBAAqB,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;CAiBpJ"}
|
|
@@ -0,0 +1,72 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.FakeStorageService = void 0;
|
|
10
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
11
|
+
const core_1 = require("@credo-ts/core");
|
|
12
|
+
let FakeStorageService = class FakeStorageService {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.storrage = new Map();
|
|
15
|
+
}
|
|
16
|
+
async save(agentContext, record) {
|
|
17
|
+
record.updatedAt = new Date();
|
|
18
|
+
const value = core_1.JsonTransformer.serialize(record);
|
|
19
|
+
this.storrage.set(record.id, value);
|
|
20
|
+
return await Promise.resolve();
|
|
21
|
+
}
|
|
22
|
+
async update(agentContext, record) {
|
|
23
|
+
record.updatedAt = new Date();
|
|
24
|
+
const value = core_1.JsonTransformer.serialize(record);
|
|
25
|
+
this.storrage.set(record.id, value);
|
|
26
|
+
return await Promise.resolve();
|
|
27
|
+
}
|
|
28
|
+
delete(agentContext, record) {
|
|
29
|
+
this.storrage.delete(record.id);
|
|
30
|
+
return Promise.resolve();
|
|
31
|
+
}
|
|
32
|
+
deleteById(agentContext, recordClass, id) {
|
|
33
|
+
this.storrage.delete(id);
|
|
34
|
+
return Promise.resolve();
|
|
35
|
+
}
|
|
36
|
+
getById(agentContext, recordClass, id) {
|
|
37
|
+
const record = this.storrage.get(id);
|
|
38
|
+
if (!record) {
|
|
39
|
+
return Promise.reject(new Error(`Record with id ${id} not found`));
|
|
40
|
+
}
|
|
41
|
+
return Promise.resolve(core_1.JsonTransformer.deserialize(record, recordClass));
|
|
42
|
+
}
|
|
43
|
+
getAll(agentContext, recordClass) {
|
|
44
|
+
const records = [];
|
|
45
|
+
for (const record of this.storrage.values()) {
|
|
46
|
+
records.push(core_1.JsonTransformer.deserialize(record, recordClass));
|
|
47
|
+
}
|
|
48
|
+
return Promise.resolve(records);
|
|
49
|
+
}
|
|
50
|
+
findByQuery(agentContext, recordClass, query, queryOptions) {
|
|
51
|
+
const records = [];
|
|
52
|
+
for (const record of this.storrage.values()) {
|
|
53
|
+
const deserializedRecord = core_1.JsonTransformer.deserialize(record, recordClass);
|
|
54
|
+
let match = true;
|
|
55
|
+
for (const [key, value] of Object.entries(query)) {
|
|
56
|
+
if (deserializedRecord[key] !== value) {
|
|
57
|
+
match = false;
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (match) {
|
|
62
|
+
records.push(deserializedRecord);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return Promise.resolve(records);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
exports.FakeStorageService = FakeStorageService;
|
|
69
|
+
exports.FakeStorageService = FakeStorageService = __decorate([
|
|
70
|
+
(0, core_1.injectable)()
|
|
71
|
+
], FakeStorageService);
|
|
72
|
+
//# sourceMappingURL=FakeStorageService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FakeStorageService.js","sourceRoot":"","sources":["../../../../src/modules/openid4vc/local/FakeStorageService.ts"],"names":[],"mappings":";;;;;;;;;AAAA,sDAAsD;AACtD,yCAAmJ;AAG5I,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAAxB;QACI,aAAQ,GAAwB,IAAI,GAAG,EAAE,CAAC;IAsDrD,CAAC;IApDU,KAAK,CAAC,IAAI,CAAC,YAA0B,EAAE,MAAS;QACnD,MAAM,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;QAC9B,MAAM,KAAK,GAAG,sBAAe,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAChD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACpC,OAAO,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;IACnC,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,YAA0B,EAAE,MAAS;QACrD,MAAM,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;QAC9B,MAAM,KAAK,GAAG,sB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,CAAC,YAA0B,EAAE,WAAqC,EAAE,KAAe,EAAE,YAA2B;QAC9H,MAAM,OAAO,GAAQ,EAAE,CAAC;QACxB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;YAC1C,MAAM,kBAAkB,GAAG,sBAAe,CAAC,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;YAC5E,IAAI,KAAK,GAAG,IAAI,CAAC;YACjB,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC/C,IAAK,kBAA0B,CAAC,GAAG,CAAC,KAAK,KAAK,EAAE,CAAC;oBAC7C,KAAK,GAAG,KAAK,CAAC;oBACd,MAAM;gBACV,CAAC;YACL,CAAC;YACD,IAAI,KAAK,EAAE,CAAC;gBACR,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;YACrC,CAAC;QACL,CAAC;QACD,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;CACJ,CAAA;AAvDY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,iBAAU,GAAE;GACA,kBAAkB,CAuD9B"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { X509Module } from "@credo-ts/core";
|
|
2
|
+
import { OpenId4VcHolderModule, type OpenId4VciMetadata, type OpenId4VciResolvedCredentialOffer, type OpenId4VpResolvedAuthorizationRequest } from "@credo-ts/openid4vc";
|
|
3
|
+
import { BaseAgent } from "./BaseAgent";
|
|
4
|
+
declare function getOpenIdHolderModules(): {
|
|
5
|
+
readonly openId4VcHolder: OpenId4VcHolderModule;
|
|
6
|
+
readonly x509: X509Module;
|
|
7
|
+
};
|
|
8
|
+
export declare class Holder extends BaseAgent<ReturnType<typeof getOpenIdHolderModules>> {
|
|
9
|
+
client: {
|
|
10
|
+
clientId: string;
|
|
11
|
+
redirectUri: string;
|
|
12
|
+
};
|
|
13
|
+
constructor(port: number, name: string);
|
|
14
|
+
static build(): Promise<Holder>;
|
|
15
|
+
resolveCredentialOffer(credentialOffer: string): Promise<any>;
|
|
16
|
+
resolveIssuerMetadata(credentialIssuer: string): Promise<OpenId4VciMetadata>;
|
|
17
|
+
initiateAuthorization(resolvedCredentialOffer: OpenId4VciResolvedCredentialOffer, credentialsToRequest: string[]): Promise<any>;
|
|
18
|
+
requestAndStoreCredentials(resolvedCredentialOffer: OpenId4VciResolvedCredentialOffer, options: {
|
|
19
|
+
clientId?: string;
|
|
20
|
+
codeVerifier?: string;
|
|
21
|
+
credentialsToRequest: string[];
|
|
22
|
+
code?: string;
|
|
23
|
+
redirectUri?: string;
|
|
24
|
+
txCode?: string;
|
|
25
|
+
}): Promise<any>;
|
|
26
|
+
resolveProofRequest(proofRequest: string): Promise<any>;
|
|
27
|
+
acceptPresentationRequest(resolvedPresentationRequest: OpenId4VpResolvedAuthorizationRequest): Promise<any>;
|
|
28
|
+
exit(): Promise<any>;
|
|
29
|
+
restart(): Promise<any>;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=Holder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Holder.d.ts","sourceRoot":"","sources":["../../../../src/modules/openid4vc/local/Holder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkI,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5K,OAAO,EACH,qBAAqB,EAIrB,KAAK,kBAAkB,EACvB,KAAK,iCAAiC,EACtC,KAAK,qCAAqC,EAC7C,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,iBAAS,sBAAsB;;;EAU9B;AAED,qBAAa,MAAO,SAAQ,SAAS,CAAC,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC;IACrE,MAAM;;;MAGX;gBAEiB,IAAI,EAAE,MAAM,E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