Skip to content

Commit fea03d3

Browse files
iarnazkat
authored andcommitted
2fa: The great tfa → 2fa rename (#18845)
PR-URL: npm/npm#18845 Credit: @iarna Reviewed-By: @zkat
1 parent a93e0a5 commit fea03d3

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

doc/cli/npm-token.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ npm-token(1) -- Manage your authentication tokens
55

66
npm token list [--json|--parseable]
77
npm token create [--read-only] [--cidr=1.1.1.1/24,2.2.2.2/16]
8-
npm token delete <id|token>
8+
npm token revoke <id|token>
99

1010
## DESCRIPTION
1111

12-
This list you list, create and delete authentication tokens.
12+
This list you list, create and revoke authentication tokens.
1313

1414
* `npm token list`:
1515
Shows a table of all active authentication tokens. You can request this as
@@ -52,7 +52,7 @@ This list you list, create and delete authentication tokens.
5252
+----------------+--------------------------------------+
5353
```
5454

55-
* `npm token delete <token|id>`:
55+
* `npm token revoke <token|id>`:
5656
This removes an authentication token, making it immediately unusable. This can accept
5757
both complete tokens (as you get back from `npm token create` and will
5858
find in your `.npmrc`) and ids as seen in the `npm token list` output.

lib/profile.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ function config () {
8888
}
8989

9090
const knownProfileKeys = qw`
91-
name email ${'two factor auth'} fullname homepage
91+
name email ${'two-factor auth'} fullname homepage
9292
freenode twitter github created updated`
9393

9494
function get (args) {
95-
const tfa = 'two factor auth'
95+
const tfa = 'two-factor auth'
9696
const conf = config()
9797
return pulseTillDone.withPromise(profile.get(conf)).then((info) => {
9898
if (!info.cidr_whitelist) delete info.cidr_whitelist
@@ -205,7 +205,7 @@ function enable2fa (args) {
205205
}
206206
const mode = args[0] || 'auth-and-writes'
207207
if (mode !== 'auth-only' && mode !== 'auth-and-writes') {
208-
return Promise.reject(new Error(`Invalid two factor authentication mode "${mode}".\n` +
208+
return Promise.reject(new Error(`Invalid two-factor authentication mode "${mode}".\n` +
209209
'Valid modes are:\n' +
210210
' auth-only - Require two-factor authentication only when logging in\n' +
211211
' auth-and-writes - Require two-factor authentication when logging in AND when publishing'))
@@ -238,7 +238,7 @@ function enable2fa (args) {
238238
}
239239
})
240240
}).then(() => {
241-
log.info('profile', 'Setting two factor authentication to ' + mode)
241+
log.info('profile', 'Setting two-factor authentication to ' + mode)
242242
return pulseTillDone.withPromise(profile.set(info, conf))
243243
}).then((challenge) => {
244244
if (challenge.tfa === null) {
@@ -255,10 +255,10 @@ function enable2fa (args) {
255255
}).then((code) => {
256256
return readUserInfo.otp('And an OTP code from your authenticator: ')
257257
}).then((otp1) => {
258-
log.info('profile', 'Finalizing two factor authentication')
258+
log.info('profile', 'Finalizing two-factor authentication')
259259
return profile.set({tfa: [otp1]}, conf)
260260
}).then((result) => {
261-
output('TFA successfully enabled. Below are your recovery codes, please print these out.')
261+
output('2FA successfully enabled. Below are your recovery codes, please print these out.')
262262
output('You will need these to recover access to your account if you lose your authentication device.')
263263
result.tfa.forEach((c) => output('\t' + c))
264264
})

lib/token.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ module.exports = token
1515

1616
token.usage =
1717
'npm token list\n' +
18-
'npm token delete <tokenKey>\n' +
18+
'npm token revoke <tokenKey>\n' +
1919
'npm token create [--read-only] [--cidr=list]\n'
2020

21-
token.subcommands = ['list', 'delete', 'create']
21+
token.subcommands = ['list', 'revoke', 'create']
2222

2323
token.completion = function (opts, cb) {
2424
var argv = opts.conf.argv.remain
2525

2626
switch (argv[2]) {
2727
case 'list':
28-
case 'delete':
28+
case 'revoke':
2929
case 'create':
3030
return cb(null, [])
3131
default:
@@ -46,7 +46,7 @@ function token (args, cb) {
4646
withCb(list(), cb)
4747
break
4848
case 'delete':
49-
case 'rel':
49+
case 'revoke':
5050
case 'remove':
5151
case 'rm':
5252
withCb(rm(args.slice(1)), cb)
@@ -127,7 +127,7 @@ function list (args) {
127127

128128
function rm (args) {
129129
if (args.length === 0) {
130-
throw new Error('npm token delete <tokenKey>')
130+
throw new Error('npm token revoke <tokenKey>')
131131
}
132132
const conf = config()
133133
const toRemove = []

0 commit comments

Comments
 (0)