@credo-ts/core 0.7.1 → 0.7.2-alpha-20260918180656

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.
@@ -33,6 +33,12 @@ declare class SignatureSuiteRegistry {
33
33
  getByVerificationMethodType(verificationMethodType: string): SuiteInfo | undefined;
34
34
  getAllByPublicJwkType(publicJwkType: SupportedPublicJwkClass | PublicJwk): SuiteInfo[];
35
35
  getByProofType(proofType: string): SuiteInfo;
36
+ /**
37
+ * Returns the `@context` url that the signature suite for the given proof type adds to documents
38
+ * it signs (see `LinkedDataSignature.ensureSuiteContext`), or undefined if the proof type is not
39
+ * registered or its suite does not declare a context url.
40
+ */
41
+ findContextUrlByProofType(proofType: string): string | undefined;
36
42
  getVerificationMethodTypesByProofType(proofType: string): string[];
37
43
  }
38
44
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"SignatureSuiteRegistry.d.mts","names":[],"sources":["../../../../src/modules/vc/linked-data-proofs/SignatureSuiteRegistry.ts"],"mappings":";;;cAMM,mBAAA;;;;AAJ2E;cAUpE,mBAAA;AAAA,UAEI,SAAA;EACf,UAAA,SAAmB,mBAAA;EACnB,SAAA;EACA,uBAAA;EACA,uBAAA,EAAyB,uBAAA;AAAA;AAAA,cAId,sBAAA;EAAA,QACH,YAAA;cAEW,MAAA,GAAQ,SAAA;EAXH;;;;EAmBjB,aAAA,CAAc,SAAA,EAAW,SAAA;EAjBhC;;;;EAyBO,cAAA,CAAe,MAAA,EAAQ,SAAA;EAAA,IAMnB,mBAAA,CAAA;EAzBA;;;EAgCJ,2BAAA,CAA4B,sBAAA,WAA8B,SAAA;EAI1D,qBAAA,CAAsB,aAAA,EAAe,uBAAA,GAA0B,SAAA,GAAS,SAAA;EAKxE,cAAA,CAAe,SAAA,WAAiB,SAAA;EAUhC,qCAAA,CAAsC,SAAA;AAAA"}
1
+ {"version":3,"file":"SignatureSuiteRegistry.d.mts","names":[],"sources":["../../../../src/modules/vc/linked-data-proofs/SignatureSuiteRegistry.ts"],"mappings":";;;cAMM,mBAAA;;;;AAJ2E;cAUpE,mBAAA;AAAA,UAEI,SAAA;EACf,UAAA,SAAmB,mBAAA;EACnB,SAAA;EACA,uBAAA;EACA,uBAAA,EAAyB,uBAAA;AAAA;AAAA,cAId,sBAAA;EAAA,QACH,YAAA;cAEW,MAAA,GAAQ,SAAA;EAXH;;;;EAmBjB,aAAA,CAAc,SAAA,EAAW,SAAA;EAjBhC;;;;EAyBO,cAAA,CAAe,MAAA,EAAQ,SAAA;EAAA,IAMnB,mBAAA,CAAA;EAzBA;;;EAgCJ,2BAAA,CAA4B,sBAAA,WAA8B,SAAA;EAI1D,qBAAA,CAAsB,aAAA,EAAe,uBAAA,GAA0B,SAAA,GAAS,SAAA;EAKxE,cAAA,CAAe,SAAA,WAAiB,SAAA;EAT0B;;;;;EAwB1D,yBAAA,CAA0B,SAAA;EAQ1B,qCAAA,CAAsC,SAAA;AAAA"}
@@ -51,6 +51,15 @@ let SignatureSuiteRegistry = class SignatureSuiteRegistry {
51
51
  if (!suiteInfo) throw new CredoError(`No signature suite for proof type: ${proofType}`);
52
52
  return suiteInfo;
53
53
  }
