mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-27 19:41:44 -04:00
* refactor: rename workspace.sort-packages and workspace.pkgs-graph - workspace.sort-packages -> workspace.projects-sorter - workspace.pkgs-graph -> workspace.projects-graph Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: rename packages/ to core/ and pkg-manifest.read-package-json to reader - Rename packages/ directory to core/ for clarity - Rename pkg-manifest/read-package-json to pkg-manifest/reader (@pnpm/pkg-manifest.reader) - Update all tsconfig, package.json, and lockfile references Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: consolidate runtime resolvers under engine/runtime domain - Remove unused @pnpm/engine.runtime.node.fetcher package - Rename engine/runtime/node.resolver to node-resolver (dash convention) - Move resolving/bun-resolver to engine/runtime/bun-resolver - Move resolving/deno-resolver to engine/runtime/deno-resolver - Update all package names, tsconfig paths, and lockfile references Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: update lockfile after removing node.fetcher Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: sort tsconfig references and package.json deps alphabetically Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: auto-fix import sorting Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update __typings__ paths in tsconfig.lint.json for moved resolvers Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: remove deno-resolver from deps of bun-resolver --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@pnpm/crypto.integrity
Parse and format integrity strings
Utilities for working with single-hash integrity strings in the format algorithm-base64hash (e.g., sha512-abc123...). This is the format used in pnpm lockfiles.
Installation
pnpm add @pnpm/crypto.integrity
Usage
import { parseIntegrity } from '@pnpm/crypto.integrity'
const { algorithm, hexDigest } = parseIntegrity('sha512-9/u6bgY2+JDlb7vzKD5STG+jIErimDgtYkdB0NxmODJuKCxBvl5CVNiCB3LFUYosWowMf37aGVlKfrU5RT4e1w==')
console.log(algorithm) // 'sha512'
console.log(hexDigest) // 'f7fbba6e0636f890e56fbbf3283e524c6fa3204ae298382d624741d0dc6638326e282c41be5e4254d8820772c5518a2c5a8c0c7f7eda19594a7eb539453e1ed7'
API
parseIntegrity(integrity: string): ParsedIntegrity
Parses an integrity string and returns the algorithm and hex-encoded digest.
Throws PnpmError with code INVALID_INTEGRITY if:
- The format is invalid (must be
algorithm-base64hash) - The base64 hash decodes to an empty digest
formatIntegrity(algorithm: string, hexDigest: string): string
Formats a hex digest into an integrity string.
import { formatIntegrity } from '@pnpm/crypto.integrity'
const integrity = formatIntegrity('sha512', 'f7fbba6e...')
// 'sha512-9/u6bgY2+JDlb7vzKD5STG+...'
License
MIT