Coder Social home page Coder Social logo

slynova-org / hash Goto Github PK

View Code? Open in Web Editor NEW
10.0 10.0 2.0 62 KB

๐Ÿ” Framework-agnostic driver based system for password hashing algorithms in Node.js

JavaScript 1.10% TypeScript 98.90%
argon2 bcrypt framework-agnostic hash hashing nodejs

hash's People

Contributors

dependabot-preview[bot] avatar romainlanz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

hash's Issues

Proposal for API changes

The hash module is a great package when using standalone. However, I was thinking of making handful of changes to make it jell well in the AdonisJs ecosystem.

Using AdonisJs manager

The @poppinss/manager package is something I am planning to use for every component, which uses the builder pattern or has driver based API.

The package assumes that you will make use of the IoC container, which makes sense for AdonisJs, but not for packages to be used standalone. To encounter that, we need to write bit of extra code and hide the IoC container layer from the end user.

Main hash class

class Hash extends Manager {
  constructor (container) {
    super(container)
  }
}

Now when we register the Hash class as a provider to the IoC container, we can provider the Ioc container reference to the class constructor.

When using it standalone, we can wrap this class inside another class.

class HashStandalone extends Hash {
  constructor () {
    super({}) // passing empty object
  }
}

The HashStandalone is shared for standalone usage.

Using driver over use.

Since, I am planning to keep the API identical everywhere, I would love to replace use with driver method, and driver method already exists on the Manager class.

Using PHC string format

The Phc string format encodes the hashing info within the hash string and it makes it possible to upgrade older hash values whenever required.

Adding needsRehash

You shared this with me earlier and I think, it's a good idea to add support for needsRehash and we will need PHC string format for that.

WHAT YEAH THINK?

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.