Lines Matching defs:const
0 const inspect = require('util').inspect
2 const { URL } = require('url')
3 const log = require('../utils/log-shim.js')
4 const npmProfile = require('npm-profile')
5 const qrcodeTerminal = require('qrcode-terminal')
6 const Table = require('cli-table3')
8 const otplease = require('../utils/otplease.js')
9 const pulseTillDone = require('../utils/pulse-till-done.js')
10 const readUserInfo = require('../utils/read-user-info.js')
12 const qrcode = url =>
15 const knownProfileKeys = [
28 const writableProfileKeys = [
38 const BaseCommand = require('../base-command.js')
85 const [subcmd, ...opts] = args
108 const tfa = 'two-factor auth'
109 const info = await pulseTillDone.withPromise(
123 const cleaned = {}
124 for (const key of knownProfileKeys) {
128 const unknownProfileKeys = Object.keys(info).filter((k) => !(k in cleaned))
129 for (const key of unknownProfileKeys) {
144 const values = args // comma or space separated
153 for (const key of Object.keys(info)) {
161 const table = new Table()
162 for (const key of Object.keys(cleaned)) {
172 const conf = { ...this.npm.flatOptions }
173 const prop = (args[0] || '').toLowerCase().trim()
177 const readPasswords = async () => {
178 const newpassword = await readUserInfo.password('New password: ')
179 const confirmedpassword = await readUserInfo.password(' Again: ')
205 const current = await readUserInfo.password('Current password: ')
206 const newpassword = await readPasswords()
212 const user = await pulseTillDone.withPromise(npmProfile.get(conf))
213 const newUser = {}
215 for (const key of writableProfileKeys) {
221 const result = await otplease(this.npm, conf, c => npmProfile.set(newUser, c))
239 const mode = args[0] || 'auth-and-writes'
257 const info = {
265 const creds = this.npm.config.getCredentialsByURI(this.npm.config.get('registry'))
266 const auth = {}
273 const basic = Buffer.from(creds.auth, 'base64').toString().split(':', 2)
286 const result = await npmProfile.createToken(
306 const password = await readUserInfo.password()
310 const userInfo = await pulseTillDone.withPromise(
314 const conf = { ...this.npm.flatOptions }
329 const challenge = await pulseTillDone.withPromise(
338 const badResponse = typeof challenge.tfa !== 'string'
347 const otpauth = new URL(challenge.tfa)
348 const secret = otpauth.searchParams.get('secret')
349 const code = await qrcode(challenge.tfa)
355 const interactiveOTP =
360 const result = await npmProfile.set({ tfa: [interactiveOTP] }, conf)
371 for (const tfaCode of result.tfa) {
377 const conf = { ...this.npm.flatOptions }
378 const info = await pulseTillDone.withPromise(npmProfile.get(conf))
385 const password = await readUserInfo.password()
388 const msg = 'Enter one-time password: '