/usr/local/lib/node_modules/npm/docs/content/commands
NameSizeModeActions
npm-access.md28880644editdlrm
npm-adduser.md20330644editdlrm
npm-audit.md162520644editdlrm
npm-bugs.md29970644editdlrm
npm-cache.md34500644editdlrm
npm-ci.md97700644editdlrm
npm-completion.md9080644editdlrm
npm-config.md40910644editdlrm
npm-dedupe.md95430644editdlrm
npm-deprecate.md21560644editdlrm
npm-diff.md89850644editdlrm
npm-dist-tag.md51700644editdlrm
npm-docs.md29750644editdlrm
npm-doctor.md50470644editdlrm
npm-edit.md10910644editdlrm
npm-exec.md113570644editdlrm
npm-explain.md27940644editdlrm
npm-explore.md10060644editdlrm
npm-find-dupes.md67910644editdlrm
npm-fund.md36740644editdlrm
npm-get.md4450644editdlrm
npm-help-search.md7550644editdlrm
npm-help.md10030644editdlrm
npm-init.md102130644editdlrm
npm-install-ci-test.md80830644editdlrm
npm-install-test.md115730644editdlrm
npm-install.md293060644editdlrm
npm-link.md123860644editdlrm
npm-ll.md56860644editdlrm
npm-login.md23540644editdlrm
npm-logout.md17490644editdlrm
npm-ls.md71480644editdlrm
npm-org.md19740644editdlrm
npm-outdated.md69780644editdlrm
npm-owner.md30820644editdlrm
npm-pack.md38320644editdlrm
npm-ping.md7690644editdlrm
npm-pkg.md80560644editdlrm
npm-prefix.md12060644editdlrm
npm-profile.md30670644editdlrm
npm-prune.md57370644editdlrm
npm-publish.md80280644editdlrm
npm-query.md69540644editdlrm
npm-rebuild.md49940644editdlrm
npm-repo.md27550644editdlrm
npm-restart.md14440644editdlrm
npm-root.md10960644editdlrm
npm-run.md75380644editdlrm
npm-sbom.md83380644editdlrm
npm-search.md35600644editdlrm
npm-set.md14330644editdlrm
npm-shrinkwrap.md9090644editdlrm
npm-star.md17120644editdlrm
npm-stars.md7430644editdlrm
npm-start.md16320644editdlrm
npm-stop.md13200644editdlrm
npm-team.md40840644editdlrm
npm-test.md12130644editdlrm
npm-token.md49050644editdlrm
npm-trust.md100730644editdlrm
npm-undeprecate.md14060644editdlrm
npm-uninstall.md44470644editdlrm
npm-unpublish.md44910644editdlrm
npm-unstar.md15740644editdlrm
npm-update.md129720644editdlrm
npm-version.md80110644editdlrm
npm-view.md74250644editdlrm
npm-whoami.md8000644editdlrm
npm.md56380644editdlrm
npx.md62870644editdlrm
Edit: /usr/local/lib/node_modules/npm/docs/content/commands/npm-trust.md (10073B)
--- title: npm-trust section: 1 description: Manage trusted publishing relationships between packages and CI/CD providers --- ### Synopsis Note: This command is unaware of workspaces. ### Prerequisites Before using npm trust commands, ensure the following requirements are met: * **npm version**: `npm@11.10.0` or above is required. Use `npm install -g npm@^11.10.0` to update if needed. * **Write permissions on the package**: You must have write access to the package you're configuring. * **2FA enabled on account**: Two-factor authentication must be enabled at the account level. Even if it's not currently enabled, you must enable it to use trust commands. * **Supported authentication methods**: Granular Access Tokens (GAT) with the bypass 2FA option are not supported. Legacy basic auth (username and password) credentials will not work for trust commands or endpoints. * **Package must exist**: The package you're configuring must already exist on the npm registry. ### Description Configure trust relationships between npm packages and CI/CD providers using OpenID Connect (OIDC). This is the command-line equivalent of managing trusted publisher configurations on the npm website. For a comprehensive overview of trusted publishing, see the [npm trusted publishers documentation](https://docs.npmjs.com/trusted-publishers). The `[package]` argument specifies the package name. If omitted, npm will use the name from the `package.json` in the current directory. Each trust relationship has its own set of configuration options and flags based on the OIDC claims provided by that provider. OIDC claims come from the CI/CD provider and include information such as repository name, workflow file, or environment. Since each provider's claims differ, the available flags and configuration keys are not universal—npm matches the claims supported by each provider's OIDC configuration. For specific details on which claims and flags are supported for a given provider, use `npm trust --help`. The required options depend on the CI/CD provider you're configuring. Detailed information about each option is available in the [managing trusted publisher configurations](https://docs.npmjs.com/trusted-publishers#managing-trusted-publisher-configurations) section of the npm documentation. If a provider is repository-based and the option is not provided, npm will use the `repository.url` field from your `package.json`, if available. Currently, the registry only supports one configuration per package. If you attempt to create a new trust relationship when one already exists, it will result in an error. To replace an existing configuration: 1. Use `npm trust list [package]` to view the ID of the existing trusted publisher 2. Use `npm trust revoke --id [package]` to remove the existing configuration 3. Then create your new trust relationship ### Bulk Usage For maintainers managing a large number of packages, you can configure trusted publishing in bulk using bash scripting. Create a loop that iterates through package names and their corresponding configuration details, executing the `npm trust ` command with the `--yes` flag for each package. The first request will require two-factor authentication. During two-factor authentication, you'll see an option on the npm website to skip two-factor authentication for the next 5 minutes. Enabling this option will allow subsequent `npm trust ` commands to proceed without two-factor authentication, streamlining the bulk configuration process. We recommend adding a 2-second sleep between each call to avoid rate limiting. With this approach, you can configure approximately 80 packages within the 5-minute two-factor authentication skip window. ### Configuration ### `npm trust github` Create a trusted relationship between a package and GitHub Actions #### Synopsis ```bash npm trust github [package] --file [--repo|--repository] [--env|--environment] [-y|--yes] ``` #### Flags | Flag | Default | Type | Description | | --- | --- | --- | --- | | `--file` | null | String (required) | Name of workflow file within a repositories .GitHub folder (must end in yaml, yml) | | `--repository`, `--repo` | null | String | Name of the repository in the format owner/repo | | `--environment`, `--env` | null | String | CI environment name | | `--dry-run` | false | Boolean | Indicates that you don't want npm to make any changes and that it should only report what it would have done. This can be passed into any of the commands that modify your local installation, eg, `install`, `update`, `dedupe`, `uninstall`, as well as `pack` and `publish`. Note: This is NOT honored by other network related commands, eg `dist-tags`, `owner`, etc. | | `--json` | false | Boolean | Whether or not to output JSON data, rather than the normal output. * In `npm pkg set` it enables parsing set values with JSON.parse() before saving them to your `package.json`. Not supported by all npm commands. | | `--registry` | "https://registry.npmjs.org/" | URL | The base URL of the npm registry. | | `--yes`, `-y` | null | null or Boolean | Automatically answer "yes" to any prompts that npm might print on the command line. | ### `npm trust gitlab` Create a trusted relationship between a package and GitLab CI/CD #### Synopsis ```bash npm trust gitlab [package] --file [--project|--repo|--repository] [--env|--environment] [-y|--yes] ``` #### Flags | Flag | Default | Type | Description | | --- | --- | --- | --- | | `--file` | null | String (required) | Name of pipeline file (e.g., .gitlab-ci.yml) | | `--project` | null | String | Name of the project in the format group/project or group/subgroup/project | | `--environment`, `--env` | null | String | CI environment name | | `--dry-run` | false | Boolean | Indicates that you don't want npm to make any changes and that it should only report what it would have done. This can be passed into any of the commands that modify your local installation, eg, `install`, `update`, `dedupe`, `uninstall`, as well as `pack` and `publish`. Note: This is NOT honored by other network related commands, eg `dist-tags`, `owner`, etc. | | `--json` | false | Boolean | Whether or not to output JSON data, rather than the normal output. * In `npm pkg set` it enables parsing set values with JSON.parse() before saving them to your `package.json`. Not supported by all npm commands. | | `--registry` | "https://registry.npmjs.org/" | URL | The base URL of the npm registry. | | `--yes`, `-y` | null | null or Boolean | Automatically answer "yes" to any prompts that npm might print on the command line. | ### `npm trust circleci` Create a trusted relationship between a package and CircleCI #### Synopsis ```bash npm trust circleci [package] --org-id --project-id --pipeline-definition-id --vcs-origin [--context-id ...] [-y|--yes] ``` #### Flags | Flag | Default | Type | Description | | --- | --- | --- | --- | | `--org-id` | null | String (required) | CircleCI organization UUID | | `--project-id` | null | String (required) | CircleCI project UUID | | `--pipeline-definition-id` | null | String (required) | CircleCI pipeline definition UUID | | `--vcs-origin` | null | String (required) | CircleCI repository origin in format 'provider/owner/repo' | | `--context-id` | null | null or String (can be set multiple times) | CircleCI context UUID to match | | `--dry-run` | false | Boolean | Indicates that you don't want npm to make any changes and that it should only report what it would have done. This can be passed into any of the commands that modify your local installation, eg, `install`, `update`, `dedupe`, `uninstall`, as well as `pack` and `publish`. Note: This is NOT honored by other network related commands, eg `dist-tags`, `owner`, etc. | | `--json` | false | Boolean | Whether or not to output JSON data, rather than the normal output. * In `npm pkg set` it enables parsing set values with JSON.parse() before saving them to your `package.json`. Not supported by all npm commands. | | `--registry` | "https://registry.npmjs.org/" | URL | The base URL of the npm registry. | | `--yes`, `-y` | null | null or Boolean | Automatically answer "yes" to any prompts that npm might print on the command line. | ### `npm trust list` List trusted relationships for a package #### Synopsis ```bash npm trust list [package] ``` #### Flags | Flag | Default | Type | Description | | --- | --- | --- | --- | | `--json` | false | Boolean | Whether or not to output JSON data, rather than the normal output. * In `npm pkg set` it enables parsing set values with JSON.parse() before saving them to your `package.json`. Not supported by all npm commands. | | `--registry` | "https://registry.npmjs.org/" | URL | The base URL of the npm registry. | ### `npm trust revoke` Revoke a trusted relationship for a package #### Synopsis ```bash npm trust revoke [package] --id= ``` #### Flags | Flag | Default | Type | Description | | --- | --- | --- | --- | | `--id` | null | String (required) | ID of the trusted relationship to revoke | | `--dry-run` | false | Boolean | Indicates that you don't want npm to make any changes and that it should only report what it would have done. This can be passed into any of the commands that modify your local installation, eg, `install`, `update`, `dedupe`, `uninstall`, as well as `pack` and `publish`. Note: This is NOT honored by other network related commands, eg `dist-tags`, `owner`, etc. | | `--registry` | "https://registry.npmjs.org/" | URL | The base URL of the npm registry. | ### See Also * [npm publish](/commands/npm-publish) * [npm token](/commands/npm-token) * [npm access](/commands/npm-access) * [npm config](/commands/npm-config) * [npm registry](/using-npm/registry)