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

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.cjs CHANGED
@@ -4880,20 +4880,22 @@ async function getManagedDidIdentifier(opts, context) {
4880
4880
  const jwkThumbprint = key.meta?.jwkThumbprint ?? (0, import_ssi_sdk_ext2.calculateJwkThumbprint)({
4881
4881
  jwk
4882
4882
  });
4883
- let kid = opts.kid ?? extendedKey.meta?.verificationMethod?.id;
4884
- if (!kid.startsWith(did)) {
4883
+ let kid = opts.kid ?? extendedKey.meta?.verificationMethod?.id ?? extendedKey.kid;
4884
+ if (kid && !kid.startsWith(did)) {
4885
4885
  const hash = kid.startsWith("#") ? "" : "#";
4886
4886
  kid = `${did}${hash}${kid}`;
4887
4887
  }
4888
4888
  const issuer = opts.issuer ?? did;
4889
4889
  let filteredKeys = identifier?.keys ?? [];
4890
+ let isFiltered = false;
4890
4891
  if (opts.kmsKeyRef) {
4891
4892
  const keysByKmsKeyRef = filteredKeys.filter((k) => k.kid === opts.kmsKeyRef);
4892
4893
  if (keysByKmsKeyRef.length > 0) {
4893
4894
  filteredKeys = keysByKmsKeyRef;
4895
+ isFiltered = true;
4894
4896
  }
4895
4897
  }
4896
- if (filteredKeys.length === identifier?.keys?.length && opts.vmRelationship) {
4898
+ if (!isFiltered && opts.vmRelationship) {
4897
4899
  const keysByVmRelationship = filteredKeys.filter((k) => {
4898
4900
  const purposes = k.meta?.purposes;
4899
4901
  if (!purposes || purposes.length === 0) {
@@ -4903,9 +4905,10 @@ async function getManagedDidIdentifier(opts, context) {
4903
4905
  });
4904
4906
  if (keysByVmRelationship.length > 0) {
4905
4907
  filteredKeys = keysByVmRelationship;
4908
+ isFiltered = true;
4906
4909
  }
4907
4910
  }
4908
- if (filteredKeys.length === identifier?.keys?.length && typeof opts.identifier === "string" && opts.identifier.includes("#")) {
4911
+ if (!isFiltered && typeof opts.identifier === "string" && opts.identifier.includes("#")) {
4909
4912
  const fragment = opts.identifier.split("#")[1];
4910
4913
  const keysByFragment = filteredKeys.filter((k) => {
4911
4914
  const vmId = k.meta?.verificationMethod?.id;
@@ -5053,10 +5056,10 @@ async function getManagedOID4VCIssuerIdentifier(opts, context) {
5053
5056
  }
5054
5057
  __name(getManagedOID4VCIssuerIdentifier, "getManagedOID4VCIssuerIdentifier");
5055
5058
  async function getManagedIdentifier(opts, context) {
5056
- let resolutionResult;
5057
5059
  if (isManagedIdentifierResult(opts)) {
5058
- opts;
5060
+ return opts;
5059
5061
  }
5062
+ let resolutionResult;
5060
5063
  if (isManagedIdentifierKidOpts(opts)) {
5061
5064
  resolutionResult = await getManagedKidIdentifier(opts, context);
5062
5065
  } else if (isManagedIdentifierDidOpts(opts)) {