# @dreamtexx/nestjs-crypto

> Simple Crypto Module for NestJS

Latest version **0.0.5** (published 2023-01-14) · ISC license · 0 weekly downloads

## Install

```sh
npm install @dreamtexx/nestjs-crypto
pnpm add @dreamtexx/nestjs-crypto
yarn add @dreamtexx/nestjs-crypto
bun add @dreamtexx/nestjs-crypto
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2023-01-14 |
| First published | 2021-02-03 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | DreamTexX |
| Maintainers | dreamtexx |
| Keywords | crypto, nestjs |

## Links

- npm: https://www.npmjs.com/package/@dreamtexx/nestjs-crypto
- Repository: https://github.com/DreamTexX/nestjs-crypto
- Homepage: https://github.com/DreamTexX/nestjs-crypto#readme
- Issues: https://github.com/DreamTexX/nestjs-crypto/issues
- npm.io page: https://npm.io/package/@dreamtexx/nestjs-crypto

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 0.0.5 (latest) — 2023-01-14
- 0.0.4 — 2023-01-09
- 0.0.3 — 2021-02-03
- 0.0.2 — 2021-02-03
- 0.0.1 — 2021-02-03

## README

# NestJS Password Crypto
This is a very basic module for hashing and verifying password.

## Installation

With npm
```shell
$ npm install --save @dreamtexx/nestjs-crypto
```

With yarn
```shell
$ yarn add @dreamtexx/nestjs-crypto
```

## Usage

Import CryptoModule in your root module.

**app.module.ts**
```ts
import { Module } from '@nestjs/common';
import { CryptoModule } from '@dreamtexx/nestjs-crypto';

@Module({
  imports: [
    CryptoModule.forRoot({
      pepper: 'SomeSecretString', //required
      saltLength: 16, //optional, default 16
      keyLength: 64, //optional, default 64
      delimiter: ':', //optional, default ':'
    }),
  ],
})
export class AppModule {}
```

Use `CryptoService` to hash or verify passwords.

**app.service.ts**
```ts
import { Injectable } from '@nestjs/common';
import { CryptoService } from '@dreamtexx/nestjs-crypto';

@Injectable()
export class AppService {
  constructor(private cryptoService: CryptoService) {}

  public getHash(password): string {
    return this.cryptoService.hash(password);
  }

  public checkPassword(password): boolean {
    // get hash from database for example:
    const hash = "...";
    return this.cryptoService.verify(password, hash);
  }
}
```

---
_Source: https://npm.io/package/@dreamtexx/nestjs-crypto · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
