PATH:
opt
/
alt
/
alt-nodejs19
/
root
/
usr
/
lib
/
node_modules
/
npm
/
lib
/
utils
const log = require('./log-shim') async function otplease (npm, opts, fn) { try { return await fn(opts) } catch (err) { if (!process.stdin.isTTY || !process.stdout.isTTY) { throw err } if (isWebOTP(err)) { log.disableProgress() const webAuth = require('./web-auth') const openUrlPrompt = require('./open-url-prompt') const openerPromise = (url, emitter) => openUrlPrompt( npm, url, 'Authenticate your account at', 'Press ENTER to open in the browser...', emitter ) const otp = await webAuth(openerPromise, err.body.authUrl, err.body.doneUrl, opts) return await fn({ ...opts, otp }) } if (isClassicOTP(err)) { const readUserInfo = require('./read-user-info.js') const otp = await readUserInfo.otp('This operation requires a one-time password.\nEnter OTP:') return await fn({ ...opts, otp }) } throw err } } function isWebOTP (err) { if (err.code === 'EOTP' && err.body) { return err.body.authUrl && err.body.doneUrl } return false } function isClassicOTP (err) { return err.code === 'EOTP' || (err.code === 'E401' && /one-time pass/.test(err.body)) } module.exports = otplease
[-] error-message.js
[open]
[+]
..
[-] display.js
[open]
[-] validate-lockfile.js
[open]
[-] reify-finish.js
[open]
[+]
config
[-] npm-usage.js
[open]
[-] did-you-mean.js
[open]
[-] completion.sh
[open]
[-] pulse-till-done.js
[open]
[-] completion.fish
[open]
[-] read-user-info.js
[open]
[-] explain-eresolve.js
[open]
[-] audit-error.js
[open]
[-] log-shim.js
[open]
[-] get-identity.js
[open]
[-] cmd-list.js
[open]
[+]
completion
[-] auth.js
[open]
[-] tar.js
[open]
[-] explain-dep.js
[open]
[-] ansi-trim.js
[open]
[-] open-url.js
[open]
[-] replace-info.js
[open]
[-] format-bytes.js
[open]
[-] is-windows.js
[open]
[-] log-file.js
[open]
[-] update-notifier.js
[open]
[-] format-search-stream.js
[open]
[-] otplease.js
[open]
[-] open-url-prompt.js
[open]
[-] web-auth.js
[open]
[-] exit-handler.js
[open]
[-] timers.js
[open]
[-] reify-output.js
[open]
[-] ping.js
[open]
[-] queryable.js
[open]