`PasswordService` is a custom json service that can be used in a NestJS to stringify or parse a json data
npm install abs-nestjs-password-servicePasswordService is a custom json service that can be used in a NestJS to stringify or parse a json data
To install the necessary dependencies, run:
``bash`
npm install abs-nestjs-password-service
1. Import the PasswordService into your module:
`typescript
import { Module } from '@nestjs/common';
import { PasswordService } from 'abs-nestjs-password-service';
@Module({
providers: [PasswordService],
exports: [PasswordService],
})
export class AppModule {}
`
2. Inject the PasswordService into your service or controller:
`typescript
import { Injectable } from '@nestjs/common';
import { PasswordService } from 'abs-nestjs-password-service';
@Injectable()
export class SomeService {
constructor(private readonly passwordServices: PasswordService) {}
someMethod() {
const hash = this.passwordService.hashPassword('password123');
console.log(hash);
console.log(this.passwordService.matchPassword('password123', hash));
}
}
``