Giter Club home page Giter Club logo

sqidsexample's Introduction

Sqids Example

Sqids is a library that enables you to generate YouTube-like identifiers (e.g., “123” -> “yc3”, “yc3” -> “123”) and provides value encoding/decoding capabilities.

In databases, two common methods are widely used for identity verification and data association: UUIDs (Universally Unique Identifiers) and auto-increment IDs. Each method has its own set of advantages and disadvantages.

UUIDs are universally unique identifiers that are mostly generated randomly. This feature makes UUIDs particularly ideal for distributed systems because the likelihood of collision is extremely low. However, the length and random structure of UUIDs can negatively affect readability for humans and database performance.

On the other hand, auto-increment IDs show a sequential and predictable increase. This facilitates readability for humans and is efficient for database indexing. However, this predictability can pose a security risk. Especially in web applications, the predictability of sequential IDs can allow malicious users unauthorized access to database records.

In this project, Sqids aims to improve the readability for humans and database performance while maintaining the uniqueness advantage offered by UUIDs, by addressing the security vulnerability of auto-increment IDs. This example securely exposes encrypted IDs to the outside world and decrypts incoming encrypted IDs for use within the application.

This approach provides an additional layer of security against malicious access attempts and enhances the security of database records. At the same time, it offers a solution suitable for the needs of modern web applications by facilitating system integration and data exchange.

sequenceDiagram
  autonumber
    actor Client
    participant Model
    participant Sqids
    participant Controller
    participant Database

    note over Client,Controller: API Request
    Client-->>Model: Encrypted Data
    Model-->>Sqids: Encrypted Data
    Sqids-->>Model: Decrypted Data
    Model->>Controller: Decrypted Model
    Controller->>Database: CRUD
    Database-->>Controller: Response
    Controller->>Model: Decrypted Model
    Model-->>Sqids: Decrypted Data
    Sqids-->>Model: Encrypted Data
    Model-->>Client: Encrypted Data
    note over Client,Controller: API Response
Loading

Application Settings

You can change the relevant fields in the appsettings.json file. Passwords will be generated using the characters in the Alphabet field. To shuffle the characters, you can use the shuffle-letters tool. For detailed information Sqids.

 "Sqids": {
    "Alphabet": "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
    "MinLength": 6,
    "BlockList": [
      "1di0t",
      "1diot"
    ]
  }

sqidsexample's People

Contributors

aliozandinler avatar

Stargazers

isamercan avatar UĞUR KAYA avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.