https://github.com/cipher-fox/nestjs-cryptography
Secure NestJS cryptography module 🔐
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (13.3%) to scientific vocabulary
Keywords
Repository
Secure NestJS cryptography module 🔐
Basic Info
- Host: GitHub
- Owner: cipher-fox
- License: mit
- Language: MDX
- Default Branch: main
- Homepage: https://nestjs-cryptography.thewolfx41.dev
- Size: 2.08 MB
Statistics
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 2
- Releases: 8
Topics
Metadata Files
README.md
NestJS - Cryptography
Quick Start
Introduction
This library was created to address a common problem encountered when performing cryptographic operations in our projects. It simplifies and streamlines the process, making it easier to implement secure and efficient cryptographic solutions. Additionally, it helps avoid common mistakes, such as the reuse of initialization vectors, reuse of encryption keys, or simple the use of keys that are not cryptographically secure.
Our library employs modern cryptographic standards to provide robust security and protect your data against advanced threats. We utilize a suite of trusted algorithms and practices recognized in the cryptographic community:
- Argon2: A cutting-edge key derivation function designed to resist GPU and ASIC attacks, making it highly effective against brute-force attempts. It offers configurable memory and time costs to balance performance and security.
- SHA3: The latest member of the Secure Hash Algorithm family, SHA3 provides enhanced security over its predecessors (SHA-1 and SHA-2) and is resilient against known cryptographic attacks.
- AES-256-GCM: Advanced Encryption Standard with a 256-bit key in Galois/Counter Mode ensures both data confidentiality and integrity. AES-256-GCM is widely used and trusted for its high level of security and performance.
- SHAKE256: A versatile extendable-output function (XOF) from the SHA-3 family, SHAKE256 allows for variable-length output, making it suitable for a variety of cryptographic applications like key generation and hashing.
- HKDF-SHA3-256: A HMAC-based Key Derivation Function using SHA3-256 as the underlying hash function. HKDF-SHA3-256 ensures secure and reliable derivation of cryptographic keys from a master secret.
- HMAC-SHA3-256: A mechanism for message authentication using SHA3-256. HMAC-SHA3-256 provides data integrity and authenticity by allowing verification that a message has not been altered.
- Constant-Time Secret Comparisons: To protect against timing attacks, our library implements constant-time algorithms for comparing secrets. This means the time taken to perform the comparison does not depend on the data being compared, preventing attackers from inferring information based on execution time.
Installation
This package are available on the npm registry.
bash
yarn add nestjs-cryptography
or
bash
npm install nestjs-cryptography
Usage on Services
To access cryptography methods from our CryptographyService, you could inject it using standard constructor injection
```typescript import { Injectable } from '@nestjs/common'; import { CryptographyService } from 'nestjs-cryptography';
@Injectable() export class SomeService { constructor( // Inject using constructor injection private readonly cryptographyService: CryptographyService ) {}
async someMethod(): Promise
Configuration
Once the installation is complete, the CryptographyModule can be configured as any other
Nest package with forRoot or forRootAsync methods.
You could see the complete available settings here
```typescript title="app.module.ts" import { CryptographyModule, CryptographyOptionsInterface, } from 'nestjs-cryptography';
@Module({
imports: [
CryptographyModule.forRoot
[!TIP] Like other factory providers, our factory function can be async and can inject dependencies through inject. For example, you mat want to get the configuration using the
ConfigurationModule, so to do this you should use theforRootAsyncmethod ⬇️⬇️⬇️.
```typescript title="app.module.ts" import { CryptographyModule, CryptographyOptionsInterface, } from 'nestjs-cryptography';
@Module({
imports: [
CryptographyModule.forRootAsync
The forRoot() and forRootAsync method takes an options object as an argument.
These options are passed through to the underlying cryptographic operations of the instance module.
[!NOTE] Please take a look at the documentation site to see the available methods and the complete configuration
GitHub Events
Total
- Issue comment event: 1
- Push event: 2
- Pull request event: 3
- Create event: 3
Last Year
- Issue comment event: 1
- Push event: 2
- Pull request event: 3
- Create event: 3
Packages
- Total packages: 1
-
Total downloads:
- npm 93 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 10
- Total maintainers: 1
npmjs.org: nestjs-cryptography
Secure NestJS cryptography module 🔐
- Homepage: https://nestjs-cryptography.cypher-fox.com
- License: MIT
-
Latest release: 3.2.3
published 7 months ago