@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 @@
|
|
|
1
|
+
{"version":3,"file":"OpenId4VcController.js","sourceRoot":"","sources":["../../../src/modules/openid4vc/OpenId4VcController.ts"],"names":[],"mappings":";;;AAGA,2FAAwF;AAExF,2FAAwF;AAExF,2CAAwC;AACxC,mDAAgD;AAEhD,+EAA4E;AAE5E,MAAa,mBAAoB,SAAQ,qDAAyB;IAItD,mBAAmB,CAAC,KAAc;QACtC,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QAC5C,IAAI,CAAC;YACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;YACxE,MAAM,IAAI,KAAK,CAAC,6BAA6B,MAAM,EAAE,CAAC,CAAC;QAC3D,CAAC;IACL,CAAC;IAED,YAAmB,MAA6B;QAC5C,KAAK,CAAC,qDAAyB,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;IACjE,CAAC;IAEe,KAAK,CAAC,IAAI;QACtB,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,yBAAyB,CAAC,gBAAgB,CAAC,CAAC;QACtG,MAAM,UAAU,GAAG,IAAI,uBAAU,CAAC,aAAa,EAAE,IAAI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AM,IAAI,CAAC,MAAM,CAAC,0BAA0B,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC;QACtG,IAAI,CAAC,cAAc;YAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAEhE,OAAO,EAAE,MAAM,EAAE,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,cAAc,CAAC,IAAI,EAAE,CAAC;IAC3E,CAAC;IAEM,KAAK,CAAC,8BAA8B,CAAC,UAAgC,EAAE,KAAa;QACvF,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,8BAA8B,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IAC/E,CAAC;IAEM,KAAK,CAAC,8BAA8B,CAAC,YAAgD,EAAE,aAAqB;QAC/G,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,8BAA8B,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;IACzF,CAAC;CACJ;AA9HD,kDA8HC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./local/BaseAgent";
|
|
2
|
+
export * from "./local/EnmeshedHolderFileSystem";
|
|
3
|
+
export * from "./local/EnmeshedHolderKeyManagementService";
|
|
4
|
+
export * from "./local/EnmeshedStorageService";
|
|
5
|
+
export * from "./local/Holder";
|
|
6
|
+
export * from "./local/OpenId4VciCredentialResponseJSON";
|
|
7
|
+
export * from "./OpenId4VcController";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,4CAA4C,CAAC;AAC3D,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0CAA0C,CAAC;AACzD,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./local/BaseAgent"), exports);
|
|
18
|
+
__exportStar(require("./local/EnmeshedHolderFileSystem"), exports);
|
|
19
|
+
__exportStar(require("./local/EnmeshedHolderKeyManagementService"), exports);
|
|
20
|
+
__exportStar(require("./local/EnmeshedStorageService"), exports);
|
|
21
|
+
__exportStar(require("./local/Holder"), exports);
|
|
22
|
+
__exportStar(require("./local/OpenId4VciCredentialResponseJSON"), exports);
|
|
23
|
+
__exportStar(require("./OpenId4VcController"), exports);
|
|
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,mEAAiD;AACjD,6EAA2D;AAC3D,iEAA+C;AAC/C,iDAA+B;AAC/B,2EAAyD;AACzD,wDAAsC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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";
|
|
4
|
+
import { KeyStorage } from "./KeyStorage";
|
|
5
|
+
export declare class BaseAgent<AgentModules extends ModulesMap> {
|
|
6
|
+
private readonly keyStorage;
|
|
7
|
+
config: InitConfig;
|
|
8
|
+
agent: Agent<AgentModules>;
|
|
9
|
+
did: string;
|
|
10
|
+
didKey: DidKey;
|
|
11
|
+
kid: string;
|
|
12
|
+
verificationMethod: VerificationMethod;
|
|
13
|
+
constructor(keyStorage: KeyStorage, modules: AgentModules, accountController: AccountController, attributeController: AttributesController, fetchInstance: typeof fetch);
|
|
14
|
+
initializeAgent(privateKey: string): Promise<void>;
|
|
15
|
+
shutdown(): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
//# 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,EAKN,KAAK,UAAU,EAEf,KAAK,UAAU,EACf,KAAK,kBAAkB,EAC1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAIxD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,qBAAa,SAAS,CAAC,YAAY,SAAS,UAAU;IAS9C,OAAO,CAAC,QAAQ,CAAC,UAAU;IARxB,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;gBAG1B,UAAU,EAAE,UAAU,EACvC,OAAO,EAAE,YAAY,EACrB,iBAAiB,EAAE,iBAAiB,EACpC,mBAAmB,EAAE,oBAAoB,EACzC,aAAa,EAAE,OAAO,KAAK;IA6BlB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmClD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAGzC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.BaseAgent = void 0;
|
|
7
|
+
const core_1 = require("@credo-ts/core");
|
|
8
|
+
const events_1 = require("events");
|
|
9
|
+
const ws_1 = __importDefault(require("ws"));
|
|
10
|
+
const EnmeshedHolderFileSystem_1 = require("./EnmeshedHolderFileSystem");
|
|
11
|
+
const EnmeshedHolderKeyManagementService_1 = require("./EnmeshedHolderKeyManagementService");
|
|
12
|
+
const EnmeshedStorageService_1 = require("./EnmeshedStorageService");
|
|
13
|
+
class BaseAgent {
|
|
14
|
+
constructor(keyStorage, modules, accountController, attributeController, fetchInstance) {
|
|
15
|
+
this.keyStorage = keyStorage;
|
|
16
|
+
const config = {
|
|
17
|
+
allowInsecureHttpUrls: true,
|
|
18
|
+
logger: new core_1.ConsoleLogger(core_1.LogLevel.off)
|
|
19
|
+
};
|
|
20
|
+
this.config = config;
|
|
21
|
+
const dependencyManager = new core_1.DependencyManager();
|
|
22
|
+
dependencyManager.registerInstance(core_1.InjectionSymbols.StorageService, new EnmeshedStorageService_1.EnmeshedStorageService(accountController, attributeController, this.keyStorage));
|
|
23
|
+
this.agent = new core_1.Agent({
|
|
24
|
+
config,
|
|
25
|
+
dependencies: {
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
27
|
+
FileSystem: EnmeshedHolderFileSystem_1.EnmeshedHolderFileSystem,
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
29
|
+
EventEmitterClass: events_1.EventEmitter,
|
|
30
|
+
fetch: fetchInstance,
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
32
|
+
WebSocketClass: ws_1.default
|
|
33
|
+
},
|
|
34
|
+
modules
|
|
35
|
+
}, dependencyManager);
|
|
36
|
+
}
|
|
37
|
+
async initializeAgent(privateKey) {
|
|
38
|
+
// as we are not using askar we need to set the storage version
|
|
39
|
+
const storage = this.agent.dependencyManager.resolve(core_1.InjectionSymbols.StorageService);
|
|
40
|
+
await storage.save(this.agent.context, new core_1.StorageVersionRecord({ storageVersion: "0.5.0" }));
|
|
41
|
+
const kmsConfig = this.agent.dependencyManager.resolve(core_1.Kms.KeyManagementModuleConfig);
|
|
42
|
+
kmsConfig.registerBackend(new EnmeshedHolderKeyManagementService_1.EnmeshedHolderKeyManagementService(this.keyStorage));
|
|
43
|
+
if (kmsConfig.backends.length === 0)
|
|
44
|
+
throw new Error("No KMS backend registered");
|
|
45
|
+
await this.agent.initialize();
|
|
46
|
+
const keyId = privateKey;
|
|
47
|
+
const didCreateResult = await this.agent.dids.create({
|
|
48
|
+
method: "key",
|
|
49
|
+
options: {
|
|
50
|
+
createKey: {
|
|
51
|
+
type: {
|
|
52
|
+
crv: "Ed25519",
|
|
53
|
+
kty: "OKP"
|
|
54
|
+
},
|
|
55
|
+
keyId: keyId
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
this.did = didCreateResult.didState.did;
|
|
60
|
+
this.didKey = core_1.DidKey.fromDid(this.did);
|
|
61
|
+
this.kid = `${this.did}#${this.didKey.publicJwk.fingerprint}`;
|
|
62
|
+
const verificationMethod = didCreateResult.didState.didDocument?.dereferenceKey(this.kid, ["authentication"]);
|
|
63
|
+
if (!verificationMethod)
|
|
64
|
+
throw new Error("No verification method found");
|
|
65
|
+
this.verificationMethod = verificationMethod;
|
|
66
|
+
}
|
|
67
|
+
async shutdown() {
|
|
68
|
+
await this.agent.shutdown();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.BaseAgent = BaseAgent;
|
|
72
|
+
//# sourceMappingURL=BaseAgent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseAgent.js","sourceRoot":"","sources":["../../../../src/modules/openid4vc/local/BaseAgent.ts"],"names":[],"mappings":";;;;;;AAAA,yCAawB;AAExB,mCAAsC;AACtC,4CAA2B;AAE3B,yEAAsE;AACtE,6FAA0F;AAC1F,qEAAkE;AAGlE,MAAa,SAAS;IAQlB,YACqB,UAAsB,EACvC,OAAqB,EACrB,iBAAoC,EACpC,mBAAyC,EACzC,aAA2B;QAJV,eAAU,GAAV,UAAU,CAAY;QAMvC,MAAM,MAAM,GAAG;YACX,qBAAqB,EAAE,IAAI;YAC3B,MAAM,EAAE,IAAI,oBAAa,CAAC,eAAQ,CAAC,GAAG,CAAC;SACrB,CAAC;QAEvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,MAAM,iBAAiB,GAAG,IAAI,wBAAiB,EAAE,CAAC;QAClD,iBAAiB,CAAC,gBAAgB,CAAC,uBAAgB,CAAC,cAAc,EAAE,IAAI,+CAAsB,CAAC,iBAAiB,EAAE,mBAAmB,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;QACzJ,IAAI,CAAC,KAAK,GAAG,IAAI,YAAK,CAClB;YACI,MAAM;YACN,YAAY,EAAE;gBACV,gEAAgE;gBAChE,UAAU,EAAE,mDAAwB;gBACpC,gEAAgE;gBAChE,iBAAiB,EAAE,qBAAY;gBAC/B,KAAK,EAAE,aAAa;gBACpB,gEAAgE;gBAChE,cAAc,EAAE,YAAS;aAC5B;YACD,OAAO;SACV,EACD,iBAAiB,CACpB,CAAC;IACN,CAAC;IAEM,KAAK,CAAC,eAAe,CA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e,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;AAhFD,8BAgFC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DownloadToFileOptions, FileSystem } from "@credo-ts/core";
|
|
2
|
+
export declare class EnmeshedHolderFileSystem implements FileSystem {
|
|
3
|
+
private static readonly NOT_IMPLEMENTED_ERROR;
|
|
4
|
+
exists(_path: string): Promise<boolean>;
|
|
5
|
+
createDirectory(_path: string): Promise<void>;
|
|
6
|
+
copyFile(_sourcePath: string, _destinationPath: string): Promise<void>;
|
|
7
|
+
write(_path: string, _data: string): Promise<void>;
|
|
8
|
+
read(_path: string): Promise<string>;
|
|
9
|
+
delete(_path: string): Promise<void>;
|
|
10
|
+
downloadToFile(_url: string, _path: string, _options?: DownloadToFileOptions): Promise<void>;
|
|
11
|
+
readonly dataPath: string;
|
|
12
|
+
readonly cachePath: string;
|
|
13
|
+
readonly tempPath: string;
|
|
14
|
+
}
|
|
15
|
+
//# 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;AAGnE,qBAAa,wBAAyB,YAAW,UAAU;IACvD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,qBAAqB,CAA+G;IAErJ,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAGvC,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAG7C,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAGtE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAGlD,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAGpC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAGpC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAGnG,SAAgB,QAAQ,EAAE,MAAM,CAAC;IACjC,SAAgB,SAAS,EAAE,MAAM,CAAC;IAClC,SAAgB,QAAQ,EAAE,MAAM,CAAC;CACpC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EnmeshedHolderFileSystem = void 0;
|
|
4
|
+
// File system is not used since we don't use Askar or AnonCreds.
|
|
5
|
+
class EnmeshedHolderFileSystem {
|
|
6
|
+
static { this.NOT_IMPLEMENTED_ERROR = "Not implemented: Credo's file system support has not been needed so far and is therefore not implemented."; }
|
|
7
|
+
exists(_path) {
|
|
8
|
+
throw new Error(EnmeshedHolderFileSystem.NOT_IMPLEMENTED_ERROR);
|
|
9
|
+
}
|
|
10
|
+
createDirectory(_path) {
|
|
11
|
+
throw new Error(EnmeshedHolderFileSystem.NOT_IMPLEMENTED_ERROR);
|
|
12
|
+
}
|
|
13
|
+
copyFile(_sourcePath, _destinationPath) {
|
|
14
|
+
throw new Error(EnmeshedHolderFileSystem.NOT_IMPLEMENTED_ERROR);
|
|
15
|
+
}
|
|
16
|
+
write(_path, _data) {
|
|
17
|
+
throw new Error(EnmeshedHolderFileSystem.NOT_IMPLEMENTED_ERROR);
|
|
18
|
+
}
|
|
19
|
+
read(_path) {
|
|
20
|
+
throw new Error(EnmeshedHolderFileSystem.NOT_IMPLEMENTED_ERROR);
|
|
21
|
+
}
|
|
22
|
+
delete(_path) {
|
|
23
|
+
throw new Error(EnmeshedHolderFileSystem.NOT_IMPLEMENTED_ERROR);
|
|
24
|
+
}
|
|
25
|
+
downloadToFile(_url, _path, _options) {
|
|
26
|
+
throw new Error(EnmeshedHolderFileSystem.NOT_IMPLEMENTED_ERROR);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.EnmeshedHolderFileSystem = EnmeshedHolderFileSystem;
|
|
30
|
+
//# sourceMappingURL=EnmeshedHolderFileSystem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EnmeshedHolderFileSystem.js","sourceRoot":"","sources":["../../../../src/modules/openid4vc/local/EnmeshedHolderFileSystem.ts"],"names":[],"mappings":";;;AAEA,iEAAiE;AACjE,MAAa,wBAAwB;aACT,0BAAqB,GAAG,2GAA2G,CAAC;IAErJ,MAAM,CAAC,KAAa;QACvB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,qBAAqB,CAAC,CAAC;IACpE,CAAC;IACM,eAAe,CAAC,KAAa;QAChC,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,qBAAqB,CAAC,CAAC;IACpE,CAAC;IACM,QAAQ,CAAC,WAAmB,EAAE,gBAAwB;QACzD,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,qBAAqB,CAAC,CAAC;IACpE,CAAC;IACM,KAAK,CAAC,KAAa,EAAE,KAAa;QACrC,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,qBAAqB,CAAC,CAAC;IACpE,CAAC;IACM,IAAI,CAAC,KAAa;QACrB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,qBAAqB,CAAC,CAAC;IACpE,CAAC;IACM,MAAM,CAAC,KAAa;QACvB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,qBAAqB,CAAC,CAAC;IACpE,CAAC;IACM,cAAc,CAAC,IAAY,EAAE,KAAa,EAAE,QAAgC;QAC/E,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,qBAAqB,CAAC,CAAC;IACpE,CAAC;;AAvBL,4DA2BC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AgentContext, Kms } from "@credo-ts/core";
|
|
2
|
+
import { KeyStorage } from "./KeyStorage";
|
|
3
|
+
export interface JwkKeyPair {
|
|
4
|
+
publicKey: JsonWebKey;
|
|
5
|
+
privateKey: JsonWebKey;
|
|
6
|
+
keyType?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class EnmeshedHolderKeyManagementService implements Kms.KeyManagementService {
|
|
9
|
+
private readonly keyStorage;
|
|
10
|
+
readonly backend = "enmeshed";
|
|
11
|
+
private readonly b64url;
|
|
12
|
+
private readonly b64urlDecode;
|
|
13
|
+
private readonly buf2hex;
|
|
14
|
+
private readonly hex2buf;
|
|
15
|
+
constructor(keyStorage: KeyStorage);
|
|
16
|
+
isOperationSupported(agentContext: AgentContext, operation: Kms.KmsOperation): boolean;
|
|
17
|
+
getPublicKey(agentContext: AgentContext, keyId: string): Promise<Kms.KmsJwkPublic>;
|
|
18
|
+
createKey<Type extends Kms.KmsCreateKeyType>(agentContext: AgentContext, options: Kms.KmsCreateKeyOptions<Type>): Promise<Kms.KmsCreateKeyReturn<Type>>;
|
|
19
|
+
importKey<Jwk extends Kms.KmsJwkPrivate>(agentContext: AgentContext, options: Kms.KmsImportKeyOptions<Jwk>): Promise<Kms.KmsImportKeyReturn<Jwk>>;
|
|
20
|
+
deleteKey(agentContext: AgentContext, options: Kms.KmsDeleteKeyOptions): Promise<boolean>;
|
|
21
|
+
sign(agentContext: AgentContext, options: Kms.KmsSignOptions): Promise<Kms.KmsSignReturn>;
|
|
22
|
+
verify(agentContext: AgentContext, options: Kms.KmsVerifyOptions): Promise<Kms.KmsVerifyReturn>;
|
|
23
|
+
private ecdhEs;
|
|
24
|
+
private utf8;
|
|
25
|
+
private concat;
|
|
26
|
+
private lenPrefix;
|
|
27
|
+
private concatKdf;
|
|
28
|
+
encrypt(agentContext: AgentContext, options: Kms.KmsEncryptOptions): Promise<Kms.KmsEncryptReturn>;
|
|
29
|
+
decrypt(agentContext: AgentContext, options: Kms.KmsDecryptOptions): Promise<Kms.KmsDecryptReturn>;
|
|
30
|
+
randomBytes(agentContext: AgentContext, options: Kms.KmsRandomBytesOptions): Kms.KmsRandomBytesReturn;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=EnmeshedHolderKeyManagementService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EnmeshedHolderKeyManagementService.d.ts","sourceRoot":"","sources":["../../../../src/modules/openid4vc/local/EnmeshedHolderKeyManagementService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAKnD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,WAAW,UAAU;IACvB,SAAS,EAAE,UAAU,CAAC;IACtB,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,kCAAmC,YAAW,GAAG,CAAC,oBAAoB;IAoB5D,OAAO,CAAC,QAAQ,CAAC,UAAU;IAnB9C,SAAgB,OAAO,cAAc;IAErC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkI;IACzJ,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAkI;IAG/J,OAAO,CAAC,QAAQ,CAAC,OAAO,CAItB;IACF,OAAO,CAAC,QAAQ,CAAC,OAAO,CAM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OAAO,EAAE,GAAG,CAAC,iBAAiB,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;IAKlG,WAAW,CAAC,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,CAAC,qBAAqB,GAAG,GAAG,CAAC,oBAAoB;CAI/G"}
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.EnmeshedHolderKeyManagementService = void 0;
|
|
7
|
+
const core_1 = require("@credo-ts/core");
|
|
8
|
+
const elliptic_1 = require("elliptic");
|
|
9
|
+
const crypto_1 = require("@nmshd/crypto");
|
|
10
|
+
const sjcl_1 = __importDefault(require("sjcl"));
|
|
11
|
+
class EnmeshedHolderKeyManagementService {
|
|
12
|
+
constructor(keyStorage) {
|
|
13
|
+
this.keyStorage = keyStorage;
|
|
14
|
+
this.backend = "enmeshed";
|
|
15
|
+
this.b64url = (bytes) => crypto_1.SodiumWrapper.sodium.to_base64(bytes, crypto_1.SodiumWrapper.sodium.base64_variants.URLSAFE_NO_PADDING);
|
|
16
|
+
this.b64urlDecode = (b64url) => crypto_1.SodiumWrapper.sodium.from_base64(b64url, crypto_1.SodiumWrapper.sodium.base64_variants.URLSAFE_NO_PADDING);
|
|
17
|
+
// we cannot use buffer here because it is not available in the browser
|
|
18
|
+
this.buf2hex = (bytes) => {
|
|
19
|
+
return Array.from(bytes)
|
|
20
|
+
.map((b) => b.toString(16).padStart(2, "0"))
|
|
21
|
+
.join("");
|
|
22
|
+
};
|
|
23
|
+
this.hex2buf = (hex) => {
|
|
24
|
+
const bytes = new Uint8Array(hex.length / 2);
|
|
25
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
26
|
+
bytes[i] = parseInt(hex.substring(i * 2, i * 2 + 2), 16);
|
|
27
|
+
}
|
|
28
|
+
return bytes;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
isOperationSupported(agentContext, operation) {
|
|
32
|
+
agentContext.config.logger.debug(`EKM: Checking if operation is supported: ${JSON.stringify(operation)}`);
|
|
33
|
+
if (operation.operation === "createKey") {
|
|
34
|
+
if (operation.type.kty === "OKP") {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
if (operation.type.kty === "EC" && operation.type.crv === "P-256") {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
if (operation.operation === "verify" && operation.algorithm === "ES256") {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
if (operation.operation === "sign" && (operation.algorithm === "EdDSA" || operation.algorithm === "ES256")) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
if (operation.operation === "randomBytes") {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
if (operation.operation === "deleteKey") {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
if (operation.operation === "encrypt" && ["A128GCM", "A256GCM"].includes(operation.encryption.algorithm)) {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
async getPublicKey(agentContext, keyId) {
|
|
60
|
+
const keyPair = await this.keyStorage.getKey(keyId);
|
|
61
|
+
if (!keyPair) {
|
|
62
|
+
agentContext.config.logger.error(`EKM: Key with id ${keyId} not found`);
|
|
63
|
+
throw new Error(`Key with id ${keyId} not found`);
|
|
64
|
+
}
|
|
65
|
+
return JSON.parse(keyPair).publicKey;
|
|
66
|
+
}
|
|
67
|
+
async createKey(agentContext, options) {
|
|
68
|
+
options.keyId ??= "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
|
|
69
|
+
const r = crypto_1.SodiumWrapper.sodium.randombytes_uniform(16);
|
|
70
|
+
const v = c === "x" ? r : (r & 0x3) | 0x8;
|
|
71
|
+
return v.toString(16);
|
|
72
|
+
});
|
|
73
|
+
agentContext.config.logger.debug(`EKM: Creating key with id ${options.keyId} and type ${JSON.stringify(options.type)}`);
|
|
74
|
+
if (options.type.kty === "EC" && options.type.crv === "P-256") {
|
|
75
|
+
const ec = new elliptic_1.ec("p256");
|
|
76
|
+
const key = ec.genKeyPair();
|
|
77
|
+
const publicJwk = {
|
|
78
|
+
kty: "EC",
|
|
79
|
+
crv: "P-256",
|
|
80
|
+
x: this.b64url(new Uint8Array(key.getPublic().getX().toArray())),
|
|
81
|
+
y: this.b64url(new Uint8Array(key.getPublic().getY().toArray()))
|
|
82
|
+
};
|
|
83
|
+
const privateJwk = {
|
|
84
|
+
...publicJwk,
|
|
85
|
+
d: this.b64url(new Uint8Array(key.getPrivate().toArray()))
|
|
86
|
+
};
|
|
87
|
+
const jwkKeyPair = {
|
|
88
|
+
publicKey: publicJwk,
|
|
89
|
+
privateKey: privateJwk,
|
|
90
|
+
keyType: "EC"
|
|
91
|
+
};
|
|
92
|
+
agentContext.config.logger.debug(`EKM: Created EC key pair with id ${options.keyId}`);
|
|
93
|
+
await this.keyStorage.storeKey(options.keyId, JSON.stringify(jwkKeyPair));
|
|
94
|
+
// Credo doesn't trust the key id provided in the key binding jwk anymore, so there are two options:
|
|
95
|
+
// Storing the key id with the credential and making sure that key id is properly fetched - this turned out to be difficult
|
|
96
|
+
// or the easy way out by storing this alternative key id computed from the public key.
|
|
97
|
+
const credoLegacyKeyId = core_1.Kms.PublicJwk.fromPublicJwk(publicJwk).legacyKeyId;
|
|
98
|
+
await this.keyStorage.storeKey(credoLegacyKeyId, JSON.stringify(jwkKeyPair));
|
|
99
|
+
return { keyId: options.keyId, publicJwk: publicJwk };
|
|
100
|
+
}
|
|
101
|
+
const { keyType, publicKey, privateKey } = crypto_1.SodiumWrapper.sodium.crypto_sign_keypair();
|
|
102
|
+
agentContext.config.logger.debug(`EKM: Created OKP key pair with id ${options.keyId} and keyType ${keyType}`);
|
|
103
|
+
const seed = privateKey.slice(0, crypto_1.SodiumWrapper.sodium.crypto_sign_SEEDBYTES);
|
|
104
|
+
const publicJwk = {
|
|
105
|
+
kty: "OKP",
|
|
106
|
+
crv: "Ed25519",
|
|
107
|
+
x: this.b64url(publicKey)
|
|
108
|
+
};
|
|
109
|
+
const privateJwk = {
|
|
110
|
+
...publicJwk,
|
|
111
|
+
d: this.b64url(seed)
|
|
112
|
+
};
|
|
113
|
+
const jwkKeyPair = {
|
|
114
|
+
publicKey: publicJwk,
|
|
115
|
+
privateKey: privateJwk,
|
|
116
|
+
keyType: "OKP"
|
|
117
|
+
};
|
|
118
|
+
await this.keyStorage.storeKey(options.keyId, JSON.stringify(jwkKeyPair));
|
|
119
|
+
return { keyId: options.keyId, publicJwk: publicJwk };
|
|
120
|
+
}
|
|
121
|
+
importKey(agentContext, options) {
|
|
122
|
+
agentContext.config.logger.debug(`EKM: Importing key with ${JSON.stringify(options)}`);
|
|
123
|
+
throw new Error("Method not implemented.");
|
|
124
|
+
}
|
|
125
|
+
async deleteKey(agentContext, options) {
|
|
126
|
+
const hasKey = await this.keyStorage.hasKey(options.keyId);
|
|
127
|
+
if (!hasKey)
|
|
128
|
+
throw new Error(`key with id ${options.keyId} not found. and cannot be deleted`);
|
|
129
|
+
agentContext.config.logger.debug(`EKM: Deleting key with id ${options.keyId}`);
|
|
130
|
+
await this.keyStorage.deleteKey(options.keyId);
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
async sign(agentContext, options) {
|
|
134
|
+
agentContext.config.logger.debug(`EKM: Signing data with key id ${options.keyId} using algorithm ${options.algorithm}`);
|
|
135
|
+
const stringifiedKeyPair = await this.keyStorage.getKey(options.keyId);
|
|
136
|
+
if (!stringifiedKeyPair) {
|
|
137
|
+
throw new Error(`Key with id ${options.keyId} not found`);
|
|
138
|
+
}
|
|
139
|
+
const { privateKey, publicKey } = JSON.parse(stringifiedKeyPair);
|
|
140
|
+
if (options.algorithm === "ES256") {
|
|
141
|
+
const ec = new elliptic_1.ec("p256");
|
|
142
|
+
if (!privateKey.d) {
|
|
143
|
+
throw new Error("Private JWK does not contain 'd' parameter");
|
|
144
|
+
}
|
|
145
|
+
const priv = this.buf2hex(this.b64urlDecode(privateKey.d));
|
|
146
|
+
const key = ec.keyFromPrivate(priv, "hex");
|
|
147
|
+
const dataHash = ec.hash().update(options.data).digest();
|
|
148
|
+
const signature = key.sign(dataHash);
|
|
149
|
+
const r = new Uint8Array(signature.r.toArray());
|
|
150
|
+
const s = new Uint8Array(signature.s.toArray());
|
|
151
|
+
const signatureBytes = new Uint8Array(r.length + s.length);
|
|
152
|
+
signatureBytes.set(r);
|
|
153
|
+
signatureBytes.set(s, r.length);
|
|
154
|
+
return await Promise.resolve({
|
|
155
|
+
signature: signatureBytes
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
const decode = (bytes) => crypto_1.SodiumWrapper.sodium.from_base64(bytes, crypto_1.SodiumWrapper.sodium.base64_variants.URLSAFE_NO_PADDING);
|
|
159
|
+
if (privateKey.d === undefined) {
|
|
160
|
+
throw new Error("Private key does not contain 'd' parameter");
|
|
161
|
+
}
|
|
162
|
+
const privateKeyBytes = decode(privateKey.d);
|
|
163
|
+
if (publicKey.x === undefined) {
|
|
164
|
+
throw new Error("Public key does not contain 'x' parameter");
|
|
165
|
+
}
|
|
166
|
+
const publicKeyBytes = decode(publicKey.x);
|
|
167
|
+
const fullPrivateKeyBytes = new Uint8Array(privateKeyBytes.length + publicKeyBytes.length);
|
|
168
|
+
fullPrivateKeyBytes.set(privateKeyBytes);
|
|
169
|
+
fullPrivateKeyBytes.set(publicKeyBytes, privateKeyBytes.length);
|
|
170
|
+
const signature = crypto_1.SodiumWrapper.sodium.crypto_sign_detached(options.data, fullPrivateKeyBytes);
|
|
171
|
+
return {
|
|
172
|
+
signature: signature
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
verify(agentContext, options) {
|
|
176
|
+
agentContext.config.logger.debug(`EKM: Verifying signature with key id ${options.key.keyId} using algorithm ${options.algorithm}`);
|
|
177
|
+
const ec = new elliptic_1.ec("p256");
|
|
178
|
+
if (!options.key.publicJwk) {
|
|
179
|
+
throw new Error("Public JWK is undefined");
|
|
180
|
+
}
|
|
181
|
+
if (options.key.publicJwk.kty !== "EC") {
|
|
182
|
+
throw new Error("Public JWK does not contain 'x' or 'y' parameter");
|
|
183
|
+
}
|
|
184
|
+
const x = options.key.publicJwk.x;
|
|
185
|
+
const y = options.key.publicJwk.y;
|
|
186
|
+
const pub = { x: this.buf2hex(this.b64urlDecode(x)), y: this.buf2hex(this.b64urlDecode(y)) };
|
|
187
|
+
const key = ec.keyFromPublic(pub, "hex");
|
|
188
|
+
const signatureBytes = options.signature;
|
|
189
|
+
const r = signatureBytes.subarray(0, 32);
|
|
190
|
+
const s = signatureBytes.subarray(32, 64);
|
|
191
|
+
const signature = { r: this.buf2hex(r), s: this.buf2hex(s) };
|
|
192
|
+
const dataHash = ec.hash().update(options.data).digest();
|
|
193
|
+
try {
|
|
194
|
+
const verified = key.verify(dataHash, signature);
|
|
195
|
+
return Promise.resolve({ verified: verified });
|
|
196
|
+
}
|
|
197
|
+
catch (e) {
|
|
198
|
+
agentContext.config.logger.error(`EKM: Error during signature verification: ${e}`);
|
|
199
|
+
throw e;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
async ecdhEs(localKeyId, remotePublicJWK) {
|
|
203
|
+
const keyPairString = await this.keyStorage.getKey(localKeyId);
|
|
204
|
+
if (!keyPairString) {
|
|
205
|
+
throw new Error(`Key with id ${localKeyId} not found`);
|
|
206
|
+
}
|
|
207
|
+
const localKeyPair = JSON.parse(keyPairString);
|
|
208
|
+
if (localKeyPair.keyType !== "EC") {
|
|
209
|
+
throw new Error("Key type is not EC");
|
|
210
|
+
}
|
|
211
|
+
const ec = new elliptic_1.ec("p256");
|
|
212
|
+
if (localKeyPair.privateKey.d === undefined) {
|
|
213
|
+
throw new Error("Local private key does not contain 'd' parameter");
|
|
214
|
+
}
|
|
215
|
+
const localPriv = ec.keyFromPrivate(this.buf2hex(this.b64urlDecode(localKeyPair.privateKey.d)), "hex");
|
|
216
|
+
const remoteBasePoint = ec.keyFromPublic({
|
|
217
|
+
x: this.buf2hex(this.b64urlDecode(remotePublicJWK.x)),
|
|
218
|
+
y: this.buf2hex(this.b64urlDecode(remotePublicJWK.y))
|
|
219
|
+
}, "hex");
|
|
220
|
+
const sharedSecret = localPriv.derive(remoteBasePoint.getPublic());
|
|
221
|
+
const sharedBytes = new Uint8Array(sharedSecret.toArray("be"));
|
|
222
|
+
return sharedBytes;
|
|
223
|
+
}
|
|
224
|
+
utf8(str) {
|
|
225
|
+
return new TextEncoder().encode(str);
|
|
226
|
+
}
|
|
227
|
+
concat(...arrays) {
|
|
228
|
+
const total = arrays.reduce((sum, a) => sum + a.length, 0);
|
|
229
|
+
const out = new Uint8Array(total);
|
|
230
|
+
let offset = 0;
|
|
231
|
+
for (const a of arrays) {
|
|
232
|
+
out.set(a, offset);
|
|
233
|
+
offset += a.length;
|
|
234
|
+
}
|
|
235
|
+
return out;
|
|
236
|
+
}
|
|
237
|
+
lenPrefix(data) {
|
|
238
|
+
const buf = new Uint8Array(4 + data.length);
|
|
239
|
+
const view = new DataView(buf.buffer);
|
|
240
|
+
view.setUint32(0, data.length, false); // big-endian
|
|
241
|
+
buf.set(data, 4);
|
|
242
|
+
return buf;
|
|
243
|
+
}
|
|
244
|
+
concatKdf(sharedSecret, keyLength, algorithmDescriptor, keyAgreement) {
|
|
245
|
+
if (keyAgreement.apu === undefined) {
|
|
246
|
+
throw new Error("Key agreement apu is undefined");
|
|
247
|
+
}
|
|
248
|
+
if (keyAgreement.apv === undefined) {
|
|
249
|
+
throw new Error("Key agreement apv is undefined");
|
|
250
|
+
}
|
|
251
|
+
const algId = this.lenPrefix(this.utf8(algorithmDescriptor));
|
|
252
|
+
const partyU = this.lenPrefix(keyAgreement.apu);
|
|
253
|
+
const partyV = this.lenPrefix(keyAgreement.apv);
|
|
254
|
+
const suppPubInfo = new Uint8Array(4);
|
|
255
|
+
new DataView(suppPubInfo.buffer).setUint32(0, keyLength, false);
|
|
256
|
+
const suppPrivInfo = new Uint8Array(0);
|
|
257
|
+
const otherInfo = this.concat(algId, partyU, partyV, suppPubInfo, suppPrivInfo);
|
|
258
|
+
const counter = new Uint8Array([0, 0, 0, 1]);
|
|
259
|
+
const input = this.concat(counter, sharedSecret, otherInfo);
|
|
260
|
+
const inputHex = this.buf2hex(input);
|
|
261
|
+
const inputBits = sjcl_1.default.codec.hex.toBits(inputHex);
|
|
262
|
+
const hashBits = sjcl_1.default.hash.sha256.hash(inputBits);
|
|
263
|
+
const hashHex = sjcl_1.default.codec.hex.fromBits(hashBits);
|
|
264
|
+
const hashBuf = this.hex2buf(hashHex);
|
|
265
|
+
return hashBuf.subarray(0, keyLength / 8);
|
|
266
|
+
}
|
|
267
|
+
async encrypt(agentContext, options) {
|
|
268
|
+
try {
|
|
269
|
+
if (options.key.keyAgreement === undefined) {
|
|
270
|
+
throw new Error("Key agreement is undefined");
|
|
271
|
+
}
|
|
272
|
+
if (options.key.keyAgreement.keyId === undefined) {
|
|
273
|
+
throw new Error("Key agreement keyId is undefined");
|
|
274
|
+
}
|
|
275
|
+
const algorithm = options.encryption.algorithm;
|
|
276
|
+
const keyLength = options.encryption.algorithm === "A128GCM" ? 128 : 256;
|
|
277
|
+
const sharedSecret = await this.ecdhEs(options.key.keyAgreement.keyId, options.key.keyAgreement.externalPublicJwk);
|
|
278
|
+
agentContext.config.logger.debug(`EKM: Derived shared secret for encryption using ECDH-ES`);
|
|
279
|
+
const derivedKey = this.concatKdf(sharedSecret, keyLength, algorithm, options.key.keyAgreement);
|
|
280
|
+
const iv = crypto.getRandomValues(new Uint8Array(12));
|
|
281
|
+
const keyBits = sjcl_1.default.codec.hex.toBits(this.buf2hex(derivedKey));
|
|
282
|
+
const dataBits = sjcl_1.default.codec.hex.toBits(this.buf2hex(options.data));
|
|
283
|
+
const ivBits = sjcl_1.default.codec.hex.toBits(this.buf2hex(iv));
|
|
284
|
+
const aadBits = "aad" in options.encryption && options.encryption.aad ? sjcl_1.default.codec.hex.toBits(this.buf2hex(options.encryption.aad)) : [];
|
|
285
|
+
const aes = new sjcl_1.default.cipher.aes(keyBits);
|
|
286
|
+
const cyphertextBits = sjcl_1.default.mode.gcm.encrypt(aes, dataBits, ivBits, aadBits, 128);
|
|
287
|
+
const cyphertextBuf = this.hex2buf(sjcl_1.default.codec.hex.fromBits(cyphertextBits));
|
|
288
|
+
const cyphertext = cyphertextBuf.subarray(0, cyphertextBuf.length - 16);
|
|
289
|
+
const tag = cyphertextBuf.subarray(cyphertextBuf.length - 16);
|
|
290
|
+
const returnValue = {
|
|
291
|
+
encrypted: cyphertext,
|
|
292
|
+
iv: iv,
|
|
293
|
+
tag: tag
|
|
294
|
+
};
|
|
295
|
+
return returnValue;
|
|
296
|
+
}
|
|
297
|
+
catch (e) {
|
|
298
|
+
agentContext.config.logger.error(`EKM: Error during encryption: ${e}`);
|
|
299
|
+
throw e;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
decrypt(agentContext, options) {
|
|
303
|
+
agentContext.config.logger.debug(`EKM: Decrypting data with key id ${options.key.keyId} using options ${options}`);
|
|
304
|
+
throw new Error("Method not implemented.");
|
|
305
|
+
}
|
|
306
|
+
randomBytes(agentContext, options) {
|
|
307
|
+
agentContext.config.logger.debug(`EKM: Generating ${options.length} random bytes`);
|
|
308
|
+
return crypto_1.SodiumWrapper.sodium.randombytes_buf(options.length); // Uint8Array
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
exports.EnmeshedHolderKeyManagementService = EnmeshedHolderKeyManagementService;
|
|
312
|
+
//# sourceMappingURL=EnmeshedHolderKeyManagementService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EnmeshedHolderKeyManagementService.js","sourceRoot":"","sources":["../../../../src/mod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/C,CAAC;IAEM,WAAW,CAAC,YAA0B,EAAE,OAAkC;QAC7E,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,OAAO,CAAC,MAAM,eAAe,CAAC,CAAC;QACnF,OAAO,sBAAa,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa;IAC9E,CAAC;CACJ;AAzWD,gFAyWC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AgentContext, BaseRecord, BaseRecordConstructor, Query, QueryOptions, StorageService } from "@credo-ts/core";
|
|
2
|
+
import { AccountController } from "@nmshd/transport";
|
|
3
|
+
import { OwnIdentityAttribute } from "../../attributes";
|
|
4
|
+
import { AttributesController } from "../../attributes/AttributesController";
|
|
5
|
+
import { KeyStorage } from "./KeyStorage";
|
|
6
|
+
export declare class EnmeshedStorageService<T extends BaseRecord> implements StorageService<T> {
|
|
7
|
+
private readonly accountController;
|
|
8
|
+
private readonly attributeController;
|
|
9
|
+
private readonly keyStorage;
|
|
10
|
+
storage: Map<string, T>;
|
|
11
|
+
supportsCursorPagination: boolean;
|
|
12
|
+
constructor(accountController: AccountController, attributeController: AttributesController, keyStorage: KeyStorage);
|
|
13
|
+
save(_agentContext: AgentContext, record: T): Promise<void>;
|
|
14
|
+
saveWithDisplay(agentContext: AgentContext, value: string | Record<string, any>, type: string, displayInformation?: Record<string, any>[]): Promise<OwnIdentityAttribute>;
|
|
15
|
+
update(_agentContext: AgentContext, _record: T): Promise<void>;
|
|
16
|
+
delete(_agentContext: AgentContext, _record: T): Promise<void>;
|
|
17
|
+
deleteById(_agentContext: AgentContext, _recordClass: BaseRecordConstructor<T>, _id: string): Promise<void>;
|
|
18
|
+
getById(_agentContext: AgentContext, _recordClass: BaseRecordConstructor<T>, id: string): Promise<T>;
|
|
19
|
+
getAll(_agentContext: AgentContext, recordClass: BaseRecordConstructor<T>): Promise<T[]>;
|
|
20
|
+
private recordTypeToCredentialType;
|
|
21
|
+
findByQuery(agentContext: AgentContext, recordClass: BaseRecordConstructor<T>, query: Query<T>, queryOptions?: QueryOptions): Promise<T[]>;
|
|
22
|
+
private matchesQuery;
|
|
23
|
+
}
|
|
24
|
+
export declare function decodeRecord(type: string, encoded: string | Record<string, any>): BaseRecord<any, any>;
|
|
25
|
+
//# sourceMappingURL=EnmeshedStorageService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EnmeshedStorageService.d.ts","sourceRoot":"","sources":["../../../../src/modules/openid4vc/local/EnmeshedStorageService.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,YAAY,EACZ,UAAU,EACV,qBAAqB,EAIrB,KAAK,EACL,YAAY,EAEZ,cAAc,EAEjB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,qBACa,sBAAsB,CAAC,CAAC,SAAS,UAAU,CAAE,YAAW,cAAc,CAAC,CAAC,CAAC;IAI9E,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,OAAO,CAAC,QAAQ,CAAC,UAAU;IALxB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAwB;IAC/C,wBAAwB,UAAS;gBAEnB,iBAAiB,EAAE,iBAAiB,EACpC,mBAAmB,EAAE,oBAAoB,EACzC,UAAU,EAAE,UAAU;IAGpC,IAAI,CAAC,aAAa,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IASrD,eAAe,CACxB,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,MAAM,GAAG,MAA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