0.0.4 • Published 1 year ago

nest-bcrypt v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Description

Bcrypt Module for Nest.

Installation

$ npm install nest-bcrypt

Usage

Injecting the BcryptModule

import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { BcryptModule } from 'nest-bcrypt';

@Module({
  imports: [BcryptModule.register({ salt: 10 })],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}

Using the BcryptService

import { Injectable } from '@nestjs/common';
import { BcryptService } from 'nest-bcrypt';

@Injectable()
export class AppService {
  constructor(private readonly bcryptService: BcryptService) {}

  public async hashData(data: string) {
    return this.bcryptService.hash(data, 10);
  }
}

Stay in touch

License

nest-bcrypt is MIT licensed.