Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sinuoslabs/nestjs-hasher
NestJS library for hashing
https://github.com/sinuoslabs/nestjs-hasher
argon bcrypt hash nest nestjs typescript
Last synced: 2 months ago
JSON representation
NestJS library for hashing
- Host: GitHub
- URL: https://github.com/sinuoslabs/nestjs-hasher
- Owner: sinuoslabs
- License: mit
- Created: 2021-12-06T07:50:40.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-22T10:52:41.000Z (9 months ago)
- Last Synced: 2024-04-22T12:02:33.003Z (9 months ago)
- Topics: argon, bcrypt, hash, nest, nestjs, typescript
- Language: TypeScript
- Size: 2.92 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# 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](https://nestjs.com/) framework.## Contents
- [Installation](#installation)
- [Usage](#usage)
- [Bcrypt](#bcrypt)
- [Argon](#argon)
- [Available methods](#available-methods)
- [Changelog](#changelog)
- [Testing](#testing)
- [Security](#security)
- [Contributing](#contributing)
- [License](#license)## Installation
To use the library you must execute the command below in your project.
```bash
$ 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](https://www.npmjs.com/package/bcrypt)
```typescript
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](https://www.npmjs.com/package/argon2)
```typescript
import { Module } from '@nestjs/common';
import { NestjsHasherModule } from 'nestjs-hasher';@Module({
imports: [
NestjsHasherModule.register({
provider: 'argon',
}),
],
})
export class AppModule {}
```### Service
```typescript
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](CHANGELOG.md) for more information what has changed recently.
## Testing
```bash
$ npm run test
```## Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## License
The MIT License (MIT). Please see [License File](LICENSE) for more information.