Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async getSha1Integrity (integrity, resolved, manifest) {
// for yarn.lock backwards compatibility
if (!/^sha1-/.test(integrity)) {
const url = normalizeUrl(resolved)
const file = await rp({
url,
encoding: null
})
const integrity = ssri.create({algorithms: ['sha1']}).update(file)
return integrity.digest().toString()
} else {
return integrity
}
}
}