Yes, npm does perform integrity checks, but there are important nuances.
Integrity Verification (SHA-512):
Starting from npm v5 (2017), every package published to the npm registry includes a SHA-512 integrity hash in its metadata. When you install a package, npm compares the downloaded tarball against this hash to ensure it hasn’t been modified. This provides tamper-detection beyond simple HTTPS transport.
Authentication of Publishers:
npm does not, by default, cryptographically verify the identity of the package author in the way that OS package managers often do. Instead, it relies on the npm registry’s authentication system. Package maintainers authenticate when publishing, and npm attaches the integrity hash. However, the trust model is weaker compared to Debian’s GPG signatures.
Additional Security Features:
npm audit checks for known vulnerabilities but doesn’t validate integrity beyond the hash.
Two-factor authentication (2FA) for package publishing adds some protection against account compromise, but again, this is at the publisher account level, not cryptographic signing of packages.
Projects like Sigstore and OpenSSF are exploring stronger solutions for package signing across ecosystems, but they’re not fully standard in npm yet.
Bottom Line:
Integrity of the downloaded package is verified against a cryptographic hash (so tampering in transit or registry compromise would be detected).
However, cryptographic proof of origin (like GPG signatures in apt/yum) is not part of npm’s default security model.
If you need that level of assurance, you would have to layer additional verification mechanisms yourself.