@sphereon/ssi-sdk-ext.identifier-resolution 0.36.1-feature.integration.fides.88 → 0.36.1-next.108

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4794,20 +4794,22 @@ async function getManagedDidIdentifier(opts, context) {
4794
4794
  const jwkThumbprint = key.meta?.jwkThumbprint ?? calculateJwkThumbprint({
4795
4795
  jwk
4796
4796
  });
4797
- let kid = opts.kid ?? extendedKey.meta?.verificationMethod?.id;
4798
- if (!kid.startsWith(did)) {
4797
+ let kid = opts.kid ?? extendedKey.meta?.verificationMethod?.id ?? extendedKey.kid;
4798
+ if (kid && !kid.startsWith(did)) {
4799
4799
  const hash = kid.startsWith("#") ? "" : "#";
4800
4800
  kid = `${did}${hash}${kid}`;
4801
4801
  }
4802
4802
  const issuer = opts.issuer ?? did;
4803
4803
  let filteredKeys = identifier?.keys ?? [];
4804
+ let isFiltered = false;
4804
4805
  if (opts.kmsKeyRef) {
4805
4806
  const keysByKmsKeyRef = filteredKeys.filter((k) => k.kid === opts.kmsKeyRef);
4806
4807
  if (keysByKmsKeyRef.length > 0) {
4807
4808
  filteredKeys = keysByKmsKeyRef;
4809
+ isFiltered = true;
4808
4810
  }
4809
4811
  }
4810
- if (filteredKeys.length === identifier?.keys?.length && opts.vmRelationship) {
4812
+ if (!isFiltered && opts.vmRelationship) {
4811
4813
  const keysByVmRelationship = filteredKeys.filter((k) => {
4812
4814
  const purposes = k.meta?.purposes;
4813
4815
  if (!purposes || purposes.length === 0) {
@@ -4817,9 +4819,10 @@ async function getManagedDidIdentifier(opts, context) {
4817
4819
  });
4818
4820
  if (keysByVmRelationship.length > 0) {
4819
4821
  filteredKeys = keysByVmRelationship;
4822
+ isFiltered = true;
4820
4823
  }
4821
4824
  }
4822
- if (filteredKeys.length === identifier?.keys?.length && typeof opts.identifier === "string" && opts.identifier.includes("#")) {
4825
+ if (!isFiltered && typeof opts.identifier === "string" && opts.identifier.includes("#")) {
4823
4826
  const fragment = opts.identifier.split("#")[1];
4824
4827
  const keysByFragment = filteredKeys.filter((k) => {
4825
4828
  const vmId = k.meta?.verificationMethod?.id;
@@ -4967,10 +4970,10 @@ async function getManagedOID4VCIssuerIdentifier(opts, context) {
4967
4970
  }
4968
4971
  __name(getManagedOID4VCIssuerIdentifier, "getManagedOID4VCIssuerIdentifier");
4969
4972
  async function getManagedIdentifier(opts, context) {
4970
- let resolutionResult;
4971
4973
  if (isManagedIdentifierResult(opts)) {
4972
- opts;
4974
+ return opts;
4973
4975
  }
4976
+ let resolutionResult;
4974
4977
  if (isManagedIdentifierKidOpts(opts)) {
4975
4978
  resolutionResult = await getManagedKidIdentifier(opts, context);
4976
4979
  } else if (isManagedIdentifierDidOpts(opts)) {