@credo-ts/webvh 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.
Files changed (48) hide show
  1. package/README.md +4 -2
  2. package/build/WebVhApi.d.mts +1 -3
  3. package/build/WebVhApi.d.mts.map +1 -1
  4. package/build/WebVhApi.mjs +4 -6
  5. package/build/WebVhApi.mjs.map +1 -1
  6. package/build/WebVhModule.d.mts +1 -3
  7. package/build/WebVhModule.d.mts.map +1 -1
  8. package/build/WebVhModule.mjs +1 -2
  9. package/build/WebVhModule.mjs.map +1 -1
  10. package/build/_virtual/{_@oxc-project_runtime@0.112.0/helpers → _@oxc-project_runtime@0.151.0/helpers/esm}/decorate.mjs +2 -3
  11. package/build/_virtual/{_@oxc-project_runtime@0.112.0/helpers → _@oxc-project_runtime@0.151.0/helpers/esm}/decorateMetadata.mjs +2 -3
  12. package/build/anoncreds/index.d.mts +2 -1
  13. package/build/anoncreds/index.mjs +1 -0
  14. package/build/anoncreds/services/WebVhAnonCredsRegistry.d.mts +7 -10
  15. package/build/anoncreds/services/WebVhAnonCredsRegistry.d.mts.map +1 -1
  16. package/build/anoncreds/services/WebVhAnonCredsRegistry.mjs +3 -3
  17. package/build/anoncreds/services/WebVhAnonCredsRegistry.mjs.map +1 -1
  18. package/build/anoncreds/utils/transform.mjs +5 -7
  19. package/build/anoncreds/utils/transform.mjs.map +1 -1
  20. package/build/core.d.mts +2 -1
  21. package/build/core.mjs +1 -0
  22. package/build/dids/WebVhDidCrypto.mjs +1 -2
  23. package/build/dids/WebVhDidCrypto.mjs.map +1 -1
  24. package/build/dids/WebVhDidCryptoSigner.mjs +1 -2
  25. package/build/dids/WebVhDidCryptoSigner.mjs.map +1 -1
  26. package/build/dids/WebVhDidRegistrar.d.mts +3 -5
  27. package/build/dids/WebVhDidRegistrar.d.mts.map +1 -1
  28. package/build/dids/WebVhDidRegistrar.mjs +11 -10
  29. package/build/dids/WebVhDidRegistrar.mjs.map +1 -1
  30. package/build/dids/WebVhDidResolver.d.mts +1 -3
  31. package/build/dids/WebVhDidResolver.d.mts.map +1 -1
  32. package/build/dids/WebVhDidResolver.mjs +3 -3
  33. package/build/dids/WebVhDidResolver.mjs.map +1 -1
  34. package/build/dids/index.d.mts +2 -1
  35. package/build/dids/index.mjs +3 -2
  36. package/build/dids/webVhDidRecordMetadataTypes.d.mts +1 -3
  37. package/build/dids/webVhDidRecordMetadataTypes.d.mts.map +1 -1
  38. package/build/dids/webVhDidRecordMetadataTypes.mjs +1 -1
  39. package/build/dids/webVhDidRecordMetadataTypes.mjs.map +1 -1
  40. package/build/index.d.mts +1 -1
  41. package/build/index.mjs +1 -2
  42. package/build/resources/attestedResource.d.mts +12 -14
  43. package/build/resources/attestedResource.d.mts.map +1 -1
  44. package/build/resources/attestedResource.mjs +5 -7
  45. package/build/resources/attestedResource.mjs.map +1 -1
  46. package/build/resources/index.d.mts +2 -1
  47. package/build/resources/index.mjs +1 -0
  48. package/package.json +3 -3
package/README.md CHANGED
@@ -39,8 +39,10 @@ In order for this module to work, we have to inject it into the agent to access
39
39
  To use the WebVh module, register it with your agent instance. Below is an example of how to configure the agent with the WebVh AnonCreds registry, DID resolver, and DID registrar:
40
40
 