54
+ /**
55
+ * Returns the `@context` url that the signature suite for the given proof type adds to documents
56
+ * it signs (see `LinkedDataSignature.ensureSuiteContext`), or undefined if the proof type is not
57
+ * registered or its suite does not declare a context url.
58
+ */
59
+ findContextUrlByProofType(proofType) {
60
+ const suiteClass = this.suiteMapping.find((x) => x.proofType === proofType)?.suiteClass;
61
+ return typeof suiteClass?.CONTEXT_URL === "string" ? suiteClass.CONTEXT_URL : void 0;
62
+ }
54
63
  getVerificationMethodTypesByProofType(proofType) {
55
64
  const suiteInfo = this.suiteMapping.find((suiteInfo) => suiteInfo.proofType === proofType);
56
65
  if (!suiteInfo) throw new CredoError(`No verification method type found for proof type: ${proofType}`);
@@ -1 +1 @@
1
- {"version":3,"file":"SignatureSuiteRegistry.mjs","names":[],"sources":["../../../../src/modules/vc/linked-data-proofs/SignatureSuiteRegistry.ts"],"sourcesContent":["import { CredoError } from '../../../error'\nimport { injectable } from '../../../plugins'\nimport { PublicJwk, type SupportedPublicJwkClass } from '../../kms/jwk/PublicJwk'\n\nimport { suites } from './adapters/jsonld-signatures-adapter'\n\nconst LinkedDataSignature = suites.LinkedDataSignature\n\n/**\n * @deprecated Registration token retained for backward compatibility.\n * Will be removed in 0.8.\n */\nexport const SignatureSuiteToken = Symbol('SignatureSuiteToken')\n\nexport interface SuiteInfo {\n suiteClass: typeof LinkedDataSignature\n proofType: string\n verificationMethodTypes: string[]\n supportedPublicJwkTypes: SupportedPublicJwkClass[]\n}\n\n@injectable()\nexport class SignatureSuiteRegistry {\n private suiteMapping: SuiteInfo[]\n\n public constructor(suites: SuiteInfo[] = []) {\n this.suiteMapping = [...suites]\n }\n\n /**\n * @deprecated Pass suites to the constructor instead.\n * Will be removed in 0.8.\n */\n public registerSuite(suiteInfo: SuiteInfo) {\n this.suiteMapping.push(suiteInfo)\n }\n\n /**\n * @deprecated Pass suites to the constructor instead.\n * Will be removed in 0.8.\n */\n public registerSuites(suites: SuiteInfo[]) {\n for (const suite of suites) {\n this.registerSuite(suite)\n }\n }\n\n public get supportedProofTypes(): string[] {\n return this.suiteMapping.map((x) => x.proofType)\n }\n\n /**\n * @deprecated recommended to always search by key type instead as that will have broader support\n */\n public getByVerificationMethodType(verificationMethodType: string) {\n return this.suiteMapping.find((x) => x.verificationMethodTypes.includes(verificationMethodType))\n }\n\n public getAllByPublicJwkType(publicJwkType: SupportedPublicJwkClass | PublicJwk) {\n const publicJwkClass = publicJwkType instanceof PublicJwk ? publicJwkType.JwkClass : publicJwkType\n return this.suiteMapping.filter((x) => x.supportedPublicJwkTypes.includes(publicJwkClass))\n }\n\n public getByProofType(proofType: string) {\n const suiteInfo = this.suiteMapping.find((x) => x.proofType === proofType)\n\n if (!suiteInfo) {\n throw new CredoError(`No signature suite for proof type: ${proofType}`)\n }\n\n return suiteInfo\n }\n\n public getVerificationMethodTypesByProofType(proofType: string): string[] {\n const suiteInfo = this.suiteMapping.find((suiteInfo) => suiteInfo.proofType === proofType)\n\n if (!suiteInfo) {\n throw new CredoError(`No verification method type found for proof type: ${proofType}`)\n }\n\n return suiteInfo.verificationMethodTypes\n }\n}\n"],"mappings":";;;;;;;;;;;AAM4B,OAAO;;;;;AAMnC,MAAa,sBAAsB,OAAO,sBAAsB;AAUzD,mCAAM,uBAAuB;CAGlC,AAAO,YAAY,SAAsB,EAAE,EAAE;AAC3C,OAAK,eAAe,CAAC,GAAG,OAAO;;;;;;CAOjC,AAAO,cAAc,WAAsB;AACzC,OAAK,aAAa,KAAK,UAAU;;;;;;CAOnC,AAAO,eAAe,QAAqB;AACzC,OAAK,MAAM,SAAS,OAClB,MAAK,cAAc,MAAM;;CAI7B,IAAW,sBAAgC;AACzC,SAAO,KAAK,aAAa,KAAK,MAAM,EAAE,UAAU;;;;;CAMlD,AAAO,4BAA4B,wBAAgC;AACjE,SAAO,KAAK,aAAa,MAAM,MAAM,EAAE,wBAAwB,SAAS,uBAAuB,CAAC;;CAGlG,AAAO,sBAAsB,eAAoD;EAC/E,MAAM,iBAAiB,yBAAyB,YAAY,cAAc,WAAW;AACrF,SAAO,KAAK,aAAa,QAAQ,MAAM,EAAE,wBAAwB,SAAS,eAAe,CAAC;;CAG5F,AAAO,eAAe,WAAmB;EACvC,MAAM,YAAY,KAAK,aAAa,MAAM,MAAM,EAAE,cAAc,UAAU;AAE1E,MAAI,CAAC,UACH,OAAM,IAAI,WAAW,sCAAsC,YAAY;AAGzE,SAAO;;CAGT,AAAO,sCAAsC,WAA6B;EACxE,MAAM,YAAY,KAAK,aAAa,MAAM,cAAc,UAAU,cAAc,UAAU;AAE1F,MAAI,CAAC,UACH,OAAM,IAAI,WAAW,qDAAqD,YAAY;AAGxF,SAAO,UAAU;;;qCA3DpB,YAAY"}
1
+ {"version":3,"file":"SignatureSuiteRegistry.mjs","names":[],"sources":["../../../../src/modules/vc/linked-data-proofs/SignatureSuiteRegistry.ts"],"sourcesContent":["import { CredoError } from '../../../error'\nimport { injectable } from '../../../plugins'\nimport { PublicJwk, type SupportedPublicJwkClass } from '../../kms/jwk/PublicJwk'\n\nimport { suites } from './adapters/jsonld-signatures-adapter'\n\nconst LinkedDataSignature = suites.LinkedDataSignature\n\n/**\n * @deprecated Registration token retained for backward compatibility.\n * Will be removed in 0.8.\n */\nexport const SignatureSuiteToken = Symbol('SignatureSuiteToken')\n\nexport interface SuiteInfo {\n suiteClass: typeof LinkedDataSignature\n proofType: string\n verificationMethodTypes: string[]\n supportedPublicJwkTypes: SupportedPublicJwkClass[]\n}\n\n@injectable()\nexport class SignatureSuiteRegistry {\n private suiteMapping: SuiteInfo[]\n\n public constructor(suites: SuiteInfo[] = []) {\n this.suiteMapping = [...suites]\n }\n\n /**\n * @deprecated Pass suites to the constructor instead.\n * Will be removed in 0.8.\n */\n public registerSuite(suiteInfo: SuiteInfo) {\n this.suiteMapping.push(suiteInfo)\n }\n\n /**\n * @deprecated Pass suites to the constructor instead.\n * Will be removed in 0.8.\n */\n public registerSuites(suites: SuiteInfo[]) {\n for (const suite of suites) {\n this.registerSuite(suite)\n }\n }\n\n public get supportedProofTypes(): string[] {\n return this.suiteMapping.map((x) => x.proofType)\n }\n\n /**\n * @deprecated recommended to always search by key type instead as that will have broader support\n */\n public getByVerificationMethodType(verificationMethodType: string) {\n return this.suiteMapping.find((x) => x.verificationMethodTypes.includes(verificationMethodType))\n }\n\n public getAllByPublicJwkType(publicJwkType: SupportedPublicJwkClass | PublicJwk) {\n const publicJwkClass = publicJwkType instanceof PublicJwk ? publicJwkType.JwkClass : publicJwkType\n return this.suiteMapping.filter((x) => x.supportedPublicJwkTypes.includes(publicJwkClass))\n }\n\n public getByProofType(proofType: string) {\n const suiteInfo = this.suiteMapping.find((x) => x.proofType === proofType)\n\n if (!suiteInfo) {\n throw new CredoError(`No signature suite for proof type: ${proofType}`)\n }\n\n return suiteInfo\n }\n\n /**\n * Returns the `@context` url that the signature suite for the given proof type adds to documents\n * it signs (see `LinkedDataSignature.ensureSuiteContext`), or undefined if the proof type is not\n * registered or its suite does not declare a context url.\n */\n public findContextUrlByProofType(proofType: string): string | undefined {\n const suiteClass = this.suiteMapping.find((x) => x.proofType === proofType)?.suiteClass as\n | { CONTEXT_URL?: unknown }\n | undefined\n\n return typeof suiteClass?.CONTEXT_URL === 'string' ? suiteClass.CONTEXT_URL : undefined\n }\n\n public getVerificationMethodTypesByProofType(proofType: string): string[] {\n const suiteInfo = this.suiteMapping.find((suiteInfo) => suiteInfo.proofType === proofType)\n\n if (!suiteInfo) {\n throw new CredoError(`No verification method type found for proof type: ${proofType}`)\n }\n\n return suiteInfo.verificationMethodTypes\n }\n}\n"],"mappings":";;;;;;;;;;;AAM4B,OAAO;;;;;AAMnC,MAAa,sBAAsB,OAAO,sBAAsB;AAUzD,mCAAM,uBAAuB;CAGlC,AAAO,YAAY,SAAsB,EAAE,EAAE;AAC3C,OAAK,eAAe,CAAC,GAAG,OAAO;;;;;;CAOjC,AAAO,cAAc,WAAsB;AACzC,OAAK,aAAa,KAAK,UAAU;;;;;;CAOnC,AAAO,eAAe,QAAqB;AACzC,OAAK,MAAM,SAAS,OAClB,MAAK,cAAc,MAAM;;CAI7B,IAAW,sBAAgC;AACzC,SAAO,KAAK,aAAa,KAAK,MAAM,EAAE,UAAU;;;;;CAMlD,AAAO,4BAA4B,wBAAgC;AACjE,SAAO,KAAK,aAAa,MAAM,MAAM,EAAE,wBAAwB,SAAS,uBAAuB,CAAC;;CAGlG,AAAO,sBAAsB,eAAoD;EAC/E,MAAM,iBAAiB,yBAAyB,YAAY,cAAc,WAAW;AACrF,SAAO,KAAK,aAAa,QAAQ,MAAM,EAAE,wBAAwB,SAAS,eAAe,CAAC;;CAG5F,AAAO,eAAe,WAAmB;EACvC,MAAM,YAAY,KAAK,aAAa,MAAM,MAAM,EAAE,cAAc,UAAU;AAE1E,MAAI,CAAC,UACH,OAAM,IAAI,WAAW,sCAAsC,YAAY;AAGzE,SAAO;;;;;;;CAQT,AAAO,0BAA0B,WAAuC;EACtE,MAAM,aAAa,KAAK,aAAa,MAAM,MAAM,EAAE,cAAc,UAAU,EAAE;AAI7E,SAAO,OAAO,YAAY,gBAAgB,WAAW,WAAW,cAAc;;CAGhF,AAAO,sCAAsC,WAA6B;EACxE,MAAM,YAAY,KAAK,aAAa,MAAM,cAAc,UAAU,cAAc,UAAU;AAE1F,MAAI,CAAC,UACH,OAAM,IAAI,WAAW,qDAAqD,YAAY;AAGxF,SAAO,UAAU;;;qCAxEpB,YAAY"}
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "types": "./build/modules/kms/index.d.mts"
10
10
  }
11
11
  },
12
- "version": "0.7.1",
12
+ "version": "0.7.2-alpha-20260918180656",
13
13
  "files": [
14
14
  "build"
15
15
  ],