@nmshd/consumption 7.0.0-openid4vc.2 → 7.0.0-openid4vc.3

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 (42) hide show
  1. package/dist/buildInformation.js +5 -5
  2. package/dist/modules/openid4vc/OpenId4VcController.d.ts +5 -0
  3. package/dist/modules/openid4vc/OpenId4VcController.d.ts.map +1 -1
  4. package/dist/modules/openid4vc/OpenId4VcController.js +61 -27
  5. package/dist/modules/openid4vc/OpenId4VcController.js.map +1 -1
  6. package/dist/modules/openid4vc/index.d.ts +3 -3
  7. package/dist/modules/openid4vc/index.d.ts.map +1 -1
  8. package/dist/modules/openid4vc/index.js +3 -3
  9. package/dist/modules/openid4vc/index.js.map +1 -1
  10. package/dist/modules/openid4vc/local/BaseAgent.d.ts +8 -8
  11. package/dist/modules/openid4vc/local/BaseAgent.d.ts.map +1 -1
  12. package/dist/modules/openid4vc/local/BaseAgent.js +13 -17
  13. package/dist/modules/openid4vc/local/BaseAgent.js.map +1 -1
  14. package/dist/modules/openid4vc/local/{FakeFileSystem.d.ts → EnmeshedHolderFileSystem.d.ts} +3 -2
  15. package/dist/modules/openid4vc/local/EnmeshedHolderFileSystem.d.ts.map +1 -0
  16. package/dist/modules/openid4vc/local/EnmeshedHolderFileSystem.js +94 -0
  17. package/dist/modules/openid4vc/local/EnmeshedHolderFileSystem.js.map +1 -0
  18. package/dist/modules/openid4vc/local/{FakeKeyManagmentService.d.ts → EnmeshedHolderKeyManagmentService.d.ts} +13 -2
  19. package/dist/modules/openid4vc/local/EnmeshedHolderKeyManagmentService.d.ts.map +1 -0
  20. package/dist/modules/openid4vc/local/EnmeshedHolderKeyManagmentService.js +364 -0
  21. package/dist/modules/openid4vc/local/EnmeshedHolderKeyManagmentService.js.map +1 -0
  22. package/dist/modules/openid4vc/local/{FakeStorageService.d.ts → EnmeshedStorageService.d.ts} +10 -3
  23. package/dist/modules/openid4vc/local/EnmeshedStorageService.d.ts.map +1 -0
  24. package/dist/modules/openid4vc/local/EnmeshedStorageService.js +218 -0
  25. package/dist/modules/openid4vc/local/EnmeshedStorageService.js.map +1 -0
  26. package/dist/modules/openid4vc/local/Holder.d.ts +6 -4
  27. package/dist/modules/openid4vc/local/Holder.d.ts.map +1 -1
  28. package/dist/modules/openid4vc/local/Holder.js +82 -30
  29. package/dist/modules/openid4vc/local/Holder.js.map +1 -1
  30. package/dist/modules/openid4vc/local/LocalAgentDependencies.d.ts.map +1 -1
  31. package/dist/modules/openid4vc/local/LocalAgentDependencies.js +2 -4
  32. package/dist/modules/openid4vc/local/LocalAgentDependencies.js.map +1 -1
  33. package/package.json +10 -7
  34. package/dist/modules/openid4vc/local/FakeFileSystem.d.ts.map +0 -1
  35. package/dist/modules/openid4vc/local/FakeFileSystem.js +0 -67
  36. package/dist/modules/openid4vc/local/FakeFileSystem.js.map +0 -1
  37. package/dist/modules/openid4vc/local/FakeKeyManagmentService.d.ts.map +0 -1
  38. package/dist/modules/openid4vc/local/FakeKeyManagmentService.js +0 -121
  39. package/dist/modules/openid4vc/local/FakeKeyManagmentService.js.map +0 -1
  40. package/dist/modules/openid4vc/local/FakeStorageService.d.ts.map +0 -1
  41. package/dist/modules/openid4vc/local/FakeStorageService.js +0 -72
  42. package/dist/modules/openid4vc/local/FakeStorageService.js.map +0 -1
