(obj: JsonValue)
| 45 | } |
| 46 | |
| 47 | export default function hashObject(obj: JsonValue): string { |
| 48 | // Sort object keys recursively |
| 49 | const sortedObj = sortKeys(obj); |
| 50 | |
| 51 | // Convert to JSON and hash it |
| 52 | const str = JSON.stringify(sortedObj); |
| 53 | const hash = crypto.createHash("sha256"); |
| 54 | hash.update(str); |
| 55 | return hash.digest("hex"); |
| 56 | } |
no test coverage detected