MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / getComposeHash

Function getComposeHash

sdk/js/src/get-compose-hash.browser.ts:46–55  ·  view source on GitHub ↗
(compose: Record<string, any>)

Source from the content-addressed store, hash-verified

44 * @returns Promise resolving to hex-encoded hash
45 */
46export async function getComposeHash(compose: Record<string, any>): Promise<string> {
47 // Sort the object keys to ensure deterministic hashing
48 const sortedCompose = sortObjectKeys(compose);
49
50 // Convert to JSON string with no extra whitespace
51 const jsonString = JSON.stringify(sortedCompose);
52
53 // Return SHA-256 hash
54 return sha256Hash(jsonString);
55}

Callers

nothing calls this directly

Calls 2

sortObjectKeysFunction · 0.85
sha256HashFunction · 0.85

Tested by

no test coverage detected