41
41
  ```typescript
42
- import { Agent, DidsModule, AnonCredsModule } from '@credo-ts/core'
43
- import { WebVhModule, WebVhAnonCredsRegistry, WebVhDidResolver, WebVhDidRegistrar } from '@credo-ts/webvh'
42
+ import { Agent, DidsModule } from '@credo-ts/core'
43
+ import { AnonCredsModule } from '@credo-ts/anoncreds'
44
+ import { WebVhAnonCredsRegistry } from '@credo-ts/webvh/anoncreds'
45
+ import { WebVhModule, WebVhDidResolver, WebVhDidRegistrar } from '@credo-ts/webvh'
44
46
 
45
47
  const agent = new Agent({
46
48
  config: options.config,
@@ -1,7 +1,6 @@
1
1
  import { AgentContext } from "@credo-ts/core";
2
-
3
2
  //#region src/WebVhApi.d.ts
4
- declare class WebVhApi {
3
+ export declare class WebVhApi {
5
4
  private agentContext;
6
5
  constructor(agentContext: AgentContext);
7
6
  resolveResource(resourceUrl: string): Promise<{
@@ -24,5 +23,4 @@ declare class WebVhApi {
24
23
  }>;
25
24
  }
26
25
  //#endregion
27
- export { WebVhApi };
28
26
  //# sourceMappingURL=WebVhApi.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WebVhApi.d.mts","names":[],"sources":["../src/WebVhApi.ts"],"mappings":";;;cAKa,QAAA;EAAA,QACH,YAAA;cAEW,YAAA,EAAc,YAAA;EAIpB,eAAA,CAAgB,WAAA,WAAmB,OAAA"}
1
+ {"version":3,"file":"WebVhApi.d.mts","names":[],"sources":["../src/WebVhApi.ts"],"mappings":";;qBAKa;UACH;EAEW,YAAA,cAAc;EAIpB,gBAAgB,sBAAmB"}
@@ -1,10 +1,8 @@
1
1
  import { WebVhDidResolver } from "./dids/WebVhDidResolver.mjs";
2
- import { __decorateMetadata } from "./_virtual/_@oxc-project_runtime@0.112.0/helpers/decorateMetadata.mjs";
3
- import { __decorate } from "./_virtual/_@oxc-project_runtime@0.112.0/helpers/decorate.mjs";
2
+ import __decorateMetadata from "./_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorateMetadata.mjs";
3
+ import __decorate from "./_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorate.mjs";
4
4
  import { AgentContext, injectable } from "@credo-ts/core";
5
-
6
5
  //#region src/WebVhApi.ts
7
- var _ref;
8
6
  let WebVhApi = class WebVhApi {
9
7
  constructor(agentContext) {
10
8
  this.agentContext = agentContext;
@@ -13,8 +11,8 @@ let WebVhApi = class WebVhApi {
13
11
  return await this.agentContext.dependencyManager.resolve(WebVhDidResolver).resolveResource(this.agentContext, resourceUrl);
14
12
  }
15
13
  };
16
- WebVhApi = __decorate([injectable(), __decorateMetadata("design:paramtypes", [typeof (_ref = typeof AgentContext !== "undefined" && AgentContext) === "function" ? _ref : Object])], WebVhApi);
17
-
14
+ WebVhApi = __decorate([injectable(), __decorateMetadata("design:paramtypes", [typeof AgentContext === "undefined" ? Object : AgentContext])], WebVhApi);
18
15
  //#endregion
19
16
  export { WebVhApi };
17
+
20
18
  //# sourceMappingURL=WebVhApi.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"WebVhApi.mjs","names":[],"sources":["../src/WebVhApi.ts"],"sourcesContent":["import { AgentContext, injectable } from '@credo-ts/core'\n\nimport { WebVhDidResolver } from './dids/WebVhDidResolver'\n\n@injectable()\nexport class WebVhApi {\n private agentContext: AgentContext\n\n public constructor(agentContext: AgentContext) {\n this.agentContext = agentContext\n }\n\n public async resolveResource(resourceUrl: string) {\n const webvhDidResolver = this.agentContext.dependencyManager.resolve(WebVhDidResolver)\n return await webvhDidResolver.resolveResource(this.agentContext, resourceUrl)\n }\n}\n"],"mappings":";;;;;;;AAKO,qBAAM,SAAS;CAGpB,AAAO,YAAY,cAA4B;AAC7C,OAAK,eAAe;;CAGtB,MAAa,gBAAgB,aAAqB;AAEhD,SAAO,MADkB,KAAK,aAAa,kBAAkB,QAAQ,iBAAiB,CACxD,gBAAgB,KAAK,cAAc,YAAY;;;uBAVhF,YAAY"}
1
+ {"version":3,"file":"WebVhApi.mjs","names":[],"sources":["../src/WebVhApi.ts"],"sourcesContent":["import { AgentContext, injectable } from '@credo-ts/core'\n\nimport { WebVhDidResolver } from './dids/WebVhDidResolver'\n\n@injectable()\nexport class WebVhApi {\n private agentContext: AgentContext\n\n public constructor(agentContext: AgentContext) {\n this.agentContext = agentContext\n }\n\n public async resolveResource(resourceUrl: string) {\n const webvhDidResolver = this.agentContext.dependencyManager.resolve(WebVhDidResolver)\n return await webvhDidResolver.resolveResource(this.agentContext, resourceUrl)\n }\n}\n"],"mappings":";;;;;AAKO,IAAM,WAAN,MAAM,SAAS;CAGpB,YAAmB,cAA4B;EAC7C,KAAK,eAAe;CACtB;CAEA,MAAa,gBAAgB,aAAqB;EAEhD,OAAO,MADkB,KAAK,aAAa,kBAAkB,QAAQ,gBACzC,CAAC,CAAC,gBAAgB,KAAK,cAAc,WAAW;CAC9E;AACF;AAZC,WAAA,WAAA,CAAA,WAAW,GAAA,mBAAA,qBAAA,CAAA,OAAA,iBAAA,cAAA,SAAA,YAAA,CAAA,CAAA,GAAA,QAAA"}
@@ -1,8 +1,7 @@
1
1
  import { WebVhApi } from "./WebVhApi.mjs";
2
2
  import { DependencyManager, Module } from "@credo-ts/core";
3
-
4
3
  //#region src/WebVhModule.d.ts
5
- declare class WebVhModule implements Module {
4
+ export declare class WebVhModule implements Module {
6
5
  readonly api: typeof WebVhApi;
7
6
  /**
8
7
  * Registers the dependencies of the WebVH module on the dependency manager.
@@ -10,5 +9,4 @@ declare class WebVhModule implements Module {
10
9
  register(dependencyManager: DependencyManager): void;
11
10
  }
12
11
  //#endregion
13
- export { WebVhModule };
14
12
  //# sourceMappingURL=WebVhModule.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WebVhModule.d.mts","names":[],"sources":["../src/WebVhModule.ts"],"mappings":";;;;cAIa,WAAA,YAAuB,MAAA;EAAA,SAClB,GAAA,SAAG,QAAA;EADR;;;EAMJ,QAAA,CAAS,iBAAA,EAAmB,iBAAA;AAAA"}
1
+ {"version":3,"file":"WebVhModule.d.mts","names":[],"sources":["../src/WebVhModule.ts"],"mappings":";;;qBAIa,uBAAuB;WAClB,YAAG;;;;EAKZ,SAAS,mBAAmB"}
@@ -2,7 +2,6 @@ import { WebVhDidRegistrar } from "./dids/WebVhDidRegistrar.mjs";
2
2
  import { WebVhDidResolver } from "./dids/WebVhDidResolver.mjs";
3
3
  import "./dids/index.mjs";
4
4
  import { WebVhApi } from "./WebVhApi.mjs";
5
-
6
5
  //#region src/WebVhModule.ts
7
6
  var WebVhModule = class {
8
7
  constructor() {
@@ -17,7 +16,7 @@ var WebVhModule = class {
17
16
  dependencyManager.registerContextScoped(WebVhApi);
18
17
  }
19
18
  };
20
-
21
19
  //#endregion
22
20
  export { WebVhModule };
21
+
23
22
  //# sourceMappingURL=WebVhModule.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"WebVhModule.mjs","names":[],"sources":["../src/WebVhModule.ts"],"sourcesContent":["import type { DependencyManager, Module } from '@credo-ts/core'\nimport { WebVhDidRegistrar, WebVhDidResolver } from './dids'\nimport { WebVhApi } from './WebVhApi'\n\nexport class WebVhModule implements Module {\n public readonly api = WebVhApi\n\n /**\n * Registers the dependencies of the WebVH module on the dependency manager.\n */\n public register(dependencyManager: DependencyManager) {\n dependencyManager.registerSingleton(WebVhDidResolver)\n dependencyManager.registerSingleton(WebVhDidRegistrar)\n dependencyManager.registerContextScoped(WebVhApi)\n }\n}\n"],"mappings":";;;;;;AAIA,IAAa,cAAb,MAA2C;;OACzB,MAAM;;;;;CAKtB,AAAO,SAAS,mBAAsC;AACpD,oBAAkB,kBAAkB,iBAAiB;AACrD,oBAAkB,kBAAkB,kBAAkB;AACtD,oBAAkB,sBAAsB,SAAS"}
1
+ {"version":3,"file":"WebVhModule.mjs","names":[],"sources":["../src/WebVhModule.ts"],"sourcesContent":["import type { DependencyManager, Module } from '@credo-ts/core'\nimport { WebVhDidRegistrar, WebVhDidResolver } from './dids'\nimport { WebVhApi } from './WebVhApi'\n\nexport class WebVhModule implements Module {\n public readonly api = WebVhApi\n\n /**\n * Registers the dependencies of the WebVH module on the dependency manager.\n */\n public register(dependencyManager: DependencyManager) {\n dependencyManager.registerSingleton(WebVhDidResolver)\n dependencyManager.registerSingleton(WebVhDidRegistrar)\n dependencyManager.registerContextScoped(WebVhApi)\n }\n}\n"],"mappings":";;;;;AAIA,IAAa,cAAb,MAA2C;;EACzC,KAAgB,MAAM;;;;;CAKtB,SAAgB,mBAAsC;EACpD,kBAAkB,kBAAkB,gBAAgB;EACpD,kBAAkB,kBAAkB,iBAAiB;EACrD,kBAAkB,sBAAsB,QAAQ;CAClD;AACF"}
@@ -1,10 +1,9 @@
1
- //#region \0@oxc-project+runtime@0.112.0/helpers/decorate.js
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.112.0/helpers/decorateMetadata.js
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 +1,2 @@
1
- import { WebVhAnonCredsRegistry } from "./services/WebVhAnonCredsRegistry.mjs";
1
+ import { WebVhAnonCredsRegistry } from "./services/WebVhAnonCredsRegistry.mjs";
2
+ export { WebVhAnonCredsRegistry };
@@ -1 +1,2 @@
1
1
  import { WebVhAnonCredsRegistry } from "./services/WebVhAnonCredsRegistry.mjs";
2
+ export { WebVhAnonCredsRegistry };
@@ -1,11 +1,9 @@
1
1
  import { WebVhAttestedResource } from "../../resources/attestedResource.mjs";
2
2
  import "../../resources/index.mjs";
3
- import * as _credo_ts_core0 from "@credo-ts/core";
4
3
  import { AgentContext, Proof, W3cDataIntegrityUnsecuredDocument } from "@credo-ts/core";
5
4
  import { AnonCredsRegistry, GetCredentialDefinitionReturn, GetRevocationRegistryDefinitionReturn, GetRevocationStatusListReturn, GetSchemaReturn, RegisterCredentialDefinitionOptions, RegisterCredentialDefinitionReturn, RegisterRevocationRegistryDefinitionOptions, RegisterRevocationRegistryDefinitionReturn, RegisterRevocationStatusListOptions, RegisterRevocationStatusListReturn, RegisterSchemaOptions, RegisterSchemaReturn } from "@credo-ts/anoncreds";
6
-
7
5
  //#region src/anoncreds/services/WebVhAnonCredsRegistry.d.ts
8
- declare class WebVhAnonCredsRegistry implements AnonCredsRegistry {
6
+ export declare class WebVhAnonCredsRegistry implements AnonCredsRegistry {
9
7
  methodName: string;
10
8
  allowsCaching: boolean;
11
9
  allowsLocalRecord: boolean;
@@ -35,39 +33,38 @@ declare class WebVhAnonCredsRegistry implements AnonCredsRegistry {
35
33
  proof?: Proof;
36
34
  } & Record<string, object>, extraInfo: Record<string, object>): Promise<{
37
35
  registrationMetadata: {
38
- proof: _credo_ts_core0.W3cDataIntegrityCryptosuiteProof;
36
+ proof: import("@credo-ts/core").W3cDataIntegrityCryptosuiteProof;
39
37
  };
40
38
  }>;
41
39
  registerRevocationStatusList(agentContext: AgentContext, options?: WebVhRegisterRevocationStatusListOptions): Promise<RegisterRevocationStatusListReturn>;
42
40
  verifyProof(agentContext: AgentContext, attestedResource: WebVhAttestedResource): Promise<boolean>;
43
- createProof(agentContext: AgentContext, unsecuredDocument: W3cDataIntegrityUnsecuredDocument, verificationMethod: string): Promise<_credo_ts_core0.W3cDataIntegrityCryptosuiteProof>;
41
+ createProof(agentContext: AgentContext, unsecuredDocument: W3cDataIntegrityUnsecuredDocument, verificationMethod: string): Promise<import("@credo-ts/core").W3cDataIntegrityCryptosuiteProof>;
44
42
  private buildSignedResource;
45
43
  private getVerificationMethodId;
46
44
  }
47
- type WebVhRegisterSchemaOptions = Omit<RegisterSchemaOptions, 'options'> & {
45
+ export type WebVhRegisterSchemaOptions = Omit<RegisterSchemaOptions, 'options'> & {
48
46
  options?: {
49
47
  verificationMethod?: string;
50
48
  extraMetadata?: Record<string, unknown>;
51
49
  };
52
50
  };
53
- type WebVhRegisterCredentialDefinitionOptions = Omit<RegisterCredentialDefinitionOptions, 'options'> & {
51
+ export type WebVhRegisterCredentialDefinitionOptions = Omit<RegisterCredentialDefinitionOptions, 'options'> & {
54
52
  options?: {
55
53
  verificationMethod?: string;
56
54
  extraMetadata?: Record<string, unknown>;
57
55
  };
58
56
  };
59
- type WebVhRegisterRevocationRegistryDefinitionOptions = Omit<RegisterRevocationRegistryDefinitionOptions, 'options'> & {
57
+ export type WebVhRegisterRevocationRegistryDefinitionOptions = Omit<RegisterRevocationRegistryDefinitionOptions, 'options'> & {
60
58
  options?: {
61
59
  verificationMethod?: string;
62
60
  extraMetadata?: Record<string, unknown>;
63
61
  };
64
62
  };
65
- type WebVhRegisterRevocationStatusListOptions = Omit<RegisterRevocationStatusListOptions, 'options'> & {
63
+ export type WebVhRegisterRevocationStatusListOptions = Omit<RegisterRevocationStatusListOptions, 'options'> & {
66
64
  options?: {
67
65
  verificationMethod?: string;
68
66
  extraMetadata?: Record<string, unknown>;
69
67
  };
70
68
  };
71
69
  //#endregion
72
- export { WebVhAnonCredsRegistry };
73
70
  //# sourceMappingURL=WebVhAnonCredsRegistry.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WebVhAnonCredsRegistry.d.mts","names":[],"sources":["../../../src/anoncreds/services/WebVhAnonCredsRegistry.ts"],"mappings":";;;;;;;cA2Ka,sBAAA,YAAkC,iBAAA;EACtC,UAAA;EAEA,aAAA;EACA,iBAAA;EAJI;;;EAAA,SASK,mBAAA,EAAmB,MAAA;EAsGE;;;;;;;;;EAAA,QA3F7B,gBAAA;EAAA,QAMM,mCAAA;EAqFD,SAAA,CAAU,YAAA,EAAc,YAAA,EAAc,QAAA,WAAmB,OAAA,CAAQ,eAAA;EA0DjE,uBAAA,CACX,YAAA,EAAc,YAAA,EACd,sBAAA,WACC,OAAA,CAAQ,6BAAA;EAiEE,+BAAA,CACX,YAAA,EAAc,YAAA,EACd,8BAAA,WACC,OAAA,CAAQ,qCAAA;EAqDE,uBAAA,CACX,YAAA,EAAc,YAAA,EACd,oBAAA,UACA,SAAA,WACC,OAAA,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AnonCredsRegistry.d.mts","names":[],"sources":["../../../src/anoncreds/services/WebVhAnonCredsRegistry.ts"],"mappings":";;;;;qBA2Ka,kCAAkC;EACtC;EAEA;EACA;;;;WAKS,qBAAmB;;;;;;;;;;UAW3B;UAMM;EAqFD,UAAU,cAAc,cAAc,mBAAmB,QAAQ;EA0DjE,wBACX,cAAc,cACd,iCACC,QAAQ;EAiEE,gCACX,cAAc,cACd,yCACC,QAAQ;EAqDE,wBACX,cAAc,cACd,8BACA,oBACC,QAAQ;EA8EE,eACX,cAAc,cACd,UAAU,6BACT,QAAQ;EA0BE,6BACX,cAAc,cACd,UAAU,2CACT,QAAQ;EA+BE,qCACX,cAAc,cACd,UAAU,mDACT,QAAQ;EAgCE,mCACX,cAAc,cACd;IAAwB,QAAQ;MAAU,wBAC1C,WAAW,yBAAsB;;;;;EAyBtB,6BACX,cAAc,cACd,UAAU,2CACT,QAAQ;EAkCE,YAAY,cAAc,cAAc,kBAAkB,wBAAwB;EA4BlF,YACX,cAAc,cACd,mBAAmB,mCACnB,6BAA0B,iCAAA;UAoBd;UAyCA;;YAqDJ,6BAA6B,KAAK;EAC5C;IACE;IACA,gBAAgB;;;YAIR,2CAA2C,KAAK;EAC1D;IACE;IACA,gBAAgB;;;YAIR,mDAAmD,KAC7D;EAGA;IACE;IACA,gBAAgB;;;YAIR,2CAA2C,KAAK;EAC1D;IACE;IACA,gBAAgB"}
@@ -5,7 +5,6 @@ import "../../resources/index.mjs";
5
5
  import { WebVhAnonCredsResource } from "../utils/transform.mjs";
6
6
  import { CredoError, DidRepository, JsonTransformer, MultiBaseEncoder, MultiHashEncoder, TypedArrayEncoder, W3cDataIntegrityApi, parseDid } from "@credo-ts/core";
7
7
  import { canonicalize } from "json-canonicalize";
8
-
9
8
  //#region src/anoncreds/services/WebVhAnonCredsRegistry.ts
10
9
  function isSchemaContentShape(value) {
11
10
  if (!value || typeof value !== "object") return false;
@@ -333,7 +332,8 @@ var WebVhAnonCredsRegistry = class {
333
332
  const { proof, ...restMetadata } = registrationMetadata;
334
333
  const vm = proof?.verificationMethod;
335
334
  if (!vm) throw new CredoError("verificationMethod not found in proof");
336
- const issuerId = parseDid(typeof vm === "string" ? vm : vm.id).did;
335
+ const previousVerificationMethod = typeof vm === "string" ? vm : vm.id;
336
+ const issuerId = parseDid(previousVerificationMethod).did;
337
337
  const verificationMethod = await this.getVerificationMethodId(agentContext, issuerId);
338
338
  const updatedMetadata = {
339
339
  ...restMetadata,
@@ -443,7 +443,7 @@ var WebVhAnonCredsRegistry = class {
443
443
  return authorizedIds.find((id) => didRecord.keys?.some((key) => id.endsWith(key.didDocumentRelativeKeyId))) ?? authorizedIds[0];
444
444
  }
445
445
  };
446
-
447
446
  //#endregion
448
447
  export { WebVhAnonCredsRegistry };
448
+
449
449
  //# sourceMappingURL=WebVhAnonCredsRegistry.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"WebVhAnonCredsRegistry.mjs","names":[],"sources":["../../../src/anoncreds/services/WebVhAnonCredsRegistry.ts"],"sourcesContent":["import type {\n AnonCredsCredentialDefinition,\n AnonCredsRegistry,\n AnonCredsRevocationRegistryDefinition,\n AnonCredsRevocationRegistryDefinitionValue,\n AnonCredsRevocationStatusList,\n AnonCredsRevocationStatusListWithoutTimestamp,\n AnonCredsSchema,\n GetCredentialDefinitionReturn,\n GetRevocationRegistryDefinitionReturn,\n GetRevocationStatusListReturn,\n GetSchemaReturn,\n RegisterCredentialDefinitionOptions,\n RegisterCredentialDefinitionReturn,\n RegisterRevocationRegistryDefinitionOptions,\n RegisterRevocationRegistryDefinitionReturn,\n RegisterRevocationStatusListOptions,\n RegisterRevocationStatusListReturn,\n RegisterSchemaOptions,\n RegisterSchemaReturn,\n} from '@credo-ts/anoncreds'\n\nimport {\n type AgentContext,\n CredoError,\n DidRepository,\n JsonTransformer,\n MultiBaseEncoder,\n MultiHashEncoder,\n type Proof,\n parseDid,\n TypedArrayEncoder,\n W3cDataIntegrityApi,\n type W3cDataIntegritySingleProofSecuredDocument,\n type W3cDataIntegrityUnsecuredDocument,\n} from '@credo-ts/core'\nimport { canonicalize } from 'json-canonicalize'\nimport { WebVhDidResolver } from '../../dids'\nimport { isWebVhAttestedResource, parseResourceId, WebVhAttestedResource } from '../../resources'\nimport { WebVhAnonCredsResource } from '../utils/transform'\n\ntype DidResourceResolutionResult = {\n error?: string\n message?: string\n content?: Record<string, unknown> | unknown[] | string // More specific than any, but still flexible\n contentMetadata?: Record<string, unknown>\n dereferencingMetadata?: Record<string, unknown>\n}\n\ntype SchemaContentShape = {\n attrNames: string[]\n name: string\n version: string\n issuerId: string\n}\n\ntype CredentialDefinitionContentShape = {\n issuerId: string\n schemaId: string\n type: string\n tag: string\n value: Record<string, unknown>\n}\n\ntype RevocationRegistryDefinitionContentShape = {\n issuerId: string\n revocDefType: string\n credDefId: string\n tag: string\n value: RevocationRegistryDefinitionValueShape\n}\n\ntype RevocationRegistryDefinitionValueShape = {\n publicKeys: {\n accumKey: {\n z: string\n }\n }\n maxCredNum: number\n tailsLocation: string\n tailsHash: string\n}\n\ntype RevocationStatusListShape = {\n issuerId: string\n revRegDefId: string\n revocationList: number[]\n currentAccumulator: string\n timestamp: number\n}\n\nfunction isSchemaContentShape(value: unknown): value is SchemaContentShape {\n if (!value || typeof value !== 'object') return false\n\n const candidate = value as Record<string, unknown>\n return (\n Array.isArray(candidate.attrNames) &&\n candidate.attrNames.every((item) => typeof item === 'string') &&\n typeof candidate.name === 'string' &&\n typeof candidate.version === 'string' &&\n typeof candidate.issuerId === 'string'\n )\n}\n\nfunction isCredentialDefinitionContentShape(value: unknown): value is CredentialDefinitionContentShape {\n if (!value || typeof value !== 'object') return false\n\n const candidate = value as Record<string, unknown>\n return (\n typeof candidate.issuerId === 'string' &&\n typeof candidate.schemaId === 'string' &&\n typeof candidate.type === 'string' &&\n typeof candidate.tag === 'string' &&\n !!candidate.value &&\n typeof candidate.value === 'object'\n )\n}\n\nfunction isRevocationRegistryDefinitionContentShape(value: unknown): value is RevocationRegistryDefinitionContentShape {\n if (!value || typeof value !== 'object') return false\n\n const candidate = value as Record<string, unknown>\n return (\n typeof candidate.issuerId === 'string' &&\n typeof candidate.revocDefType === 'string' &&\n typeof candidate.credDefId === 'string' &&\n typeof candidate.tag === 'string' &&\n isRevocationRegistryDefinitionValueShape(candidate.value)\n )\n}\n\nfunction isRevocationRegistryDefinitionValueShape(value: unknown): value is RevocationRegistryDefinitionValueShape {\n if (!value || typeof value !== 'object') return false\n\n const candidate = value as Record<string, unknown>\n const publicKeys = candidate.publicKeys as Record<string, unknown> | undefined\n const accumKey = publicKeys?.accumKey as Record<string, unknown> | undefined\n\n return (\n !!publicKeys &&\n typeof publicKeys === 'object' &&\n !!accumKey &&\n typeof accumKey === 'object' &&\n typeof accumKey.z === 'string' &&\n typeof candidate.maxCredNum === 'number' &&\n typeof candidate.tailsLocation === 'string' &&\n typeof candidate.tailsHash === 'string'\n )\n}\n\nfunction isRevocationStatusListShape(value: unknown): value is RevocationStatusListShape {\n if (!value || typeof value !== 'object') return false\n\n const candidate = value as Record<string, unknown>\n\n return (\n typeof candidate.issuerId === 'string' &&\n typeof candidate.revRegDefId === 'string' &&\n Array.isArray(candidate.revocationList) &&\n candidate.revocationList.every((item) => typeof item === 'number') &&\n typeof candidate.currentAccumulator === 'string' &&\n typeof candidate.timestamp === 'number'\n )\n}\n\n/**\n * Attested resources are always signed with, and verified against, a verification method that is\n * authorized for the `assertionMethod` verification relationship.\n */\nconst ATTESTED_RESOURCE_PROOF_PURPOSE = 'assertionMethod' as const\n\nexport class WebVhAnonCredsRegistry implements AnonCredsRegistry {\n public methodName = 'webvh'\n\n public allowsCaching = true\n public allowsLocalRecord = true\n\n /**\n * This class supports resolving objects with did:webvh identifiers.\n */\n public readonly supportedIdentifier = /^did:webvh:.*/\n\n /**\n * Resolves a resource using the WebVhDidResolver and performs common validation steps.\n *\n * @param agentContext The agent context.\n * @param resourceId The DID URI of the resource to resolve.\n * @param resourceTypeString A descriptive string for the resource type (e.g., 'schema', 'credential definition') used in logs/errors.\n * @returns The parsed and validated resource object and the original resolution result.\n * @throws {CredoError} If resolution, parsing, or validation fails.\n */\n private _digestMultibase(value: string) {\n const valueBytes = TypedArrayEncoder.fromUtf8String(value)\n const digestMultihash = MultiHashEncoder.encode(valueBytes, 'sha-256')\n const digestMultibase = MultiBaseEncoder.encode(digestMultihash, 'base58btc')\n return digestMultibase\n }\n private async _resolveAndValidateAttestedResource(\n agentContext: AgentContext,\n resourceId: string,\n resourceTypeString: string\n ): Promise<{ resourceObject: WebVhAttestedResource; resolutionResult: DidResourceResolutionResult }> {\n try {\n const webvhDidResolver = agentContext.dependencyManager.resolve(WebVhDidResolver)\n if (!this.supportedIdentifier.test(resourceId))\n throw new CredoError(`Invalid ${resourceTypeString} ID: ${resourceId}`)\n\n agentContext.config.logger.trace(\n `Attempting to resolve ${resourceTypeString} resource '${resourceId}' via did:webvh resolver`\n )\n\n const resolutionResult = await webvhDidResolver.resolveResource(agentContext, resourceId)\n\n if (!resolutionResult) {\n throw new CredoError(`Resource resolution returned null/undefined for ${resourceId}`)\n }\n\n if ('error' in resolutionResult || !('content' in resolutionResult)) {\n throw new CredoError(\n `Resource ${resourceId} could not be resolved or is missing data. Error: ${resolutionResult.error || 'unknown'} - ${resolutionResult.message || 'no message'}`\n )\n }\n\n let resourceObject: WebVhAnonCredsResource\n try {\n agentContext.config.logger.trace(\n `Parsing resource data: ${JSON.stringify(resolutionResult.content).substring(0, 200)}...`\n )\n resourceObject = JsonTransformer.fromJSON(resolutionResult.content, WebVhAnonCredsResource)\n } catch (parseError) {\n agentContext.config.logger.error(`Failed to parse resource data for ${resourceId}`, {\n error: parseError instanceof Error ? parseError.message : String(parseError),\n stack: parseError instanceof Error ? parseError.stack : undefined,\n })\n throw new CredoError(\n `Failed to parse resource data for ${resourceId}: ${\n parseError instanceof Error ? parseError.message : String(parseError)\n }`\n )\n }\n\n // --- Attested Resource Validation steps ---\n\n // 1. Data Model Verification\n if (!isWebVhAttestedResource(resourceObject)) {\n throw new CredoError('Missing AttestedResource type.')\n }\n agentContext.config.logger.trace(`Resource ${resourceId} attestation found.`)\n\n // 2. DataIntegrityProof Verification\n const verified = await this.verifyProof(agentContext, resourceObject)\n if (!verified) {\n agentContext.config.logger.trace('Resolved resource proof is invalid.')\n throw new CredoError('Resolved resource proof is invalid.')\n }\n agentContext.config.logger.trace(`Resource ${resourceId} proof validated.`)\n\n // 3. Resource Digest Multibase Verification\n if (resourceObject.id !== resourceId) {\n throw new CredoError(`ID mismatch ${resourceObject.id} != ${resourceId}`)\n }\n const parts = resourceId.split(/[:/]/)\n const expectedMultibaseHash = parts[parts.length - 1]\n if (!expectedMultibaseHash) {\n throw new CredoError(`Could not extract expected hash from ${resourceTypeString} ID: ${resourceId}`)\n }\n const digestMultibase = this._digestMultibase(canonicalize(resourceObject.content))\n\n if (digestMultibase !== expectedMultibaseHash) {\n throw new CredoError(\n `Content hash mismatch for ${resourceId}. Expected: ${expectedMultibaseHash}, Actual: ${digestMultibase}`\n )\n }\n agentContext.config.logger.trace(`Resource ${resourceId} content hash matches filename.`)\n\n return { resourceObject, resolutionResult }\n } catch (error) {\n agentContext.config.logger.error('Error in did:webvh _resolveAndValidateAttestedResource:', error)\n throw error\n }\n }\n\n public async getSchema(agentContext: AgentContext, schemaId: string): Promise<GetSchemaReturn> {\n try {\n const { resourceObject, resolutionResult } = await this._resolveAndValidateAttestedResource(\n agentContext,\n schemaId,\n 'schema'\n )\n\n // --- Parsing Step (Simplified) ---\n const schemaContent = resourceObject.content\n\n // Type check to ensure we have a schema content object\n if (!isSchemaContentShape(schemaContent)) {\n throw new CredoError(`Parsed resource content for ${schemaId} is not a valid schema.`)\n }\n\n const contentIssuerId = schemaContent.issuerId\n\n const parsedSchemaId = parseResourceId(schemaId)\n if (!parsedSchemaId) {\n throw new CredoError(`Could not extract DID from resource ID: ${schemaId}`)\n }\n const expectedIssuerDid = parsedSchemaId.did\n\n if (contentIssuerId !== expectedIssuerDid) {\n throw new CredoError(\n `Issuer ID mismatch for ${schemaId}. Expected: ${expectedIssuerDid}, Actual: ${contentIssuerId}`\n )\n }\n\n return {\n schema: {\n attrNames: schemaContent.attrNames,\n name: schemaContent.name,\n version: schemaContent.version,\n issuerId: contentIssuerId,\n },\n schemaId,\n resolutionMetadata: resolutionResult.dereferencingMetadata || {},\n schemaMetadata: resourceObject.metadata || {},\n }\n } catch (error) {\n agentContext.config.logger.error(`Error retrieving schema '${schemaId}' via did:webvh`, {\n error: error instanceof Error ? error.message : String(error),\n schemaId,\n })\n\n return {\n schemaId,\n resolutionMetadata: {\n error: 'invalid',\n message: `unable to resolve schema: ${error instanceof Error ? error.message : String(error)}`,\n },\n schemaMetadata: {},\n }\n }\n }\n\n public async getCredentialDefinition(\n agentContext: AgentContext,\n credentialDefinitionId: string\n ): Promise<GetCredentialDefinitionReturn> {\n try {\n const { resourceObject, resolutionResult } = await this._resolveAndValidateAttestedResource(\n agentContext,\n credentialDefinitionId,\n 'credential definition'\n )\n\n // Extract the content and make sure it's a CredDef\n const credDefContent = resourceObject.content\n // Type check for WebVhCredDefContent\n if (!isCredentialDefinitionContentShape(credDefContent)) {\n throw new CredoError('Resolved resource content is not a valid credential definition.')\n }\n\n const contentIssuerId = credDefContent.issuerId\n\n // Extract the DID from the resourceId (part before /resources/hash)\n const parsedCredentialDefinitionId = parseResourceId(credentialDefinitionId)\n if (!parsedCredentialDefinitionId) {\n throw new CredoError(`Could not extract DID from resource ID: ${credentialDefinitionId}`)\n }\n const expectedIssuerDid = parsedCredentialDefinitionId.did\n\n if (contentIssuerId !== expectedIssuerDid) {\n throw new CredoError(\n `Issuer ID mismatch for ${credentialDefinitionId}. Expected: ${expectedIssuerDid}, Actual: ${contentIssuerId}`\n )\n }\n\n // Extract metadata from the resolved resource\n const credDefMetadata = resourceObject.metadata || resolutionResult.contentMetadata || {}\n\n return {\n credentialDefinition: {\n issuerId: credDefContent.issuerId,\n schemaId: credDefContent.schemaId,\n type: 'CL' as const, // Assuming CL type for now, might need adjustment if other types are supported\n tag: credDefContent.tag,\n value: credDefContent.value as { primary: Record<string, unknown>; revocation?: unknown }, // Assuming structure\n },\n credentialDefinitionId,\n resolutionMetadata: resolutionResult.dereferencingMetadata || {},\n credentialDefinitionMetadata: credDefMetadata,\n }\n } catch (error) {\n agentContext.config.logger.error(\n `Error retrieving credential definition '${credentialDefinitionId}' via did:webvh`,\n {\n error: error instanceof Error ? error.message : String(error),\n credentialDefinitionId,\n }\n )\n\n return {\n credentialDefinitionId,\n resolutionMetadata: {\n error: 'invalid',\n message: `unable to resolve credential definition: ${error instanceof Error ? error.message : String(error)}`,\n },\n credentialDefinitionMetadata: {},\n }\n }\n }\n\n public async getRevocationRegistryDefinition(\n agentContext: AgentContext,\n revocationRegistryDefinitionId: string\n ): Promise<GetRevocationRegistryDefinitionReturn> {\n try {\n const { resourceObject, resolutionResult } = await this._resolveAndValidateAttestedResource(\n agentContext,\n revocationRegistryDefinitionId,\n 'revocation registry definition'\n )\n\n const revRegDefContent = resourceObject.content\n\n if (!isRevocationRegistryDefinitionContentShape(revRegDefContent)) {\n throw new CredoError(\n `Parsed resource content for ${revocationRegistryDefinitionId} is not a valid revocation registry definition.`\n )\n }\n\n // Extract metadata\n const revRegDefMetadata = resourceObject.metadata || resolutionResult.contentMetadata || {}\n\n return {\n revocationRegistryDefinition: {\n issuerId: revRegDefContent.issuerId,\n revocDefType: revRegDefContent.revocDefType as AnonCredsRevocationRegistryDefinition['revocDefType'], // TODO: Map revocDefType string to AnonCreds type\n credDefId: revRegDefContent.credDefId,\n tag: revRegDefContent.tag,\n value: revRegDefContent.value as AnonCredsRevocationRegistryDefinitionValue,\n },\n revocationRegistryDefinitionId,\n resolutionMetadata: resolutionResult.dereferencingMetadata || {},\n revocationRegistryDefinitionMetadata: revRegDefMetadata,\n }\n } catch (error) {\n agentContext.config.logger.error(\n `Error retrieving revocation registry definition '${revocationRegistryDefinitionId}' via did:webvh`,\n {\n error: error instanceof Error ? error.message : String(error),\n revocationRegistryDefinitionId,\n }\n )\n\n return {\n revocationRegistryDefinitionId,\n resolutionMetadata: {\n error: 'invalid',\n message: `unable to resolve revocation registry definition: ${\n error instanceof Error ? error.message : String(error)\n }`,\n },\n revocationRegistryDefinitionMetadata: {},\n }\n }\n }\n\n public async getRevocationStatusList(\n agentContext: AgentContext,\n revocationRegistryId: string,\n timestamp: number\n ): Promise<GetRevocationStatusListReturn> {\n try {\n if (!revocationRegistryId.startsWith('did:webvh:'))\n throw new CredoError(`Invalid revocationRegistryId: ${revocationRegistryId}`)\n\n agentContext.config.logger.trace(\n `Attempting to resolve revocation status list resource for '${revocationRegistryId}' at timestamp ${timestamp} via did:webvh resolver`\n )\n const { resourceObject } = await this._resolveAndValidateAttestedResource(\n agentContext,\n revocationRegistryId,\n 'revocation status list'\n )\n if (!resourceObject.links) {\n throw new CredoError('No revocation entries found.')\n }\n\n const revocationEntries = resourceObject.links\n .filter((entry) => entry.timestamp != null)\n .sort((a, b) => (a.timestamp ?? 0) - (b.timestamp ?? 0))\n if (!revocationEntries || revocationEntries.length === 0) {\n throw new CredoError('No revocation entries found.')\n }\n\n let revocationEntryId: string | undefined\n for (const [index, entry] of revocationEntries?.entries() ?? []) {\n if (entry.timestamp && entry.timestamp > timestamp) {\n revocationEntryId = revocationEntries?.[index - 1]?.id\n break\n }\n }\n if (!revocationEntryId) {\n revocationEntryId = revocationEntries?.[revocationEntries.length - 1]?.id\n }\n\n const { resourceObject: revocationEntryResourceObject, resolutionResult: revocationEntryResolutionResult } =\n await this._resolveAndValidateAttestedResource(agentContext, revocationEntryId, 'revocation status list entry')\n\n if (!revocationEntryResourceObject) {\n throw new CredoError('No revocation entry found for the given timestamp.')\n }\n\n // The signed attested resource does not embed the timestamp, so we inject it before validating the shape\n const selectedEntry = revocationEntries.find((entry) => entry.id === revocationEntryId)\n const revocationStatusListContent = {\n ...(revocationEntryResourceObject.content as object),\n timestamp: selectedEntry?.timestamp,\n }\n\n if (!isRevocationStatusListShape(revocationStatusListContent)) {\n throw new CredoError('Resolved revocation entry content is not a valid revocation status list.')\n }\n\n return {\n revocationStatusList: revocationStatusListContent as AnonCredsRevocationStatusList,\n resolutionMetadata: revocationEntryResolutionResult.dereferencingMetadata || {},\n revocationStatusListMetadata: revocationEntryResourceObject.metadata || {},\n }\n } catch (error) {\n agentContext.config.logger.error(\n `Error retrieving revocation registry status list '${revocationRegistryId}' via did:webvh`,\n {\n error: error instanceof Error ? error.message : String(error),\n revocationRegistryId,\n timestamp,\n }\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 public async registerSchema(\n agentContext: AgentContext,\n options?: WebVhRegisterSchemaOptions\n ): Promise<RegisterSchemaReturn> {\n if (!options?.schema) throw new CredoError('Schema options must be provided.')\n\n const resourceId = this._digestMultibase(canonicalize(options.schema))\n const schemaId = `${options.schema.issuerId}/resources/${resourceId}`\n\n const attestedResource = await this.buildSignedResource(agentContext, {\n content: options.schema,\n id: schemaId,\n metadata: {\n resourceId,\n resourceType: 'anonCredsSchema',\n resourceName: options.schema.name,\n ...options.options?.extraMetadata,\n },\n issuerId: options.schema.issuerId,\n verificationMethod: options?.options?.verificationMethod,\n })\n\n return {\n schemaState: { state: 'finished', schema: options.schema, schemaId },\n registrationMetadata: { attestedResource },\n schemaMetadata: {},\n }\n }\n\n public async registerCredentialDefinition(\n agentContext: AgentContext,\n options?: WebVhRegisterCredentialDefinitionOptions\n ): Promise<RegisterCredentialDefinitionReturn> {\n if (!options?.credentialDefinition) throw new CredoError('credentialDefinition options must be provided.')\n\n const resourceId = this._digestMultibase(canonicalize(options.credentialDefinition))\n\n const credentialDefinitionId = `${options.credentialDefinition.issuerId}/resources/${resourceId}`\n\n const attestedResource = await this.buildSignedResource(agentContext, {\n content: options.credentialDefinition,\n id: credentialDefinitionId,\n metadata: {\n resourceId,\n resourceType: 'anonCredsCredDef',\n resourceName: options.credentialDefinition.tag,\n ...options.options?.extraMetadata,\n },\n issuerId: options.credentialDefinition.issuerId,\n verificationMethod: options.options?.verificationMethod,\n })\n\n return {\n credentialDefinitionState: {\n state: 'finished',\n credentialDefinition: options.credentialDefinition,\n credentialDefinitionId,\n },\n credentialDefinitionMetadata: {},\n registrationMetadata: { attestedResource },\n }\n }\n\n public async registerRevocationRegistryDefinition(\n agentContext: AgentContext,\n options?: WebVhRegisterRevocationRegistryDefinitionOptions\n ): Promise<RegisterRevocationRegistryDefinitionReturn> {\n if (!options?.revocationRegistryDefinition)\n throw new CredoError('revocationRegistryDefinition options must be provided.')\n\n const resourceId = this._digestMultibase(canonicalize(options.revocationRegistryDefinition))\n\n const revocationRegistryDefinitionId = `${options.revocationRegistryDefinition.issuerId}/resources/${resourceId}`\n\n const attestedResource = await this.buildSignedResource(agentContext, {\n content: options.revocationRegistryDefinition,\n id: revocationRegistryDefinitionId,\n metadata: {\n resourceId,\n resourceType: 'anonCredsRevocRegDef',\n resourceName: options.revocationRegistryDefinition.tag,\n ...options.options?.extraMetadata,\n },\n issuerId: options.revocationRegistryDefinition.issuerId,\n verificationMethod: options.options?.verificationMethod,\n })\n\n return {\n revocationRegistryDefinitionState: {\n state: 'finished',\n revocationRegistryDefinition: options.revocationRegistryDefinition,\n revocationRegistryDefinitionId,\n },\n registrationMetadata: { attestedResource },\n revocationRegistryDefinitionMetadata: {},\n }\n }\n\n public async updateRevocationRegistryDefinition(\n agentContext: AgentContext,\n registrationMetadata: { proof?: Proof } & Record<string, object>,\n extraInfo: Record<string, object>\n ) {\n const { proof, ...restMetadata } = registrationMetadata\n\n const vm = proof?.verificationMethod\n if (!vm) throw new CredoError('verificationMethod not found in proof')\n const previousVerificationMethod = typeof vm === 'string' ? vm : vm.id\n\n // Re-select an authorized verification method rather than reusing the one from the previous\n // proof, which may never have been authorized for the proof purpose in the first place.\n const issuerId = parseDid(previousVerificationMethod).did\n const verificationMethod = await this.getVerificationMethodId(agentContext, issuerId)\n\n const updatedMetadata = { ...restMetadata, ...extraInfo }\n\n const newProof = await this.createProof(agentContext, updatedMetadata, verificationMethod)\n\n return {\n registrationMetadata: {\n ...updatedMetadata,\n proof: newProof,\n },\n }\n }\n\n public async registerRevocationStatusList(\n agentContext: AgentContext,\n options?: WebVhRegisterRevocationStatusListOptions\n ): Promise<RegisterRevocationStatusListReturn> {\n if (!options?.revocationStatusList) throw new CredoError('revocationStatusList options must be provided.')\n\n const timestamp = Math.floor(Date.now() / 1000)\n const resourceId = this._digestMultibase(canonicalize(options.revocationStatusList))\n\n const resourceStatusListId = `${options.revocationStatusList.issuerId}/resources/${resourceId}`\n\n const attestedResource = await this.buildSignedResource(agentContext, {\n content: options.revocationStatusList,\n id: resourceStatusListId,\n metadata: {\n resourceId,\n resourceType: 'anonCredsStatusList',\n resourceName: '0',\n ...options.options?.extraMetadata,\n },\n issuerId: options.revocationStatusList.issuerId,\n verificationMethod: options?.options?.verificationMethod,\n })\n\n return {\n revocationStatusListState: {\n state: 'finished',\n revocationStatusList: { ...options.revocationStatusList, timestamp },\n },\n registrationMetadata: { attestedResource },\n revocationStatusListMetadata: {\n previousVersionId: '',\n nextVersionId: '',\n },\n }\n }\n\n public async verifyProof(agentContext: AgentContext, attestedResource: WebVhAttestedResource): Promise<boolean> {\n const dataIntegrity = agentContext.dependencyManager.resolve(W3cDataIntegrityApi)\n try {\n const verificationResult = await dataIntegrity.verifyProof(\n {\n ...attestedResource,\n } as W3cDataIntegritySingleProofSecuredDocument,\n { expectedProofPurpose: ATTESTED_RESOURCE_PROOF_PURPOSE }\n )\n\n if (!verificationResult.verified) {\n agentContext.config.logger.error('Proof validation of did:webvh resource failed', {\n resourceId: attestedResource.id,\n verificationMethod: attestedResource.proof?.verificationMethod,\n errors: verificationResult.errors,\n })\n }\n\n return verificationResult.verified\n } catch (error) {\n agentContext.config.logger.error('Error during proof validation of did:webvh resource', {\n error: error instanceof Error ? error.message : String(error),\n stack: error instanceof Error ? error.stack : undefined,\n })\n return false\n }\n }\n\n public async createProof(\n agentContext: AgentContext,\n unsecuredDocument: W3cDataIntegrityUnsecuredDocument,\n verificationMethod: string\n ) {\n const dataIntegrity = agentContext.dependencyManager.resolve(W3cDataIntegrityApi)\n try {\n const creationResult = await dataIntegrity.createProofOrThrow({\n unsecuredDocument,\n cryptosuite: 'eddsa-jcs-2022',\n verificationMethod,\n proofPurpose: ATTESTED_RESOURCE_PROOF_PURPOSE,\n })\n return creationResult.proof\n } catch (error) {\n agentContext.config.logger.error('Error during proof creation of did:webvh resource', {\n error: error instanceof Error ? error.message : String(error),\n stack: error instanceof Error ? error.stack : undefined,\n })\n throw error\n }\n }\n\n private async buildSignedResource(\n agentContext: AgentContext,\n {\n content,\n id,\n metadata,\n issuerId,\n verificationMethod,\n }: {\n content:\n | AnonCredsSchema\n | AnonCredsCredentialDefinition\n | AnonCredsRevocationRegistryDefinition\n | AnonCredsRevocationStatusListWithoutTimestamp\n id: string\n metadata: Record<string, unknown>\n issuerId: string\n verificationMethod?: string\n }\n ) {\n const verificationMethodId = await this.getVerificationMethodId(agentContext, issuerId, verificationMethod)\n\n // Prepare the generic resource payload to be signed\n const resourcePayload = {\n '@context': [\n 'https://identity.foundation/did-attested-resources/context/v0.1',\n 'https://w3id.org/security/data-integrity/v2',\n ],\n type: ['AttestedResource'],\n id,\n content,\n metadata,\n }\n\n const proof = await this.createProof(agentContext, resourcePayload, verificationMethodId)\n return {\n ...resourcePayload,\n proof,\n }\n }\n\n private async getVerificationMethodId(\n agentContext: AgentContext,\n issuerId: string,\n explicitVerificationMethod?: string\n ): Promise<string> {\n const didRepository = agentContext.dependencyManager.resolve(DidRepository)\n\n const didRecord = await didRepository.findCreatedDid(agentContext, issuerId)\n if (!didRecord) {\n throw new CredoError(`No DID found for issuer ${issuerId}`)\n }\n\n const didDocument = didRecord.didDocument\n if (!didDocument) {\n throw new CredoError(`No did document stored on the did record for issuer ${issuerId}`)\n }\n\n // Relative references ('#key-1') are valid within a did document, but a proof's\n // verificationMethod must resolve on its own, so we always return an absolute did url.\n const toAbsoluteId = (id: string) => (id.startsWith('#') ? `${didDocument.id}${id}` : id)\n\n if (explicitVerificationMethod) {\n try {\n return toAbsoluteId(\n didDocument.dereferenceKey(explicitVerificationMethod, [ATTESTED_RESOURCE_PROOF_PURPOSE]).id\n )\n } catch (error) {\n throw new CredoError(\n `Verification method '${explicitVerificationMethod}' is not authorized for '${ATTESTED_RESOURCE_PROOF_PURPOSE}' in the did document of issuer ${issuerId}`,\n { cause: error }\n )\n }\n }\n\n const authorizedMethods = didDocument.findVerificationMethodsByTypeAndPurpose('Multikey', ['assertionMethod'])\n const authorizedIds = authorizedMethods.map((method) => toAbsoluteId(method.id))\n\n if (authorizedIds.length === 0) {\n throw new CredoError(\n `No verification method authorized for '${ATTESTED_RESOURCE_PROOF_PURPOSE}' found in the did document of issuer ${issuerId}`\n )\n }\n\n // Prefer a verification method this agent holds the key for. Did records created before keys\n // were tracked have none, and signing those still resolves the key id from the public key, so\n // the first authorized method remains the fallback rather than an error.\n return (\n authorizedIds.find((id) => didRecord.keys?.some((key) => id.endsWith(key.didDocumentRelativeKeyId))) ??\n authorizedIds[0]\n )\n }\n}\n\nexport type WebVhRegisterSchemaOptions = Omit<RegisterSchemaOptions, 'options'> & {\n options?: {\n verificationMethod?: string\n extraMetadata?: Record<string, unknown>\n }\n}\n\nexport type WebVhRegisterCredentialDefinitionOptions = Omit<RegisterCredentialDefinitionOptions, 'options'> & {\n options?: {\n verificationMethod?: string\n extraMetadata?: Record<string, unknown>\n }\n}\n\nexport type WebVhRegisterRevocationRegistryDefinitionOptions = Omit<\n RegisterRevocationRegistryDefinitionOptions,\n 'options'\n> & {\n options?: {\n verificationMethod?: string\n extraMetadata?: Record<string, unknown>\n }\n}\n\nexport type WebVhRegisterRevocationStatusListOptions = Omit<RegisterRevocationStatusListOptions, 'options'> & {\n options?: {\n verificationMethod?: string\n extraMetadata?: Record<string, unknown>\n }\n}\n"],"mappings":";;;;;;;;;AA2FA,SAAS,qBAAqB,OA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M,uBAAuB,MAAM,KAAK,wBAAwB,cAAc,UAAU,mBAAmB;EAG3G,MAAM,kBAAkB;GACtB,YAAY,CACV,mEACA,8CACD;GACD,MAAM,CAAC,mBAAmB;GAC1B;GACA;GACA;GACD;EAED,MAAM,QAAQ,MAAM,KAAK,YAAY,cAAc,iBAAiB,qBAAqB;AACzF,SAAO;GACL,GAAG;GACH;GACD;;CAGH,MAAc,wBACZ,cACA,UACA,4BACiB;EAGjB,MAAM,YAAY,MAFI,aAAa,kBAAkB,QAAQ,cAAc,CAErC,eAAe,cAAc,SAAS;AAC5E,MAAI,CAAC,UACH,OAAM,IAAI,WAAW,2BAA2B,WAAW;EAG7D,MAAM,cAAc,UAAU;AAC9B,MAAI,CAAC,YACH,OAAM,IAAI,WAAW,uDAAuD,WAAW;EAKzF,MAAM,gBAAgB,OAAgB,GAAG,WAAW,IAAI,GAAG,GAAG,YAAY,KAAK,OAAO;AAEtF,MAAI,2BACF,KAAI;AACF,UAAO,aACL,YAAY,eAAe,4BAA4B,CAAC,gCAAgC,CAAC,CAAC,GAC3F;WACM,OAAO;AACd,SAAM,IAAI,WACR,wBAAwB,2BAA2B,2BAA2B,gCAAgC,kCAAkC,YAChJ,EAAE,OAAO,OAAO,CACjB;;EAKL,MAAM,gBADoB,YAAY,wCAAwC,YAAY,CAAC,kBAAkB,CAAC,CACtE,KAAK,WAAW,aAAa,OAAO,GAAG,CAAC;AAEhF,MAAI,cAAc,WAAW,EAC3B,OAAM,IAAI,WACR,0CAA0C,gCAAgC,wCAAwC,WACnH;AAMH,SACE,cAAc,MAAM,OAAO,UAAU,MAAM,MAAM,QAAQ,GAAG,SAAS,IAAI,yBAAyB,CAAC,CAAC,IACpG,cAAc"}
1
+ {"version":3,"file":"WebVhAnonCredsRegistry.mjs","names":[],"sources":["../../../src/anoncreds/services/WebVhAnonCredsRegistry.ts"],"sourcesContent":["import type {\n AnonCredsCredentialDefinition,\n AnonCredsRegistry,\n AnonCredsRevocationRegistryDefinition,\n AnonCredsRevocationRegistryDefinitionValue,\n AnonCredsRevocationStatusList,\n AnonCredsRevocationStatusListWithoutTimestamp,\n AnonCredsSchema,\n GetCredentialDefinitionReturn,\n GetRevocationRegistryDefinitionReturn,\n GetRevocationStatusListReturn,\n GetSchemaReturn,\n RegisterCredentialDefinitionOptions,\n RegisterCredentialDefinitionReturn,\n RegisterRevocationRegistryDefinitionOptions,\n RegisterRevocationRegistryDefinitionReturn,\n RegisterRevocationStatusListOptions,\n RegisterRevocationStatusListReturn,\n RegisterSchemaOptions,\n RegisterSchemaReturn,\n} from '@credo-ts/anoncreds'\n\nimport {\n type AgentContext,\n CredoError,\n DidRepository,\n JsonTransformer,\n MultiBaseEncoder,\n MultiHashEncoder,\n type Proof,\n parseDid,\n TypedArrayEncoder,\n W3cDataIntegrityApi,\n type W3cDataIntegritySingleProofSecuredDocument,\n type W3cDataIntegrityUnsecuredDocument,\n} from '@credo-ts/core'\nimport { canonicalize } from 'json-canonicalize'\nimport { WebVhDidResolver } from '../../dids'\nimport { isWebVhAttestedResource, parseResourceId, WebVhAttestedResource } from '../../resources'\nimport { WebVhAnonCredsResource } from '../utils/transform'\n\ntype DidResourceResolutionResult = {\n error?: string\n message?: string\n content?: Record<string, unknown> | unknown[] | string // More specific than any, but still flexible\n contentMetadata?: Record<string, unknown>\n dereferencingMetadata?: Record<string, unknown>\n}\n\ntype SchemaContentShape = {\n attrNames: string[]\n name: string\n version: string\n issuerId: string\n}\n\ntype CredentialDefinitionContentShape = {\n issuerId: string\n schemaId: string\n type: string\n tag: string\n value: Record<string, unknown>\n}\n\ntype RevocationRegistryDefinitionContentShape = {\n issuerId: string\n revocDefType: string\n credDefId: string\n tag: string\n value: RevocationRegistryDefinitionValueShape\n}\n\ntype RevocationRegistryDefinitionValueShape = {\n publicKeys: {\n accumKey: {\n z: string\n }\n }\n maxCredNum: number\n tailsLocation: string\n tailsHash: string\n}\n\ntype RevocationStatusListShape = {\n issuerId: string\n revRegDefId: string\n revocationList: number[]\n currentAccumulator: string\n timestamp: number\n}\n\nfunction isSchemaContentShape(value: unknown): value is SchemaContentShape {\n if (!value || typeof value !== 'object') return false\n\n const candidate = value as Record<string, unknown>\n return (\n Array.isArray(candidate.attrNames) &&\n candidate.attrNames.every((item) => typeof item === 'string') &&\n typeof candidate.name === 'string' &&\n typeof candidate.version === 'string' &&\n typeof candidate.issuerId === 'string'\n )\n}\n\nfunction isCredentialDefinitionContentShape(value: unknown): value is CredentialDefinitionContentShape {\n if (!value || typeof value !== 'object') return false\n\n const candidate = value as Record<string, unknown>\n return (\n typeof candidate.issuerId === 'string' &&\n typeof candidate.schemaId === 'string' &&\n typeof candidate.type === 'string' &&\n typeof candidate.tag === 'string' &&\n !!candidate.value &&\n typeof candidate.value === 'object'\n )\n}\n\nfunction isRevocationRegistryDefinitionContentShape(value: unknown): value is RevocationRegistryDefinitionContentShape {\n if (!value || typeof value !== 'object') return false\n\n const candidate = value as Record<string, unknown>\n return (\n typeof candidate.issuerId === 'string' &&\n typeof candidate.revocDefType === 'string' &&\n typeof candidate.credDefId === 'string' &&\n typeof candidate.tag === 'string' &&\n isRevocationRegistryDefinitionValueShape(candidate.value)\n )\n}\n\nfunction isRevocationRegistryDefinitionValueShape(value: unknown): value is RevocationRegistryDefinitionValueShape {\n if (!value || typeof value !== 'object') return false\n\n const candidate = value as Record<string, unknown>\n const publicKeys = candidate.publicKeys as Record<string, unknown> | undefined\n const accumKey = publicKeys?.accumKey as Record<string, unknown> | undefined\n\n return (\n !!publicKeys &&\n typeof publicKeys === 'object' &&\n !!accumKey &&\n typeof accumKey === 'object' &&\n typeof accumKey.z === 'string' &&\n typeof candidate.maxCredNum === 'number' &&\n typeof candidate.tailsLocation === 'string' &&\n typeof candidate.tailsHash === 'string'\n )\n}\n\nfunction isRevocationStatusListShape(value: unknown): value is RevocationStatusListShape {\n if (!value || typeof value !== 'object') return false\n\n const candidate = value as Record<string, unknown>\n\n return (\n typeof candidate.issuerId === 'string' &&\n typeof candidate.revRegDefId === 'string' &&\n Array.isArray(candidate.revocationList) &&\n candidate.revocationList.every((item) => typeof item === 'number') &&\n typeof candidate.currentAccumulator === 'string' &&\n typeof candidate.timestamp === 'number'\n )\n}\n\n/**\n * Attested resources are always signed with, and verified against, a verification method that is\n * authorized for the `assertionMethod` verification relationship.\n */\nconst ATTESTED_RESOURCE_PROOF_PURPOSE = 'assertionMethod' as const\n\nexport class WebVhAnonCredsRegistry implements AnonCredsRegistry {\n public methodName = 'webvh'\n\n public allowsCaching = true\n public allowsLocalRecord = true\n\n /**\n * This class supports resolving objects with did:webvh identifiers.\n */\n public readonly supportedIdentifier = /^did:webvh:.*/\n\n /**\n * Resolves a resource using the WebVhDidResolver and performs common validation steps.\n *\n * @param agentContext The agent context.\n * @param resourceId The DID URI of the resource to resolve.\n * @param resourceTypeString A descriptive string for the resource type (e.g., 'schema', 'credential definition') used in logs/errors.\n * @returns The parsed and validated resource object and the original resolution result.\n * @throws {CredoError} If resolution, parsing, or validation fails.\n */\n private _digestMultibase(value: string) {\n const valueBytes = TypedArrayEncoder.fromUtf8String(value)\n const digestMultihash = MultiHashEncoder.encode(valueBytes, 'sha-256')\n const digestMultibase = MultiBaseEncoder.encode(digestMultihash, 'base58btc')\n return digestMultibase\n }\n private async _resolveAndValidateAttestedResource(\n agentContext: AgentContext,\n resourceId: string,\n resourceTypeString: string\n ): Promise<{ resourceObject: WebVhAttestedResource; resolutionResult: DidResourceResolutionResult }> {\n try {\n const webvhDidResolver = agentContext.dependencyManager.resolve(WebVhDidResolver)\n if (!this.supportedIdentifier.test(resourceId))\n throw new CredoError(`Invalid ${resourceTypeString} ID: ${resourceId}`)\n\n agentContext.config.logger.trace(\n `Attempting to resolve ${resourceTypeString} resource '${resourceId}' via did:webvh resolver`\n )\n\n const resolutionResult = await webvhDidResolver.resolveResource(agentContext, resourceId)\n\n if (!resolutionResult) {\n throw new CredoError(`Resource resolution returned null/undefined for ${resourceId}`)\n }\n\n if ('error' in resolutionResult || !('content' in resolutionResult)) {\n throw new CredoError(\n `Resource ${resourceId} could not be resolved or is missing data. Error: ${resolutionResult.error || 'unknown'} - ${resolutionResult.message || 'no message'}`\n )\n }\n\n let resourceObject: WebVhAnonCredsResource\n try {\n agentContext.config.logger.trace(\n `Parsing resource data: ${JSON.stringify(resolutionResult.content).substring(0, 200)}...`\n )\n resourceObject = JsonTransformer.fromJSON(resolutionResult.content, WebVhAnonCredsResource)\n } catch (parseError) {\n agentContext.config.logger.error(`Failed to parse resource data for ${resourceId}`, {\n error: parseError instanceof Error ? parseError.message : String(parseError),\n stack: parseError instanceof Error ? parseError.stack : undefined,\n })\n throw new CredoError(\n `Failed to parse resource data for ${resourceId}: ${\n parseError instanceof Error ? parseError.message : String(parseError)\n }`\n )\n }\n\n // --- Attested Resource Validation steps ---\n\n // 1. Data Model Verification\n if (!isWebVhAttestedResource(resourceObject)) {\n throw new CredoError('Missing AttestedResource type.')\n }\n agentContext.config.logger.trace(`Resource ${resourceId} attestation found.`)\n\n // 2. DataIntegrityProof Verification\n const verified = await this.verifyProof(agentContext, resourceObject)\n if (!verified) {\n agentContext.config.logger.trace('Resolved resource proof is invalid.')\n throw new CredoError('Resolved resource proof is invalid.')\n }\n agentContext.config.logger.trace(`Resource ${resourceId} proof validated.`)\n\n // 3. Resource Digest Multibase Verification\n if (resourceObject.id !== resourceId) {\n throw new CredoError(`ID mismatch ${resourceObject.id} != ${resourceId}`)\n }\n const parts = resourceId.split(/[:/]/)\n const expectedMultibaseHash = parts[parts.length - 1]\n if (!expectedMultibaseHash) {\n throw new CredoError(`Could not extract expected hash from ${resourceTypeString} ID: ${resourceId}`)\n }\n const digestMultibase = this._digestMultibase(canonicalize(resourceObject.content))\n\n if (digestMultibase !== expectedMultibaseHash) {\n throw new CredoError(\n `Content hash mismatch for ${resourceId}. Expected: ${expectedMultibaseHash}, Actual: ${digestMultibase}`\n )\n }\n agentContext.config.logger.trace(`Resource ${resourceId} content hash matches filename.`)\n\n return { resourceObject, resolutionResult }\n } catch (error) {\n agentContext.config.logger.error('Error in did:webvh _resolveAndValidateAttestedResource:', error)\n throw error\n }\n }\n\n public async getSchema(agentContext: AgentContext, schemaId: string): Promise<GetSchemaReturn> {\n try {\n const { resourceObject, resolutionResult } = await this._resolveAndValidateAttestedResource(\n agentContext,\n schemaId,\n 'schema'\n )\n\n // --- Parsing Step (Simplified) ---\n const schemaContent = resourceObject.content\n\n // Type check to ensure we have a schema content object\n if (!isSchemaContentShape(schemaContent)) {\n throw new CredoError(`Parsed resource content for ${schemaId} is not a valid schema.`)\n }\n\n const contentIssuerId = schemaContent.issuerId\n\n const parsedSchemaId = parseResourceId(schemaId)\n if (!parsedSchemaId) {\n throw new CredoError(`Could not extract DID from resource ID: ${schemaId}`)\n }\n const expectedIssuerDid = parsedSchemaId.did\n\n if (contentIssuerId !== expectedIssuerDid) {\n throw new CredoError(\n `Issuer ID mismatch for ${schemaId}. Expected: ${expectedIssuerDid}, Actual: ${contentIssuerId}`\n )\n }\n\n return {\n schema: {\n attrNames: schemaContent.attrNames,\n name: schemaContent.name,\n version: schemaContent.version,\n issuerId: contentIssuerId,\n },\n schemaId,\n resolutionMetadata: resolutionResult.dereferencingMetadata || {},\n schemaMetadata: resourceObject.metadata || {},\n }\n } catch (error) {\n agentContext.config.logger.error(`Error retrieving schema '${schemaId}' via did:webvh`, {\n error: error instanceof Error ? error.message : String(error),\n schemaId,\n })\n\n return {\n schemaId,\n resolutionMetadata: {\n error: 'invalid',\n message: `unable to resolve schema: ${error instanceof Error ? error.message : String(error)}`,\n },\n schemaMetadata: {},\n }\n }\n }\n\n public async getCredentialDefinition(\n agentContext: AgentContext,\n credentialDefinitionId: string\n ): Promise<GetCredentialDefinitionReturn> {\n try {\n const { resourceObject, resolutionResult } = await this._resolveAndValidateAttestedResource(\n agentContext,\n credentialDefinitionId,\n 'credential definition'\n )\n\n // Extract the content and make sure it's a CredDef\n const credDefContent = resourceObject.content\n // Type check for WebVhCredDefContent\n if (!isCredentialDefinitionContentShape(credDefContent)) {\n throw new CredoError('Resolved resource content is not a valid credential definition.')\n }\n\n const contentIssuerId = credDefContent.issuerId\n\n // Extract the DID from the resourceId (part before /resources/hash)\n const parsedCredentialDefinitionId = parseResourceId(credentialDefinitionId)\n if (!parsedCredentialDefinitionId) {\n throw new CredoError(`Could not extract DID from resource ID: ${credentialDefinitionId}`)\n }\n const expectedIssuerDid = parsedCredentialDefinitionId.did\n\n if (contentIssuerId !== expectedIssuerDid) {\n throw new CredoError(\n `Issuer ID mismatch for ${credentialDefinitionId}. Expected: ${expectedIssuerDid}, Actual: ${contentIssuerId}`\n )\n }\n\n // Extract metadata from the resolved resource\n const credDefMetadata = resourceObject.metadata || resolutionResult.contentMetadata || {}\n\n return {\n credentialDefinition: {\n issuerId: credDefContent.issuerId,\n schemaId: credDefContent.schemaId,\n type: 'CL' as const, // Assuming CL type for now, might need adjustment if other types are supported\n tag: credDefContent.tag,\n value: credDefContent.value as { primary: Record<string, unknown>; revocation?: unknown }, // Assuming structure\n },\n credentialDefinitionId,\n resolutionMetadata: resolutionResult.dereferencingMetadata || {},\n credentialDefinitionMetadata: credDefMetadata,\n }\n } catch (error) {\n agentContext.config.logger.error(\n `Error retrieving credential definition '${credentialDefinitionId}' via did:webvh`,\n {\n error: error instanceof Error ? error.message : String(error),\n credentialDefinitionId,\n }\n )\n\n return {\n credentialDefinitionId,\n resolutionMetadata: {\n error: 'invalid',\n message: `unable to resolve credential definition: ${error instanceof Error ? error.message : String(error)}`,\n },\n credentialDefinitionMetadata: {},\n }\n }\n }\n\n public async getRevocationRegistryDefinition(\n agentContext: AgentContext,\n revocationRegistryDefinitionId: string\n ): Promise<GetRevocationRegistryDefinitionReturn> {\n try {\n const { resourceObject, resolutionResult } = await this._resolveAndValidateAttestedResource(\n agentContext,\n revocationRegistryDefinitionId,\n 'revocation registry definition'\n )\n\n const revRegDefContent = resourceObject.content\n\n if (!isRevocationRegistryDefinitionContentShape(revRegDefContent)) {\n throw new CredoError(\n `Parsed resource content for ${revocationRegistryDefinitionId} is not a valid revocation registry definition.`\n )\n }\n\n // Extract metadata\n const revRegDefMetadata = resourceObject.metadata || resolutionResult.contentMetadata || {}\n\n return {\n revocationRegistryDefinition: {\n issuerId: revRegDefContent.issuerId,\n revocDefType: revRegDefContent.revocDefType as AnonCredsRevocationRegistryDefinition['revocDefType'], // TODO: Map revocDefType string to AnonCreds type\n credDefId: revRegDefContent.credDefId,\n tag: revRegDefContent.tag,\n value: revRegDefContent.value as AnonCredsRevocationRegistryDefinitionValue,\n },\n revocationRegistryDefinitionId,\n resolutionMetadata: resolutionResult.dereferencingMetadata || {},\n revocationRegistryDefinitionMetadata: revRegDefMetadata,\n }\n } catch (error) {\n agentContext.config.logger.error(\n `Error retrieving revocation registry definition '${revocationRegistryDefinitionId}' via did:webvh`,\n {\n error: error instanceof Error ? error.message : String(error),\n revocationRegistryDefinitionId,\n }\n )\n\n return {\n revocationRegistryDefinitionId,\n resolutionMetadata: {\n error: 'invalid',\n message: `unable to resolve revocation registry definition: ${\n error instanceof Error ? error.message : String(error)\n }`,\n },\n revocationRegistryDefinitionMetadata: {},\n }\n }\n }\n\n public async getRevocationStatusList(\n agentContext: AgentContext,\n revocationRegistryId: string,\n timestamp: number\n ): Promise<GetRevocationStatusListReturn> {\n try {\n if (!revocationRegistryId.startsWith('did:webvh:'))\n throw new CredoError(`Invalid revocationRegistryId: ${revocationRegistryId}`)\n\n agentContext.config.logger.trace(\n `Attempting to resolve revocation status list resource for '${revocationRegistryId}' at timestamp ${timestamp} via did:webvh resolver`\n )\n const { resourceObject } = await this._resolveAndValidateAttestedResource(\n agentContext,\n revocationRegistryId,\n 'revocation status list'\n )\n if (!resourceObject.links) {\n throw new CredoError('No revocation entries found.')\n }\n\n const revocationEntries = resourceObject.links\n .filter((entry) => entry.timestamp != null)\n .sort((a, b) => (a.timestamp ?? 0) - (b.timestamp ?? 0))\n if (!revocationEntries || revocationEntries.length === 0) {\n throw new CredoError('No revocation entries found.')\n }\n\n let revocationEntryId: string | undefined\n for (const [index, entry] of revocationEntries?.entries() ?? []) {\n if (entry.timestamp && entry.timestamp > timestamp) {\n revocationEntryId = revocationEntries?.[index - 1]?.id\n break\n }\n }\n if (!revocationEntryId) {\n revocationEntryId = revocationEntries?.[revocationEntries.length - 1]?.id\n }\n\n const { resourceObject: revocationEntryResourceObject, resolutionResult: revocationEntryResolutionResult } =\n await this._resolveAndValidateAttestedResource(agentContext, revocationEntryId, 'revocation status list entry')\n\n if (!revocationEntryResourceObject) {\n throw new CredoError('No revocation entry found for the given timestamp.')\n }\n\n // The signed attested resource does not embed the timestamp, so we inject it before validating the shape\n const selectedEntry = revocationEntries.find((entry) => entry.id === revocationEntryId)\n const revocationStatusListContent = {\n ...(revocationEntryResourceObject.content as object),\n timestamp: selectedEntry?.timestamp,\n }\n\n if (!isRevocationStatusListShape(revocationStatusListContent)) {\n throw new CredoError('Resolved revocation entry content is not a valid revocation status list.')\n }\n\n return {\n revocationStatusList: revocationStatusListContent as AnonCredsRevocationStatusList,\n resolutionMetadata: revocationEntryResolutionResult.dereferencingMetadata || {},\n revocationStatusListMetadata: revocationEntryResourceObject.metadata || {},\n }\n } catch (error) {\n agentContext.config.logger.error(\n `Error retrieving revocation registry status list '${revocationRegistryId}' via did:webvh`,\n {\n error: error instanceof Error ? error.message : String(error),\n revocationRegistryId,\n timestamp,\n }\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 public async registerSchema(\n agentContext: AgentContext,\n options?: WebVhRegisterSchemaOptions\n ): Promise<RegisterSchemaReturn> {\n if (!options?.schema) throw new CredoError('Schema options must be provided.')\n\n const resourceId = this._digestMultibase(canonicalize(options.schema))\n const schemaId = `${options.schema.issuerId}/resources/${resourceId}`\n\n const attestedResource = await this.buildSignedResource(agentContext, {\n content: options.schema,\n id: schemaId,\n metadata: {\n resourceId,\n resourceType: 'anonCredsSchema',\n resourceName: options.schema.name,\n ...options.options?.extraMetadata,\n },\n issuerId: options.schema.issuerId,\n verificationMethod: options?.options?.verificationMethod,\n })\n\n return {\n schemaState: { state: 'finished', schema: options.schema, schemaId },\n registrationMetadata: { attestedResource },\n schemaMetadata: {},\n }\n }\n\n public async registerCredentialDefinition(\n agentContext: AgentContext,\n options?: WebVhRegisterCredentialDefinitionOptions\n ): Promise<RegisterCredentialDefinitionReturn> {\n if (!options?.credentialDefinition) throw new CredoError('credentialDefinition options must be provided.')\n\n const resourceId = this._digestMultibase(canonicalize(options.credentialDefinition))\n\n const credentialDefinitionId = `${options.credentialDefinition.issuerId}/resources/${resourceId}`\n\n const attestedResource = await this.buildSignedResource(agentContext, {\n content: options.credentialDefinition,\n id: credentialDefinitionId,\n metadata: {\n resourceId,\n resourceType: 'anonCredsCredDef',\n resourceName: options.credentialDefinition.tag,\n ...options.options?.extraMetadata,\n },\n issuerId: options.credentialDefinition.issuerId,\n verificationMethod: options.options?.verificationMethod,\n })\n\n return {\n credentialDefinitionState: {\n state: 'finished',\n credentialDefinition: options.credentialDefinition,\n credentialDefinitionId,\n },\n credentialDefinitionMetadata: {},\n registrationMetadata: { attestedResource },\n }\n }\n\n public async registerRevocationRegistryDefinition(\n agentContext: AgentContext,\n options?: WebVhRegisterRevocationRegistryDefinitionOptions\n ): Promise<RegisterRevocationRegistryDefinitionReturn> {\n if (!options?.revocationRegistryDefinition)\n throw new CredoError('revocationRegistryDefinition options must be provided.')\n\n const resourceId = this._digestMultibase(canonicalize(options.revocationRegistryDefinition))\n\n const revocationRegistryDefinitionId = `${options.revocationRegistryDefinition.issuerId}/resources/${resourceId}`\n\n const attestedResource = await this.buildSignedResource(agentContext, {\n content: options.revocationRegistryDefinition,\n id: revocationRegistryDefinitionId,\n metadata: {\n resourceId,\n resourceType: 'anonCredsRevocRegDef',\n resourceName: options.revocationRegistryDefinition.tag,\n ...options.options?.extraMetadata,\n },\n issuerId: options.revocationRegistryDefinition.issuerId,\n verificationMethod: options.options?.verificationMethod,\n })\n\n return {\n revocationRegistryDefinitionState: {\n state: 'finished',\n revocationRegistryDefinition: options.revocationRegistryDefinition,\n revocationRegistryDefinitionId,\n },\n registrationMetadata: { attestedResource },\n revocationRegistryDefinitionMetadata: {},\n }\n }\n\n public async updateRevocationRegistryDefinition(\n agentContext: AgentContext,\n registrationMetadata: { proof?: Proof } & Record<string, object>,\n extraInfo: Record<string, object>\n ) {\n const { proof, ...restMetadata } = registrationMetadata\n\n const vm = proof?.verificationMethod\n if (!vm) throw new CredoError('verificationMethod not found in proof')\n const previousVerificationMethod = typeof vm === 'string' ? vm : vm.id\n\n // Re-select an authorized verification method rather than reusing the one from the previous\n // proof, which may never have been authorized for the proof purpose in the first place.\n const issuerId = parseDid(previousVerificationMethod).did\n const verificationMethod = await this.getVerificationMethodId(agentContext, issuerId)\n\n const updatedMetadata = { ...restMetadata, ...extraInfo }\n\n const newProof = await this.createProof(agentContext, updatedMetadata, verificationMethod)\n\n return {\n registrationMetadata: {\n ...updatedMetadata,\n proof: newProof,\n },\n }\n }\n\n public async registerRevocationStatusList(\n agentContext: AgentContext,\n options?: WebVhRegisterRevocationStatusListOptions\n ): Promise<RegisterRevocationStatusListReturn> {\n if (!options?.revocationStatusList) throw new CredoError('revocationStatusList options must be provided.')\n\n const timestamp = Math.floor(Date.now() / 1000)\n const resourceId = this._digestMultibase(canonicalize(options.revocationStatusList))\n\n const resourceStatusListId = `${options.revocationStatusList.issuerId}/resources/${resourceId}`\n\n const attestedResource = await this.buildSignedResource(agentContext, {\n content: options.revocationStatusList,\n id: resourceStatusListId,\n metadata: {\n resourceId,\n resourceType: 'anonCredsStatusList',\n resourceName: '0',\n ...options.options?.extraMetadata,\n },\n issuerId: options.revocationStatusList.issuerId,\n verificationMethod: options?.options?.verificationMethod,\n })\n\n return {\n revocationStatusListState: {\n state: 'finished',\n revocationStatusList: { ...options.revocationStatusList, timestamp },\n },\n registrationMetadata: { attestedResource },\n revocationStatusListMetadata: {\n previousVersionId: '',\n nextVersionId: '',\n },\n }\n }\n\n public async verifyProof(agentContext: AgentContext, attestedResource: WebVhAttestedResource): Promise<boolean> {\n const dataIntegrity = agentContext.dependencyManager.resolve(W3cDataIntegrityApi)\n try {\n const verificationResult = await dataIntegrity.verifyProof(\n {\n ...attestedResource,\n } as W3cDataIntegritySingleProofSecuredDocument,\n { expectedProofPurpose: ATTESTED_RESOURCE_PROOF_PURPOSE }\n )\n\n if (!verificationResult.verified) {\n agentContext.config.logger.error('Proof validation of did:webvh resource failed', {\n resourceId: attestedResource.id,\n verificationMethod: attestedResource.proof?.verificationMethod,\n errors: verificationResult.errors,\n })\n }\n\n return verificationResult.verified\n } catch (error) {\n agentContext.config.logger.error('Error during proof validation of did:webvh resource', {\n error: error instanceof Error ? error.message : String(error),\n stack: error instanceof Error ? error.stack : undefined,\n })\n return false\n }\n }\n\n public async createProof(\n agentContext: AgentContext,\n unsecuredDocument: W3cDataIntegrityUnsecuredDocument,\n verificationMethod: string\n ) {\n const dataIntegrity = agentContext.dependencyManager.resolve(W3cDataIntegrityApi)\n try {\n const creationResult = await dataIntegrity.createProofOrThrow({\n unsecuredDocument,\n cryptosuite: 'eddsa-jcs-2022',\n verificationMethod,\n proofPurpose: ATTESTED_RESOURCE_PROOF_PURPOSE,\n })\n return creationResult.proof\n } catch (error) {\n agentContext.config.logger.error('Error during proof creation of did:webvh resource', {\n error: error instanceof Error ? error.message : String(error),\n stack: error instanceof Error ? error.stack : undefined,\n })\n throw error\n }\n }\n\n private async buildSignedResource(\n agentContext: AgentContext,\n {\n content,\n id,\n metadata,\n issuerId,\n verificationMethod,\n }: {\n content:\n | AnonCredsSchema\n | AnonCredsCredentialDefinition\n | AnonCredsRevocationRegistryDefinition\n | AnonCredsRevocationStatusListWithoutTimestamp\n id: string\n metadata: Record<string, unknown>\n issuerId: string\n verificationMethod?: string\n }\n ) {\n const verificationMethodId = await this.getVerificationMethodId(agentContext, issuerId, verificationMethod)\n\n // Prepare the generic resource payload to be signed\n const resourcePayload = {\n '@context': [\n 'https://identity.foundation/did-attested-resources/context/v0.1',\n 'https://w3id.org/security/data-integrity/v2',\n ],\n type: ['AttestedResource'],\n id,\n content,\n metadata,\n }\n\n const proof = await this.createProof(agentContext, resourcePayload, verificationMethodId)\n return {\n ...resourcePayload,\n proof,\n }\n }\n\n private async getVerificationMethodId(\n agentContext: AgentContext,\n issuerId: string,\n explicitVerificationMethod?: string\n ): Promise<string> {\n const didRepository = agentContext.dependencyManager.resolve(DidRepository)\n\n const didRecord = await didRepository.findCreatedDid(agentContext, issuerId)\n if (!didRecord) {\n throw new CredoError(`No DID found for issuer ${issuerId}`)\n }\n\n const didDocument = didRecord.didDocument\n if (!didDocument) {\n throw new CredoError(`No did document stored on the did record for issuer ${issuerId}`)\n }\n\n // Relative references ('#key-1') are valid within a did document, but a proof's\n // verificationMethod must resolve on its own, so we always return an absolute did url.\n const toAbsoluteId = (id: string) => (id.startsWith('#') ? `${didDocument.id}${id}` : id)\n\n if (explicitVerificationMethod) {\n try {\n return toAbsoluteId(\n didDocument.dereferenceKey(explicitVerificationMethod, [ATTESTED_RESOURCE_PROOF_PURPOSE]).id\n )\n } catch (error) {\n throw new CredoError(\n `Verification method '${explicitVerificationMethod}' is not authorized for '${ATTESTED_RESOURCE_PROOF_PURPOSE}' in the did document of issuer ${issuerId}`,\n { cause: error }\n )\n }\n }\n\n const authorizedMethods = didDocument.findVerificationMethodsByTypeAndPurpose('Multikey', ['assertionMethod'])\n const authorizedIds = authorizedMethods.map((method) => toAbsoluteId(method.id))\n\n if (authorizedIds.length === 0) {\n throw new CredoError(\n `No verification method authorized for '${ATTESTED_RESOURCE_PROOF_PURPOSE}' found in the did document of issuer ${issuerId}`\n )\n }\n\n // Prefer a verification method this agent holds the key for. Did records created before keys\n // were tracked have none, and signing those still resolves the key id from the public key, so\n // the first authorized method remains the fallback rather than an error.\n return (\n authorizedIds.find((id) => didRecord.keys?.some((key) => id.endsWith(key.didDocumentRelativeKeyId))) ??\n authorizedIds[0]\n )\n }\n}\n\nexport type WebVhRegisterSchemaOptions = Omit<RegisterSchemaOptions, 'options'> & {\n options?: {\n verificationMethod?: string\n extraMetadata?: Record<string, unknown>\n }\n}\n\nexport type WebVhRegisterCredentialDefinitionOptions = Omit<RegisterCredentialDefinitionOptions, 'options'> & {\n options?: {\n verificationMethod?: string\n extraMetadata?: Record<string, unknown>\n }\n}\n\nexport type WebVhRegisterRevocationRegistryDefinitionOptions = Omit<\n RegisterRevocationRegistryDefinitionOptions,\n 'options'\n> & {\n options?: {\n verificationMethod?: string\n extraMetadata?: Record<string, unknown>\n }\n}\n\nexport type WebVhRegisterRevocationStatusListOptions = Omit<RegisterRevocationStatusListOptions, 'options'> & {\n options?: {\n verificationMethod?: string\n extraMetadata?: Record<string, unknown>\n }\n}\n"],"mappings":";;;;;;;;AA2FA,SAAS,qBAAqB,OAA6C;CACzE,IAAI,CAAC,SAAS,OAAO,UAAU,UAAU,OAAO;CAEhD,MAAM,YAAY;CAClB,OACE,MAAM,QAAQ,UAAU,SAAS,KACjC,UAAU,UAAU,OAAO,SAAS,OAAO,SAAS,QAAQ,KAC5D,OAAO,UAAU,SAAS,YAC1B,OAAO,UAAU,YAAY,YAC7B,OAAO,UAAU,aAAa;AAElC;AAEA,SAAS,mCAAmC,OAA2D;CACrG,IAAI,CAAC,SAAS,OAAO,UAAU,UAAU,OAAO;CAEhD,MAAM,YAAY;CAClB,OACE,OAAO,UAAU,aAAa,YAC9B,OAAO,UAAU,aAAa,YAC9B,OAAO,UAAU,SAAS,YAC1B,OAAO,UAAU,QAAQ,YACzB,CAAC,CAAC,UAAU,SACZ,OAAO,UAAU,UAAU;AAE/B;AAEA,SAAS,2CAA2C,OAAmE;CACrH,IAAI,CAAC,SAAS,OAAO,UAAU,UAAU,OAAO;CAEhD,MAAM,YAAY;CAClB,OACE,OAAO,UAAU,aAAa,YAC9B,OAAO,UAAU,iBAAiB,YAClC,OAAO,UAAU,cAAc,YAC/B,OAAO,UAAU,QAAQ,YACzB,yCAAyC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AAM,IAAI,WAAW,uDAAuD,UAAU;EAKxF,MAAM,gBAAgB,OAAgB,GAAG,WAAW,GAAG,IAAI,GAAG,YAAY,KAAK,OAAO;EAEtF,IAAI,4BACF,IAAI;GACF,OAAO,aACL,YAAY,eAAe,4BAA4B,CAAC,+BAA+B,CAAC,CAAC,CAAC,EAC5F;EACF,SAAS,OAAO;GACd,MAAM,IAAI,WACR,wBAAwB,2BAA2B,2BAA2B,gCAAgC,kCAAkC,YAChJ,EAAE,OAAO,MAAM,CACjB;EACF;EAIF,MAAM,gBADoB,YAAY,wCAAwC,YAAY,CAAC,iBAAiB,CACtE,CAAC,CAAC,KAAK,WAAW,aAAa,OAAO,EAAE,CAAC;EAE/E,IAAI,cAAc,WAAW,GAC3B,MAAM,IAAI,WACR,0CAA0C,gCAAgC,wCAAwC,UACpH;EAMF,OACE,cAAc,MAAM,OAAO,UAAU,MAAM,MAAM,QAAQ,GAAG,SAAS,IAAI,wBAAwB,CAAC,CAAC,KACnG,cAAc;CAElB;AACF"}
@@ -1,13 +1,11 @@
1
- import { __decorateMetadata } from "../../_virtual/_@oxc-project_runtime@0.112.0/helpers/decorateMetadata.mjs";
2
- import { __decorate } from "../../_virtual/_@oxc-project_runtime@0.112.0/helpers/decorate.mjs";
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 { WebVhAttestedResource } from "../../resources/attestedResource.mjs";
4
4
  import "../../resources/index.mjs";
5
5
  import { JsonTransformer } from "@credo-ts/core";
6
6
  import { Expose, Transform, Type } from "class-transformer";
7
7
  import { ArrayMinSize, IsArray, IsNumber, IsObject, IsOptional, IsString } from "class-validator";
8
-
9
8
  //#region src/anoncreds/utils/transform.ts
10
- var _ref;
11
9
  var WebVhSchemaContent = class {};
12
10
  __decorate([
13
11
  IsArray(),
@@ -28,7 +26,7 @@ __decorate([IsString(), __decorateMetadata("design:type", String)], WebVhCredDef
28
26
  __decorate([IsString(), __decorateMetadata("design:type", String)], WebVhCredDefContent.prototype, "schemaId", void 0);
29
27
  __decorate([IsString(), __decorateMetadata("design:type", String)], WebVhCredDefContent.prototype, "type", void 0);
30
28
  __decorate([IsString(), __decorateMetadata("design:type", String)], WebVhCredDefContent.prototype, "tag", void 0);
31
- __decorate([IsObject(), __decorateMetadata("design:type", typeof (_ref = typeof Record !== "undefined" && Record) === "function" ? _ref : Object)], WebVhCredDefContent.prototype, "value", void 0);
29
+ __decorate([IsObject(), __decorateMetadata("design:type", typeof Record === "undefined" ? Object : Record)], WebVhCredDefContent.prototype, "value", void 0);
32
30
  var WebVhRevRegDefContent = class {};
33
31
  __decorate([IsString(), __decorateMetadata("design:type", String)], WebVhRevRegDefContent.prototype, "issuerId", void 0);
34
32
  __decorate([IsString(), __decorateMetadata("design:type", String)], WebVhRevRegDefContent.prototype, "revocDefType", void 0);
@@ -56,7 +54,7 @@ __decorate([
56
54
  }),
57
55
  __decorateMetadata("design:type", Object)
58
56
  ], WebVhAnonCredsResource.prototype, "content", void 0);
59
-
60
57
  //#endregion
61
- export { WebVhAnonCredsResource };
58
+ export { WebVhAnonCredsResource, WebVhCredDefContent, WebVhRevRegDefContent, WebVhRevocationStatusListContent, WebVhSchemaContent };
59
+
62
60
  //# sourceMappingURL=transform.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"transform.mjs","names":[],"sources":["../../../src/anoncreds/utils/transform.ts"],"sourcesContent":["import { JsonTransformer } from '@credo-ts/core'\nimport { Expose, Transform, Type } from 'class-transformer'\nimport { ArrayMinSize, IsArray, IsNumber, IsObject, IsOptional, IsString } from 'class-validator'\nimport { WebVhAttestedResource } from '../../resources'\n\nexport class WebVhSchemaContent {\n @IsArray()\n @IsString({ each: true })\n @ArrayMinSize(1)\n @Type(() => String)\n public attrNames!: string[]\n\n @IsString()\n public name!: string\n\n @IsString()\n public version!: string\n\n @IsOptional()\n @IsString()\n public issuerId?: string\n}\n\nexport class WebVhCredDefContent {\n @IsString()\n public issuerId!: string\n\n @IsString()\n public schemaId!: string\n\n @IsString()\n public type!: string\n\n @IsString()\n public tag!: string\n\n @IsObject()\n public value!: Record<string, unknown>\n}\n\nexport class WebVhRevRegDefContent {\n @IsString()\n public issuerId!: string\n\n @IsString()\n public revocDefType!: string\n\n @IsString()\n public credDefId!: string\n\n @IsString()\n public tag!: string\n\n @IsObject()\n public value!: {\n publicKeys: { accumKey: { z: string } }\n maxCredNum: number\n tailsLocation: string\n tailsHash: string\n }\n}\n\nexport class WebVhRevocationStatusListContent {\n @IsString()\n public issuerId!: string\n\n @IsString()\n public revRegDefId!: string\n\n @IsArray()\n @IsNumber({}, { each: true })\n public revocationList!: number[]\n\n @IsString()\n public currentAccumulator!: string\n\n @IsNumber()\n public timestamp!: number\n}\n\nexport class WebVhAnonCredsResource extends WebVhAttestedResource {\n @Expose()\n @Transform(({ value }) => {\n if (value && 'attrNames' in value) {\n return JsonTransformer.fromJSON(value, WebVhSchemaContent)\n }\n if (value && 'schemaId' in value) {\n return JsonTransformer.fromJSON(value, WebVhCredDefContent)\n }\n if (value && 'revocDefType' in value) {\n return JsonTransformer.fromJSON(value, WebVhRevRegDefContent)\n }\n return value\n })\n public content!: WebVhSchemaContent | WebVhCredDefContent | WebVhRevRegDefContent | WebVhRevocationStatusListContent\n}\n"],"mappings":";;;;;;;;;;AAKA,IAAa,qBAAb,MAAgC;;CAC7B,SAAS;CACT,SAAS,EAAE,MAAM,MAAM,CAAC;CACxB,aAAa,EAAE;CACf,WAAW,OAAO;;;YAGlB,UAAU;YAGV,UAAU;;CAGV,YAAY;CACZ,UAAU;;;AAIb,IAAa,sBAAb,MAAiC;YAC9B,UAAU;YAGV,UAAU;YAGV,UAAU;YAGV,UAAU;YAGV,UAAU;AAIb,IAAa,wBAAb,MAAmC;YAChC,UAAU;YAGV,UAAU;YAGV,UAAU;YAGV,UAAU;YAGV,UAAU;AASb,IAAa,mCAAb,MAA8C;YAC3C,UAAU;YAGV,UAAU;;CAGV,SAAS;CACT,SAAS,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;;;YAG5B,UAAU;YAGV,UAAU;AAIb,IAAa,yBAAb,cAA4C,sBAAsB;;CAC/D,QAAQ;CACR,WAAW,EAAE,YAAY;AACxB,MAAI,SAAS,eAAe,MAC1B,QAAO,gBAAgB,SAAS,OAAO,mBAAmB;AAE5D,MAAI,SAAS,cAAc,MACzB,QAAO,gBAAgB,SAAS,OAAO,oBAAoB;AAE7D,MAAI,SAAS,kBAAkB,MAC7B,QAAO,gBAAgB,SAAS,OAAO,sBAAsB;AAE/D,SAAO;GACP"}
1
+ {"version":3,"file":"transform.mjs","names":[],"sources":["../../../src/anoncreds/utils/transform.ts"],"sourcesContent":["import { JsonTransformer } from '@credo-ts/core'\nimport { Expose, Transform, Type } from 'class-transformer'\nimport { ArrayMinSize, IsArray, IsNumber, IsObject, IsOptional, IsString } from 'class-validator'\nimport { WebVhAttestedResource } from '../../resources'\n\nexport class WebVhSchemaContent {\n @IsArray()\n @IsString({ each: true })\n @ArrayMinSize(1)\n @Type(() => String)\n public attrNames!: string[]\n\n @IsString()\n public name!: string\n\n @IsString()\n public version!: string\n\n @IsOptional()\n @IsString()\n public issuerId?: string\n}\n\nexport class WebVhCredDefContent {\n @IsString()\n public issuerId!: string\n\n @IsString()\n public schemaId!: string\n\n @IsString()\n public type!: string\n\n @IsString()\n public tag!: string\n\n @IsObject()\n public value!: Record<string, unknown>\n}\n\nexport class WebVhRevRegDefContent {\n @IsString()\n public issuerId!: string\n\n @IsString()\n public revocDefType!: string\n\n @IsString()\n public credDefId!: string\n\n @IsString()\n public tag!: string\n\n @IsObject()\n public value!: {\n publicKeys: { accumKey: { z: string } }\n maxCredNum: number\n tailsLocation: string\n tailsHash: string\n }\n}\n\nexport class WebVhRevocationStatusListContent {\n @IsString()\n public issuerId!: string\n\n @IsString()\n public revRegDefId!: string\n\n @IsArray()\n @IsNumber({}, { each: true })\n public revocationList!: number[]\n\n @IsString()\n public currentAccumulator!: string\n\n @IsNumber()\n public timestamp!: number\n}\n\nexport class WebVhAnonCredsResource extends WebVhAttestedResource {\n @Expose()\n @Transform(({ value }) => {\n if (value && 'attrNames' in value) {\n return JsonTransformer.fromJSON(value, WebVhSchemaContent)\n }\n if (value && 'schemaId' in value) {\n return JsonTransformer.fromJSON(value, WebVhCredDefContent)\n }\n if (value && 'revocDefType' in value) {\n return JsonTransformer.fromJSON(value, WebVhRevRegDefContent)\n }\n return value\n })\n public content!: WebVhSchemaContent | WebVhCredDefContent | WebVhRevRegDefContent | WebVhRevocationStatusListContent\n}\n"],"mappings":";;;;;;;;AAKA,IAAa,qBAAb,MAAgC,CAgBhC;;CAfG,QAAQ;CACR,SAAS,EAAE,MAAM,KAAK,CAAC;CACvB,aAAa,CAAC;CACd,WAAW,MAAM;;;AAGjB,WAAA,CAAA,SAAS,GAAA,mBAAA,eAAA,MAAA,CAAA,GAAA,mBAAA,WAAA,QAAA,KAAA,CAAA;AAGT,WAAA,CAAA,SAAS,GAAA,mBAAA,eAAA,MAAA,CAAA,GAAA,mBAAA,WAAA,WAAA,KAAA,CAAA;;CAGT,WAAW;CACX,SAAS;;;AAIZ,IAAa,sBAAb,MAAiC,CAejC;AAdG,WAAA,CAAA,SAAS,GAAA,mBAAA,eAAA,MAAA,CAAA,GAAA,oBAAA,WAAA,YAAA,KAAA,CAAA;AAGT,WAAA,CAAA,SAAS,GAAA,mBAAA,eAAA,MAAA,CAAA,GAAA,oBAAA,WAAA,YAAA,KAAA,CAAA;AAGT,WAAA,CAAA,SAAS,GAAA,mBAAA,eAAA,MAAA,CAAA,GAAA,oBAAA,WAAA,QAAA,KAAA,CAAA;AAGT,WAAA,CAAA,SAAS,GAAA,mBAAA,eAAA,MAAA,CAAA,GAAA,oBAAA,WAAA,OAAA,KAAA,CAAA;AAGT,WAAA,CAAA,SAAS,GAAA,mBAAA,eAAA,OAAA,WAAA,cAAA,SAAA,MAA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E5D,IAAI,SAAS,kBAAkB,OAC7B,OAAO,gBAAgB,SAAS,OAAO,qBAAqB;EAE9D,OAAO;CACT,CAAC"}
package/build/core.d.mts CHANGED
@@ -5,4 +5,5 @@ import { WebVhDidResolver } from "./dids/WebVhDidResolver.mjs";
5
5
  import { WebVhDidRecordMetadataKeys } from "./dids/webVhDidRecordMetadataTypes.mjs";
6
6
  import "./dids/index.mjs";
7
7
  import { WebVhApi } from "./WebVhApi.mjs";
8
- import { WebVhModule } from "./WebVhModule.mjs";
8
+ import { WebVhModule } from "./WebVhModule.mjs";
9
+ export { WebVhApi, WebVhAttestedResource, WebVhAttestedResourceLink, WebVhAttestedResourceProof, type WebVhDidCreateOptions, WebVhDidLog, WebVhDidLogEntry, WebVhDidRecordMetadataKeys, WebVhDidRegistrar, WebVhDidResolver, type WebVhDidUpdateOptions, WebVhModule, WebVhResourceIdParts, WebVhResourcePublisher, WebVhResourceResolver, getResourceType, isWebVhAttestedResource, parseResourceId, requireResourceType };
package/build/core.mjs CHANGED
@@ -6,3 +6,4 @@ import { WebVhAttestedResource, WebVhAttestedResourceLink, WebVhAttestedResource
6
6
  import "./resources/index.mjs";
7
7
  import { WebVhApi } from "./WebVhApi.mjs";
8
8
  import { WebVhModule } from "./WebVhModule.mjs";
9
+ export { WebVhApi, WebVhAttestedResource, WebVhAttestedResourceLink, WebVhAttestedResourceProof, WebVhDidRecordMetadataKeys, WebVhDidRegistrar, WebVhDidResolver, WebVhModule, getResourceType, isWebVhAttestedResource, parseResourceId, requireResourceType };
@@ -1,5 +1,4 @@
1
1
  import { Kms } from "@credo-ts/core";
2
-
3
2
  //#region src/dids/WebVhDidCrypto.ts
4
3
  var WebVhDidCrypto = class {
5
4
  constructor(agentContext) {
@@ -25,7 +24,7 @@ var WebVhDidCrypto = class {
25
24
  }
26
25
  }
27
26
  };
28
-
29
27
  //#endregion
30
28
  export { WebVhDidCrypto };
29
+
31
30
  //# sourceMappingURL=WebVhDidCrypto.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"WebVhDidCrypto.mjs","names":[],"sources":["../../src/dids/WebVhDidCrypto.ts"],"sourcesContent":["import { type AgentContext, Kms } from '@credo-ts/core'\nimport type { Verifier } from 'didwebvh-ts'\n\nexport class WebVhDidCrypto implements Verifier {\n private agentContext: AgentContext\n\n public constructor(agentContext: AgentContext) {\n this.agentContext = agentContext\n }\n\n public async verify(signature: Uint8Array, message: Uint8Array, publicKey: Uint8Array): Promise<boolean> {\n try {\n const kms = this.agentContext.dependencyManager.resolve(Kms.KeyManagementApi)\n\n const publicJwk = Kms.PublicJwk.fromPublicKey({\n kty: 'OKP',\n crv: 'Ed25519',\n publicKey,\n })\n\n const verificationResult = await kms.verify({\n key: { publicJwk: publicJwk.toJson() },\n algorithm: 'EdDSA',\n signature: signature,\n data: message,\n })\n\n return verificationResult.verified\n } catch (error) {\n this.agentContext.config.logger.error('KMS verification failed:', error)\n return false\n }\n }\n}\n"],"mappings":";;;AAGA,IAAa,iBAAb,MAAgD;CAG9C,AAAO,YAAY,cAA4B;AAC7C,OAAK,eAAe;;CAGtB,MAAa,OAAO,WAAuB,SAAqB,WAAyC;AACvG,MAAI;GACF,MAAM,MAAM,KAAK,aAAa,kBAAkB,QAAQ,IAAI,iBAAiB;GAE7E,MAAM,YAAY,IAAI,UAAU,cAAc;IAC5C,KAAK;IACL,KAAK;IACL;IACD,CAAC;AASF,WAP2B,MAAM,IAAI,OAAO;IAC1C,KAAK,EAAE,WAAW,UAAU,QAAQ,EAAE;IACtC,WAAW;IACA;IACX,MAAM;IACP,CAAC,EAEwB;WACnB,OAAO;AACd,QAAK,aAAa,OAAO,OAAO,MAAM,4BAA4B,MAAM;AACxE,UAAO"}
1
+ {"version":3,"file":"WebVhDidCrypto.mjs","names":[],"sources":["../../src/dids/WebVhDidCrypto.ts"],"sourcesContent":["import { type AgentContext, Kms } from '@credo-ts/core'\nimport type { Verifier } from 'didwebvh-ts'\n\nexport class WebVhDidCrypto implements Verifier {\n private agentContext: AgentContext\n\n public constructor(agentContext: AgentContext) {\n this.agentContext = agentContext\n }\n\n public async verify(signature: Uint8Array, message: Uint8Array, publicKey: Uint8Array): Promise<boolean> {\n try {\n const kms = this.agentContext.dependencyManager.resolve(Kms.KeyManagementApi)\n\n const publicJwk = Kms.PublicJwk.fromPublicKey({\n kty: 'OKP',\n crv: 'Ed25519',\n publicKey,\n })\n\n const verificationResult = await kms.verify({\n key: { publicJwk: publicJwk.toJson() },\n algorithm: 'EdDSA',\n signature: signature,\n data: message,\n })\n\n return verificationResult.verified\n } catch (error) {\n this.agentContext.config.logger.error('KMS verification failed:', error)\n return false\n }\n }\n}\n"],"mappings":";;AAGA,IAAa,iBAAb,MAAgD;CAG9C,YAAmB,cAA4B;EAC7C,KAAK,eAAe;CACtB;CAEA,MAAa,OAAO,WAAuB,SAAqB,WAAyC;EACvG,IAAI;GACF,MAAM,MAAM,KAAK,aAAa,kBAAkB,QAAQ,IAAI,gBAAgB;GAE5E,MAAM,YAAY,IAAI,UAAU,cAAc;IAC5C,KAAK;IACL,KAAK;IACL;GACF,CAAC;GASD,QAAO,MAP0B,IAAI,OAAO;IAC1C,KAAK,EAAE,WAAW,UAAU,OAAO,EAAE;IACrC,WAAW;IACA;IACX,MAAM;GACR,CAAC,EAAA,CAEyB;EAC5B,SAAS,OAAO;GACd,KAAK,aAAa,OAAO,OAAO,MAAM,4BAA4B,KAAK;GACvE,OAAO;EACT;CACF;AACF"}
@@ -1,6 +1,5 @@
1
1
  import { Kms } from "@credo-ts/core";
2
2
  import { MultibaseEncoding, multibaseEncode, prepareDataForSigning } from "didwebvh-ts";
3
-
4
3
  //#region src/dids/WebVhDidCryptoSigner.ts
5
4
  /**
6
5
  * Complement to the WebVhDidCrypto class implementing the Signer interface.
@@ -47,7 +46,7 @@ var WebVhDidCryptoSigner = class {
47
46
  }
48
47
  }
49
48
  };
50
-
51
49
  //#endregion
52
50
  export { WebVhDidCryptoSigner };
51
+
53
52
  //# sourceMappingURL=WebVhDidCryptoSigner.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"WebVhDidCryptoSigner.mjs","names":[],"sources":["../../src/dids/WebVhDidCryptoSigner.ts"],"sourcesContent":["import { type AgentContext, Kms } from '@credo-ts/core'\nimport {\n MultibaseEncoding,\n multibaseEncode,\n prepareDataForSigning,\n type Signer,\n type SigningInput,\n type SigningOutput,\n} from 'didwebvh-ts'\n\n/**\n * Complement to the WebVhDidCrypto class implementing the Signer interface.\n * Provides cryptographic operations for DID documents using Ed25519 keys.\n */\nexport class WebVhDidCryptoSigner implements Signer {\n private publicKeyMultibase: string\n private keyId: string\n private agentContext: AgentContext\n public readonly supportedMethods: string[] = ['webvh']\n\n /**\n * Constructs a new instance of WebVhDidCryptoSigner.\n * @param agentContext - The agent context containing wallet and configuration.\n * @param publicKeyMultibase - The public key encoded in multibase format.\n */\n constructor(agentContext: AgentContext, publicKeyMultibase: string, keyId: string) {\n this.agentContext = agentContext\n this.publicKeyMultibase = publicKeyMultibase\n this.keyId = keyId\n }\n\n /**\n * Gets the verification method identifier as a did:key URL.\n * @returns The verification method URL as a string.\n */\n getVerificationMethodId(): string {\n return `did:key:${this.publicKeyMultibase}#${this.publicKeyMultibase}`\n }\n\n /**\n * Signs the provided input document using the Ed25519 secret key.\n * @param input - The signing input containing the document and proof.\n * @returns A promise that resolves to the signing output with the proof value.\n * @throws Error if the secret key is not found or signing fails.\n */\n async sign(input: SigningInput): Promise<SigningOutput> {\n try {\n const kms = this.agentContext.dependencyManager.resolve(Kms.KeyManagementApi)\n const data = await prepareDataForSigning(input.document, input.proof)\n\n const { signature } = await kms.sign({\n keyId: this.keyId,\n algorithm: 'EdDSA',\n data,\n })\n return {\n proofValue: multibaseEncode(signature, MultibaseEncoding.BASE58_BTC),\n }\n } catch (error) {\n this.agentContext.config.logger.error('Ed25519 signing error:', error)\n throw error\n }\n }\n}\n"],"mappings":";;;;;;;;AAcA,IAAa,uBAAb,MAAoD;;;;;;CAWlD,YAAY,cAA4B,oBAA4B,OAAe;OAPnE,mBAA6B,CAAC,QAAQ;AAQpD,OAAK,eAAe;AACpB,OAAK,qBAAqB;AAC1B,OAAK,QAAQ;;;;;;CAOf,0BAAkC;AAChC,SAAO,WAAW,KAAK,mBAAmB,GAAG,KAAK;;;;;;;;CASpD,MAAM,KAAK,OAA6C;AACtD,MAAI;GACF,MAAM,MAAM,KAAK,aAAa,kBAAkB,QAAQ,IAAI,iBAAiB;GAC7E,MAAM,OAAO,MAAM,sBAAsB,MAAM,UAAU,MAAM,MAAM;GAErE,MAAM,EAAE,cAAc,MAAM,IAAI,KAAK;IACnC,OAAO,KAAK;IACZ,WAAW;IACX;IACD,CAAC;AACF,UAAO,EACL,YAAY,gBAAgB,WAAW,kBAAkB,WAAW,EACrE;WACM,OAAO;AACd,QAAK,aAAa,OAAO,OAAO,MAAM,0BAA0B,MAAM;AACtE,SAAM"}
