MCPcopy Create free account
hub / github.com/cypress-io/cypress / getIntegrityCheckSource

Function getIntegrityCheckSource

scripts/binary/binary-sources.js:42–54  ·  view source on GitHub ↗
(baseDirectory)

Source from the content-addressed store, hash-verified

40}
41
42const getIntegrityCheckSource = (baseDirectory) => {
43 const fileSource = read('binary-integrity-check-source.js')
44
45 const mainIndexHash = crypto.createHmac('md5', secret).update(fs.readFileSync(path.join(baseDirectory, './index.js'), 'utf8')).digest('hex')
46
47 return fileSource.split('\n').join(`\n `)
48 .replaceAll('MAIN_INDEX_HASH', mainIndexHash)
49 .replaceAll('INDEX_JSC_HASH', DUMMY_INDEX_JSC_HASH)
50 .replaceAll('HMAC_SECRET', secret)
51 .replaceAll('CRYPTO_CREATE_HMAC_TO_STRING', escapeString(crypto.createHmac.toString()))
52 .replaceAll('CRYPTO_HMAC_UPDATE_TO_STRING', escapeString(crypto.Hmac.prototype.update.toString()))
53 .replaceAll('CRYPTO_HMAC_DIGEST_TO_STRING', escapeString(crypto.Hmac.prototype.digest.toString()))
54}
55
56const getIndexJscHash = (baseDirectory) => {
57 return crypto.createHmac('md5', secret).update(fs.readFileSync(path.join(baseDirectory, './packages/server/index.jsc'), 'utf8')).digest('hex')

Callers 1

after-pack-hook.jsFile · 0.85

Calls 4

escapeStringFunction · 0.85
joinMethod · 0.80
readFunction · 0.70
updateMethod · 0.45

Tested by

no test coverage detected