/snap/node/11691/lib/node_modules/npm/lib/utils
NameSizeModeActions
audit-error.js10450644editdlrm
auth.js32910644editdlrm
cmd-list.js29590644editdlrm
completion.fish15960644editdlrm
completion.sh18980755editdlrm
did-you-mean.js11880644editdlrm
display.js157490644editdlrm
error-message.js151500644editdlrm
explain-dep.js36480644editdlrm
explain-eresolve.js26170644editdlrm
format-bytes.js6290644editdlrm
format-search-stream.js48080644editdlrm
format.js19570644editdlrm
get-identity.js8020644editdlrm
get-workspaces.js17480644editdlrm
installed-deep.js11290644editdlrm
installed-shallow.js5830644editdlrm
is-windows.js1770644editdlrm
log-file.js79710644editdlrm
npm-usage.js20640644editdlrm
open-url.js24140644editdlrm
output-error.js7670644editdlrm
ping.js2620644editdlrm
queryable.js97850644editdlrm
read-user-info.js19560644editdlrm
reify-finish.js8860644editdlrm
reify-output.js57880644editdlrm
sbom-cyclonedx.js53310644editdlrm
sbom-spdx.js46960644editdlrm
tar.js35520644editdlrm
timers.js21200644editdlrm
update-workspaces.js10130644editdlrm
validate-lockfile.js10230644editdlrm
verify-signatures.js122260644editdlrm
Edit: /snap/node/11691/lib/node_modules/npm/lib/utils/read-user-info.js (1956B)
const { read: _read } = require('read') const userValidate = require('npm-user-validate') const { log, input } = require('proc-log') const otpPrompt = `This command requires a one-time password (OTP) from your authenticator app. Enter one below. You can also pass one on the command line by appending --otp=123456. For more information, see: https://docs.npmjs.com/getting-started/using-two-factor-authentication Enter OTP: ` const passwordPrompt = 'npm password: ' const usernamePrompt = 'npm username: ' const emailPrompt = 'email (this IS public): ' const read = (...args) => input.read(() => _read(...args)) function readOTP (msg = otpPrompt, otp, isRetry) { if (isRetry && otp && /^[\d ]+$|^[A-Fa-f0-9]{64,64}$/.test(otp)) { return otp.replace(/\s+/g, '') } return read({ prompt: msg, default: otp || '' }) .then((rOtp) => readOTP(msg, rOtp, true)) } function readPassword (msg = passwordPrompt, password, isRetry) { if (isRetry && password) { return password } return read({ prompt: msg, silent: true, default: password || '' }) .then((rPassword) => readPassword(msg, rPassword, true)) } function readUsername (msg = usernamePrompt, username, isRetry) { if (isRetry && username) { const error = userValidate.username(username) if (error) { log.warn(error.message) } else { return Promise.resolve(username.trim()) } } return read({ prompt: msg, default: username || '' }) .then((rUsername) => readUsername(msg, rUsername, true)) } function readEmail (msg = emailPrompt, email, isRetry) { if (isRetry && email) { const error = userValidate.email(email) if (error) { log.warn(error.message) } else { return email.trim() } } return read({ prompt: msg, default: email || '' }) .then((username) => readEmail(msg, username, true)) } module.exports = { otp: readOTP, password: readPassword, username: readUsername, email: readEmail, }