@sinuos/nestjs-hasher
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

Nestjs Hasher

NestJS Hasher, is a module that combines several hash libraries into one such as bcrypt and argon. You can use them separately, without affecting anything. This library works only with the NestJS framework.

Contents

Installation

To use the library you must execute the command below in your project.

$ npm install @sinuos/nestjs-hasher

Usage

To use this library, you must declare the module in AppModule

Bcrypt

This integration works with this package Bcrypt

import { Module } from '@nestjs/common';
import { NestjsHasherModule } from 'nestjs-hasher';

@Module({
  imports: [
    NestjsHasherModule.register({
      provider: 'bcrypt',
      round: 10,
    }),
  ],
})
export class AppModule {}

Argon

This integration works with this package Argon

import { Module } from '@nestjs/common';
import { NestjsHasherModule } from 'nestjs-hasher';

@Module({
  imports: [
    NestjsHasherModule.register({
      provider: 'argon',
    }),
  ],
})
export class AppModule {}

Service

import { Injectable } from '@nestjs/common';
import { NestjsHasherService } from '@sinuos/nestjs-haasher';

@Injectable()
export class AppService {
    constructor(private readonly service: NestjsHasherService) { }
}

Available methods

Hash

hash(plainText) to hash a string

Check

check(plainText, hashedValue) to check if hashed value matched with your string

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ npm run test

Security

If you discover any security related issues, please email dao.houssene@gmail.com instead of using the issue tracker.

Contributing

Please see CONTRIBUTING for details.

License

The MIT License (MIT). Please see License File for more information.

Package Sidebar

Install

npm i @sinuos/nestjs-hasher

Weekly Downloads

1

Version

1.1.1

License

MIT

Unpacked Size

80 kB

Total Files

39

Last publish

Collaborators

  • houssenedao