@sphereon/ssi-sdk-ext.identifier-resolution 0.36.1-feature.integration.fides.68 → 0.36.1-feature.integration.fides.74
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 +37 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +37 -3
- package/dist/index.js.map +1 -1
- package/package.json +13 -13
- package/src/functions/managedIdentifierFunctions.ts +56 -8
package/dist/index.cjs
CHANGED
|
@@ -4866,7 +4866,6 @@ async function getManagedDidIdentifier(opts, context) {
|
|
|
4866
4866
|
identifier = opts.identifier;
|
|
4867
4867
|
}
|
|
4868
4868
|
const did = identifier.did;
|
|
4869
|
-
const keys = identifier?.keys;
|
|
4870
4869
|
const extendedKey = await (0, import_ssi_sdk_ext.getFirstKeyWithRelation)({
|
|
4871
4870
|
...opts,
|
|
4872
4871
|
// Make sure we use offline mode if no pref was supplied. We are looking for managed DIDs after all. Could be it is not published yet
|
|
@@ -4875,7 +4874,6 @@ async function getManagedDidIdentifier(opts, context) {
|
|
|
4875
4874
|
vmRelationship: opts.vmRelationship ?? "verificationMethod"
|
|
4876
4875
|
}, context);
|
|
4877
4876
|
const key = extendedKey;
|
|
4878
|
-
const controllerKeyId = identifier.controllerKeyId;
|
|
4879
4877
|
const jwk = (0, import_ssi_sdk_ext2.toJwk)(key.publicKeyHex, key.type, {
|
|
4880
4878
|
key
|
|
4881
4879
|
});
|
|
@@ -4888,6 +4886,42 @@ async function getManagedDidIdentifier(opts, context) {
|
|
|
4888
4886
|
kid = `${did}${hash}${kid}`;
|
|
4889
4887
|
}
|
|
4890
4888
|
const issuer = opts.issuer ?? did;
|
|
4889
|
+
let filteredKeys = identifier?.keys ?? [];
|
|
4890
|
+
if (opts.kmsKeyRef) {
|
|
4891
|
+
const keysByKmsKeyRef = filteredKeys.filter((k) => k.kid === opts.kmsKeyRef);
|
|
4892
|
+
if (keysByKmsKeyRef.length > 0) {
|
|
4893
|
+
filteredKeys = keysByKmsKeyRef;
|
|
4894
|
+
}
|
|
4895
|
+
}
|
|
4896
|
+
if (filteredKeys.length === identifier?.keys?.length && opts.vmRelationship) {
|
|
4897
|
+
const keysByVmRelationship = filteredKeys.filter((k) => {
|
|
4898
|
+
const purposes = k.meta?.purposes;
|
|
4899
|
+
if (!purposes || purposes.length === 0) {
|
|
4900
|
+
return opts.vmRelationship === "verificationMethod";
|
|
4901
|
+
}
|
|
4902
|
+
return purposes.includes(opts.vmRelationship);
|
|
4903
|
+
});
|
|
4904
|
+
if (keysByVmRelationship.length > 0) {
|
|
4905
|
+
filteredKeys = keysByVmRelationship;
|
|
4906
|
+
}
|
|
4907
|
+
}
|
|
4908
|
+
if (filteredKeys.length === identifier?.keys?.length && typeof opts.identifier === "string" && opts.identifier.includes("#")) {
|
|
4909
|
+
const fragment = opts.identifier.split("#")[1];
|
|
4910
|
+
const keysByFragment = filteredKeys.filter((k) => {
|
|
4911
|
+
const vmId = k.meta?.verificationMethod?.id;
|
|
4912
|
+
return vmId === `${did}#${fragment}` || vmId === fragment || k.kid === fragment;
|
|
4913
|
+
});
|
|
4914
|
+
if (keysByFragment.length > 0) {
|
|
4915
|
+
filteredKeys = keysByFragment;
|
|
4916
|
+
}
|
|
4917
|
+
}
|
|
4918
|
+
const keys = filteredKeys;
|
|
4919
|
+
const controllerKeyId = key.kid;
|
|
4920
|
+
const filteredIdentifier = {
|
|
4921
|
+
...identifier,
|
|
4922
|
+
keys: filteredKeys,
|
|
4923
|
+
controllerKeyId
|
|
4924
|
+
};
|
|
4891
4925
|
return {
|
|
4892
4926
|
method,
|
|
4893
4927
|
key,
|
|
@@ -4899,7 +4933,7 @@ async function getManagedDidIdentifier(opts, context) {
|
|
|
4899
4933
|
kid,
|
|
4900
4934
|
keys,
|
|
4901
4935
|
issuer,
|
|
4902
|
-
identifier,
|
|
4936
|
+
identifier: filteredIdentifier,
|
|
4903
4937
|
clientId: opts.clientId,
|
|
4904
4938
|
clientIdScheme: opts.clientIdScheme,
|
|
4905
4939
|
opts
|