const isEbsiDid = (did: string): boolean => { if (!did) return false; if (did.match(/^did:ebsi:/g)) { return true; } return false; }; const isKeyDid = (did: string): boolean => { if (!did) return false; if (did.match(/^did:key:/g)) { return true; } return false; }; const isWebDid = (did: string): boolean => { if (!did) return false; if (did.match(/^did:web:/g)) { return true; } return false; }; function areEqualObjects(object1: any, object2: any): boolean { // Check if both objects are arrays if (Array.isArray(object1) && Array.isArray(object2)) { // If they are arrays, compare their lengths if (object1.length !== object2.length) { return false; } // Compare each element in the arrays for (let i = 0; i < object1.length; i++) { if (!areEqualObjects(object1[i], object2[i])) { return false; } } return true; } // If one of the objects is an array and the other is not, they are not equal if (Array.isArray(object1) || Array.isArray(object2)) { return false; } // If both objects are not arrays, proceed with the original comparison logic const keys1 = Object.keys(object1); const keys2 = Object.keys(object2); if (keys1.length !== keys2.length) { return false; } for (const key of keys1) { const value1 = object1[key]; const value2 = object2[key]; if (typeof value1 === 'object' && typeof value2 === 'object') { // If both values are objects, recursively check their equality if (!areEqualObjects(value1, value2)) { return false; } } else if (value1 !== value2) { // If values are not objects, directly compare them return false; } } return true; } export { isWebDid, isEbsiDid, isKeyDid, areEqualObjects };