HEX
Server: Apache/2.4.65 (Debian)
System: Linux kubikelcreative 5.10.0-35-amd64 #1 SMP Debian 5.10.237-1 (2025-05-19) x86_64
User: www-data (33)
PHP: 8.4.13
Disabled: NONE
Upload Files
File: //proc/thread-self/root/usr/share/npm/lib/utils/otplease.js
const prompt = 'This operation requires a one-time password.\nEnter OTP:'
const readUserInfo = require('./read-user-info.js')

const isOtpError = err =>
  err.code === 'EOTP' || (err.code === 'E401' && /one-time pass/.test(err.body))

module.exports = otplease
function otplease (opts, fn) {
  opts = { prompt, ...opts }
  return Promise.resolve().then(() => fn(opts)).catch(err => {
    if (!isOtpError(err))
      throw err
    else if (!process.stdin.isTTY || !process.stdout.isTTY)
      throw err
    else {
      return readUserInfo.otp(opts.prompt)
        .then(otp => fn({ ...opts, otp }))
    }
  })
}