Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const handler = async ({
password,
raw,
}: PwHandlerOptions): Promise => {
if (!raw) {
spinner.start();
}
try {
const pwnCount = await pwnedPassword(password, { userAgent });
if (pwnCount) {
const pwnedMessage = `Oh no — pwned ${pwnCount} times!`;
if (!raw) {
spinner.warn(pwnedMessage);
} else {
logger.log(pwnedMessage);
}
} else {
const successMessage = 'Good news — no pwnage found!';
if (!raw) {
spinner.succeed(successMessage);
} else {
logger.log(successMessage);
}
}
} catch (err) {