@@ -6,11 +6,11 @@ const content_1 = require("@nmshd/content");
6
6
  const crypto_1 = require("@nmshd/crypto");
7
7
  const transport_1 = require("@nmshd/transport");
8
8
  exports.buildInformation = {
9
- version: "7.0.0-openid4vc.2",
10
- build: "327",
11
- date: "2025-08-28T14:28:37+00:00",
12
- commit: "f6075089746677eff673bb75a16d8e7818084c33",
13
- dependencies: {"@credo-ts/askar":"v0.6.0-alpha-20250704130724","@credo-ts/core":"v0.6.0-alpha-20250704130724","@credo-ts/openid4vc":"v0.6.0-alpha-20250704130724","@js-soft/docdb-querytranslator":"^1.1.5","@js-soft/ts-serval":"2.0.13","@js-soft/ts-utils":"2.3.4","@nmshd/content":"*","@nmshd/core-types":"*","@nmshd/iql":"^1.0.3","@nmshd/transport":"*","jose":"^6.0.13","lodash":"^4.17.21","ts-simple-nameof":"^1.3.3","ws":"^8.18.3"},
9
+ version: "7.0.0-openid4vc.3",
10
+ build: "349",
11
+ date: "2025-10-13T07:10:45+00:00",
12
+ commit: "3cec06a2b43fc43bd2b54dd2ac672887e8261451",
13
+ dependencies: {"@credo-ts/core":"v0.6.0-alpha-20250919145226","@credo-ts/openid4vc":"v0.6.0-alpha-20250919145226","@js-soft/docdb-querytranslator":"^1.1.5","@js-soft/ts-serval":"2.0.13","@js-soft/ts-utils":"2.3.4","@nmshd/content":"*","@nmshd/core-types":"*","@nmshd/iql":"^1.0.3","@nmshd/transport":"*","@noble/ciphers":"^0.2.0","jose":"^6.0.13","libsodium-wrappers":"^0.7.15","lodash":"^4.17.21","sjcl":"^1.0.8","ts-simple-nameof":"^1.3.3","ws":"^8.18.3"},
14
14
  libraries: {
15
15
  transport: transport_1.buildInformation,
16
16
  crypto: crypto_1.buildInformation,
@@ -2,6 +2,11 @@ import { ConsumptionBaseController } from "../../consumption/ConsumptionBaseCont
2
2
  import { ConsumptionController } from "../../consumption/ConsumptionController";
3
3
  export declare class OpenId4VcController extends ConsumptionBaseController {
4
4
  constructor(parent: ConsumptionController);
5
+ fetchCredentialOffer(credentialOfferUrl: string): Promise<any>;
6
+ processFetchedCredentialOffer(fetchedCredentialOffer: string, requestedCredentialOffers: string[], pinCode?: string): Promise<any>;
5
7
  processCredentialOffer(credentialOffer: string): Promise<any>;
8
+ fetchProofRequest(proofRequestUrl: string): Promise<any>;
9
+ acceptProofRequest(jsonEncodedRequest: string): Promise<any>;
10
+ getVerifiableCredentials(ids: string[] | undefined): Promise<any[]>;
6
11
  }
7
12
  //# sourceMappingURL=OpenId4VcController.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"OpenId4VcController.d.ts","sourceRoot":"","sources":["../../../src/modules/openid4vc/OpenId4VcController.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAIhF,qBAAa,mBAAoB,SAAQ,yBAAyB;gBAC3C,MAAM,EAAE,qBAAqB;IAInC,sBAAsB,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;CAwC7E"}
1
+ {"version":3,"file":"OpenId4VcController.d.ts","sourceRoot":"","sources":["../../../src/modules/openid4vc/OpenId4VcController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAIhF,qBAAa,mBAAoB,SAAQ,yBAAyB;gBAC3C,MAAM,EAAE,qBAAqB;IAInC,oBAAoB,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAS9D,6BAA6B,CAAC,sBAAsB,EAAE,MAAM,EAAE,yBAAyB,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAkBlI,sBAAsB,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAY7D,iBAAiB,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IASxD,kBAAkB,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAa5D,wBAAwB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;CAiBnF"}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OpenId4VcController = void 0;
4
- const content_1 = require("@nmshd/content");
5
4
  const ConsumptionBaseController_1 = require("../../consumption/ConsumptionBaseController");
6
5
  const ConsumptionControllerName_1 = require("../../consumption/ConsumptionControllerName");
7
6
  const Holder_1 = require("./local/Holder");
@@ -9,40 +8,75 @@ class OpenId4VcController extends ConsumptionBaseController_1.ConsumptionBaseCon
9
8
  constructor(parent) {
10
9
  super(ConsumptionControllerName_1.ConsumptionControllerName.OpenId4VcController, parent);
11
10
  }
11
+ async fetchCredentialOffer(credentialOfferUrl) {
12
+ const holder = new Holder_1.Holder(this.parent.accountController, this.parent.attributes);
13
+ await holder.initializeAgent("96213c3d7fc8d4d6754c7a0fd969598e");
14
+ const res = await holder.resolveCredentialOffer(credentialOfferUrl);
15
+ return {
16
+ data: JSON.stringify(res)
17
+ };
18
+ }
19
+ async processFetchedCredentialOffer(fetchedCredentialOffer, requestedCredentialOffers, pinCode) {
20
+ const holder = new Holder_1.Holder(this.parent.accountController, this.parent.attributes);
21
+ await holder.initializeAgent("96213c3d7fc8d4d6754c7a0fd969598e");
22
+ const credentialOffer = JSON.parse(fetchedCredentialOffer);
23
+ const credentials = await holder.requestAndStoreCredentials(credentialOffer, { credentialsToRequest: requestedCredentialOffers, txCode: pinCode });
24
+ // TODO: support multiple credentials
25
+ const credential = credentials[0].content.value;
26
+ return {
27
+ data: credential.value,
28
+ // multi credentials not supported yet
29
+ id: credentials[0].id,
30
+ type: credential.type,
31
+ displayInformation: credential.displayInformation
32
+ };
33
+ }
12
34
  async processCredentialOffer(credentialOffer) {
13
- // This is a dummy implementation for the sake of example.
14
- // In a real implementation, you would process the credential offer here.
15
- this._log.error("Processing credential offer:", credentialOffer);
16
- const holder = new Holder_1.Holder(3000, "OpenId4VcHolder");
35
+ const holder = new Holder_1.Holder(this.parent.accountController, this.parent.attributes);
17
36
  await holder.initializeAgent("96213c3d7fc8d4d6754c7a0fd969598e");
18
37
  const res = await holder.resolveCredentialOffer(credentialOffer);
19
- this._log.error("Resolved credential offer:", res);
20
38
  const credentials = await holder.requestAndStoreCredentials(res, { credentialsToRequest: ["EmployeeIdCard-sdjwt"] });
21
- this._log.error("Fetched credentials:", credentials);
22
- const attributes = [];
23
- for (const credential of credentials) {
24
- const owner = this.parent.accountController.identity.address;
25
- const identityAttribute = content_1.IdentityAttribute.from({
26
- value: {
27
- "@type": "VerifiableCredential",
28
- value: credential,
29
- title: "Employee ID Card",
30
- description: "An employee ID card credential"
31
- },
32
- owner: owner
33
- });
34
- const attribute = await this.parent.attributes.createRepositoryAttribute({
35
- content: identityAttribute
36
- });
37
- this._log.error("Created attribute:", attribute);
38
- attributes.push(attribute);
39
- }
40
39
  return {
41
- status: "success",
42
- message: "Credential offer processed successfully",
40
+ id: credentials.length > 0 ? credentials[0].id : undefined,
43
41
  data: JSON.stringify(credentials)
44
42
  };
45
43
  }
44
+ async fetchProofRequest(proofRequestUrl) {
45
+ const holder = new Holder_1.Holder(this.parent.accountController, this.parent.attributes);
46
+ await holder.initializeAgent("96213c3d7fc8d4d6754c7a0fd969598e");
47
+ const res = await holder.resolveProofRequest(proofRequestUrl);
48
+ return {
49
+ data: JSON.stringify(res)
50
+ };
51
+ }
52
+ async acceptProofRequest(jsonEncodedRequest) {
53
+ const holder = new Holder_1.Holder(this.parent.accountController, this.parent.attributes);
54
+ await holder.initializeAgent("96213c3d7fc8d4d6754c7a0fd969598e");
55
+ const fetchedRequest = JSON.parse(jsonEncodedRequest);
56
+ // parse the credential type to be sdjwt
57
+ const serverResponse = await holder.acceptPresentationRequest(fetchedRequest);
58
+ return {
59
+ status: serverResponse.status,
60
+ message: serverResponse.body
61
+ };
62
+ }
63
+ async getVerifiableCredentials(ids) {
64
+ const holder = new Holder_1.Holder(this.parent.accountController, this.parent.attributes);
65
+ await holder.initializeAgent("96213c3d7fc8d4d6754c7a0fd969598e");
66
+ // eslint-disable-next-line no-console
67
+ console.log("Fetching credentials with ids:", JSON.stringify(ids));
68
+ const credentials = await holder.getVerifiableCredentials(ids);
69
+ const result = [];
70
+ for (const credential of credentials) {
71
+ result.push({
72
+ id: credential.id.toString(),
73
+ data: credential.content.value.value.toString(),
74
+ displayInformation: credential.content.value.displayInformation ?? undefined,
75
+ type: credential.content.value.type ?? undefined
76
+ });
77
+ }
78
+ return result;
79
+ }
46
80
  }
47
81
  exports.OpenId4VcController = OpenId4VcController;
48
82
  //# sourceMappingURL=OpenId4VcController.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OpenId4VcController.js","sourceRoot":"","sources":["../../../src/modules/openid4vc/OpenId4VcController.ts"],"names":[],"mappings":";;;AAAA,4CAAmD;AACnD,2FAAwF;AAExF,2FAAwF;AACxF,2CAAwC;AAExC,MAAa,mBAAoB,SAAQ,qDAAyB;IAC9D,YAAmB,MAA6B;QAC5C,KAAK,CAAC,qDAAyB,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;IACjE,CAAC;IAEM,KAAK,CAAC,sBAAsB,CAAC,eAAuB;QACvD,0DAA0D;QAC1D,yEAAyE;QAEzE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,8BAA8B,EAAE,eAAe,CAAC,CAAC;QAEjE,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;QACnD,MAAM,MAAM,CAAC,eAAe,CAAC,kCAAkC,CAAC,CAAC;QACjE,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,sBAAsB,CAAC,eAAe,CAAC,CAAC;QACjE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,4BAA4B,EAAE,GAAG,CAAC,CAAC;QAEnD,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,0BAA0B,CAAC,GAAG,EAAE,EAAE,oBAAoB,EAAE,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC;QACrH,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,sBAAsB,EAAE,WAAW,CAAC,CAAC;QAErD,MAAM,UAAU,GAAG,EAAE,CAAC;QAEtB,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;YACnC,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,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M,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACjF,MAAM,MAAM,CAAC,eAAe,CAAC,kCAAkC,CAAC,CAAC;QACjE,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,gCAAgC,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;QACnE,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAC;QAC/D,MAAM,MAAM,GAAG,EAAE,CAAC;QAClB,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;YACnC,MAAM,CAAC,IAAI,CAAC;gBACR,EAAE,EAAE,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE;gBAC5B,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE;gBAC/C,kBAAkB,EAAE,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,kBAAkB,IAAI,SAAS;gBAC5E,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,SAAS;aACnD,CAAC,CAAC;QACP,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAnFD,kDAmFC"}
@@ -1,7 +1,7 @@
1
1
  export * from "./local/BaseAgent";
2
- export * from "./local/FakeFileSystem";
3
- export * from "./local/FakeKeyManagmentService";
4
- export * from "./local/FakeStorageService";
2
+ export * from "./local/EnmeshedHolderFileSystem";
3
+ export * from "./local/EnmeshedHolderKeyManagmentService";
4
+ export * from "./local/EnmeshedStorageService";
5
5
  export * from "./local/Holder";
6
6
  export * from "./local/LocalAgentDependencies";
7
7
  export * from "./OpenId4VcController";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/openid4vc/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iCAAiC,CAAC;AAChD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/openid4vc/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kCAAkC,CAAC;AACjD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC"}
@@ -15,9 +15,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./local/BaseAgent"), exports);
18
- __exportStar(require("./local/FakeFileSystem"), exports);
19
- __exportStar(require("./local/FakeKeyManagmentService"), exports);
20
- __exportStar(require("./local/FakeStorageService"), exports);
18
+ __exportStar(require("./local/EnmeshedHolderFileSystem"), exports);
19
+ __exportStar(require("./local/EnmeshedHolderKeyManagmentService"), exports);
20
+ __exportStar(require("./local/EnmeshedStorageService"), exports);
21
21
  __exportStar(require("./local/Holder"), exports);
22
22
  __exportStar(require("./local/LocalAgentDependencies"), exports);
23
23
  __exportStar(require("./OpenId4VcController"), exports);
@@ -1 +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"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/openid4vc/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,mEAAiD;AACjD,4EAA0D;AAC1D,iEAA+C;AAC/C,iDAA+B;AAC/B,iEAA+C;AAC/C,wDAAsC"}
@@ -1,19 +1,19 @@
1
1
  import { Agent, DidKey, type InitConfig, type ModulesMap, type VerificationMethod } from "@credo-ts/core";
2
+ import { AccountController } from "@nmshd/transport";
3
+ import { AttributesController } from "../../attributes";
2
4
  export declare class BaseAgent<AgentModules extends ModulesMap> {
3
- port: number;
4
- name: string;
5
+ readonly port: number;
6
+ readonly name: string;
7
+ readonly modules: AgentModules;
8
+ readonly accountController: AccountController;
9
+ readonly attributeController: AttributesController;
5
10
  config: InitConfig;
6
11
  agent: Agent<AgentModules>;
7
12
  did: string;
8
13
  didKey: DidKey;
9
14
  kid: string;
10
15
  verificationMethod: VerificationMethod;
11
- private readonly keyStorage;
12
- constructor({ port, name, modules }: {
13
- port: number;
14
- name: string;
15
- modules: AgentModules;
16
- });
16
+ constructor(port: number, name: string, modules: AgentModules, accountController: AccountController, attributeController: AttributesController);
17
17
  initializeAgent(privateKey: string): Promise<any>;
18
18
  shutdown(): Promise<void>;
19
19
  }
@@ -1 +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,UAA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zC"}
@@ -3,48 +3,44 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BaseAgent = void 0;
4
4
  const core_1 = require("@credo-ts/core");
5
5
  const kms_1 = require("@credo-ts/core/build/modules/kms");
6
- const FakeKeyManagmentService_1 = require("./FakeKeyManagmentService");
7
- const FakeStorageService_1 = require("./FakeStorageService");
6
+ const EnmeshedHolderKeyManagmentService_1 = require("./EnmeshedHolderKeyManagmentService");
7
+ const EnmeshedStorageService_1 = require("./EnmeshedStorageService");
8
8
  const LocalAgentDependencies_1 = require("./LocalAgentDependencies");
9
9
  class BaseAgent {
10
- constructor({ port, name, modules }) {
11
- this.keyStorage = new Map();
10
+ constructor(port, name, modules, accountController, attributeController) {
11
+ this.port = port;
12
+ this.name = name;
13
+ this.modules = modules;
14
+ this.accountController = accountController;
15
+ this.attributeController = attributeController;
12
16
  this.name = name;
13
17
  this.port = port;
14
18
  const config = {
15
- label: name,
16
19
  allowInsecureHttpUrls: true,
17
20
  logger: new core_1.ConsoleLogger(core_1.LogLevel.off)
18
21
  };
19
22
  this.config = config;
23
+ this.accountController = accountController;
24
+ this.attributeController = attributeController;
20
25
  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
- }
26
+ dependencyManager.registerInstance(core_1.InjectionSymbols.StorageService, new EnmeshedStorageService_1.EnmeshedStorageService(accountController, attributeController));
27
27
  this.agent = new core_1.Agent({
28
28
  config,
29
29
  dependencies: LocalAgentDependencies_1.agentDependencies,
30
30
  modules
31
31
  }, dependencyManager);
32
32
  }
33
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
34
33
  async initializeAgent(privateKey) {
35
34
  // as we are not using askar we need to set the storage version
36
35
  const storrage = this.agent.dependencyManager.resolve(core_1.InjectionSymbols.StorageService);
37
36
  const versionRecord = { id: "STORAGE_VERSION_RECORD_ID", storageVersion: "0.5.0", value: "0.5.0" };
38
37
  await storrage.save(this.agent.context, versionRecord);
39
- // as we are not using askar we need to setup our own key management service
40
38
  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());
39
+ kmsConfig.registerBackend(new EnmeshedHolderKeyManagmentService_1.EnmshedHolderKeyManagmentService());
43
40
  if (kmsConfig.backends.length === 0)
44
41
  throw new Error("No KMS backend registered");
45
42
  await this.agent.initialize();
46
- // create a uuid based key id
47
- const keyId = crypto.randomUUID();
43
+ const keyId = privateKey;
48
44
  const didCreateResult = await this.agent.dids.create({
49
45
  method: "key",
50
46
  options: {
@@ -1 +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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ements FileSystem {
2
+ export declare class EnmeshedHolderFileSystem implements FileSystem {
3
3
  readonly dataPath: string;
4
4
  readonly cachePath: string;
5
5
  readonly tempPath: string;
6
6
  private readonly fileSystem;
7
7
  private readonly directories;
8
8
  constructor();
9
+ static updateGlobalInstance(toStore: EnmeshedHolderFileSystem): void;
9
10
  exists(path: string): Promise<boolean>;
10
11
  createDirectory(path: string): Promise<void>;
11
12
  copyFile(sourcePath: string, destinationPath: string): Promise<void>;
@@ -14,4 +15,4 @@ export declare class FakeFileSystem implements FileSystem {
14
15
  delete(path: string): Promise<void>;
15
16
  downloadToFile(url: string, path: string, options?: DownloadToFileOptions): Promise<void>;
16
17
  }
17
- //# sourceMappingURL=FakeFileSystem.d.ts.map
18
+ //# sourceMappingURL=EnmeshedHolderFileSystem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EnmeshedHolderFileSystem.d.ts","sourceRoot":"","sources":["../../../../src/modules/openid4vc/local/EnmeshedHolderFileSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEnE,qBAAa,wBAAyB,YAAW,UAAU;IACvD,SAAgB,QAAQ,EAAE,MAAM,CAAC;IACjC,SAAgB,SAAS,EAAE,MAAM,CAAC;IAClC,SAAgB,QAAQ,EAAE,MAAM,CAAC;IAEjC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkC;IAC7D,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAmC;;WA2BjD,oBAAoB,CAAC,OAAO,EAAE,wBAAwB,GAAG,IAAI;IAIpE,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAQtC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMtC,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAc1E,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAU1C,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAanC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBzC,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnG"}
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnmeshedHolderFileSystem = void 0;
4
+ class EnmeshedHolderFileSystem {
5
+ constructor() {
6
+ this.fileSystem = new Map();
7
+ this.directories = new Map();
8
+ // check if the globalThis object already knows a fake file system
9
+ if (globalThis.enmeshedFileSystem) {
10
+ // if a fake file system already exists use its value to initialize this instance
11
+ const existingFs = globalThis.enmeshedFileSystem;
12
+ this.fileSystem = existingFs.fileSystem;
13
+ this.directories = existingFs.directories;
14
+ this.dataPath = existingFs.dataPath;
15
+ this.cachePath = existingFs.cachePath;
16
+ this.tempPath = existingFs.tempPath;
17
+ }
18
+ else {
19
+ this.dataPath = "/data";
20
+ this.cachePath = "/cache";
21
+ this.tempPath = "/temp";
22
+ // initialize the directories map with the known paths
23
+ this.directories.set(this.dataPath, true);
24
+ this.directories.set(this.cachePath, true);
25
+ this.directories.set(this.tempPath, true);
26
+ // store this instance in the globalThis object
27
+ EnmeshedHolderFileSystem.updateGlobalInstance(this);
28
+ }
29
+ }
30
+ static updateGlobalInstance(toStore) {
31
+ globalThis.enmeshedFileSystem = toStore;
32
+ }
33
+ exists(path) {
34
+ if (this.directories.has(path) || this.fileSystem.has(path)) {
35
+ return Promise.resolve(true);
36
+ }
37
+ return Promise.resolve(false);
38
+ }
39
+ createDirectory(path) {
40
+ this.directories.set(path, true);
41
+ EnmeshedHolderFileSystem.updateGlobalInstance(this);
42
+ return Promise.resolve();
43
+ }
44
+ async copyFile(sourcePath, destinationPath) {
45
+ const exists = await this.exists(sourcePath);
46
+ if (!exists) {
47
+ throw new Error(`Source file ${sourcePath} does not exist`);
48
+ }
49
+ if (this.directories.get(sourcePath)) {
50
+ throw new Error(`Source path ${sourcePath} is a directory, not a file`);
51
+ }
52
+ await this.write(destinationPath, this.fileSystem.get(sourcePath));
53
+ return;
54
+ }
55
+ write(path, data) {
56
+ // if the path doe not yet exist set it as a file
57
+ if (!this.directories.has(path)) {
58
+ this.directories.set(path, false); // mark as file
59
+ }
60
+ this.fileSystem.set(path, data);
61
+ EnmeshedHolderFileSystem.updateGlobalInstance(this);
62
+ return Promise.resolve();
63
+ }
64
+ async read(path) {
65
+ const exists = await this.exists(path);
66
+ if (!exists) {
67
+ throw new Error(`Path ${path} does not exist`);
68
+ }
69
+ if (this.directories.get(path)) {
70
+ throw new Error(`Path ${path} is a directory, not a file`);
71
+ }
72
+ return this.fileSystem.get(path) ?? "";
73
+ }
74
+ async delete(path) {
75
+ if (!(await this.exists(path))) {
76
+ throw new Error(`Path ${path} does not exist`);
77
+ }
78
+ if (this.directories.get(path)) {
79
+ throw new Error(`Path ${path} is a directory, not a file`);
80
+ }
81
+ if (this.fileSystem.has(path)) {
82
+ this.fileSystem.delete(path);
83
+ this.directories.delete(path);
84
+ }
85
+ EnmeshedHolderFileSystem.updateGlobalInstance(this);
86
+ return;
87
+ }
88
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
89
+ downloadToFile(url, path, options) {
90
+ throw new Error("Method not implemented.");
91
+ }
92
+ }
93
+ exports.EnmeshedHolderFileSystem = EnmeshedHolderFileSystem;
94
+ //# sourceMappingURL=EnmeshedHolderFileSystem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EnmeshedHolderFileSystem.js","sourceRoot":"","sources":["../../../../src/modules/openid4vc/local/EnmeshedHolderFileSystem.ts"],"names":[],"mappings":";;;AAEA,MAA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AAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;CACJ;AA5GD,4DA4GC"}
@@ -3,12 +3,18 @@ import { KeyManagementService, KmsCreateKeyOptions, KmsCreateKeyReturn, KmsCreat
3
3
  export interface JwkKeyPair {
4
4
  publicKey: JsonWebKey;
5
5
  privateKey: JsonWebKey;
6
+ keyType?: string;
6
7
  }
7
- export declare class FakeKeyManagmentService implements KeyManagementService {
8
+ export declare class EnmshedHolderKeyManagmentService implements KeyManagementService {
8
9
  static readonly backend = "fakeKeyManagementService";
9
10
  readonly backend = "fakeKeyManagementService";
10
11
  keystore: Map<string, string>;
12
+ private readonly b64url;
13
+ private readonly b64urlDecode;
14
+ private readonly buf2hex;
15
+ private readonly hex2buf;
11
16
  constructor();
17
+ updateGlobalInstance(storrage: Map<string, string>): void;
12
18
  isOperationSupported(agentContext: AgentContext, operation: KmsOperation): boolean;
13
19
  getPublicKey(agentContext: AgentContext, keyId: string): Promise<KmsJwkPublic>;
14
20
  createKey<Type extends KmsCreateKeyType>(agentContext: AgentContext, options: KmsCreateKeyOptions<Type>): Promise<KmsCreateKeyReturn<Type>>;
@@ -16,8 +22,13 @@ export declare class FakeKeyManagmentService implements KeyManagementService {
16
22
  deleteKey(agentContext: AgentContext, options: KmsDeleteKeyOptions): Promise<boolean>;
17
23
  sign(agentContext: AgentContext, options: KmsSignOptions): Promise<KmsSignReturn>;
18
24
  verify(agentContext: AgentContext, options: KmsVerifyOptions): Promise<KmsVerifyReturn>;
25
+ private ecdhEs;
26
+ private utf8;
27
+ private concat;
28
+ private lenPrefix;
29
+ private concatKdf;
19
30
  encrypt(agentContext: AgentContext, options: KmsEncryptOptions): Promise<KmsEncryptReturn>;
20
31
  decrypt(agentContext: AgentContext, options: KmsDecryptOptions): Promise<KmsDecryptReturn>;
21
32
  randomBytes(agentContext: AgentContext, options: KmsRandomBytesOptions): KmsRandomBytesReturn;
22
33
  }
23
- //# sourceMappingURL=FakeKeyManagmentService.d.ts.map
34
+ //# sourceMappingURL=EnmeshedHolderKeyManagmentService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EnmeshedHolderKeyManagmentService.d.ts","sourceRoot":"","sources":["../../../../src/modules/openid4vc/local/EnmeshedHolderKeyManagmentService.ts"],"names":[],"mappings":"AAAA,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;AAK1C,MAAM,WAAW,UAAU;IACvB,SAAS,EAAE,UAAU,CAAC;IACtB,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,gCAAiC,YAAW,oBAAoB;IACzE,gBAAuB,OAAO,8BAA8B;IAE5D,SAAgB,OAAO,8BAA4C;IAC5D,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAErC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA+F;IACtH,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA+F;IAI5H,OAAO,CAAC,QAAQ,CAAC,OAAO,CAItB;IACF,OAAO,CAAC,QAAQ,CAAC,OAAO,CAMtB;;IAWK,oBAAoB,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAMzD,oBAAoB,CAAC,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,GAAG,OAAO;IA4BlF,YAAY,CAAC,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GA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