@friends-of-software/nest-pwned-password
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Description

@friends-of-software/nest-pwned-password package for Nest, useful to check if a password has been pwned before. The service calls the haveibeenpwned API in order to see if the password was leaked.

Installation

$ npm i --save @friends-of-software/nest-pwned-password

Example

After you import the PwnedPasswordModule in your module, you can use the PwnedPasswordService.

import { Controller, Get } from '@nestjs/common';
import { PwnedPasswordService } from '@friends-of-software/nest-pwned-password';

@Controller()
export class AppController {
  constructor(
    private pwnedPasswordService: PwnedPasswordService,
  ) {}

  @Post('has-been-pwned')
  async hasBeenPwned(@Body() hasBeenPwnedDto: HasBeenPwnedDto): Promise<{ pwned: boolean; timesPwned: number }> {
    return this.pwnedPasswordService.hasPasswordBeenPwned(hasBeenPwnedDto.password);
  }
}

Package Sidebar

Install

npm i @friends-of-software/nest-pwned-password

Weekly Downloads

0

Version

1.0.4

License

MIT

Unpacked Size

11.5 kB

Total Files

13

Last publish

Collaborators

  • dominicbachmann