1
+ {"version":3,"file":"WebVhDidCryptoSigner.mjs","names":[],"sources":["../../src/dids/WebVhDidCryptoSigner.ts"],"sourcesContent":["import { type AgentContext, Kms } from '@credo-ts/core'\nimport {\n MultibaseEncoding,\n multibaseEncode,\n prepareDataForSigning,\n type Signer,\n type SigningInput,\n type SigningOutput,\n} from 'didwebvh-ts'\n\n/**\n * Complement to the WebVhDidCrypto class implementing the Signer interface.\n * Provides cryptographic operations for DID documents using Ed25519 keys.\n */\nexport class WebVhDidCryptoSigner implements Signer {\n private publicKeyMultibase: string\n private keyId: string\n private agentContext: AgentContext\n public readonly supportedMethods: string[] = ['webvh']\n\n /**\n * Constructs a new instance of WebVhDidCryptoSigner.\n * @param agentContext - The agent context containing wallet and configuration.\n * @param publicKeyMultibase - The public key encoded in multibase format.\n */\n constructor(agentContext: AgentContext, publicKeyMultibase: string, keyId: string) {\n this.agentContext = agentContext\n this.publicKeyMultibase = publicKeyMultibase\n this.keyId = keyId\n }\n\n /**\n * Gets the verification method identifier as a did:key URL.\n * @returns The verification method URL as a string.\n */\n getVerificationMethodId(): string {\n return `did:key:${this.publicKeyMultibase}#${this.publicKeyMultibase}`\n }\n\n /**\n * Signs the provided input document using the Ed25519 secret key.\n * @param input - The signing input containing the document and proof.\n * @returns A promise that resolves to the signing output with the proof value.\n * @throws Error if the secret key is not found or signing fails.\n */\n async sign(input: SigningInput): Promise<SigningOutput> {\n try {\n const kms = this.agentContext.dependencyManager.resolve(Kms.KeyManagementApi)\n const data = await prepareDataForSigning(input.document, input.proof)\n\n const { signature } = await kms.sign({\n keyId: this.keyId,\n algorithm: 'EdDSA',\n data,\n })\n return {\n proofValue: multibaseEncode(signature, MultibaseEncoding.BASE58_BTC),\n }\n } catch (error) {\n this.agentContext.config.logger.error('Ed25519 signing error:', error)\n throw error\n }\n }\n}\n"],"mappings":";;;;;;;AAcA,IAAa,uBAAb,MAAoD;;;;;;CAWlD,YAAY,cAA4B,oBAA4B,OAAe;EAPnF,KAAgB,mBAA6B,CAAC,OAAO;EAQnD,KAAK,eAAe;EACpB,KAAK,qBAAqB;EAC1B,KAAK,QAAQ;CACf;;;;;CAMA,0BAAkC;EAChC,OAAO,WAAW,KAAK,mBAAmB,GAAG,KAAK;CACpD;;;;;;;CAQA,MAAM,KAAK,OAA6C;EACtD,IAAI;GACF,MAAM,MAAM,KAAK,aAAa,kBAAkB,QAAQ,IAAI,gBAAgB;GAC5E,MAAM,OAAO,MAAM,sBAAsB,MAAM,UAAU,MAAM,KAAK;GAEpE,MAAM,EAAE,cAAc,MAAM,IAAI,KAAK;IACnC,OAAO,KAAK;IACZ,WAAW;IACX;GACF,CAAC;GACD,OAAO,EACL,YAAY,gBAAgB,WAAW,kBAAkB,UAAU,EACrE;EACF,SAAS,OAAO;GACd,KAAK,aAAa,OAAO,OAAO,MAAM,0BAA0B,KAAK;GACrE,MAAM;EACR;CACF;AACF"}
@@ -1,18 +1,17 @@
1
1
  import { AgentContext, DidCreateOptions, DidCreateResult, DidDeactivateOptions, DidDeactivateResult, DidDocument, DidRegistrar, DidUpdateOptions, DidUpdateResult } from "@credo-ts/core";
