MCPcopy Index your code
hub / github.com/devcontainers/cli / devcontainerIdForLabels

Function devcontainerIdForLabels

src/spec-common/variableSubstitution.ts:161–171  ·  view source on GitHub ↗
(idLabels: Record<string, string>)

Source from the content-addressed store, hash-verified

159}
160
161function devcontainerIdForLabels(idLabels: Record<string, string>): string {
162 const stringInput = JSON.stringify(idLabels, Object.keys(idLabels).sort()); // sort properties
163 const bufferInput = Buffer.from(stringInput, 'utf-8');
164 const hash = crypto.createHash('sha256')
165 .update(bufferInput)
166 .digest();
167 const uniqueId = BigInt(`0x${hash.toString('hex')}`)
168 .toString(32)
169 .padStart(52, '0');
170 return uniqueId;
171}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected