/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/get-identity.js (802B)
const npmFetch = require('npm-registry-fetch') module.exports = async (npm, opts) => { const { registry } = opts // First, check if we have a user/pass-based auth const creds = npm.config.getCredentialsByURI(registry) if (creds.username) { return creds.username } // No username, but we have other credentials; fetch the username from registry if (creds.token || creds.certfile && creds.keyfile) { const registryData = await npmFetch.json('/-/whoami', { ...opts }) if (typeof registryData?.username === 'string') { return registryData.username } } // At this point, even if they have a credentials object, it doesn't have a // valid token. throw Object.assign( new Error('This command requires you to be logged in.'), { code: 'ENEEDAUTH' } ) }