2025-08-22 16:11:42 +02:00
2025-08-22 16:11:42 +02:00
2025-08-21 20:11:50 +02:00
wip
2025-08-21 20:52:08 +02:00
2025-08-20 22:56:28 +02:00
2025-08-22 16:11:42 +02:00
2025-08-22 16:11:42 +02:00
2025-08-22 16:11:42 +02:00
wip
2025-08-21 21:46:59 +02:00

Password Hasher

This Service is for NestJs and can create a Hash of a Password and verify it.

Install

npm i --save @apihub24/password-hasher

Dependencies

Dependency Description
@nestjs/config use the NestJs Config Module to get the Password Salt Rounds with key PASSWORD_HASH_SALT_ROUNDS
Exported Injection Keys
@apihub24/password_service

Usage

// register the PasswordHashService as Provider in a NestJs Module
import { PasswordHashService } from '@apihub24/password-hasher';

@Module({
  // import the ConfigModule! not forget to set the PASSWORD_HASH_SALT_ROUNDS in Config otherwise 10 was used
  imports: [ConfigModule.forRoot()]
  providers: [PasswordHashService],
})
...

// inject the PasswordHashService
export class SomeOtherService {
  constructor(@Inject(PasswordHashService) passwordHashService: PasswordHashService) {}

  async test(password: string) {
    // generate the hash
    const hash = await this.passwordHashService(password);

    // compare a plaintext Password with Hash
    await this.passwordHashService.verify(password, hash);
  }
}
Description
No description provided
Readme MIT 482 KiB
Languages
TypeScript 100%