@credo-ts/cheqd 0.7.2-pr-2704-20260918194459 → 0.7.2
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/build/CheqdApi.d.mts +3 -6
- package/build/CheqdApi.d.mts.map +1 -1
- package/build/CheqdApi.mjs +4 -6
- package/build/CheqdApi.mjs.map +1 -1
- package/build/CheqdModule.d.mts +1 -3
- package/build/CheqdModule.d.mts.map +1 -1
- package/build/CheqdModule.mjs +1 -2
- package/build/CheqdModule.mjs.map +1 -1
- package/build/CheqdModuleConfig.d.mts +3 -4
- package/build/CheqdModuleConfig.d.mts.map +1 -1
- package/build/CheqdModuleConfig.mjs +1 -1
- package/build/CheqdModuleConfig.mjs.map +1 -1
- package/build/_virtual/{_@oxc-project_runtime@0.112.0/helpers → _@oxc-project_runtime@0.151.0/helpers/esm}/decorate.mjs +2 -3
- package/build/_virtual/{_@oxc-project_runtime@0.112.0/helpers → _@oxc-project_runtime@0.151.0/helpers/esm}/decorateMetadata.mjs +2 -3
- package/build/_virtual/{_@oxc-project_runtime@0.112.0/helpers → _@oxc-project_runtime@0.151.0/helpers/esm}/decorateParam.mjs +2 -3
- package/build/anoncreds/index.d.mts +2 -1
- package/build/anoncreds/index.mjs +1 -0
- package/build/anoncreds/services/CheqdAnonCredsRegistry.d.mts +3 -11
- package/build/anoncreds/services/CheqdAnonCredsRegistry.d.mts.map +1 -1
- package/build/anoncreds/services/CheqdAnonCredsRegistry.mjs +1 -2
- package/build/anoncreds/services/CheqdAnonCredsRegistry.mjs.map +1 -1
- package/build/anoncreds/utils/identifiers.mjs +2 -5
- package/build/anoncreds/utils/identifiers.mjs.map +1 -1
- package/build/anoncreds/utils/transform.mjs +9 -11
- package/build/anoncreds/utils/transform.mjs.map +1 -1
- package/build/dids/CheqdDidRegistrar.d.mts +7 -9
- package/build/dids/CheqdDidRegistrar.d.mts.map +1 -1
- package/build/dids/CheqdDidRegistrar.mjs +6 -7
- package/build/dids/CheqdDidRegistrar.mjs.map +1 -1
- package/build/dids/CheqdDidResolver.d.mts +1 -3
- package/build/dids/CheqdDidResolver.d.mts.map +1 -1
- package/build/dids/CheqdDidResolver.mjs +1 -2
- package/build/dids/CheqdDidResolver.mjs.map +1 -1
- package/build/dids/didCheqdUtil.mjs +4 -4
- package/build/dids/didCheqdUtil.mjs.map +1 -1
- package/build/dids/index.d.mts +2 -1
- package/build/dids/index.mjs +1 -0
- package/build/index.mjs +1 -2
- package/build/ledger/CheqdLedgerService.d.mts +2 -5
- package/build/ledger/CheqdLedgerService.d.mts.map +1 -1
- package/build/ledger/CheqdLedgerService.mjs +6 -13
- package/build/ledger/CheqdLedgerService.mjs.map +1 -1
- package/build/ledger/index.d.mts +2 -1
- package/build/ledger/index.mjs +1 -0
- package/package.json +11 -6
package/build/CheqdApi.d.mts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { CheqdCreateResourceOptions } from "./dids/CheqdDidRegistrar.mjs";
|
|
2
2
|
import "./dids/index.mjs";
|
|
3
3
|
import { AgentContext } from "@credo-ts/core";
|
|
4
|
-
import * as _cheqd_ts_proto_cheqd_resource_v20 from "@cheqd/ts-proto/cheqd/resource/v2";
|
|
5
|
-
|
|
6
4
|
//#region src/CheqdApi.d.ts
|
|
7
|
-
declare class CheqdApi {
|
|
5
|
+
export declare class CheqdApi {
|
|
8
6
|
private agentContext;
|
|
9
7
|
constructor(agentContext: AgentContext);
|
|
10
8
|
createResource(did: string, options: CheqdCreateResourceOptions): Promise<{
|
|
@@ -22,7 +20,7 @@ declare class CheqdApi {
|
|
|
22
20
|
resourceState: {
|
|
23
21
|
state: string;
|
|
24
22
|
resourceId: string;
|
|
25
|
-
resource:
|
|
23
|
+
resource: import("@cheqd/ts-proto/cheqd/resource/v2").MsgCreateResourcePayload;
|
|
26
24
|
reason?: undefined;
|
|
27
25
|
};
|
|
28
26
|
}>;
|
|
@@ -34,12 +32,11 @@ declare class CheqdApi {
|
|
|
34
32
|
resourceResolutionMetadata?: undefined;
|
|
35
33
|
} | {
|
|
36
34
|
resource: any;
|
|
37
|
-
resourceMetadata:
|
|
35
|
+
resourceMetadata: import("@cheqd/ts-proto/cheqd/resource/v2").Metadata;
|
|
38
36
|
resourceResolutionMetadata: {};
|
|
39
37
|
error?: undefined;
|
|
40
38
|
message?: undefined;
|
|
41
39
|
}>;
|
|
42
40
|
}
|
|
43
41
|
//#endregion
|
|
44
|
-
export { CheqdApi };
|
|
45
42
|
//# sourceMappingURL=CheqdApi.d.mts.map
|
package/build/CheqdApi.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheqdApi.d.mts","names":[],"sources":["../src/CheqdApi.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"CheqdApi.d.mts","names":[],"sources":["../src/CheqdApi.ts"],"mappings":";;;;qBAKa;UACH;EAEW,YAAA,cAAc;EAIpB,eAAe,aAAa,SAAS,6BAA0B;;;;;;;;;;;;;;;;;;;EAK/D,gBAAgB,sBAAmB"}
|
package/build/CheqdApi.mjs
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import __decorateMetadata from "./_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorateMetadata.mjs";
|
|
2
|
+
import __decorate from "./_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorate.mjs";
|
|
3
3
|
import { CheqdDidRegistrar } from "./dids/CheqdDidRegistrar.mjs";
|
|
4
4
|
import { CheqdDidResolver } from "./dids/CheqdDidResolver.mjs";
|
|
5
5
|
import "./dids/index.mjs";
|
|
6
6
|
import { AgentContext, injectable } from "@credo-ts/core";
|
|
7
|
-
|
|
8
7
|
//#region src/CheqdApi.ts
|
|
9
|
-
var _ref;
|
|
10
8
|
let CheqdApi = class CheqdApi {
|
|
11
9
|
constructor(agentContext) {
|
|
12
10
|
this.agentContext = agentContext;
|
|
@@ -18,8 +16,8 @@ let CheqdApi = class CheqdApi {
|
|
|
18
16
|
return await this.agentContext.dependencyManager.resolve(CheqdDidResolver).resolveResource(this.agentContext, resourceUrl);
|
|
19
17
|
}
|
|
20
18
|
};
|
|
21
|
-
CheqdApi = __decorate([injectable(), __decorateMetadata("design:paramtypes", [typeof
|
|
22
|
-
|
|
19
|
+
CheqdApi = __decorate([injectable(), __decorateMetadata("design:paramtypes", [typeof AgentContext === "undefined" ? Object : AgentContext])], CheqdApi);
|
|
23
20
|
//#endregion
|
|
24
21
|
export { CheqdApi };
|
|
22
|
+
|
|
25
23
|
//# sourceMappingURL=CheqdApi.mjs.map
|
package/build/CheqdApi.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheqdApi.mjs","names":[],"sources":["../src/CheqdApi.ts"],"sourcesContent":["import { AgentContext, injectable } from '@credo-ts/core'\n\nimport { type CheqdCreateResourceOptions, CheqdDidRegistrar, CheqdDidResolver } from './dids'\n\n@injectable()\nexport class CheqdApi {\n private agentContext: AgentContext\n\n public constructor(agentContext: AgentContext) {\n this.agentContext = agentContext\n }\n\n public async createResource(did: string, options: CheqdCreateResourceOptions) {\n const cheqdDidRegistrar = this.agentContext.dependencyManager.resolve(CheqdDidRegistrar)\n return await cheqdDidRegistrar.createResource(this.agentContext, did, options)\n }\n\n public async resolveResource(resourceUrl: string) {\n const cheqdDidResolver = this.agentContext.dependencyManager.resolve(CheqdDidResolver)\n return await cheqdDidResolver.resolveResource(this.agentContext, resourceUrl)\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"CheqdApi.mjs","names":[],"sources":["../src/CheqdApi.ts"],"sourcesContent":["import { AgentContext, injectable } from '@credo-ts/core'\n\nimport { type CheqdCreateResourceOptions, CheqdDidRegistrar, CheqdDidResolver } from './dids'\n\n@injectable()\nexport class CheqdApi {\n private agentContext: AgentContext\n\n public constructor(agentContext: AgentContext) {\n this.agentContext = agentContext\n }\n\n public async createResource(did: string, options: CheqdCreateResourceOptions) {\n const cheqdDidRegistrar = this.agentContext.dependencyManager.resolve(CheqdDidRegistrar)\n return await cheqdDidRegistrar.createResource(this.agentContext, did, options)\n }\n\n public async resolveResource(resourceUrl: string) {\n const cheqdDidResolver = this.agentContext.dependencyManager.resolve(CheqdDidResolver)\n return await cheqdDidResolver.resolveResource(this.agentContext, resourceUrl)\n }\n}\n"],"mappings":";;;;;;;AAKO,IAAM,WAAN,MAAM,SAAS;CAGpB,YAAmB,cAA4B;EAC7C,KAAK,eAAe;CACtB;CAEA,MAAa,eAAe,KAAa,SAAqC;EAE5E,OAAO,MADmB,KAAK,aAAa,kBAAkB,QAAQ,iBACzC,CAAC,CAAC,eAAe,KAAK,cAAc,KAAK,OAAO;CAC/E;CAEA,MAAa,gBAAgB,aAAqB;EAEhD,OAAO,MADkB,KAAK,aAAa,kBAAkB,QAAQ,gBACzC,CAAC,CAAC,gBAAgB,KAAK,cAAc,WAAW;CAC9E;AACF;AAjBC,WAAA,WAAA,CAAA,WAAW,GAAA,mBAAA,qBAAA,CAAA,OAAA,iBAAA,cAAA,SAAA,YAAA,CAAA,CAAA,GAAA,QAAA"}
|
package/build/CheqdModule.d.mts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { CheqdApi } from "./CheqdApi.mjs";
|
|
2
2
|
import { CheqdModuleConfig, CheqdModuleConfigOptions } from "./CheqdModuleConfig.mjs";
|
|
3
3
|
import { AgentContext, DependencyManager, Module } from "@credo-ts/core";
|
|
4
|
-
|
|
5
4
|
//#region src/CheqdModule.d.ts
|
|
6
|
-
declare class CheqdModule implements Module {
|
|
5
|
+
export declare class CheqdModule implements Module {
|
|
7
6
|
readonly config: CheqdModuleConfig;
|
|
8
7
|
readonly api: typeof CheqdApi;
|
|
9
8
|
constructor(config: CheqdModuleConfigOptions);
|
|
@@ -11,5 +10,4 @@ declare class CheqdModule implements Module {
|
|
|
11
10
|
initialize(agentContext: AgentContext): Promise<void>;
|
|
12
11
|
}
|
|
13
12
|
//#endregion
|
|
14
|
-
export { CheqdModule };
|
|
15
13
|
//# sourceMappingURL=CheqdModule.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheqdModule.d.mts","names":[],"sources":["../src/CheqdModule.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"CheqdModule.d.mts","names":[],"sources":["../src/CheqdModule.ts"],"mappings":";;;;qBAOa,uBAAuB;WAClB,QAAQ;WACR,YAAG;EAEA,YAAA,QAAQ;EAIpB,SAAS,mBAAmB;EAYtB,WAAW,cAAc,eAAe"}
|
package/build/CheqdModule.mjs
CHANGED
|
@@ -3,7 +3,6 @@ import { CheqdLedgerService } from "./ledger/CheqdLedgerService.mjs";
|
|
|
3
3
|
import "./ledger/index.mjs";
|
|
4
4
|
import { CheqdApi } from "./CheqdApi.mjs";
|
|
5
5
|
import { Buffer } from "buffer";
|
|
6
|
-
|
|
7
6
|
//#region src/CheqdModule.ts
|
|
8
7
|
var CheqdModule = class {
|
|
9
8
|
constructor(config) {
|
|
@@ -19,7 +18,7 @@ var CheqdModule = class {
|
|
|
19
18
|
agentContext.dependencyManager.resolve(CheqdLedgerService).connect();
|
|
20
19
|
}
|
|
21
20
|
};
|
|
22
|
-
|
|
23
21
|
//#endregion
|
|
24
22
|
export { CheqdModule };
|
|
23
|
+
|
|
25
24
|
//# sourceMappingURL=CheqdModule.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheqdModule.mjs","names":[],"sources":["../src/CheqdModule.ts"],"sourcesContent":["import type { AgentContext, DependencyManager, Module } from '@credo-ts/core'\nimport { Buffer } from 'buffer'\nimport { CheqdApi } from './CheqdApi'\nimport type { CheqdModuleConfigOptions } from './CheqdModuleConfig'\nimport { CheqdModuleConfig } from './CheqdModuleConfig'\nimport { CheqdLedgerService } from './ledger'\n\nexport class CheqdModule implements Module {\n public readonly config: CheqdModuleConfig\n public readonly api = CheqdApi\n\n public constructor(config: CheqdModuleConfigOptions) {\n this.config = new CheqdModuleConfig(config)\n }\n\n public register(dependencyManager: DependencyManager) {\n // Register config\n dependencyManager.registerInstance(CheqdModuleConfig, this.config)\n\n dependencyManager.registerSingleton(CheqdLedgerService)\n\n // Cheqd module needs Buffer to be available globally\n // If it is not available yet, we overwrite it with the\n // Buffer implementation from Credo\n global.Buffer = global.Buffer || Buffer\n }\n\n public async initialize(agentContext: AgentContext): Promise<void> {\n // not required\n const cheqdLedgerService = agentContext.dependencyManager.resolve(CheqdLedgerService)\n // We don't await it, as it impact startup time\n void cheqdLedgerService.connect()\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"CheqdModule.mjs","names":[],"sources":["../src/CheqdModule.ts"],"sourcesContent":["import type { AgentContext, DependencyManager, Module } from '@credo-ts/core'\nimport { Buffer } from 'buffer'\nimport { CheqdApi } from './CheqdApi'\nimport type { CheqdModuleConfigOptions } from './CheqdModuleConfig'\nimport { CheqdModuleConfig } from './CheqdModuleConfig'\nimport { CheqdLedgerService } from './ledger'\n\nexport class CheqdModule implements Module {\n public readonly config: CheqdModuleConfig\n public readonly api = CheqdApi\n\n public constructor(config: CheqdModuleConfigOptions) {\n this.config = new CheqdModuleConfig(config)\n }\n\n public register(dependencyManager: DependencyManager) {\n // Register config\n dependencyManager.registerInstance(CheqdModuleConfig, this.config)\n\n dependencyManager.registerSingleton(CheqdLedgerService)\n\n // Cheqd module needs Buffer to be available globally\n // If it is not available yet, we overwrite it with the\n // Buffer implementation from Credo\n global.Buffer = global.Buffer || Buffer\n }\n\n public async initialize(agentContext: AgentContext): Promise<void> {\n // not required\n const cheqdLedgerService = agentContext.dependencyManager.resolve(CheqdLedgerService)\n // We don't await it, as it impact startup time\n void cheqdLedgerService.connect()\n }\n}\n"],"mappings":";;;;;;AAOA,IAAa,cAAb,MAA2C;CAIzC,YAAmB,QAAkC;EAFrD,KAAgB,MAAM;EAGpB,KAAK,SAAS,IAAI,kBAAkB,MAAM;CAC5C;CAEA,SAAgB,mBAAsC;EAEpD,kBAAkB,iBAAiB,mBAAmB,KAAK,MAAM;EAEjE,kBAAkB,kBAAkB,kBAAkB;EAKtD,OAAO,SAAS,OAAO,UAAU;CACnC;CAEA,MAAa,WAAW,cAA2C;EAIjE,aAFwC,kBAAkB,QAAQ,kBAE5C,CAAC,CAAC,QAAQ;CAClC;AACF"}
|
|
@@ -2,20 +2,19 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* CheqdModuleConfigOptions defines the interface for the options of the CheqdModuleConfig class.
|
|
4
4
|
*/
|
|
5
|
-
interface CheqdModuleConfigOptions {
|
|
5
|
+
export interface CheqdModuleConfigOptions {
|
|
6
6
|
networks: NetworkConfig[];
|
|
7
7
|
}
|
|
8
|
-
interface NetworkConfig {
|
|
8
|
+
export interface NetworkConfig {
|
|
9
9
|
rpcUrl?: string;
|
|
10
10
|
cosmosPayerSeed?: string;
|
|
11
11
|
network: string;
|
|
12
12
|
}
|
|
13
|
-
declare class CheqdModuleConfig {
|
|
13
|
+
export declare class CheqdModuleConfig {
|
|
14
14
|
private options;
|
|
15
15
|
constructor(options: CheqdModuleConfigOptions);
|
|
16
16
|
/** See {@link CheqdModuleConfigOptions.networks} */
|
|
17
17
|
get networks(): NetworkConfig[];
|
|
18
18
|
}
|
|
19
19
|
//#endregion
|
|
20
|
-
export { CheqdModuleConfig, CheqdModuleConfigOptions };
|
|
21
20
|
//# sourceMappingURL=CheqdModuleConfig.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheqdModuleConfig.d.mts","names":[],"sources":["../src/CheqdModuleConfig.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"CheqdModuleConfig.d.mts","names":[],"sources":["../src/CheqdModuleConfig.ts"],"mappings":";;;;iBAGiB;EACf,UAAU;;iBAGK;EACf;EACA;EACA;;qBAGW;UACH;EAEW,YAAA,SAAS;;MAKjB,YAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheqdModuleConfig.mjs","names":[],"sources":["../src/CheqdModuleConfig.ts"],"sourcesContent":["/**\n * CheqdModuleConfigOptions defines the interface for the options of the CheqdModuleConfig class.\n */\nexport interface CheqdModuleConfigOptions {\n networks: NetworkConfig[]\n}\n\nexport interface NetworkConfig {\n rpcUrl?: string\n cosmosPayerSeed?: string\n network: string\n}\n\nexport class CheqdModuleConfig {\n private options: CheqdModuleConfigOptions\n\n public constructor(options: CheqdModuleConfigOptions) {\n this.options = options\n }\n\n /** See {@link CheqdModuleConfigOptions.networks} */\n public get networks() {\n return this.options.networks\n }\n}\n"],"mappings":";AAaA,IAAa,oBAAb,MAA+B;CAG7B,
|
|
1
|
+
{"version":3,"file":"CheqdModuleConfig.mjs","names":[],"sources":["../src/CheqdModuleConfig.ts"],"sourcesContent":["/**\n * CheqdModuleConfigOptions defines the interface for the options of the CheqdModuleConfig class.\n */\nexport interface CheqdModuleConfigOptions {\n networks: NetworkConfig[]\n}\n\nexport interface NetworkConfig {\n rpcUrl?: string\n cosmosPayerSeed?: string\n network: string\n}\n\nexport class CheqdModuleConfig {\n private options: CheqdModuleConfigOptions\n\n public constructor(options: CheqdModuleConfigOptions) {\n this.options = options\n }\n\n /** See {@link CheqdModuleConfigOptions.networks} */\n public get networks() {\n return this.options.networks\n }\n}\n"],"mappings":";AAaA,IAAa,oBAAb,MAA+B;CAG7B,YAAmB,SAAmC;EACpD,KAAK,UAAU;CACjB;;CAGA,IAAW,WAAW;EACpB,OAAO,KAAK,QAAQ;CACtB;AACF"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
//#region \0@oxc-project+runtime@0.
|
|
1
|
+
//#region \0@oxc-project+runtime@0.151.0/helpers/esm/decorate.js
|
|
2
2
|
function __decorate(decorators, target, key, desc) {
|
|
3
3
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
4
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
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
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
}
|
|
8
|
-
|
|
9
8
|
//#endregion
|
|
10
|
-
export { __decorate };
|
|
9
|
+
export { __decorate as default };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
//#region \0@oxc-project+runtime@0.
|
|
1
|
+
//#region \0@oxc-project+runtime@0.151.0/helpers/esm/decorateMetadata.js
|
|
2
2
|
function __decorateMetadata(k, v) {
|
|
3
3
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
4
4
|
}
|
|
5
|
-
|
|
6
5
|
//#endregion
|
|
7
|
-
export { __decorateMetadata };
|
|
6
|
+
export { __decorateMetadata as default };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
//#region \0@oxc-project+runtime@0.
|
|
1
|
+
//#region \0@oxc-project+runtime@0.151.0/helpers/esm/decorateParam.js
|
|
2
2
|
function __decorateParam(paramIndex, decorator) {
|
|
3
3
|
return function(target, key) {
|
|
4
4
|
decorator(target, key, paramIndex);
|
|
5
5
|
};
|
|
6
6
|
}
|
|
7
|
-
|
|
8
7
|
//#endregion
|
|
9
|
-
export { __decorateParam };
|
|
8
|
+
export { __decorateParam as default };
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import { CheqdAnonCredsRegistry } from "./services/CheqdAnonCredsRegistry.mjs";
|
|
1
|
+
import { CheqdAnonCredsRegistry } from "./services/CheqdAnonCredsRegistry.mjs";
|
|
2
|
+
export { CheqdAnonCredsRegistry };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { AnonCredsRegistry, GetCredentialDefinitionReturn, GetRevocationRegistryDefinitionReturn, GetRevocationStatusListReturn, GetSchemaReturn, RegisterCredentialDefinitionOptions, RegisterCredentialDefinitionReturn, RegisterRevocationRegistryDefinitionOptions, RegisterRevocationRegistryDefinitionReturn, RegisterRevocationStatusListOptions, RegisterRevocationStatusListReturn, RegisterSchemaOptions, RegisterSchemaReturn } from "@credo-ts/anoncreds";
|
|
2
2
|
import { AgentContext } from "@credo-ts/core";
|
|
3
|
-
|
|
4
3
|
//#region src/anoncreds/services/CheqdAnonCredsRegistry.d.ts
|
|
5
|
-
declare class CheqdAnonCredsRegistry implements AnonCredsRegistry {
|
|
4
|
+
export declare class CheqdAnonCredsRegistry implements AnonCredsRegistry {
|
|
6
5
|
methodName: string;
|
|
7
6
|
allowsCaching: boolean;
|
|
8
7
|
allowsLocalRecord: boolean;
|
|
@@ -17,18 +16,11 @@ declare class CheqdAnonCredsRegistry implements AnonCredsRegistry {
|
|
|
17
16
|
registerCredentialDefinition(agentContext: AgentContext, options: RegisterCredentialDefinitionOptions): Promise<RegisterCredentialDefinitionReturn>;
|
|
18
17
|
getCredentialDefinition(agentContext: AgentContext, credentialDefinitionId: string): Promise<GetCredentialDefinitionReturn>;
|
|
19
18
|
getRevocationRegistryDefinition(agentContext: AgentContext, revocationRegistryDefinitionId: string): Promise<GetRevocationRegistryDefinitionReturn>;
|
|
20
|
-
registerRevocationRegistryDefinition(agentContext: AgentContext, {
|
|
21
|
-
revocationRegistryDefinition,
|
|
22
|
-
options
|
|
23
|
-
}: RegisterRevocationRegistryDefinitionOptions): Promise<RegisterRevocationRegistryDefinitionReturn>;
|
|
19
|
+
registerRevocationRegistryDefinition(agentContext: AgentContext, { revocationRegistryDefinition, options }: RegisterRevocationRegistryDefinitionOptions): Promise<RegisterRevocationRegistryDefinitionReturn>;
|
|
24
20
|
getRevocationStatusList(agentContext: AgentContext, revocationRegistryId: string, timestamp: number): Promise<GetRevocationStatusListReturn>;
|
|
25
21
|
private updateLocalCredentialDefinitionRecordMetadata;
|
|
26
22
|
private updateLocalRevocationRegistryDefinitionRecordMetadata;
|
|
27
|
-
registerRevocationStatusList(agentContext: AgentContext, {
|
|
28
|
-
revocationStatusList,
|
|
29
|
-
options
|
|
30
|
-
}: RegisterRevocationStatusListOptions): Promise<RegisterRevocationStatusListReturn>;
|
|
23
|
+
registerRevocationStatusList(agentContext: AgentContext, { revocationStatusList, options }: RegisterRevocationStatusListOptions): Promise<RegisterRevocationStatusListReturn>;
|
|
31
24
|
}
|
|
32
25
|
//#endregion
|
|
33
|
-
export { CheqdAnonCredsRegistry };
|
|
34
26
|
//# sourceMappingURL=CheqdAnonCredsRegistry.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheqdAnonCredsRegistry.d.mts","names":[],"sources":["../../../src/anoncreds/services/CheqdAnonCredsRegistry.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"CheqdAnonCredsRegistry.d.mts","names":[],"sources":["../../../src/anoncreds/services/CheqdAnonCredsRegistry.ts"],"mappings":";;;qBAsCa,kCAAkC;EACtC;EAEA;EACA;;;;;;WAOS,qBAAmB;EAEtB,UAAU,cAAc,cAAc,mBAAmB,QAAQ;EAyCjE,eACX,cAAc,cACd,SAAS,wBACR,QAAQ;EAkDE,6BACX,cAAc,cACd,SAAS,sCACR,QAAQ;EAqEE,wBACX,cAAc,cACd,iCACC,QAAQ;EAuCE,gCACX,cAAc,cACd,yCACC,QAAQ;EAoDE,qCACX,cAAc,gBACZ,8BAA8B,WAAW,8CAC1C,QAAQ;EA2FE,wBACX,cAAc,cACd,8BACA,oBACC,QAAQ;UA0EG;UAgCA;EAmCD,6BACX,cAAc,gBACZ,sBAAsB,WAAW,sCAClC,QAAQ"}
|
|
@@ -5,7 +5,6 @@ import "../../dids/index.mjs";
|
|
|
5
5
|
import { CheqdCredentialDefinition, CheqdRevocationRegistryDefinition, CheqdRevocationStatusList, CheqdSchema } from "../utils/transform.mjs";
|
|
6
6
|
import { AnonCredsApi, AnonCredsCredentialDefinitionRecordMetadataKeys, AnonCredsCredentialDefinitionRepository, AnonCredsRegistryService, AnonCredsRevocationRegistryDefinitionRecordMetadataKeys, AnonCredsRevocationRegistryDefinitionRepository } from "@credo-ts/anoncreds";
|
|
7
7
|
import { CredoError, Hasher, JsonTransformer, TypedArrayEncoder, utils } from "@credo-ts/core";
|
|
8
|
-
|
|
9
8
|
//#region src/anoncreds/services/CheqdAnonCredsRegistry.ts
|
|
10
9
|
var CheqdAnonCredsRegistry = class {
|
|
11
10
|
constructor() {
|
|
@@ -395,7 +394,7 @@ var CheqdAnonCredsRegistry = class {
|
|
|
395
394
|
}
|
|
396
395
|
}
|
|
397
396
|
};
|
|
398
|
-
|
|
399
397
|
//#endregion
|
|
400
398
|
export { CheqdAnonCredsRegistry };
|
|
399
|
+
|
|
401
400
|
//# sourceMappingURL=CheqdAnonCredsRegistry.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheqdAnonCredsRegistry.mjs","names":[],"sources":["../../../src/anoncreds/services/CheqdAnonCredsRegistry.ts"],"sourcesContent":["import type { Metadata } from '@cheqd/ts-proto/cheqd/resource/v2'\nimport {\n AnonCredsApi,\n AnonCredsCredentialDefinitionRecordMetadataKeys,\n AnonCredsCredentialDefinitionRepository,\n type AnonCredsRegistry,\n AnonCredsRegistryService,\n AnonCredsRevocationRegistryDefinitionRecordMetadataKeys,\n AnonCredsRevocationRegistryDefinitionRepository,\n type GetCredentialDefinitionReturn,\n type GetRevocationRegistryDefinitionReturn,\n type GetRevocationStatusListReturn,\n type GetSchemaReturn,\n type RegisterCredentialDefinitionOptions,\n type RegisterCredentialDefinitionReturn,\n type RegisterRevocationRegistryDefinitionOptions,\n type RegisterRevocationRegistryDefinitionReturn,\n type RegisterRevocationStatusListOptions,\n type RegisterRevocationStatusListReturn,\n type RegisterSchemaOptions,\n type RegisterSchemaReturn,\n} from '@credo-ts/anoncreds'\nimport type { AgentContext } from '@credo-ts/core'\nimport { CredoError, Hasher, JsonTransformer, TypedArrayEncoder, utils } from '@credo-ts/core'\nimport type { CheqdCreateResourceOptions } from '../../dids'\nimport { CheqdDidRegistrar, CheqdDidResolver } from '../../dids'\nimport {\n cheqdAnonCredsResourceTypes,\n cheqdSdkAnonCredsRegistryIdentifierRegex,\n parseCheqdDid,\n} from '../utils/identifiers'\nimport {\n CheqdCredentialDefinition,\n CheqdRevocationRegistryDefinition,\n CheqdRevocationStatusList,\n CheqdSchema,\n} from '../utils/transform'\n\nexport class CheqdAnonCredsRegistry implements AnonCredsRegistry {\n public methodName = 'cheqd'\n\n public allowsCaching = true\n public allowsLocalRecord = true\n\n /**\n * This class supports resolving and registering objects with cheqd identifiers.\n * It needs to include support for the schema, credential definition, revocation registry as well\n * as the issuer id (which is needed when registering objects).\n */\n public readonly supportedIdentifier = cheqdSdkAnonCredsRegistryIdentifierRegex\n\n public async getSchema(agentContext: AgentContext, schemaId: string): Promise<GetSchemaReturn> {\n try {\n agentContext.dependencyManager.resolve(AnonCredsApi)\n const cheqdDidResolver = agentContext.dependencyManager.resolve(CheqdDidResolver)\n const parsedDid = parseCheqdDid(schemaId)\n if (!parsedDid) throw new CredoError(`Invalid schemaId: ${schemaId}`)\n\n agentContext.config.logger.trace(`Submitting get schema request for schema '${schemaId}' to ledger`)\n\n const response = await cheqdDidResolver.resolveResource(agentContext, schemaId)\n if (response.error) throw new Error(`${response.error}: ${response.message}`)\n const schema = JsonTransformer.fromJSON(response.resource, CheqdSchema)\n\n return {\n schema: {\n attrNames: schema.attrNames,\n name: schema.name,\n version: schema.version,\n issuerId: parsedDid.did,\n },\n schemaId,\n resolutionMetadata: {},\n schemaMetadata: {},\n }\n } catch (error) {\n agentContext.config.logger.error(`Error retrieving schema '${schemaId}'`, {\n error,\n schemaId,\n })\n\n return {\n schemaId,\n resolutionMetadata: {\n error: 'notFound',\n message: `unable to resolve schema: ${error.message}`,\n },\n schemaMetadata: {},\n }\n }\n }\n\n public async registerSchema(\n agentContext: AgentContext,\n options: RegisterSchemaOptions\n ): Promise<RegisterSchemaReturn> {\n try {\n const cheqdDidRegistrar = agentContext.dependencyManager.resolve(CheqdDidRegistrar)\n\n const schema = options.schema\n const schemaResource = {\n id: utils.uuid(),\n name: `${schema.name}-Schema`,\n resourceType: cheqdAnonCredsResourceTypes.schema,\n data: {\n name: schema.name,\n version: schema.version,\n attrNames: schema.attrNames,\n },\n version: schema.version,\n } satisfies CheqdCreateResourceOptions\n\n const response = await cheqdDidRegistrar.createResource(agentContext, schema.issuerId, schemaResource)\n if (response.resourceState.state !== 'finished') {\n throw new CredoError(response.resourceState.reason ?? 'Unknown error')\n }\n\n return {\n schemaState: {\n state: 'finished',\n schema,\n schemaId: `${schema.issuerId}/resources/${schemaResource.id}`,\n },\n registrationMetadata: {},\n schemaMetadata: {},\n }\n } catch (error) {\n agentContext.config.logger.debug(`Error registering schema for did '${options.schema.issuerId}'`, {\n error,\n did: options.schema.issuerId,\n schema: options,\n })\n\n return {\n schemaMetadata: {},\n registrationMetadata: {},\n schemaState: {\n state: 'failed',\n schema: options.schema,\n reason: `unknownError: ${error.message}`,\n },\n }\n }\n }\n\n public async registerCredentialDefinition(\n agentContext: AgentContext,\n options: RegisterCredentialDefinitionOptions\n ): Promise<RegisterCredentialDefinitionReturn> {\n try {\n const cheqdDidRegistrar = agentContext.dependencyManager.resolve(CheqdDidRegistrar)\n const { credentialDefinition } = options\n const anoncredsRegistryService = agentContext.resolve(AnonCredsRegistryService)\n const schema = await anoncredsRegistryService.getSchema(agentContext, credentialDefinition.schemaId)\n if (!schema.schema) throw new CredoError(`Schema not found for schemaId: ${credentialDefinition.schemaId}`)\n\n const credDefName = `${schema.schema.name}-${credentialDefinition.tag}`\n const credDefNameHashBuffer = Hasher.hash(credDefName, 'sha-256')\n\n const credDefResource = {\n id: utils.uuid(),\n name: TypedArrayEncoder.toHex(credDefNameHashBuffer),\n resourceType: cheqdAnonCredsResourceTypes.credentialDefinition,\n data: {\n type: credentialDefinition.type,\n tag: credentialDefinition.tag,\n value: credentialDefinition.value,\n schemaId: credentialDefinition.schemaId,\n },\n version: utils.uuid(),\n } satisfies CheqdCreateResourceOptions\n\n const response = await cheqdDidRegistrar.createResource(\n agentContext,\n credentialDefinition.issuerId,\n credDefResource\n )\n if (response.resourceState.state !== 'finished')\n throw new CredoError(response.resourceState.reason ?? 'Unknown error')\n\n return {\n credentialDefinitionState: {\n state: 'finished',\n credentialDefinition,\n credentialDefinitionId: `${credentialDefinition.issuerId}/resources/${credDefResource.id}`,\n },\n registrationMetadata: {},\n // NOTE: some of these metadata fields are used for resolved items\n credentialDefinitionMetadata: {\n name: TypedArrayEncoder.toHex(credDefNameHashBuffer),\n version: credDefResource.version,\n resourceType: credDefResource.resourceType,\n id: credDefResource.id,\n } satisfies Partial<Metadata>,\n }\n } catch (error) {\n agentContext.config.logger.error(\n `Error registering credential definition for did '${options.credentialDefinition.issuerId}'`,\n {\n error,\n did: options.credentialDefinition.issuerId,\n schema: options,\n }\n )\n\n return {\n credentialDefinitionMetadata: {},\n registrationMetadata: {},\n credentialDefinitionState: {\n state: 'failed',\n credentialDefinition: options.credentialDefinition,\n reason: `unknownError: ${error.message}. ${error.stack}`,\n },\n }\n }\n }\n\n public async getCredentialDefinition(\n agentContext: AgentContext,\n credentialDefinitionId: string\n ): Promise<GetCredentialDefinitionReturn> {\n try {\n const cheqdDidResolver = agentContext.dependencyManager.resolve(CheqdDidResolver)\n const parsedDid = parseCheqdDid(credentialDefinitionId)\n if (!parsedDid) throw new CredoError(`Invalid credentialDefinitionId: ${credentialDefinitionId}`)\n\n agentContext.config.logger.trace(\n `Submitting get credential definition request for '${credentialDefinitionId}' to ledger`\n )\n\n const response = await cheqdDidResolver.resolveResource(agentContext, credentialDefinitionId)\n if (response.error) throw new Error(`${response.error}: ${response.message}`)\n const credentialDefinition = JsonTransformer.fromJSON(response.resource, CheqdCredentialDefinition)\n return {\n credentialDefinition: {\n ...credentialDefinition,\n issuerId: parsedDid.did,\n },\n credentialDefinitionId,\n resolutionMetadata: {},\n credentialDefinitionMetadata: (response.resourceMetadata ?? {}) as Record<string, unknown>,\n }\n } catch (error) {\n agentContext.config.logger.error(`Error retrieving credential definition '${credentialDefinitionId}'`, {\n error,\n credentialDefinitionId,\n })\n\n return {\n credentialDefinitionId,\n resolutionMetadata: {\n error: 'notFound',\n message: `unable to resolve credential definition: ${error.message}`,\n },\n credentialDefinitionMetadata: {},\n }\n }\n }\n\n public async getRevocationRegistryDefinition(\n agentContext: AgentContext,\n revocationRegistryDefinitionId: string\n ): Promise<GetRevocationRegistryDefinitionReturn> {\n try {\n const cheqdDidResolver = agentContext.dependencyManager.resolve(CheqdDidResolver)\n const parsedDid = parseCheqdDid(revocationRegistryDefinitionId)\n if (!parsedDid) throw new CredoError(`Invalid revocationRegistryDefinitionId: ${revocationRegistryDefinitionId}`)\n\n agentContext.config.logger.trace(\n `Submitting get revocation registry definition request for '${revocationRegistryDefinitionId}' to ledger`\n )\n\n const searchDid = parsedDid.path\n ? revocationRegistryDefinitionId\n : `${revocationRegistryDefinitionId}${revocationRegistryDefinitionId.includes('?') ? '&' : '?'}resourceType=${\n cheqdAnonCredsResourceTypes.revocationRegistryDefinition\n }`\n\n const response = await cheqdDidResolver.resolveResource(agentContext, searchDid)\n if (response.error) throw new Error(`${response.error}: ${response.message}`)\n\n const revocationRegistryDefinition = JsonTransformer.fromJSON(\n response.resource,\n CheqdRevocationRegistryDefinition\n )\n return {\n revocationRegistryDefinition: {\n ...revocationRegistryDefinition,\n issuerId: parsedDid.did,\n },\n revocationRegistryDefinitionId,\n resolutionMetadata: {},\n revocationRegistryDefinitionMetadata: (response.resourceMetadata ?? {}) as Record<string, unknown>,\n }\n } catch (error) {\n agentContext.config.logger.error(\n `Error retrieving revocation registry definition '${revocationRegistryDefinitionId}'`,\n {\n error,\n revocationRegistryDefinitionId,\n }\n )\n\n return {\n revocationRegistryDefinitionId,\n resolutionMetadata: {\n error: 'notFound',\n message: `unable to resolve revocation registry definition: ${error.message}`,\n },\n revocationRegistryDefinitionMetadata: {},\n }\n }\n }\n\n public async registerRevocationRegistryDefinition(\n agentContext: AgentContext,\n { revocationRegistryDefinition, options }: RegisterRevocationRegistryDefinitionOptions\n ): Promise<RegisterRevocationRegistryDefinitionReturn> {\n try {\n const anoncredsRegistryService = agentContext.resolve(AnonCredsRegistryService)\n let credentialDefinition = await anoncredsRegistryService.getCredentialDefinition(\n agentContext,\n revocationRegistryDefinition.credDefId\n )\n if (!credentialDefinition.credentialDefinition)\n throw new CredoError(`Credential definition not found for id: ${revocationRegistryDefinition.credDefId}`)\n\n let credentialDefinitionName = credentialDefinition.credentialDefinitionMetadata.name\n if (!credentialDefinitionName) {\n // We need to handle the case where we didn't store the metadata yet on the record. In that case we resolve\n // the fresh object and store the metadata on the record locally\n if (credentialDefinition.resolutionMetadata.servedFromRecord) {\n credentialDefinition = await this.updateLocalCredentialDefinitionRecordMetadata(\n agentContext,\n credentialDefinition\n )\n\n credentialDefinitionName = credentialDefinition.credentialDefinitionMetadata.name\n }\n\n if (!credentialDefinitionName) {\n throw new CredoError(`Credential definition name not found for id: ${revocationRegistryDefinition.credDefId}`)\n }\n }\n\n const cheqdDidRegistrar = agentContext.dependencyManager.resolve(CheqdDidRegistrar)\n\n const revocDefName = `${credentialDefinitionName}-${revocationRegistryDefinition.tag}`\n const revocDefNameHashedBuffer = Hasher.hash(revocDefName, 'sha-256')\n\n const revocationRegistryDefinitionResource = {\n id: utils.uuid(),\n name: TypedArrayEncoder.toHex(revocDefNameHashedBuffer),\n resourceType: cheqdAnonCredsResourceTypes.revocationRegistryDefinition,\n data: {\n credDefId: revocationRegistryDefinition.credDefId,\n revocDefType: revocationRegistryDefinition.revocDefType,\n tag: revocationRegistryDefinition.tag,\n value: revocationRegistryDefinition.value,\n },\n version: utils.uuid(),\n } satisfies CheqdCreateResourceOptions\n\n const response = await cheqdDidRegistrar.createResource(\n agentContext,\n revocationRegistryDefinition.issuerId,\n revocationRegistryDefinitionResource\n )\n if (response.resourceState.state !== 'finished')\n throw new CredoError(response.resourceState.reason ?? 'Unknown error')\n\n return {\n revocationRegistryDefinitionState: {\n state: 'finished',\n revocationRegistryDefinition,\n revocationRegistryDefinitionId: `${revocationRegistryDefinition.issuerId}/resources/${revocationRegistryDefinitionResource.id}`,\n },\n registrationMetadata: {},\n // NOTE: some of these metadata fields are used for resolved items\n revocationRegistryDefinitionMetadata: {\n name: revocationRegistryDefinitionResource.name,\n id: revocationRegistryDefinitionResource.id,\n version: revocationRegistryDefinitionResource.version,\n resourceType: revocationRegistryDefinitionResource.resourceType,\n } satisfies Partial<Metadata>,\n }\n } catch (error) {\n agentContext.config.logger.error(\n `Error registering revocation registry definition for did '${revocationRegistryDefinition.issuerId}'`,\n {\n error,\n did: revocationRegistryDefinition.issuerId,\n options,\n }\n )\n\n return {\n revocationRegistryDefinitionMetadata: {},\n registrationMetadata: {},\n revocationRegistryDefinitionState: {\n state: 'failed',\n revocationRegistryDefinition,\n reason: `unknownError: ${error.message}`,\n },\n }\n }\n }\n\n public async getRevocationStatusList(\n agentContext: AgentContext,\n revocationRegistryId: string,\n timestamp: number\n ): Promise<GetRevocationStatusListReturn> {\n try {\n const cheqdDidResolver = agentContext.dependencyManager.resolve(CheqdDidResolver)\n const parsedDid = parseCheqdDid(revocationRegistryId)\n if (!parsedDid) throw new CredoError(`Invalid revocationRegistryId: ${revocationRegistryId}`)\n\n agentContext.config.logger.trace(\n `Submitting get revocation status request for '${revocationRegistryId}' to ledger`\n )\n\n const anoncredsRegistryService = agentContext.resolve(AnonCredsRegistryService)\n let revocationRegistryDefinition = await anoncredsRegistryService.getRevocationRegistryDefinition(\n agentContext,\n revocationRegistryId\n )\n if (!revocationRegistryDefinition.revocationRegistryDefinition)\n throw new CredoError(`Revocation registry definition not found for id: ${revocationRegistryId}`)\n\n let revocationRegistryDefinitionName = revocationRegistryDefinition.revocationRegistryDefinitionMetadata.name\n if (!revocationRegistryDefinitionName) {\n // We need to handle the case where we didn't store the metadata yet on the record. In that case we resolve\n // the fresh object and store the metadata on the record locally\n if (revocationRegistryDefinition.resolutionMetadata.servedFromRecord) {\n revocationRegistryDefinition = await this.updateLocalRevocationRegistryDefinitionRecordMetadata(\n agentContext,\n revocationRegistryDefinition\n )\n\n revocationRegistryDefinitionName = revocationRegistryDefinition.revocationRegistryDefinitionMetadata.name\n }\n\n if (!revocationRegistryDefinitionName) {\n throw new CredoError(`Revocation registry definition name not found for id: ${revocationRegistryId}`)\n }\n }\n\n const response = await cheqdDidResolver.resolveResource(\n agentContext,\n `${parsedDid.did}?resourceType=${cheqdAnonCredsResourceTypes.revocationStatusList}&resourceVersionTime=${timestamp}&resourceName=${revocationRegistryDefinitionName}`\n )\n if (response.error) throw new Error(`${response.error}: ${response.message}`)\n const revocationStatusList = JsonTransformer.fromJSON(response.resource, CheqdRevocationStatusList)\n\n const statusListTimestamp = response.resourceMetadata?.created\n ? Math.floor(response.resourceMetadata.created.getTime() / 1000)\n : undefined\n if (statusListTimestamp === undefined)\n throw new CredoError(`Unable to extract revocation status list timestamp from resource ${revocationRegistryId}`)\n\n return {\n revocationStatusList: {\n ...revocationStatusList,\n issuerId: parsedDid.did,\n timestamp: statusListTimestamp,\n },\n resolutionMetadata: {},\n revocationStatusListMetadata: (response.resourceMetadata ?? {}) as Record<string, unknown>,\n }\n } catch (error) {\n agentContext.config.logger.error(`Error retrieving revocation registry status list '${revocationRegistryId}'`, {\n error,\n revocationRegistryId,\n })\n\n return {\n resolutionMetadata: {\n error: 'notFound',\n message: `unable to resolve revocation registry status list: ${error.message}`,\n },\n revocationStatusListMetadata: {},\n }\n }\n }\n\n private async updateLocalCredentialDefinitionRecordMetadata(\n agentContext: AgentContext,\n credentialDefinition: GetCredentialDefinitionReturn\n ): Promise<GetCredentialDefinitionReturn> {\n const anoncredsRegistryService = agentContext.resolve(AnonCredsRegistryService)\n\n const freshCredentialDefinition = await anoncredsRegistryService.getCredentialDefinition(\n agentContext,\n credentialDefinition.credentialDefinitionId,\n { useLocalRecord: false, useCache: false }\n )\n\n if (!credentialDefinition.credentialDefinition) {\n throw new CredoError(`Credential definition not found for id: ${credentialDefinition.credentialDefinitionId}`)\n }\n\n const credentialDefinitionRepository = agentContext.resolve(AnonCredsCredentialDefinitionRepository)\n const credentialDefinitionRecord = await credentialDefinitionRepository.getByCredentialDefinitionId(\n agentContext,\n credentialDefinition.credentialDefinitionId\n )\n\n credentialDefinitionRecord.metadata.set(\n AnonCredsCredentialDefinitionRecordMetadataKeys.CredentialDefinitionMetadata,\n freshCredentialDefinition.credentialDefinitionMetadata\n )\n\n await credentialDefinitionRepository.update(agentContext, credentialDefinitionRecord)\n\n return freshCredentialDefinition\n }\n\n private async updateLocalRevocationRegistryDefinitionRecordMetadata(\n agentContext: AgentContext,\n revocationRegistryDefinition: GetRevocationRegistryDefinitionReturn\n ): Promise<GetRevocationRegistryDefinitionReturn> {\n const anoncredsRegistryService = agentContext.resolve(AnonCredsRegistryService)\n\n const freshRevocationRegistryDefinition = await anoncredsRegistryService.getRevocationRegistryDefinition(\n agentContext,\n revocationRegistryDefinition.revocationRegistryDefinitionId,\n { useLocalRecord: false, useCache: false }\n )\n\n if (!revocationRegistryDefinition.revocationRegistryDefinition) {\n throw new CredoError(\n `Revocation registry definition not found for id: ${revocationRegistryDefinition.revocationRegistryDefinitionId}`\n )\n }\n\n const revocationRegistryDefinitionRepository = agentContext.resolve(AnonCredsRevocationRegistryDefinitionRepository)\n const revocationRegistryDefinitionRecord =\n await revocationRegistryDefinitionRepository.getByRevocationRegistryDefinitionId(\n agentContext,\n revocationRegistryDefinition.revocationRegistryDefinitionId\n )\n\n revocationRegistryDefinitionRecord.metadata.set(\n AnonCredsRevocationRegistryDefinitionRecordMetadataKeys.RevocationRegistryDefinitionMetadata,\n freshRevocationRegistryDefinition.revocationRegistryDefinitionMetadata\n )\n\n await revocationRegistryDefinitionRepository.update(agentContext, revocationRegistryDefinitionRecord)\n\n return freshRevocationRegistryDefinition\n }\n\n public async registerRevocationStatusList(\n agentContext: AgentContext,\n { revocationStatusList, options }: RegisterRevocationStatusListOptions\n ): Promise<RegisterRevocationStatusListReturn> {\n try {\n const anoncredsRegistryService = agentContext.resolve(AnonCredsRegistryService)\n let revocationRegistryDefinition = await anoncredsRegistryService.getRevocationRegistryDefinition(\n agentContext,\n revocationStatusList.revRegDefId\n )\n if (!revocationRegistryDefinition.revocationRegistryDefinition) {\n throw new CredoError(`Revocation registry definition not found for id: ${revocationStatusList.revRegDefId}`)\n }\n\n let revocationRegistryDefinitionName = revocationRegistryDefinition.revocationRegistryDefinitionMetadata.name\n if (!revocationRegistryDefinitionName) {\n // We need to handle the case where we didn't store the metadata yet on the record. In that case we resolve\n // the fresh object and store the metadata on the record locally\n if (revocationRegistryDefinition.resolutionMetadata.servedFromRecord) {\n revocationRegistryDefinition = await this.updateLocalRevocationRegistryDefinitionRecordMetadata(\n agentContext,\n revocationRegistryDefinition\n )\n\n revocationRegistryDefinitionName = revocationRegistryDefinition.revocationRegistryDefinitionMetadata.name\n }\n\n if (!revocationRegistryDefinitionName) {\n throw new CredoError(\n `Revocation registry definition name not found for id: ${revocationStatusList.revRegDefId}`\n )\n }\n }\n\n const cheqdDidRegistrar = agentContext.dependencyManager.resolve(CheqdDidRegistrar)\n const revocationStatusListResource = {\n id: utils.uuid(),\n name: revocationRegistryDefinitionName as string,\n resourceType: cheqdAnonCredsResourceTypes.revocationStatusList,\n data: {\n currentAccumulator: revocationStatusList.currentAccumulator,\n revRegDefId: revocationStatusList.revRegDefId,\n revocationList: revocationStatusList.revocationList,\n },\n version: utils.uuid(),\n } satisfies CheqdCreateResourceOptions\n\n const response = await cheqdDidRegistrar.createResource(\n agentContext,\n revocationStatusList.issuerId,\n revocationStatusListResource\n )\n if (response.resourceState.state !== 'finished')\n throw new CredoError(response.resourceState.reason ?? 'Unknown error')\n\n // It's not possible to get the timestamp from the response, so we set it to the current time\n const nowTimestamp = Math.floor(Date.now() / 1000)\n\n return {\n revocationStatusListState: {\n state: 'finished',\n revocationStatusList: {\n ...revocationStatusList,\n timestamp: nowTimestamp,\n },\n },\n registrationMetadata: {},\n revocationStatusListMetadata: (response.resourceMetadata ?? {}) as Record<string, unknown>,\n }\n } catch (error) {\n agentContext.config.logger.error(\n `Error registering revocation status list for did '${revocationStatusList.issuerId}'`,\n {\n error,\n did: revocationStatusList.issuerId,\n options,\n }\n )\n\n return {\n revocationStatusListMetadata: {},\n registrationMetadata: {},\n revocationStatusListState: {\n state: 'failed',\n revocationStatusList,\n reason: `unknownError: ${error.message}`,\n },\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;AAsCA,IAAa,yBAAb,MAAiE;;OACxD,aAAa;OAEb,gBAAgB;OAChB,oBAAoB;OAOX,sBAAsB;;CAEtC,MAAa,UAAU,cAA4B,UAA4C;AAC7F,MAAI;AACF,gBAAa,kBAAkB,QAAQ,aAAa;GACpD,MAAM,mBAAmB,aAAa,kBAAkB,QAAQ,iBAAiB;GACjF,MAAM,YAAY,cAAc,SAAS;AACzC,OAAI,CAAC,UAAW,OAAM,IAAI,WAAW,qBAAqB,WAAW;AAErE,gBAAa,OAAO,OAAO,MAAM,6CAA6C,SAAS,aAAa;GAEpG,MAAM,WAAW,MAAM,iBAAiB,gBAAgB,cAAc,SAAS;AAC/E,OAAI,SAAS,MAAO,OAAM,IAAI,MAAM,GAAG,SAAS,MAAM,IAAI,SAAS,UAAU;GAC7E,MAAM,SAAS,gBAAgB,SAAS,SAAS,UAAU,YAAY;AAEvE,UAAO;IACL,QAAQ;KACN,WAAW,OAAO;KAClB,MAAM,OAAO;KACb,SAAS,OAAO;KAChB,UAAU,UAAU;KACrB;IACD;IACA,oBAAoB,EAAE;IACtB,gBAAgB,EAAE;IACnB;WACM,OAAO;AACd,gBAAa,OAAO,OAAO,MAAM,4BAA4B,SAAS,IAAI;IACxE;IACA;IACD,CAAC;AAEF,UAAO;IACL;IACA,oBAAoB;KAClB,OAAO;KACP,SAAS,6BAA6B,MAAM;KAC7C;IACD,gBAAgB,EAAE;IACnB;;;CAIL,MAAa,eACX,cACA,SAC+B;AAC/B,MAAI;GACF,MAAM,oBAAoB,aAAa,kBAAkB,QAAQ,kBAAkB;GAEnF,MAAM,SAAS,QA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6BAA6B,6BAChC,OAAM,IAAI,WAAW,oDAAoD,qBAAqB,cAAc;GAG9G,IAAI,mCAAmC,6BAA6B,qCAAqC;AACzG,OAAI,CAAC,kCAAkC;AAGrC,QAAI,6BAA6B,mBAAmB,kBAAkB;AACpE,oCAA+B,MAAM,KAAK,sDACxC,cACA,6BACD;AAED,wCAAmC,6BAA6B,qCAAqC;;AAGvG,QAAI,CAAC,iCACH,OAAM,IAAI,WACR,yDAAyD,qBAAqB,cAC/E;;GAIL,MAAM,oBAAoB,aAAa,kBAAkB,QAAQ,kBAAkB;GACnF,MAAM,+BAA+B;IACnC,IAAI,MAAM,MAAM;IAChB,MAAM;IACN,cAAc,4BAA4B;IAC1C,MAAM;KACJ,oBAAoB,qBAAqB;KACzC,aAAa,qBAAqB;KAClC,gBAAgB,qBAAqB;KACtC;IACD,SAAS,MAAM,MAAM;IACtB;GAED,MAAM,WAAW,MAAM,kBAAkB,eACvC,cACA,qBAAqB,UACrB,6BACD;AACD,OAAI,SAAS,cAAc,UAAU,WACnC,OAAM,IAAI,WAAW,SAAS,cAAc,UAAU,gBAAgB;GAGxE,MAAM,eAAe,KAAK,MAAM,KAAK,KAAK,GAAG,IAAK;AAElD,UAAO;IACL,2BAA2B;KACzB,OAAO;KACP,sBAAsB;MACpB,GAAG;MACH,WAAW;MACZ;KACF;IACD,sBAAsB,EAAE;IACxB,8BAA+B,SAAS,oBAAoB,EAAE;IAC/D;WACM,OAAO;AACd,gBAAa,OAAO,OAAO,MACzB,qDAAqD,qBAAqB,SAAS,IACnF;IACE;IACA,KAAK,qBAAqB;IAC1B;IACD,CACF;AAED,UAAO;IACL,8BAA8B,EAAE;IAChC,sBAAsB,EAAE;IACxB,2BAA2B;KACzB,OAAO;KACP;KACA,QAAQ,iBAAiB,MAAM;KAChC;IACF"}
|
|
1
|
+
{"version":3,"file":"CheqdAnonCredsRegistry.mjs","names":[],"sources":["../../../src/anoncreds/services/CheqdAnonCredsRegistry.ts"],"sourcesContent":["import type { Metadata } from '@cheqd/ts-proto/cheqd/resource/v2'\nimport {\n AnonCredsApi,\n AnonCredsCredentialDefinitionRecordMetadataKeys,\n AnonCredsCredentialDefinitionRepository,\n type AnonCredsRegistry,\n AnonCredsRegistryService,\n AnonCredsRevocationRegistryDefinitionRecordMetadataKeys,\n AnonCredsRevocationRegistryDefinitionRepository,\n type GetCredentialDefinitionReturn,\n type GetRevocationRegistryDefinitionReturn,\n type GetRevocationStatusListReturn,\n type GetSchemaReturn,\n type RegisterCredentialDefinitionOptions,\n type RegisterCredentialDefinitionReturn,\n type RegisterRevocationRegistryDefinitionOptions,\n type RegisterRevocationRegistryDefinitionReturn,\n type RegisterRevocationStatusListOptions,\n type RegisterRevocationStatusListReturn,\n type RegisterSchemaOptions,\n type RegisterSchemaReturn,\n} from '@credo-ts/anoncreds'\nimport type { AgentContext } from '@credo-ts/core'\nimport { CredoError, Hasher, JsonTransformer, TypedArrayEncoder, utils } from '@credo-ts/core'\nimport type { CheqdCreateResourceOptions } from '../../dids'\nimport { CheqdDidRegistrar, CheqdDidResolver } from '../../dids'\nimport {\n cheqdAnonCredsResourceTypes,\n cheqdSdkAnonCredsRegistryIdentifierRegex,\n parseCheqdDid,\n} from '../utils/identifiers'\nimport {\n CheqdCredentialDefinition,\n CheqdRevocationRegistryDefinition,\n CheqdRevocationStatusList,\n CheqdSchema,\n} from '../utils/transform'\n\nexport class CheqdAnonCredsRegistry implements AnonCredsRegistry {\n public methodName = 'cheqd'\n\n public allowsCaching = true\n public allowsLocalRecord = true\n\n /**\n * This class supports resolving and registering objects with cheqd identifiers.\n * It needs to include support for the schema, credential definition, revocation registry as well\n * as the issuer id (which is needed when registering objects).\n */\n public readonly supportedIdentifier = cheqdSdkAnonCredsRegistryIdentifierRegex\n\n public async getSchema(agentContext: AgentContext, schemaId: string): Promise<GetSchemaReturn> {\n try {\n agentContext.dependencyManager.resolve(AnonCredsApi)\n const cheqdDidResolver = agentContext.dependencyManager.resolve(CheqdDidResolver)\n const parsedDid = parseCheqdDid(schemaId)\n if (!parsedDid) throw new CredoError(`Invalid schemaId: ${schemaId}`)\n\n agentContext.config.logger.trace(`Submitting get schema request for schema '${schemaId}' to ledger`)\n\n const response = await cheqdDidResolver.resolveResource(agentContext, schemaId)\n if (response.error) throw new Error(`${response.error}: ${response.message}`)\n const schema = JsonTransformer.fromJSON(response.resource, CheqdSchema)\n\n return {\n schema: {\n attrNames: schema.attrNames,\n name: schema.name,\n version: schema.version,\n issuerId: parsedDid.did,\n },\n schemaId,\n resolutionMetadata: {},\n schemaMetadata: {},\n }\n } catch (error) {\n agentContext.config.logger.error(`Error retrieving schema '${schemaId}'`, {\n error,\n schemaId,\n })\n\n return {\n schemaId,\n resolutionMetadata: {\n error: 'notFound',\n message: `unable to resolve schema: ${error.message}`,\n },\n schemaMetadata: {},\n }\n }\n }\n\n public async registerSchema(\n agentContext: AgentContext,\n options: RegisterSchemaOptions\n ): Promise<RegisterSchemaReturn> {\n try {\n const cheqdDidRegistrar = agentContext.dependencyManager.resolve(CheqdDidRegistrar)\n\n const schema = options.schema\n const schemaResource = {\n id: utils.uuid(),\n name: `${schema.name}-Schema`,\n resourceType: cheqdAnonCredsResourceTypes.schema,\n data: {\n name: schema.name,\n version: schema.version,\n attrNames: schema.attrNames,\n },\n version: schema.version,\n } satisfies CheqdCreateResourceOptions\n\n const response = await cheqdDidRegistrar.createResource(agentContext, schema.issuerId, schemaResource)\n if (response.resourceState.state !== 'finished') {\n throw new CredoError(response.resourceState.reason ?? 'Unknown error')\n }\n\n return {\n schemaState: {\n state: 'finished',\n schema,\n schemaId: `${schema.issuerId}/resources/${schemaResource.id}`,\n },\n registrationMetadata: {},\n schemaMetadata: {},\n }\n } catch (error) {\n agentContext.config.logger.debug(`Error registering schema for did '${options.schema.issuerId}'`, {\n error,\n did: options.schema.issuerId,\n schema: options,\n })\n\n return {\n schemaMetadata: {},\n registrationMetadata: {},\n schemaState: {\n state: 'failed',\n schema: options.schema,\n reason: `unknownError: ${error.message}`,\n },\n }\n }\n }\n\n public async registerCredentialDefinition(\n agentContext: AgentContext,\n options: RegisterCredentialDefinitionOptions\n ): Promise<RegisterCredentialDefinitionReturn> {\n try {\n const cheqdDidRegistrar = agentContext.dependencyManager.resolve(CheqdDidRegistrar)\n const { credentialDefinition } = options\n const anoncredsRegistryService = agentContext.resolve(AnonCredsRegistryService)\n const schema = await anoncredsRegistryService.getSchema(agentContext, credentialDefinition.schemaId)\n if (!schema.schema) throw new CredoError(`Schema not found for schemaId: ${credentialDefinition.schemaId}`)\n\n const credDefName = `${schema.schema.name}-${credentialDefinition.tag}`\n const credDefNameHashBuffer = Hasher.hash(credDefName, 'sha-256')\n\n const credDefResource = {\n id: utils.uuid(),\n name: TypedArrayEncoder.toHex(credDefNameHashBuffer),\n resourceType: cheqdAnonCredsResourceTypes.credentialDefinition,\n data: {\n type: credentialDefinition.type,\n tag: credentialDefinition.tag,\n value: credentialDefinition.value,\n schemaId: credentialDefinition.schemaId,\n },\n version: utils.uuid(),\n } satisfies CheqdCreateResourceOptions\n\n const response = await cheqdDidRegistrar.createResource(\n agentContext,\n credentialDefinition.issuerId,\n credDefResource\n )\n if (response.resourceState.state !== 'finished')\n throw new CredoError(response.resourceState.reason ?? 'Unknown error')\n\n return {\n credentialDefinitionState: {\n state: 'finished',\n credentialDefinition,\n credentialDefinitionId: `${credentialDefinition.issuerId}/resources/${credDefResource.id}`,\n },\n registrationMetadata: {},\n // NOTE: some of these metadata fields are used for resolved items\n credentialDefinitionMetadata: {\n name: TypedArrayEncoder.toHex(credDefNameHashBuffer),\n version: credDefResource.version,\n resourceType: credDefResource.resourceType,\n id: credDefResource.id,\n } satisfies Partial<Metadata>,\n }\n } catch (error) {\n agentContext.config.logger.error(\n `Error registering credential definition for did '${options.credentialDefinition.issuerId}'`,\n {\n error,\n did: options.credentialDefinition.issuerId,\n schema: options,\n }\n )\n\n return {\n credentialDefinitionMetadata: {},\n registrationMetadata: {},\n credentialDefinitionState: {\n state: 'failed',\n credentialDefinition: options.credentialDefinition,\n reason: `unknownError: ${error.message}. ${error.stack}`,\n },\n }\n }\n }\n\n public async getCredentialDefinition(\n agentContext: AgentContext,\n credentialDefinitionId: string\n ): Promise<GetCredentialDefinitionReturn> {\n try {\n const cheqdDidResolver = agentContext.dependencyManager.resolve(CheqdDidResolver)\n const parsedDid = parseCheqdDid(credentialDefinitionId)\n if (!parsedDid) throw new CredoError(`Invalid credentialDefinitionId: ${credentialDefinitionId}`)\n\n agentContext.config.logger.trace(\n `Submitting get credential definition request for '${credentialDefinitionId}' to ledger`\n )\n\n const response = await cheqdDidResolver.resolveResource(agentContext, credentialDefinitionId)\n if (response.error) throw new Error(`${response.error}: ${response.message}`)\n const credentialDefinition = JsonTransformer.fromJSON(response.resource, CheqdCredentialDefinition)\n return {\n credentialDefinition: {\n ...credentialDefinition,\n issuerId: parsedDid.did,\n },\n credentialDefinitionId,\n resolutionMetadata: {},\n credentialDefinitionMetadata: (response.resourceMetadata ?? {}) as Record<string, unknown>,\n }\n } catch (error) {\n agentContext.config.logger.error(`Error retrieving credential definition '${credentialDefinitionId}'`, {\n error,\n credentialDefinitionId,\n })\n\n return {\n credentialDefinitionId,\n resolutionMetadata: {\n error: 'notFound',\n message: `unable to resolve credential definition: ${error.message}`,\n },\n credentialDefinitionMetadata: {},\n }\n }\n }\n\n public async getRevocationRegistryDefinition(\n agentContext: AgentContext,\n revocationRegistryDefinitionId: string\n ): Promise<GetRevocationRegistryDefinitionReturn> {\n try {\n const cheqdDidResolver = agentContext.dependencyManager.resolve(CheqdDidResolver)\n const parsedDid = parseCheqdDid(revocationRegistryDefinitionId)\n if (!parsedDid) throw new CredoError(`Invalid revocationRegistryDefinitionId: ${revocationRegistryDefinitionId}`)\n\n agentContext.config.logger.trace(\n `Submitting get revocation registry definition request for '${revocationRegistryDefinitionId}' to ledger`\n )\n\n const searchDid = parsedDid.path\n ? revocationRegistryDefinitionId\n : `${revocationRegistryDefinitionId}${revocationRegistryDefinitionId.includes('?') ? '&' : '?'}resourceType=${\n cheqdAnonCredsResourceTypes.revocationRegistryDefinition\n }`\n\n const response = await cheqdDidResolver.resolveResource(agentContext, searchDid)\n if (response.error) throw new Error(`${response.error}: ${response.message}`)\n\n const revocationRegistryDefinition = JsonTransformer.fromJSON(\n response.resource,\n CheqdRevocationRegistryDefinition\n )\n return {\n revocationRegistryDefinition: {\n ...revocationRegistryDefinition,\n issuerId: parsedDid.did,\n },\n revocationRegistryDefinitionId,\n resolutionMetadata: {},\n revocationRegistryDefinitionMetadata: (response.resourceMetadata ?? {}) as Record<string, unknown>,\n }\n } catch (error) {\n agentContext.config.logger.error(\n `Error retrieving revocation registry definition '${revocationRegistryDefinitionId}'`,\n {\n error,\n revocationRegistryDefinitionId,\n }\n )\n\n return {\n revocationRegistryDefinitionId,\n resolutionMetadata: {\n error: 'notFound',\n message: `unable to resolve revocation registry definition: ${error.message}`,\n },\n revocationRegistryDefinitionMetadata: {},\n }\n }\n }\n\n public async registerRevocationRegistryDefinition(\n agentContext: AgentContext,\n { revocationRegistryDefinition, options }: RegisterRevocationRegistryDefinitionOptions\n ): Promise<RegisterRevocationRegistryDefinitionReturn> {\n try {\n const anoncredsRegistryService = agentContext.resolve(AnonCredsRegistryService)\n let credentialDefinition = await anoncredsRegistryService.getCredentialDefinition(\n agentContext,\n revocationRegistryDefinition.credDefId\n )\n if (!credentialDefinition.credentialDefinition)\n throw new CredoError(`Credential definition not found for id: ${revocationRegistryDefinition.credDefId}`)\n\n let credentialDefinitionName = credentialDefinition.credentialDefinitionMetadata.name\n if (!credentialDefinitionName) {\n // We need to handle the case where we didn't store the metadata yet on the record. In that case we resolve\n // the fresh object and store the metadata on the record locally\n if (credentialDefinition.resolutionMetadata.servedFromRecord) {\n credentialDefinition = await this.updateLocalCredentialDefinitionRecordMetadata(\n agentContext,\n credentialDefinition\n )\n\n credentialDefinitionName = credentialDefinition.credentialDefinitionMetadata.name\n }\n\n if (!credentialDefinitionName) {\n throw new CredoError(`Credential definition name not found for id: ${revocationRegistryDefinition.credDefId}`)\n }\n }\n\n const cheqdDidRegistrar = agentContext.dependencyManager.resolve(CheqdDidRegistrar)\n\n const revocDefName = `${credentialDefinitionName}-${revocationRegistryDefinition.tag}`\n const revocDefNameHashedBuffer = Hasher.hash(revocDefName, 'sha-256')\n\n const revocationRegistryDefinitionResource = {\n id: utils.uuid(),\n name: TypedArrayEncoder.toHex(revocDefNameHashedBuffer),\n resourceType: cheqdAnonCredsResourceTypes.revocationRegistryDefinition,\n data: {\n credDefId: revocationRegistryDefinition.credDefId,\n revocDefType: revocationRegistryDefinition.revocDefType,\n tag: revocationRegistryDefinition.tag,\n value: revocationRegistryDefinition.value,\n },\n version: utils.uuid(),\n } satisfies CheqdCreateResourceOptions\n\n const response = await cheqdDidRegistrar.createResource(\n agentContext,\n revocationRegistryDefinition.issuerId,\n revocationRegistryDefinitionResource\n )\n if (response.resourceState.state !== 'finished')\n throw new CredoError(response.resourceState.reason ?? 'Unknown error')\n\n return {\n revocationRegistryDefinitionState: {\n state: 'finished',\n revocationRegistryDefinition,\n revocationRegistryDefinitionId: `${revocationRegistryDefinition.issuerId}/resources/${revocationRegistryDefinitionResource.id}`,\n },\n registrationMetadata: {},\n // NOTE: some of these metadata fields are used for resolved items\n revocationRegistryDefinitionMetadata: {\n name: revocationRegistryDefinitionResource.name,\n id: revocationRegistryDefinitionResource.id,\n version: revocationRegistryDefinitionResource.version,\n resourceType: revocationRegistryDefinitionResource.resourceType,\n } satisfies Partial<Metadata>,\n }\n } catch (error) {\n agentContext.config.logger.error(\n `Error registering revocation registry definition for did '${revocationRegistryDefinition.issuerId}'`,\n {\n error,\n did: revocationRegistryDefinition.issuerId,\n options,\n }\n )\n\n return {\n revocationRegistryDefinitionMetadata: {},\n registrationMetadata: {},\n revocationRegistryDefinitionState: {\n state: 'failed',\n revocationRegistryDefinition,\n reason: `unknownError: ${error.message}`,\n },\n }\n }\n }\n\n public async getRevocationStatusList(\n agentContext: AgentContext,\n revocationRegistryId: string,\n timestamp: number\n ): Promise<GetRevocationStatusListReturn> {\n try {\n const cheqdDidResolver = agentContext.dependencyManager.resolve(CheqdDidResolver)\n const parsedDid = parseCheqdDid(revocationRegistryId)\n if (!parsedDid) throw new CredoError(`Invalid revocationRegistryId: ${revocationRegistryId}`)\n\n agentContext.config.logger.trace(\n `Submitting get revocation status request for '${revocationRegistryId}' to ledger`\n )\n\n const anoncredsRegistryService = agentContext.resolve(AnonCredsRegistryService)\n let revocationRegistryDefinition = await anoncredsRegistryService.getRevocationRegistryDefinition(\n agentContext,\n revocationRegistryId\n )\n if (!revocationRegistryDefinition.revocationRegistryDefinition)\n throw new CredoError(`Revocation registry definition not found for id: ${revocationRegistryId}`)\n\n let revocationRegistryDefinitionName = revocationRegistryDefinition.revocationRegistryDefinitionMetadata.name\n if (!revocationRegistryDefinitionName) {\n // We need to handle the case where we didn't store the metadata yet on the record. In that case we resolve\n // the fresh object and store the metadata on the record locally\n if (revocationRegistryDefinition.resolutionMetadata.servedFromRecord) {\n revocationRegistryDefinition = await this.updateLocalRevocationRegistryDefinitionRecordMetadata(\n agentContext,\n revocationRegistryDefinition\n )\n\n revocationRegistryDefinitionName = revocationRegistryDefinition.revocationRegistryDefinitionMetadata.name\n }\n\n if (!revocationRegistryDefinitionName) {\n throw new CredoError(`Revocation registry definition name not found for id: ${revocationRegistryId}`)\n }\n }\n\n const response = await cheqdDidResolver.resolveResource(\n agentContext,\n `${parsedDid.did}?resourceType=${cheqdAnonCredsResourceTypes.revocationStatusList}&resourceVersionTime=${timestamp}&resourceName=${revocationRegistryDefinitionName}`\n )\n if (response.error) throw new Error(`${response.error}: ${response.message}`)\n const revocationStatusList = JsonTransformer.fromJSON(response.resource, CheqdRevocationStatusList)\n\n const statusListTimestamp = response.resourceMetadata?.created\n ? Math.floor(response.resourceMetadata.created.getTime() / 1000)\n : undefined\n if (statusListTimestamp === undefined)\n throw new CredoError(`Unable to extract revocation status list timestamp from resource ${revocationRegistryId}`)\n\n return {\n revocationStatusList: {\n ...revocationStatusList,\n issuerId: parsedDid.did,\n timestamp: statusListTimestamp,\n },\n resolutionMetadata: {},\n revocationStatusListMetadata: (response.resourceMetadata ?? {}) as Record<string, unknown>,\n }\n } catch (error) {\n agentContext.config.logger.error(`Error retrieving revocation registry status list '${revocationRegistryId}'`, {\n error,\n revocationRegistryId,\n })\n\n return {\n resolutionMetadata: {\n error: 'notFound',\n message: `unable to resolve revocation registry status list: ${error.message}`,\n },\n revocationStatusListMetadata: {},\n }\n }\n }\n\n private async updateLocalCredentialDefinitionRecordMetadata(\n agentContext: AgentContext,\n credentialDefinition: GetCredentialDefinitionReturn\n ): Promise<GetCredentialDefinitionReturn> {\n const anoncredsRegistryService = agentContext.resolve(AnonCredsRegistryService)\n\n const freshCredentialDefinition = await anoncredsRegistryService.getCredentialDefinition(\n agentContext,\n credentialDefinition.credentialDefinitionId,\n { useLocalRecord: false, useCache: false }\n )\n\n if (!credentialDefinition.credentialDefinition) {\n throw new CredoError(`Credential definition not found for id: ${credentialDefinition.credentialDefinitionId}`)\n }\n\n const credentialDefinitionRepository = agentContext.resolve(AnonCredsCredentialDefinitionRepository)\n const credentialDefinitionRecord = await credentialDefinitionRepository.getByCredentialDefinitionId(\n agentContext,\n credentialDefinition.credentialDefinitionId\n )\n\n credentialDefinitionRecord.metadata.set(\n AnonCredsCredentialDefinitionRecordMetadataKeys.CredentialDefinitionMetadata,\n freshCredentialDefinition.credentialDefinitionMetadata\n )\n\n await credentialDefinitionRepository.update(agentContext, credentialDefinitionRecord)\n\n return freshCredentialDefinition\n }\n\n private async updateLocalRevocationRegistryDefinitionRecordMetadata(\n agentContext: AgentContext,\n revocationRegistryDefinition: GetRevocationRegistryDefinitionReturn\n ): Promise<GetRevocationRegistryDefinitionReturn> {\n const anoncredsRegistryService = agentContext.resolve(AnonCredsRegistryService)\n\n const freshRevocationRegistryDefinition = await anoncredsRegistryService.getRevocationRegistryDefinition(\n agentContext,\n revocationRegistryDefinition.revocationRegistryDefinitionId,\n { useLocalRecord: false, useCache: false }\n )\n\n if (!revocationRegistryDefinition.revocationRegistryDefinition) {\n throw new CredoError(\n `Revocation registry definition not found for id: ${revocationRegistryDefinition.revocationRegistryDefinitionId}`\n )\n }\n\n const revocationRegistryDefinitionRepository = agentContext.resolve(AnonCredsRevocationRegistryDefinitionRepository)\n const revocationRegistryDefinitionRecord =\n await revocationRegistryDefinitionRepository.getByRevocationRegistryDefinitionId(\n agentContext,\n revocationRegistryDefinition.revocationRegistryDefinitionId\n )\n\n revocationRegistryDefinitionRecord.metadata.set(\n AnonCredsRevocationRegistryDefinitionRecordMetadataKeys.RevocationRegistryDefinitionMetadata,\n freshRevocationRegistryDefinition.revocationRegistryDefinitionMetadata\n )\n\n await revocationRegistryDefinitionRepository.update(agentContext, revocationRegistryDefinitionRecord)\n\n return freshRevocationRegistryDefinition\n }\n\n public async registerRevocationStatusList(\n agentContext: AgentContext,\n { revocationStatusList, options }: RegisterRevocationStatusListOptions\n ): Promise<RegisterRevocationStatusListReturn> {\n try {\n const anoncredsRegistryService = agentContext.resolve(AnonCredsRegistryService)\n let revocationRegistryDefinition = await anoncredsRegistryService.getRevocationRegistryDefinition(\n agentContext,\n revocationStatusList.revRegDefId\n )\n if (!revocationRegistryDefinition.revocationRegistryDefinition) {\n throw new CredoError(`Revocation registry definition not found for id: ${revocationStatusList.revRegDefId}`)\n }\n\n let revocationRegistryDefinitionName = revocationRegistryDefinition.revocationRegistryDefinitionMetadata.name\n if (!revocationRegistryDefinitionName) {\n // We need to handle the case where we didn't store the metadata yet on the record. In that case we resolve\n // the fresh object and store the metadata on the record locally\n if (revocationRegistryDefinition.resolutionMetadata.servedFromRecord) {\n revocationRegistryDefinition = await this.updateLocalRevocationRegistryDefinitionRecordMetadata(\n agentContext,\n revocationRegistryDefinition\n )\n\n revocationRegistryDefinitionName = revocationRegistryDefinition.revocationRegistryDefinitionMetadata.name\n }\n\n if (!revocationRegistryDefinitionName) {\n throw new CredoError(\n `Revocation registry definition name not found for id: ${revocationStatusList.revRegDefId}`\n )\n }\n }\n\n const cheqdDidRegistrar = agentContext.dependencyManager.resolve(CheqdDidRegistrar)\n const revocationStatusListResource = {\n id: utils.uuid(),\n name: revocationRegistryDefinitionName as string,\n resourceType: cheqdAnonCredsResourceTypes.revocationStatusList,\n data: {\n currentAccumulator: revocationStatusList.currentAccumulator,\n revRegDefId: revocationStatusList.revRegDefId,\n revocationList: revocationStatusList.revocationList,\n },\n version: utils.uuid(),\n } satisfies CheqdCreateResourceOptions\n\n const response = await cheqdDidRegistrar.createResource(\n agentContext,\n revocationStatusList.issuerId,\n revocationStatusListResource\n )\n if (response.resourceState.state !== 'finished')\n throw new CredoError(response.resourceState.reason ?? 'Unknown error')\n\n // It's not possible to get the timestamp from the response, so we set it to the current time\n const nowTimestamp = Math.floor(Date.now() / 1000)\n\n return {\n revocationStatusListState: {\n state: 'finished',\n revocationStatusList: {\n ...revocationStatusList,\n timestamp: nowTimestamp,\n },\n },\n registrationMetadata: {},\n revocationStatusListMetadata: (response.resourceMetadata ?? {}) as Record<string, unknown>,\n }\n } catch (error) {\n agentContext.config.logger.error(\n `Error registering revocation status list for did '${revocationStatusList.issuerId}'`,\n {\n error,\n did: revocationStatusList.issuerId,\n options,\n }\n )\n\n return {\n revocationStatusListMetadata: {},\n registrationMetadata: {},\n revocationStatusListState: {\n state: 'failed',\n revocationStatusList,\n reason: `unknownError: ${error.message}`,\n },\n }\n }\n }\n}\n"],"mappings":";;;;;;;;AAsCA,IAAa,yBAAb,MAAiE;;EAC/D,KAAO,aAAa;EAEpB,KAAO,gBAAgB;EACvB,KAAO,oBAAoB;EAO3B,KAAgB,sBAAsB;;CAEtC,MAAa,UAAU,cAA4B,UAA4C;EAC7F,IAAI;GACF,aAAa,kBAAkB,QAAQ,YAAY;GACnD,MAAM,mBAAmB,aAAa,kBAAkB,QAAQ,gBAAgB;GAChF,MAAM,YAAY,cAAc,QAAQ;GACxC,IAAI,CAAC,WAAW,MAAM,IAAI,WAAW,qBAAqB,UA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;IACnC,IAAI,MAAM,KAAK;IACf,MAAM;IACN,cAAc,4BAA4B;IAC1C,MAAM;KACJ,oBAAoB,qBAAqB;KACzC,aAAa,qBAAqB;KAClC,gBAAgB,qBAAqB;IACvC;IACA,SAAS,MAAM,KAAK;GACtB;GAEA,MAAM,WAAW,MAAM,kBAAkB,eACvC,cACA,qBAAqB,UACrB,4BACF;GACA,IAAI,SAAS,cAAc,UAAU,YACnC,MAAM,IAAI,WAAW,SAAS,cAAc,UAAU,eAAe;GAGvE,MAAM,eAAe,KAAK,MAAM,KAAK,IAAI,IAAI,GAAI;GAEjD,OAAO;IACL,2BAA2B;KACzB,OAAO;KACP,sBAAsB;MACpB,GAAG;MACH,WAAW;KACb;IACF;IACA,sBAAsB,CAAC;IACvB,8BAA+B,SAAS,oBAAoB,CAAC;GAC/D;EACF,SAAS,OAAO;GACd,aAAa,OAAO,OAAO,MACzB,qDAAqD,qBAAqB,SAAS,IACnF;IACE;IACA,KAAK,qBAAqB;IAC1B;GACF,CACF;GAEA,OAAO;IACL,8BAA8B,CAAC;IAC/B,sBAAsB,CAAC;IACvB,2BAA2B;KACzB,OAAO;KACP;KACA,QAAQ,iBAAiB,MAAM;IACjC;GACF;EACF;CACF;AACF"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { TypedArrayEncoder, utils } from "@credo-ts/core";
|
|
2
2
|
import { isBase58 } from "class-validator";
|
|
3
|
-
|
|
4
3
|
//#region src/anoncreds/utils/identifiers.ts
|
|
5
4
|
const ID_CHAR = "([a-z,A-Z,0-9,-])";
|
|
6
5
|
const NETWORK = "(testnet|mainnet)";
|
|
@@ -9,8 +8,6 @@ const PATH = "(/[^#?]*)?";
|
|
|
9
8
|
const QUERY = "([?][^#]*)?";
|
|
10
9
|
const VERSION_ID = "(.*?)";
|
|
11
10
|
const FRAGMENT = "([#].*)?";
|
|
12
|
-
const ED25519_SUITE_CONTEXT_URL_2018 = "https://w3id.org/security/suites/ed25519-2018/v1";
|
|
13
|
-
const ED25519_SUITE_CONTEXT_URL_2020 = "https://w3id.org/security/suites/ed25519-2020/v1";
|
|
14
11
|
const cheqdSdkAnonCredsRegistryIdentifierRegex = new RegExp(`^did:cheqd:${NETWORK}:${IDENTIFIER}${PATH}${QUERY}${FRAGMENT}$`);
|
|
15
12
|
const cheqdDidRegex = new RegExp(`^did:cheqd:${NETWORK}:${IDENTIFIER}${QUERY}${FRAGMENT}$`);
|
|
16
13
|
const cheqdDidVersionRegex = new RegExp(`^did:cheqd:${NETWORK}:${IDENTIFIER}/version/${VERSION_ID}${QUERY}${FRAGMENT}$`);
|
|
@@ -50,7 +47,7 @@ const cheqdAnonCredsResourceTypes = {
|
|
|
50
47
|
revocationRegistryDefinition: "anonCredsRevocRegDef",
|
|
51
48
|
revocationStatusList: "anonCredsStatusList"
|
|
52
49
|
};
|
|
53
|
-
|
|
54
50
|
//#endregion
|
|
55
|
-
export {
|
|
51
|
+
export { cheqdAnonCredsResourceTypes, cheqdDidMetadataRegex, cheqdDidRegex, cheqdDidVersionRegex, cheqdDidVersionsRegex, cheqdResourceMetadataRegex, cheqdResourceRegex, cheqdSdkAnonCredsRegistryIdentifierRegex, parseCheqdDid };
|
|
52
|
+
|
|
56
53
|
//# sourceMappingURL=identifiers.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identifiers.mjs","names":[],"sources":["../../../src/anoncreds/utils/identifiers.ts"],"sourcesContent":["import type { CheqdNetwork } from '@cheqd/sdk'\nimport type { ParsedDid } from '@credo-ts/core'\n\nimport { TypedArrayEncoder, utils } from '@credo-ts/core'\nimport { isBase58 } from 'class-validator'\n\nconst ID_CHAR = '([a-z,A-Z,0-9,-])'\nconst NETWORK = '(testnet|mainnet)'\nconst IDENTIFIER = `((?:${ID_CHAR}*:)*(${ID_CHAR}+))`\nconst PATH = '(/[^#?]*)?'\nconst QUERY = '([?][^#]*)?'\nconst VERSION_ID = '(.*?)'\nconst FRAGMENT = '([#].*)?'\n\nexport const
|
|
1
|
+
{"version":3,"file":"identifiers.mjs","names":[],"sources":["../../../src/anoncreds/utils/identifiers.ts"],"sourcesContent":["import type { CheqdNetwork } from '@cheqd/sdk'\nimport type { ParsedDid } from '@credo-ts/core'\n\nimport { TypedArrayEncoder, utils } from '@credo-ts/core'\nimport { isBase58 } from 'class-validator'\n\nconst ID_CHAR = '([a-z,A-Z,0-9,-])'\nconst NETWORK = '(testnet|mainnet)'\nconst IDENTIFIER = `((?:${ID_CHAR}*:)*(${ID_CHAR}+))`\nconst PATH = '(/[^#?]*)?'\nconst QUERY = '([?][^#]*)?'\nconst VERSION_ID = '(.*?)'\nconst FRAGMENT = '([#].*)?'\n\nexport const cheqdSdkAnonCredsRegistryIdentifierRegex = new RegExp(\n `^did:cheqd:${NETWORK}:${IDENTIFIER}${PATH}${QUERY}${FRAGMENT}$`\n)\n\nexport const cheqdDidRegex = new RegExp(`^did:cheqd:${NETWORK}:${IDENTIFIER}${QUERY}${FRAGMENT}$`)\nexport const cheqdDidVersionRegex = new RegExp(\n `^did:cheqd:${NETWORK}:${IDENTIFIER}/version/${VERSION_ID}${QUERY}${FRAGMENT}$`\n)\nexport const cheqdDidVersionsRegex = new RegExp(`^did:cheqd:${NETWORK}:${IDENTIFIER}/versions${QUERY}${FRAGMENT}$`)\nexport const cheqdDidMetadataRegex = new RegExp(`^did:cheqd:${NETWORK}:${IDENTIFIER}/metadata${QUERY}${FRAGMENT}$`)\nexport const cheqdResourceRegex = new RegExp(\n `^did:cheqd:${NETWORK}:${IDENTIFIER}/resources/${IDENTIFIER}${QUERY}${FRAGMENT}$`\n)\nexport const cheqdResourceMetadataRegex = new RegExp(\n `^did:cheqd:${NETWORK}:${IDENTIFIER}/resources/${IDENTIFIER}/metadata${QUERY}${FRAGMENT}`\n)\n\nexport type ParsedCheqdDid = ParsedDid & { network: `${CheqdNetwork}` }\nexport function parseCheqdDid(didUrl: string): ParsedCheqdDid | null {\n if (didUrl === '' || !didUrl) return null\n const sections = didUrl.match(cheqdSdkAnonCredsRegistryIdentifierRegex)\n if (sections) {\n if (\n !(\n utils.isValidUuid(sections[2]) ||\n (isBase58(sections[2]) && TypedArrayEncoder.fromBase58(sections[2]).length === 16)\n )\n ) {\n return null\n }\n const parts: ParsedCheqdDid = {\n did: `did:cheqd:${sections[1]}:${sections[2]}`,\n method: 'cheqd',\n network: sections[1] as `${CheqdNetwork}`,\n id: sections[2],\n didUrl,\n }\n if (sections[7]) {\n const params = sections[7].slice(1).split('&')\n parts.params = {}\n for (const p of params) {\n const kv = p.split('=')\n parts.params[kv[0]] = kv[1]\n }\n }\n if (sections[6]) parts.path = sections[6]\n if (sections[8]) parts.fragment = sections[8].slice(1)\n return parts\n }\n return null\n}\n\nexport const cheqdAnonCredsResourceTypes = {\n schema: 'anonCredsSchema',\n credentialDefinition: 'anonCredsCredDef',\n revocationRegistryDefinition: 'anonCredsRevocRegDef',\n revocationStatusList: 'anonCredsStatusList',\n}\n"],"mappings":";;;AAMA,MAAM,UAAU;AAChB,MAAM,UAAU;AAChB,MAAM,aAAa,OAAO,QAAQ,OAAO,QAAQ;AACjD,MAAM,OAAO;AACb,MAAM,QAAQ;AACd,MAAM,aAAa;AACnB,MAAM,WAAW;AAEjB,MAAa,2CAA2C,IAAI,OAC1D,cAAc,QAAQ,GAAG,aAAa,OAAO,QAAQ,SAAS,EAChE;AAEA,MAAa,gBAAgB,IAAI,OAAO,cAAc,QAAQ,GAAG,aAAa,QAAQ,SAAS,EAAE;AACjG,MAAa,uBAAuB,IAAI,OACtC,cAAc,QAAQ,GAAG,WAAW,WAAW,aAAa,QAAQ,SAAS,EAC/E;AACA,MAAa,wBAAwB,IAAI,OAAO,cAAc,QAAQ,GAAG,WAAW,WAAW,QAAQ,SAAS,EAAE;AAClH,MAAa,wBAAwB,IAAI,OAAO,cAAc,QAAQ,GAAG,WAAW,WAAW,QAAQ,SAAS,EAAE;AAClH,MAAa,qBAAqB,IAAI,OACpC,cAAc,QAAQ,GAAG,WAAW,aAAa,aAAa,QAAQ,SAAS,EACjF;AACA,MAAa,6BAA6B,IAAI,OAC5C,cAAc,QAAQ,GAAG,WAAW,aAAa,WAAW,WAAW,QAAQ,UACjF;AAGA,SAAgB,cAAc,QAAuC;CACnE,IAAI,WAAW,MAAM,CAAC,QAAQ,OAAO;CACrC,MAAM,WAAW,OAAO,MAAM,wCAAwC;CACtE,IAAI,UAAU;EACZ,IACE,EACE,MAAM,YAAY,SAAS,EAAE,KAC5B,SAAS,SAAS,EAAE,KAAK,kBAAkB,WAAW,SAAS,EAAE,CAAC,CAAC,WAAW,KAGjF,OAAO;EAET,MAAM,QAAwB;GAC5B,KAAK,aAAa,SAAS,GAAG,GAAG,SAAS;GAC1C,QAAQ;GACR,SAAS,SAAS;GAClB,IAAI,SAAS;GACb;EACF;EACA,IAAI,SAAS,IAAI;GACf,MAAM,SAAS,SAAS,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,GAAG;GAC7C,MAAM,SAAS,CAAC;GAChB,KAAK,MAAM,KAAK,QAAQ;IACtB,MAAM,KAAK,EAAE,MAAM,GAAG;IACtB,MAAM,OAAO,GAAG,MAAM,GAAG;GAC3B;EACF;EACA,IAAI,SAAS,IAAI,MAAM,OAAO,SAAS;EACvC,IAAI,SAAS,IAAI,MAAM,WAAW,SAAS,EAAE,CAAC,MAAM,CAAC;EACrD,OAAO;CACT;CACA,OAAO;AACT;AAEA,MAAa,8BAA8B;CACzC,QAAQ;CACR,sBAAsB;CACtB,8BAA8B;CAC9B,sBAAsB;AACxB"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorateMetadata.mjs";
|
|
2
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorate.mjs";
|
|
3
3
|
import { ArrayMinSize, Contains, IsArray, IsInstance, IsNumber, IsObject, IsOptional, IsString, ValidateNested } from "class-validator";
|
|
4
4
|
import { Type } from "class-transformer";
|
|
5
|
-
|
|
6
5
|
//#region src/anoncreds/utils/transform.ts
|
|
7
|
-
var _ref, _ref2, _ref3, _ref4, _ref5;
|
|
8
6
|
var CheqdSchema = class {
|
|
9
7
|
constructor(options) {
|
|
10
8
|
if (options) {
|
|
@@ -23,7 +21,7 @@ __decorate([
|
|
|
23
21
|
], CheqdSchema.prototype, "attrNames", void 0);
|
|
24
22
|
__decorate([IsString(), __decorateMetadata("design:type", String)], CheqdSchema.prototype, "version", void 0);
|
|
25
23
|
var CheqdCredentialDefinitionValue = class {};
|
|
26
|
-
__decorate([IsObject(), __decorateMetadata("design:type", typeof
|
|
24
|
+
__decorate([IsObject(), __decorateMetadata("design:type", typeof Record === "undefined" ? Object : Record)], CheqdCredentialDefinitionValue.prototype, "primary", void 0);
|
|
27
25
|
__decorate([
|
|
28
26
|
IsObject(),
|
|
29
27
|
IsOptional(),
|
|
@@ -46,7 +44,7 @@ __decorate([
|
|
|
46
44
|
ValidateNested(),
|
|
47
45
|
IsInstance(CheqdCredentialDefinitionValue),
|
|
48
46
|
Type(() => CheqdCredentialDefinitionValue),
|
|
49
|
-
__decorateMetadata("design:type", typeof
|
|
47
|
+
__decorateMetadata("design:type", typeof CheqdCredentialDefinitionValue === "undefined" ? Object : CheqdCredentialDefinitionValue)
|
|
50
48
|
], CheqdCredentialDefinition.prototype, "value", void 0);
|
|
51
49
|
var AccumKey = class {};
|
|
52
50
|
__decorate([IsString(), __decorateMetadata("design:type", String)], AccumKey.prototype, "z", void 0);
|
|
@@ -55,14 +53,14 @@ __decorate([
|
|
|
55
53
|
ValidateNested(),
|
|
56
54
|
IsInstance(AccumKey),
|
|
57
55
|
Type(() => AccumKey),
|
|
58
|
-
__decorateMetadata("design:type", typeof
|
|
56
|
+
__decorateMetadata("design:type", typeof AccumKey === "undefined" ? Object : AccumKey)
|
|
59
57
|
], PublicKeys.prototype, "accumKey", void 0);
|
|
60
58
|
var CheqdRevocationRegistryDefinitionValue = class {};
|
|
61
59
|
__decorate([
|
|
62
60
|
ValidateNested(),
|
|
63
61
|
IsInstance(PublicKeys),
|
|
64
62
|
Type(() => PublicKeys),
|
|
65
|
-
__decorateMetadata("design:type", typeof
|
|
63
|
+
__decorateMetadata("design:type", typeof PublicKeys === "undefined" ? Object : PublicKeys)
|
|
66
64
|
], CheqdRevocationRegistryDefinitionValue.prototype, "publicKeys", void 0);
|
|
67
65
|
__decorate([IsNumber(), __decorateMetadata("design:type", Number)], CheqdRevocationRegistryDefinitionValue.prototype, "maxCredNum", void 0);
|
|
68
66
|
__decorate([IsString(), __decorateMetadata("design:type", String)], CheqdRevocationRegistryDefinitionValue.prototype, "tailsLocation", void 0);
|
|
@@ -84,7 +82,7 @@ __decorate([
|
|
|
84
82
|
ValidateNested(),
|
|
85
83
|
IsInstance(CheqdRevocationRegistryDefinitionValue),
|
|
86
84
|
Type(() => CheqdRevocationRegistryDefinitionValue),
|
|
87
|
-
__decorateMetadata("design:type", typeof
|
|
85
|
+
__decorateMetadata("design:type", typeof CheqdRevocationRegistryDefinitionValue === "undefined" ? Object : CheqdRevocationRegistryDefinitionValue)
|
|
88
86
|
], CheqdRevocationRegistryDefinition.prototype, "value", void 0);
|
|
89
87
|
var CheqdRevocationStatusList = class {
|
|
90
88
|
constructor(options) {
|
|
@@ -98,7 +96,7 @@ var CheqdRevocationStatusList = class {
|
|
|
98
96
|
__decorate([IsString(), __decorateMetadata("design:type", String)], CheqdRevocationStatusList.prototype, "revRegDefId", void 0);
|
|
99
97
|
__decorate([IsNumber({}, { each: true }), __decorateMetadata("design:type", Array)], CheqdRevocationStatusList.prototype, "revocationList", void 0);
|
|
100
98
|
__decorate([IsString(), __decorateMetadata("design:type", String)], CheqdRevocationStatusList.prototype, "currentAccumulator", void 0);
|
|
101
|
-
|
|
102
99
|
//#endregion
|
|
103
|
-
export { CheqdCredentialDefinition, CheqdRevocationRegistryDefinition, CheqdRevocationStatusList, CheqdSchema };
|
|
100
|
+
export { AccumKey, CheqdCredentialDefinition, CheqdCredentialDefinitionValue, CheqdRevocationRegistryDefinition, CheqdRevocationRegistryDefinitionValue, CheqdRevocationStatusList, CheqdSchema, PublicKeys };
|
|
101
|
+
|
|
104
102
|
//# sourceMappingURL=transform.mjs.map
|