2
-
3
2
  //#region src/dids/WebVhDidRegistrar.d.ts
4
- interface WebVhDidCreateOptions extends DidCreateOptions {
3
+ export interface WebVhDidCreateOptions extends DidCreateOptions {
5
4
  domain: string;
6
5
  path?: string;
7
6
  }
8
- interface WebVhDidUpdateOptions extends DidUpdateOptions {
7
+ export interface WebVhDidUpdateOptions extends DidUpdateOptions {
9
8
  didDocument: DidDocument;
10
9
  }
11
10
  /**
12
11
  * DID Registrar implementation for the 'webvh' method.
13
12
  * Handles creation, update, and (future) deactivation of DIDs using the webvh method.
14
13
  */
15
- declare class WebVhDidRegistrar implements DidRegistrar {
14
+ export declare class WebVhDidRegistrar implements DidRegistrar {
16
15
  readonly supportedMethods: string[];
17
16
  /**
18
17
  * Creates a new DID document and saves it in the repository.
@@ -42,5 +41,4 @@ declare class WebVhDidRegistrar implements DidRegistrar {
42
41
  private handleError;
43
42
  }
44
43
  //#endregion
45
- export { WebVhDidCreateOptions, WebVhDidRegistrar, WebVhDidUpdateOptions };
46
44
  //# sourceMappingURL=WebVhDidRegistrar.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WebVhDidRegistrar.d.mts","names":[],"sources":["../../src/dids/WebVhDidRegistrar.ts"],"mappings":";;;UAoCiB,qBAAA,SAA8B,gBAAA;EAC7C,MAAA;EACA,IAAA;AAAA;AAAA,UAGe,qBAAA,SAA8B,gBAAA;EAC7C,WAAA,EAAa,WAAA;AAAA;;;;AADf;cAWa,iBAAA,YAA6B,YAAA;EAAA,SACxB,gBAAA;EAZ6C;;;;;;AAW/D;;;EAYe,MAAA,CAAO,YAAA,EAAc,YAAA,EAAc,OAAA,EAAS,qBAAA,GAAwB,OAAA,CAAQ,eAAA;EAAhC;;;;;;;EA0F5C,MAAA,CAAO,YAAA,EAAc,YAAA,EAAc,OAAA,EAAS,qBAAA,GAAwB,OAAA,CAAQ,eAAA;EAmFlF,UAAA,CAAW,aAAA,EAAe,YAAA,EAAc,QAAA,EAAU,oBAAA,GAAuB,OAAA,CAAQ,mBAAA;EAAA;;;;;EAAA,QAS1E,iBAAA;EAAA,QAcN,WAAA;AAAA"}
1
+ {"version":3,"file":"WebVhDidRegistrar.d.mts","names":[],"sources":["../../src/dids/WebVhDidRegistrar.ts"],"mappings":";;iBAoCiB,8BAA8B;EAC7C;EACA;;iBAGe,8BAA8B;EAC7C,aAAa;;;;;;qBAUF,6BAA6B;WACxB;;;;;;;;;;EAWH,OAAO,cAAc,cAAc,SAAS,wBAAwB,QAAQ;;;;;;;;EA0F5E,OAAO,cAAc,cAAc,SAAS,wBAAwB,QAAQ;EAmFlF,WAAW,eAAe,cAAc,UAAU,uBAAuB,QAAQ;;;;;;UAS1E;UAcN"}
@@ -1,9 +1,8 @@
1
1
  import { WebVhDidCrypto } from "./WebVhDidCrypto.mjs";
2
2
  import { WebVhDidCryptoSigner } from "./WebVhDidCryptoSigner.mjs";
3
- import { WebVhDidRecordMetadataKeys } from "./webVhDidRecordMetadataTypes.mjs";
3
+ import "./webVhDidRecordMetadataTypes.mjs";
4
4
  import { DidDocument, DidDocumentRole, DidRecord, DidRepository, JsonTransformer, Kms, getKmsKeyIdForVerifiacationMethod } from "@credo-ts/core";
5
5
  import { MultibaseEncoding, createDID, multibaseEncode, updateDID } from "didwebvh-ts";
6
-
7
6
  //#region src/dids/WebVhDidRegistrar.ts
8
7
  const normalizeMethodArray = (arr) => arr?.map((item) => typeof item === "string" ? item : item.id);
9
8
  /**
@@ -65,8 +64,8 @@ var WebVhDidRegistrar = class {
65
64
  role: DidDocumentRole.Created,
66
65
  keys
67
66
  });
68
- didRecord.metadata.set(WebVhDidRecordMetadataKeys.DidLog, log);
69
- didRecord.metadata.set(WebVhDidRecordMetadataKeys.UpdateKeyKmsKeyIds, { [publicKeyMultibase]: keyId });
67
+ didRecord.metadata.set("log", log);
68
+ didRecord.metadata.set("_internal/webvhUpdateKeyKmsKeyIds", { [publicKeyMultibase]: keyId });
70
69
  didRecord.setTags({ domain: domainKey });
71
70
  await didRepository.save(agentContext, didRecord);
72
71
  return {
@@ -99,12 +98,12 @@ var WebVhDidRegistrar = class {
99
98
  method: "webvh"
100
99
  });
101
100
  if (!didRecord) return this.handleError("DID not found");
102
- const log = didRecord.metadata.get(WebVhDidRecordMetadataKeys.DidLog);
101
+ const log = didRecord.metadata.get("log");
103
102
  const domain = didRecord.getTag("domain");
104
103
  const activeUpdateKey = log[log.length - 1]?.parameters?.updateKeys?.[0] ?? log[0]?.parameters?.updateKeys?.[0];
105
104
  const vm = didRecord.didDocument?.verificationMethod?.find((v) => v.publicKeyMultibase === activeUpdateKey);
106
105
  let keyId = vm ? getKmsKeyIdForVerifiacationMethod(vm, didRecord.keys) : void 0;
107
- if (!keyId && activeUpdateKey) keyId = didRecord.metadata.get(WebVhDidRecordMetadataKeys.UpdateKeyKmsKeyIds)?.[activeUpdateKey];
106
+ if (!keyId && activeUpdateKey) keyId = didRecord.metadata.get("_internal/webvhUpdateKeyKmsKeyIds")?.[activeUpdateKey];
108
107
  if (!log) return this.handleError("The log registry must be created before it can be edited.");
109
108
  if (!keyId) return this.handleError("The key ID must be present before the log can be edited.");
110
109
  const { controller, authentication, assertionMethod, keyAgreement, service: services, verificationMethod: inputVerificationMethod } = inputDidDocument;
@@ -114,10 +113,12 @@ var WebVhDidRegistrar = class {
114
113
  const { updateKeys } = log[log.length - 1].parameters;
115
114
  const verificationMethod = verificationMethods?.find((vm) => vm.publicKeyMultibase);
116
115
  if (!verificationMethod?.publicKeyMultibase) return this.handleError("At least one verification method with publicKeyMultibase must be provided.");
116
+ const signer = new WebVhDidCryptoSigner(agentContext, verificationMethod.publicKeyMultibase, keyId);
117
+ const verifier = new WebVhDidCrypto(agentContext);
117
118
  const { log: logResult, doc } = await updateDID({
118
119
  log,
119
- signer: new WebVhDidCryptoSigner(agentContext, verificationMethod.publicKeyMultibase, keyId),
120
- verifier: new WebVhDidCrypto(agentContext),
120
+ signer,
121
+ verifier,
121
122
  domain,
122
123
  updateKeys,
123
124
  ...inputDidDocument,
@@ -128,7 +129,7 @@ var WebVhDidRegistrar = class {
128
129
  keyAgreement: normalizeMethodArray(keyAgreement),
129
130
  services
130
131
  });
131
- didRecord.metadata.set(WebVhDidRecordMetadataKeys.DidLog, logResult);
132
+ didRecord.metadata.set("log", logResult);
132
133
  didRecord.didDocument = JsonTransformer.fromJSON(doc, DidDocument);
133
134
  await didRepository.update(agentContext, didRecord);
134
135
  return {
@@ -178,7 +179,7 @@ var WebVhDidRegistrar = class {
178
179
  };
179
180
  }
180
181
  };
181
-
182
182
  //#endregion
183
183
  export { WebVhDidRegistrar };
184
+
184
185
  //# sourceMappingURL=WebVhDidRegistrar.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"WebVhDidRegistrar.mjs","names":[],"sources":["../../src/dids/WebVhDidRegistrar.ts"],"sourcesContent":["import type {\n AgentContext,\n DidCreateOptions,\n DidCreateResult,\n DidDeactivateOptions,\n DidDeactivateResult,\n DidDocumentKey,\n DidRegistrar,\n DidUpdateOptions,\n DidUpdateResult,\n VerificationMethod,\n} from '@credo-ts/core'\n\nimport {\n DidDocument,\n DidDocumentRole,\n DidRecord,\n DidRepository,\n getKmsKeyIdForVerifiacationMethod,\n JsonTransformer,\n Kms,\n} from '@credo-ts/core'\nimport {\n createDID,\n type DIDLog,\n MultibaseEncoding,\n multibaseEncode,\n updateDID,\n type ServiceEndpoint as WebVhServiceEndpoint,\n type VerificationMethod as WebVhVerificationMethod,\n} from 'didwebvh-ts'\n\nimport { WebVhDidCrypto } from './WebVhDidCrypto'\nimport { WebVhDidCryptoSigner } from './WebVhDidCryptoSigner'\nimport { WebVhDidRecordMetadataKeys } from './webVhDidRecordMetadataTypes'\n\nexport interface WebVhDidCreateOptions extends DidCreateOptions {\n domain: string\n path?: string\n}\n\nexport interface WebVhDidUpdateOptions extends DidUpdateOptions {\n didDocument: DidDocument\n}\n\nconst normalizeMethodArray = (arr?: (string | { id: string })[]) =>\n arr?.map((item) => (typeof item === 'string' ? item : item.id))\n\n/**\n * DID Registrar implementation for the 'webvh' method.\n * Handles creation, update, and (future) deactivation of DIDs using the webvh method.\n */\nexport class WebVhDidRegistrar implements DidRegistrar {\n public readonly supportedMethods: string[] = ['webvh']\n\n /**\n * Creates a new DID document and saves it in the repository.\n * Handles crypto setup, DID generation, and persistence.\n * The `paths` option (string with `/` or array of segments) allows adding sub-identifiers\n * after the domain, joined with `:` in the resulting DID.\n * @param agentContext The agent context.\n * @param options The creation options, including domain, optional paths, endpoints, controller, signer, and verifier.\n * @returns The result of the DID creation, with error handling.\n */\n public async create(agentContext: AgentContext, options: WebVhDidCreateOptions): Promise<DidCreateResult> {\n try {\n const { domain, path } = options\n const paths = path?.replace(/^\\/|\\/$/g, '').split('/')\n const domainKey = paths?.length ? [domain, ...paths].join(':') : domain\n const keys: DidDocumentKey[] = []\n const didRepository = agentContext.dependencyManager.resolve(DidRepository)\n const record = await didRepository.findSingleByQuery(agentContext, {\n role: DidDocumentRole.Created,\n domain: domainKey,\n method: 'webvh',\n })\n if (record) return this.handleError(`A record with domain \"${domain}\" already exists.`)\n\n // Create crypto instance\n const { publicKeyMultibase, keyId } = await this.generatePublicKey(agentContext)\n const signer = new WebVhDidCryptoSigner(agentContext, publicKeyMultibase, keyId)\n const verifier = new WebVhDidCrypto(agentContext)\n const baseDid = `did:webvh:{SCID}:${encodeURIComponent(domain)}`\n\n // didwebvh-ts derives verification method ids as `<did>#<last 8 chars of publicKeyMultibase>`.\n // We reference the key relatively, as the full id is only known once the SCID has been\n // derived, and a relative reference is unaffected by the {SCID} substitution that happens\n // while the initial log entry is hashed.\n const verificationMethodFragment = `#${publicKeyMultibase.slice(-8)}`\n\n // Create DID\n const { did, doc, log } = await createDID({\n domain,\n paths,\n signer,\n updateKeys: [publicKeyMultibase],\n verificationMethods: [\n {\n controller: baseDid,\n type: 'Multikey',\n publicKeyMultibase,\n },\n ],\n // didwebvh-ts places verification methods without a purpose in `authentication` only, and\n // emits an empty `assertionMethod`. Without this, every attested resource signed by this\n // did would be unverifiable. Setting `purpose: 'assertionMethod'` on the verification\n // method is not an alternative, as that would empty `authentication` instead.\n assertionMethod: [verificationMethodFragment],\n verifier,\n })\n\n const didDocument = JsonTransformer.fromJSON(doc, DidDocument)\n\n // Derive the fragment from the actual DID document verificationMethod. didwebvh-ts\n // is responsible for incorporating and signing over fragments in the log\n // so we read back what the library produced\n const matchedVm = didDocument.verificationMethod?.find((vm) => vm.publicKeyMultibase === publicKeyMultibase)\n const vmIdFragment = matchedVm?.id.split('#')[1]\n keys.push({\n kmsKeyId: keyId,\n didDocumentRelativeKeyId: `#${vmIdFragment}`,\n })\n const didRecord = new DidRecord({\n did,\n didDocument,\n role: DidDocumentRole.Created,\n keys,\n })\n didRecord.metadata.set(WebVhDidRecordMetadataKeys.DidLog, log)\n didRecord.metadata.set(WebVhDidRecordMetadataKeys.UpdateKeyKmsKeyIds, { [publicKeyMultibase]: keyId })\n didRecord.setTags({ domain: domainKey })\n await didRepository.save(agentContext, didRecord)\n\n return {\n didDocumentMetadata: {},\n didRegistrationMetadata: {},\n didState: {\n state: 'finished',\n did,\n didDocument,\n },\n }\n } catch (error) {\n return this.handleError(error instanceof Error ? error.message : 'Unknown error occurred.')\n }\n }\n\n /**\n * Updates an existing DID document and its log in the repository.\n * Uses internal logic to validate verification methods and handle errors.\n * @param agentContext The agent context.\n * @param options The update options, including DID, log, signer, verifier, and services.\n * @returns The result of the DID update, with error handling and validation.\n */\n public async update(agentContext: AgentContext, options: WebVhDidUpdateOptions): Promise<DidUpdateResult> {\n try {\n const { did, didDocument: inputDidDocument } = options\n const didRepository = agentContext.dependencyManager.resolve(DidRepository)\n const didRecord = await didRepository.findSingleByQuery(agentContext, {\n role: DidDocumentRole.Created,\n did,\n method: 'webvh',\n })\n if (!didRecord) return this.handleError('DID not found')\n\n const log = didRecord.metadata.get(WebVhDidRecordMetadataKeys.DidLog) as DIDLog\n const domain = didRecord.getTag('domain') as string\n const activeUpdateKey = log[log.length - 1]?.parameters?.updateKeys?.[0] ?? log[0]?.parameters?.updateKeys?.[0]\n const vm = didRecord.didDocument?.verificationMethod?.find((v) => v.publicKeyMultibase === activeUpdateKey)\n let keyId = vm ? getKmsKeyIdForVerifiacationMethod(vm, didRecord.keys) : undefined\n if (!keyId && activeUpdateKey)\n keyId = didRecord.metadata.get(WebVhDidRecordMetadataKeys.UpdateKeyKmsKeyIds)?.[activeUpdateKey]\n\n if (!log) return this.handleError('The log registry must be created before it can be edited.')\n if (!keyId) return this.handleError('The key ID must be present before the log can be edited.')\n\n const {\n controller,\n authentication,\n assertionMethod,\n keyAgreement,\n service: services,\n verificationMethod: inputVerificationMethod,\n } = inputDidDocument\n const lastState = log[log.length - 1].state\n const verificationMethods = inputVerificationMethod ?? (lastState.verificationMethod as VerificationMethod[])\n // didwebvh-ts resets the verification relationships whenever verification methods are\n // supplied, so we fall back to the last log state to avoid dropping `assertionMethod` for\n // callers that only intend to update e.g. the services. References to keys that the update\n // removes are left behind, as carrying them over would publish a dangling reference.\n const assertionMethodRefs =\n normalizeMethodArray(assertionMethod) ??\n (lastState.assertionMethod as string[] | undefined)?.filter((reference) =>\n verificationMethods?.some((vm) => vm.id.endsWith(reference))\n )\n const { updateKeys } = log[log.length - 1].parameters\n const verificationMethod = verificationMethods?.find((vm) => vm.publicKeyMultibase)\n if (!verificationMethod?.publicKeyMultibase)\n return this.handleError('At least one verification method with publicKeyMultibase must be provided.')\n\n // Get signer/verifier\n const signer = new WebVhDidCryptoSigner(agentContext, verificationMethod.publicKeyMultibase, keyId)\n const verifier = new WebVhDidCrypto(agentContext)\n\n const { log: logResult, doc } = await updateDID({\n log,\n signer,\n verifier,\n domain,\n updateKeys,\n ...inputDidDocument,\n verificationMethods: verificationMethods as unknown as WebVhVerificationMethod[],\n controller: Array.isArray(controller) ? controller[0] : controller,\n authentication: normalizeMethodArray(authentication),\n assertionMethod: assertionMethodRefs,\n keyAgreement: normalizeMethodArray(keyAgreement),\n services: services as unknown as WebVhServiceEndpoint[],\n })\n didRecord.metadata.set(WebVhDidRecordMetadataKeys.DidLog, logResult)\n didRecord.didDocument = JsonTransformer.fromJSON(doc, DidDocument)\n await didRepository.update(agentContext, didRecord)\n\n return {\n didDocumentMetadata: {},\n didRegistrationMetadata: {},\n didState: {\n state: 'finished',\n did,\n didDocument: didRecord.didDocument,\n },\n }\n } catch (error) {\n return this.handleError(error instanceof Error ? error.message : 'Unknown error occurred.')\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n public deactivate(_agentContext: AgentContext, _options: DidDeactivateOptions): Promise<DidDeactivateResult> {\n throw new Error('Method not implemented.')\n }\n\n /**\n * Generates a new Ed25519 public key in multibase format and stores the private key in the wallet.\n * @param agentContext The agent context.\n * @returns The public key in multibase format.\n */\n private async generatePublicKey(agentContext: AgentContext): Promise<{ publicKeyMultibase: string; keyId: string }> {\n const kms = agentContext.dependencyManager.resolve(Kms.KeyManagementApi)\n const key = await kms.createKey({ type: { kty: 'OKP', crv: 'Ed25519' } })\n const publicKeyBytes = Kms.PublicJwk.fromPublicJwk(key.publicJwk).publicKey.publicKey\n\n return {\n publicKeyMultibase: multibaseEncode(\n new Uint8Array([0xed, 0x01, ...publicKeyBytes]),\n MultibaseEncoding.BASE58_BTC\n ),\n keyId: key.keyId,\n }\n }\n\n private handleError(reason: string): DidUpdateResult | DidCreateResult {\n return {\n didDocumentMetadata: {},\n didRegistrationMetadata: {},\n didState: {\n state: 'failed',\n reason,\n },\n }\n }\n}\n"],"mappings":";;;;;;;AA6CA,MAAM,wBAAwB,QAC5B,KAAK,KAAK,SAAU,OAAO,SAAS,WAAW,OAAO,KAAK,GAAI;;;;;AAMjE,IAAa,oBAAb,MAAuD;;OACrC,mBAA6B,CAAC,QAAQ;;;;;;;;;;;CAWtD,MAAa,OAAO,cAA4B,SAA0D;AACxG,MAAI;GACF,MAAM,EAAE,QAAQ,SAAS;GACzB,MAAM,QAAQ,MAAM,QAAQ,YAAY,GAAG,CAAC,MAAM,IAAI;GACtD,MAAM,YAAY,OAAO,SAAS,CAAC,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F"}
1
+ {"version":3,"file":"WebVhDidRegistrar.mjs","names":[],"sources":["../../src/dids/WebVhDidRegistrar.ts"],"sourcesContent":["import type {\n AgentContext,\n DidCreateOptions,\n DidCreateResult,\n DidDeactivateOptions,\n DidDeactivateResult,\n DidDocumentKey,\n DidRegistrar,\n DidUpdateOptions,\n DidUpdateResult,\n VerificationMethod,\n} from '@credo-ts/core'\n\nimport {\n DidDocument,\n DidDocumentRole,\n DidRecord,\n DidRepository,\n getKmsKeyIdForVerifiacationMethod,\n JsonTransformer,\n Kms,\n} from '@credo-ts/core'\nimport {\n createDID,\n type DIDLog,\n MultibaseEncoding,\n multibaseEncode,\n updateDID,\n type ServiceEndpoint as WebVhServiceEndpoint,\n type VerificationMethod as WebVhVerificationMethod,\n} from 'didwebvh-ts'\n\nimport { WebVhDidCrypto } from './WebVhDidCrypto'\nimport { WebVhDidCryptoSigner } from './WebVhDidCryptoSigner'\nimport { WebVhDidRecordMetadataKeys } from './webVhDidRecordMetadataTypes'\n\nexport interface WebVhDidCreateOptions extends DidCreateOptions {\n domain: string\n path?: string\n}\n\nexport interface WebVhDidUpdateOptions extends DidUpdateOptions {\n didDocument: DidDocument\n}\n\nconst normalizeMethodArray = (arr?: (string | { id: string })[]) =>\n arr?.map((item) => (typeof item === 'string' ? item : item.id))\n\n/**\n * DID Registrar implementation for the 'webvh' method.\n * Handles creation, update, and (future) deactivation of DIDs using the webvh method.\n */\nexport class WebVhDidRegistrar implements DidRegistrar {\n public readonly supportedMethods: string[] = ['webvh']\n\n /**\n * Creates a new DID document and saves it in the repository.\n * Handles crypto setup, DID generation, and persistence.\n * The `paths` option (string with `/` or array of segments) allows adding sub-identifiers\n * after the domain, joined with `:` in the resulting DID.\n * @param agentContext The agent context.\n * @param options The creation options, including domain, optional paths, endpoints, controller, signer, and verifier.\n * @returns The result of the DID creation, with error handling.\n */\n public async create(agentContext: AgentContext, options: WebVhDidCreateOptions): Promise<DidCreateResult> {\n try {\n const { domain, path } = options\n const paths = path?.replace(/^\\/|\\/$/g, '').split('/')\n const domainKey = paths?.length ? [domain, ...paths].join(':') : domain\n const keys: DidDocumentKey[] = []\n const didRepository = agentContext.dependencyManager.resolve(DidRepository)\n const record = await didRepository.findSingleByQuery(agentContext, {\n role: DidDocumentRole.Created,\n domain: domainKey,\n method: 'webvh',\n })\n if (record) return this.handleError(`A record with domain \"${domain}\" already exists.`)\n\n // Create crypto instance\n const { publicKeyMultibase, keyId } = await this.generatePublicKey(agentContext)\n const signer = new WebVhDidCryptoSigner(agentContext, publicKeyMultibase, keyId)\n const verifier = new WebVhDidCrypto(agentContext)\n const baseDid = `did:webvh:{SCID}:${encodeURIComponent(domain)}`\n\n // didwebvh-ts derives verification method ids as `<did>#<last 8 chars of publicKeyMultibase>`.\n // We reference the key relatively, as the full id is only known once the SCID has been\n // derived, and a relative reference is unaffected by the {SCID} substitution that happens\n // while the initial log entry is hashed.\n const verificationMethodFragment = `#${publicKeyMultibase.slice(-8)}`\n\n // Create DID\n const { did, doc, log } = await createDID({\n domain,\n paths,\n signer,\n updateKeys: [publicKeyMultibase],\n verificationMethods: [\n {\n controller: baseDid,\n type: 'Multikey',\n publicKeyMultibase,\n },\n ],\n // didwebvh-ts places verification methods without a purpose in `authentication` only, and\n // emits an empty `assertionMethod`. Without this, every attested resource signed by this\n // did would be unverifiable. Setting `purpose: 'assertionMethod'` on the verification\n // method is not an alternative, as that would empty `authentication` instead.\n assertionMethod: [verificationMethodFragment],\n verifier,\n })\n\n const didDocument = JsonTransformer.fromJSON(doc, DidDocument)\n\n // Derive the fragment from the actual DID document verificationMethod. didwebvh-ts\n // is responsible for incorporating and signing over fragments in the log\n // so we read back what the library produced\n const matchedVm = didDocument.verificationMethod?.find((vm) => vm.publicKeyMultibase === publicKeyMultibase)\n const vmIdFragment = matchedVm?.id.split('#')[1]\n keys.push({\n kmsKeyId: keyId,\n didDocumentRelativeKeyId: `#${vmIdFragment}`,\n })\n const didRecord = new DidRecord({\n did,\n didDocument,\n role: DidDocumentRole.Created,\n keys,\n })\n didRecord.metadata.set(WebVhDidRecordMetadataKeys.DidLog, log)\n didRecord.metadata.set(WebVhDidRecordMetadataKeys.UpdateKeyKmsKeyIds, { [publicKeyMultibase]: keyId })\n didRecord.setTags({ domain: domainKey })\n await didRepository.save(agentContext, didRecord)\n\n return {\n didDocumentMetadata: {},\n didRegistrationMetadata: {},\n didState: {\n state: 'finished',\n did,\n didDocument,\n },\n }\n } catch (error) {\n return this.handleError(error instanceof Error ? error.message : 'Unknown error occurred.')\n }\n }\n\n /**\n * Updates an existing DID document and its log in the repository.\n * Uses internal logic to validate verification methods and handle errors.\n * @param agentContext The agent context.\n * @param options The update options, including DID, log, signer, verifier, and services.\n * @returns The result of the DID update, with error handling and validation.\n */\n public async update(agentContext: AgentContext, options: WebVhDidUpdateOptions): Promise<DidUpdateResult> {\n try {\n const { did, didDocument: inputDidDocument } = options\n const didRepository = agentContext.dependencyManager.resolve(DidRepository)\n const didRecord = await didRepository.findSingleByQuery(agentContext, {\n role: DidDocumentRole.Created,\n did,\n method: 'webvh',\n })\n if (!didRecord) return this.handleError('DID not found')\n\n const log = didRecord.metadata.get(WebVhDidRecordMetadataKeys.DidLog) as DIDLog\n const domain = didRecord.getTag('domain') as string\n const activeUpdateKey = log[log.length - 1]?.parameters?.updateKeys?.[0] ?? log[0]?.parameters?.updateKeys?.[0]\n const vm = didRecord.didDocument?.verificationMethod?.find((v) => v.publicKeyMultibase === activeUpdateKey)\n let keyId = vm ? getKmsKeyIdForVerifiacationMethod(vm, didRecord.keys) : undefined\n if (!keyId && activeUpdateKey)\n keyId = didRecord.metadata.get(WebVhDidRecordMetadataKeys.UpdateKeyKmsKeyIds)?.[activeUpdateKey]\n\n if (!log) return this.handleError('The log registry must be created before it can be edited.')\n if (!keyId) return this.handleError('The key ID must be present before the log can be edited.')\n\n const {\n controller,\n authentication,\n assertionMethod,\n keyAgreement,\n service: services,\n verificationMethod: inputVerificationMethod,\n } = inputDidDocument\n const lastState = log[log.length - 1].state\n const verificationMethods = inputVerificationMethod ?? (lastState.verificationMethod as VerificationMethod[])\n // didwebvh-ts resets the verification relationships whenever verification methods are\n // supplied, so we fall back to the last log state to avoid dropping `assertionMethod` for\n // callers that only intend to update e.g. the services. References to keys that the update\n // removes are left behind, as carrying them over would publish a dangling reference.\n const assertionMethodRefs =\n normalizeMethodArray(assertionMethod) ??\n (lastState.assertionMethod as string[] | undefined)?.filter((reference) =>\n verificationMethods?.some((vm) => vm.id.endsWith(reference))\n )\n const { updateKeys } = log[log.length - 1].parameters\n const verificationMethod = verificationMethods?.find((vm) => vm.publicKeyMultibase)\n if (!verificationMethod?.publicKeyMultibase)\n return this.handleError('At least one verification method with publicKeyMultibase must be provided.')\n\n // Get signer/verifier\n const signer = new WebVhDidCryptoSigner(agentContext, verificationMethod.publicKeyMultibase, keyId)\n const verifier = new WebVhDidCrypto(agentContext)\n\n const { log: logResult, doc } = await updateDID({\n log,\n signer,\n verifier,\n domain,\n updateKeys,\n ...inputDidDocument,\n verificationMethods: verificationMethods as unknown as WebVhVerificationMethod[],\n controller: Array.isArray(controller) ? controller[0] : controller,\n authentication: normalizeMethodArray(authentication),\n assertionMethod: assertionMethodRefs,\n keyAgreement: normalizeMethodArray(keyAgreement),\n services: services as unknown as WebVhServiceEndpoint[],\n })\n didRecord.metadata.set(WebVhDidRecordMetadataKeys.DidLog, logResult)\n didRecord.didDocument = JsonTransformer.fromJSON(doc, DidDocument)\n await didRepository.update(agentContext, didRecord)\n\n return {\n didDocumentMetadata: {},\n didRegistrationMetadata: {},\n didState: {\n state: 'finished',\n did,\n didDocument: didRecord.didDocument,\n },\n }\n } catch (error) {\n return this.handleError(error instanceof Error ? error.message : 'Unknown error occurred.')\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n public deactivate(_agentContext: AgentContext, _options: DidDeactivateOptions): Promise<DidDeactivateResult> {\n throw new Error('Method not implemented.')\n }\n\n /**\n * Generates a new Ed25519 public key in multibase format and stores the private key in the wallet.\n * @param agentContext The agent context.\n * @returns The public key in multibase format.\n */\n private async generatePublicKey(agentContext: AgentContext): Promise<{ publicKeyMultibase: string; keyId: string }> {\n const kms = agentContext.dependencyManager.resolve(Kms.KeyManagementApi)\n const key = await kms.createKey({ type: { kty: 'OKP', crv: 'Ed25519' } })\n const publicKeyBytes = Kms.PublicJwk.fromPublicJwk(key.publicJwk).publicKey.publicKey\n\n return {\n publicKeyMultibase: multibaseEncode(\n new Uint8Array([0xed, 0x01, ...publicKeyBytes]),\n MultibaseEncoding.BASE58_BTC\n ),\n keyId: key.keyId,\n }\n }\n\n private handleError(reason: string): DidUpdateResult | DidCreateResult {\n return {\n didDocumentMetadata: {},\n didRegistrationMetadata: {},\n didState: {\n state: 'failed',\n reason,\n },\n }\n }\n}\n"],"mappings":";;;;;;AA6CA,MAAM,wBAAwB,QAC5B,KAAK,KAAK,SAAU,OAAO,SAAS,WAAW,OAAO,KAAK,EAAG;;;;;AAMhE,IAAa,oBAAb,MAAuD;;EACrD,KAAgB,mBAA6B,CAAC,OAAO;;;;;;;;;;;CAWrD,MAAa,OAAO,cAA4B,SAA0D;EACxG,IAAI;GACF,MAAM,EAAE,QAAQ,SAAS;GACzB,MAAM,QAAQ,MAAM,QAAQ,YAAY,EAAE,CAAC,CAAC,MAAM,GAAG;GACrD,MAAM,YAAY,OAAO,SAAS,CAAC,QAAQ,GAAG,KAAK,CAAC,CAAC,KAAK,GAAG,IAAI;GACjE,MAAM,OAAyB,CAAC;GAChC,MAAM,gBAAgB,aAAa,kBAAkB,QAAQ,aAAa;GAM1E,IAAI,MALiB,cAAc,kBAAkB,cAAc;IACjE,MAAM,gBAAgB;IACtB,QAAQ;IACR,QAAQ;GACV,CAAC,GACW,OAAO,KAAK,YAAY,yBAAyB,OAAO,kBAAkB;GAGtF,MAAM,EAAE,oBAAoB,UAAU,MAAM,KAAK,kBAAkB,YAAY;GAC/E,MAAM,SAAS,IAAI,qBAAqB,cAAc,oBAAoB,KAAK;GAC/E,MAA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ACnD,iBAAiB;IACjB,cAAc,qBAAqB,YAAY;IACrC;GACZ,CAAC;GACD,UAAU,SAAS,IAAA,OAAuC,SAAS;GACnE,UAAU,cAAc,gBAAgB,SAAS,KAAK,WAAW;GACjE,MAAM,cAAc,OAAO,cAAc,SAAS;GAElD,OAAO;IACL,qBAAqB,CAAC;IACtB,yBAAyB,CAAC;IAC1B,UAAU;KACR,OAAO;KACP;KACA,aAAa,UAAU;IACzB;GACF;EACF,SAAS,OAAO;GACd,OAAO,KAAK,YAAY,iBAAiB,QAAQ,MAAM,UAAU,yBAAyB;EAC5F;CACF;CAGA,WAAkB,eAA6B,UAA8D;EAC3G,MAAM,IAAI,MAAM,yBAAyB;CAC3C;;;;;;CAOA,MAAc,kBAAkB,cAAoF;EAElH,MAAM,MAAM,MADA,aAAa,kBAAkB,QAAQ,IAAI,gBACnC,CAAC,CAAC,UAAU,EAAE,MAAM;GAAE,KAAK;GAAO,KAAK;EAAU,EAAE,CAAC;EACxE,MAAM,iBAAiB,IAAI,UAAU,cAAc,IAAI,SAAS,CAAC,CAAC,UAAU;EAE5E,OAAO;GACL,oBAAoB,gBAClB,IAAI,WAAW;IAAC;IAAM;IAAM,GAAG;GAAc,CAAC,GAC9C,kBAAkB,UACpB;GACA,OAAO,IAAI;EACb;CACF;CAEA,YAAoB,QAAmD;EACrE,OAAO;GACL,qBAAqB,CAAC;GACtB,yBAAyB,CAAC;GAC1B,UAAU;IACR,OAAO;IACP;GACF;EACF;CACF;AACF"}
@@ -1,7 +1,6 @@
1
1
  import { AgentContext, DidResolutionResult, DidResolver } from "@credo-ts/core";
2
-
3
2
  //#region src/dids/WebVhDidResolver.d.ts
4
- declare class WebVhDidResolver implements DidResolver {
3
+ export declare class WebVhDidResolver implements DidResolver {
5
4
  readonly supportedMethods: string[];
6
5
  readonly allowsCaching = true;
7
6
  readonly allowsLocalDidRecord = true;
@@ -28,5 +27,4 @@ declare class WebVhDidResolver implements DidResolver {
28
27
  private resolveDidDoc;
29
28
  }
30
29
  //#endregion
31
- export { WebVhDidResolver };
32
30
  //# sourceMappingURL=WebVhDidResolver.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WebVhDidResolver.d.mts","names":[],"sources":["../../src/dids/WebVhDidResolver.ts"],"mappings":";;;cAOa,gBAAA,YAA4B,WAAA;EAAA,SACvB,gBAAA;EAAA,SACA,aAAA;EAAA,SACA,oBAAA;EAEH,OAAA,CAAQ,YAAA,EAAc,YAAA,EAAc,GAAA,WAAc,OAAA,CAAQ,mBAAA;EAkBhE,UAAA,GAAc,EAAA;EA0CR,eAAA,CAAgB,YAAA,EAAc,YAAA,EAAc,WAAA,WAAmB,OAAA;;;;;;;;;;;;;;;;;;UA8C9D,aAAA;AAAA"}
1
+ {"version":3,"file":"WebVhDidResolver.d.mts","names":[],"sources":["../../src/dids/WebVhDidResolver.ts"],"mappings":";;qBAOa,4BAA4B;WACvB;WACA;WACA;EAEH,QAAQ,cAAc,cAAc,cAAc,QAAQ;EAkBhE,aAAc;EA0CR,gBAAgB,cAAc,cAAc,sBAAmB;;;;;;;;;;;;;;;;;;UA8C9D"}
@@ -1,7 +1,6 @@
1
1
  import { WebVhDidCrypto } from "./WebVhDidCrypto.mjs";
2
2
  import { DidDocument } from "@credo-ts/core";
3
3
  import { resolveDID } from "didwebvh-ts";
4
-
5
4
  //#region src/dids/WebVhDidResolver.ts
6
5
  var WebVhDidResolver = class {
7
6
  constructor() {
@@ -74,7 +73,8 @@ var WebVhDidResolver = class {
74
73
  }
75
74
  }
76
75
  async resolveDidDoc(agentContext, did) {
77
- const { doc, meta } = await resolveDID(did, { verifier: new WebVhDidCrypto(agentContext) });
76
+ const crypto = new WebVhDidCrypto(agentContext);
77
+ const { doc, meta } = await resolveDID(did, { verifier: crypto });
78
78
  if (!doc) return {
79
79
  didDocument: null,
80
80
  didDocumentMetadata: {},
@@ -90,7 +90,7 @@ var WebVhDidResolver = class {
90
90
  };
91
91
  }
92
92
  };
93
-
94
93
  //#endregion
95
94
  export { WebVhDidResolver };
95
+
96
96
  //# sourceMappingURL=WebVhDidResolver.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"WebVhDidResolver.mjs","names":[],"sources":["../../src/dids/WebVhDidResolver.ts"],"sourcesContent":["import type { AgentContext, DidResolutionResult, DidResolver } from '@credo-ts/core'\n\nimport { DidDocument } from '@credo-ts/core'\nimport { resolveDID } from 'didwebvh-ts'\n\nimport { WebVhDidCrypto } from './WebVhDidCrypto'\n\nexport class WebVhDidResolver implements DidResolver {\n public readonly supportedMethods = ['webvh']\n public readonly allowsCaching = true\n public readonly allowsLocalDidRecord = true\n\n public async resolve(agentContext: AgentContext, did: string): Promise<DidResolutionResult> {\n const didDocumentMetadata = {}\n\n try {\n return await this.resolveDidDoc(agentContext, did)\n } catch (error) {\n agentContext.config.logger.error(`Error resolving DID ${did}: ${error}`)\n return {\n didDocument: null,\n didDocumentMetadata,\n didResolutionMetadata: {\n error: 'notFound',\n message: `resolver_error: Unable to resolve did '${did}': ${error}`,\n },\n }\n }\n }\n\n public getBaseUrl = (id: string) => {\n // Handle DID URL paths - split on first slash to separate DID from URL path\n const slashIndex = id.indexOf('/')\n let didPart = id\n let urlPath = ''\n\n if (slashIndex !== -1) {\n didPart = id.substring(0, slashIndex)\n urlPath = id.substring(slashIndex)\n }\n\n const parts = didPart.split(':')\n if (!didPart.startsWith('did:webvh:') || parts.length < 4) {\n throw new Error(`${id} is not a valid did:webvh identifier`)\n }\n\n // Extract domain and path parts from the DID (after did:webvh:CID)\n const domainAndPathParts = parts.slice(3)\n const protocol = domainAndPathParts.join(':').includes('localhost') ? 'http' : 'https'\n\n // First part is domain, rest are path components\n const domain = domainAndPathParts[0]\n const pathComponents = domainAndPathParts.slice(1)\n\n // Check if domain has port\n const [host, port] = domain.split(':')\n const normalizedHost = port ? `${host}:${port}` : host\n\n // Build the base URL\n let baseUrl = `${protocol}://${normalizedHost}`\n if (pathComponents.length > 0) {\n baseUrl += `/${pathComponents.join('/')}`\n }\n\n // Append the URL path if present\n if (urlPath) {\n baseUrl += urlPath\n }\n\n return baseUrl\n }\n\n public async resolveResource(agentContext: AgentContext, resourceUrl: string) {\n try {\n agentContext.config.logger.debug(`Attempting to resolve resource: ${resourceUrl}`)\n\n // Use the getBaseUrl method to parse the did:webvh resource URL\n const httpsUrl = this.getBaseUrl(resourceUrl)\n\n agentContext.config.logger.debug(`Fetching resource from: ${httpsUrl}`)\n\n // Fetch the resource using agent dependencies fetch\n const response = await agentContext.config.agentDependencies.fetch(httpsUrl)\n\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`)\n }\n\n const contentType = response.headers.get('content-type') || 'application/json'\n let content: Record<string, unknown> | unknown[] | string\n\n if (contentType.includes('application/json')) {\n content = (await response.json()) as Record<string, unknown>\n } else {\n content = await response.text()\n }\n\n agentContext.config.logger.debug(`Successfully fetched resource, content type: ${contentType}`)\n\n return {\n content: content,\n contentMetadata: {\n contentType: contentType,\n retrieved: new Date().toISOString(),\n },\n dereferencingMetadata: {\n contentType: contentType,\n },\n }\n } catch (error) {\n agentContext.config.logger.error(`Error resolving resource ${resourceUrl}:`, error)\n return {\n error: 'notFound',\n message: `resolver_error: Unable to resolve resource '${resourceUrl}': ${error instanceof Error ? error.message : String(error)}`,\n }\n }\n }\n\n private async resolveDidDoc(agentContext: AgentContext, did: string): Promise<DidResolutionResult> {\n const crypto = new WebVhDidCrypto(agentContext)\n const { doc, meta } = await resolveDID(did, { verifier: crypto })\n\n if (!doc) {\n return {\n didDocument: null,\n didDocumentMetadata: {},\n didResolutionMetadata: {\n error: meta.error && /not_?found/i.test(meta.error) ? 'notFound' : 'invalidDid',\n message: `resolver_error: Unable to resolve did '${did}': ${meta.problemDetails?.detail ?? meta.error ?? 'no did document returned'}`,\n },\n }\n }\n\n return {\n didDocument: DidDocument.fromJSON(doc),\n didDocumentMetadata: {},\n didResolutionMetadata: {},\n }\n }\n}\n"],"mappings":";;;;;AAOA,IAAa,mBAAb,MAAqD;;OACnC,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W;GAGvE,MAAM,WAAW,MAAM,aAAa,OAAO,kBAAkB,MAAM,SAAS;AAE5E,OAAI,CAAC,SAAS,GACZ,OAAM,IAAI,MAAM,QAAQ,SAAS,OAAO,IAAI,SAAS,aAAa;GAGpE,MAAM,cAAc,SAAS,QAAQ,IAAI,eAAe,IAAI;GAC5D,IAAI;AAEJ,OAAI,YAAY,SAAS,mBAAmB,CAC1C,WAAW,MAAM,SAAS,MAAM;OAEhC,WAAU,MAAM,SAAS,MAAM;AAGjC,gBAAa,OAAO,OAAO,MAAM,gDAAgD,cAAc;AAE/F,UAAO;IACI;IACT,iBAAiB;KACF;KACb,4BAAW,IAAI,MAAM,EAAC,aAAa;KACpC;IACD,uBAAuB,EACR,aACd;IACF;WACM,OAAO;AACd,gBAAa,OAAO,OAAO,MAAM,4BAA4B,YAAY,IAAI,MAAM;AACnF,UAAO;IACL,OAAO;IACP,SAAS,+CAA+C,YAAY,KAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;IAChI;;;CAIL,MAAc,cAAc,cAA4B,KAA2C;EAEjG,MAAM,EAAE,KAAK,SAAS,MAAM,WAAW,KAAK,EAAE,UAD/B,IAAI,eAAe,aAAa,EACiB,CAAC;AAEjE,MAAI,CAAC,IACH,QAAO;GACL,aAAa;GACb,qBAAqB,EAAE;GACvB,uBAAuB;IACrB,OAAO,KAAK,SAAS,cAAc,KAAK,KAAK,MAAM,GAAG,aAAa;IACnE,SAAS,0CAA0C,IAAI,KAAK,KAAK,gBAAgB,UAAU,KAAK,SAAS;IAC1G;GACF;AAGH,SAAO;GACL,aAAa,YAAY,SAAS,IAAI;GACtC,qBAAqB,EAAE;GACvB,uBAAuB,EAAE;GAC1B"}
1
+ {"version":3,"file":"WebVhDidResolver.mjs","names":[],"sources":["../../src/dids/WebVhDidResolver.ts"],"sourcesContent":["import type { AgentContext, DidResolutionResult, DidResolver } from '@credo-ts/core'\n\nimport { DidDocument } from '@credo-ts/core'\nimport { resolveDID } from 'didwebvh-ts'\n\nimport { WebVhDidCrypto } from './WebVhDidCrypto'\n\nexport class WebVhDidResolver implements DidResolver {\n public readonly supportedMethods = ['webvh']\n public readonly allowsCaching = true\n public readonly allowsLocalDidRecord = true\n\n public async resolve(agentContext: AgentContext, did: string): Promise<DidResolutionResult> {\n const didDocumentMetadata = {}\n\n try {\n return await this.resolveDidDoc(agentContext, did)\n } catch (error) {\n agentContext.config.logger.error(`Error resolving DID ${did}: ${error}`)\n return {\n didDocument: null,\n didDocumentMetadata,\n didResolutionMetadata: {\n error: 'notFound',\n message: `resolver_error: Unable to resolve did '${did}': ${error}`,\n },\n }\n }\n }\n\n public getBaseUrl = (id: string) => {\n // Handle DID URL paths - split on first slash to separate DID from URL path\n const slashIndex = id.indexOf('/')\n let didPart = id\n let urlPath = ''\n\n if (slashIndex !== -1) {\n didPart = id.substring(0, slashIndex)\n urlPath = id.substring(slashIndex)\n }\n\n const parts = didPart.split(':')\n if (!didPart.startsWith('did:webvh:') || parts.length < 4) {\n throw new Error(`${id} is not a valid did:webvh identifier`)\n }\n\n // Extract domain and path parts from the DID (after did:webvh:CID)\n const domainAndPathParts = parts.slice(3)\n const protocol = domainAndPathParts.join(':').includes('localhost') ? 'http' : 'https'\n\n // First part is domain, rest are path components\n const domain = domainAndPathParts[0]\n const pathComponents = domainAndPathParts.slice(1)\n\n // Check if domain has port\n const [host, port] = domain.split(':')\n const normalizedHost = port ? `${host}:${port}` : host\n\n // Build the base URL\n let baseUrl = `${protocol}://${normalizedHost}`\n if (pathComponents.length > 0) {\n baseUrl += `/${pathComponents.join('/')}`\n }\n\n // Append the URL path if present\n if (urlPath) {\n baseUrl += urlPath\n }\n\n return baseUrl\n }\n\n public async resolveResource(agentContext: AgentContext, resourceUrl: string) {\n try {\n agentContext.config.logger.debug(`Attempting to resolve resource: ${resourceUrl}`)\n\n // Use the getBaseUrl method to parse the did:webvh resource URL\n const httpsUrl = this.getBaseUrl(resourceUrl)\n\n agentContext.config.logger.debug(`Fetching resource from: ${httpsUrl}`)\n\n // Fetch the resource using agent dependencies fetch\n const response = await agentContext.config.agentDependencies.fetch(httpsUrl)\n\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`)\n }\n\n const contentType = response.headers.get('content-type') || 'application/json'\n let content: Record<string, unknown> | unknown[] | string\n\n if (contentType.includes('application/json')) {\n content = (await response.json()) as Record<string, unknown>\n } else {\n content = await response.text()\n }\n\n agentContext.config.logger.debug(`Successfully fetched resource, content type: ${contentType}`)\n\n return {\n content: content,\n contentMetadata: {\n contentType: contentType,\n retrieved: new Date().toISOString(),\n },\n dereferencingMetadata: {\n contentType: contentType,\n },\n }\n } catch (error) {\n agentContext.config.logger.error(`Error resolving resource ${resourceUrl}:`, error)\n return {\n error: 'notFound',\n message: `resolver_error: Unable to resolve resource '${resourceUrl}': ${error instanceof Error ? error.message : String(error)}`,\n }\n }\n }\n\n private async resolveDidDoc(agentContext: AgentContext, did: string): Promise<DidResolutionResult> {\n const crypto = new WebVhDidCrypto(agentContext)\n const { doc, meta } = await resolveDID(did, { verifier: crypto })\n\n if (!doc) {\n return {\n didDocument: null,\n didDocumentMetadata: {},\n didResolutionMetadata: {\n error: meta.error && /not_?found/i.test(meta.error) ? 'notFound' : 'invalidDid',\n message: `resolver_error: Unable to resolve did '${did}': ${meta.problemDetails?.detail ?? meta.error ?? 'no did document returned'}`,\n },\n }\n }\n\n return {\n didDocument: DidDocument.fromJSON(doc),\n didDocumentMetadata: {},\n didResolutionMetadata: {},\n }\n }\n}\n"],"mappings":";;;;AAOA,IAAa,mBAAb,MAAqD;;EACnD,KAAgB,mBAAmB,CAAC,OAAO;EAC3C,KAAgB,gBAAgB;EAChC,KAAgB,uBAAuB;EAoBvC,KAAO,cAAc,OAAe;GAElC,MAAM,aAAa,GAAG,QAAQ,GAAG;GACjC,IAAI,UAAU;GACd,IAAI,UAAU;GAEd,IAAI,eAAe,IAAI;IACrB,UAAU,GAAG,UAAU,GAAG,UAAU;IACpC,UAAU,GAAG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GAC5D,IAAI;GAEJ,IAAI,YAAY,SAAS,kBAAkB,GACzC,UAAW,MAAM,SAAS,KAAK;QAE/B,UAAU,MAAM,SAAS,KAAK;GAGhC,aAAa,OAAO,OAAO,MAAM,gDAAgD,aAAa;GAE9F,OAAO;IACI;IACT,iBAAiB;KACF;KACb,4BAAW,IAAI,KAAK,EAAA,CAAE,YAAY;IACpC;IACA,uBAAuB,EACR,YACf;GACF;EACF,SAAS,OAAO;GACd,aAAa,OAAO,OAAO,MAAM,4BAA4B,YAAY,IAAI,KAAK;GAClF,OAAO;IACL,OAAO;IACP,SAAS,+CAA+C,YAAY,KAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;GAChI;EACF;CACF;CAEA,MAAc,cAAc,cAA4B,KAA2C;EACjG,MAAM,SAAS,IAAI,eAAe,YAAY;EAC9C,MAAM,EAAE,KAAK,SAAS,MAAM,WAAW,KAAK,EAAE,UAAU,OAAO,CAAC;EAEhE,IAAI,CAAC,KACH,OAAO;GACL,aAAa;GACb,qBAAqB,CAAC;GACtB,uBAAuB;IACrB,OAAO,KAAK,SAAS,cAAc,KAAK,KAAK,KAAK,IAAI,aAAa;IACnE,SAAS,0CAA0C,IAAI,KAAK,KAAK,gBAAgB,UAAU,KAAK,SAAS;GAC3G;EACF;EAGF,OAAO;GACL,aAAa,YAAY,SAAS,GAAG;GACrC,qBAAqB,CAAC;GACtB,uBAAuB,CAAC;EAC1B;CACF;AACF"}
@@ -2,4 +2,5 @@ import "./WebVhDidCrypto.mjs";
2
2
  import "./WebVhDidCryptoSigner.mjs";
3
3
  import { WebVhDidCreateOptions, WebVhDidRegistrar, WebVhDidUpdateOptions } from "./WebVhDidRegistrar.mjs";
4
4
  import { WebVhDidResolver } from "./WebVhDidResolver.mjs";
5
- import { WebVhDidRecordMetadataKeys } from "./webVhDidRecordMetadataTypes.mjs";
5
+ import { WebVhDidRecordMetadataKeys } from "./webVhDidRecordMetadataTypes.mjs";
6
+ export { type WebVhDidCreateOptions, WebVhDidRecordMetadataKeys, WebVhDidRegistrar, WebVhDidResolver, type WebVhDidUpdateOptions };
@@ -1,5 +1,6 @@
1
- import { WebVhDidCrypto } from "./WebVhDidCrypto.mjs";
2
- import { WebVhDidCryptoSigner } from "./WebVhDidCryptoSigner.mjs";
1
+ import "./WebVhDidCrypto.mjs";
2
+ import "./WebVhDidCryptoSigner.mjs";
3
3
  import { WebVhDidRecordMetadataKeys } from "./webVhDidRecordMetadataTypes.mjs";
4
4
  import { WebVhDidRegistrar } from "./WebVhDidRegistrar.mjs";
5
5
  import { WebVhDidResolver } from "./WebVhDidResolver.mjs";
6
+ export { WebVhDidRecordMetadataKeys, WebVhDidRegistrar, WebVhDidResolver };
@@ -1,10 +1,8 @@
1
1
  import "../resources/index.mjs";
2
-
3
2
  //#region src/dids/webVhDidRecordMetadataTypes.d.ts
4
- declare enum WebVhDidRecordMetadataKeys {
3
+ export declare enum WebVhDidRecordMetadataKeys {
5
4
  DidLog = "log",
6
5
  UpdateKeyKmsKeyIds = "_internal/webvhUpdateKeyKmsKeyIds"
7
6
  }
8
7
  //#endregion
9
- export { WebVhDidRecordMetadataKeys };
10
8
  //# sourceMappingURL=webVhDidRecordMetadataTypes.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"webVhDidRecordMetadataTypes.d.mts","names":[],"sources":["../../src/dids/webVhDidRecordMetadataTypes.ts"],"mappings":";;;aAEY,0BAAA;EAEV,MAAA;EACA,kBAAA;AAAA"}
1
+ {"version":3,"file":"webVhDidRecordMetadataTypes.d.mts","names":[],"sources":["../../src/dids/webVhDidRecordMetadataTypes.ts"],"mappings":";;oBAEY;EAEV;EACA"}
@@ -4,7 +4,7 @@ let WebVhDidRecordMetadataKeys = /* @__PURE__ */ function(WebVhDidRecordMetadata
4
4
  WebVhDidRecordMetadataKeys["UpdateKeyKmsKeyIds"] = "_internal/webvhUpdateKeyKmsKeyIds";
5
5
  return WebVhDidRecordMetadataKeys;
6
6
  }({});
7
-
8
7
  //#endregion
9
8
  export { WebVhDidRecordMetadataKeys };
9
+
10
10
  //# sourceMappingURL=webVhDidRecordMetadataTypes.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"webVhDidRecordMetadataTypes.mjs","names":[],"sources":["../../src/dids/webVhDidRecordMetadataTypes.ts"],"sourcesContent":["import type { WebVhDidLog } from '../resources'\n\nexport enum WebVhDidRecordMetadataKeys {\n // FIXME: refactor to '_internal/webvhDidLog' in next major release\n DidLog = 'log',\n UpdateKeyKmsKeyIds = '_internal/webvhUpdateKeyKmsKeyIds',\n}\n\nexport type WebVhDidRecordMetadata = {\n [WebVhDidRecordMetadataKeys.DidLog]: WebVhDidLog\n [WebVhDidRecordMetadataKeys.UpdateKeyKmsKeyIds]: Record<string, string>\n}\n"],"mappings":";AAEA,IAAY,kFAAL;AAEL;AACA"}
1
+ {"version":3,"file":"webVhDidRecordMetadataTypes.mjs","names":[],"sources":["../../src/dids/webVhDidRecordMetadataTypes.ts"],"sourcesContent":["import type { WebVhDidLog } from '../resources'\n\nexport enum WebVhDidRecordMetadataKeys {\n // FIXME: refactor to '_internal/webvhDidLog' in next major release\n DidLog = 'log',\n UpdateKeyKmsKeyIds = '_internal/webvhUpdateKeyKmsKeyIds',\n}\n\nexport type WebVhDidRecordMetadata = {\n [WebVhDidRecordMetadataKeys.DidLog]: WebVhDidLog\n [WebVhDidRecordMetadataKeys.UpdateKeyKmsKeyIds]: Record<string, string>\n}\n"],"mappings":";AAEA,IAAY,6BAAL,yBAAA,4BAAA;CAEL,2BAAA,YAAA;CACA,2BAAA,wBAAA;;AACF,EAAA,CAAA,CAAA"}
package/build/index.d.mts CHANGED
@@ -8,4 +8,4 @@ import { WebVhDidRecordMetadataKeys } from "./dids/webVhDidRecordMetadataTypes.m
8
8
  import { WebVhApi } from "./WebVhApi.mjs";
9
9
  import { WebVhModule } from "./WebVhModule.mjs";
10
10
  import "./core.mjs";
11
- export { WebVhAnonCredsRegistry, WebVhApi, WebVhAttestedResource, WebVhAttestedResourceLink, WebVhAttestedResourceProof, WebVhDidCreateOptions, WebVhDidLog, WebVhDidLogEntry, WebVhDidRecordMetadataKeys, WebVhDidRegistrar, WebVhDidResolver, WebVhDidUpdateOptions, WebVhModule, WebVhResourceIdParts, WebVhResourcePublisher, WebVhResourceResolver, getResourceType, isWebVhAttestedResource, parseResourceId, requireResourceType };
11
+ export { WebVhAnonCredsRegistry, WebVhApi, WebVhAttestedResource, WebVhAttestedResourceLink, WebVhAttestedResourceProof, type WebVhDidCreateOptions, WebVhDidLog, WebVhDidLogEntry, WebVhDidRecordMetadataKeys, WebVhDidRegistrar, WebVhDidResolver, type WebVhDidUpdateOptions, WebVhModule, WebVhResourceIdParts, WebVhResourcePublisher, WebVhResourceResolver, getResourceType, isWebVhAttestedResource, parseResourceId, requireResourceType };
package/build/index.mjs CHANGED
@@ -8,5 +8,4 @@ import "./anoncreds/index.mjs";
8
8
  import { WebVhApi } from "./WebVhApi.mjs";
9
9
  import { WebVhModule } from "./WebVhModule.mjs";
10
10
  import "./core.mjs";
11
-
12
- export { WebVhAnonCredsRegistry, WebVhApi, WebVhAttestedResource, WebVhAttestedResourceLink, WebVhAttestedResourceProof, WebVhDidRecordMetadataKeys, WebVhDidRegistrar, WebVhDidResolver, WebVhModule, getResourceType, isWebVhAttestedResource, parseResourceId, requireResourceType };
11
+ export { WebVhAnonCredsRegistry, WebVhApi, WebVhAttestedResource, WebVhAttestedResourceLink, WebVhAttestedResourceProof, WebVhDidRecordMetadataKeys, WebVhDidRegistrar, WebVhDidResolver, WebVhModule, getResourceType, isWebVhAttestedResource, parseResourceId, requireResourceType };
@@ -1,5 +1,4 @@
1
1
  import { DIDLog, DIDLogEntry } from "didwebvh-ts";
2
-
3
2
  //#region src/resources/attestedResource.d.ts
4
3
  /**
5
4
  * A single entry in a did:webvh DID log.
@@ -7,31 +6,31 @@ import { DIDLog, DIDLogEntry } from "didwebvh-ts";
7
6
  * as a stable Credo-level contract so consumers do not need to import directly
8
7
  * from the upstream library.
9
8
  */
10
- type WebVhDidLogEntry = DIDLogEntry;
9
+ export type WebVhDidLogEntry = DIDLogEntry;
11
10
  /**
12
11
  * An ordered array of `WebVhDidLogEntry` items representing the full history of
13
12
  * a did:webvh DID document.
14
13
  * Structurally identical to `DIDLog` from `didwebvh-ts`.
15
14
  */
16
- type WebVhDidLog = DIDLog;
17
- type WebVhResourceIdParts = {
15
+ export type WebVhDidLog = DIDLog;
16
+ export type WebVhResourceIdParts = {
18
17
  did: string;
19
18
  resourceId: string;
20
19
  };
21
- declare class WebVhAttestedResourceProof {
20
+ export declare class WebVhAttestedResourceProof {
22
21
  type: string;
23
22
  cryptosuite: string;
24
23
  proofPurpose: string;
25
24
  proofValue: string;
26
25
  verificationMethod: string;
27
26
  }
28
- declare class WebVhAttestedResourceLink {
27
+ export declare class WebVhAttestedResourceLink {
29
28
  id: string;
30
29
  type: string;
31
30
  timestamp?: number;
32
31
  digestMultibase?: string;
33
32
  }
34
- declare class WebVhAttestedResource {
33
+ export declare class WebVhAttestedResource {
35
34
  '@context': string[];
36
35
  type: string[];
37
36
  id: string;
@@ -40,21 +39,20 @@ declare class WebVhAttestedResource {
40
39
  metadata?: Record<string, unknown>;
41
40
  links?: WebVhAttestedResourceLink[];
42
41
  }
43
- interface WebVhResourcePublisher<TResource = unknown, TOptions = unknown> {
42
+ export interface WebVhResourcePublisher<TResource = unknown, TOptions = unknown> {
44
43
  publish(options: TOptions): Promise<TResource>;
45
44
  }
46
- interface WebVhResourceResolver<TResource = unknown> {
45
+ export interface WebVhResourceResolver<TResource = unknown> {
47
46
  resolve(resourceId: string): Promise<TResource>;
48
47
  }
49
- declare function isWebVhAttestedResource(value: unknown): value is WebVhAttestedResource;
50
- declare function parseResourceId(resourceId: string): WebVhResourceIdParts | null;
51
- declare function getResourceType(resource: Pick<WebVhAttestedResource, 'metadata'>): string | undefined;
48
+ export declare function isWebVhAttestedResource(value: unknown): value is WebVhAttestedResource;
49
+ export declare function parseResourceId(resourceId: string): WebVhResourceIdParts | null;
50
+ export declare function getResourceType(resource: Pick<WebVhAttestedResource, 'metadata'>): string | undefined;
52
51
  /**
53
52
  * Returns the `metadata.resourceType` string from a webvh attested resource.
54
53
  * Throws if the field is absent or empty, ensuring callers receive a non-optional
55
54
  * string suitable for deterministic indexing, policy routing, or typed dispatch.
56
55
  */
57
- declare function requireResourceType(resource: Pick<WebVhAttestedResource, 'metadata'>): string;
56
+ export declare function requireResourceType(resource: Pick<WebVhAttestedResource, 'metadata'>): string;
58
57
  //#endregion
59
- export { WebVhAttestedResource, WebVhAttestedResourceLink, WebVhAttestedResourceProof, WebVhDidLog, WebVhDidLogEntry, WebVhResourceIdParts, WebVhResourcePublisher, WebVhResourceResolver, getResourceType, isWebVhAttestedResource, parseResourceId, requireResourceType };
60
58
  //# sourceMappingURL=attestedResource.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"attestedResource.d.mts","names":[],"sources":["../../src/resources/attestedResource.ts"],"mappings":";;;;;AAWA;;;;KAAY,gBAAA,GAAmB,WAAA;AAO/B;;;;;AAAA,KAAY,WAAA,GAAc,MAAA;AAAA,KAEd,oBAAA;EACV,GAAA;EACA,UAAA;AAAA;AAAA,cAGW,0BAAA;EAEJ,IAAA;EAGA,WAAA;EAGA,YAAA;EAGA,UAAA;EAGA,kBAAA;AAAA;AAAA,cAGI,yBAAA;EAEJ,EAAA;EAGA,IAAA;EAIA,SAAA;EAIA,eAAA;AAAA;AAAA,cAGI,qBAAA;EAAA;EASJ,IAAA;EAGA,EAAA;EAGA,OAAA;EAIA,KAAA,EAAQ,0BAAA;EAIR,QAAA,GAAW,MAAA;EAMX,KAAA,GAAQ,yBAAA;AAAA;AAAA,UAGA,sBAAA;EACf,OAAA,CAAQ,OAAA,EAAS,QAAA,GAAW,OAAA,CAAQ,SAAA;AAAA;AAAA,UAGrB,qBAAA;EACf,OAAA,CAAQ,UAAA,WAAqB,OAAA,CAAQ,SAAA;AAAA;AAAA,iBAGvB,uBAAA,CAAwB,KAAA,YAAiB,KAAA,IAAS,qBAAA;AAAA,iBAsBlD,eAAA,CAAgB,UAAA,WAAqB,oBAAA;AAAA,iBAUrC,eAAA,CAAgB,QAAA,EAAU,IAAA,CAAK,qBAAA;;;;;;iBAU/B,mBAAA,CAAoB,QAAA,EAAU,IAAA,CAAK,qBAAA"}
1
+ {"version":3,"file":"attestedResource.d.mts","names":[],"sources":["../../src/resources/attestedResource.ts"],"mappings":";;;;;;;;YAWY,mBAAmB;;;;;;YAOnB,cAAc;YAEd;EACV;EACA;;qBAGW;EAEJ;EAGA;EAGA;EAGA;EAGA;;qBAGI;EAEJ;EAGA;EAIA;EAIA;;qBAGI;;EASJ;EAGA;EAGA;EAIA,OAAQ;EAIR,WAAW;EAMX,QAAQ;;iBAGA,uBAAuB,qBAAqB;EAC3D,QAAQ,SAAS,WAAW,QAAQ;;iBAGrB,sBAAsB;EACrC,QAAQ,qBAAqB,QAAQ;;wBAGvB,wBAAwB,iBAAiB,SAAS;wBAsBlD,gBAAgB,qBAAqB;wBAUrC,gBAAgB,UAAU,KAAK;;;;;;wBAU/B,oBAAoB,UAAU,KAAK"}
@@ -1,11 +1,9 @@
1
- import { __decorateMetadata } from "../_virtual/_@oxc-project_runtime@0.112.0/helpers/decorateMetadata.mjs";
2
- import { __decorate } from "../_virtual/_@oxc-project_runtime@0.112.0/helpers/decorate.mjs";
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 { IsStringOrStringArray } from "@credo-ts/core";
4
4
  import { Transform, Type } from "class-transformer";
5
5
  import { IsArray, IsNumber, IsObject, IsOptional, IsString, Validate, ValidateNested } from "class-validator";
6
-
7
6
  //#region src/resources/attestedResource.ts
8
- var _ref, _ref2;
9
7
  var WebVhAttestedResourceProof = class {};
10
8
  __decorate([IsString(), __decorateMetadata("design:type", String)], WebVhAttestedResourceProof.prototype, "type", void 0);
11
9
  __decorate([IsString(), __decorateMetadata("design:type", String)], WebVhAttestedResourceProof.prototype, "cryptosuite", void 0);
@@ -43,12 +41,12 @@ __decorate([IsObject(), __decorateMetadata("design:type", Object)], WebVhAtteste
43
41
  __decorate([
44
42
  ValidateNested(),
45
43
  Type(() => WebVhAttestedResourceProof),
46
- __decorateMetadata("design:type", typeof (_ref = typeof WebVhAttestedResourceProof !== "undefined" && WebVhAttestedResourceProof) === "function" ? _ref : Object)
44
+ __decorateMetadata("design:type", typeof WebVhAttestedResourceProof === "undefined" ? Object : WebVhAttestedResourceProof)
47
45
  ], WebVhAttestedResource.prototype, "proof", void 0);
48
46
  __decorate([
49
47
  IsOptional(),
50
48
  IsObject(),
51
- __decorateMetadata("design:type", typeof (_ref2 = typeof Record !== "undefined" && Record) === "function" ? _ref2 : Object)
49
+ __decorateMetadata("design:type", typeof Record === "undefined" ? Object : Record)
52
50
  ], WebVhAttestedResource.prototype, "metadata", void 0);
53
51
  __decorate([
54
52
  IsOptional(),
@@ -90,7 +88,7 @@ function requireResourceType(resource) {
90
88
  if (typeof resourceType !== "string" || resourceType.length === 0) throw new Error("WebVh attested resource is missing required metadata.resourceType");
91
89
  return resourceType;
92
90
  }
93
-
94
91
  //#endregion
95
92
  export { WebVhAttestedResource, WebVhAttestedResourceLink, WebVhAttestedResourceProof, getResourceType, isWebVhAttestedResource, parseResourceId, requireResourceType };
93
+
96
94
  //# sourceMappingURL=attestedResource.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"attestedResource.mjs","names":[],"sources":["../../src/resources/attestedResource.ts"],"sourcesContent":["import { IsStringOrStringArray } from '@credo-ts/core'\nimport { Transform, Type } from 'class-transformer'\nimport { IsArray, IsNumber, IsObject, IsOptional, IsString, Validate, ValidateNested } from 'class-validator'\nimport type { DIDLog, DIDLogEntry } from 'didwebvh-ts'\n\n/**\n * A single entry in a did:webvh DID log.\n * Structurally identical to `DIDLogEntry` from `didwebvh-ts`; re-exported here\n * as a stable Credo-level contract so consumers do not need to import directly\n * from the upstream library.\n */\nexport type WebVhDidLogEntry = DIDLogEntry\n\n/**\n * An ordered array of `WebVhDidLogEntry` items representing the full history of\n * a did:webvh DID document.\n * Structurally identical to `DIDLog` from `didwebvh-ts`.\n */\nexport type WebVhDidLog = DIDLog\n\nexport type WebVhResourceIdParts = {\n did: string\n resourceId: string\n}\n\nexport class WebVhAttestedResourceProof {\n @IsString()\n public type!: string\n\n @IsString()\n public cryptosuite!: string\n\n @IsString()\n public proofPurpose!: string\n\n @IsString()\n public proofValue!: string\n\n @IsString()\n public verificationMethod!: string\n}\n\nexport class WebVhAttestedResourceLink {\n @IsString()\n public id!: string\n\n @IsString()\n public type!: string\n\n @IsOptional()\n @IsNumber()\n public timestamp?: number\n\n @IsOptional()\n @IsString()\n public digestMultibase?: string\n}\n\nexport class WebVhAttestedResource {\n @IsArray()\n @IsString({ each: true })\n @Type(() => String)\n public '@context'!: string[]\n\n @Validate(IsStringOrStringArray)\n @Transform(({ value }) => (Array.isArray(value) ? value : [value]))\n @Type(() => String)\n public type!: string[]\n\n @IsString()\n public id!: string\n\n @IsObject()\n public content!: unknown\n\n @ValidateNested()\n @Type(() => WebVhAttestedResourceProof)\n public proof!: WebVhAttestedResourceProof\n\n @IsOptional()\n @IsObject()\n public metadata?: Record<string, unknown>\n\n @IsOptional()\n @IsArray()\n @ValidateNested({ each: true })\n @Type(() => WebVhAttestedResourceLink)\n public links?: WebVhAttestedResourceLink[]\n}\n\nexport interface WebVhResourcePublisher<TResource = unknown, TOptions = unknown> {\n publish(options: TOptions): Promise<TResource>\n}\n\nexport interface WebVhResourceResolver<TResource = unknown> {\n resolve(resourceId: string): Promise<TResource>\n}\n\nexport function isWebVhAttestedResource(value: unknown): value is WebVhAttestedResource {\n if (!value || typeof value !== 'object') return false\n\n const candidate = value as {\n type?: unknown\n id?: unknown\n content?: unknown\n proof?: unknown\n metadata?: unknown\n links?: unknown\n }\n\n if (!Array.isArray(candidate.type) || !candidate.type.includes('AttestedResource')) return false\n if (typeof candidate.id !== 'string') return false\n if (!candidate.content || typeof candidate.content !== 'object') return false\n if (!candidate.proof || typeof candidate.proof !== 'object') return false\n if (candidate.metadata !== undefined && typeof candidate.metadata !== 'object') return false\n if (candidate.links !== undefined && !Array.isArray(candidate.links)) return false\n\n return true\n}\n\nexport function parseResourceId(resourceId: string): WebVhResourceIdParts | null {\n const match = resourceId.match(/^(did:webvh:[^/]+)\\/resources\\/([^/]+)$/)\n if (!match) return null\n\n return {\n did: match[1],\n resourceId: match[2],\n }\n}\n\nexport function getResourceType(resource: Pick<WebVhAttestedResource, 'metadata'>): string | undefined {\n const resourceType = resource.metadata?.resourceType\n return typeof resourceType === 'string' ? resourceType : undefined\n}\n\n/**\n * Returns the `metadata.resourceType` string from a webvh attested resource.\n * Throws if the field is absent or empty, ensuring callers receive a non-optional\n * string suitable for deterministic indexing, policy routing, or typed dispatch.\n */\nexport function requireResourceType(resource: Pick<WebVhAttestedResource, 'metadata'>): string {\n const resourceType = resource.metadata?.resourceType\n if (typeof resourceType !== 'string' || resourceType.length === 0) {\n throw new Error('WebVh attested resource is missing required metadata.resourceType')\n }\n return resourceType\n}\n"],"mappings":";;;;;;;;AAyBA,IAAa,6BAAb,MAAwC;YACrC,UAAU;YAGV,UAAU;YAGV,UAAU;YAGV,UAAU;YAGV,UAAU;AAIb,IAAa,4BAAb,MAAuC;YACpC,UAAU;YAGV,UAAU;;CAGV,YAAY;CACZ,UAAU;;;;CAGV,YAAY;CACZ,UAAU;;;AAIb,IAAa,wBAAb,MAAmC;;CAChC,SAAS;CACT,SAAS,EAAE,MAAM,MAAM,CAAC;CACxB,WAAW,OAAO;;oCACZ;;CAEN,SAAS,sBAAsB;CAC/B,WAAW,EAAE,YAAa,MAAM,QAAQ,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAE;CAClE,WAAW,OAAO;;;YAGlB,UAAU;YAGV,UAAU;;CAGV,gBAAgB;CAChB,WAAW,2BAA2B;;;;CAGtC,YAAY;CACZ,UAAU;;;;CAGV,YAAY;CACZ,SAAS;CACT,eAAe,EAAE,MAAM,MAAM,CAAC;CAC9B,WAAW,0BAA0B;;;AAYxC,SAAgB,wBAAwB,OAAgD;AACtF,KAAI,CAAC,SAAS,OAAO,UAAU,SAAU,QAAO;CAEhD,MAAM,YAAY;AASlB,KAAI,CAAC,MAAM,QAAQ,UAAU,KAAK,IAAI,CAAC,UAAU,KAAK,SAAS,mBAAmB,CAAE,QAAO;AAC3F,KAAI,OAAO,UAAU,OAAO,SAAU,QAAO;AAC7C,KAAI,CAAC,UAAU,WAAW,OAAO,UAAU,YAAY,SAAU,QAAO;AACxE,KAAI,CAAC,UAAU,SAAS,OAAO,UAAU,UAAU,SAAU,QAAO;AACpE,KAAI,UAAU,aAAa,UAAa,OAAO,UAAU,aAAa,SAAU,QAAO;AACvF,KAAI,UAAU,UAAU,UAAa,CAAC,MAAM,QAAQ,UAAU,MAAM,CAAE,QAAO;AAE7E,QAAO;;AAGT,SAAgB,gBAAgB,YAAiD;CAC/E,MAAM,QAAQ,WAAW,MAAM,0CAA0C;AACzE,KAAI,CAAC,MAAO,QAAO;AAEnB,QAAO;EACL,KAAK,MAAM;EACX,YAAY,MAAM;EACnB;;AAGH,SAAgB,gBAAgB,UAAuE;CACrG,MAAM,eAAe,SAAS,UAAU;AACxC,QAAO,OAAO,iBAAiB,WAAW,eAAe;;;;;;;AAQ3D,SAAgB,oBAAoB,UAA2D;CAC7F,MAAM,eAAe,SAAS,UAAU;AACxC,KAAI,OAAO,iBAAiB,YAAY,aAAa,WAAW,EAC9D,OAAM,IAAI,MAAM,oEAAoE;AAEtF,QAAO"}
1
+ {"version":3,"file":"attestedResource.mjs","names":[],"sources":["../../src/resources/attestedResource.ts"],"sourcesContent":["import { IsStringOrStringArray } from '@credo-ts/core'\nimport { Transform, Type } from 'class-transformer'\nimport { IsArray, IsNumber, IsObject, IsOptional, IsString, Validate, ValidateNested } from 'class-validator'\nimport type { DIDLog, DIDLogEntry } from 'didwebvh-ts'\n\n/**\n * A single entry in a did:webvh DID log.\n * Structurally identical to `DIDLogEntry` from `didwebvh-ts`; re-exported here\n * as a stable Credo-level contract so consumers do not need to import directly\n * from the upstream library.\n */\nexport type WebVhDidLogEntry = DIDLogEntry\n\n/**\n * An ordered array of `WebVhDidLogEntry` items representing the full history of\n * a did:webvh DID document.\n * Structurally identical to `DIDLog` from `didwebvh-ts`.\n */\nexport type WebVhDidLog = DIDLog\n\nexport type WebVhResourceIdParts = {\n did: string\n resourceId: string\n}\n\nexport class WebVhAttestedResourceProof {\n @IsString()\n public type!: string\n\n @IsString()\n public cryptosuite!: string\n\n @IsString()\n public proofPurpose!: string\n\n @IsString()\n public proofValue!: string\n\n @IsString()\n public verificationMethod!: string\n}\n\nexport class WebVhAttestedResourceLink {\n @IsString()\n public id!: string\n\n @IsString()\n public type!: string\n\n @IsOptional()\n @IsNumber()\n public timestamp?: number\n\n @IsOptional()\n @IsString()\n public digestMultibase?: string\n}\n\nexport class WebVhAttestedResource {\n @IsArray()\n @IsString({ each: true })\n @Type(() => String)\n public '@context'!: string[]\n\n @Validate(IsStringOrStringArray)\n @Transform(({ value }) => (Array.isArray(value) ? value : [value]))\n @Type(() => String)\n public type!: string[]\n\n @IsString()\n public id!: string\n\n @IsObject()\n public content!: unknown\n\n @ValidateNested()\n @Type(() => WebVhAttestedResourceProof)\n public proof!: WebVhAttestedResourceProof\n\n @IsOptional()\n @IsObject()\n public metadata?: Record<string, unknown>\n\n @IsOptional()\n @IsArray()\n @ValidateNested({ each: true })\n @Type(() => WebVhAttestedResourceLink)\n public links?: WebVhAttestedResourceLink[]\n}\n\nexport interface WebVhResourcePublisher<TResource = unknown, TOptions = unknown> {\n publish(options: TOptions): Promise<TResource>\n}\n\nexport interface WebVhResourceResolver<TResource = unknown> {\n resolve(resourceId: string): Promise<TResource>\n}\n\nexport function isWebVhAttestedResource(value: unknown): value is WebVhAttestedResource {\n if (!value || typeof value !== 'object') return false\n\n const candidate = value as {\n type?: unknown\n id?: unknown\n content?: unknown\n proof?: unknown\n metadata?: unknown\n links?: unknown\n }\n\n if (!Array.isArray(candidate.type) || !candidate.type.includes('AttestedResource')) return false\n if (typeof candidate.id !== 'string') return false\n if (!candidate.content || typeof candidate.content !== 'object') return false\n if (!candidate.proof || typeof candidate.proof !== 'object') return false\n if (candidate.metadata !== undefined && typeof candidate.metadata !== 'object') return false\n if (candidate.links !== undefined && !Array.isArray(candidate.links)) return false\n\n return true\n}\n\nexport function parseResourceId(resourceId: string): WebVhResourceIdParts | null {\n const match = resourceId.match(/^(did:webvh:[^/]+)\\/resources\\/([^/]+)$/)\n if (!match) return null\n\n return {\n did: match[1],\n resourceId: match[2],\n }\n}\n\nexport function getResourceType(resource: Pick<WebVhAttestedResource, 'metadata'>): string | undefined {\n const resourceType = resource.metadata?.resourceType\n return typeof resourceType === 'string' ? resourceType : undefined\n}\n\n/**\n * Returns the `metadata.resourceType` string from a webvh attested resource.\n * Throws if the field is absent or empty, ensuring callers receive a non-optional\n * string suitable for deterministic indexing, policy routing, or typed dispatch.\n */\nexport function requireResourceType(resource: Pick<WebVhAttestedResource, 'metadata'>): string {\n const resourceType = resource.metadata?.resourceType\n if (typeof resourceType !== 'string' || resourceType.length === 0) {\n throw new Error('WebVh attested resource is missing required metadata.resourceType')\n }\n return resourceType\n}\n"],"mappings":";;;;;;AAyBA,IAAa,6BAAb,MAAwC,CAexC;AAdG,WAAA,CAAA,SAAS,GAAA,mBAAA,eAAA,MAAA,CAAA,GAAA,2BAAA,WAAA,QAAA,KAAA,CAAA;AAGT,WAAA,CAAA,SAAS,GAAA,mBAAA,eAAA,MAAA,CAAA,GAAA,2BAAA,WAAA,eAAA,KAAA,CAAA;AAGT,WAAA,CAAA,SAAS,GAAA,mBAAA,eAAA,MAAA,CAAA,GAAA,2BAAA,WAAA,gBAAA,KAAA,CAAA;AAGT,WAAA,CAAA,SAAS,GAAA,mBAAA,eAAA,MAAA,CAAA,GAAA,2BAAA,WAAA,c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AAC,UAAU,WAAW,OAAO,UAAU,YAAY,UAAU,OAAO;CACxE,IAAI,CAAC,UAAU,SAAS,OAAO,UAAU,UAAU,UAAU,OAAO;CACpE,IAAI,UAAU,aAAa,KAAA,KAAa,OAAO,UAAU,aAAa,UAAU,OAAO;CACvF,IAAI,UAAU,UAAU,KAAA,KAAa,CAAC,MAAM,QAAQ,UAAU,KAAK,GAAG,OAAO;CAE7E,OAAO;AACT;AAEA,SAAgB,gBAAgB,YAAiD;CAC/E,MAAM,QAAQ,WAAW,MAAM,yCAAyC;CACxE,IAAI,CAAC,OAAO,OAAO;CAEnB,OAAO;EACL,KAAK,MAAM;EACX,YAAY,MAAM;CACpB;AACF;AAEA,SAAgB,gBAAgB,UAAuE;CACrG,MAAM,eAAe,SAAS,UAAU;CACxC,OAAO,OAAO,iBAAiB,WAAW,eAAe,KAAA;AAC3D;;;;;;AAOA,SAAgB,oBAAoB,UAA2D;CAC7F,MAAM,eAAe,SAAS,UAAU;CACxC,IAAI,OAAO,iBAAiB,YAAY,aAAa,WAAW,GAC9D,MAAM,IAAI,MAAM,mEAAmE;CAErF,OAAO;AACT"}
@@ -1 +1,2 @@
1
- import { WebVhAttestedResource, WebVhAttestedResourceLink, WebVhAttestedResourceProof, WebVhDidLog, WebVhDidLogEntry, WebVhResourceIdParts, WebVhResourcePublisher, WebVhResourceResolver, getResourceType, isWebVhAttestedResource, parseResourceId, requireResourceType } from "./attestedResource.mjs";
1
+ import { WebVhAttestedResource, WebVhAttestedResourceLink, WebVhAttestedResourceProof, WebVhDidLog, WebVhDidLogEntry, WebVhResourceIdParts, WebVhResourcePublisher, WebVhResourceResolver, getResourceType, isWebVhAttestedResource, parseResourceId, requireResourceType } from "./attestedResource.mjs";
2
+ export { WebVhAttestedResource, WebVhAttestedResourceLink, WebVhAttestedResourceProof, WebVhDidLog, WebVhDidLogEntry, WebVhResourceIdParts, WebVhResourcePublisher, WebVhResourceResolver, getResourceType, isWebVhAttestedResource, parseResourceId, requireResourceType };
@@ -1 +1,2 @@
1
1
  import { WebVhAttestedResource, WebVhAttestedResourceLink, WebVhAttestedResourceProof, getResourceType, isWebVhAttestedResource, parseResourceId, requireResourceType } from "./attestedResource.mjs";
2
+ export { WebVhAttestedResource, WebVhAttestedResourceLink, WebVhAttestedResourceProof, getResourceType, isWebVhAttestedResource, parseResourceId, requireResourceType };
package/package.json CHANGED
@@ -19,7 +19,7 @@
19
19
  "types": "./build/resources/index.d.mts"
20
20
  }
21
21
  },
22
- "version": "0.7.2-pr-2704-20260918194459",
22
+ "version": "0.7.2",
23
23
  "description": "Credo WebVH DID method implementation",
24
24
  "files": [
25
25
  "build"
@@ -39,8 +39,8 @@
39
39
  "didwebvh-ts": "^2.8.0",
40
40
  "json-canonicalize": "^3.0.0",
41
41
  "tsyringe": "^4.10.0",
42
- "@credo-ts/anoncreds": "0.7.2-pr-2704-20260918194459",
43
- "@credo-ts/core": "0.7.2-pr-2704-20260918194459"
42
+ "@credo-ts/anoncreds": "0.7.2",
43
+ "@credo-ts/core": "0.7.2"
44
44
  },
45
45
  "devDependencies": {
46
46
  "typescript": "~5.9.3"