credo-ts-indy-vdr-proxy-server 0.1.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/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # Aries JavaScript Indy VDR Proxy Server
2
+
3
+ A server that exposes a REST API to resolve objects in Indy networks. It is built in [NestJs](https://github.com/nestjs/nest) and based on [Credo](https://github.com/openwallet-foundation/credo-ts).
4
+
5
+ Although it can be used as a general gateway to multiple Indy networks (much in the same way [Universal Resolver](https://dev.uniresolver.io/) does), this server was developed to reduce the workload needed by a mobile application, as multiple ZMQ sockets must be opened when supporting multiple Indy networks and there might be issues in some mobile OS and Mobile Network Operators.
6
+
7
+ ### Usage
8
+
9
+ In order to run the server in standalone mode, you just need to install all dependencies by doing:
10
+
11
+ ```
12
+ yarn install
13
+ ```
14
+
15
+ and then go to server directory and execute:
16
+
17
+ ```
18
+ cd packages/server
19
+ yarn run start
20
+ ```
21
+
22
+ By default, Indy VDR Proxy Server runs at port 3000 and supports only [BCovrin Test network](http://test.bcovrin.vonx.io/). This can be overriden by either updating the configuration file located at `res/app.config.json` or providing your own by setting the environment variable `INDY_VDR_PROXY_CONFIG_PATH`. E.g.:
23
+
24
+ ```
25
+ INDY_VDR_PROXY_CONFIG_PATH=/my-directory/my-config.file.json yarn run start
26
+ ```
27
+
28
+ If you want to integrate Indy VDR Proxy in your own NestJS-based project, you can by importing `IndyVdrProxyServerModule`. You'll need to call `register` method passing an `IndyVdrProxyAgent` instance (which could be your own AFJ-based Agent as long as it contains all required modules):
29
+
30
+ ```ts
31
+ import { setupAgent } from "credo-ts-indy-vdr-proxy-server"
32
+
33
+ IndyVdrProxyModule.register(setupAgent({ networks }))
34
+ ```
35
+
36
+ ### Endpoints
37
+
38
+ All endpoints use HTTP GET method.
39
+
40
+ - /did/{fully qualified or legacy Indy did}: resolve a DID Document
41
+ - /schema/{fully qualified AnonCreds schema ID}: resolve an AnonCreds Schema
42
+ - /credential-definition/{fully qualified AnonCreds credential definition ID}: resolve an AnonCreds Credential Definition
43
+ - /revocation-registry-definition/{fully qualified AnonCreds revocation registry definition ID}: resolve an AnonCreds Revocation Registry Definition
44
+ - /revocation-status-list/{fully qualified AnonCreds revocation registry definition ID}/{timestamp}: resolve an AnonCreds Revocation Status List
45
+
46
+ The response for each follows the format used in `@credo-ts/anoncreds` module. It's a JSON containing three elements:
47
+
48
+ ```json
49
+ {
50
+ objectTypeInCamelCase: { ... },
51
+ objectTypeInCamelCaseMetadata: { ... };
52
+ resolutionMetadata: { error?: 'invalid' | 'notFound' | 'unsupportedAnonCredsMethod' | string;
53
+ message?: string;};
54
+ }
55
+ ```
@@ -0,0 +1,21 @@
1
+ import { Agent, DidsModule, Logger } from "@credo-ts/core";
2
+ import { AskarModule } from "@credo-ts/askar";
3
+ import { AnonCredsModule } from "@credo-ts/anoncreds";
4
+ import { IndyVdrModule, IndyVdrPoolConfig } from "@credo-ts/indy-vdr";
5
+ export type IndyVdrProxyAgent = Agent<ReturnType<typeof getIndyVdrProxyAgentModules>>;
6
+ export declare function setupAgent(options: {
7
+ networks: [IndyVdrPoolConfig, ...IndyVdrPoolConfig[]];
8
+ logger?: Logger;
9
+ }): Agent<{
10
+ readonly askar: AskarModule;
11
+ readonly anoncreds: AnonCredsModule;
12
+ readonly dids: DidsModule;
13
+ readonly indyVdr: IndyVdrModule;
14
+ }>;
15
+ declare const getIndyVdrProxyAgentModules: (networks: [IndyVdrPoolConfig, ...IndyVdrPoolConfig[]]) => {
16
+ readonly askar: AskarModule;
17
+ readonly anoncreds: AnonCredsModule;
18
+ readonly dids: DidsModule;
19
+ readonly indyVdr: IndyVdrModule;
20
+ };
21
+ export {};
package/build/agent.js ADDED
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setupAgent = void 0;
4
+ const core_1 = require("@credo-ts/core");
5
+ const node_1 = require("@credo-ts/node");
6
+ const askar_1 = require("@credo-ts/askar");
7
+ const anoncreds_1 = require("@credo-ts/anoncreds");
8
+ const indy_vdr_1 = require("@credo-ts/indy-vdr");
9
+ const anoncreds_nodejs_1 = require("@hyperledger/anoncreds-nodejs");
10
+ const aries_askar_nodejs_1 = require("@hyperledger/aries-askar-nodejs");
11
+ const indy_vdr_nodejs_1 = require("@hyperledger/indy-vdr-nodejs");
12
+ function setupAgent(options) {
13
+ var _a;
14
+ return new core_1.Agent({
15
+ config: {
16
+ label: "Indy VDR Proxy",
17
+ walletConfig: {
18
+ id: "indy-vdr-proxy",
19
+ key: "indy-vdr-proxy",
20
+ },
21
+ logger: (_a = options.logger) !== null && _a !== void 0 ? _a : new core_1.ConsoleLogger(core_1.LogLevel.off),
22
+ },
23
+ dependencies: node_1.agentDependencies,
24
+ modules: getIndyVdrProxyAgentModules(options.networks),
25
+ });
26
+ }
27
+ exports.setupAgent = setupAgent;
28
+ const getIndyVdrProxyAgentModules = (networks) => {
29
+ return {
30
+ askar: new askar_1.AskarModule({ ariesAskar: aries_askar_nodejs_1.ariesAskar }),
31
+ anoncreds: new anoncreds_1.AnonCredsModule({
32
+ registries: [new indy_vdr_1.IndyVdrAnonCredsRegistry()],
33
+ anoncreds: anoncreds_nodejs_1.anoncreds,
34
+ }),
35
+ dids: new core_1.DidsModule({ resolvers: [new indy_vdr_1.IndyVdrSovDidResolver()] }),
36
+ indyVdr: new indy_vdr_1.IndyVdrModule({
37
+ indyVdr: indy_vdr_nodejs_1.indyVdr,
38
+ networks,
39
+ }),
40
+ };
41
+ };
42
+ //# sourceMappingURL=agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":";;;AAAA,yCAAmF;AACnF,yCAAkD;AAClD,2CAA6C;AAC7C,mDAAqD;AACrD,iDAAsH;AACtH,oEAAyD;AACzD,wEAA4D;AAC5D,kEAAsD;AAItD,SAAgB,UAAU,CAAC,OAAmF;;IAC5G,OAAO,IAAI,YAAK,CAAC;QACf,MAAM,EAAE;YACN,KAAK,EAAE,gBAAgB;YACvB,YAAY,EAAE;gBACZ,EAAE,EAAE,gBAAgB;gBACpB,GAAG,EAAE,gBAAgB;aACtB;YACD,MAAM,EAAE,MAAA,OAAO,CAAC,MAAM,mCAAI,IAAI,oBAAa,CAAC,eAAQ,CAAC,GAAG,CAAC;SAC1D;QACD,YAAY,EAAE,wBAAiB;QAC/B,OAAO,EAAE,2BAA2B,CAAC,OAAO,CAAC,QAAQ,CAAC;KACvD,CAAC,CAAA;AACJ,CAAC;AAbD,gCAaC;AAED,MAAM,2BAA2B,GAAG,CAAC,QAAqD,EAAE,EAAE;IAC5F,OAAO;QACL,KAAK,EAAE,IAAI,mBAAW,CAAC,EAAE,UAAU,EAAV,+BAAU,EAAE,CAAC;QACtC,SAAS,EAAE,IAAI,2BAAe,CAAC;YAC7B,UAAU,EAAE,CAAC,IAAI,mCAAwB,EAAE,CAAC;YAC5C,SAAS,EAAT,4BAAS;SACV,CAAC;QACF,IAAI,EAAE,IAAI,iBAAU,CAAC,EAAE,SAAS,EAAE,CAAC,IAAI,gCAAqB,EAAE,CAAC,EAAE,CAAC;QAClE,OAAO,EAAE,IAAI,wBAAa,CAAC;YACzB,OAAO,EAAP,yBAAO;YACP,QAAQ;SACT,CAAC;KACM,CAAA;AACZ,CAAC,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { IndyVdrProxyAgent } from "./agent";
2
+ export declare class AgentService {
3
+ private agent;
4
+ constructor(agent: IndyVdrProxyAgent);
5
+ getAgent(): Promise<IndyVdrProxyAgent>;
6
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.AgentService = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ let AgentService = class AgentService {
18
+ constructor(agent) {
19
+ this.agent = agent;
20
+ }
21
+ async getAgent() {
22
+ if (!this.agent.isInitialized) {
23
+ await this.agent.initialize();
24
+ }
25
+ return this.agent;
26
+ }
27
+ };
28
+ AgentService = __decorate([
29
+ (0, common_1.Injectable)(),
30
+ __param(0, (0, common_1.Inject)("AGENT")),
31
+ __metadata("design:paramtypes", [Object])
32
+ ], AgentService);
33
+ exports.AgentService = AgentService;
34
+ //# sourceMappingURL=agent.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.service.js","sourceRoot":"","sources":["../src/agent.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAmD;AAI5C,IAAM,YAAY,GAAlB,MAAM,YAAY;IACvB,YAAqC,KAAwB;QAAxB,UAAK,GAAL,KAAK,CAAmB;IAAG,CAAC;IAEjE,KAAK,CAAC,QAAQ;QACZ,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE;YAC7B,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAA;SAC9B;QAED,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;CACF,CAAA;AAVY,YAAY;IADxB,IAAA,mBAAU,GAAE;IAEE,WAAA,IAAA,eAAM,EAAC,OAAO,CAAC,CAAA;;GADjB,YAAY,CAUxB;AAVY,oCAAY"}
@@ -0,0 +1,5 @@
1
+ import { DynamicModule } from "@nestjs/common";
2
+ import { IndyVdrProxyAgent } from "./agent";
3
+ export declare class IndyVdrProxyModule {
4
+ static register(agent: IndyVdrProxyAgent): DynamicModule;
5
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var IndyVdrProxyModule_1;
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.IndyVdrProxyModule = void 0;
11
+ const common_1 = require("@nestjs/common");
12
+ const agent_service_1 = require("./agent.service");
13
+ const creddef_controller_1 = require("./creddef.controller");
14
+ const did_controller_1 = require("./did.controller");
15
+ const revregdef_controller_1 = require("./revregdef.controller");
16
+ const revstatuslist_controller_1 = require("./revstatuslist.controller");
17
+ const schema_controller_1 = require("./schema.controller");
18
+ let IndyVdrProxyModule = IndyVdrProxyModule_1 = class IndyVdrProxyModule {
19
+ static register(agent) {
20
+ return {
21
+ module: IndyVdrProxyModule_1,
22
+ controllers: [
23
+ did_controller_1.DidController,
24
+ schema_controller_1.SchemaController,
25
+ creddef_controller_1.CredentialDefinitionController,
26
+ revregdef_controller_1.RevocationRegistryDefinitionController,
27
+ revstatuslist_controller_1.RevocationStatusListController,
28
+ ],
29
+ providers: [
30
+ {
31
+ provide: "AGENT",
32
+ useValue: agent,
33
+ },
34
+ agent_service_1.AgentService,
35
+ ],
36
+ exports: [agent_service_1.AgentService],
37
+ };
38
+ }
39
+ };
40
+ IndyVdrProxyModule = IndyVdrProxyModule_1 = __decorate([
41
+ (0, common_1.Module)({})
42
+ ], IndyVdrProxyModule);
43
+ exports.IndyVdrProxyModule = IndyVdrProxyModule;
44
+ //# sourceMappingURL=app.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.module.js","sourceRoot":"","sources":["../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAsD;AAEtD,mDAA8C;AAC9C,6DAAqE;AACrE,qDAAgD;AAChD,iEAA+E;AAC/E,yEAA2E;AAC3E,2DAAsD;AAG/C,IAAM,kBAAkB,0BAAxB,MAAM,kBAAkB;IAC7B,MAAM,CAAC,QAAQ,CAAC,KAAwB;QACtC,OAAO;YACL,MAAM,EAAE,oBAAkB;YAC1B,WAAW,EAAE;gBACX,8BAAa;gBACb,oCAAgB;gBAChB,mDAA8B;gBAC9B,6DAAsC;gBACtC,yDAA8B;aAC/B;YACD,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,OAAO;oBAChB,QAAQ,EAAE,KAAK;iBAChB;gBACD,4BAAY;aACb;YACD,OAAO,EAAE,CAAC,4BAAY,CAAC;SACxB,CAAA;IACH,CAAC;CACF,CAAA;AArBY,kBAAkB;IAD9B,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,kBAAkB,CAqB9B;AArBY,gDAAkB"}
@@ -0,0 +1,7 @@
1
+ import { AgentService } from "./agent.service";
2
+ import { GetCredentialDefinitionReturn } from "@credo-ts/anoncreds/build/services/registry";
3
+ export declare class CredentialDefinitionController {
4
+ private readonly agentService;
5
+ constructor(agentService: AgentService);
6
+ getCredentialDefinition(params: any): Promise<GetCredentialDefinitionReturn>;
7
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.CredentialDefinitionController = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const agent_service_1 = require("./agent.service");
18
+ let CredentialDefinitionController = class CredentialDefinitionController {
19
+ constructor(agentService) {
20
+ this.agentService = agentService;
21
+ }
22
+ async getCredentialDefinition(params) {
23
+ const agent = await this.agentService.getAgent();
24
+ const getCredentialDefinitionReturn = await agent.modules.anoncreds.getCredentialDefinition(params.credentialDefinitionId);
25
+ return getCredentialDefinitionReturn;
26
+ }
27
+ };
28
+ __decorate([
29
+ (0, common_1.Get)("/:credentialDefinitionId"),
30
+ __param(0, (0, common_1.Param)()),
31
+ __metadata("design:type", Function),
32
+ __metadata("design:paramtypes", [Object]),
33
+ __metadata("design:returntype", Promise)
34
+ ], CredentialDefinitionController.prototype, "getCredentialDefinition", null);
35
+ CredentialDefinitionController = __decorate([
36
+ (0, common_1.Controller)("credential-definition"),
37
+ __metadata("design:paramtypes", [agent_service_1.AgentService])
38
+ ], CredentialDefinitionController);
39
+ exports.CredentialDefinitionController = CredentialDefinitionController;
40
+ //# sourceMappingURL=creddef.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"creddef.controller.js","sourceRoot":"","sources":["../src/creddef.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAuD;AACvD,mDAA8C;AAIvC,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IACzC,YAA6B,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;IAAG,CAAC;IAG9C,AAAN,KAAK,CAAC,uBAAuB,CAAU,MAAM;QAClD,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAA;QAEhD,MAAM,6BAA6B,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,uBAAuB,CACzF,MAAM,CAAC,sBAAsB,CAC9B,CAAA;QACD,OAAO,6BAA6B,CAAA;IACtC,CAAC;CACF,CAAA;AARc;IADZ,IAAA,YAAG,EAAC,0BAA0B,CAAC;IACM,WAAA,IAAA,cAAK,GAAE,CAAA;;;;6EAO5C;AAXU,8BAA8B;IAD1C,IAAA,mBAAU,EAAC,uBAAuB,CAAC;qCAES,4BAAY;GAD5C,8BAA8B,CAY1C;AAZY,wEAA8B"}
@@ -0,0 +1,7 @@
1
+ import { DidResolutionResult } from "@credo-ts/core";
2
+ import { AgentService } from "./agent.service";
3
+ export declare class DidController {
4
+ private readonly agentService;
5
+ constructor(agentService: AgentService);
6
+ getDid(params: any): Promise<DidResolutionResult>;
7
+ }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.DidController = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const agent_service_1 = require("./agent.service");
18
+ const legacyIndyDidRegex = /^[a-zA-Z0-9]{21,22}$/;
19
+ let DidController = class DidController {
20
+ constructor(agentService) {
21
+ this.agentService = agentService;
22
+ }
23
+ async getDid(params) {
24
+ const agent = await this.agentService.getAgent();
25
+ const did = params.did.match(legacyIndyDidRegex) ? `did:sov:${params.did}` : params.did;
26
+ const didResolutionResult = await agent.dids.resolve(did);
27
+ return didResolutionResult;
28
+ }
29
+ };
30
+ __decorate([
31
+ (0, common_1.Get)("/:did"),
32
+ __param(0, (0, common_1.Param)()),
33
+ __metadata("design:type", Function),
34
+ __metadata("design:paramtypes", [Object]),
35
+ __metadata("design:returntype", Promise)
36
+ ], DidController.prototype, "getDid", null);
37
+ DidController = __decorate([
38
+ (0, common_1.Controller)("did"),
39
+ __metadata("design:paramtypes", [agent_service_1.AgentService])
40
+ ], DidController);
41
+ exports.DidController = DidController;
42
+ //# sourceMappingURL=did.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"did.controller.js","sourceRoot":"","sources":["../src/did.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,2CAAuD;AACvD,mDAA8C;AAE9C,MAAM,kBAAkB,GAAG,sBAAsB,CAAA;AAG1C,IAAM,aAAa,GAAnB,MAAM,aAAa;IACxB,YAA6B,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;IAAG,CAAC;IAG9C,AAAN,KAAK,CAAC,MAAM,CAAU,MAAM;QACjC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAA;QAEhD,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,WAAW,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAA;QACvF,MAAM,mBAAmB,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QACzD,OAAO,mBAAmB,CAAA;IAC5B,CAAC;CACF,CAAA;AAPc;IADZ,IAAA,YAAG,EAAC,OAAO,CAAC;IACQ,WAAA,IAAA,cAAK,GAAE,CAAA;;;;2CAM3B;AAVU,aAAa;IADzB,IAAA,mBAAU,EAAC,KAAK,CAAC;qCAE2B,4BAAY;GAD5C,aAAa,CAWzB;AAXY,sCAAa"}
@@ -0,0 +1,2 @@
1
+ export { IndyVdrProxyModule } from "./app.module";
2
+ export { IndyVdrProxyAgent, setupAgent } from "./agent";
package/build/index.js ADDED
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setupAgent = exports.IndyVdrProxyModule = void 0;
4
+ var app_module_1 = require("./app.module");
5
+ Object.defineProperty(exports, "IndyVdrProxyModule", { enumerable: true, get: function () { return app_module_1.IndyVdrProxyModule; } });
6
+ var agent_1 = require("./agent");
7
+ Object.defineProperty(exports, "setupAgent", { enumerable: true, get: function () { return agent_1.setupAgent; } });
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,2CAAiD;AAAxC,gHAAA,kBAAkB,OAAA;AAC3B,iCAAuD;AAA3B,mGAAA,UAAU,OAAA"}
@@ -0,0 +1 @@
1
+ export {};
package/build/main.js ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@nestjs/core");
4
+ const agent_1 = require("./agent");
5
+ const app_module_1 = require("./app.module");
6
+ const fs_1 = require("fs");
7
+ const common_1 = require("@nestjs/common");
8
+ const core_2 = require("@credo-ts/core");
9
+ async function bootstrap() {
10
+ var _a, _b;
11
+ const configPath = (_a = process.env.INDY_VDR_PROXY_CONFIG_PATH) !== null && _a !== void 0 ? _a : "./res/app.config.json";
12
+ common_1.Logger.debug(`Bootstrapping Indy VDR Proxy Server with config file ${configPath}`);
13
+ const config = JSON.parse((0, fs_1.readFileSync)(configPath, { encoding: "utf-8" }));
14
+ const networks = config.networks;
15
+ const app = await core_1.NestFactory.create(app_module_1.IndyVdrProxyModule.register((0, agent_1.setupAgent)({ networks, logger: new core_2.ConsoleLogger(config.logLevel) })));
16
+ await app.listen((_b = config.port) !== null && _b !== void 0 ? _b : 3000);
17
+ }
18
+ bootstrap();
19
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;AACA,uCAA0C;AAC1C,mCAAoC;AACpC,6CAAiD;AAEjD,2BAAiC;AACjC,2CAAuC;AACvC,yCAA8C;AAE9C,KAAK,UAAU,SAAS;;IACtB,MAAM,UAAU,GAAG,MAAA,OAAO,CAAC,GAAG,CAAC,0BAA0B,mCAAI,uBAAuB,CAAA;IACpF,eAAM,CAAC,KAAK,CAAC,wDAAwD,UAAU,EAAE,CAAC,CAAA;IAClF,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAA,iBAAY,EAAC,UAAU,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,CAAA;IAE1E,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAuD,CAAA;IAE/E,MAAM,GAAG,GAAG,MAAM,kBAAW,CAAC,MAAM,CAClC,+BAAkB,CAAC,QAAQ,CAAC,IAAA,kBAAU,EAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,oBAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAClG,CAAA;IACD,MAAM,GAAG,CAAC,MAAM,CAAC,MAAA,MAAM,CAAC,IAAI,mCAAI,IAAI,CAAC,CAAA;AACvC,CAAC;AACD,SAAS,EAAE,CAAA"}
@@ -0,0 +1,7 @@
1
+ import { AgentService } from "./agent.service";
2
+ import { GetRevocationRegistryDefinitionReturn } from "@credo-ts/anoncreds/build/services/registry";
3
+ export declare class RevocationRegistryDefinitionController {
4
+ private readonly agentService;
5
+ constructor(agentService: AgentService);
6
+ getRevocationRegistryDefinition(params: any): Promise<GetRevocationRegistryDefinitionReturn>;
7
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.RevocationRegistryDefinitionController = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const agent_service_1 = require("./agent.service");
18
+ let RevocationRegistryDefinitionController = class RevocationRegistryDefinitionController {
19
+ constructor(agentService) {
20
+ this.agentService = agentService;
21
+ }
22
+ async getRevocationRegistryDefinition(params) {
23
+ const agent = await this.agentService.getAgent();
24
+ const getRevocationRegistryDefinitionReturn = await agent.modules.anoncreds.getRevocationRegistryDefinition(params.revocationRegistryDefinition);
25
+ return getRevocationRegistryDefinitionReturn;
26
+ }
27
+ };
28
+ __decorate([
29
+ (0, common_1.Get)("/:revocationRegistryDefinition"),
30
+ __param(0, (0, common_1.Param)()),
31
+ __metadata("design:type", Function),
32
+ __metadata("design:paramtypes", [Object]),
33
+ __metadata("design:returntype", Promise)
34
+ ], RevocationRegistryDefinitionController.prototype, "getRevocationRegistryDefinition", null);
35
+ RevocationRegistryDefinitionController = __decorate([
36
+ (0, common_1.Controller)("revocation-registry-definition"),
37
+ __metadata("design:paramtypes", [agent_service_1.AgentService])
38
+ ], RevocationRegistryDefinitionController);
39
+ exports.RevocationRegistryDefinitionController = RevocationRegistryDefinitionController;
40
+ //# sourceMappingURL=revregdef.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"revregdef.controller.js","sourceRoot":"","sources":["../src/revregdef.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAuD;AACvD,mDAA8C;AAIvC,IAAM,sCAAsC,GAA5C,MAAM,sCAAsC;IACjD,YAA6B,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;IAAG,CAAC;IAG9C,AAAN,KAAK,CAAC,+BAA+B,CAAU,MAAM;QAC1D,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAA;QAChD,MAAM,qCAAqC,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,+BAA+B,CACzG,MAAM,CAAC,4BAA4B,CACpC,CAAA;QACD,OAAO,qCAAqC,CAAA;IAC9C,CAAC;CACF,CAAA;AAPc;IADZ,IAAA,YAAG,EAAC,gCAAgC,CAAC;IACQ,WAAA,IAAA,cAAK,GAAE,CAAA;;;;6FAMpD;AAVU,sCAAsC;IADlD,IAAA,mBAAU,EAAC,gCAAgC,CAAC;qCAEA,4BAAY;GAD5C,sCAAsC,CAWlD;AAXY,wFAAsC"}
@@ -0,0 +1,7 @@
1
+ import { AgentService } from "./agent.service";
2
+ import { GetRevocationStatusListReturn } from "@credo-ts/anoncreds/build/services/registry";
3
+ export declare class RevocationStatusListController {
4
+ private readonly agentService;
5
+ constructor(agentService: AgentService);
6
+ getRevocationRegistryDefinition(params: any): Promise<GetRevocationStatusListReturn>;
7
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.RevocationStatusListController = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const agent_service_1 = require("./agent.service");
18
+ let RevocationStatusListController = class RevocationStatusListController {
19
+ constructor(agentService) {
20
+ this.agentService = agentService;
21
+ }
22
+ async getRevocationRegistryDefinition(params) {
23
+ const agent = await this.agentService.getAgent();
24
+ const getRevocationStatusListReturn = await agent.modules.anoncreds.getRevocationStatusList(params.revocationRegistryDefinition, params.timestamp);
25
+ return getRevocationStatusListReturn;
26
+ }
27
+ };
28
+ __decorate([
29
+ (0, common_1.Get)("/:revocationRegistryDefinition/:timestamp"),
30
+ __param(0, (0, common_1.Param)()),
31
+ __metadata("design:type", Function),
32
+ __metadata("design:paramtypes", [Object]),
33
+ __metadata("design:returntype", Promise)
34
+ ], RevocationStatusListController.prototype, "getRevocationRegistryDefinition", null);
35
+ RevocationStatusListController = __decorate([
36
+ (0, common_1.Controller)("revocation-status-list"),
37
+ __metadata("design:paramtypes", [agent_service_1.AgentService])
38
+ ], RevocationStatusListController);
39
+ exports.RevocationStatusListController = RevocationStatusListController;
40
+ //# sourceMappingURL=revstatuslist.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"revstatuslist.controller.js","sourceRoot":"","sources":["../src/revstatuslist.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAuD;AACvD,mDAA8C;AAIvC,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IACzC,YAA6B,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;IAAG,CAAC;IAG9C,AAAN,KAAK,CAAC,+BAA+B,CAAU,MAAM;QAC1D,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAA;QAEhD,MAAM,6BAA6B,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,uBAAuB,CACzF,MAAM,CAAC,4BAA4B,EACnC,MAAM,CAAC,SAAS,CACjB,CAAA;QACD,OAAO,6BAA6B,CAAA;IACtC,CAAC;CACF,CAAA;AATc;IADZ,IAAA,YAAG,EAAC,2CAA2C,CAAC;IACH,WAAA,IAAA,cAAK,GAAE,CAAA;;;;qFAQpD;AAZU,8BAA8B;IAD1C,IAAA,mBAAU,EAAC,wBAAwB,CAAC;qCAEQ,4BAAY;GAD5C,8BAA8B,CAa1C;AAbY,wEAA8B"}
@@ -0,0 +1,7 @@
1
+ import { AgentService } from "./agent.service";
2
+ import { GetSchemaReturn } from "@credo-ts/anoncreds/build/services/registry";
3
+ export declare class SchemaController {
4
+ private readonly agentService;
5
+ constructor(agentService: AgentService);
6
+ getSchema(params: any): Promise<GetSchemaReturn>;
7
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.SchemaController = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const agent_service_1 = require("./agent.service");
18
+ let SchemaController = class SchemaController {
19
+ constructor(agentService) {
20
+ this.agentService = agentService;
21
+ }
22
+ async getSchema(params) {
23
+ const agent = await this.agentService.getAgent();
24
+ const getSchemaReturn = await agent.modules.anoncreds.getSchema(params.schemaId);
25
+ return getSchemaReturn;
26
+ }
27
+ };
28
+ __decorate([
29
+ (0, common_1.Get)("/:schemaId"),
30
+ __param(0, (0, common_1.Param)()),
31
+ __metadata("design:type", Function),
32
+ __metadata("design:paramtypes", [Object]),
33
+ __metadata("design:returntype", Promise)
34
+ ], SchemaController.prototype, "getSchema", null);
35
+ SchemaController = __decorate([
36
+ (0, common_1.Controller)("schema"),
37
+ __metadata("design:paramtypes", [agent_service_1.AgentService])
38
+ ], SchemaController);
39
+ exports.SchemaController = SchemaController;
40
+ //# sourceMappingURL=schema.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.controller.js","sourceRoot":"","sources":["../src/schema.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAuD;AACvD,mDAA8C;AAIvC,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAC3B,YAA6B,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;IAAG,CAAC;IAG9C,AAAN,KAAK,CAAC,SAAS,CAAU,MAAM;QACpC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAA;QAEhD,MAAM,eAAe,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;QAChF,OAAO,eAAe,CAAA;IACxB,CAAC;CACF,CAAA;AANc;IADZ,IAAA,YAAG,EAAC,YAAY,CAAC;IACM,WAAA,IAAA,cAAK,GAAE,CAAA;;;;iDAK9B;AATU,gBAAgB;IAD5B,IAAA,mBAAU,EAAC,QAAQ,CAAC;qCAEwB,4BAAY;GAD5C,gBAAgB,CAU5B;AAVY,4CAAgB"}
package/package.json ADDED
@@ -0,0 +1,91 @@
1
+ {
2
+ "name": "credo-ts-indy-vdr-proxy-server",
3
+ "version": "0.1.0",
4
+ "description": "Indy VDR Proxy server based on credo-ts",
5
+ "author": "2060.io",
6
+ "homepage": "https://github.com/2060-io/credo-ts-indy-vdr-proxy",
7
+ "license": "ISC",
8
+ "main": "build/index.js",
9
+ "types": "build/index.js",
10
+ "files": [
11
+ "build"
12
+ ],
13
+ "scripts": {
14
+ "build": "yarn run clean && yarn run compile",
15
+ "clean": "rimraf -rf ./build",
16
+ "compile": "tsc -p tsconfig.build.json",
17
+ "prepublishOnly": "yarn run build",
18
+ "check-types": "tsc --noEmit -p tsconfig.build.json",
19
+ "check-format": "yarn prettier --check",
20
+ "prettier": "prettier --ignore-path .gitignore '**/*.+(js|json|ts|md|yml|yaml)'",
21
+ "start": "nest start"
22
+ },
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "https://github.com/2060-io/credo-ts-indy-vdr-proxy",
26
+ "directory": "packages/server"
27
+ },
28
+ "bugs": {
29
+ "url": "https://github.com/2060-io/credo-ts-indy-vdr-proxy/issues"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
34
+ "dependencies": {
35
+ "@credo-ts/anoncreds": "^0.5.0-alpha.116",
36
+ "@credo-ts/askar": "^0.5.0-alpha.116",
37
+ "@credo-ts/core": "^0.5.0-alpha.116",
38
+ "@credo-ts/indy-vdr": "^0.5.0-alpha.116",
39
+ "@credo-ts/node": "^0.5.0-alpha.116",
40
+ "@hyperledger/anoncreds-shared": "^0.2.0-dev.9",
41
+ "@hyperledger/anoncreds-nodejs": "^0.2.0-dev.9",
42
+ "@hyperledger/aries-askar-nodejs": "^0.2.0-dev.6",
43
+ "@hyperledger/indy-vdr-nodejs": "^0.2.0-dev.6",
44
+ "@nestjs/common": "^9.0.0",
45
+ "@nestjs/core": "^9.0.0",
46
+ "@nestjs/platform-express": "^9.0.0",
47
+ "reflect-metadata": "^0.1.13",
48
+ "rxjs": "^7.2.0"
49
+ },
50
+ "devDependencies": {
51
+ "@nestjs/cli": "^9.0.0",
52
+ "@nestjs/schematics": "^9.0.0",
53
+ "@nestjs/testing": "^9.0.0",
54
+ "@types/express": "^4.17.13",
55
+ "@types/jest": "29.5.11",
56
+ "@types/node": "18.11.18",
57
+ "@types/ref-struct-di": "^1.1.8",
58
+ "@types/supertest": "^2.0.11",
59
+ "@typescript-eslint/eslint-plugin": "^5.0.0",
60
+ "@typescript-eslint/parser": "^5.0.0",
61
+ "eslint": "^8.0.1",
62
+ "eslint-config-prettier": "^8.3.0",
63
+ "eslint-plugin-prettier": "^4.0.0",
64
+ "jest": "29.7.0",
65
+ "prettier": "^2.3.2",
66
+ "source-map-support": "^0.5.20",
67
+ "supertest": "^6.1.3",
68
+ "ts-jest": "29.0.3",
69
+ "ts-loader": "^9.2.3",
70
+ "ts-node": "^10.0.0",
71
+ "tsconfig-paths": "4.1.1",
72
+ "typescript": "^4.7.4"
73
+ },
74
+ "jest": {
75
+ "moduleFileExtensions": [
76
+ "js",
77
+ "json",
78
+ "ts"
79
+ ],
80
+ "rootDir": "src",
81
+ "testRegex": ".*\\.spec\\.ts$",
82
+ "transform": {
83
+ "^.+\\.(t|j)s$": "ts-jest"
84
+ },
85
+ "collectCoverageFrom": [
86
+ "**/*.(t|j)s"
87
+ ],
88
+ "coverageDirectory": "../coverage",
89
+ "testEnvironment": "node"
90
+ }
91
+ }