Skip to content

Commit 6a27a7b

Browse files
fritzylukekarrys
authored andcommitted
feat: deprecated key, cert config options and updated registry scoped auth docs
1 parent 0d94f52 commit 6a27a7b

File tree

4 files changed

+66
-32
lines changed

4 files changed

+66
-32
lines changed

docs/lib/content/configuring-npm/npmrc.md

+9
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,15 @@ The settings `_auth`, `_authToken`, `username` and `_password` must all be
9797
scoped to a specific registry. This ensures that `npm` will never send
9898
credentials to the wrong host.
9999

100+
The full list is:
101+
- `_auth` (base64 authentication string)
102+
- `_authToken` (authentication token)
103+
- `username`
104+
- `_password`
105+
- `email`
106+
- `certfile` (path to certificate file)
107+
- `keyfile` (path to key file)
108+
100109
In order to scope these values, they must be prefixed by a URI fragment.
101110
If the credential is meant for any request to a registry on a single host,
102111
the scope may look like `//registry.npmjs.org/:`. If it must be scoped to a

docs/lib/content/using-npm/registry.md

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ used, which is supplied by the [`registry` config](/using-npm/config#registry)
3131
parameter. See [`npm config`](/commands/npm-config),
3232
[`npmrc`](/configuring-npm/npmrc), and [`config`](/using-npm/config) for more on
3333
managing npm's configuration.
34+
Authentication configuration such as auth tokens and certificates are configured
35+
specifically scoped to an individual registry. See
36+
[Auth Related Configuration](/configuring-npm/npmrc#auth-related-configuration)
3437

3538
When the default registry is used in a package-lock or shrinkwrap is has the
3639
special meaning of "the currently configured registry". If you create a lock

lib/utils/config/definitions.js

+14
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,13 @@ define('cert', {
422422
It is _not_ the path to a certificate file, though you can set a registry-scoped
423423
"certfile" path like "//other-registry.tld/:certfile=/path/to/cert.pem".
424424
`,
425+
deprecated: `
426+
\`key\` and \`cert\` are no longer used for most registry operations.
427+
Use registry scoped \`keyfile\` and \`certfile\` instead.
428+
Example:
429+
//other-registry.tld/:keyfile=/path/to/key.pem
430+
//other-registry.tld/:certfile=/path/to/cert.crt
431+
`,
425432
flatten,
426433
})
427434

@@ -1124,6 +1131,13 @@ define('key', {
11241131
It is _not_ the path to a key file, though you can set a registry-scoped
11251132
"keyfile" path like "//other-registry.tld/:keyfile=/path/to/key.pem".
11261133
`,
1134+
deprecated: `
1135+
\`key\` and \`cert\` are no longer used for most registry operations.
1136+
Use registry scoped \`keyfile\` and \`certfile\` instead.
1137+
Example:
1138+
//other-registry.tld/:keyfile=/path/to/key.pem
1139+
//other-registry.tld/:certfile=/path/to/cert.crt
1140+
`,
11271141
flatten,
11281142
})
11291143

tap-snapshots/test/lib/docs.js.test.cjs

+40-32
Original file line numberDiff line numberDiff line change
@@ -750,23 +750,6 @@ npm exec --package yo --package generator-node --call "yo node"
750750
\`\`\`
751751
752752
753-
#### \`cert\`
754-
755-
* Default: null
756-
* Type: null or String
757-
758-
A client certificate to pass when accessing the registry. Values should be
759-
in PEM format (Windows calls it "Base-64 encoded X.509 (.CER)") with
760-
newlines replaced by the string "\\n". For example:
761-
762-
\`\`\`ini
763-
cert="-----BEGIN CERTIFICATE-----\\nXXXX\\nXXXX\\n-----END CERTIFICATE-----"
764-
\`\`\`
765-
766-
It is _not_ the path to a certificate file, though you can set a
767-
registry-scoped "certfile" path like
768-
"//other-registry.tld/:certfile=/path/to/cert.pem".
769-
770753
#### \`ci-name\`
771754
772755
* Default: The name of the current CI system, or \`null\` when not on a known CI
@@ -1200,21 +1183,6 @@ Whether or not to output JSON data, rather than the normal output.
12001183
12011184
Not supported by all npm commands.
12021185
1203-
#### \`key\`
1204-
1205-
* Default: null
1206-
* Type: null or String
1207-
1208-
A client key to pass when accessing the registry. Values should be in PEM
1209-
format with newlines replaced by the string "\\n". For example:
1210-
1211-
\`\`\`ini
1212-
key="-----BEGIN PRIVATE KEY-----\\nXXXX\\nXXXX\\n-----END PRIVATE KEY-----"
1213-
\`\`\`
1214-
1215-
It is _not_ the path to a key file, though you can set a registry-scoped
1216-
"keyfile" path like "//other-registry.tld/:keyfile=/path/to/key.pem".
1217-
12181186
#### \`legacy-peer-deps\`
12191187
12201188
* Default: false
@@ -1975,6 +1943,27 @@ When set to \`dev\` or \`development\`, this is an alias for \`--include=dev\`.
19751943
19761944
\`--cache-min=9999 (or bigger)\` is an alias for \`--prefer-offline\`.
19771945
1946+
#### \`cert\`
1947+
1948+
* Default: null
1949+
* Type: null or String
1950+
* DEPRECATED: \`key\` and \`cert\` are no longer used for most registry
1951+
operations. Use registry scoped \`keyfile\` and \`certfile\` instead. Example:
1952+
//other-registry.tld/:keyfile=/path/to/key.pem
1953+
//other-registry.tld/:certfile=/path/to/cert.crt
1954+
1955+
A client certificate to pass when accessing the registry. Values should be
1956+
in PEM format (Windows calls it "Base-64 encoded X.509 (.CER)") with
1957+
newlines replaced by the string "\\n". For example:
1958+
1959+
\`\`\`ini
1960+
cert="-----BEGIN CERTIFICATE-----\\nXXXX\\nXXXX\\n-----END CERTIFICATE-----"
1961+
\`\`\`
1962+
1963+
It is _not_ the path to a certificate file, though you can set a
1964+
registry-scoped "certfile" path like
1965+
"//other-registry.tld/:certfile=/path/to/cert.pem".
1966+
19781967
#### \`dev\`
19791968
19801969
* Default: false
@@ -2041,6 +2030,25 @@ Alias for \`--init-module\`
20412030
20422031
Alias for \`--init-version\`
20432032
2033+
#### \`key\`
2034+
2035+
* Default: null
2036+
* Type: null or String
2037+
* DEPRECATED: \`key\` and \`cert\` are no longer used for most registry
2038+
operations. Use registry scoped \`keyfile\` and \`certfile\` instead. Example:
2039+
//other-registry.tld/:keyfile=/path/to/key.pem
2040+
//other-registry.tld/:certfile=/path/to/cert.crt
2041+
2042+
A client key to pass when accessing the registry. Values should be in PEM
2043+
format with newlines replaced by the string "\\n". For example:
2044+
2045+
\`\`\`ini
2046+
key="-----BEGIN PRIVATE KEY-----\\nXXXX\\nXXXX\\n-----END PRIVATE KEY-----"
2047+
\`\`\`
2048+
2049+
It is _not_ the path to a key file, though you can set a registry-scoped
2050+
"keyfile" path like "//other-registry.tld/:keyfile=/path/to/key.pem".
2051+
20442052
#### \`legacy-bundling\`
20452053
20462054
* Default: false

0 commit comments

Comments
 (0)