# young1ll/hashbin architecture

> Architecture diagram of the GitHub repository young1ll/hashbin, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/young1ll/hashbin
- Repository: https://github.com/young1ll/hashbin

## Overview

##### Main Components

a. Core Module Layer:
- HashbinModule (Main entry point)
- HashbinService (Core service orchestrator)

b. Provider Layer (Hashing Implementations):
- Bcrypt Service
- Argon2 Service
- PBKDF2 Service
- RSA Service

c. Utilities Layer:
- Validators
- Decorators
- Utility Functions

**┌─────────────────────────────────────────────┐**
- Client Application              │
- ┘
- ↓
**┌─────────────────────────────────────────────┐**
- Hashbin Module                  │
- ┤
- Hashbin Service                 │
- ┘
- ↓
**┌─────────────────────────────────────────────┐**
- Hash Providers Layer              │
- ┬──────────┬──────────┬───────────┤
- Bcrypt  │  Argon2  │  PBKDF2  │    RSA    │
- ┴──────────┴──────────┴───────────┘
- ↓
**┌─────────────────────────────────────────────┐**
- Utilities Layer                 │
- ┬──────────┬──────────┬───────────┤
- Validators│Decorators│  Utils   │  Helpers  │
- ┴──────────┴──────────┴───────────┘

##### Important Elements to Highlight

a. Module Registration Flow:
- How HashbinModule can be imported into NestJS applications
- Configuration options and provider registration

b. Service Implementation Details:
- Relationship between HashbinService and individual provider services
- How the provider selection works

c. Utility Integration:
- How validators and decorators integrate with the main module
- Validation flow for hashed values

##### Technical Details

- Supported hashing algorithms (Bcrypt, Argon2, PBKDF2, RSA)
- Validation decorator flow
- Utility function integration points
- Testing infrastructure integration

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client ["Client Application"]
        App[NestJS Application]
    end

    subgraph Core ["Core Module Layer"]
        HashMod["HashbinModule"]
        HashServ["HashbinService"]
        HashConst["Module Constants"]
    end

    subgraph Providers ["Hash Providers Layer"]
        BcryptS["Bcrypt Service"]
        Argon2S["Argon2 Service"]
        PBKDF2S["PBKDF2 Service"]
        RSAS["RSA Service"]
    end

    subgraph Utils ["Utilities Layer"]
        Valid["Validators"]
        Decor["Decorators"]
        UtilF["Utility Functions"]
        direction TB
        subgraph HashChecks ["Hash Checking Utils"]
            ArgonUtil["Argon2 Checker"]
            BcryptUtil["Bcrypt Checker"]
            MD5Util["MD5 Checker"]
            SHAUtil["SHA Checker"]
        end
    end

    %% Relationships
    App --> HashMod
    HashMod --> HashServ
    HashServ --> BcryptS
    HashServ --> Argon2S
    HashServ --> PBKDF2S
    HashServ --> RSAS
    HashServ --> Valid
    HashServ --> Decor
    HashServ --> UtilF
    HashMod --> HashConst

    %% Click Events
    click HashMod "https://github.com/young1ll/hashbin/blob/main/lib/hashbin.module.ts"
    click HashServ "https://github.com/young1ll/hashbin/blob/main/lib/services/hashbin.service.ts"
    click BcryptS "https://github.com/young1ll/hashbin/blob/main/lib/services/bcrypt.service.ts"
    click Argon2S "https://github.com/young1ll/hashbin/blob/main/lib/services/argon2.service.ts"
    click PBKDF2S "https://github.com/young1ll/hashbin/blob/main/lib/services/pbkdf2.service.ts"
    click RSAS "https://github.com/young1ll/hashbin/blob/main/lib/services/rsa.service.ts"
    click Valid "https://github.com/young1ll/hashbin/blob/main/lib/utils/is-hashed-validator.decorator.ts"
    click Decor "https://github.com/young1ll/hashbin/blob/main/lib/utils/is-hashed-validator.decorator.ts"
    click ArgonUtil "https://github.com/young1ll/hashbin/blob/main/lib/utils/is-argon2.util.ts"
    click BcryptUtil "https://github.com/young1ll/hashbin/blob/main/lib/utils/is-bcrypt.util.ts"
    click MD5Util "https://github.com/young1ll/hashbin/blob/main/lib/utils/is-md5.util.ts"
    click SHAUtil "https://github.com/young1ll/hashbin/blob/main/lib/utils/is-sha.util.ts"
    click HashConst "https://github.com/young1ll/hashbin/blob/main/lib/hashbin.constant.ts"

    %% Styling
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef core fill:#b3e0ff,stroke:#333,stroke-width:2px
    classDef provider fill:#98FB98,stroke:#333,stroke-width:2px
    classDef util fill:#FFE4B5,stroke:#333,stroke-width:2px
    classDef client fill:#DCDCDC,stroke:#333,stroke-width:2px

    class App client
    class HashMod,HashServ,HashConst core
    class BcryptS,Argon2S,PBKDF2S,RSAS provider
    class Valid,Decor,UtilF,ArgonUtil,BcryptUtil,MD5Util,SHAUtil util
```
